Merge tag 'samsung-soc-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk...
authorOlof Johansson <olof@lixom.net>
Sat, 26 Sep 2020 19:55:43 +0000 (12:55 -0700)
committerOlof Johansson <olof@lixom.net>
Sat, 26 Sep 2020 19:55:43 +0000 (12:55 -0700)
Samsung mach/soc changes for v5.10

1. Clear unneeded L2C-310 flag which presenc was triggering warning
   message.
2. Fix build of SAMSUNG_PM_DEBUG without MMU.
3. Minor cleanups and update of linux-samsung-soc mailing list in
   Maintainers.

* tag 'samsung-soc-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
  ARM: s3c64xx: bring back notes from removed debug-macro.S
  ARM: s3c24xx: fix Wunused-variable warning on !MMU
  ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
  MAINTAINERS: mark linux-samsung-soc list non-moderated
  ARM: exynos: clear L310_AUX_CTRL_NS_LOCKDOWN in default l2c_aux_val

Signed-off-by: Olof Johansson <olof@lixom.net>
2270 files changed:
.mailmap
Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7
Documentation/admin-guide/ext4.rst
Documentation/admin-guide/kernel-parameters.txt
Documentation/admin-guide/pm/intel_pstate.rst
Documentation/bpf/index.rst
Documentation/devicetree/bindings/arm/omap/prm-inst.txt
Documentation/devicetree/bindings/clock/imx23-clock.yaml
Documentation/devicetree/bindings/clock/imx28-clock.yaml
Documentation/devicetree/bindings/gpio/gpio-mxs.yaml
Documentation/devicetree/bindings/i2c/i2c-mxs.yaml
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt [deleted file]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt [deleted file]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
Documentation/devicetree/bindings/mmc/mxs-mmc.yaml
Documentation/devicetree/bindings/net/ethernet-controller.yaml
Documentation/devicetree/bindings/net/renesas,ether.yaml
Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml
Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml
Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml
Documentation/devicetree/bindings/thermal/imx-thermal.yaml
Documentation/devicetree/bindings/timer/sifive,clint.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/vendor-prefixes.yaml
Documentation/devicetree/writing-schema.rst
Documentation/fault-injection/nvme-fault-injection.rst
Documentation/filesystems/ext4/about.rst
Documentation/networking/bonding.rst
Documentation/powerpc/syscall64-abi.rst
MAINTAINERS
Makefile
arch/alpha/kernel/module.c
arch/alpha/kernel/signal.c
arch/alpha/kernel/traps.c
arch/arc/kernel/disasm.c
arch/arc/kernel/signal.c
arch/arc/kernel/unwind.c
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/boot/dts/am33xx-l4.dtsi
arch/arm/boot/dts/am33xx.dtsi
arch/arm/boot/dts/am4372.dtsi
arch/arm/boot/dts/am437x-l4.dtsi
arch/arm/boot/dts/am43x-epos-evm.dts
arch/arm/boot/dts/dra7-l4.dtsi
arch/arm/boot/dts/omap4-l4-abe.dtsi
arch/arm/boot/dts/omap4.dtsi
arch/arm/boot/dts/omap5-l4-abe.dtsi
arch/arm/boot/dts/omap5.dtsi
arch/arm/include/debug/brcmstb.S
arch/arm/kernel/hw_breakpoint.c
arch/arm/kernel/signal.c
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/pm.h
arch/arm/mach-at91/pm_suspend.S
arch/arm/mach-bcm/Kconfig
arch/arm/mach-ep93xx/crunch.c
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/Makefile
arch/arm/mach-exynos/common.h
arch/arm/mach-exynos/exynos.c
arch/arm/mach-exynos/include/mach/map.h [deleted file]
arch/arm/mach-exynos/platsmp.c
arch/arm/mach-exynos/pm.c
arch/arm/mach-mmp/pm-mmp2.c
arch/arm/mach-mmp/pm-pxa910.c
arch/arm/mach-omap1/include/mach/mux.h
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/am33xx.h
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/clockdomains33xx_data.c
arch/arm/mach-omap2/clockdomains81xx_data.c
arch/arm/mach-omap2/cm-regbits-33xx.h
arch/arm/mach-omap2/cm-regbits-54xx.h
arch/arm/mach-omap2/cm-regbits-7xx.h
arch/arm/mach-omap2/cm1_54xx.h
arch/arm/mach-omap2/cm1_7xx.h
arch/arm/mach-omap2/cm2_54xx.h
arch/arm/mach-omap2/cm2_7xx.h
arch/arm/mach-omap2/cm33xx.c
arch/arm/mach-omap2/cm33xx.h
arch/arm/mach-omap2/cm81xx.h
arch/arm/mach-omap2/display.c
arch/arm/mach-omap2/dma.c
arch/arm/mach-omap2/id.c
arch/arm/mach-omap2/l3_2xxx.h
arch/arm/mach-omap2/l3_3xxx.h
arch/arm/mach-omap2/l4_2xxx.h
arch/arm/mach-omap2/omap-iommu.c
arch/arm/mach-omap2/omap_device.c
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_33xx_data.c
arch/arm/mach-omap2/omap_hwmod_43xx_data.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/mach-omap2/omap_hwmod_54xx_data.c
arch/arm/mach-omap2/omap_hwmod_7xx_data.c
arch/arm/mach-omap2/omap_hwmod_81xx_data.c
arch/arm/mach-omap2/omap_opp_data.h
arch/arm/mach-omap2/omap_phy_internal.c
arch/arm/mach-omap2/opp3xxx_data.c
arch/arm/mach-omap2/opp4xxx_data.c
arch/arm/mach-omap2/pm33xx-core.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/powerdomains33xx_data.c
arch/arm/mach-omap2/prcm43xx.h
arch/arm/mach-omap2/prcm_mpu54xx.h
arch/arm/mach-omap2/prcm_mpu7xx.h
arch/arm/mach-omap2/prm-regbits-33xx.h
arch/arm/mach-omap2/prm33xx.c
arch/arm/mach-omap2/prm33xx.h
arch/arm/mach-omap2/prm54xx.h
arch/arm/mach-omap2/prm7xx.h
arch/arm/mach-omap2/scrm54xx.h
arch/arm/mach-omap2/sleep33xx.S
arch/arm/mach-omap2/sleep43xx.S
arch/arm/mach-omap2/ti81xx.h
arch/arm/mach-omap2/voltagedomains54xx_data.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-rpc/riscpc.c
arch/arm/mach-s3c/Kconfig [new file with mode: 0644]
arch/arm/mach-s3c/Kconfig.s3c24xx [new file with mode: 0644]
arch/arm/mach-s3c/Kconfig.s3c64xx [new file with mode: 0644]
arch/arm/mach-s3c/Makefile [new file with mode: 0644]
arch/arm/mach-s3c/Makefile.boot [new file with mode: 0644]
arch/arm/mach-s3c/Makefile.s3c24xx [new file with mode: 0644]
arch/arm/mach-s3c/Makefile.s3c64xx [new file with mode: 0644]
arch/arm/mach-s3c/adc-core.h [new file with mode: 0644]
arch/arm/mach-s3c/adc.c [new file with mode: 0644]
arch/arm/mach-s3c/anubis.h [new file with mode: 0644]
arch/arm/mach-s3c/ata-core-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/backlight-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/bast-ide.c [new file with mode: 0644]
arch/arm/mach-s3c/bast-irq.c [new file with mode: 0644]
arch/arm/mach-s3c/bast.h [new file with mode: 0644]
arch/arm/mach-s3c/common-smdk-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/common-smdk-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/cpu.c [new file with mode: 0644]
arch/arm/mach-s3c/cpu.h [new file with mode: 0644]
arch/arm/mach-s3c/cpufreq-utils-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/cpuidle-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/crag6410.h [new file with mode: 0644]
arch/arm/mach-s3c/dev-audio-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/dev-backlight-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/dev-uart-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/dev-uart.c [new file with mode: 0644]
arch/arm/mach-s3c/devs.c [new file with mode: 0644]
arch/arm/mach-s3c/devs.h [new file with mode: 0644]
arch/arm/mach-s3c/dma-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/dma-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/dma.h [new file with mode: 0644]
arch/arm/mach-s3c/fb-core-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/fb.h [new file with mode: 0644]
arch/arm/mach-s3c/gpio-cfg-helpers.h [new file with mode: 0644]
arch/arm/mach-s3c/gpio-cfg.h [new file with mode: 0644]
arch/arm/mach-s3c/gpio-core.h [new file with mode: 0644]
arch/arm/mach-s3c/gpio-samsung-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/gpio-samsung-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/gpio-samsung.c [new file with mode: 0644]
arch/arm/mach-s3c/gpio-samsung.h [new file with mode: 0644]
arch/arm/mach-s3c/gta02.h [new file with mode: 0644]
arch/arm/mach-s3c/h1940-bluetooth.c [new file with mode: 0644]
arch/arm/mach-s3c/h1940.h [new file with mode: 0644]
arch/arm/mach-s3c/hardware-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/iic-core.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/io-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/io.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/irqs-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/irqs-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/irqs.h [new file with mode: 0644]
arch/arm/mach-s3c/include/mach/map-base.h [new file with mode: 0644]
arch/arm/mach-s3c/init.c [new file with mode: 0644]
arch/arm/mach-s3c/iotiming-s3c2410.c [new file with mode: 0644]
arch/arm/mach-s3c/iotiming-s3c2412.c [new file with mode: 0644]
arch/arm/mach-s3c/irq-pm-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/irq-pm-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/irq-s3c24xx-fiq-exports.c [new file with mode: 0644]
arch/arm/mach-s3c/irq-s3c24xx-fiq.S [new file with mode: 0644]
arch/arm/mach-s3c/irq-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/irq-uart-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/keypad.h [new file with mode: 0644]
arch/arm/mach-s3c/mach-amlm5900.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-anubis.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-anw6410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-at2440evb.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-bast.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-crag6410-module.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-crag6410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-gta02.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-h1940.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-hmt.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-jive.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-mini2440.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-mini6410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-n30.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-ncp.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-nexcoder.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-osiris-dvs.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-osiris.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-otom.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-qt2410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-real6410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-rx1950.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-rx3715.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-s3c2416-dt.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-s3c64xx-dt.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smartq.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smartq.h [new file with mode: 0644]
arch/arm/mach-s3c/mach-smartq5.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smartq7.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk2410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk2413.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk2416.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk2440.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk2443.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk6400.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-smdk6410.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-tct_hammer.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-vr1000.c [new file with mode: 0644]
arch/arm/mach-s3c/mach-vstms.c [new file with mode: 0644]
arch/arm/mach-s3c/map-s3c.h [new file with mode: 0644]
arch/arm/mach-s3c/map-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/map-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/map-s5p.h [new file with mode: 0644]
arch/arm/mach-s3c/map.h [new file with mode: 0644]
arch/arm/mach-s3c/nand-core-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/onenand-core-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/osiris.h [new file with mode: 0644]
arch/arm/mach-s3c/otom.h [new file with mode: 0644]
arch/arm/mach-s3c/pl080.c [new file with mode: 0644]
arch/arm/mach-s3c/platformdata.c [new file with mode: 0644]
arch/arm/mach-s3c/pll-s3c2410.c [new file with mode: 0644]
arch/arm/mach-s3c/pll-s3c2440-12000000.c [new file with mode: 0644]
arch/arm/mach-s3c/pll-s3c2440-16934400.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-common.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-common.h [new file with mode: 0644]
arch/arm/mach-s3c/pm-core-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/pm-core-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/pm-core.h [new file with mode: 0644]
arch/arm/mach-s3c/pm-gpio.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-h1940.S [new file with mode: 0644]
arch/arm/mach-s3c/pm-s3c2410.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-s3c2412.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-s3c2416.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/pm-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/pm.c [new file with mode: 0644]
arch/arm/mach-s3c/pm.h [new file with mode: 0644]
arch/arm/mach-s3c/pwm-core.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-adc.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-clock-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-clock-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-clock.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-dsc-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-gpio-memport-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-gpio-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-gpio-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-gpio.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-irq-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-irq-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-irq.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-irqtype.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-mem-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-modem-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-s3c2443-clock.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-srom-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-sys-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-syscon-power-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/regs-usb-hsotg-phy-s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/rtc-core-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/s3c2410.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c2412-power.h [new file with mode: 0644]
arch/arm/mach-s3c/s3c2412.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c2412.h [new file with mode: 0644]
arch/arm/mach-s3c/s3c2416.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c2440.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c2442.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c2443.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c244x.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/s3c6400.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c6410.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/s3c64xx.h [new file with mode: 0644]
arch/arm/mach-s3c/sdhci.h [new file with mode: 0644]
arch/arm/mach-s3c/setup-fb-24bpp-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-i2c-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-i2c0-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-i2c1-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-ide-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-keypad-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-sdhci-gpio-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-sdhci-gpio-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-spi-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-spi-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-ts-s3c24xx.c [new file with mode: 0644]
arch/arm/mach-s3c/setup-usb-phy-s3c64xx.c [new file with mode: 0644]
arch/arm/mach-s3c/simtec-audio.c [new file with mode: 0644]
arch/arm/mach-s3c/simtec-nor.c [new file with mode: 0644]
arch/arm/mach-s3c/simtec-pm.c [new file with mode: 0644]
arch/arm/mach-s3c/simtec-usb.c [new file with mode: 0644]
arch/arm/mach-s3c/simtec.h [new file with mode: 0644]
arch/arm/mach-s3c/sleep-s3c2410.S [new file with mode: 0644]
arch/arm/mach-s3c/sleep-s3c2412.S [new file with mode: 0644]
arch/arm/mach-s3c/sleep-s3c24xx.S [new file with mode: 0644]
arch/arm/mach-s3c/sleep-s3c64xx.S [new file with mode: 0644]
arch/arm/mach-s3c/spi-core-s3c24xx.h [new file with mode: 0644]
arch/arm/mach-s3c/usb-phy.h [new file with mode: 0644]
arch/arm/mach-s3c/vr1000.h [new file with mode: 0644]
arch/arm/mach-s3c/wakeup-mask.c [new file with mode: 0644]
arch/arm/mach-s3c/wakeup-mask.h [new file with mode: 0644]
arch/arm/mach-s3c24xx/Kconfig [deleted file]
arch/arm/mach-s3c24xx/Makefile [deleted file]
arch/arm/mach-s3c24xx/Makefile.boot [deleted file]
arch/arm/mach-s3c24xx/anubis.h [deleted file]
arch/arm/mach-s3c24xx/bast-ide.c [deleted file]
arch/arm/mach-s3c24xx/bast-irq.c [deleted file]
arch/arm/mach-s3c24xx/bast.h [deleted file]
arch/arm/mach-s3c24xx/common-smdk.c [deleted file]
arch/arm/mach-s3c24xx/common-smdk.h [deleted file]
arch/arm/mach-s3c24xx/common.c [deleted file]
arch/arm/mach-s3c24xx/common.h [deleted file]
arch/arm/mach-s3c24xx/cpufreq-utils.c [deleted file]
arch/arm/mach-s3c24xx/fb-core.h [deleted file]
arch/arm/mach-s3c24xx/gta02.h [deleted file]
arch/arm/mach-s3c24xx/h1940-bluetooth.c [deleted file]
arch/arm/mach-s3c24xx/h1940.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/dma.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/fb.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/hardware.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/io.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/irqs.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/map.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/pm-core.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/regs-clock.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/regs-gpio.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/regs-irq.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/regs-lcd.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/rtc-core.h [deleted file]
arch/arm/mach-s3c24xx/include/mach/s3c2412.h [deleted file]
arch/arm/mach-s3c24xx/iotiming-s3c2410.c [deleted file]
arch/arm/mach-s3c24xx/iotiming-s3c2412.c [deleted file]
arch/arm/mach-s3c24xx/irq-pm.c [deleted file]
arch/arm/mach-s3c24xx/mach-amlm5900.c [deleted file]
arch/arm/mach-s3c24xx/mach-anubis.c [deleted file]
arch/arm/mach-s3c24xx/mach-at2440evb.c [deleted file]
arch/arm/mach-s3c24xx/mach-bast.c [deleted file]
arch/arm/mach-s3c24xx/mach-gta02.c [deleted file]
arch/arm/mach-s3c24xx/mach-h1940.c [deleted file]
arch/arm/mach-s3c24xx/mach-jive.c [deleted file]
arch/arm/mach-s3c24xx/mach-mini2440.c [deleted file]
arch/arm/mach-s3c24xx/mach-n30.c [deleted file]
arch/arm/mach-s3c24xx/mach-nexcoder.c [deleted file]
arch/arm/mach-s3c24xx/mach-osiris-dvs.c [deleted file]
arch/arm/mach-s3c24xx/mach-osiris.c [deleted file]
arch/arm/mach-s3c24xx/mach-otom.c [deleted file]
arch/arm/mach-s3c24xx/mach-qt2410.c [deleted file]
arch/arm/mach-s3c24xx/mach-rx1950.c [deleted file]
arch/arm/mach-s3c24xx/mach-rx3715.c [deleted file]
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c [deleted file]
arch/arm/mach-s3c24xx/mach-smdk2410.c [deleted file]
arch/arm/mach-s3c24xx/mach-smdk2413.c [deleted file]
arch/arm/mach-s3c24xx/mach-smdk2416.c [deleted file]
arch/arm/mach-s3c24xx/mach-smdk2440.c [deleted file]
arch/arm/mach-s3c24xx/mach-smdk2443.c [deleted file]
arch/arm/mach-s3c24xx/mach-tct_hammer.c [deleted file]
arch/arm/mach-s3c24xx/mach-vr1000.c [deleted file]
arch/arm/mach-s3c24xx/mach-vstms.c [deleted file]
arch/arm/mach-s3c24xx/nand-core.h [deleted file]
arch/arm/mach-s3c24xx/osiris.h [deleted file]
arch/arm/mach-s3c24xx/otom.h [deleted file]
arch/arm/mach-s3c24xx/pll-s3c2410.c [deleted file]
arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c [deleted file]
arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c [deleted file]
arch/arm/mach-s3c24xx/pm-h1940.S [deleted file]
arch/arm/mach-s3c24xx/pm-s3c2410.c [deleted file]
arch/arm/mach-s3c24xx/pm-s3c2412.c [deleted file]
arch/arm/mach-s3c24xx/pm-s3c2416.c [deleted file]
arch/arm/mach-s3c24xx/pm.c [deleted file]
arch/arm/mach-s3c24xx/regs-dsc.h [deleted file]
arch/arm/mach-s3c24xx/regs-mem.h [deleted file]
arch/arm/mach-s3c24xx/s3c2410.c [deleted file]
arch/arm/mach-s3c24xx/s3c2412-power.h [deleted file]
arch/arm/mach-s3c24xx/s3c2412.c [deleted file]
arch/arm/mach-s3c24xx/s3c2416.c [deleted file]
arch/arm/mach-s3c24xx/s3c2440.c [deleted file]
arch/arm/mach-s3c24xx/s3c2442.c [deleted file]
arch/arm/mach-s3c24xx/s3c2443.c [deleted file]
arch/arm/mach-s3c24xx/s3c244x.c [deleted file]
arch/arm/mach-s3c24xx/setup-camif.c [deleted file]
arch/arm/mach-s3c24xx/setup-i2c.c [deleted file]
arch/arm/mach-s3c24xx/setup-sdhci-gpio.c [deleted file]
arch/arm/mach-s3c24xx/setup-spi.c [deleted file]
arch/arm/mach-s3c24xx/setup-ts.c [deleted file]
arch/arm/mach-s3c24xx/simtec-audio.c [deleted file]
arch/arm/mach-s3c24xx/simtec-nor.c [deleted file]
arch/arm/mach-s3c24xx/simtec-pm.c [deleted file]
arch/arm/mach-s3c24xx/simtec-usb.c [deleted file]
arch/arm/mach-s3c24xx/simtec.h [deleted file]
arch/arm/mach-s3c24xx/sleep-s3c2410.S [deleted file]
arch/arm/mach-s3c24xx/sleep-s3c2412.S [deleted file]
arch/arm/mach-s3c24xx/sleep.S [deleted file]
arch/arm/mach-s3c24xx/spi-core.h [deleted file]
arch/arm/mach-s3c24xx/vr1000.h [deleted file]
arch/arm/mach-s3c64xx/Kconfig [deleted file]
arch/arm/mach-s3c64xx/Makefile [deleted file]
arch/arm/mach-s3c64xx/ata-core.h [deleted file]
arch/arm/mach-s3c64xx/backlight.h [deleted file]
arch/arm/mach-s3c64xx/common.c [deleted file]
arch/arm/mach-s3c64xx/common.h [deleted file]
arch/arm/mach-s3c64xx/cpuidle.c [deleted file]
arch/arm/mach-s3c64xx/crag6410.h [deleted file]
arch/arm/mach-s3c64xx/dev-audio.c [deleted file]
arch/arm/mach-s3c64xx/dev-backlight.c [deleted file]
arch/arm/mach-s3c64xx/dev-uart.c [deleted file]
arch/arm/mach-s3c64xx/include/mach/dma.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/hardware.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/irqs.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/map.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/pm-core.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/regs-clock.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/regs-gpio.h [deleted file]
arch/arm/mach-s3c64xx/include/mach/regs-irq.h [deleted file]
arch/arm/mach-s3c64xx/irq-pm.c [deleted file]
arch/arm/mach-s3c64xx/irq-uart.h [deleted file]
arch/arm/mach-s3c64xx/mach-anw6410.c [deleted file]
arch/arm/mach-s3c64xx/mach-crag6410-module.c [deleted file]
arch/arm/mach-s3c64xx/mach-crag6410.c [deleted file]
arch/arm/mach-s3c64xx/mach-hmt.c [deleted file]
arch/arm/mach-s3c64xx/mach-mini6410.c [deleted file]
arch/arm/mach-s3c64xx/mach-ncp.c [deleted file]
arch/arm/mach-s3c64xx/mach-real6410.c [deleted file]
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c [deleted file]
arch/arm/mach-s3c64xx/mach-smartq.c [deleted file]
arch/arm/mach-s3c64xx/mach-smartq.h [deleted file]
arch/arm/mach-s3c64xx/mach-smartq5.c [deleted file]
arch/arm/mach-s3c64xx/mach-smartq7.c [deleted file]
arch/arm/mach-s3c64xx/mach-smdk6400.c [deleted file]
arch/arm/mach-s3c64xx/mach-smdk6410.c [deleted file]
arch/arm/mach-s3c64xx/onenand-core.h [deleted file]
arch/arm/mach-s3c64xx/pl080.c [deleted file]
arch/arm/mach-s3c64xx/pm.c [deleted file]
arch/arm/mach-s3c64xx/regs-gpio-memport.h [deleted file]
arch/arm/mach-s3c64xx/regs-modem.h [deleted file]
arch/arm/mach-s3c64xx/regs-srom.h [deleted file]
arch/arm/mach-s3c64xx/regs-sys.h [deleted file]
arch/arm/mach-s3c64xx/regs-syscon-power.h [deleted file]
arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h [deleted file]
arch/arm/mach-s3c64xx/s3c6400.c [deleted file]
arch/arm/mach-s3c64xx/s3c6410.c [deleted file]
arch/arm/mach-s3c64xx/setup-fb-24bpp.c [deleted file]
arch/arm/mach-s3c64xx/setup-i2c0.c [deleted file]
arch/arm/mach-s3c64xx/setup-i2c1.c [deleted file]
arch/arm/mach-s3c64xx/setup-ide.c [deleted file]
arch/arm/mach-s3c64xx/setup-keypad.c [deleted file]
arch/arm/mach-s3c64xx/setup-sdhci-gpio.c [deleted file]
arch/arm/mach-s3c64xx/setup-spi.c [deleted file]
arch/arm/mach-s3c64xx/setup-usb-phy.c [deleted file]
arch/arm/mach-s3c64xx/sleep.S [deleted file]
arch/arm/mach-s3c64xx/watchdog-reset.h [deleted file]
arch/arm/mach-s5pv210/Kconfig
arch/arm/mach-s5pv210/Makefile
arch/arm/mach-s5pv210/pm.c
arch/arm/mach-s5pv210/regs-clock.h
arch/arm/mach-s5pv210/s5pv210.c
arch/arm/mach-shmobile/rcar-gen2.h
arch/arm/mach-shmobile/setup-rcar-gen2.c
arch/arm/mach-tegra/reset.c
arch/arm/mm/alignment.c
arch/arm/mm/proc-v7-bugs.c
arch/arm/plat-omap/dma.c
arch/arm/plat-samsung/Kconfig [deleted file]
arch/arm/plat-samsung/Makefile [deleted file]
arch/arm/plat-samsung/adc.c [deleted file]
arch/arm/plat-samsung/cpu.c [deleted file]
arch/arm/plat-samsung/dev-uart.c [deleted file]
arch/arm/plat-samsung/devs.c [deleted file]
arch/arm/plat-samsung/gpio-samsung.c [deleted file]
arch/arm/plat-samsung/include/plat/adc-core.h [deleted file]
arch/arm/plat-samsung/include/plat/adc.h [deleted file]
arch/arm/plat-samsung/include/plat/cpu-freq-core.h [deleted file]
arch/arm/plat-samsung/include/plat/cpu-freq.h [deleted file]
arch/arm/plat-samsung/include/plat/cpu.h [deleted file]
arch/arm/plat-samsung/include/plat/devs.h [deleted file]
arch/arm/plat-samsung/include/plat/fb-s3c2410.h [deleted file]
arch/arm/plat-samsung/include/plat/fb.h [deleted file]
arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h [deleted file]
arch/arm/plat-samsung/include/plat/gpio-cfg.h [deleted file]
arch/arm/plat-samsung/include/plat/gpio-core.h [deleted file]
arch/arm/plat-samsung/include/plat/iic-core.h [deleted file]
arch/arm/plat-samsung/include/plat/keypad.h [deleted file]
arch/arm/plat-samsung/include/plat/map-base.h [deleted file]
arch/arm/plat-samsung/include/plat/map-s3c.h [deleted file]
arch/arm/plat-samsung/include/plat/map-s5p.h [deleted file]
arch/arm/plat-samsung/include/plat/pm-common.h [deleted file]
arch/arm/plat-samsung/include/plat/pm.h [deleted file]
arch/arm/plat-samsung/include/plat/pwm-core.h [deleted file]
arch/arm/plat-samsung/include/plat/regs-adc.h [deleted file]
arch/arm/plat-samsung/include/plat/regs-irqtype.h [deleted file]
arch/arm/plat-samsung/include/plat/regs-spi.h [deleted file]
arch/arm/plat-samsung/include/plat/regs-udc.h [deleted file]
arch/arm/plat-samsung/include/plat/samsung-time.h [deleted file]
arch/arm/plat-samsung/include/plat/sdhci.h [deleted file]
arch/arm/plat-samsung/include/plat/usb-phy.h [deleted file]
arch/arm/plat-samsung/include/plat/wakeup-mask.h [deleted file]
arch/arm/plat-samsung/init.c [deleted file]
arch/arm/plat-samsung/platformdata.c [deleted file]
arch/arm/plat-samsung/pm-check.c [deleted file]
arch/arm/plat-samsung/pm-common.c [deleted file]
arch/arm/plat-samsung/pm-debug.c [deleted file]
arch/arm/plat-samsung/pm-gpio.c [deleted file]
arch/arm/plat-samsung/pm.c [deleted file]
arch/arm/plat-samsung/wakeup-mask.c [deleted file]
arch/arm/plat-samsung/watchdog-reset.c [deleted file]
arch/arm/probes/decode.c
arch/arm/probes/kprobes/core.c
arch/arm64/Kconfig.platforms
arch/arm64/Makefile
arch/arm64/boot/dts/ti/k3-am65-main.dtsi
arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
arch/arm64/boot/dts/ti/k3-am654-base-board.dts
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
arch/arm64/include/asm/compiler.h
arch/arm64/include/asm/irqflags.h
arch/arm64/include/asm/kvm_arm.h
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/tlbflush.h
arch/arm64/kernel/acpi.c
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/cpuinfo.c
arch/arm64/kernel/entry.S
arch/arm64/kernel/hw_breakpoint.c
arch/arm64/kernel/image-vars.h
arch/arm64/kernel/module.c
arch/arm64/kernel/process.c
arch/arm64/kernel/smp.c
arch/arm64/kernel/vdso32/Makefile
arch/arm64/kernel/vmlinux.lds.S
arch/arm64/kvm/arm.c
arch/arm64/kvm/handle_exit.c
arch/arm64/kvm/hyp/entry.S
arch/arm64/kvm/hyp/hyp-entry.S
arch/arm64/kvm/hyp/include/hyp/debug-sr.h
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/vgic-v3-sr.c
arch/arm64/kvm/hyp/vhe/switch.c
arch/arm64/kvm/mmu.c
arch/arm64/mm/context.c
arch/c6x/kernel/signal.c
arch/csky/kernel/signal.c
arch/h8300/kernel/signal.c
arch/hexagon/kernel/module.c
arch/hexagon/kernel/signal.c
arch/ia64/include/asm/pgtable.h
arch/ia64/kernel/crash.c
arch/ia64/kernel/module.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/signal.c
arch/ia64/kernel/unaligned.c
arch/ia64/kernel/unwind.c
arch/m68k/atari/atakeyb.c
arch/m68k/kernel/signal.c
arch/m68k/mac/config.c
arch/m68k/mac/via.c
arch/m68k/mm/fault.c
arch/microblaze/kernel/signal.c
arch/mips/include/asm/irqflags.h
arch/mips/include/asm/kvm_host.h
arch/mips/include/asm/unroll.h
arch/mips/kvm/mmu.c
arch/nds32/include/asm/irqflags.h
arch/nds32/kernel/fpu.c
arch/nds32/kernel/signal.c
arch/openrisc/kernel/signal.c
arch/parisc/kernel/signal.c
arch/parisc/kernel/traps.c
arch/parisc/mm/fault.c
arch/powerpc/Kconfig
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/fixmap.h
arch/powerpc/include/asm/hw_irq.h
arch/powerpc/include/asm/kasan.h
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/include/asm/mce.h
arch/powerpc/include/asm/mman.h
arch/powerpc/include/asm/nohash/64/pgtable.h
arch/powerpc/include/asm/perf_event.h
arch/powerpc/include/asm/perf_event_server.h
arch/powerpc/include/uapi/asm/mman.h
arch/powerpc/include/uapi/asm/perf_regs.h
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/dt_cpu_ftrs.c
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/process.c
arch/powerpc/kernel/setup-common.c
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/e500_mmu_host.c
arch/powerpc/mm/book3s32/mmu.c
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/perf/core-book3s.c
arch/powerpc/perf/hv-24x7.c
arch/powerpc/perf/imc-pmu.c
arch/powerpc/perf/perf_regs.c
arch/powerpc/perf/power10-pmu.c
arch/powerpc/perf/power9-pmu.c
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/powernv/idle.c
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/platforms/pseries/hotplug-cpu.c
arch/powerpc/platforms/pseries/ras.c
arch/riscv/Kconfig
arch/riscv/Kconfig.socs
arch/riscv/configs/nommu_virt_defconfig
arch/riscv/configs/rv32_defconfig
arch/riscv/include/asm/clint.h [deleted file]
arch/riscv/include/asm/smp.h
arch/riscv/include/asm/timex.h
arch/riscv/kernel/Makefile
arch/riscv/kernel/clint.c [deleted file]
arch/riscv/kernel/sbi.c
arch/riscv/kernel/setup.c
arch/riscv/kernel/signal.c
arch/riscv/kernel/smp.c
arch/riscv/kernel/smpboot.c
arch/riscv/net/bpf_jit_comp32.c
arch/s390/include/asm/percpu.h
arch/s390/kernel/idle.c
arch/s390/kernel/ptrace.c
arch/s390/kernel/runtime_instr.c
arch/s390/mm/vmem.c
arch/s390/pci/pci.c
arch/s390/pci/pci_bus.c
arch/s390/pci/pci_bus.h
arch/s390/pci/pci_event.c
arch/sh/drivers/platform_early.c
arch/sh/kernel/disassemble.c
arch/sh/kernel/kgdb.c
arch/sh/kernel/signal_32.c
arch/sparc/kernel/auxio_64.c
arch/sparc/kernel/central.c
arch/sparc/kernel/kgdb_32.c
arch/sparc/kernel/kgdb_64.c
arch/sparc/kernel/pcr.c
arch/sparc/kernel/prom_32.c
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/sparc/math-emu/math_32.c
arch/sparc/net/bpf_jit_comp_32.c
arch/um/kernel/signal.c
arch/x86/boot/cmdline.c
arch/x86/boot/compressed/kaslr.c
arch/x86/boot/compressed/misc.c
arch/x86/boot/string.h
arch/x86/entry/calling.h
arch/x86/entry/thunk_32.S
arch/x86/events/intel/core.c
arch/x86/events/intel/lbr.c
arch/x86/events/intel/uncore_snb.c
arch/x86/include/asm/efi.h
arch/x86/include/asm/kvm_host.h
arch/x86/include/asm/mmu.h
arch/x86/kernel/alternative.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/vector.c
arch/x86/kernel/cpu/cacheinfo.c
arch/x86/kernel/cpu/mce/inject.c
arch/x86/kernel/cpu/mce/intel.c
arch/x86/kernel/cpu/mtrr/cyrix.c
arch/x86/kernel/hw_breakpoint.c
arch/x86/kernel/kgdb.c
arch/x86/kernel/mpparse.c
arch/x86/kernel/process.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/reboot.c
arch/x86/kernel/signal.c
arch/x86/kernel/smpboot.c
arch/x86/kernel/uprobes.c
arch/x86/kvm/emulate.c
arch/x86/kvm/hyperv.c
arch/x86/kvm/irq_comm.c
arch/x86/kvm/lapic.c
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c
arch/x86/lib/cmdline.c
arch/x86/lib/insn-eval.c
arch/x86/math-emu/errors.c
arch/x86/math-emu/fpu_trig.c
arch/x86/mm/ioremap.c
arch/x86/mm/tlb.c
arch/x86/pci/xen.c
arch/x86/platform/efi/efi.c
arch/x86/platform/efi/efi_32.c
arch/x86/platform/efi/efi_64.c
arch/xtensa/kernel/signal.c
block/badblocks.c
block/bfq-cgroup.c
block/bfq-iosched.c
block/bfq-iosched.h
block/bfq-wf2q.c
block/bio.c
block/blk-cgroup.c
block/blk-merge.c
block/blk-mq-sched.c
block/blk-mq.c
block/blk-wbt.c
block/bsg-lib.c
block/ioprio.c
crypto/af_alg.c
crypto/drbg.c
crypto/tcrypt.c
drivers/accessibility/braille/braille_console.c
drivers/accessibility/speakup/Kconfig
drivers/accessibility/speakup/Makefile
drivers/accessibility/speakup/serialio.c
drivers/accessibility/speakup/spk_priv.h
drivers/accessibility/speakup/spk_ttyio.c
drivers/accessibility/speakup/spk_types.h
drivers/accessibility/speakup/synth.c
drivers/acpi/acpi_apd.c
drivers/acpi/osl.c
drivers/ata/ahci_brcm.c
drivers/ata/libahci_platform.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/pata_atp867x.c
drivers/ata/pata_serverworks.c
drivers/ata/sata_mv.c
drivers/ata/sata_promise.c
drivers/ata/sata_sx4.c
drivers/atm/firestream.c
drivers/atm/fore200e.c
drivers/atm/he.c
drivers/atm/idt77105.c
drivers/atm/lanai.c
drivers/atm/zatm.c
drivers/auxdisplay/panel.c
drivers/base/core.c
drivers/base/firmware_loader/fallback.c
drivers/base/power/main.c
drivers/block/aoe/aoecmd.c
drivers/block/ataflop.c
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_nl.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_req.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/null_blk_main.c
drivers/block/paride/pd.c
drivers/block/pktcdvd.c
drivers/block/rbd.c
drivers/block/rnbd/rnbd-srv.c
drivers/block/rsxx/core.c
drivers/block/skd_main.c
drivers/block/virtio_blk.c
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkback/xenbus.c
drivers/block/xen-blkfront.c
drivers/bus/ti-sysc.c
drivers/char/agp/ali-agp.c
drivers/char/hw_random/ingenic-rng.c
drivers/char/ipmi/kcs_bmc.c
drivers/char/lp.c
drivers/char/mem.c
drivers/char/nvram.c
drivers/clk/samsung/clk-s3c2410-dclk.c
drivers/clk/samsung/clk-s3c2410.c
drivers/clk/samsung/clk-s3c2412.c
drivers/clk/samsung/clk-s3c2443.c
drivers/clk/samsung/clk-s3c64xx.c
drivers/clocksource/Kconfig
drivers/clocksource/Makefile
drivers/clocksource/timer-cadence-ttc.c
drivers/clocksource/timer-clint.c [new file with mode: 0644]
drivers/clocksource/timer-riscv.c
drivers/cpufreq/Kconfig.arm
drivers/cpufreq/cpufreq.c
drivers/cpufreq/p4-clockmod.c
drivers/cpufreq/s3c2410-cpufreq.c
drivers/cpufreq/s3c2412-cpufreq.c
drivers/cpufreq/s3c2440-cpufreq.c
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
drivers/cpufreq/s3c24xx-cpufreq.c
drivers/cpufreq/speedstep-lib.c
drivers/cpufreq/tegra194-cpufreq.c
drivers/cpufreq/ti-cpufreq.c
drivers/cpuidle/cpuidle.c
drivers/crypto/Kconfig
drivers/crypto/axis/artpec6_crypto.c
drivers/crypto/cavium/cpt/cptvf_reqmanager.c
drivers/crypto/chelsio/chcr_ktls.c
drivers/crypto/marvell/octeontx/otx_cptvf_reqmgr.c
drivers/crypto/qat/qat_common/adf_admin.c
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
drivers/crypto/qat/qat_common/qat_uclo.c
drivers/crypto/ux500/cryp/cryp.c
drivers/dax/super.c
drivers/dma/amba-pl08x.c
drivers/dma/fsldma.c
drivers/dma/fsldma.h
drivers/dma/imx-dma.c
drivers/dma/iop-adma.h
drivers/dma/nbpfaxi.c
drivers/dma/pl330.c
drivers/dma/sh/shdma-base.c
drivers/edac/amd64_edac.c
drivers/edac/ghes_edac.c
drivers/edac/i7core_edac.c
drivers/edac/pnd2_edac.c
drivers/edac/sb_edac.c
drivers/edac/skx_common.c
drivers/firewire/core-device.c
drivers/firewire/core-iso.c
drivers/firewire/core-topology.c
drivers/firewire/core-transaction.c
drivers/firewire/ohci.c
drivers/firmware/efi/efi.c
drivers/firmware/efi/libstub/efi-stub-helper.c
drivers/firmware/ti_sci.c
drivers/gpio/gpio-aspeed-sgpio.c
drivers/gpio/gpio-aspeed.c
drivers/gpio/gpio-ath79.c
drivers/gpio/gpio-eic-sprd.c
drivers/gpio/gpio-stmpe.c
drivers/gpio/gpiolib-acpi.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
drivers/gpu/drm/amd/amdgpu/si_dpm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
drivers/gpu/drm/amd/display/dc/bios/command_table2.c
drivers/gpu/drm/amd/display/dc/bios/command_table2.h
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
drivers/gpu/drm/amd/display/dc/dc_stream.h
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.h
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_link_encoder.h
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_link_encoder.h
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h
drivers/gpu/drm/amd/display/include/bios_parser_types.h
drivers/gpu/drm/amd/display/include/fixed31_32.h
drivers/gpu/drm/amd/display/modules/freesync/freesync.c
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
drivers/gpu/drm/arm/malidp_hw.c
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/bridge/nwl-dsi.c
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
drivers/gpu/drm/bridge/ti-sn65dsi86.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_bufs.c
drivers/gpu/drm/drm_color_mgmt.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_dp_helper.c
drivers/gpu/drm/drm_dp_mst_topology.c
drivers/gpu/drm/drm_mode_object.c
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/drm_plane.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
drivers/gpu/drm/etnaviv/etnaviv_sched.c
drivers/gpu/drm/exynos/exynos_drm_dsi.c
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
drivers/gpu/drm/exynos/exynos_drm_gem.h
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
drivers/gpu/drm/i915/display/icl_dsi.c
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_cdclk.c
drivers/gpu/drm/i915/display/intel_combo_phy.c
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display_debugfs.c
drivers/gpu/drm/i915/display/intel_display_power.c
drivers/gpu/drm/i915/display/intel_dpll_mgr.c
drivers/gpu/drm/i915/display/intel_panel.c
drivers/gpu/drm/i915/display/intel_sdvo.c
drivers/gpu/drm/i915/display/intel_sprite.c
drivers/gpu/drm/i915/display/intel_tc.c
drivers/gpu/drm/i915/gem/i915_gem_mman.c
drivers/gpu/drm/i915/gem/i915_gem_pages.c
drivers/gpu/drm/i915/gem/i915_gem_stolen.c
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/gt/intel_ggtt.c
drivers/gpu/drm/i915/gt/intel_ring_submission.c
drivers/gpu/drm/i915/gvt/cfg_space.c
drivers/gpu/drm/i915/gvt/gtt.c
drivers/gpu/drm/i915/gvt/gtt.h
drivers/gpu/drm/i915/gvt/gvt.h
drivers/gpu/drm/i915/gvt/handlers.c
drivers/gpu/drm/i915/gvt/vgpu.c
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/selftests/i915_buddy.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c
drivers/gpu/drm/imx/ipuv3-plane.c
drivers/gpu/drm/meson/meson_osd_afbcd.c
drivers/gpu/drm/meson/meson_overlay.c
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
drivers/gpu/drm/msm/adreno/a6xx_gmu.c
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h
drivers/gpu/drm/msm/adreno/adreno_device.c
drivers/gpu/drm/msm/adreno/adreno_gpu.c
drivers/gpu/drm/msm/adreno/adreno_gpu.h
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_ringbuffer.c
drivers/gpu/drm/omapdrm/dss/venc.c
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/radeon/ci_dpm.c
drivers/gpu/drm/radeon/r300.c
drivers/gpu/drm/radeon/r420.c
drivers/gpu/drm/radeon/r600_cs.c
drivers/gpu/drm/radeon/radeon_uvd.c
drivers/gpu/drm/radeon/si_dpm.c
drivers/gpu/drm/radeon/uvd_v1_0.c
drivers/gpu/drm/savage/savage_state.c
drivers/gpu/drm/sti/sti_hdmi.c
drivers/gpu/drm/sun4i/sun4i_tcon.c
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
drivers/gpu/drm/ttm/ttm_bo_vm.c
drivers/gpu/drm/via/via_dmablit.c
drivers/gpu/drm/virtio/virtgpu_ioctl.c
drivers/gpu/drm/virtio/virtgpu_object.c
drivers/gpu/drm/xen/xen_drm_front.c
drivers/gpu/ipu-v3/ipu-dc.c
drivers/hid/hid-cougar.c
drivers/hid/hid-ids.h
drivers/hid/hid-lg-g15.c
drivers/hid/hid-logitech-dj.c
drivers/hid/hid-macally.c
drivers/hid/hid-microsoft.c
drivers/hid/hid-quirks.c
drivers/hid/hid-rmi.c
drivers/hid/hid-roccat-kone.c
drivers/hid/hid-uclogic-params.c
drivers/hid/hid-wiimote-core.c
drivers/hid/i2c-hid/i2c-hid-core.c
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hiddev.c
drivers/hid/usbhid/usbhid.h
drivers/hid/wacom_wac.c
drivers/hsi/clients/ssi_protocol.c
drivers/hsi/controllers/omap_ssi_core.c
drivers/hv/hv_kvp.c
drivers/hv/hv_util.c
drivers/hwmon/adt7462.c
drivers/hwmon/applesmc.c
drivers/hwmon/emc1403.c
drivers/hwmon/f71882fg.c
drivers/hwmon/gsc-hwmon.c
drivers/hwmon/hwmon-vid.c
drivers/hwmon/ina3221.c
drivers/hwmon/nct6775.c
drivers/hwmon/nct7904.c
drivers/hwmon/occ/common.c
drivers/hwmon/pmbus/isl68137.c
drivers/hwmon/s3c-hwmon.c
drivers/hwmon/w83627hf.c
drivers/hwmon/w83781d.c
drivers/hwmon/w83795.c
drivers/hwtracing/coresight/coresight-cpu-debug.c
drivers/hwtracing/coresight/coresight-etm4x.c
drivers/hwtracing/coresight/coresight-tmc.c
drivers/hwtracing/intel_th/sth.c
drivers/i2c/busses/i2c-bcm-iproc.c
drivers/i2c/busses/i2c-omap.c
drivers/i2c/busses/i2c-opal.c
drivers/i2c/busses/i2c-rcar.c
drivers/i2c/i2c-core-acpi.c
drivers/i2c/i2c-core-base.c
drivers/i2c/i2c-core.h
drivers/i3c/master/dw-i3c-master.c
drivers/ide/hpt366.c
drivers/ide/ide-cd.c
drivers/ide/ide-floppy.c
drivers/ide/ide-probe.c
drivers/ide/ide-taskfile.c
drivers/ide/sis5513.c
drivers/idle/intel_idle.c
drivers/iio/accel/mma8452.c
drivers/iio/adc/ab8500-gpadc.c
drivers/iio/adc/cpcap-adc.c
drivers/iio/chemical/sps30.c
drivers/iio/dac/ad5592r-base.c
drivers/iio/dac/dpot-dac.c
drivers/iio/health/max30102.c
drivers/iio/imu/adis.c
drivers/iio/industrialio-core.c
drivers/iio/light/si1145.c
drivers/iio/magnetometer/ak8974.c
drivers/infiniband/core/cm.c
drivers/infiniband/core/cma.c
drivers/infiniband/core/device.c
drivers/infiniband/core/rw.c
drivers/infiniband/core/ucma.c
drivers/infiniband/core/uverbs_ioctl.c
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_fp.c
drivers/infiniband/hw/cxgb4/cm.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/hfi1/pio_copy.c
drivers/infiniband/hw/hfi1/tid_rdma.c
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.h
drivers/infiniband/hw/hns/hns_roce_qp.c
drivers/infiniband/hw/hns/hns_roce_srq.c
drivers/infiniband/hw/i40iw/i40iw_cm.c
drivers/infiniband/hw/i40iw/i40iw_ctrl.c
drivers/infiniband/hw/i40iw/i40iw_hw.c
drivers/infiniband/hw/i40iw/i40iw_main.c
drivers/infiniband/hw/i40iw/i40iw_puda.c
drivers/infiniband/hw/i40iw/i40iw_utils.c
drivers/infiniband/hw/i40iw/i40iw_verbs.c
drivers/infiniband/hw/mlx4/cq.c
drivers/infiniband/hw/mlx4/mcg.c
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/mad.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qp.c
drivers/infiniband/hw/mthca/mthca_av.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/hw/qib/qib_iba6120.c
drivers/infiniband/hw/qib/qib_iba7220.c
drivers/infiniband/hw/qib/qib_iba7322.c
drivers/infiniband/hw/qib/qib_mad.c
drivers/infiniband/hw/qib/qib_rc.c
drivers/infiniband/hw/qib/qib_sdma.c
drivers/infiniband/hw/qib/qib_uc.c
drivers/infiniband/hw/qib/qib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_main.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
drivers/infiniband/sw/rdmavt/qp.c
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_task.c
drivers/infiniband/sw/rxe/rxe_verbs.c
drivers/infiniband/sw/siw/siw_cm.c
drivers/infiniband/sw/siw/siw_qp_rx.c
drivers/infiniband/sw/siw/siw_qp_tx.c
drivers/infiniband/ulp/ipoib/ipoib_cm.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/iser/iser_verbs.c
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c
drivers/input/joystick/fsia6b.c
drivers/input/joystick/gamecon.c
drivers/input/tablet/wacom_serial4.c
drivers/input/touchscreen/atmel_mxt_ts.c
drivers/input/touchscreen/s3c2410_ts.c
drivers/input/touchscreen/wm831x-ts.c
drivers/iommu/amd/init.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/dma-iommu.c
drivers/iommu/intel/iommu.c
drivers/iommu/virtio-iommu.c
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-imx-gpcv2.c
drivers/irqchip/irq-ingenic.c
drivers/irqchip/irq-mips-gic.c
drivers/irqchip/irq-mtk-cirq.c
drivers/irqchip/irq-mtk-sysirq.c
drivers/irqchip/irq-s3c24xx.c [deleted file]
drivers/irqchip/irq-stm32-exti.c
drivers/irqchip/irq-ti-sci-inta.c
drivers/irqchip/irq-ti-sci-intr.c
drivers/irqchip/irq-vic.c
drivers/irqchip/irqchip.c
drivers/irqchip/qcom-pdc.c
drivers/isdn/hardware/mISDN/avmfritz.c
drivers/isdn/hardware/mISDN/hfc_multi_8xx.h
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hardware/mISDN/hfcsusb.c
drivers/isdn/hardware/mISDN/isdnhdlc.c
drivers/isdn/hardware/mISDN/mISDNinfineon.c
drivers/isdn/hardware/mISDN/mISDNisar.c
drivers/isdn/mISDN/stack.c
drivers/leds/leds-s3c24xx.c
drivers/lightnvm/pblk-core.c
drivers/macintosh/adbhid.c
drivers/macintosh/smu.c
drivers/md/bcache/journal.c
drivers/md/bcache/util.c
drivers/md/dm-crypt.c
drivers/md/dm-mpath.c
drivers/md/dm.c
drivers/md/md-autodetect.c
drivers/md/md-bitmap.c
drivers/md/raid5.c
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
drivers/media/dvb-core/dvb_net.c
drivers/media/dvb-frontends/bcm3510.c
drivers/media/dvb-frontends/dib0090.c
drivers/media/dvb-frontends/dib3000mb.c
drivers/media/dvb-frontends/dib7000p.c
drivers/media/dvb-frontends/drx39xyj/drxj.c
drivers/media/dvb-frontends/drxd_hard.c
drivers/media/dvb-frontends/drxk_hard.c
drivers/media/dvb-frontends/lgdt3306a.c
drivers/media/dvb-frontends/mt352.c
drivers/media/dvb-frontends/mxl5xx.c
drivers/media/dvb-frontends/or51132.c
drivers/media/dvb-frontends/s5h1411.c
drivers/media/dvb-frontends/zl10353.c
drivers/media/pci/cx23885/cx23885-cards.c
drivers/media/pci/ddbridge/ddbridge-core.c
drivers/media/pci/meye/meye.c
drivers/media/pci/ttpci/av7110.c
drivers/media/pci/ttpci/av7110_hw.c
drivers/media/pci/ttpci/av7110_ipack.c
drivers/media/pci/ttpci/budget-av.c
drivers/media/pci/ttpci/budget.c
drivers/media/platform/sh_vou.c
drivers/media/radio/radio-si476x.c
drivers/media/radio/tea575x.c
drivers/media/rc/bpf-lirc.c
drivers/media/rc/ir-rc6-decoder.c
drivers/media/rc/ir-sony-decoder.c
drivers/media/tuners/xc5000.c
drivers/media/usb/b2c2/flexcop-usb.c
drivers/media/usb/cpia2/cpia2_core.c
drivers/media/usb/cx231xx/cx231xx-video.c
drivers/media/usb/dvb-usb/dib0700_devices.c
drivers/media/usb/dvb-usb/dw2102.c
drivers/media/v4l2-core/v4l2-ctrls.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/media/v4l2-core/videobuf-core.c
drivers/memory/omap-gpmc.c
drivers/memstick/core/ms_block.c
drivers/memstick/host/jmb38x_ms.c
drivers/memstick/host/tifm_ms.c
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptsas.c
drivers/message/fusion/mptscsih.c
drivers/mfd/db8500-prcmu.c
drivers/mfd/iqs62x.c
drivers/mfd/mfd-core.c
drivers/mfd/mxs-lradc.c
drivers/mfd/omap-usb-host.c
drivers/mfd/rave-sp.c
drivers/mfd/syscon.c
drivers/misc/eeprom/at25.c
drivers/misc/habanalabs/common/command_buffer.c
drivers/misc/habanalabs/common/command_submission.c
drivers/misc/habanalabs/common/debugfs.c
drivers/misc/habanalabs/common/device.c
drivers/misc/habanalabs/common/firmware_if.c
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/memory.c
drivers/misc/habanalabs/common/mmu.c
drivers/misc/habanalabs/common/pci.c
drivers/misc/habanalabs/common/sysfs.c
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/gaudi/gaudiP.h
drivers/misc/habanalabs/gaudi/gaudi_coresight.c
drivers/misc/habanalabs/goya/goya.c
drivers/misc/habanalabs/goya/goya_coresight.c
drivers/misc/mei/hdcp/mei_hdcp.c
drivers/misc/mic/scif/scif_api.c
drivers/misc/mic/scif/scif_rma.c
drivers/misc/sgi-gru/grukservices.c
drivers/misc/sgi-xp/xpc_main.c
drivers/misc/sgi-xp/xpc_partition.c
drivers/misc/sgi-xp/xpc_uv.c
drivers/mmc/core/host.c
drivers/mmc/host/Kconfig
drivers/mmc/host/atmel-mci.c
drivers/mmc/host/davinci_mmc.c
drivers/mmc/host/dw_mmc-k3.c
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/jz4740_mmc.c
drivers/mmc/host/meson-mx-sdio.c
drivers/mmc/host/renesas_sdhi_core.c
drivers/mmc/host/s3cmci.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sprd.c
drivers/mmc/host/sdhci-xenon-phy.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/tifm_sd.c
drivers/mmc/host/usdhi6rol0.c
drivers/mux/adgs1408.c
drivers/net/appletalk/cops.c
drivers/net/arcnet/arc-rimi.c
drivers/net/arcnet/com20020-isa.c
drivers/net/arcnet/com90io.c
drivers/net/arcnet/com90xx.c
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_alb.c
drivers/net/bonding/bond_main.c
drivers/net/can/at91_can.c
drivers/net/can/peak_canfd/peak_pciefd_main.c
drivers/net/can/sja1000/sja1000_platform.c
drivers/net/can/slcan.c
drivers/net/can/spi/mcp251x.c
drivers/net/can/usb/peak_usb/pcan_usb.c
drivers/net/can/usb/peak_usb/pcan_usb_core.c
drivers/net/can/usb/peak_usb/pcan_usb_pro.c
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_serdes.c
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/mt7530.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/ocelot/Kconfig
drivers/net/ethernet/3com/3c509.c
drivers/net/ethernet/3com/3c574_cs.c
drivers/net/ethernet/8390/axnet_cs.c
drivers/net/ethernet/8390/pcnet_cs.c
drivers/net/ethernet/alacritech/slicoss.c
drivers/net/ethernet/alteon/acenic.c
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
drivers/net/ethernet/broadcom/bgmac-bcma.c
drivers/net/ethernet/broadcom/bgmac-platform.c
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
drivers/net/ethernet/broadcom/cnic.c
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmmii.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/brocade/bna/bfa_ioc.c
drivers/net/ethernet/brocade/bna/bna_enet.c
drivers/net/ethernet/brocade/bna/bna_tx_rx.c
drivers/net/ethernet/cadence/macb_ptp.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
drivers/net/ethernet/cavium/thunder/nicvf_main.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
drivers/net/ethernet/chelsio/cxgb3/l2t.c
drivers/net/ethernet/chelsio/cxgb4/l2t.c
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
drivers/net/ethernet/cisco/enic/enic_main.c
drivers/net/ethernet/cortina/gemini.c
drivers/net/ethernet/davicom/dm9000.c
drivers/net/ethernet/dec/tulip/de4x5.c
drivers/net/ethernet/dec/tulip/tulip_core.c
drivers/net/ethernet/dec/tulip/winbond-840.c
drivers/net/ethernet/emulex/benet/be_ethtool.c
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/fman/fman_memac.c
drivers/net/ethernet/freescale/fman/fman_port.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/freescale/ucc_geth.c
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/ibm/ehea/ehea_main.c
drivers/net/ethernet/ibm/emac/core.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/intel/igc/igc_ptp.c
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
drivers/net/ethernet/marvell/skge.c
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core_env.c
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/microchip/lan743x_ethtool.c
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/natsemi/natsemi.c
drivers/net/ethernet/neterion/vxge/vxge-config.c
drivers/net/ethernet/netronome/nfp/crypto/tls.c
drivers/net/ethernet/netronome/nfp/flower/action.c
drivers/net/ethernet/netronome/nfp/flower/cmsg.c
drivers/net/ethernet/netronome/nfp/flower/offload.c
drivers/net/ethernet/netronome/nfp/nfp_asm.c
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_rtsym.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
drivers/net/ethernet/packetengines/yellowfin.c
drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
drivers/net/ethernet/qlogic/qed/qed_cxt.c
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qed/qed_mcp.c
drivers/net/ethernet/qlogic/qla3xxx.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
drivers/net/ethernet/realtek/r8169_main.c
drivers/net/ethernet/rocker/rocker_main.c
drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
drivers/net/ethernet/sfc/ef100.c
drivers/net/ethernet/sfc/ef100_nic.c
drivers/net/ethernet/sfc/ef100_rx.c
drivers/net/ethernet/sfc/ef100_rx.h
drivers/net/ethernet/sfc/efx.h
drivers/net/ethernet/sfc/falcon/ethtool.c
drivers/net/ethernet/sfc/falcon/farch.c
drivers/net/ethernet/sfc/farch.c
drivers/net/ethernet/sfc/mcdi_filters.c
drivers/net/ethernet/sfc/mcdi_port_common.c
drivers/net/ethernet/sfc/net_driver.h
drivers/net/ethernet/sfc/nic.c
drivers/net/ethernet/sfc/rx.c
drivers/net/ethernet/sfc/rx_common.c
drivers/net/ethernet/sis/sis900.c
drivers/net/ethernet/smsc/smc911x.c
drivers/net/ethernet/socionext/netsec.c
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
drivers/net/ethernet/sun/cassini.c
drivers/net/ethernet/sun/niu.c
drivers/net/ethernet/sun/sungem.c
drivers/net/ethernet/ti/cpsw-phy-sel.c
drivers/net/ethernet/ti/cpsw_priv.c
drivers/net/ethernet/ti/tlan.c
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
drivers/net/ethernet/toshiba/spider_net.c
drivers/net/ethernet/xircom/xirc2ps_cs.c
drivers/net/fddi/skfp/cfm.c
drivers/net/fddi/skfp/fplustm.c
drivers/net/fddi/skfp/hwmtm.c
drivers/net/fddi/skfp/pcmplc.c
drivers/net/fddi/skfp/smt.c
drivers/net/fjes/fjes_main.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/mkiss.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/ipvlan/ipvlan_main.c
drivers/net/macvlan.c
drivers/net/mii.c
drivers/net/netdevsim/bus.c
drivers/net/netdevsim/fib.c
drivers/net/phy/adin.c
drivers/net/phy/dp83640.c
drivers/net/phy/fixed_phy.c
drivers/net/phy/mscc/mscc_main.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/phy/phylink.c
drivers/net/phy/sfp-bus.c
drivers/net/phy/sfp.c
drivers/net/plip/plip.c
drivers/net/tun.c
drivers/net/usb/aqc111.c
drivers/net/usb/catc.c
drivers/net/usb/cdc-phonet.c
drivers/net/usb/lan78xx.c
drivers/net/usb/pegasus.c
drivers/net/usb/r8152.c
drivers/net/usb/rtl8150.c
drivers/net/usb/usbnet.c
drivers/net/veth.c
drivers/net/virtio_net.c
drivers/net/vmxnet3/vmxnet3_ethtool.c
drivers/net/wan/dlci.c
drivers/net/wan/hdlc.c
drivers/net/wan/hdlc_x25.c
drivers/net/wan/lapbether.c
drivers/net/wan/sdla.c
drivers/net/wan/x25_asy.c
drivers/net/wimax/i2400m/control.c
drivers/net/wimax/i2400m/usb-fw.c
drivers/net/wimax/i2400m/usb-tx.c
drivers/net/wimax/i2400m/usb.c
drivers/net/xen-netback/hash.c
drivers/net/xen-netback/xenbus.c
drivers/net/xen-netfront.c
drivers/nfc/pn533/pn533.c
drivers/nfc/st21nfca/dep.c
drivers/nfc/trf7970a.c
drivers/ntb/ntb_transport.c
drivers/nvdimm/dimm_devs.c
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/host/tcp.c
drivers/nvme/target/configfs.c
drivers/nvme/target/core.c
drivers/nvme/target/fcloop.c
drivers/nvme/target/io-cmd-bdev.c
drivers/nvme/target/loop.c
drivers/nvme/target/passthru.c
drivers/nvme/target/rdma.c
drivers/of/address.c
drivers/opp/core.c
drivers/parport/ieee1284.c
drivers/parport/parport_pc.c
drivers/pci/controller/dwc/pci-imx6.c
drivers/pci/controller/pci-rcar-gen2.c
drivers/pci/hotplug/ibmphp_res.c
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/hotplug/s390_pci_hpc.c
drivers/pci/hotplug/shpchp_ctrl.c
drivers/pci/p2pdma.c
drivers/pci/pci.c
drivers/pci/proc.c
drivers/pci/quirks.c
drivers/pci/setup-bus.c
drivers/pci/xen-pcifront.c
drivers/pcmcia/db1xxx_ss.c
drivers/perf/arm-ccn.c
drivers/perf/arm_spe_pmu.c
drivers/phy/qualcomm/phy-qcom-usb-hs.c
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
drivers/platform/olpc/olpc-xo175-ec.c
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/dell-laptop.c
drivers/platform/x86/surfacepro3_button.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/power/supply/ab8500_charger.c
drivers/power/supply/ab8500_fg.c
drivers/power/supply/abx500_chargalg.c
drivers/power/supply/axp20x_usb_power.c
drivers/power/supply/cros_usbpd-charger.c
drivers/power/supply/max8925_power.c
drivers/power/supply/s3c_adc_battery.c
drivers/power/supply/wm831x_power.c
drivers/power/supply/wm8350_power.c
drivers/ps3/ps3av.c
drivers/ps3/ps3av_cmd.c
drivers/ptp/ptp_clockmatrix.c
drivers/ptp/ptp_clockmatrix.h
drivers/pwm/Kconfig
drivers/rapidio/devices/rio_mport_cdev.c
drivers/regulator/axp20x-regulator.c
drivers/regulator/core.c
drivers/regulator/slg51000-regulator.c
drivers/regulator/twl6030-regulator.c
drivers/remoteproc/omap_remoteproc.c
drivers/reset/reset-imx7.c
drivers/rpmsg/qcom_glink_native.c
drivers/rtc/rtc-m41t80.c
drivers/rtc/rtc-pcf85063.c
drivers/rtc/rtc-pcf8523.c
drivers/rtc/rtc-stmp3xxx.c
drivers/s390/cio/css.c
drivers/s390/net/ctcm_fsms.c
drivers/s390/net/ctcm_mpc.c
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_ethtool.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c
drivers/s390/scsi/zfcp_fsf.c
drivers/scsi/53c700.c
drivers/scsi/BusLogic.c
drivers/scsi/FlashPoint.c
drivers/scsi/NCR5380.c
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/linit.c
drivers/scsi/aic7xxx/aic79xx_core.c
drivers/scsi/aic7xxx/aic79xx_osm.c
drivers/scsi/aic7xxx/aic7xxx_core.c
drivers/scsi/aic94xx/aic94xx_scb.c
drivers/scsi/aic94xx/aic94xx_tmf.c
drivers/scsi/arcmsr/arcmsr_hba.c
drivers/scsi/arm/fas216.c
drivers/scsi/be2iscsi/be_iscsi.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bfa/bfa_fcpim.c
drivers/scsi/bfa/bfa_fcs_lport.c
drivers/scsi/bfa/bfa_fcs_rport.c
drivers/scsi/bfa/bfa_ioc.c
drivers/scsi/bfa/bfa_svc.c
drivers/scsi/bnx2fc/bnx2fc_hwi.c
drivers/scsi/csiostor/csio_hw.c
drivers/scsi/csiostor/csio_lnode.c
drivers/scsi/csiostor/csio_wr.c
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
drivers/scsi/cxlflash/main.c
drivers/scsi/cxlflash/superpipe.c
drivers/scsi/device_handler/scsi_dh_hp_sw.c
drivers/scsi/esas2r/esas2r_flash.c
drivers/scsi/esas2r/esas2r_init.c
drivers/scsi/esp_scsi.c
drivers/scsi/fcoe/fcoe_ctlr.c
drivers/scsi/g_NCR5380.c
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hpsa.c
drivers/scsi/ibmvscsi/ibmvfc.c
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
drivers/scsi/imm.c
drivers/scsi/isci/phy.c
drivers/scsi/isci/remote_device.c
drivers/scsi/isci/remote_node_context.c
drivers/scsi/isci/request.c
drivers/scsi/libfc/fc_exch.c
drivers/scsi/libfc/fc_fcp.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/libfc/fc_rport.c
drivers/scsi/libiscsi.c
drivers/scsi/libiscsi_tcp.c
drivers/scsi/libsas/sas_ata.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/libsas/sas_scsi_host.c
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_nvme.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/megaraid.c
drivers/scsi/megaraid/megaraid_mbox.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/mesh.c
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_ctl.c
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/scsi/myrb.c
drivers/scsi/ncr53c8xx.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/scsi/ppa.c
drivers/scsi/qla2xxx/qla_dbg.h
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gs.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_iocb.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_nvme.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_sup.c
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/qla4xxx/ql4_os.c
drivers/scsi/qlogicpti.c
drivers/scsi/scsi_debug.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_lib.c
drivers/scsi/smartpqi/smartpqi_init.c
drivers/scsi/sr.c
drivers/scsi/st.c
drivers/scsi/sun3_scsi.c
drivers/scsi/sym53c8xx_2/sym_fw.c
drivers/scsi/sym53c8xx_2/sym_hipd.c
drivers/scsi/sym53c8xx_2/sym_nvram.c
drivers/scsi/ufs/ti-j721e-ufs.c
drivers/scsi/ufs/ufs-mediatek.c
drivers/scsi/ufs/ufs_bsg.c
drivers/scsi/ufs/ufshcd-pci.c
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h
drivers/scsi/virtio_scsi.c
drivers/scsi/vmw_pvscsi.c
drivers/scsi/wd33c93.c
drivers/scsi/xen-scsifront.c
drivers/soc/qcom/socinfo.c
drivers/soc/samsung/Kconfig
drivers/soc/samsung/Makefile
drivers/soc/samsung/s3c-pm-check.c [new file with mode: 0644]
drivers/soc/samsung/s3c-pm-debug.c [new file with mode: 0644]
drivers/soc/tegra/pmc.c
drivers/soc/ti/omap_prm.c
drivers/soc/ti/pm33xx.c
drivers/soc/versatile/soc-integrator.c
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/spi-bcm2835aux.c
drivers/spi/spi-fsl-cpm.c
drivers/spi/spi-s3c24xx-fiq.S [deleted file]
drivers/spi/spi-s3c24xx-fiq.h [deleted file]
drivers/spi/spi-s3c24xx-regs.h [new file with mode: 0644]
drivers/spi/spi-s3c24xx.c
drivers/spi/spi-sprd-adi.c
drivers/spi/spi-stm32.c
drivers/spi/spi.c
drivers/ssb/driver_chipcommon.c
drivers/ssb/driver_mipscore.c
drivers/ssb/scan.c
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
drivers/staging/media/atomisp/pci/sh_css.c
drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c
drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/usbvision/usbvision-i2c.c
drivers/target/iscsi/cxgbit/cxgbit_main.c
drivers/target/iscsi/iscsi_target.c
drivers/target/target_core_pr.c
drivers/target/target_core_sbc.c
drivers/target/target_core_transport.c
drivers/target/tcm_fc/tfc_cmd.c
drivers/thermal/qcom/tsens-v0_1.c
drivers/thermal/qcom/tsens-v1.c
drivers/thunderbolt/ctl.c
drivers/thunderbolt/switch.c
drivers/thunderbolt/tunnel.c
drivers/tty/hvc/hvc_xen.c
drivers/tty/mips_ejtag_fdc.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_r3964.c
drivers/tty/serial/8250/8250_em.c
drivers/tty/serial/8250/8250_exar.c
drivers/tty/serial/8250/8250_fintek.c
drivers/tty/serial/8250/8250_pci.c
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/8250/8250_uniphier.c
drivers/tty/serial/Kconfig
drivers/tty/serial/Makefile
drivers/tty/serial/amba-pl011.c
drivers/tty/serial/atmel_serial.c
drivers/tty/serial/omap-serial.c
drivers/tty/serial/qcom_geni_serial.c
drivers/tty/serial/rda-uart.c
drivers/tty/serial/samsung_tty.c
drivers/tty/serial/serial-tegra.c
drivers/tty/serial/serial_core.c
drivers/tty/serial/stm32-usart.c
drivers/tty/serial/sunsu.c
drivers/tty/serial/sunzilog.c
drivers/tty/serial/xilinx_uartps.c
drivers/tty/tty_ioctl.c
drivers/tty/vt/vt.c
drivers/tty/vt/vt_ioctl.c
drivers/usb/c67x00/c67x00-sched.c
drivers/usb/class/cdc-acm.c
drivers/usb/core/driver.c
drivers/usb/core/generic.c
drivers/usb/core/hcd-pci.c
drivers/usb/core/hub.c
drivers/usb/core/quirks.c
drivers/usb/dwc3/core.c
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/function/f_mass_storage.c
drivers/usb/gadget/function/f_ncm.c
drivers/usb/gadget/function/f_tcm.c
drivers/usb/gadget/u_f.h
drivers/usb/gadget/udc/atmel_usba_udc.c
drivers/usb/gadget/udc/fsl_udc_core.c
drivers/usb/gadget/udc/pxa25x_udc.c
drivers/usb/gadget/udc/s3c-hsudc.c
drivers/usb/gadget/udc/s3c2410_udc.c
drivers/usb/gadget/udc/s3c2410_udc.h
drivers/usb/gadget/udc/s3c2410_udc_regs.h [new file with mode: 0644]
drivers/usb/host/isp116x-hcd.c
drivers/usb/host/ohci-exynos.c
drivers/usb/host/pci-quirks.c
drivers/usb/host/xhci-dbgcap.c
drivers/usb/host/xhci-debugfs.c
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-pci-renesas.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci-tegra.c
drivers/usb/host/xhci.c
drivers/usb/misc/lvstest.c
drivers/usb/misc/yurex.c
drivers/usb/musb/cppi_dma.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_dsps.c
drivers/usb/musb/musb_gadget_ep0.c
drivers/usb/musb/musb_host.c
drivers/usb/musb/musb_virthub.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/tusb6010.c
drivers/usb/phy/phy-jz4770.c
drivers/usb/storage/sddr55.c
drivers/usb/storage/uas.c
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/unusual_uas.h
drivers/usb/typec/tcpm/tcpci.c
drivers/usb/typec/tcpm/tcpm.c
drivers/usb/typec/ucsi/displayport.c
drivers/usb/typec/ucsi/ucsi.c
drivers/usb/usbip/stub_dev.c
drivers/vdpa/ifcvf/ifcvf_base.h
drivers/vdpa/ifcvf/ifcvf_main.c
drivers/vdpa/mlx5/net/mlx5_vnet.c
drivers/vfio/pci/vfio_pci.c
drivers/vfio/pci/vfio_pci_private.h
drivers/vfio/pci/vfio_pci_rdwr.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/iotlb.c
drivers/video/backlight/adp8860_bl.c
drivers/video/fbdev/acornfb.c
drivers/video/fbdev/arcfb.c
drivers/video/fbdev/atmel_lcdfb.c
drivers/video/fbdev/aty/radeon_pm.c
drivers/video/fbdev/cirrusfb.c
drivers/video/fbdev/controlfb.c
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbmem.c
drivers/video/fbdev/efifb.c
drivers/video/fbdev/fsl-diu-fb.c
drivers/video/fbdev/gxt4500.c
drivers/video/fbdev/hyperv_fb.c
drivers/video/fbdev/i740fb.c
drivers/video/fbdev/mmp/fb/mmpfb.c
drivers/video/fbdev/nvidia/nv_hw.c
drivers/video/fbdev/offb.c
drivers/video/fbdev/omap/lcdc.c
drivers/video/fbdev/omap/omapfb_main.c
drivers/video/fbdev/omap2/omapfb/dss/dispc.c
drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
drivers/video/fbdev/omap2/omapfb/omapfb-main.c
drivers/video/fbdev/pm2fb.c
drivers/video/fbdev/pxa168fb.c
drivers/video/fbdev/pxafb.c
drivers/video/fbdev/riva/fbdev.c
drivers/video/fbdev/s3c-fb.c
drivers/video/fbdev/s3c2410fb-regs-lcd.h [new file with mode: 0644]
drivers/video/fbdev/s3c2410fb.c
drivers/video/fbdev/sa1100fb.c
drivers/video/fbdev/savage/savagefb_driver.c
drivers/video/fbdev/sh_mobile_lcdcfb.c
drivers/video/fbdev/sis/sis_main.c
drivers/video/fbdev/sm501fb.c
drivers/video/fbdev/stifb.c
drivers/video/fbdev/tdfxfb.c
drivers/video/fbdev/via/lcd.c
drivers/video/fbdev/xen-fbfront.c
drivers/watchdog/Kconfig
drivers/watchdog/sc1200wdt.c
drivers/watchdog/wdrtas.c
drivers/xen/events/events_base.c
drivers/xen/pvcalls-front.c
drivers/xen/xen-acpi-memhotplug.c
drivers/xen/xen-pciback/xenbus.c
drivers/xen/xen-scsiback.c
drivers/xen/xenbus/xenbus_client.c
drivers/xen/xenbus/xenbus_probe_frontend.c
fs/9p/vfs_file.c
fs/adfs/dir_f.c
fs/affs/inode.c
fs/affs/super.c
fs/afs/cmservice.c
fs/afs/dynroot.c
fs/afs/file.c
fs/afs/flock.c
fs/afs/fs_operation.c
fs/afs/fsclient.c
fs/afs/misc.c
fs/afs/rotate.c
fs/afs/rxrpc.c
fs/afs/vlclient.c
fs/afs/write.c
fs/afs/yfsclient.c
fs/aio.c
fs/binfmt_flat.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/file.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c
fs/btrfs/super.c
fs/btrfs/tree-log.c
fs/buffer.c
fs/ceph/caps.c
fs/ceph/debugfs.c
fs/ceph/dir.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.h
fs/ceph/quota.c
fs/ceph/super.h
fs/cifs/cifsglob.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/sess.c
fs/cifs/smb2pdu.c
fs/configfs/dir.c
fs/dax.c
fs/dlm/lock.c
fs/erofs/zmap.c
fs/eventpoll.c
fs/ext2/inode.c
fs/ext2/super.c
fs/ext4/Kconfig
fs/ext4/balloc.c
fs/ext4/block_validity.c
fs/ext4/ext4.h
fs/ext4/ext4_jbd2.c
fs/ext4/extents.c
fs/ext4/file.c
fs/ext4/hash.c
fs/ext4/indirect.c
fs/ext4/inline.c
fs/ext4/inode.c
fs/ext4/ioctl.c
fs/ext4/mballoc.c
fs/ext4/mballoc.h
fs/ext4/move_extent.c
fs/ext4/namei.c
fs/ext4/readpage.c
fs/ext4/super.c
fs/ext4/sysfs.c
fs/ext4/xattr.c
fs/f2fs/f2fs.h
fs/f2fs/node.c
fs/fcntl.c
fs/fs-writeback.c
fs/fs_context.c
fs/fsopen.c
fs/gfs2/bmap.c
fs/gfs2/log.c
fs/gfs2/quota.c
fs/gfs2/trans.c
fs/hfsplus/wrapper.c
fs/io-wq.c
fs/io_uring.c
fs/iomap/seek.c
fs/jbd2/journal.c
fs/jbd2/recovery.c
fs/jbd2/transaction.c
fs/jffs2/fs.c
fs/jffs2/readinode.c
fs/libfs.c
fs/locks.c
fs/nfs/blocklayout/blocklayout.c
fs/nfs/dir.c
fs/nfs/filelayout/filelayout.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/fs_context.c
fs/nfs/nfs3acl.c
fs/nfs/nfs4file.c
fs/nfs/nfs4idmap.c
fs/nfs/nfs4proc.c
fs/nfs/nfs4state.c
fs/nfs/pagelist.c
fs/nfs/pnfs.c
fs/nfs_common/nfsacl.c
fs/nfsd/blocklayout.c
fs/nfsd/nfs4callback.c
fs/nfsd/nfs4layouts.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4state.c
fs/nfsd/nfsfh.c
fs/nfsd/nfsproc.c
fs/nfsd/nfssvc.c
fs/nfsd/vfs.c
fs/nilfs2/bmap.c
fs/nilfs2/recovery.c
fs/nilfs2/segment.c
fs/notify/fanotify/fanotify_user.c
fs/ocfs2/cluster/quorum.c
fs/pstore/zone.c
fs/quota/quota.c
fs/romfs/storage.c
fs/seq_file.c
fs/signalfd.c
fs/squashfs/block.c
fs/ubifs/lprops.c
fs/udf/symlink.c
fs/ufs/util.h
fs/vboxsf/utils.c
fs/xfs/libxfs/xfs_trans_inode.c
include/drm/drm_modeset_lock.h
include/linux/ceph/ceph_features.h
include/linux/clk/samsung.h [new file with mode: 0644]
include/linux/compat.h
include/linux/cpufreq.h
include/linux/cpuhotplug.h
include/linux/cpuidle.h
include/linux/dma-direct.h
include/linux/dma-mapping.h
include/linux/filter.h
include/linux/fs.h
include/linux/irqflags.h
include/linux/jbd2.h
include/linux/jhash.h
include/linux/kernel.h
include/linux/lockdep.h
include/linux/mm.h
include/linux/mmu_context.h
include/linux/netfilter_ipv6.h
include/linux/pgtable.h
include/linux/phylink.h
include/linux/platform_data/clk-s3c2410.h [new file with mode: 0644]
include/linux/platform_data/fb-s3c2410.h [new file with mode: 0644]
include/linux/platform_data/mmc-s3cmci.h
include/linux/platform_data/pm33xx.h
include/linux/platform_data/s3c-hsudc.h
include/linux/sched.h
include/linux/sched/user.h
include/linux/signal.h
include/linux/skbuff.h
include/linux/soc/samsung/s3c-adc.h [new file with mode: 0644]
include/linux/soc/samsung/s3c-cpu-freq.h [new file with mode: 0644]
include/linux/soc/samsung/s3c-cpufreq-core.h [new file with mode: 0644]
include/linux/soc/samsung/s3c-pm.h [new file with mode: 0644]
include/linux/soc/ti/ti_sci_protocol.h
include/linux/spi/s3c24xx-fiq.h [new file with mode: 0644]
include/linux/spi/s3c24xx.h
include/math-emu/op-common.h
include/media/drv-intf/s3c_camif.h
include/net/addrconf.h
include/trace/events/ext4.h
include/trace/events/mmflags.h
include/trace/events/writeback.h
include/uapi/linux/bpf.h
include/xen/arm/page.h
ipc/sem.c
ipc/shm.c
kernel/auditfilter.c
kernel/bpf/bpf_iter.c
kernel/bpf/cgroup.c
kernel/bpf/cpumap.c
kernel/bpf/stackmap.c
kernel/bpf/syscall.c
kernel/bpf/task_iter.c
kernel/bpf/verifier.c
kernel/capability.c
kernel/compat.c
kernel/debug/gdbstub.c
kernel/debug/kdb/kdb_keyboard.c
kernel/debug/kdb/kdb_support.c
kernel/dma/direct.c
kernel/dma/pool.c
kernel/entry/common.c
kernel/events/core.c
kernel/events/uprobes.c
kernel/irq/handle.c
kernel/irq/manage.c
kernel/irq/matrix.c
kernel/kallsyms.c
kernel/locking/lockdep.c
kernel/power/hibernate.c
kernel/power/qos.c
kernel/relay.c
kernel/sched/core.c
kernel/sched/idle.c
kernel/sched/topology.c
kernel/signal.c
kernel/sys.c
kernel/time/hrtimer.c
kernel/time/posix-timers.c
kernel/time/tick-broadcast.c
kernel/time/timer.c
kernel/trace/blktrace.c
kernel/trace/trace_events_filter.c
kernel/watch_queue.c
lib/Makefile
lib/bootconfig.c
lib/glob.c
lib/vsprintf.c
lib/xz/xz_dec_lzma2.c
lib/xz/xz_dec_stream.c
lib/zstd/decompress.c
mm/hugetlb_cgroup.c
mm/khugepaged.c
mm/ksm.c
mm/memory.c
mm/page_alloc.c
mm/rodata_test.c
mm/vmalloc.c
net/8021q/vlan_dev.c
net/9p/trans_xen.c
net/atm/common.c
net/atm/lec.c
net/atm/resources.c
net/bpf/test_run.c
net/bridge/netfilter/ebtables.c
net/bridge/netfilter/nf_conntrack_bridge.c
net/can/j1939/socket.c
net/can/j1939/transport.c
net/ceph/ceph_hash.c
net/ceph/crush/mapper.c
net/ceph/messenger.c
net/ceph/mon_client.c
net/ceph/osd_client.c
net/core/dev.c
net/core/dev_ioctl.c
net/core/devlink.c
net/core/drop_monitor.c
net/core/filter.c
net/core/pktgen.c
net/core/skbuff.c
net/core/skmsg.c
net/core/sock.c
net/dccp/ccids/ccid3.c
net/dccp/feat.c
net/dccp/input.c
net/dccp/options.c
net/dccp/output.c
net/dccp/proto.c
net/decnet/af_decnet.c
net/decnet/dn_nsp_in.c
net/decnet/dn_table.c
net/decnet/sysctl_net_decnet.c
net/dsa/slave.c
net/ethtool/features.c
net/ieee802154/6lowpan/reassembly.c
net/ieee802154/6lowpan/rx.c
net/ipv4/Kconfig
net/ipv4/nexthop.c
net/ipv6/addrconf.c
net/ipv6/ip6_tunnel.c
net/ipv6/netfilter.c
net/iucv/af_iucv.c
net/mpls/af_mpls.c
net/mptcp/protocol.c
net/ncsi/ncsi-manage.c
net/netfilter/ipvs/ip_vs_proto_tcp.c
net/netfilter/ipvs/ip_vs_proto_udp.c
net/netfilter/nf_tables_api.c
net/netfilter/nft_compat.c
net/netfilter/nft_exthdr.c
net/netlink/policy.c
net/netrom/nr_in.c
net/netrom/nr_route.c
net/openvswitch/conntrack.c
net/openvswitch/flow.c
net/packet/af_packet.c
net/phonet/pep.c
net/qrtr/qrtr.c
net/rds/send.c
net/rose/rose_in.c
net/rose/rose_route.c
net/rxrpc/af_rxrpc.c
net/rxrpc/call_accept.c
net/rxrpc/conn_client.c
net/rxrpc/input.c
net/rxrpc/local_object.c
net/rxrpc/peer_event.c
net/rxrpc/recvmsg.c
net/rxrpc/sendmsg.c
net/sched/act_ct.c
net/sched/sch_cake.c
net/sctp/ipv6.c
net/sctp/outqueue.c
net/sctp/sm_make_chunk.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statefuns.c
net/sctp/stream.c
net/smc/smc_close.c
net/smc/smc_diag.c
net/sunrpc/auth_gss/gss_krb5_wrap.c
net/sunrpc/auth_gss/trace.c
net/sunrpc/clnt.c
net/sunrpc/xprt.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtsock.c
net/tipc/Kconfig
net/tipc/bearer.c
net/tipc/crypto.c
net/tipc/group.c
net/tipc/link.c
net/tipc/netlink_compat.c
net/tipc/socket.c
net/tipc/udp_media.c
net/unix/af_unix.c
net/wireless/chan.c
net/wireless/mlme.c
net/wireless/nl80211.c
net/wireless/scan.c
net/wireless/sme.c
net/wireless/util.c
net/wireless/wext-compat.c
net/x25/x25_facilities.c
net/x25/x25_in.c
net/xfrm/xfrm_policy.c
samples/bpf/hbm.c
scripts/Makefile.extrawarn
scripts/extract-cert.c
scripts/genksyms/keywords.c
scripts/kconfig/qconf.cc
scripts/kconfig/qconf.h
security/apparmor/domain.c
security/apparmor/lib.c
security/integrity/ima/ima_appraise.c
security/integrity/ima/ima_policy.c
security/integrity/ima/ima_template_lib.c
security/keys/process_keys.c
security/keys/request_key.c
security/selinux/hooks.c
security/selinux/ss/mls.c
security/smack/smack_lsm.c
security/tomoyo/common.c
security/tomoyo/file.c
sound/hda/hdac_bus.c
sound/hda/hdac_controller.c
sound/isa/sscape.c
sound/pci/hda/patch_realtek.c
sound/ppc/snd_ps3.c
sound/soc/amd/acp3x-rt5682-max9836.c
sound/soc/amd/renoir/acp3x-pdm-dma.c
sound/soc/atmel/mchp-i2s-mcc.c
sound/soc/codecs/jz4770.c
sound/soc/codecs/msm8916-wcd-analog.c
sound/soc/codecs/pcm186x.c
sound/soc/codecs/wm8958-dsp2.c
sound/soc/codecs/wm8962.c
sound/soc/codecs/wm8994.c
sound/soc/fsl/fsl-asoc-card.c
sound/soc/fsl/fsl_ssi.c
sound/soc/fsl/mpc5200_dma.c
sound/soc/hisilicon/hi6210-i2s.c
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/intel/baytrail/sst-baytrail-pcm.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/skylake/skl-pcm.c
sound/soc/meson/axg-tdm-interface.c
sound/soc/pxa/pxa-ssp.c
sound/soc/qcom/qdsp6/q6afe-dai.c
sound/soc/qcom/qdsp6/q6routing.c
sound/soc/rockchip/rockchip_pdm.c
sound/soc/samsung/Kconfig
sound/soc/samsung/h1940_uda1380.c
sound/soc/samsung/i2s.c
sound/soc/samsung/neo1973_wm8753.c
sound/soc/samsung/rx1950_uda1380.c
sound/soc/samsung/s3c-i2s-v2.c
sound/soc/samsung/s3c-i2s-v2.h
sound/soc/samsung/s3c2412-i2s.c
sound/soc/samsung/s3c24xx-i2s.c
sound/soc/soc-component.c
sound/soc/soc-core.c
sound/soc/soc-topology.c
sound/soc/sof/intel/hda-dai.c
sound/soc/sof/pcm.c
sound/soc/tegra/tegra186_dspk.c
sound/soc/tegra/tegra210_admaif.c
sound/soc/tegra/tegra210_ahub.c
sound/soc/tegra/tegra210_dmic.c
sound/soc/tegra/tegra210_i2s.c
sound/soc/ti/davinci-i2s.c
sound/soc/ti/n810.c
sound/soc/ti/omap-dmic.c
sound/soc/ti/omap-mcpdm.c
sound/soc/ti/rx51.c
sound/soc/zte/zx-i2s.c
sound/soc/zte/zx-spdif.c
sound/usb/mixer.c
sound/usb/quirks-table.h
tools/bpf/bpftool/btf_dumper.c
tools/bpf/bpftool/gen.c
tools/bpf/bpftool/link.c
tools/bpf/bpftool/main.h
tools/bpf/bpftool/pids.c
tools/bpf/bpftool/prog.c
tools/bpf/resolve_btfids/main.c
tools/include/uapi/linux/bpf.h
tools/lib/bpf/bpf_helpers.h
tools/lib/bpf/btf.c
tools/lib/bpf/btf.h
tools/lib/bpf/btf_dump.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.map
tools/testing/selftests/bpf/.gitignore
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c
tools/testing/selftests/bpf/prog_tests/btf_dump.c
tools/testing/selftests/bpf/prog_tests/core_extern.c
tools/testing/selftests/bpf/prog_tests/core_reloc.c
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
tools/testing/selftests/bpf/prog_tests/flow_dissector.c
tools/testing/selftests/bpf/prog_tests/global_data.c
tools/testing/selftests/bpf/prog_tests/mmap.c
tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c
tools/testing/selftests/bpf/prog_tests/sk_lookup.c
tools/testing/selftests/bpf/prog_tests/skb_ctx.c
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c
tools/testing/selftests/bpf/prog_tests/varlen.c
tools/testing/selftests/bpf/progs/core_reloc_types.h
tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
tools/testing/selftests/bpf/progs/test_varlen.c
tools/testing/selftests/bpf/test_btf.c
tools/testing/selftests/bpf/test_progs.h
tools/testing/selftests/kvm/x86_64/debug_regs.c
tools/testing/selftests/net/icmp_redirect.sh
tools/testing/selftests/netfilter/nft_flowtable.sh
tools/testing/selftests/powerpc/mm/.gitignore
tools/testing/selftests/powerpc/mm/Makefile
tools/testing/selftests/powerpc/mm/prot_sao.c [new file with mode: 0644]
tools/usb/Build [new file with mode: 0644]
tools/usb/Makefile
virt/kvm/kvm_main.c

index 57fe008..332c783 100644 (file)
--- a/.mailmap
+++ b/.mailmap
 Aaron Durbin <adurbin@google.com>
 Adam Oldham <oldhamca@gmail.com>
 Adam Radford <aradford@gmail.com>
-Adrian Bunk <bunk@stusta.de>
 Adriana Reus <adi.reus@gmail.com> <adriana.reus@intel.com>
+Adrian Bunk <bunk@stusta.de>
 Alan Cox <alan@lxorguk.ukuu.org.uk>
 Alan Cox <root@hraefn.swansea.linux.org.uk>
-Aleksey Gorelov <aleksey_gorelov@phoenix.com>
 Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com>
-Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@intel.com>
-Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@linaro.org>
+Aleksey Gorelov <aleksey_gorelov@phoenix.com>
 Alexander Lobakin <alobakin@pm.me> <alobakin@dlink.ru>
 Alexander Lobakin <alobakin@pm.me> <alobakin@marvell.com>
 Alexander Lobakin <alobakin@pm.me> <bloodyreaper@yandex.ru>
 Alexandre Belloni <alexandre.belloni@bootlin.com> <alexandre.belloni@free-electrons.com>
-Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com>
 Alexei Starovoitov <ast@kernel.org> <alexei.starovoitov@gmail.com>
 Alexei Starovoitov <ast@kernel.org> <ast@fb.com>
+Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com>
+Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@intel.com>
+Alex Shi <alex.shi@linux.alibaba.com> <alex.shi@linaro.org>
 Al Viro <viro@ftp.linux.org.uk>
 Al Viro <viro@zenIV.linux.org.uk>
+Andi Kleen <ak@linux.intel.com> <ak@suse.de>
 Andi Shyti <andi@etezian.org> <andi.shyti@samsung.com>
 Andreas Herrmann <aherrman@de.ibm.com>
-Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com>
 Andrew Morton <akpm@linux-foundation.org>
-Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com>
 Andrew Murray <amurray@thegoodpenguin.co.uk> <amurray@embedded-bits.co.uk>
+Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com>
 Andrew Vasquez <andrew.vasquez@qlogic.com>
+Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com>
 Andy Adamson <andros@citi.umich.edu>
 Antoine Tenart <antoine.tenart@free-electrons.com>
 Antonio Ospite <ao2@ao2.it> <ao2@amarulasolutions.com>
@@ -48,40 +49,42 @@ Arnaud Patard <arnaud.patard@rtp-net.org>
 Arnd Bergmann <arnd@arndb.de>
 Axel Dyks <xl@xlsigned.net>
 Axel Lin <axel.lin@gmail.com>
-Bart Van Assche <bvanassche@acm.org> <bart.vanassche@wdc.com>
 Bart Van Assche <bvanassche@acm.org> <bart.vanassche@sandisk.com>
+Bart Van Assche <bvanassche@acm.org> <bart.vanassche@wdc.com>
 Ben Gardner <bgardner@wabtec.com>
 Ben M Cahill <ben.m.cahill@intel.com>
 Björn Steinbrink <B.Steinbrink@gmx.de>
-Boris Brezillon <bbrezillon@kernel.org> <boris.brezillon@bootlin.com>
-Boris Brezillon <bbrezillon@kernel.org> <boris.brezillon@free-electrons.com>
 Boris Brezillon <bbrezillon@kernel.org> <b.brezillon.dev@gmail.com>
 Boris Brezillon <bbrezillon@kernel.org> <b.brezillon@overkiz.com>
+Boris Brezillon <bbrezillon@kernel.org> <boris.brezillon@bootlin.com>
+Boris Brezillon <bbrezillon@kernel.org> <boris.brezillon@free-electrons.com>
 Brian Avery <b.avery@hp.com>
 Brian King <brking@us.ibm.com>
+Changbin Du <changbin.du@intel.com> <changbin.du@gmail.com>
+Changbin Du <changbin.du@intel.com> <changbin.du@intel.com>
 Chao Yu <chao@kernel.org> <chao2.yu@samsung.com>
 Chao Yu <chao@kernel.org> <yuchao0@huawei.com>
-Christoph Hellwig <hch@lst.de>
 Christophe Ricard <christophe.ricard@gmail.com>
+Christoph Hellwig <hch@lst.de>
 Corey Minyard <minyard@acm.org>
 Damian Hobson-Garcia <dhobsong@igel.co.jp>
-Daniel Borkmann <daniel@iogearbox.net> <dborkman@redhat.com>
-Daniel Borkmann <daniel@iogearbox.net> <dborkmann@redhat.com>
+Daniel Borkmann <daniel@iogearbox.net> <danborkmann@googlemail.com>
 Daniel Borkmann <daniel@iogearbox.net> <danborkmann@iogearbox.net>
 Daniel Borkmann <daniel@iogearbox.net> <daniel.borkmann@tik.ee.ethz.ch>
-Daniel Borkmann <daniel@iogearbox.net> <danborkmann@googlemail.com>
+Daniel Borkmann <daniel@iogearbox.net> <dborkmann@redhat.com>
+Daniel Borkmann <daniel@iogearbox.net> <dborkman@redhat.com>
 Daniel Borkmann <daniel@iogearbox.net> <dxchgb@gmail.com>
 David Brownell <david-b@pacbell.net>
 David Woodhouse <dwmw2@shinybook.infradead.org>
-Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@mips.com>
-Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@imgtec.com>
 Dengcheng Zhu <dzhu@wavecomp.com> <dczhu@mips.com>
 Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@gmail.com>
+Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@imgtec.com>
+Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@mips.com>
 <dev.kurt@vandijck-laurijssen.be> <kurt.van.dijck@eia.be>
 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
-Dmitry Safonov <0x7f454c46@gmail.com> <dsafonov@virtuozzo.com>
-Dmitry Safonov <0x7f454c46@gmail.com> <d.safonov@partner.samsung.com>
 Dmitry Safonov <0x7f454c46@gmail.com> <dima@arista.com>
+Dmitry Safonov <0x7f454c46@gmail.com> <d.safonov@partner.samsung.com>
+Dmitry Safonov <0x7f454c46@gmail.com> <dsafonov@virtuozzo.com>
 Domen Puncer <domen@coderock.org>
 Douglas Gilbert <dougg@torque.net>
 Ed L. Cashin <ecashin@coraid.com>
@@ -92,20 +95,22 @@ Felix Kuhling <fxkuehl@gmx.de>
 Felix Moeller <felix@derklecks.de>
 Filipe Lautert <filipe@icewall.org>
 Franck Bui-Huu <vagabon.xyz@gmail.com>
-Frank Rowand <frowand.list@gmail.com> <frowand@mvista.com>
 Frank Rowand <frowand.list@gmail.com> <frank.rowand@am.sony.com>
 Frank Rowand <frowand.list@gmail.com> <frank.rowand@sonymobile.com>
+Frank Rowand <frowand.list@gmail.com> <frowand@mvista.com>
 Frank Zago <fzago@systemfabricworks.com>
 Gao Xiang <xiang@kernel.org> <gaoxiang25@huawei.com>
 Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com>
-Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com>
 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com>
+Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com>
 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@linux.vnet.ibm.com>
 Greg Kroah-Hartman <greg@echidna.(none)>
 Greg Kroah-Hartman <gregkh@suse.de>
 Greg Kroah-Hartman <greg@kroah.com>
 Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com>
 Gregory CLEMENT <gregory.clement@bootlin.com> <gregory.clement@free-electrons.com>
+Gustavo Padovan <gustavo@las.ic.unicamp.br>
+Gustavo Padovan <padovan@profusion.mobi>
 Hanjun Guo <guohanjun@huawei.com> <hanjun.guo@linaro.org>
 Heiko Carstens <hca@linux.ibm.com> <h.carstens@de.ibm.com>
 Heiko Carstens <hca@linux.ibm.com> <heiko.carstens@de.ibm.com>
@@ -115,32 +120,33 @@ Henrik Rydberg <rydberg@bitmath.org>
 Herbert Xu <herbert@gondor.apana.org.au>
 Jacob Shin <Jacob.Shin@amd.com>
 Jaegeuk Kim <jaegeuk@kernel.org> <jaegeuk@google.com>
-Jaegeuk Kim <jaegeuk@kernel.org> <jaegeuk@motorola.com>
 Jaegeuk Kim <jaegeuk@kernel.org> <jaegeuk.kim@samsung.com>
+Jaegeuk Kim <jaegeuk@kernel.org> <jaegeuk@motorola.com>
 Jakub Kicinski <kuba@kernel.org> <jakub.kicinski@netronome.com>
 James Bottomley <jejb@mulgrave.(none)>
 James Bottomley <jejb@titanic.il.steeleye.com>
 James E Wilson <wilson@specifix.com>
-James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
 James Hogan <jhogan@kernel.org> <james@albanarts.com>
+James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
 James Ketrenos <jketreno@io.(none)>
 Jan Glauber <jan.glauber@gmail.com> <jang@de.ibm.com>
 Jan Glauber <jan.glauber@gmail.com> <jang@linux.vnet.ibm.com>
 Jan Glauber <jan.glauber@gmail.com> <jglauber@cavium.com>
 Jason Gunthorpe <jgg@ziepe.ca> <jgg@mellanox.com>
+Jason Gunthorpe <jgg@ziepe.ca> <jgg@nvidia.com>
 Jason Gunthorpe <jgg@ziepe.ca> <jgunthorpe@obsidianresearch.com>
-Javi Merino <javi.merino@kernel.org> <javi.merino@arm.com>
 <javier@osg.samsung.com> <javier.martinez@collabora.co.uk>
+Javi Merino <javi.merino@kernel.org> <javi.merino@arm.com>
 Jayachandran C <c.jayachandran@gmail.com> <jayachandranc@netlogicmicro.com>
 Jayachandran C <c.jayachandran@gmail.com> <jchandra@broadcom.com>
 Jayachandran C <c.jayachandran@gmail.com> <jchandra@digeo.com>
 Jayachandran C <c.jayachandran@gmail.com> <jnair@caviumnetworks.com>
-Jean Tourrilhes <jt@hpl.hp.com>
 <jean-philippe@linaro.org> <jean-philippe.brucker@arm.com>
+Jean Tourrilhes <jt@hpl.hp.com>
 Jeff Garzik <jgarzik@pretzel.yyz.us>
-Jeff Layton <jlayton@kernel.org> <jlayton@redhat.com>
 Jeff Layton <jlayton@kernel.org> <jlayton@poochiereds.net>
 Jeff Layton <jlayton@kernel.org> <jlayton@primarydata.com>
+Jeff Layton <jlayton@kernel.org> <jlayton@redhat.com>
 Jens Axboe <axboe@suse.de>
 Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
 Jiri Slaby <jirislaby@kernel.org> <jirislaby@gmail.com>
@@ -164,30 +170,31 @@ Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com>
 Kamil Konieczny <k.konieczny@samsung.com> <k.konieczny@partner.samsung.com>
 Kay Sievers <kay.sievers@vrfy.org>
 Kenneth W Chen <kenneth.w.chen@intel.com>
-Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
 Konstantin Khlebnikov <koct9i@gmail.com> <khlebnikov@yandex-team.ru>
+Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
 Koushik <raghavendra.koushik@neterion.com>
-Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski@samsung.com>
 Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com>
+Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski@samsung.com>
 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Leon Romanovsky <leon@kernel.org> <leon@leon.nu>
-Leon Romanovsky <leon@kernel.org> <leonro@mellanox.com>
 Leonardo Bras <leobras.c@gmail.com> <leonardo@linux.ibm.com>
 Leonid I Ananiev <leonid.i.ananiev@intel.com>
+Leon Romanovsky <leon@kernel.org> <leon@leon.nu>
+Leon Romanovsky <leon@kernel.org> <leonro@mellanox.com>
+Leon Romanovsky <leon@kernel.org> <leonro@nvidia.com>
 Linas Vepstas <linas@austin.ibm.com>
-Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
 Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>
-Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org>
+Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
 Li Yang <leoyang.li@nxp.com> <leoli@freescale.com>
+Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org>
 Lukasz Luba <lukasz.luba@arm.com> <l.luba@partner.samsung.com>
 Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com>
-Marc Zyngier <maz@kernel.org> <marc.zyngier@arm.com>
 Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com>
+Marc Zyngier <maz@kernel.org> <marc.zyngier@arm.com>
 Mark Brown <broonie@sirena.org.uk>
 Mark Yao <markyao0591@gmail.com> <mark.yao@rock-chips.com>
-Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com>
 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com>
 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@puri.sm>
+Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com>
 Mathieu Othacehe <m.othacehe@gmail.com>
 Matthew Wilcox <willy@infradead.org> <matthew.r.wilcox@intel.com>
 Matthew Wilcox <willy@infradead.org> <matthew@wil.cx>
@@ -197,17 +204,17 @@ Matthew Wilcox <willy@infradead.org> <willy@debian.org>
 Matthew Wilcox <willy@infradead.org> <willy@linux.intel.com>
 Matthew Wilcox <willy@infradead.org> <willy@parisc-linux.org>
 Matthieu CASTET <castet.matthieu@free.fr>
-Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@brturbo.com.br>
+Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting>
+Matt Ranostay <mranostay@gmail.com> Matthew Ranostay <mranostay@embeddedalley.com>
+Matt Ranostay <mranostay@gmail.com> <matt.ranostay@intel.com>
+Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com>
 Mauro Carvalho Chehab <mchehab@kernel.org> <maurochehab@gmail.com>
+Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@brturbo.com.br>
 Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@infradead.org>
+Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@osg.samsung.com>
 Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@redhat.com>
 Mauro Carvalho Chehab <mchehab@kernel.org> <m.chehab@samsung.com>
-Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@osg.samsung.com>
 Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@s-opensource.com>
-Matt Ranostay <mranostay@gmail.com> Matthew Ranostay <mranostay@embeddedalley.com>
-Matt Ranostay <mranostay@gmail.com> <matt.ranostay@intel.com>
-Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting>
-Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com>
 Maxime Ripard <mripard@kernel.org> <maxime.ripard@bootlin.com>
 Maxime Ripard <mripard@kernel.org> <maxime.ripard@free-electrons.com>
 Mayuresh Janorkar <mayur@ti.com>
@@ -239,13 +246,13 @@ Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
 Patrick Mochel <mochel@digitalimplant.org>
 Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com>
 Paul Burton <paulburton@kernel.org> <paul.burton@mips.com>
+Paul E. McKenney <paulmck@kernel.org> <paul.mckenney@linaro.org>
 Paul E. McKenney <paulmck@kernel.org> <paulmck@linux.ibm.com>
 Paul E. McKenney <paulmck@kernel.org> <paulmck@linux.vnet.ibm.com>
-Paul E. McKenney <paulmck@kernel.org> <paul.mckenney@linaro.org>
 Paul E. McKenney <paulmck@kernel.org> <paulmck@us.ibm.com>
 Peter A Jonsson <pj@ludd.ltu.se>
-Peter Oruba <peter@oruba.de>
 Peter Oruba <peter.oruba@amd.com>
+Peter Oruba <peter@oruba.de>
 Pratyush Anand <pratyush.anand@gmail.com> <pratyush.anand@st.com>
 Praveen BP <praveenbp@ti.com>
 Punit Agrawal <punitagrawal@gmail.com> <punit.agrawal@arm.com>
@@ -258,23 +265,23 @@ Ralf Baechle <ralf@linux-mips.org>
 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
 Randy Dunlap <rdunlap@infradead.org> <rdunlap@xenotime.net>
 Rémi Denis-Courmont <rdenis@simphalempin.com>
-Ricardo Ribalda <ribalda@kernel.org> <ricardo.ribalda@gmail.com>
 Ricardo Ribalda <ribalda@kernel.org> <ricardo@ribalda.com>
 Ricardo Ribalda <ribalda@kernel.org> Ricardo Ribalda Delgado <ribalda@kernel.org>
+Ricardo Ribalda <ribalda@kernel.org> <ricardo.ribalda@gmail.com>
 Ross Zwisler <zwisler@kernel.org> <ross.zwisler@linux.intel.com>
 Rudolf Marek <R.Marek@sh.cvut.cz>
 Rui Saraiva <rmps@joel.ist.utl.pt>
 Sachin P Sant <ssant@in.ibm.com>
-Sarangdhar Joshi <spjoshi@codeaurora.org>
+Sakari Ailus <sakari.ailus@linux.intel.com> <sakari.ailus@iki.fi>
 Sam Ravnborg <sam@mars.ravnborg.org>
-Santosh Shilimkar <ssantosh@kernel.org>
 Santosh Shilimkar <santosh.shilimkar@oracle.org>
+Santosh Shilimkar <ssantosh@kernel.org>
+Sarangdhar Joshi <spjoshi@codeaurora.org>
 Sascha Hauer <s.hauer@pengutronix.de>
 S.ÇaÄŸlar Onur <caglar@pardus.org.tr>
-Sakari Ailus <sakari.ailus@linux.intel.com> <sakari.ailus@iki.fi>
 Sean Nyekjaer <sean@geanix.com> <sean.nyekjaer@prevas.dk>
-Sebastian Reichel <sre@kernel.org> <sre@debian.org>
 Sebastian Reichel <sre@kernel.org> <sebastian.reichel@collabora.co.uk>
+Sebastian Reichel <sre@kernel.org> <sre@debian.org>
 Sedat Dilek <sedat.dilek@gmail.com> <sedat.dilek@credativ.de>
 Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com>
 Shuah Khan <shuah@kernel.org> <shuahkhan@gmail.com>
@@ -285,18 +292,21 @@ Simon Arlott <simon@octiron.net> <simon@fire.lp0.eu>
 Simon Kelley <simon@thekelleys.org.uk>
 Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
 Stephen Hemminger <shemminger@osdl.org>
+Steve Wise <larrystevenwise@gmail.com> <swise@chelsio.com>
+Steve Wise <larrystevenwise@gmail.com> <swise@opengridcomputing.com>
 Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
 Subhash Jadavani <subhashj@codeaurora.org>
 Sudeep Holla <sudeep.holla@arm.com> Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
 Sumit Semwal <sumit.semwal@ti.com>
+Takashi YOSHII <takashi.yoshii.zj@renesas.com>
 Tejun Heo <htejun@gmail.com>
 Thomas Graf <tgraf@suug.ch>
 Thomas Pedersen <twp@codeaurora.org>
 Tiezhu Yang <yangtiezhu@loongson.cn> <kernelpatch@126.com>
 Todor Tomov <todor.too@gmail.com> <todor.tomov@linaro.org>
 Tony Luck <tony.luck@intel.com>
-TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn>
 TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org>
+TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn>
 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
 Uwe Kleine-König <ukl@pengutronix.de>
@@ -305,22 +315,16 @@ Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
 Vinod Koul <vkoul@kernel.org> <vinod.koul@intel.com>
 Vinod Koul <vkoul@kernel.org> <vinod.koul@linux.intel.com>
 Vinod Koul <vkoul@kernel.org> <vkoul@infradead.org>
+Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com>
 Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com>
 Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com>
-Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com>
 Vivien Didelot <vivien.didelot@gmail.com> <vivien.didelot@savoirfairelinux.com>
 Vlad Dogaru <ddvlad@gmail.com> <vlad.dogaru@intel.com>
-Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com>
 Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com>
-Takashi YOSHII <takashi.yoshii.zj@renesas.com>
+Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com>
+WeiXiong Liao <gmpy.liaowx@gmail.com> <liaoweixiong@allwinnertech.com>
 Will Deacon <will@kernel.org> <will.deacon@arm.com>
-Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de>
 Wolfram Sang <wsa@kernel.org> <w.sang@pengutronix.de>
+Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de>
 Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com>
 Yusuke Goda <goda.yusuke@renesas.com>
-Gustavo Padovan <gustavo@las.ic.unicamp.br>
-Gustavo Padovan <padovan@profusion.mobi>
-Changbin Du <changbin.du@intel.com> <changbin.du@intel.com>
-Changbin Du <changbin.du@intel.com> <changbin.du@gmail.com>
-Steve Wise <larrystevenwise@gmail.com> <swise@chelsio.com>
-Steve Wise <larrystevenwise@gmail.com> <swise@opengridcomputing.com>
index f7e32f2..e82fc37 100644 (file)
@@ -43,7 +43,7 @@ Description:  read only
                This sysfs interface exposes the number of cores per chip
                present in the system.
 
-What:          /sys/devices/hv_24x7/interface/cpumask
+What:          /sys/devices/hv_24x7/cpumask
 Date:          July 2020
 Contact:       Linux on PowerPC Developer List <linuxppc-dev@lists.ozlabs.org>
 Description:   read only
index a683976..d2795ca 100644 (file)
@@ -489,6 +489,9 @@ Files in /sys/fs/ext4/<devname>:
         multiple of this tuning parameter if the stripe size is not set in the
         ext4 superblock
 
+  mb_max_inode_prealloc
+        The maximum length of per-inode ext4_prealloc_space list.
+
   mb_max_to_scan
         The maximum number of extents the multiblock allocator will search to
         find the best extent.
@@ -529,21 +532,21 @@ Files in /sys/fs/ext4/<devname>:
 Ioctls
 ======
 
-There is some Ext4 specific functionality which can be accessed by applications
-through the system call interfaces. The list of all Ext4 specific ioctls are
-shown in the table below.
+Ext4 implements various ioctls which can be used by applications to access
+ext4-specific functionality. An incomplete list of these ioctls is shown in the
+table below. This list includes truly ext4-specific ioctls (``EXT4_IOC_*``) as
+well as ioctls that may have been ext4-specific originally but are now supported
+by some other filesystem(s) too (``FS_IOC_*``).
 
-Table of Ext4 specific ioctls
+Table of Ext4 ioctls
 
-  EXT4_IOC_GETFLAGS
+  FS_IOC_GETFLAGS
         Get additional attributes associated with inode.  The ioctl argument is
-        an integer bitfield, with bit values described in ext4.h. This ioctl is
-        an alias for FS_IOC_GETFLAGS.
+        an integer bitfield, with bit values described in ext4.h.
 
-  EXT4_IOC_SETFLAGS
+  FS_IOC_SETFLAGS
         Set additional attributes associated with inode.  The ioctl argument is
-        an integer bitfield, with bit values described in ext4.h. This ioctl is
-        an alias for FS_IOC_SETFLAGS.
+        an integer bitfield, with bit values described in ext4.h.
 
   EXT4_IOC_GETVERSION, EXT4_IOC_GETVERSION_OLD
         Get the inode i_generation number stored for each inode. The
index bdc1f33..a106874 100644 (file)
        efi=            [EFI]
                        Format: { "debug", "disable_early_pci_dma",
                                  "nochunk", "noruntime", "nosoftreserve",
-                                 "novamap", "no_disable_early_pci_dma",
-                                 "old_map" }
+                                 "novamap", "no_disable_early_pci_dma" }
                        debug: enable misc debug output.
                        disable_early_pci_dma: disable the busmaster bit on all
                        PCI bridges while in the EFI boot stub.
                        novamap: do not call SetVirtualAddressMap().
                        no_disable_early_pci_dma: Leave the busmaster bit set
                        on all PCI bridges while in the EFI boot stub
-                       old_map [X86-64]: switch to the old ioremap-based EFI
-                       runtime services mapping. [Needs CONFIG_X86_UV=y]
 
        efi_no_storage_paranoia [EFI; X86]
                        Using this parameter you can use more than 50% of
index 7adef96..cdd1a9a 100644 (file)
@@ -564,8 +564,8 @@ Energy-Performance Preference (EPP) knob (if supported) or its
 Energy-Performance Bias (EPB) knob. It is also possible to write a positive
 integer value between 0 to 255, if the EPP feature is present. If the EPP
 feature is not present, writing integer value to this attribute is not
-supported. In this case, user can use
- "/sys/devices/system/cpu/cpu*/power/energy_perf_bias" interface.
+supported. In this case, user can use the
+"/sys/devices/system/cpu/cpu*/power/energy_perf_bias" interface.
 
 [Note that tasks may by migrated from one CPU to another by the scheduler's
 load-balancing algorithm and if different energy vs performance hints are
index d46429b..7df2465 100644 (file)
@@ -36,6 +36,12 @@ Two sets of Questions and Answers (Q&A) are maintained.
    bpf_devel_QA
 
 
+Helper functions
+================
+
+* `bpf-helpers(7)`_ maintains a list of helpers available to eBPF programs.
+
+
 Program types
 =============
 
@@ -79,4 +85,5 @@ Other
 .. _networking-filter: ../networking/filter.rst
 .. _man-pages: https://www.kernel.org/doc/man-pages/
 .. _bpf(2): https://man7.org/linux/man-pages/man2/bpf.2.html
+.. _bpf-helpers(7): https://man7.org/linux/man-pages/man7/bpf-helpers.7.html
 .. _BPF and XDP Reference Guide: https://docs.cilium.io/en/latest/bpf/
index fcd3456..42db138 100644 (file)
@@ -18,6 +18,7 @@ Required properties:
                (base address and length)
 
 Optional properties:
+- #power-domain-cells: Should be 0 if the instance is a power domain provider.
 - #reset-cells:        Should be 1 if the PRM instance in question supports resets.
 
 Example:
@@ -25,5 +26,6 @@ Example:
 prm_dsp2: prm@1b00 {
        compatible = "ti,dra7-prm-inst", "ti,omap-prm-inst";
        reg = <0x1b00 0x40>;
+       #power-domain-cells = <0>;
        #reset-cells = <1>;
 };
index 66cb238..ad21899 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Clock bindings for Freescale i.MX23
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
 
 description: |
   The clock consumer should specify the desired clock by having the clock
index 72328d5..f1af110 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Clock bindings for Freescale i.MX28
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
 
 description: |
   The clock consumer should specify the desired clock by having the clock
index ccf5b50..dfa1133 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Freescale MXS GPIO controller
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
   - Anson Huang <Anson.Huang@nxp.com>
 
 description: |
index d3134ed..21ae7bc 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Freescale MXS Inter IC (I2C) Controller
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
deleted file mode 100644 (file)
index 7841cb0..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-Texas Instruments K3 Interrupt Aggregator
-=========================================
-
-The Interrupt Aggregator (INTA) provides a centralized machine
-which handles the termination of system events to that they can
-be coherently processed by the host(s) in the system. A maximum
-of 64 events can be mapped to a single interrupt.
-
-
-                              Interrupt Aggregator
-                     +-----------------------------------------+
-                     |      Intmap            VINT             |
-                     | +--------------+  +------------+        |
-            m ------>| | vint  | bit  |  | 0 |.....|63| vint0  |
-               .     | +--------------+  +------------+        |       +------+
-               .     |         .               .               |       | HOST |
-Globalevents  ------>|         .               .               |------>| IRQ  |
-               .     |         .               .               |       | CTRL |
-               .     |         .               .               |       +------+
-            n ------>| +--------------+  +------------+        |
-                     | | vint  | bit  |  | 0 |.....|63| vintx  |
-                     | +--------------+  +------------+        |
-                     |                                         |
-                     +-----------------------------------------+
-
-Configuration of these Intmap registers that maps global events to vint is done
-by a system controller (like the Device Memory and Security Controller on K3
-AM654 SoC). Driver should request the system controller to get the range
-of global events and vints assigned to the requesting host. Management
-of these requested resources should be handled by driver and requests
-system controller to map specific global event to vint, bit pair.
-
-Communication between the host processor running an OS and the system
-controller happens through a protocol called TI System Control Interface
-(TISCI protocol). For more details refer:
-Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
-
-TISCI Interrupt Aggregator Node:
--------------------------------
-- compatible:          Must be "ti,sci-inta".
-- reg:                 Should contain registers location and length.
-- interrupt-controller:        Identifies the node as an interrupt controller
-- msi-controller:      Identifies the node as an MSI controller.
-- interrupt-parent:    phandle of irq parent.
-- ti,sci:              Phandle to TI-SCI compatible System controller node.
-- ti,sci-dev-id:       TISCI device ID of the Interrupt Aggregator.
-- ti,sci-rm-range-vint:        Array of TISCI subtype ids representing vints(inta
-                       outputs) range within this INTA, assigned to the
-                       requesting host context.
-- ti,sci-rm-range-global-event:        Array of TISCI subtype ids representing the
-                       global events range reaching this IA and are assigned
-                       to the requesting host context.
-
-Example:
---------
-main_udmass_inta: interrupt-controller@33d00000 {
-       compatible = "ti,sci-inta";
-       reg = <0x0 0x33d00000 0x0 0x100000>;
-       interrupt-controller;
-       msi-controller;
-       interrupt-parent = <&main_navss_intr>;
-       ti,sci = <&dmsc>;
-       ti,sci-dev-id = <179>;
-       ti,sci-rm-range-vint = <0x0>;
-       ti,sci-rm-range-global-event = <0x1>;
-};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
new file mode 100644 (file)
index 0000000..c7cd056
--- /dev/null
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/ti,sci-inta.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments K3 Interrupt Aggregator
+
+maintainers:
+  - Lokesh Vutla <lokeshvutla@ti.com>
+
+allOf:
+  - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
+
+description: |
+  The Interrupt Aggregator (INTA) provides a centralized machine
+  which handles the termination of system events to that they can
+  be coherently processed by the host(s) in the system. A maximum
+  of 64 events can be mapped to a single interrupt.
+
+                                Interrupt Aggregator
+                       +-----------------------------------------+
+                       |      Intmap            VINT             |
+                       | +--------------+  +------------+        |
+              m ------>| | vint  | bit  |  | 0 |.....|63| vint0  |
+                 .     | +--------------+  +------------+        |      +------+
+                 .     |         .               .               |      | HOST |
+  Globalevents  ------>|         .               .               |----->| IRQ  |
+                 .     |         .               .               |      | CTRL |
+                 .     |         .               .               |      +------+
+              n ------>| +--------------+  +------------+        |
+                       | | vint  | bit  |  | 0 |.....|63| vintx  |
+                       | +--------------+  +------------+        |
+                       |                                         |
+                       +-----------------------------------------+
+
+  Configuration of these Intmap registers that maps global events to vint is
+  done by a system controller (like the Device Memory and Security Controller
+  on AM654 SoC). Driver should request the system controller to get the range
+  of global events and vints assigned to the requesting host. Management
+  of these requested resources should be handled by driver and requests
+  system controller to map specific global event to vint, bit pair.
+
+  Communication between the host processor running an OS and the system
+  controller happens through a protocol called TI System Control Interface
+  (TISCI protocol).
+
+properties:
+  compatible:
+    const: ti,sci-inta
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  msi-controller: true
+
+  ti,interrupt-ranges:
+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
+    description: |
+      Interrupt ranges that converts the INTA output hw irq numbers
+      to parents's input interrupt numbers.
+    items:
+      items:
+        - description: |
+            "output_irq" specifies the base for inta output irq
+        - description: |
+            "parent's input irq" specifies the base for parent irq
+        - description: |
+            "limit" specifies the limit for translation
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - msi-controller
+  - ti,sci
+  - ti,sci-dev-id
+  - ti,interrupt-ranges
+
+examples:
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        main_udmass_inta: msi-controller@33d00000 {
+            compatible = "ti,sci-inta";
+            reg = <0x0 0x33d00000 0x0 0x100000>;
+            interrupt-controller;
+            msi-controller;
+            interrupt-parent = <&main_navss_intr>;
+            ti,sci = <&dmsc>;
+            ti,sci-dev-id = <179>;
+            ti,interrupt-ranges = <0 0 256>;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
deleted file mode 100644 (file)
index 178fca0..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-Texas Instruments K3 Interrupt Router
-=====================================
-
-The Interrupt Router (INTR) module provides a mechanism to mux M
-interrupt inputs to N interrupt outputs, where all M inputs are selectable
-to be driven per N output. An Interrupt Router can either handle edge triggered
-or level triggered interrupts and that is fixed in hardware.
-
-                                 Interrupt Router
-                             +----------------------+
-                             |  Inputs     Outputs  |
-        +-------+            | +------+    +-----+  |
-        | GPIO  |----------->| | irq0 |    |  0  |  |       Host IRQ
-        +-------+            | +------+    +-----+  |      controller
-                             |    .           .     |      +-------+
-        +-------+            |    .           .     |----->|  IRQ  |
-        | INTA  |----------->|    .           .     |      +-------+
-        +-------+            |    .        +-----+  |
-                             | +------+    |  N  |  |
-                             | | irqM |    +-----+  |
-                             | +------+             |
-                             |                      |
-                             +----------------------+
-
-There is one register per output (MUXCNTL_N) that controls the selection.
-Configuration of these MUXCNTL_N registers is done by a system controller
-(like the Device Memory and Security Controller on K3 AM654 SoC). System
-controller will keep track of the used and unused registers within the Router.
-Driver should request the system controller to get the range of GIC IRQs
-assigned to the requesting hosts. It is the drivers responsibility to keep
-track of Host IRQs.
-
-Communication between the host processor running an OS and the system
-controller happens through a protocol called TI System Control Interface
-(TISCI protocol). For more details refer:
-Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
-
-TISCI Interrupt Router Node:
-----------------------------
-Required Properties:
-- compatible:          Must be "ti,sci-intr".
-- ti,intr-trigger-type:        Should be one of the following:
-                       1: If intr supports edge triggered interrupts.
-                       4: If intr supports level triggered interrupts.
-- interrupt-controller:        Identifies the node as an interrupt controller
-- #interrupt-cells:    Specifies the number of cells needed to encode an
-                       interrupt source. The value should be 2.
-                       First cell should contain the TISCI device ID of source
-                       Second cell should contain the interrupt source offset
-                       within the device.
-- ti,sci:              Phandle to TI-SCI compatible System controller node.
-- ti,sci-dst-id:       TISCI device ID of the destination IRQ controller.
-- ti,sci-rm-range-girq:        Array of TISCI subtype ids representing the host irqs
-                       assigned to this interrupt router. Each subtype id
-                       corresponds to a range of host irqs.
-
-For more details on TISCI IRQ resource management refer:
-https://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/rm/rm_irq.html
-
-Example:
---------
-The following example demonstrates both interrupt router node and the consumer
-node(main gpio) on the AM654 SoC:
-
-main_intr: interrupt-controller0 {
-       compatible = "ti,sci-intr";
-       ti,intr-trigger-type = <1>;
-       interrupt-controller;
-       interrupt-parent = <&gic500>;
-       #interrupt-cells = <2>;
-       ti,sci = <&dmsc>;
-       ti,sci-dst-id = <56>;
-       ti,sci-rm-range-girq = <0x1>;
-};
-
-main_gpio0: gpio@600000 {
-       ...
-       interrupt-parent = <&main_intr>;
-       interrupts = <57 256>, <57 257>, <57 258>,
-                    <57 259>, <57 260>, <57 261>;
-       ...
-};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
new file mode 100644 (file)
index 0000000..cff6a95
--- /dev/null
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/ti,sci-intr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments K3 Interrupt Router
+
+maintainers:
+  - Lokesh Vutla <lokeshvutla@ti.com>
+
+allOf:
+  - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
+
+description: |
+  The Interrupt Router (INTR) module provides a mechanism to mux M
+  interrupt inputs to N interrupt outputs, where all M inputs are selectable
+  to be driven per N output. An Interrupt Router can either handle edge
+  triggered or level triggered interrupts and that is fixed in hardware.
+
+                                   Interrupt Router
+                               +----------------------+
+                               |  Inputs     Outputs  |
+          +-------+            | +------+    +-----+  |
+          | GPIO  |----------->| | irq0 |    |  0  |  |       Host IRQ
+          +-------+            | +------+    +-----+  |      controller
+                               |    .           .     |      +-------+
+          +-------+            |    .           .     |----->|  IRQ  |
+          | INTA  |----------->|    .           .     |      +-------+
+          +-------+            |    .        +-----+  |
+                               | +------+    |  N  |  |
+                               | | irqM |    +-----+  |
+                               | +------+             |
+                               |                      |
+                               +----------------------+
+
+  There is one register per output (MUXCNTL_N) that controls the selection.
+  Configuration of these MUXCNTL_N registers is done by a system controller
+  (like the Device Memory and Security Controller on K3 AM654 SoC). System
+  controller will keep track of the used and unused registers within the Router.
+  Driver should request the system controller to get the range of GIC IRQs
+  assigned to the requesting hosts. It is the drivers responsibility to keep
+  track of Host IRQs.
+
+  Communication between the host processor running an OS and the system
+  controller happens through a protocol called TI System Control Interface
+  (TISCI protocol).
+
+properties:
+  compatible:
+    const: ti,sci-intr
+
+  ti,intr-trigger-type:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 4]
+    description: |
+      Should be one of the following.
+        1 = If intr supports edge triggered interrupts.
+        4 = If intr supports level triggered interrupts.
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 1
+    description: |
+      The 1st cell should contain interrupt router input hw number.
+
+  ti,interrupt-ranges:
+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
+    description: |
+      Interrupt ranges that converts the INTR output hw irq numbers
+      to parents's input interrupt numbers.
+    items:
+      items:
+        - description: |
+            "output_irq" specifies the base for intr output irq
+        - description: |
+            "parent's input irq" specifies the base for parent irq
+        - description: |
+            "limit" specifies the limit for translation
+
+required:
+  - compatible
+  - ti,intr-trigger-type
+  - interrupt-controller
+  - '#interrupt-cells'
+  - ti,sci
+  - ti,sci-dev-id
+  - ti,interrupt-ranges
+
+examples:
+  - |
+    main_gpio_intr: interrupt-controller0 {
+        compatible = "ti,sci-intr";
+        ti,intr-trigger-type = <1>;
+        interrupt-controller;
+        interrupt-parent = <&gic500>;
+        #interrupt-cells = <1>;
+        ti,sci = <&dmsc>;
+        ti,sci-dev-id = <131>;
+        ti,interrupt-ranges = <0 360 32>;
+    };
index 75dc116..10b4596 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Freescale Enhanced Secure Digital Host Controller (eSDHC) for i.MX
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
 
 allOf:
   - $ref: "mmc-controller.yaml"
index 1cccc04..bec8f8c 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Freescale MXS MMC controller
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
 
 description: |
   The Freescale MXS Synchronous Serial Ports (SSP) can act as a MMC controller
index 1c44740..fa2baca 100644 (file)
@@ -54,7 +54,8 @@ properties:
 
   phy-connection-type:
     description:
-      Operation mode of the PHY interface
+      Specifies interface type between the Ethernet device and a physical
+      layer (PHY) device.
     enum:
       # There is not a standard bus between the MAC and the PHY,
       # something proprietary is being used to embed the PHY in the
index 08678af..8ce5ed8 100644 (file)
@@ -59,9 +59,15 @@ properties:
   clocks:
     maxItems: 1
 
-  pinctrl-0: true
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
 
-  pinctrl-names: true
+  phy-mode: true
+
+  phy-handle: true
 
   renesas,no-ether-link:
     type: boolean
@@ -74,6 +80,11 @@ properties:
       specify when the Ether LINK signal is active-low instead of normal
       active-high
 
+patternProperties:
+  "^ethernet-phy@[0-9a-f]$":
+    type: object
+    $ref: ethernet-phy.yaml#
+
 required:
   - compatible
   - reg
@@ -83,7 +94,8 @@ required:
   - '#address-cells'
   - '#size-cells'
   - clocks
-  - pinctrl-0
+
+additionalProperties: false
 
 examples:
   # Lager board
@@ -99,8 +111,6 @@ examples:
         clocks = <&mstp8_clks R8A7790_CLK_ETHER>;
         phy-mode = "rmii";
         phy-handle = <&phy1>;
-        pinctrl-0 = <&ether_pins>;
-        pinctrl-names = "default";
         renesas,ether-link-active-low;
         #address-cells = <1>;
         #size-cells = <0>;
@@ -109,7 +119,5 @@ examples:
             reg = <1>;
             interrupt-parent = <&irqc0>;
             interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-            pinctrl-0 = <&phy1_pins>;
-            pinctrl-names = "default";
         };
     };
index 64b2c64..a1e2be7 100644 (file)
@@ -9,6 +9,14 @@ title: PCIe RC controller on Intel Gateway SoCs
 maintainers:
   - Dilip Kota <eswara.kota@linux.intel.com>
 
+select:
+  properties:
+    compatible:
+      contains:
+        const: intel,lgm-pcie
+  required:
+    - compatible
+
 properties:
   compatible:
     items:
index da68f4a..8740e07 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Freescale MXS PWM controller
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
   - Anson Huang <anson.huang@nxp.com>
 
 properties:
index 1b50ced..50df1a4 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Freescale (Enhanced) Configurable Serial Peripheral Interface (CSPI/eCSPI) for i.MX
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
 
 allOf:
   - $ref: "/schemas/spi/spi-controller.yaml#"
index 22882e7..312d8fe 100644 (file)
@@ -39,6 +39,7 @@ properties:
       spi common code does not support use of CS signals discontinuously.
       i.MX8DXL-EVK board only uses CS1 without using CS0. Therefore, add
       this property to re-config the chipselect value in the LPSPI driver.
+    type: boolean
 
 required:
   - compatible
index aedac16..16b57f5 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: NXP i.MX Thermal Binding
 
 maintainers:
-  - Shawn Guo <shawn.guo@linaro.org>
+  - Shawn Guo <shawnguo@kernel.org>
   - Anson Huang <Anson.Huang@nxp.com>
 
 properties:
diff --git a/Documentation/devicetree/bindings/timer/sifive,clint.yaml b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
new file mode 100644 (file)
index 0000000..2a0e9cd
--- /dev/null
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/sifive,clint.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SiFive Core Local Interruptor
+
+maintainers:
+  - Palmer Dabbelt <palmer@dabbelt.com>
+  - Anup Patel <anup.patel@wdc.com>
+
+description:
+  SiFive (and other RISC-V) SOCs include an implementation of the SiFive
+  Core Local Interruptor (CLINT) for M-mode timer and M-mode inter-processor
+  interrupts. It directly connects to the timer and inter-processor interrupt
+  lines of various HARTs (or CPUs) so RISC-V per-HART (or per-CPU) local
+  interrupt controller is the parent interrupt controller for CLINT device.
+  The clock frequency of CLINT is specified via "timebase-frequency" DT
+  property of "/cpus" DT node. The "timebase-frequency" DT property is
+  described in Documentation/devicetree/bindings/riscv/cpus.yaml
+
+properties:
+  compatible:
+    items:
+      - const: sifive,fu540-c000-clint
+      - const: sifive,clint0
+
+    description:
+      Should be "sifive,<chip>-clint" and "sifive,clint<version>".
+      Supported compatible strings are -
+      "sifive,fu540-c000-clint" for the SiFive CLINT v0 as integrated
+      onto the SiFive FU540 chip, and "sifive,clint0" for the SiFive
+      CLINT v0 IP block with no chip integration tweaks.
+      Please refer to sifive-blocks-ip-versioning.txt for details
+
+  reg:
+    maxItems: 1
+
+  interrupts-extended:
+    minItems: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts-extended
+
+examples:
+  - |
+    timer@2000000 {
+      compatible = "sifive,fu540-c000-clint", "sifive,clint0";
+      interrupts-extended = <&cpu1intc 3 &cpu1intc 7
+                             &cpu2intc 3 &cpu2intc 7
+                             &cpu3intc 3 &cpu3intc 7
+                             &cpu4intc 3 &cpu4intc 7>;
+       reg = <0x2000000 0x10000>;
+    };
+...
index 2baee2c..63996ab 100644 (file)
@@ -993,7 +993,7 @@ patternProperties:
   "^sst,.*":
     description: Silicon Storage Technology, Inc.
   "^sstar,.*":
-    description: Xiamen Xingchen(SigmaStar) Technology Co., Ltd. 
+    description: Xiamen Xingchen(SigmaStar) Technology Co., Ltd.
       (formerly part of MStar Semiconductor, Inc.)
   "^st,.*":
     description: STMicroelectronics
index 8c74a99..16f21e1 100644 (file)
@@ -5,7 +5,7 @@ Writing DeviceTree Bindings in json-schema
 
 Devicetree bindings are written using json-schema vocabulary. Schema files are
 written in a JSON compatible subset of YAML. YAML is used instead of JSON as it
-considered more human readable and has some advantages such as allowing
+is considered more human readable and has some advantages such as allowing
 comments (Prefixed with '#').
 
 Schema Contents
@@ -19,7 +19,7 @@ $id
   A json-schema unique identifier string. The string must be a valid
   URI typically containing the binding's filename and path. For DT schema, it must
   begin with "http://devicetree.org/schemas/". The URL is used in constructing
-  references to other files specified in schema "$ref" properties. A $ref values
+  references to other files specified in schema "$ref" properties. A $ref value
   with a leading '/' will have the hostname prepended. A $ref value a relative
   path or filename only will be prepended with the hostname and path components
   of the current schema file's '$id' value. A URL is used even for local files,
index cdb2e82..1d44278 100644 (file)
@@ -3,7 +3,7 @@ NVMe Fault Injection
 Linux's fault injection framework provides a systematic way to support
 error injection via debugfs in the /sys/kernel/debug directory. When
 enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
-injected into the nvme_end_request. Users can change the default status
+injected into the nvme_try_complete_req. Users can change the default status
 code and no retry flag via the debugfs. The list of Generic Command
 Status can be found in include/linux/nvme.h
 
index 0aadba0..cc76b57 100644 (file)
@@ -39,6 +39,6 @@ entry.
 Other References
 ----------------
 
-Also see http://www.nongnu.org/ext2-doc/ for quite a collection of
+Also see https://www.nongnu.org/ext2-doc/ for quite a collection of
 information about ext2/3. Here's another old reference:
 http://wiki.osdev.org/Ext2
index 24168b0..adc3146 100644 (file)
@@ -2860,17 +2860,6 @@ version of the linux kernel, found on http://kernel.org
 The latest version of this document can be found in the latest kernel
 source (named Documentation/networking/bonding.rst).
 
-Discussions regarding the usage of the bonding driver take place on the
-bonding-devel mailing list, hosted at sourceforge.net. If you have questions or
-problems, post them to the list.  The list address is:
-
-bonding-devel@lists.sourceforge.net
-
-The administrative interface (to subscribe or unsubscribe) can
-be found at:
-
-https://lists.sourceforge.net/lists/listinfo/bonding-devel
-
 Discussions regarding the development of the bonding driver take place
 on the main Linux network mailing list, hosted at vger.kernel.org. The list
 address is:
@@ -2881,10 +2870,3 @@ The administrative interface (to subscribe or unsubscribe) can
 be found at:
 
 http://vger.kernel.org/vger-lists.html#netdev
-
-Donald Becker's Ethernet Drivers and diag programs may be found at :
-
- - http://web.archive.org/web/%2E/http://www.scyld.com/network/
-
-You will also find a lot of information regarding Ethernet, NWay, MII,
-etc. at www.scyld.com.
index 46caaad..379817c 100644 (file)
@@ -49,16 +49,18 @@ Register preservation rules
 Register preservation rules match the ELF ABI calling sequence with the
 following differences:
 
-=========== ============= ========================================
 --- For the sc instruction, differences with the ELF ABI ---
+=========== ============= ========================================
 r0          Volatile      (System call number.)
 r3          Volatile      (Parameter 1, and return value.)
 r4-r8       Volatile      (Parameters 2-6.)
 cr0         Volatile      (cr0.SO is the return error condition.)
 cr1, cr5-7  Nonvolatile
 lr          Nonvolatile
+=========== ============= ========================================
 
 --- For the scv 0 instruction, differences with the ELF ABI ---
+=========== ============= ========================================
 r0          Volatile      (System call number.)
 r3          Volatile      (Parameter 1, and return value.)
 r4-r8       Volatile      (Parameters 2-6.)
index e2c6ce6..eeb71d5 100644 (file)
@@ -2220,8 +2220,8 @@ ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT
 L:     openmoko-kernel@lists.openmoko.org (subscribers-only)
 S:     Orphan
 W:     http://wiki.openmoko.org/wiki/Neo_FreeRunner
-F:     arch/arm/mach-s3c24xx/gta02.h
-F:     arch/arm/mach-s3c24xx/mach-gta02.c
+F:     arch/arm/mach-s3c/gta02.h
+F:     arch/arm/mach-s3c/mach-gta02.c
 
 ARM/Orion SoC/Technologic Systems TS-78xx platform support
 M:     Alexander Clouter <alex@digriz.org.uk>
@@ -2410,10 +2410,8 @@ F:       arch/arm/boot/dts/exynos*
 F:     arch/arm/boot/dts/s3c*
 F:     arch/arm/boot/dts/s5p*
 F:     arch/arm/mach-exynos*/
-F:     arch/arm/mach-s3c24*/
-F:     arch/arm/mach-s3c64xx/
+F:     arch/arm/mach-s3c/
 F:     arch/arm/mach-s5p*/
-F:     arch/arm/plat-samsung/
 F:     arch/arm64/boot/dts/exynos/
 F:     drivers/*/*/*s3c24*
 F:     drivers/*/*s3c24*
@@ -2424,6 +2422,9 @@ F:        drivers/soc/samsung/
 F:     drivers/tty/serial/samsung*
 F:     include/linux/soc/samsung/
 N:     exynos
+N:     s3c2410
+N:     s3c64xx
+N:     s5pv210
 
 ARM/SAMSUNG MOBILE MACHINE SUPPORT
 M:     Kyungmin Park <kyungmin.park@samsung.com>
@@ -3205,6 +3206,7 @@ S:        Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
 F:     block/
 F:     drivers/block/
+F:     include/linux/blk*
 F:     kernel/trace/blktrace.c
 F:     lib/sbitmap.c
 
@@ -3433,7 +3435,7 @@ M:        bcm-kernel-feedback-list@broadcom.com
 L:     linux-arm-kernel@lists.infradead.org
 S:     Maintained
 F:     arch/arm/boot/dts/bcm470*
-F:     arch/arm/boot/dts/bcm5301x*.dtsi
+F:     arch/arm/boot/dts/bcm5301*
 F:     arch/arm/boot/dts/bcm953012*
 F:     arch/arm/mach-bcm/bcm_5301x.c
 
@@ -5050,7 +5052,7 @@ F:        include/linux/dm-*.h
 F:     include/uapi/linux/dm-*.h
 
 DEVLINK
-M:     Jiri Pirko <jiri@mellanox.com>
+M:     Jiri Pirko <jiri@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     Documentation/networking/devlink
@@ -6081,7 +6083,7 @@ F:        include/linux/dynamic_debug.h
 F:     lib/dynamic_debug.c
 
 DYNAMIC INTERRUPT MODERATION
-M:     Tal Gilboa <talgi@mellanox.com>
+M:     Tal Gilboa <talgi@nvidia.com>
 S:     Maintained
 F:     Documentation/networking/net_dim.rst
 F:     include/linux/dim.h
@@ -6161,7 +6163,7 @@ F:        Documentation/devicetree/bindings/edac/aspeed-sdram-edac.txt
 F:     drivers/edac/aspeed_edac.c
 
 EDAC-BLUEFIELD
-M:     Shravan Kumar Ramani <sramani@mellanox.com>
+M:     Shravan Kumar Ramani <sramani@nvidia.com>
 S:     Supported
 F:     drivers/edac/bluefield_edac.c
 
@@ -6483,8 +6485,8 @@ S:        Odd Fixes
 F:     drivers/net/ethernet/agere/
 
 ETHERNET BRIDGE
-M:     Roopa Prabhu <roopa@cumulusnetworks.com>
-M:     Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
+M:     Roopa Prabhu <roopa@nvidia.com>
+M:     Nikolay Aleksandrov <nikolay@nvidia.com>
 L:     bridge@lists.linux-foundation.org (moderated for non-subscribers)
 L:     netdev@vger.kernel.org
 S:     Maintained
@@ -6599,7 +6601,7 @@ F:        drivers/iommu/exynos-iommu.c
 
 EZchip NPS platform support
 M:     Vineet Gupta <vgupta@synopsys.com>
-M:     Ofer Levi <oferle@mellanox.com>
+M:     Ofer Levi <oferle@nvidia.com>
 S:     Supported
 F:     arch/arc/boot/dts/eznps.dts
 F:     arch/arc/plat-eznps
@@ -8563,7 +8565,7 @@ F:        drivers/iio/pressure/dps310.c
 
 INFINIBAND SUBSYSTEM
 M:     Doug Ledford <dledford@redhat.com>
-M:     Jason Gunthorpe <jgg@mellanox.com>
+M:     Jason Gunthorpe <jgg@nvidia.com>
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     https://github.com/linux-rdma/rdma-core
@@ -9226,7 +9228,7 @@ F:        drivers/firmware/iscsi_ibft*
 
 ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR
 M:     Sagi Grimberg <sagi@grimberg.me>
-M:     Max Gurtovoy <maxg@mellanox.com>
+M:     Max Gurtovoy <maxg@nvidia.com>
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     http://www.openfabrics.org
@@ -11072,7 +11074,7 @@ F:      Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt
 F:     drivers/input/touchscreen/melfas_mip4.c
 
 MELLANOX ETHERNET DRIVER (mlx4_en)
-M:     Tariq Toukan <tariqt@mellanox.com>
+M:     Tariq Toukan <tariqt@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11080,7 +11082,7 @@ Q:      http://patchwork.ozlabs.org/project/netdev/list/
 F:     drivers/net/ethernet/mellanox/mlx4/en_*
 
 MELLANOX ETHERNET DRIVER (mlx5e)
-M:     Saeed Mahameed <saeedm@mellanox.com>
+M:     Saeed Mahameed <saeedm@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11088,7 +11090,7 @@ Q:      http://patchwork.ozlabs.org/project/netdev/list/
 F:     drivers/net/ethernet/mellanox/mlx5/core/en_*
 
 MELLANOX ETHERNET INNOVA DRIVERS
-R:     Boris Pismenny <borisp@mellanox.com>
+R:     Boris Pismenny <borisp@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11099,8 +11101,8 @@ F:      drivers/net/ethernet/mellanox/mlx5/core/fpga/*
 F:     include/linux/mlx5/mlx5_ifc_fpga.h
 
 MELLANOX ETHERNET SWITCH DRIVERS
-M:     Jiri Pirko <jiri@mellanox.com>
-M:     Ido Schimmel <idosch@mellanox.com>
+M:     Jiri Pirko <jiri@nvidia.com>
+M:     Ido Schimmel <idosch@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11109,7 +11111,7 @@ F:      drivers/net/ethernet/mellanox/mlxsw/
 F:     tools/testing/selftests/drivers/net/mlxsw/
 
 MELLANOX FIRMWARE FLASH LIBRARY (mlxfw)
-M:     mlxsw@mellanox.com
+M:     mlxsw@nvidia.com
 L:     netdev@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11119,7 +11121,7 @@ F:      drivers/net/ethernet/mellanox/mlxfw/
 MELLANOX HARDWARE PLATFORM SUPPORT
 M:     Andy Shevchenko <andy@infradead.org>
 M:     Darren Hart <dvhart@infradead.org>
-M:     Vadim Pasternak <vadimp@mellanox.com>
+M:     Vadim Pasternak <vadimp@nvidia.com>
 L:     platform-driver-x86@vger.kernel.org
 S:     Supported
 F:     Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
@@ -11127,7 +11129,7 @@ F:      drivers/platform/mellanox/
 F:     include/linux/platform_data/mlxreg.h
 
 MELLANOX MLX4 core VPI driver
-M:     Tariq Toukan <tariqt@mellanox.com>
+M:     Tariq Toukan <tariqt@nvidia.com>
 L:     netdev@vger.kernel.org
 L:     linux-rdma@vger.kernel.org
 S:     Supported
@@ -11137,7 +11139,7 @@ F:      drivers/net/ethernet/mellanox/mlx4/
 F:     include/linux/mlx4/
 
 MELLANOX MLX4 IB driver
-M:     Yishai Hadas <yishaih@mellanox.com>
+M:     Yishai Hadas <yishaih@nvidia.com>
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11147,8 +11149,8 @@ F:      include/linux/mlx4/
 F:     include/uapi/rdma/mlx4-abi.h
 
 MELLANOX MLX5 core VPI driver
-M:     Saeed Mahameed <saeedm@mellanox.com>
-M:     Leon Romanovsky <leonro@mellanox.com>
+M:     Saeed Mahameed <saeedm@nvidia.com>
+M:     Leon Romanovsky <leonro@nvidia.com>
 L:     netdev@vger.kernel.org
 L:     linux-rdma@vger.kernel.org
 S:     Supported
@@ -11159,7 +11161,7 @@ F:      drivers/net/ethernet/mellanox/mlx5/core/
 F:     include/linux/mlx5/
 
 MELLANOX MLX5 IB driver
-M:     Leon Romanovsky <leonro@mellanox.com>
+M:     Leon Romanovsky <leonro@nvidia.com>
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     http://www.mellanox.com
@@ -11169,8 +11171,8 @@ F:      include/linux/mlx5/
 F:     include/uapi/rdma/mlx5-abi.h
 
 MELLANOX MLXCPLD I2C AND MUX DRIVER
-M:     Vadim Pasternak <vadimp@mellanox.com>
-M:     Michael Shych <michaelsh@mellanox.com>
+M:     Vadim Pasternak <vadimp@nvidia.com>
+M:     Michael Shych <michaelsh@nvidia.com>
 L:     linux-i2c@vger.kernel.org
 S:     Supported
 F:     Documentation/i2c/busses/i2c-mlxcpld.rst
@@ -11178,7 +11180,7 @@ F:      drivers/i2c/busses/i2c-mlxcpld.c
 F:     drivers/i2c/muxes/i2c-mux-mlxcpld.c
 
 MELLANOX MLXCPLD LED DRIVER
-M:     Vadim Pasternak <vadimp@mellanox.com>
+M:     Vadim Pasternak <vadimp@nvidia.com>
 L:     linux-leds@vger.kernel.org
 S:     Supported
 F:     Documentation/leds/leds-mlxcpld.rst
@@ -11186,7 +11188,7 @@ F:      drivers/leds/leds-mlxcpld.c
 F:     drivers/leds/leds-mlxreg.c
 
 MELLANOX PLATFORM DRIVER
-M:     Vadim Pasternak <vadimp@mellanox.com>
+M:     Vadim Pasternak <vadimp@nvidia.com>
 L:     platform-driver-x86@vger.kernel.org
 S:     Supported
 F:     drivers/platform/x86/mlx-platform.c
@@ -12167,8 +12169,8 @@ F:      net/ipv6/syncookies.c
 F:     net/ipv6/tcp*.c
 
 NETWORKING [TLS]
-M:     Boris Pismenny <borisp@mellanox.com>
-M:     Aviad Yehezkel <aviadye@mellanox.com>
+M:     Boris Pismenny <borisp@nvidia.com>
+M:     Aviad Yehezkel <aviadye@nvidia.com>
 M:     John Fastabend <john.fastabend@gmail.com>
 M:     Daniel Borkmann <daniel@iogearbox.net>
 M:     Jakub Kicinski <kuba@kernel.org>
@@ -12468,7 +12470,7 @@ S:      Supported
 F:     drivers/nfc/nxp-nci
 
 OBJAGG
-M:     Jiri Pirko <jiri@mellanox.com>
+M:     Jiri Pirko <jiri@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     include/linux/objagg.h
@@ -13110,7 +13112,7 @@ F:      drivers/video/logo/logo_parisc*
 F:     include/linux/hp_sdc.h
 
 PARMAN
-M:     Jiri Pirko <jiri@mellanox.com>
+M:     Jiri Pirko <jiri@nvidia.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     include/linux/parman.h
@@ -15301,6 +15303,8 @@ F:      Documentation/devicetree/bindings/clock/samsung,s3c*
 F:     Documentation/devicetree/bindings/clock/samsung,s5p*
 F:     drivers/clk/samsung/
 F:     include/dt-bindings/clock/exynos*.h
+F:     include/linux/clk/samsung.h
+F:     include/linux/platform_data/clk-s3c2410.h
 
 SAMSUNG SPI DRIVERS
 M:     Kukjin Kim <kgene@kernel.org>
@@ -15312,6 +15316,7 @@ S:      Maintained
 F:     Documentation/devicetree/bindings/spi/spi-samsung.txt
 F:     drivers/spi/spi-s3c*
 F:     include/linux/platform_data/spi-s3c64xx.h
+F:     include/linux/spi/s3c24xx-fiq.h
 
 SAMSUNG SXGBE DRIVERS
 M:     Byungho An <bh74.an@samsung.com>
@@ -15825,19 +15830,17 @@ F:    drivers/video/fbdev/simplefb.c
 F:     include/linux/platform_data/simplefb.h
 
 SIMTEC EB110ATX (Chalice CATS)
-M:     Vincent Sanders <vince@simtec.co.uk>
 M:     Simtec Linux Team <linux@simtec.co.uk>
 S:     Supported
 W:     http://www.simtec.co.uk/products/EB110ATX/
 
 SIMTEC EB2410ITX (BAST)
-M:     Vincent Sanders <vince@simtec.co.uk>
 M:     Simtec Linux Team <linux@simtec.co.uk>
 S:     Supported
 W:     http://www.simtec.co.uk/products/EB2410ITX/
-F:     arch/arm/mach-s3c24xx/bast-ide.c
-F:     arch/arm/mach-s3c24xx/bast-irq.c
-F:     arch/arm/mach-s3c24xx/mach-bast.c
+F:     arch/arm/mach-s3c/bast-ide.c
+F:     arch/arm/mach-s3c/bast-irq.c
+F:     arch/arm/mach-s3c/mach-bast.c
 
 SIOX
 M:     Thorsten Scherer <t.scherer@eckelmann.de>
@@ -16034,7 +16037,7 @@ F:      drivers/infiniband/sw/siw/
 F:     include/uapi/rdma/siw-abi.h
 
 SOFT-ROCE DRIVER (rxe)
-M:     Zhu Yanjun <yanjunz@mellanox.com>
+M:     Zhu Yanjun <yanjunz@nvidia.com>
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 F:     drivers/infiniband/sw/rxe/
@@ -17116,8 +17119,8 @@ S:      Maintained
 F:     Documentation/devicetree/bindings/arm/keystone/ti,k3-sci-common.yaml
 F:     Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
 F:     Documentation/devicetree/bindings/clock/ti,sci-clk.txt
-F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
-F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
+F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
+F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
 F:     Documentation/devicetree/bindings/reset/ti,sci-reset.txt
 F:     Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
 F:     drivers/clk/keystone/sci-clk.c
@@ -18756,7 +18759,7 @@ F:      Documentation/devicetree/bindings/mfd/wm831x.txt
 F:     Documentation/devicetree/bindings/regulator/wlf,arizona.yaml
 F:     Documentation/devicetree/bindings/sound/wlf,arizona.yaml
 F:     Documentation/hwmon/wm83??.rst
-F:     arch/arm/mach-s3c64xx/mach-crag6410*
+F:     arch/arm/mach-s3c/mach-crag6410*
 F:     drivers/clk/clk-wm83*.c
 F:     drivers/extcon/extcon-arizona.c
 F:     drivers/gpio/gpio-*wm*.c
@@ -18874,6 +18877,15 @@ S:     Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
 F:     arch/x86/platform
 
+X86 PLATFORM UV HPE SUPERDOME FLEX
+M:     Steve Wahl <steve.wahl@hpe.com>
+R:     Dimitri Sivanich <dimitri.sivanich@hpe.com>
+R:     Russ Anderson <russ.anderson@hpe.com>
+S:     Supported
+F:     arch/x86/include/asm/uv/
+F:     arch/x86/kernel/apic/x2apic_uv_x.c
+F:     arch/x86/platform/uv/
+
 X86 VDSO
 M:     Andy Lutomirski <luto@kernel.org>
 L:     linux-kernel@vger.kernel.org
index 9cac6fd..ff5e073 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 9
 SUBLEVEL = 0
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc3
 NAME = Kleptomaniac Octopus
 
 # *DOCUMENTATION*
@@ -265,8 +265,7 @@ no-dot-config-targets := $(clean-targets) \
                         $(version_h) headers headers_% archheaders archscripts \
                         %asm-generic kernelversion %src-pkg dt_binding_check \
                         outputmakefile
-no-sync-config-targets := $(no-dot-config-targets) install %install \
-                          kernelrelease
+no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
 
 config-build   :=
@@ -292,7 +291,7 @@ ifneq ($(KBUILD_EXTMOD),)
 endif
 
 ifeq ($(KBUILD_EXTMOD),)
-        ifneq ($(filter config %config,$(MAKECMDGOALS)),)
+        ifneq ($(filter %config,$(MAKECMDGOALS)),)
                config-build := 1
                 ifneq ($(words $(MAKECMDGOALS)),1)
                        mixed-build := 1
index ac110ae..5b60c24 100644 (file)
@@ -212,7 +212,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
                            STO_ALPHA_STD_GPLOAD)
                                /* Omit the prologue. */
                                value += 8;
-                       /* FALLTHRU */
+                       fallthrough;
                case R_ALPHA_BRADDR:
                        value -= (u64)location + 4;
                        if (value & 3)
index a813020..15bc9d1 100644 (file)
@@ -453,7 +453,7 @@ syscall_restart(unsigned long r0, unsigned long r19,
                        regs->r0 = EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->r0 = r0;  /* reset v0 and a3 and replay syscall */
                regs->r19 = r19;
index 49754e0..921d4b6 100644 (file)
@@ -883,7 +883,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
 
        case 0x26: /* sts */
                fake_reg = s_reg_to_mem(alpha_read_fp_reg(reg));
-               /* FALLTHRU */
+               fallthrough;
 
        case 0x2c: /* stl */
                __asm__ __volatile__(
@@ -911,7 +911,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
 
        case 0x27: /* stt */
                fake_reg = alpha_read_fp_reg(reg);
-               /* FALLTHRU */
+               fallthrough;
 
        case 0x2d: /* stq */
                __asm__ __volatile__(
index d04837d..03f8b1b 100644 (file)
@@ -339,7 +339,7 @@ void __kprobes disasm_instr(unsigned long addr, struct disasm_state *state,
 
        case op_LDWX_S: /* LDWX_S c, [b, u6] */
                state->x = 1;
-               /* intentional fall-through */
+               fallthrough;
 
        case op_LDW_S:  /* LDW_S c, [b, u6] */
                state->zz = 2;
index 3d57ed0..8222f8c 100644 (file)
@@ -321,7 +321,7 @@ static void arc_restart_syscall(struct k_sigaction *ka, struct pt_regs *regs)
                        regs->r0 = -EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
 
        case -ERESTARTNOINTR:
                /*
index f87758a..74ad425 100644 (file)
@@ -572,7 +572,7 @@ static unsigned long read_pointer(const u8 **pLoc, const void *end,
 #else
                BUILD_BUG_ON(sizeof(u32) != sizeof(value));
 #endif
-               /* Fall through */
+               fallthrough;
        case DW_EH_PE_native:
                if (end < (const void *)(ptr.pul + 1))
                        return 0;
@@ -827,7 +827,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
                        case DW_CFA_def_cfa:
                                state->cfa.reg = get_uleb128(&ptr.p8, end);
                                unw_debug("cfa_def_cfa: r%lu ", state->cfa.reg);
-                               /* fall through */
+                               fallthrough;
                        case DW_CFA_def_cfa_offset:
                                state->cfa.offs = get_uleb128(&ptr.p8, end);
                                unw_debug("cfa_def_cfa_offset: 0x%lx ",
@@ -835,7 +835,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
                                break;
                        case DW_CFA_def_cfa_sf:
                                state->cfa.reg = get_uleb128(&ptr.p8, end);
-                               /* fall through */
+                               fallthrough;
                        case DW_CFA_def_cfa_offset_sf:
                                state->cfa.offs = get_sleb128(&ptr.p8, end)
                                    * state->dataAlign;
index e00d94b..2a02105 100644 (file)
@@ -265,9 +265,7 @@ config PHYS_OFFSET
        depends on !ARM_PATCH_PHYS_VIRT
        default DRAM_BASE if !MMU
        default 0x00000000 if ARCH_EBSA110 || \
-                       ARCH_FOOTBRIDGE || \
-                       ARCH_INTEGRATOR || \
-                       ARCH_REALVIEW
+                       ARCH_FOOTBRIDGE
        default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
        default 0x20000000 if ARCH_S5PV210
        default 0xc0000000 if ARCH_SA1100
@@ -503,11 +501,12 @@ config ARCH_S3C24XX
        select GPIOLIB
        select GENERIC_IRQ_MULTI_HANDLER
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select NEED_MACH_IO_H
+       select S3C2410_WATCHDOG
        select SAMSUNG_ATAGS
        select USE_OF
+       select WATCHDOG
        help
          Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443
          and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
@@ -636,7 +635,6 @@ source "arch/arm/mach-dove/Kconfig"
 source "arch/arm/mach-ep93xx/Kconfig"
 
 source "arch/arm/mach-exynos/Kconfig"
-source "arch/arm/plat-samsung/Kconfig"
 
 source "arch/arm/mach-footbridge/Kconfig"
 
@@ -709,9 +707,7 @@ source "arch/arm/mach-realview/Kconfig"
 
 source "arch/arm/mach-rockchip/Kconfig"
 
-source "arch/arm/mach-s3c24xx/Kconfig"
-
-source "arch/arm/mach-s3c64xx/Kconfig"
+source "arch/arm/mach-s3c/Kconfig"
 
 source "arch/arm/mach-s5pv210/Kconfig"
 
index 80000a6..b4b41f9 100644 (file)
@@ -1005,7 +1005,7 @@ choice
                  via SCIFA4 on Renesas SH-Mobile AG5 (SH73A0).
 
        config DEBUG_S3C_UART0
-               depends on PLAT_SAMSUNG
+               depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C24XX_UART if ARCH_S3C24XX
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
@@ -1017,7 +1017,7 @@ choice
                  by the boot-loader before use.
 
        config DEBUG_S3C_UART1
-               depends on PLAT_SAMSUNG
+               depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C24XX_UART if ARCH_S3C24XX
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
@@ -1029,7 +1029,7 @@ choice
                  by the boot-loader before use.
 
        config DEBUG_S3C_UART2
-               depends on PLAT_SAMSUNG
+               depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C24XX_UART if ARCH_S3C24XX
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
@@ -1041,7 +1041,7 @@ choice
                  by the boot-loader before use.
 
        config DEBUG_S3C_UART3
-               depends on PLAT_SAMSUNG && (ARCH_EXYNOS || ARCH_S5PV210)
+               depends on ARCH_EXYNOS || ARCH_S5PV210
                select DEBUG_EXYNOS_UART if ARCH_EXYNOS
                select DEBUG_S3C64XX_UART if ARCH_S3C64XX
                select DEBUG_S5PV210_UART if ARCH_S5PV210
@@ -1497,6 +1497,16 @@ config DEBUG_S3C64XX_UART
 config DEBUG_S5PV210_UART
        bool
 
+config DEBUG_S3C_UART
+       depends on DEBUG_S3C2410_UART || DEBUG_S3C24XX_UART || \
+                  DEBUG_S3C64XX_UART ||  DEBUG_S5PV210_UART || \
+                  DEBUG_EXYNOS_UART
+       int
+       default "0" if DEBUG_S3C_UART0
+       default "1" if DEBUG_S3C_UART1
+       default "2" if DEBUG_S3C_UART2
+       default "3" if DEBUG_S3C_UART3
+
 config DEBUG_OMAP2PLUS_UART
        bool
        depends on ARCH_OMAP2PLUS
index 4e87735..d3a447a 100644 (file)
@@ -209,8 +209,7 @@ machine-$(CONFIG_ARCH_REALTEK)              += realtek
 machine-$(CONFIG_ARCH_REALVIEW)                += realview
 machine-$(CONFIG_ARCH_ROCKCHIP)                += rockchip
 machine-$(CONFIG_ARCH_RPC)             += rpc
-machine-$(CONFIG_ARCH_S3C24XX)         += s3c24xx
-machine-$(CONFIG_ARCH_S3C64XX)         += s3c64xx
+machine-$(CONFIG_PLAT_SAMSUNG)         += s3c
 machine-$(CONFIG_ARCH_S5PV210)         += s5pv210
 machine-$(CONFIG_ARCH_SA1100)          += sa1100
 machine-$(CONFIG_ARCH_RENESAS)         += shmobile
@@ -232,13 +231,9 @@ machine-$(CONFIG_PLAT_SPEAR)               += spear
 
 # Platform directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
-plat-$(CONFIG_ARCH_EXYNOS)     += samsung
 plat-$(CONFIG_ARCH_OMAP)       += omap
-plat-$(CONFIG_ARCH_S3C64XX)    += samsung
-plat-$(CONFIG_ARCH_S5PV210)    += samsung
 plat-$(CONFIG_PLAT_ORION)      += orion
 plat-$(CONFIG_PLAT_PXA)                += pxa
-plat-$(CONFIG_PLAT_S3C24XX)    += samsung
 plat-$(CONFIG_PLAT_VERSATILE)  += versatile
 
 ifeq ($(CONFIG_ARCH_EBSA110),y)
index b88d0ca..ea20e4b 100644 (file)
 
                target-module@3e000 {                   /* 0x44e3e000, ap 35 60.0 */
                        compatible = "ti,sysc-omap4-simple", "ti,sysc";
-                       ti,hwmods = "rtc";
                        reg = <0x3e074 0x4>,
                              <0x3e078 0x4>;
                        reg-names = "rev", "sysc";
index 5cb4cc3..0fab080 100644 (file)
                                        <SYSC_IDLE_SMART>;
                        clocks = <&gfx_l3_clkctrl AM3_GFX_L3_GFX_CLKCTRL 0>;
                        clock-names = "fck";
+                       power-domains = <&prm_gfx>;
                        resets = <&prm_gfx 0>;
                        reset-names = "rstctrl";
                        #address-cells = <1>;
        prm_gfx: prm@1100 {
                compatible = "ti,am3-prm-inst", "ti,omap-prm-inst";
                reg = <0x1100 0x100>;
+               #power-domain-cells = <0>;
                #reset-cells = <1>;
        };
 };
index 1431404..8d47913 100644 (file)
                                        <SYSC_IDLE_SMART>;
                        clocks = <&gfx_l3_clkctrl AM4_GFX_L3_GFX_CLKCTRL 0>;
                        clock-names = "fck";
+                       power-domains = <&prm_gfx>;
                        resets = <&prm_gfx 0>;
                        reset-names = "rstctrl";
                        #address-cells = <1>;
        prm_gfx: prm@400 {
                compatible = "ti,am4-prm-inst", "ti,omap-prm-inst";
                reg = <0x400 0x100>;
+               #power-domain-cells = <0>;
                #reset-cells = <1>;
        };
 
index 3d393fe..8a67bb2 100644 (file)
                        ranges = <0x0 0x39000 0x1000>;
                };
 
-               target-module@3e000 {                   /* 0x44e3e000, ap 34 60.0 */
+               rtc_target: target-module@3e000 {       /* 0x44e3e000, ap 34 60.0 */
                        compatible = "ti,sysc-omap4-simple", "ti,sysc";
-                       ti,hwmods = "rtc";
                        reg = <0x3e074 0x4>,
                              <0x3e078 0x4>;
                        reg-names = "rev", "sysc";
index de4fc78..7f3faa3 100644 (file)
        status = "okay";
 };
 
+&rtc_target {
+       status = "disabled";
+};
+
 &tscadc {
        status = "okay";
 
index 27a6a83..f43b764 100644 (file)
 
                rtctarget: target-module@38000 {                        /* 0x48838000, ap 29 12.0 */
                        compatible = "ti,sysc-omap4-simple", "ti,sysc";
-                       ti,hwmods = "rtcss";
                        reg = <0x38074 0x4>,
                              <0x38078 0x4>;
                        reg-names = "rev", "sysc";
index b2cf5f4..a9573d4 100644 (file)
@@ -1,14 +1,16 @@
 &l4_abe {                                              /* 0x40100000 */
-       compatible = "ti,omap4-l4-abe", "simple-bus";
+       compatible = "ti,omap4-l4-abe", "simple-pm-bus";
        reg = <0x40100000 0x400>,
              <0x40100400 0x400>;
        reg-names = "la", "ap";
+       power-domains = <&prm_abe>;
+       /* OMAP4_L4_ABE_CLKCTRL is read-only */
        #address-cells = <1>;
        #size-cells = <1>;
        ranges = <0x00000000 0x40100000 0x100000>,      /* segment 0 */
                 <0x49000000 0x49000000 0x100000>;
        segment@0 {                                     /* 0x40100000 */
-               compatible = "simple-bus";
+               compatible = "simple-pm-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges =
index 0282b9d..eb5780e 100644 (file)
                #reset-cells = <1>;
        };
 
+       prm_abe: prm@500 {
+               compatible = "ti,omap4-prm-inst", "ti,omap-prm-inst";
+               reg = <0x500 0x100>;
+               #power-domain-cells = <0>;
+       };
+
        prm_core: prm@700 {
                compatible = "ti,omap4-prm-inst", "ti,omap-prm-inst";
                reg = <0x700 0x100>;
index 25b7fce..a03bca5 100644 (file)
@@ -1,14 +1,16 @@
 &l4_abe {                                              /* 0x40100000 */
-       compatible = "ti,omap5-l4-abe", "simple-bus";
+       compatible = "ti,omap5-l4-abe", "simple-pm-bus";
        reg = <0x40100000 0x400>,
              <0x40100400 0x400>;
        reg-names = "la", "ap";
+       power-domains = <&prm_abe>;
+       /* OMAP5_L4_ABE_CLKCTRL is read-only */
        #address-cells = <1>;
        #size-cells = <1>;
        ranges = <0x00000000 0x40100000 0x100000>,      /* segment 0 */
                 <0x49000000 0x49000000 0x100000>;
        segment@0 {                                     /* 0x40100000 */
-               compatible = "simple-bus";
+               compatible = "simple-pm-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges =
index 5da9cff..199035a 100644 (file)
                #reset-cells = <1>;
        };
 
+       prm_abe: prm@500 {
+               compatible = "ti,omap5-prm-inst", "ti,omap-prm-inst";
+               reg = <0x500 0x100>;
+               #power-domain-cells = <0>;
+       };
+
        prm_core: prm@700 {
                compatible = "ti,omap5-prm-inst", "ti,omap-prm-inst";
                reg = <0x700 0x100>;
index 132a20c..d693565 100644 (file)
@@ -32,6 +32,8 @@
 #define UARTA_7271             UARTA_7268
 #define UARTA_7278             REG_PHYS_ADDR_V7(0x40c000)
 #define UARTA_7216             UARTA_7278
+#define UARTA_72164            UARTA_7278
+#define UARTA_72165            UARTA_7278
 #define UARTA_7364             REG_PHYS_ADDR(0x40b000)
 #define UARTA_7366             UARTA_7364
 #define UARTA_74371            REG_PHYS_ADDR(0x406b00)
@@ -84,17 +86,19 @@ ARM_BE8(    rev     \rv, \rv )
                /* Chip specific detection starts here */
 20:            checkuart(\rp, \rv, 0x33900000, 3390)
 21:            checkuart(\rp, \rv, 0x72160000, 7216)
-22:            checkuart(\rp, \rv, 0x72500000, 7250)
-23:            checkuart(\rp, \rv, 0x72550000, 7255)
-24:            checkuart(\rp, \rv, 0x72600000, 7260)
-25:            checkuart(\rp, \rv, 0x72680000, 7268)
-26:            checkuart(\rp, \rv, 0x72710000, 7271)
-27:            checkuart(\rp, \rv, 0x72780000, 7278)
-28:            checkuart(\rp, \rv, 0x73640000, 7364)
-29:            checkuart(\rp, \rv, 0x73660000, 7366)
-30:            checkuart(\rp, \rv, 0x07437100, 74371)
-31:            checkuart(\rp, \rv, 0x74390000, 7439)
-32:            checkuart(\rp, \rv, 0x74450000, 7445)
+22:            checkuart(\rp, \rv, 0x07216400, 72164)
+23:            checkuart(\rp, \rv, 0x07216500, 72165)
+24:            checkuart(\rp, \rv, 0x72500000, 7250)
+25:            checkuart(\rp, \rv, 0x72550000, 7255)
+26:            checkuart(\rp, \rv, 0x72600000, 7260)
+27:            checkuart(\rp, \rv, 0x72680000, 7268)
+28:            checkuart(\rp, \rv, 0x72710000, 7271)
+29:            checkuart(\rp, \rv, 0x72780000, 7278)
+30:            checkuart(\rp, \rv, 0x73640000, 7364)
+31:            checkuart(\rp, \rv, 0x73660000, 7366)
+32:            checkuart(\rp, \rv, 0x07437100, 74371)
+33:            checkuart(\rp, \rv, 0x74390000, 7439)
+34:            checkuart(\rp, \rv, 0x74450000, 7445)
 
                /* No valid UART found */
 90:            mov     \rp, #0
index 7fff88e..7a4853b 100644 (file)
@@ -547,7 +547,7 @@ static int arch_build_bp_info(struct perf_event *bp,
                if ((hw->ctrl.type != ARM_BREAKPOINT_EXECUTE)
                        && max_watchpoint_len >= 8)
                        break;
-               /* Else, fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
@@ -612,12 +612,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
                /* Allow halfword watchpoints and breakpoints. */
                if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2)
                        break;
-               /* Else, fall through */
+               fallthrough;
        case 3:
                /* Allow single byte watchpoint. */
                if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
                        break;
-               /* Else, fall through */
+               fallthrough;
        default:
                ret = -EINVAL;
                goto out;
@@ -884,7 +884,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
                break;
        case ARM_ENTRY_ASYNC_WATCHPOINT:
                WARN(1, "Asynchronous watchpoint exception taken. Debugging results may be unreliable\n");
-               /* Fall through */
+               fallthrough;
        case ARM_ENTRY_SYNC_WATCHPOINT:
                watchpoint_handler(addr, fsr, regs);
                break;
@@ -933,7 +933,7 @@ static bool core_has_os_save_restore(void)
                ARM_DBG_READ(c1, c1, 4, oslsr);
                if (oslsr & ARM_OSLSR_OSLM0)
                        return true;
-               /* Else, fall through */
+               fallthrough;
        default:
                return false;
        }
index c9dc912..c1892f7 100644 (file)
@@ -596,7 +596,7 @@ static int do_signal(struct pt_regs *regs, int syscall)
                switch (retval) {
                case -ERESTART_RESTARTBLOCK:
                        restart -= 2;
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
index 2aab043..120f9aa 100644 (file)
@@ -51,10 +51,11 @@ static struct at91_soc_pm soc_pm = {
 };
 
 static const match_table_t pm_modes __initconst = {
-       { AT91_PM_STANDBY, "standby" },
-       { AT91_PM_ULP0, "ulp0" },
-       { AT91_PM_ULP1, "ulp1" },
-       { AT91_PM_BACKUP, "backup" },
+       { AT91_PM_STANDBY,      "standby" },
+       { AT91_PM_ULP0,         "ulp0" },
+       { AT91_PM_ULP0_FAST,    "ulp0-fast" },
+       { AT91_PM_ULP1,         "ulp1" },
+       { AT91_PM_BACKUP,       "backup" },
        { -1, NULL },
 };
 
@@ -557,11 +558,6 @@ static void at91rm9200_idle(void)
        writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR);
 }
 
-static void at91sam9x60_idle(void)
-{
-       cpu_do_idle();
-}
-
 static void at91sam9_idle(void)
 {
        writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR);
@@ -789,6 +785,51 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = {
        { /* sentinel */ },
 };
 
+static void __init at91_pm_modes_validate(const int *modes, int len)
+{
+       u8 i, standby = 0, suspend = 0;
+       int mode;
+
+       for (i = 0; i < len; i++) {
+               if (standby && suspend)
+                       break;
+
+               if (modes[i] == soc_pm.data.standby_mode && !standby) {
+                       standby = 1;
+                       continue;
+               }
+
+               if (modes[i] == soc_pm.data.suspend_mode && !suspend) {
+                       suspend = 1;
+                       continue;
+               }
+       }
+
+       if (!standby) {
+               if (soc_pm.data.suspend_mode == AT91_PM_STANDBY)
+                       mode = AT91_PM_ULP0;
+               else
+                       mode = AT91_PM_STANDBY;
+
+               pr_warn("AT91: PM: %s mode not supported! Using %s.\n",
+                       pm_modes[soc_pm.data.standby_mode].pattern,
+                       pm_modes[mode].pattern);
+               soc_pm.data.standby_mode = mode;
+       }
+
+       if (!suspend) {
+               if (soc_pm.data.standby_mode == AT91_PM_ULP0)
+                       mode = AT91_PM_STANDBY;
+               else
+                       mode = AT91_PM_ULP0;
+
+               pr_warn("AT91: PM: %s mode not supported! Using %s.\n",
+                       pm_modes[soc_pm.data.suspend_mode].pattern,
+                       pm_modes[mode].pattern);
+               soc_pm.data.suspend_mode = mode;
+       }
+}
+
 static void __init at91_pm_init(void (*pm_idle)(void))
 {
        struct device_node *pmc_np;
@@ -800,6 +841,7 @@ static void __init at91_pm_init(void (*pm_idle)(void))
 
        pmc_np = of_find_matching_node_and_match(NULL, atmel_pmc_ids, &of_id);
        soc_pm.data.pmc = of_iomap(pmc_np, 0);
+       of_node_put(pmc_np);
        if (!soc_pm.data.pmc) {
                pr_err("AT91: PM not supported, PMC not found\n");
                return;
@@ -830,6 +872,14 @@ void __init at91rm9200_pm_init(void)
        if (!IS_ENABLED(CONFIG_SOC_AT91RM9200))
                return;
 
+       /*
+        * Force STANDBY and ULP0 mode to avoid calling
+        * at91_pm_modes_validate() which may increase booting time.
+        * Platform supports anyway only STANDBY and ULP0 modes.
+        */
+       soc_pm.data.standby_mode = AT91_PM_STANDBY;
+       soc_pm.data.suspend_mode = AT91_PM_ULP0;
+
        at91_dt_ramc();
 
        /*
@@ -842,12 +892,17 @@ void __init at91rm9200_pm_init(void)
 
 void __init sam9x60_pm_init(void)
 {
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1,
+       };
+
        if (!IS_ENABLED(CONFIG_SOC_SAM9X60))
                return;
 
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
        at91_pm_modes_init();
        at91_dt_ramc();
-       at91_pm_init(at91sam9x60_idle);
+       at91_pm_init(NULL);
 
        soc_pm.ws_ids = sam9x60_ws_ids;
        soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws;
@@ -858,26 +913,46 @@ void __init at91sam9_pm_init(void)
        if (!IS_ENABLED(CONFIG_SOC_AT91SAM9))
                return;
 
+       /*
+        * Force STANDBY and ULP0 mode to avoid calling
+        * at91_pm_modes_validate() which may increase booting time.
+        * Platform supports anyway only STANDBY and ULP0 modes.
+        */
+       soc_pm.data.standby_mode = AT91_PM_STANDBY;
+       soc_pm.data.suspend_mode = AT91_PM_ULP0;
+
        at91_dt_ramc();
        at91_pm_init(at91sam9_idle);
 }
 
 void __init sama5_pm_init(void)
 {
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST,
+       };
+
        if (!IS_ENABLED(CONFIG_SOC_SAMA5))
                return;
 
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
        at91_dt_ramc();
        at91_pm_init(NULL);
 }
 
 void __init sama5d2_pm_init(void)
 {
+       static const int modes[] __initconst = {
+               AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1,
+               AT91_PM_BACKUP,
+       };
+
        if (!IS_ENABLED(CONFIG_SOC_SAMA5D2))
                return;
 
+       at91_pm_modes_validate(modes, ARRAY_SIZE(modes));
        at91_pm_modes_init();
-       sama5_pm_init();
+       at91_dt_ramc();
+       at91_pm_init(NULL);
 
        soc_pm.ws_ids = sama5d2_ws_ids;
        soc_pm.config_shdwc_ws = at91_sama5d2_config_shdwc_ws;
index 218e8d1..bfb260b 100644 (file)
@@ -19,8 +19,9 @@
 
 #define        AT91_PM_STANDBY         0x00
 #define AT91_PM_ULP0           0x01
-#define AT91_PM_ULP1           0x02
-#define        AT91_PM_BACKUP          0x03
+#define AT91_PM_ULP0_FAST      0x02
+#define AT91_PM_ULP1           0x03
+#define        AT91_PM_BACKUP          0x04
 
 #ifndef __ASSEMBLY__
 struct at91_pm_data {
index be9764e..0184de0 100644 (file)
@@ -164,7 +164,22 @@ ENDPROC(at91_backup_mode)
 
 .macro at91_pm_ulp0_mode
        ldr     pmc, .pmc_base
+       ldr     tmp2, .pm_mode
+       ldr     tmp3, .mckr_offset
+
+       /* Check if ULP0 fast variant has been requested. */
+       cmp     tmp2, #AT91_PM_ULP0_FAST
+       bne     0f
+
+       /* Set highest prescaler for power saving */
+       ldr     tmp1, [pmc, tmp3]
+       bic     tmp1, tmp1, #AT91_PMC_PRES
+       orr     tmp1, tmp1, #AT91_PMC_PRES_64
+       str     tmp1, [pmc, tmp3]
+       wait_mckrdy
+       b       1f
 
+0:
        /* Turn off the crystal oscillator */
        ldr     tmp1, [pmc, #AT91_CKGR_MOR]
        bic     tmp1, tmp1, #AT91_PMC_MOSCEN
@@ -192,7 +207,18 @@ ENDPROC(at91_backup_mode)
        /* Wait for interrupt */
 1:     at91_cpu_idle
 
-       /* Restore RC oscillator state */
+       /* Check if ULP0 fast variant has been requested. */
+       cmp     tmp2, #AT91_PM_ULP0_FAST
+       bne     5f
+
+       /* Set lowest prescaler for fast resume. */
+       ldr     tmp1, [pmc, tmp3]
+       bic     tmp1, tmp1, #AT91_PMC_PRES
+       str     tmp1, [pmc, tmp3]
+       wait_mckrdy
+       b       6f
+
+5:     /* Restore RC oscillator state */
        ldr     tmp1, .saved_osc_status
        tst     tmp1, #AT91_PMC_MOSCRCS
        beq     4f
@@ -216,6 +242,7 @@ ENDPROC(at91_backup_mode)
        str     tmp1, [pmc, #AT91_CKGR_MOR]
 
        wait_moscrdy
+6:
 .endm
 
 /**
@@ -473,23 +500,29 @@ ENDPROC(at91_backup_mode)
 ENTRY(at91_ulp_mode)
        ldr     pmc, .pmc_base
        ldr     tmp2, .mckr_offset
+       ldr     tmp3, .pm_mode
 
        /* Save Master clock setting */
        ldr     tmp1, [pmc, tmp2]
        str     tmp1, .saved_mckr
 
        /*
-        * Set the Master clock source to slow clock
+        * Set master clock source to:
+        * - MAINCK if using ULP0 fast variant
+        * - slow clock, otherwise
         */
        bic     tmp1, tmp1, #AT91_PMC_CSS
+       cmp     tmp3, #AT91_PM_ULP0_FAST
+       bne     save_mck
+       orr     tmp1, tmp1, #AT91_PMC_CSS_MAIN
+save_mck:
        str     tmp1, [pmc, tmp2]
 
        wait_mckrdy
 
        at91_plla_disable
 
-       ldr     r0, .pm_mode
-       cmp     r0, #AT91_PM_ULP1
+       cmp     tmp3, #AT91_PM_ULP1
        beq     ulp1_mode
 
        at91_pm_ulp0_mode
index 1df0ee0..ae79090 100644 (file)
@@ -208,6 +208,7 @@ config ARCH_BRCMSTB
        select ARM_GIC
        select ARM_ERRATA_798181 if SMP
        select HAVE_ARM_ARCH_TIMER
+       select BCM7038_L1_IRQ
        select BRCMSTB_L2_IRQ
        select BCM7120_L2_IRQ
        select ARCH_HAS_HOLES_MEMORYMODEL
index 1c05c5b..757032d 100644 (file)
@@ -49,7 +49,7 @@ static int crunch_do(struct notifier_block *self, unsigned long cmd, void *t)
                 * FALLTHROUGH: Ensure we don't try to overwrite our newly
                 * initialised state information on the first fault.
                 */
-               /* Fall through */
+               fallthrough;
 
        case THREAD_NOTIFY_EXIT:
                crunch_task_release(thread);
index f185cd3..d2d2497 100644 (file)
@@ -24,7 +24,6 @@ menuconfig ARCH_EXYNOS
        select HAVE_ARM_ARCH_TIMER if ARCH_EXYNOS5
        select HAVE_ARM_SCU if SMP
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
index 0fd3fcf..53fa363 100644 (file)
@@ -3,10 +3,6 @@
 # Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
 #              http://www.samsung.com/
 
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
-
-# Core
-
 obj-$(CONFIG_ARCH_EXYNOS)      += exynos.o exynos-smc.o firmware.o
 
 obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm.o sleep.o
index afd988a..29eb075 100644 (file)
 #define EXYNOS5800_SOC_ID      0xE5422000
 #define EXYNOS5_SOC_MASK       0xFFFFF000
 
-extern unsigned long samsung_cpu_id;
+extern unsigned long exynos_cpu_id;
 
 #define IS_SAMSUNG_CPU(name, id, mask)         \
 static inline int is_samsung_##name(void)      \
 {                                              \
-       return ((samsung_cpu_id & mask) == (id & mask));        \
+       return ((exynos_cpu_id & mask) == (id & mask)); \
 }
 
 IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
@@ -147,7 +147,7 @@ extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data;
 
 extern void exynos_set_delayed_reset_assertion(bool enable);
 
-extern unsigned int samsung_rev(void);
+extern unsigned int exynos_rev(void);
 extern void exynos_core_restart(u32 core_id);
 extern int exynos_set_boot_addr(u32 core_id, unsigned long boot_addr);
 extern int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr);
index a96f335..700763e 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/map.h>
-#include <plat/cpu.h>
-
 #include "common.h"
 
+#define S3C_ADDR_BASE  0xF6000000
+#define S3C_ADDR(x)    ((void __iomem __force *)S3C_ADDR_BASE + (x))
+#define S5P_VA_CHIPID  S3C_ADDR(0x02000000)
+
 static struct platform_device exynos_cpuidle = {
        .name              = "exynos_cpuidle",
 #ifdef CONFIG_ARM_EXYNOS_CPUIDLE
@@ -36,6 +37,14 @@ void __iomem *sysram_base_addr __ro_after_init;
 phys_addr_t sysram_base_phys __ro_after_init;
 void __iomem *sysram_ns_base_addr __ro_after_init;
 
+unsigned long exynos_cpu_id;
+static unsigned int exynos_cpu_rev;
+
+unsigned int exynos_rev(void)
+{
+       return exynos_cpu_rev;
+}
+
 void __init exynos_sysram_init(void)
 {
        struct device_node *node;
@@ -86,7 +95,11 @@ static void __init exynos_init_io(void)
        of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
 
        /* detect cpu id and rev. */
-       s5p_init_cpu(S5P_VA_CHIPID);
+       exynos_cpu_id = readl_relaxed(S5P_VA_CHIPID);
+       exynos_cpu_rev = exynos_cpu_id & 0xFF;
+
+       pr_info("Samsung CPU ID: 0x%08lx\n", exynos_cpu_id);
+
 }
 
 /*
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
deleted file mode 100644 (file)
index 8d58faa..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * Exynos - Memory map definitions
- */
-
-#ifndef __ASM_ARCH_MAP_H
-#define __ASM_ARCH_MAP_H __FILE__
-
-#include <plat/map-base.h>
-
-#include <plat/map-s5p.h>
-
-#define EXYNOS_PA_CHIPID               0x10000000
-
-#endif /* __ASM_ARCH_MAP_H */
index 0cbbae8..d7fedbb 100644 (file)
@@ -22,8 +22,6 @@
 #include <asm/smp_scu.h>
 #include <asm/firmware.h>
 
-#include <mach/map.h>
-
 #include "common.h"
 
 extern void exynos4_secondary_startup(void);
@@ -188,7 +186,7 @@ void exynos_scu_enable(void)
 
 static void __iomem *cpu_boot_reg_base(void)
 {
-       if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
+       if (soc_is_exynos4210() && exynos_rev() == EXYNOS4210_REV_1_1)
                return pmu_base_addr + S5P_INFORM5;
        return sysram_base_addr;
 }
index 78af34c..30f4e55 100644 (file)
 
 static inline void __iomem *exynos_boot_vector_addr(void)
 {
-       if (samsung_rev() == EXYNOS4210_REV_1_1)
+       if (exynos_rev() == EXYNOS4210_REV_1_1)
                return pmu_base_addr + S5P_INFORM7;
-       else if (samsung_rev() == EXYNOS4210_REV_1_0)
+       else if (exynos_rev() == EXYNOS4210_REV_1_0)
                return sysram_base_addr + 0x24;
        return pmu_base_addr + S5P_INFORM0;
 }
 
 static inline void __iomem *exynos_boot_vector_flag(void)
 {
-       if (samsung_rev() == EXYNOS4210_REV_1_1)
+       if (exynos_rev() == EXYNOS4210_REV_1_1)
                return pmu_base_addr + S5P_INFORM6;
-       else if (samsung_rev() == EXYNOS4210_REV_1_0)
+       else if (exynos_rev() == EXYNOS4210_REV_1_0)
                return sysram_base_addr + 0x20;
        return pmu_base_addr + S5P_INFORM1;
 }
index 2d86381..7a6f74c 100644 (file)
@@ -123,19 +123,19 @@ void mmp2_pm_enter_lowpower_mode(int state)
        case POWER_MODE_SYS_SLEEP:
                apcr |= MPMU_PCR_PJ_SLPEN;              /* set the SLPEN bit */
                apcr |= MPMU_PCR_PJ_VCTCXOSD;           /* set VCTCXOSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CHIP_SLEEP:
                apcr |= MPMU_PCR_PJ_SLPEN;
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_SLEEP:
                apcr |= MPMU_PCR_PJ_APBSD;              /* set APBSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_IDLE:
                apcr |= MPMU_PCR_PJ_AXISD;              /* set AXISDD bit */
                apcr |= MPMU_PCR_PJ_DDRCORSD;           /* set DDRCORSD bit */
                idle_cfg |= APMU_PJ_IDLE_CFG_PJ_PWRDWN; /* PJ power down */
                apcr |= MPMU_PCR_PJ_SPSD;
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CORE_EXTIDLE:
                idle_cfg |= APMU_PJ_IDLE_CFG_PJ_IDLE;   /* set the IDLE bit */
                idle_cfg &= ~APMU_PJ_IDLE_CFG_ISO_MODE_CNTRL_MASK;
index 69ebe18..1d71d73 100644 (file)
@@ -145,23 +145,23 @@ void pxa910_pm_enter_lowpower_mode(int state)
        case POWER_MODE_UDR:
                /* only shutdown APB in UDR */
                apcr |= MPMU_APCR_STBYEN | MPMU_APCR_APBSD;
-               /* fall through */
+               fallthrough;
        case POWER_MODE_SYS_SLEEP:
                apcr |= MPMU_APCR_SLPEN;                /* set the SLPEN bit */
                apcr |= MPMU_APCR_VCTCXOSD;             /* set VCTCXOSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_SLEEP:
                apcr |= MPMU_APCR_DDRCORSD;             /* set DDRCORSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_IDLE:
                apcr |= MPMU_APCR_AXISD;                /* set AXISDD bit */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CORE_EXTIDLE:
                idle_cfg |= APMU_MOH_IDLE_CFG_MOH_IDLE;
                idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWRDWN;
                idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWR_SW(3)
                        | APMU_MOH_IDLE_CFG_MOH_L2_PWR_SW(3);
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CORE_INTIDLE:
                break;
        }
index adfe1f6..3f6dc55 100644 (file)
@@ -88,7 +88,7 @@
  * OMAP730/850 has a slightly different config for the pin mux.
  * - config regs are the OMAP7XX_IO_CONF_x regs (see omap7xx.h) regs and
  *   not the FUNC_MUX_CTRL_x regs from hardware.h
- * - for pull-up/down, only has one enable bit which is is in the same register
+ * - for pull-up/down, only has one enable bit which is in the same register
  *   as mux config
  */
 #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode,  \
index ea23205..3ee7bdf 100644 (file)
@@ -7,6 +7,7 @@ config ARCH_OMAP2
        depends on ARCH_MULTI_V6
        select ARCH_OMAP2PLUS
        select CPU_V6
+       select PM_GENERIC_DOMAINS if PM
        select SOC_HAS_OMAP2_SDRC
 
 config ARCH_OMAP3
index 5eef093..bf2b5f8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file contains the address info for various AM33XX modules.
  *
- * Copyright (C) 2011 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2011 Texas Instruments, Inc. - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 334923d..7290f03 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (C) 2005 Nokia Corporation
  * Author: Paul Mundt <paul.mundt@nokia.com>
  *
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
  *
  * Modified from the original mach-omap/omap2/board-generic.c did by Paul
  * to support the OMAP2+ device tree boards with an unique board file.
index 32c90fd..b4d5144 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX Clock Domain data.
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
  * This program is free software; you can redistribute it and/or
index 65fbd13..127dc7a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * TI81XX Clock Domain data.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
  *
  * This program is free software; you can redistribute it and/or
index c0823fd..e7ae2bb 100644 (file)
@@ -4,7 +4,7 @@
  * This file is automatically generated from the AM33XX hardware databases.
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 44663b5..fc88688 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx Clock Management register bits
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index a78ccba..2725af4 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx Clock Management register bits
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 7be363a..eb86bbd 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx CM1 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index 28660ed..aae3831 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx CM1 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index c5da1f5..8e49765 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx CM2 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index e16fc58..f873460 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx CM2 instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 084d454..ac4882e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX CM functions
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
  * Reference taken from from OMAP4 cminst44xx.c
index a91f7d2..63b362b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX CM offset macros
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  * Vaibhav Hiremath <hvaibhav@ti.com>
  *
  * This program is free software; you can redistribute it and/or
index 5d73a10..bd91223 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Clock domain register offsets for TI81XX.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
  *
  * This program is free software; you can redistribute it and/or
index 46012ca..2000fca 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP2plus display device setup / initialization.
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Senthilvadivu Guruswamy
  *     Sumit Semwal
  *
index 8cc109c..dfc9b21 100644 (file)
@@ -13,7 +13,7 @@
  * Copyright (C) 2009 Texas Instruments
  * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  * Converted DMA library into platform driver
  *     - G, Manjunath Kondaiah <manjugk@ti.com>
  */
index 1d119b9..59755b5 100644 (file)
@@ -396,7 +396,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "3.1";
                        break;
                case 7:
-               /* FALLTHROUGH */
                default:
                        /* Use the latest known revision as default */
                        omap_revision = OMAP3430_REV_ES3_1_2;
@@ -416,7 +415,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "1.0";
                        break;
                case 1:
-               /* FALLTHROUGH */
                default:
                        omap_revision = AM35XX_REV_ES1_1;
                        cpu_rev = "1.1";
@@ -435,7 +433,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "1.1";
                        break;
                case 2:
-               /* FALLTHROUGH */
                default:
                        omap_revision = OMAP3630_REV_ES1_2;
                        cpu_rev = "1.2";
@@ -456,7 +453,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "2.0";
                        break;
                case 3:
-                       /* FALLTHROUGH */
                default:
                        omap_revision = TI8168_REV_ES2_1;
                        cpu_rev = "2.1";
@@ -473,7 +469,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "2.0";
                        break;
                case 2:
-               /* FALLTHROUGH */
                default:
                        omap_revision = AM335X_REV_ES2_1;
                        cpu_rev = "2.1";
@@ -491,7 +486,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "1.1";
                        break;
                case 2:
-               /* FALLTHROUGH */
                default:
                        omap_revision = AM437X_REV_ES1_2;
                        cpu_rev = "1.2";
@@ -502,7 +496,6 @@ void __init omap3xxx_check_revision(void)
        case 0xb968:
                switch (rev) {
                case 0:
-               /* FALLTHROUGH */
                case 1:
                        omap_revision = TI8148_REV_ES1_0;
                        cpu_rev = "1.0";
@@ -512,7 +505,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "2.0";
                        break;
                case 3:
-               /* FALLTHROUGH */
                default:
                        omap_revision = TI8148_REV_ES2_1;
                        cpu_rev = "2.1";
index c2bd8d8..6297c62 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * arch/arm/plat-omap/include/plat/l3_2xxx.h - L3 firewall definitions
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Sumit Semwal
  */
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_2XXX_H
index 995ebcc..60ea7b2 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * arch/arm/plat-omap/include/plat/l3_3xxx.h - L3 firewall definitions
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Sumit Semwal
  */
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L3_3XXX_H
index 556e69c..418e107 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * arch/arm/plat-omap/include/plat/l4_2xxx.h - L4 firewall definitions
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Sumit Semwal
  */
 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_L4_2XXX_H
index 54aff33..df6686b 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP IOMMU quirks for various TI SoCs
  *
- * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2015-2019 Texas Instruments Incorporated - https://www.ti.com/
  *      Suman Anna <s-anna@ti.com>
  */
 
index 6b4548f..fc7bb2c 100644 (file)
@@ -240,7 +240,7 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
                if (pdev->dev.of_node)
                        omap_device_build_from_dt(pdev);
                omap_auxdata_legacy_init(dev);
-               /* fall through */
+               fallthrough;
        default:
                od = to_omap_device(pdev);
                if (od)
index 5f4ab24..e298410 100644 (file)
@@ -26,7 +26,6 @@ extern struct omap_hwmod_ocp_if am33xx_mpu__prcm;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__l3_main;
 extern struct omap_hwmod_ocp_if am33xx_gfx__l3_main;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__gfx;
-extern struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__gpmc;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer2;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__ocmc;
@@ -43,7 +42,6 @@ extern struct omap_hwmod am33xx_ocmcram_hwmod;
 extern struct omap_hwmod am33xx_smartreflex0_hwmod;
 extern struct omap_hwmod am33xx_smartreflex1_hwmod;
 extern struct omap_hwmod am33xx_gpmc_hwmod;
-extern struct omap_hwmod am33xx_rtc_hwmod;
 
 extern struct omap_hwmod_class am33xx_emif_hwmod_class;
 extern struct omap_hwmod_class am33xx_l4_hwmod_class;
index b389d65..ab5146b 100644 (file)
@@ -74,30 +74,6 @@ struct omap_hwmod_ocp_if am33xx_l3_s__l3_main = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* gfx -> l3 main */
-struct omap_hwmod_ocp_if am33xx_gfx__l3_main = {
-       .master         = &am33xx_gfx_hwmod,
-       .slave          = &am33xx_l3_main_hwmod,
-       .clk            = "dpll_core_m4_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l3 main -> gfx */
-struct omap_hwmod_ocp_if am33xx_l3_main__gfx = {
-       .master         = &am33xx_l3_main_hwmod,
-       .slave          = &am33xx_gfx_hwmod,
-       .clk            = "dpll_core_m4_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4 wkup -> rtc */
-struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_rtc_hwmod,
-       .clk            = "clkdiv32k_ick",
-       .user           = OCP_USER_MPU,
-};
-
 /* l3s cfg -> gpmc */
 struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
        .master         = &am33xx_l3_s_hwmod,
index 4b3cd59..bcc120e 100644 (file)
@@ -26,7 +26,6 @@
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
 #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
-#define PRCM_FLAGS(oh, flag) ((oh).prcm.omap4.flags = (flag))
 
 /*
  * 'l3' class
@@ -133,30 +132,6 @@ struct omap_hwmod_class am33xx_wkup_m3_hwmod_class = {
        .name           = "wkup_m3",
 };
 
-/* gfx */
-/* Pseudo hwmod for reset control purpose only */
-static struct omap_hwmod_class am33xx_gfx_hwmod_class = {
-       .name   = "gfx",
-};
-
-static struct omap_hwmod_rst_info am33xx_gfx_resets[] = {
-       { .name = "gfx", .rst_shift = 0, .st_shift = 0},
-};
-
-struct omap_hwmod am33xx_gfx_hwmod = {
-       .name           = "gfx",
-       .class          = &am33xx_gfx_hwmod_class,
-       .clkdm_name     = "gfx_l3_clkdm",
-       .main_clk       = "gfx_fck_div_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .rst_lines      = am33xx_gfx_resets,
-       .rst_lines_cnt  = ARRAY_SIZE(am33xx_gfx_resets),
-};
-
 /*
  * 'prcm' class
  * power and reset manager (whole prcm infrastructure)
@@ -274,67 +249,24 @@ struct omap_hwmod am33xx_gpmc_hwmod = {
        },
 };
 
-
-/*
- * 'rtc' class
- * rtc subsystem
- */
-static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc = {
-       .rev_offs       = 0x0074,
-       .sysc_offs      = 0x0078,
-       .sysc_flags     = SYSC_HAS_SIDLEMODE,
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO |
-                         SIDLE_SMART | SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type3,
-};
-
-static struct omap_hwmod_class am33xx_rtc_hwmod_class = {
-       .name           = "rtc",
-       .sysc           = &am33xx_rtc_sysc,
-       .unlock         = &omap_hwmod_rtc_unlock,
-       .lock           = &omap_hwmod_rtc_lock,
-};
-
-struct omap_hwmod am33xx_rtc_hwmod = {
-       .name           = "rtc",
-       .class          = &am33xx_rtc_hwmod_class,
-       .clkdm_name     = "l4_rtc_clkdm",
-       .main_clk       = "clk_32768_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 static void omap_hwmod_am33xx_clkctrl(void)
 {
        CLKCTRL(am33xx_smartreflex0_hwmod,
                AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex1_hwmod,
                AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
-       PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_main_hwmod, AM33XX_CM_PER_L3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_gfx_hwmod, AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mpu_hwmod , AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_instr_hwmod , AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_ocmcram_hwmod , AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET);
 }
 
-static void omap_hwmod_am33xx_rst(void)
-{
-       RSTCTRL(am33xx_gfx_hwmod, AM33XX_RM_GFX_RSTCTRL_OFFSET);
-       RSTST(am33xx_gfx_hwmod, AM33XX_RM_GFX_RSTST_OFFSET);
-}
-
 void omap_hwmod_am33xx_reg(void)
 {
        omap_hwmod_am33xx_clkctrl();
-       omap_hwmod_am33xx_rst();
 }
 
 static void omap_hwmod_am43xx_clkctrl(void)
@@ -343,25 +275,16 @@ static void omap_hwmod_am43xx_clkctrl(void)
                AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex1_hwmod,
                AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_wkup_hwmod, AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_main_hwmod, AM43XX_CM_PER_L3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_gfx_hwmod, AM43XX_CM_GFX_GFX_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mpu_hwmod , AM43XX_CM_MPU_MPU_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l3_instr_hwmod , AM43XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_ocmcram_hwmod , AM43XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET);
 }
 
-static void omap_hwmod_am43xx_rst(void)
-{
-       RSTCTRL(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTCTRL_OFFSET);
-       RSTST(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTST_OFFSET);
-}
-
 void omap_hwmod_am43xx_reg(void)
 {
        omap_hwmod_am43xx_clkctrl();
-       omap_hwmod_am43xx_rst();
 }
index 3cf9c4c..b232f6c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * omap_hwmod_33xx_data.c: Hardware modules present on the AM33XX chips
  *
- * Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) {2012} Texas Instruments Incorporated - https://www.ti.com/
  *
  * This file is automatically generated from the AM33XX hardware databases.
  * This program is free software; you can redistribute it and/or
@@ -274,16 +274,13 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
        &am33xx_l3_main__l4_hs,
        &am33xx_l3_main__l3_s,
        &am33xx_l3_main__l3_instr,
-       &am33xx_l3_main__gfx,
        &am33xx_l3_s__l3_main,
        &am33xx_wkup_m3__l4_wkup,
-       &am33xx_gfx__l3_main,
        &am33xx_l3_main__debugss,
        &am33xx_l4_wkup__wkup_m3,
        &am33xx_l4_wkup__control,
        &am33xx_l4_wkup__smartreflex0,
        &am33xx_l4_wkup__smartreflex1,
-       &am33xx_l4_wkup__rtc,
        &am33xx_l3_s__gpmc,
        &am33xx_l3_main__ocmc,
        NULL,
index b88d12d..b97cb74 100644 (file)
@@ -143,11 +143,9 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        &am43xx_l3_main__l4_hs,
        &am33xx_l3_main__l3_s,
        &am33xx_l3_main__l3_instr,
-       &am33xx_l3_main__gfx,
        &am33xx_l3_s__l3_main,
        &am43xx_l3_main__emif,
        &am43xx_wkup_m3__l4_wkup,
-       &am33xx_gfx__l3_main,
        &am43xx_l4_wkup__wkup_m3,
        &am43xx_l4_wkup__control,
        &am43xx_l4_wkup__smartreflex0,
@@ -157,11 +155,6 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        NULL,
 };
 
-static struct omap_hwmod_ocp_if *am43xx_rtc_hwmod_ocp_ifs[] __initdata = {
-       &am33xx_l4_wkup__rtc,
-       NULL,
-};
-
 int __init am43xx_hwmod_init(void)
 {
        int ret;
@@ -170,8 +163,5 @@ int __init am43xx_hwmod_init(void)
        omap_hwmod_init();
        ret = omap_hwmod_register_links(am43xx_hwmod_ocp_ifs);
 
-       if (!ret && of_machine_is_compatible("ti,am4372"))
-               ret = omap_hwmod_register_links(am43xx_rtc_hwmod_ocp_ifs);
-
        return ret;
 }
index 665ca74..37c5911 100644 (file)
@@ -124,21 +124,6 @@ static struct omap_hwmod_class omap44xx_l4_hwmod_class = {
        .name   = "l4",
 };
 
-/* l4_abe */
-static struct omap_hwmod omap44xx_l4_abe_hwmod = {
-       .name           = "l4_abe",
-       .class          = &omap44xx_l4_hwmod_class,
-       .clkdm_name     = "abe_clkdm",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
-                       .lostcontext_mask = OMAP4430_LOSTMEM_AESSMEM_MASK,
-                       .flags        = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
-               },
-       },
-};
-
 /* l4_cfg */
 static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
        .name           = "l4_cfg",
@@ -771,22 +756,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_3 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l3_main_1 -> l4_abe */
-static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_abe = {
-       .master         = &omap44xx_l3_main_1_hwmod,
-       .slave          = &omap44xx_l4_abe_hwmod,
-       .clk            = "l3_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* mpu -> l4_abe */
-static struct omap_hwmod_ocp_if omap44xx_mpu__l4_abe = {
-       .master         = &omap44xx_mpu_hwmod,
-       .slave          = &omap44xx_l4_abe_hwmod,
-       .clk            = "ocp_abe_iclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_1 -> l4_cfg */
 static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_cfg = {
        .master         = &omap44xx_l3_main_1_hwmod,
@@ -988,8 +957,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
        &omap44xx_l3_main_1__l3_main_3,
        &omap44xx_l3_main_2__l3_main_3,
        &omap44xx_l4_cfg__l3_main_3,
-       &omap44xx_l3_main_1__l4_abe,
-       &omap44xx_mpu__l4_abe,
        &omap44xx_l3_main_1__l4_cfg,
        &omap44xx_l3_main_2__l4_per,
        &omap44xx_l4_cfg__l4_wkup,
index 7c38c1b..85b9ab4 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Hardware modules present on the OMAP54xx chips
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley
  * Benoit Cousson
@@ -121,19 +121,6 @@ static struct omap_hwmod_class omap54xx_l4_hwmod_class = {
        .name   = "l4",
 };
 
-/* l4_abe */
-static struct omap_hwmod omap54xx_l4_abe_hwmod = {
-       .name           = "l4_abe",
-       .class          = &omap54xx_l4_hwmod_class,
-       .clkdm_name     = "abe_clkdm",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_ABE_L4_ABE_CLKCTRL_OFFSET,
-                       .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
-               },
-       },
-};
-
 /* l4_cfg */
 static struct omap_hwmod omap54xx_l4_cfg_hwmod = {
        .name           = "l4_cfg",
@@ -395,22 +382,6 @@ static struct omap_hwmod_ocp_if omap54xx_l4_cfg__l3_main_3 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l3_main_1 -> l4_abe */
-static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_abe = {
-       .master         = &omap54xx_l3_main_1_hwmod,
-       .slave          = &omap54xx_l4_abe_hwmod,
-       .clk            = "abe_iclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* mpu -> l4_abe */
-static struct omap_hwmod_ocp_if omap54xx_mpu__l4_abe = {
-       .master         = &omap54xx_mpu_hwmod,
-       .slave          = &omap54xx_l4_abe_hwmod,
-       .clk            = "abe_iclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_1 -> l4_cfg */
 static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_cfg = {
        .master         = &omap54xx_l3_main_1_hwmod,
@@ -478,8 +449,6 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l3_main_1__l3_main_3,
        &omap54xx_l3_main_2__l3_main_3,
        &omap54xx_l4_cfg__l3_main_3,
-       &omap54xx_l3_main_1__l4_abe,
-       &omap54xx_mpu__l4_abe,
        &omap54xx_l3_main_1__l4_cfg,
        &omap54xx_l3_main_2__l4_per,
        &omap54xx_l3_main_1__l4_wkup,
index adb0784..05e163c 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Hardware modules present on the DRA7xx chips
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley
  * Benoit Cousson
@@ -418,41 +418,6 @@ static struct omap_hwmod dra7xx_qspi_hwmod = {
        },
 };
 
-/*
- * 'rtcss' class
- *
- */
-static struct omap_hwmod_class_sysconfig dra7xx_rtcss_sysc = {
-       .rev_offs       = 0x0074,
-       .sysc_offs      = 0x0078,
-       .sysc_flags     = SYSC_HAS_SIDLEMODE,
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type3,
-};
-
-static struct omap_hwmod_class dra7xx_rtcss_hwmod_class = {
-       .name   = "rtcss",
-       .sysc   = &dra7xx_rtcss_sysc,
-       .unlock = &omap_hwmod_rtc_unlock,
-       .lock   = &omap_hwmod_rtc_lock,
-};
-
-/* rtcss */
-static struct omap_hwmod dra7xx_rtcss_hwmod = {
-       .name           = "rtcss",
-       .class          = &dra7xx_rtcss_hwmod_class,
-       .clkdm_name     = "rtc_clkdm",
-       .main_clk       = "sys_32k_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_RTC_RTCSS_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_RTC_RTCSS_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 /*
  * 'sata' class
  *
@@ -702,14 +667,6 @@ static struct omap_hwmod_ocp_if dra7xx_l3_main_1__qspi = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per3 -> rtcss */
-static struct omap_hwmod_ocp_if dra7xx_l4_per3__rtcss = {
-       .master         = &dra7xx_l4_per3_hwmod,
-       .slave          = &dra7xx_rtcss_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> sata */
 static struct omap_hwmod_ocp_if dra7xx_l4_cfg__sata = {
        .master         = &dra7xx_l4_cfg_hwmod,
@@ -786,7 +743,6 @@ static struct omap_hwmod_ocp_if *dra72x_hwmod_ocp_ifs[] __initdata = {
 };
 
 static struct omap_hwmod_ocp_if *rtc_hwmod_ocp_ifs[] __initdata = {
-       &dra7xx_l4_per3__rtcss,
        NULL,
 };
 
index 50fb699..450ab99 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * DM81xx hwmod data.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
  *
  * This program is free software; you can redistribute it and/or
index 336fdfc..533dd64 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP SoC specific OPP Data helpers
  *
- * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009-2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Nishanth Menon
  *     Kevin Hilman
  * Copyright (C) 2010 Nokia Corporation.
index d2925e8..6f6a6a6 100644 (file)
@@ -3,7 +3,7 @@
   * This file configures the internal USB PHY in OMAP4430. Used
   * with TWL6030 transceiver and MUSB on OMAP4430.
   *
-  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+  * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com
   * Author: Hema HK <hemahk@ti.com>
   */
 
index c2d459f..b610c5f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP3 OPP table definitions.
  *
- * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009-2010 Texas Instruments Incorporated - https://www.ti.com/
  *     Nishanth Menon
  *     Kevin Hilman
  * Copyright (C) 2010-2011 Nokia Corporation.
index 985aeab..d937c5e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP4 OPP table definitions.
  *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2010-2012 Texas Instruments Incorporated - https://www.ti.com/
  *     Nishanth Menon
  *     Kevin Hilman
  *     Thara Gopinath
index 58236c7..56f2c0b 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * AM33XX Arch Power Management Routines
  *
- * Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2016-2018 Texas Instruments Incorporated - https://www.ti.com/
  *     Dave Gerlach
  */
 
@@ -25,7 +25,6 @@
 #include "control.h"
 #include "clockdomain.h"
 #include "iomap.h"
-#include "omap_hwmod.h"
 #include "pm.h"
 #include "powerdomain.h"
 #include "prm33xx.h"
@@ -36,7 +35,6 @@
 static struct powerdomain *cefuse_pwrdm, *gfx_pwrdm, *per_pwrdm, *mpu_pwrdm;
 static struct clockdomain *gfx_l4ls_clkdm;
 static void __iomem *scu_base;
-static struct omap_hwmod *rtc_oh;
 
 static int (*idle_fn)(u32 wfi_flags);
 
@@ -267,13 +265,6 @@ static struct am33xx_pm_sram_addr *amx3_get_sram_addrs(void)
                return NULL;
 }
 
-static void __iomem *am43xx_get_rtc_base_addr(void)
-{
-       rtc_oh = omap_hwmod_lookup("rtc");
-
-       return omap_hwmod_get_mpu_rt_va(rtc_oh);
-}
-
 static void am43xx_save_context(void)
 {
 }
@@ -297,16 +288,6 @@ static void am43xx_restore_context(void)
        writel_relaxed(0x0, AM33XX_L4_WK_IO_ADDRESS(0x44df2e14));
 }
 
-static void am43xx_prepare_rtc_suspend(void)
-{
-       omap_hwmod_enable(rtc_oh);
-}
-
-static void am43xx_prepare_rtc_resume(void)
-{
-       omap_hwmod_idle(rtc_oh);
-}
-
 static struct am33xx_pm_platform_data am33xx_ops = {
        .init = am33xx_suspend_init,
        .deinit = amx3_suspend_deinit,
@@ -317,10 +298,7 @@ static struct am33xx_pm_platform_data am33xx_ops = {
        .get_sram_addrs = amx3_get_sram_addrs,
        .save_context = am33xx_save_context,
        .restore_context = am33xx_restore_context,
-       .prepare_rtc_suspend = am43xx_prepare_rtc_suspend,
-       .prepare_rtc_resume = am43xx_prepare_rtc_resume,
        .check_off_mode_enable = am33xx_check_off_mode_enable,
-       .get_rtc_base_addr = am43xx_get_rtc_base_addr,
 };
 
 static struct am33xx_pm_platform_data am43xx_ops = {
@@ -333,10 +311,7 @@ static struct am33xx_pm_platform_data am43xx_ops = {
        .get_sram_addrs = amx3_get_sram_addrs,
        .save_context = am43xx_save_context,
        .restore_context = am43xx_restore_context,
-       .prepare_rtc_suspend = am43xx_prepare_rtc_suspend,
-       .prepare_rtc_resume = am43xx_prepare_rtc_resume,
        .check_off_mode_enable = am43xx_check_off_mode_enable,
-       .get_rtc_base_addr = am43xx_get_rtc_base_addr,
 };
 
 static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
index 6df395f..f5dfddf 100644 (file)
@@ -298,11 +298,7 @@ static void omap3_pm_idle(void)
        if (omap_irq_pending())
                return;
 
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
-
        omap_sram_idle();
-
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_SUSPEND
index 869adb8..626055e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX Power domain data
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 7078a61..899da0a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM43x PRCM defines
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
index 6ef3882..bdbfa07 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx PRCM MPU instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index 33d0013..2e30324 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx PRCM MPU instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 84feece..7dfdff0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX PRM_XXX register bits
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index d514166..9144cc0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX PRM functions
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index 66302c6..d0b7404 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * AM33XX PRM instance offset macros
  *
- * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index ee0f1cc..7329d6f 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54xx PRM instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Paul Walmsley (paul@pwsan.com)
  * Rajendra Nayak (rnayak@ti.com)
index cf99307..e5aee04 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * DRA7xx PRM instance offset macros
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Generated by code originally written by:
  * Paul Walmsley (paul@pwsan.com)
index 810d2b1..cb6f3e6 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * OMAP54XX SCRM registers and bitfields
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  *
  * Benoit Cousson (b-cousson@ti.com)
  *
index dc22124..ac3d0b3 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Low level suspend code for AM33XX SoCs
  *
- * Copyright (C) 2012-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2012-2018 Texas Instruments Incorporated - https://www.ti.com/
  *     Dave Gerlach, Vaibhav Bedia
  */
 
index 90d2907..832c913 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Low level suspend code for AM43XX SoCs
  *
- * Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2013-2018 Texas Instruments Incorporated - https://www.ti.com/
  *     Dave Gerlach, Vaibhav Bedia
  */
 
index a1e6caf..192b0e7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file contains the address data for various TI81XX modules.
  *
- * Copyright (C) 2010 Texas Instruments, Inc. - http://www.ti.com/
+ * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
index aac274d..e60d76d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Based on voltagedomains44xx_data.c
  *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com
  */
 #include <linux/kernel.h>
 #include <linux/err.h>
index d13344b..87cb472 100644 (file)
@@ -624,7 +624,7 @@ static void __init dns323_init(void)
                 dns323ab_leds[0].active_low = 1;
                 gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable");
                 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
-               /* Fall through */
+               fallthrough;
        case DNS323_REV_B1:
                i2c_register_board_info(0, dns323ab_i2c_devices,
                                ARRAY_SIZE(dns323ab_i2c_devices));
index ea2c842..d23970b 100644 (file)
@@ -46,7 +46,7 @@ static int __init parse_tag_acorn(const struct tag *tag)
        switch (tag->u.acorn.vram_pages) {
        case 512:
                vram_size += PAGE_SIZE * 256;
-               /* Fall through - ??? */
+               fallthrough;    /* ??? */
        case 256:
                vram_size += PAGE_SIZE * 256;
        default:
diff --git a/arch/arm/mach-s3c/Kconfig b/arch/arm/mach-s3c/Kconfig
new file mode 100644 (file)
index 0000000..25606e6
--- /dev/null
@@ -0,0 +1,250 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2009 Simtec Electronics
+
+source "arch/arm/mach-s3c/Kconfig.s3c24xx"
+source "arch/arm/mach-s3c/Kconfig.s3c64xx"
+
+config PLAT_SAMSUNG
+       bool
+       depends on PLAT_S3C24XX || ARCH_S3C64XX
+       default y
+       select GENERIC_IRQ_CHIP
+       select NO_IOPORT_MAP
+       select SOC_SAMSUNG
+       help
+         Base platform code for all Samsung SoC based systems
+
+config SAMSUNG_PM
+       bool
+       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX)
+       default y
+       help
+         Base platform power management code for samsung code
+
+if PLAT_SAMSUNG
+menu "Samsung Common options"
+
+# boot configurations
+
+comment "Boot options"
+
+config S3C_LOWLEVEL_UART_PORT
+       int "S3C UART to use for low-level messages"
+       depends on ARCH_S3C64XX
+       default 0
+       help
+         Choice of which UART port to use for the low-level messages,
+         such as the `Uncompressing...` at start time. The value of
+         this configuration should be between zero and two. The port
+         must have been initialised by the boot-loader before use.
+
+config SAMSUNG_ATAGS
+       def_bool n
+       depends on ATAGS
+       help
+          This option enables ATAGS based boot support code for
+          Samsung platforms, including static platform devices, legacy
+          clock, timer and interrupt initialization, etc.
+
+          Platforms that support only DT based boot need not to select
+          this option.
+
+if SAMSUNG_ATAGS
+
+config S3C_GPIO_SPACE
+       int "Space between gpio banks"
+       default 0
+       help
+         Add a number of spare GPIO entries between each bank for debugging
+         purposes. This allows any problems where an counter overflows from
+         one bank to another to be caught, at the expense of using a little
+         more memory.
+
+config S3C_GPIO_TRACK
+       bool
+       help
+         Internal configuration option to enable the s3c specific gpio
+         chip tracking if the platform requires it.
+
+# ADC driver
+
+config S3C_ADC
+       bool "ADC common driver support"
+       depends on !ARCH_MULTIPLATFORM
+       help
+         Core support for the ADC block found in the Samsung SoC systems
+         for drivers such as the touchscreen and hwmon to use to share
+         this resource.
+
+# device definitions to compile in
+
+config S3C_DEV_HSMMC
+       bool
+       help
+         Compile in platform device definitions for HSMMC code
+
+config S3C_DEV_HSMMC1
+       bool
+       help
+         Compile in platform device definitions for HSMMC channel 1
+
+config S3C_DEV_HSMMC2
+       bool
+       help
+         Compile in platform device definitions for HSMMC channel 2
+
+config S3C_DEV_HSMMC3
+       bool
+       help
+         Compile in platform device definitions for HSMMC channel 3
+
+config S3C_DEV_HWMON
+       bool
+       help
+           Compile in platform device definitions for HWMON
+
+config S3C_DEV_I2C1
+       bool
+       help
+         Compile in platform device definitions for I2C channel 1
+
+config S3C_DEV_I2C2
+       bool
+       help
+         Compile in platform device definitions for I2C channel 2
+
+config S3C_DEV_I2C3
+       bool
+       help
+         Compile in platform device definition for I2C controller 3
+
+config S3C_DEV_I2C4
+       bool
+       help
+         Compile in platform device definition for I2C controller 4
+
+config S3C_DEV_I2C5
+       bool
+       help
+         Compile in platform device definition for I2C controller 5
+
+config S3C_DEV_I2C6
+       bool
+       help
+         Compile in platform device definition for I2C controller 6
+
+config S3C_DEV_I2C7
+       bool
+       help
+         Compile in platform device definition for I2C controller 7
+
+config S3C_DEV_FB
+       bool
+       help
+         Compile in platform device definition for framebuffer
+
+config S3C_DEV_USB_HOST
+       bool
+       help
+         Compile in platform device definition for USB host.
+
+config S3C_DEV_USB_HSOTG
+       bool
+       help
+         Compile in platform device definition for USB high-speed OtG
+
+config S3C_DEV_WDT
+       bool
+       default y if ARCH_S3C24XX
+       help
+         Compile in platform device definition for Watchdog Timer
+
+config S3C_DEV_NAND
+       bool
+       help
+         Compile in platform device definition for NAND controller
+
+config S3C_DEV_ONENAND
+       bool
+       help
+         Compile in platform device definition for OneNAND controller
+
+config S3C_DEV_RTC
+       bool
+       help
+         Compile in platform device definition for RTC
+
+config SAMSUNG_DEV_ADC
+       bool
+       help
+         Compile in platform device definition for ADC controller
+
+config SAMSUNG_DEV_IDE
+       bool
+       help
+         Compile in platform device definitions for IDE
+
+config S3C64XX_DEV_SPI0
+       bool
+       help
+         Compile in platform device definitions for S3C64XX's type
+         SPI controller 0
+
+config S3C64XX_DEV_SPI1
+       bool
+       help
+         Compile in platform device definitions for S3C64XX's type
+         SPI controller 1
+
+config S3C64XX_DEV_SPI2
+       bool
+       help
+         Compile in platform device definitions for S3C64XX's type
+         SPI controller 2
+
+config SAMSUNG_DEV_TS
+       bool
+       help
+           Common in platform device definitions for touchscreen device
+
+config SAMSUNG_DEV_KEYPAD
+       bool
+       help
+         Compile in platform device definitions for keypad
+
+config SAMSUNG_DEV_PWM
+       bool
+       default y if ARCH_S3C24XX
+       help
+         Compile in platform device definition for PWM Timer
+
+config S3C24XX_PWM
+       bool "PWM device support"
+       select PWM
+       select PWM_SAMSUNG
+       help
+         Support for exporting the PWM timer blocks via the pwm device
+         system
+
+config GPIO_SAMSUNG
+       def_bool y
+
+config SAMSUNG_PM_GPIO
+       bool
+       default y if GPIO_SAMSUNG && PM
+       help
+         Include legacy GPIO power management code for platforms not using
+         pinctrl-samsung driver.
+endif
+
+config SAMSUNG_WAKEMASK
+       bool
+       depends on PM
+       help
+         Compile support for wakeup-mask controls found on the S3C6400
+         and above. This code allows a set of interrupt to wakeup-mask
+         mappings. See <plat/wakeup-mask.h>
+
+endmenu
+endif
diff --git a/arch/arm/mach-s3c/Kconfig.s3c24xx b/arch/arm/mach-s3c/Kconfig.s3c24xx
new file mode 100644 (file)
index 0000000..000e3e2
--- /dev/null
@@ -0,0 +1,583 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2012 Samsung Electronics Co., Ltd.
+#              http://www.samsung.com/
+#
+# Copyright 2007 Simtec Electronics
+
+if ARCH_S3C24XX
+
+config PLAT_S3C24XX
+       def_bool y
+       select GPIOLIB
+       select NO_IOPORT_MAP
+       select S3C_DEV_NAND
+       select IRQ_DOMAIN
+       select COMMON_CLK
+       help
+         Base platform code for any Samsung S3C24XX device
+
+
+
+menu "Samsung S3C24XX SoCs Support"
+
+comment "S3C24XX SoCs"
+
+config CPU_S3C2410
+       bool "Samsung S3C2410"
+       default y
+       select CPU_ARM920T
+       select S3C2410_COMMON_CLK
+       select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
+       select S3C2410_PM if PM
+       help
+         Support for S3C2410 and S3C2410A family from the S3C24XX line
+         of Samsung Mobile CPUs.
+
+config CPU_S3C2412
+       bool "Samsung S3C2412"
+       select CPU_ARM926T
+       select S3C2412_COMMON_CLK
+       select S3C2412_PM if PM_SLEEP
+       help
+         Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
+
+config CPU_S3C2416
+       bool "Samsung S3C2416/S3C2450"
+       select CPU_ARM926T
+       select S3C2416_PM if PM_SLEEP
+       select S3C2443_COMMON_CLK
+       help
+         Support for the S3C2416 SoC from the S3C24XX line
+
+config CPU_S3C2440
+       bool "Samsung S3C2440"
+       select CPU_ARM920T
+       select S3C2410_COMMON_CLK
+       select S3C2410_PM if PM_SLEEP
+       help
+         Support for S3C2440 Samsung Mobile CPU based systems.
+
+config CPU_S3C2442
+       bool "Samsung S3C2442"
+       select CPU_ARM920T
+       select S3C2410_COMMON_CLK
+       select S3C2410_PM if PM_SLEEP
+       help
+         Support for S3C2442 Samsung Mobile CPU based systems.
+
+config CPU_S3C244X
+       def_bool y
+       depends on CPU_S3C2440 || CPU_S3C2442
+
+config CPU_S3C2443
+       bool "Samsung S3C2443"
+       select CPU_ARM920T
+       select S3C2443_COMMON_CLK
+       help
+         Support for the S3C2443 SoC from the S3C24XX line
+
+# common code
+
+config S3C24XX_SMDK
+       bool
+       help
+         Common machine code for SMDK2410 and SMDK2440
+
+config S3C24XX_SIMTEC_AUDIO
+       bool
+       depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS)
+       default y
+       help
+         Add audio devices for common Simtec S3C24XX boards
+
+config S3C24XX_SIMTEC_PM
+       bool
+       help
+         Common power management code for systems that are
+         compatible with the Simtec style of power management
+
+config S3C24XX_SIMTEC_USB
+       bool
+       help
+         USB management code for common Simtec S3C24XX boards
+
+config S3C24XX_SETUP_TS
+       bool
+       help
+         Compile in platform device definition for Samsung TouchScreen.
+
+config S3C2410_PM
+       bool
+       help
+         Power Management code common to S3C2410 and better
+
+config S3C24XX_PLL
+       bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
+       depends on ARM_S3C24XX_CPUFREQ
+       help
+         Compile in support for changing the PLL frequency from the
+         S3C24XX series CPUfreq driver. The PLL takes time to settle
+         after a frequency change, so by default it is not enabled.
+
+         This also means that the PLL tables for the selected CPU(s) will
+         be built which may increase the size of the kernel image.
+
+# cpu frequency items common between s3c2410 and s3c2440/s3c2442
+
+config S3C2410_IOTIMING
+       bool
+       depends on ARM_S3C24XX_CPUFREQ
+       help
+         Internal node to select io timing code that is common to the s3c2410
+         and s3c2440/s3c2442 cpu frequency support.
+
+# cpu frequency support common to s3c2412, s3c2413 and s3c2442
+
+config S3C2412_IOTIMING
+       bool
+       depends on ARM_S3C24XX_CPUFREQ && (CPU_S3C2412 || CPU_S3C2443)
+       help
+         Intel node to select io timing code that is common to the s3c2412
+         and the s3c2443.
+
+# cpu-specific sections
+
+if CPU_S3C2410
+
+config S3C2410_PLL
+       bool
+       depends on ARM_S3C2410_CPUFREQ && S3C24XX_PLL
+       default y
+       help
+         Select the PLL table for the S3C2410
+
+config S3C24XX_SIMTEC_NOR
+       bool
+       help
+         Internal node to specify machine has simtec NOR mapping
+
+config MACH_BAST_IDE
+       bool
+       select HAVE_PATA_PLATFORM
+       help
+         Internal node for machines with an BAST style IDE
+         interface
+
+comment "S3C2410 Boards"
+
+#
+# The "S3C2410 Boards" list is ordered alphabetically by option text.
+# (without ARCH_ or MACH_)
+#
+
+config MACH_AML_M5900
+       bool "AML M5900 Series"
+       select S3C24XX_SIMTEC_PM if PM
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the American Microsystems M5900 Series
+         <http://www.amltd.com>
+
+config ARCH_BAST
+       bool "Simtec Electronics BAST (EB2410ITX)"
+       select ISA
+       select MACH_BAST_IDE
+       select S3C2410_COMMON_DCLK
+       select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ
+       select S3C24XX_SIMTEC_NOR
+       select S3C24XX_SIMTEC_PM if PM
+       select S3C24XX_SIMTEC_USB
+       select S3C_DEV_HWMON
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Simtec Electronics EB2410ITX
+         development board (also known as BAST)
+
+config BAST_PC104_IRQ
+       bool "BAST PC104 IRQ support"
+       depends on ARCH_BAST
+       default y
+       help
+         Say Y here to enable the PC104 IRQ routing on the
+         Simtec BAST (EB2410ITX)
+
+config ARCH_H1940
+       bool "IPAQ H1940"
+       select PM_H1940 if PM
+       select S3C24XX_SETUP_TS
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the HP IPAQ H1940
+
+config H1940BT
+       tristate "Control the state of H1940 bluetooth chip"
+       depends on ARCH_H1940
+       depends on RFKILL
+       help
+         This is a simple driver that is able to control
+         the state of built in bluetooth chip on h1940.
+
+config MACH_N30
+       bool "Acer N30 family"
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you want suppt for the Acer N30, Acer N35,
+         Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
+
+config MACH_OTOM
+       bool "NexVision OTOM Board"
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Nex Vision OTOM board
+
+config MACH_QT2410
+       bool "QT2410"
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Armzone QT2410
+
+config ARCH_SMDK2410
+       bool "SMDK2410/A9M2410"
+       select S3C24XX_SMDK
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the SMDK2410 or the derived module A9M2410
+         <http://www.fsforth.de>
+
+config MACH_TCT_HAMMER
+       bool "TCT Hammer Board"
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the TinCanTools Hammer Board
+         <https://www.tincantools.com>
+
+config MACH_VR1000
+       bool "Thorcom VR1000"
+       select MACH_BAST_IDE
+       select S3C2410_COMMON_DCLK
+       select S3C24XX_SIMTEC_NOR
+       select S3C24XX_SIMTEC_PM if PM
+       select S3C24XX_SIMTEC_USB
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Thorcom VR1000 board.
+
+endif  # CPU_S3C2410
+
+config S3C2412_PM_SLEEP
+       bool
+       help
+         Internal config node to apply sleep for S3C2412 power management.
+         Can be selected by another SoCs such as S3C2416 with similar
+         sleep procedure.
+
+if CPU_S3C2412
+
+config CPU_S3C2412_ONLY
+       bool
+       depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \
+                  !CPU_S3C2442 && !CPU_S3C2443
+       default y
+
+config S3C2412_PM
+       bool
+       select S3C2412_PM_SLEEP
+       select SAMSUNG_WAKEMASK
+       help
+         Internal config node to apply S3C2412 power management
+
+comment "S3C2412 Boards"
+
+#
+# The "S3C2412 Boards" list is ordered alphabetically by option text.
+# (without ARCH_ or MACH_)
+#
+
+config MACH_JIVE
+       bool "Logitech Jive"
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Logitech Jive.
+
+config MACH_JIVE_SHOW_BOOTLOADER
+       bool "Allow access to bootloader partitions in MTD"
+       depends on MACH_JIVE
+
+config MACH_S3C2413
+       bool
+       help
+         Internal node for S3C2413 version of SMDK2413, so that
+         machine_is_s3c2413() will work when MACH_SMDK2413 is
+         selected
+
+config MACH_SMDK2412
+       bool "SMDK2412"
+       select MACH_SMDK2413
+       help
+         Say Y here if you are using an SMDK2412
+
+         Note, this shares support with SMDK2413, so will automatically
+         select MACH_SMDK2413.
+
+config MACH_SMDK2413
+       bool "SMDK2413"
+       select MACH_S3C2413
+       select S3C24XX_SMDK
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using an SMDK2413
+
+config MACH_VSTMS
+       bool "VMSTMS"
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using an VSTMS board
+
+endif  # CPU_S3C2412
+
+if CPU_S3C2416
+
+config S3C2416_PM
+       bool
+       select S3C2412_PM_SLEEP
+       select SAMSUNG_WAKEMASK
+       help
+         Internal config node to apply S3C2416 power management
+
+config S3C2416_SETUP_SDHCI
+       bool
+       select S3C2416_SETUP_SDHCI_GPIO
+       help
+         Internal helper functions for S3C2416 based SDHCI systems
+
+config S3C2416_SETUP_SDHCI_GPIO
+       bool
+       help
+         Common setup code for SDHCI gpio.
+
+comment "S3C2416 Boards"
+
+config MACH_SMDK2416
+       bool "SMDK2416"
+       select S3C2416_SETUP_SDHCI
+       select S3C24XX_SMDK
+       select S3C_DEV_FB
+       select S3C_DEV_HSMMC
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using an SMDK2416
+
+config MACH_S3C2416_DT
+       bool "Samsung S3C2416 machine using devicetree"
+       select TIMER_OF
+       select USE_OF
+       select PINCTRL
+       select PINCTRL_S3C24XX
+       help
+         Machine support for Samsung S3C2416 machines with device tree enabled.
+         Select this if a fdt blob is available for the S3C2416 SoC based board.
+         Note: This is under development and not all peripherals can be supported
+         with this machine file.
+
+endif  # CPU_S3C2416
+
+if CPU_S3C2440 || CPU_S3C2442
+
+config S3C2440_XTAL_12000000
+       bool
+       help
+         Indicate that the build needs to support 12MHz system
+         crystal.
+
+config S3C2440_XTAL_16934400
+       bool
+       help
+         Indicate that the build needs to support 16.9344MHz system
+         crystal.
+
+config S3C2440_PLL_12000000
+       bool
+       depends on ARM_S3C2440_CPUFREQ && S3C2440_XTAL_12000000
+       default y if S3C24XX_PLL
+       help
+         PLL tables for S3C2440 or S3C2442 CPUs with 12MHz crystals.
+
+config S3C2440_PLL_16934400
+       bool
+       depends on ARM_S3C2440_CPUFREQ && S3C2440_XTAL_16934400
+       default y if S3C24XX_PLL
+       help
+         PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals.
+endif
+
+if CPU_S3C2440
+
+comment "S3C2440 Boards"
+
+#
+# The "S3C2440 Boards" list is ordered alphabetically by option text.
+# (without ARCH_ or MACH_)
+#
+
+config MACH_ANUBIS
+       bool "Simtec Electronics ANUBIS"
+       select HAVE_PATA_PLATFORM
+       select S3C2410_COMMON_DCLK
+       select S3C2440_XTAL_12000000
+       select S3C24XX_SIMTEC_PM if PM
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Simtec Electronics ANUBIS
+         development system
+
+config MACH_AT2440EVB
+       bool "Avantech AT2440EVB development board"
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the AT2440EVB development board
+
+config MACH_MINI2440
+       bool "MINI2440 development board"
+       select LEDS_CLASS
+       select LEDS_TRIGGERS
+       select LEDS_TRIGGER_BACKLIGHT
+       select NEW_LEDS
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
+         available via various sources. It can come with a 3.5" or 7" touch LCD.
+
+config MACH_NEXCODER_2440
+       bool "NexVision NEXCODER 2440 Light Board"
+       select S3C2440_XTAL_12000000
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board
+
+config MACH_OSIRIS
+       bool "Simtec IM2440D20 (OSIRIS) module"
+       select S3C2410_COMMON_DCLK
+       select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
+       select S3C2440_XTAL_12000000
+       select S3C24XX_SIMTEC_PM if PM
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the Simtec IM2440D20 module, also
+         known as the Osiris.
+
+config MACH_OSIRIS_DVS
+       tristate "Simtec IM2440D20 (OSIRIS) Dynamic Voltage Scaling driver"
+       depends on MACH_OSIRIS
+       depends on TPS65010
+       help
+         Say Y/M here if you want to have dynamic voltage scaling support
+         on the Simtec IM2440D20 (OSIRIS) module via the TPS65011.
+
+         The DVS driver alters the voltage supplied to the ARM core
+         depending on the frequency it is running at. The driver itself
+         does not do any of the frequency alteration, which is left up
+         to the cpufreq driver.
+
+config MACH_RX3715
+       bool "HP iPAQ rx3715"
+       select PM_H1940 if PM
+       select S3C2440_XTAL_16934400
+       select S3C_DEV_NAND
+       help
+         Say Y here if you are using the HP iPAQ rx3715.
+
+config ARCH_S3C2440
+       bool "SMDK2440"
+       select S3C2440_XTAL_16934400
+       select S3C24XX_SMDK
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       help
+         Say Y here if you are using the SMDK2440.
+
+config SMDK2440_CPU2440
+       bool "SMDK2440 with S3C2440 CPU module"
+       default y if ARCH_S3C2440
+       select S3C2440_XTAL_16934400
+
+endif  # CPU_S3C2440
+
+if CPU_S3C2442
+
+comment "S3C2442 Boards"
+
+#
+# The "S3C2442 Boards" list is ordered alphabetically by option text.
+# (without ARCH_ or MACH_)
+#
+
+config MACH_NEO1973_GTA02
+       bool "Openmoko GTA02 / Freerunner phone"
+       select I2C
+       select MFD_PCF50633
+       select PCF50633_GPIO
+       select POWER_SUPPLY
+       select S3C24XX_PWM
+       select S3C_DEV_USB_HOST
+       help
+          Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone
+
+config MACH_RX1950
+       bool "HP iPAQ rx1950"
+       select I2C
+       select PM_H1940 if PM
+       select S3C2410_COMMON_DCLK
+       select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
+       select S3C2440_XTAL_16934400
+       select S3C24XX_PWM
+       select S3C_DEV_NAND
+       help
+          Say Y here if you're using HP iPAQ rx1950
+
+endif  # CPU_S3C2442
+
+if CPU_S3C2443 || CPU_S3C2416
+
+config S3C2443_SETUP_SPI
+       bool
+       help
+         Common setup code for SPI GPIO configurations
+
+endif  # CPU_S3C2443 || CPU_S3C2416
+
+if CPU_S3C2443
+
+comment "S3C2443 Boards"
+
+config MACH_SMDK2443
+       bool "SMDK2443"
+       select S3C24XX_SMDK
+       select S3C_DEV_HSMMC1
+       help
+         Say Y here if you are using an SMDK2443
+
+endif  # CPU_S3C2443
+
+config PM_H1940
+       bool
+       help
+         Internal node for H1940 and related PM
+
+endmenu        # Samsung S3C24XX SoCs Support
+
+endif  # ARCH_S3C24XX
diff --git a/arch/arm/mach-s3c/Kconfig.s3c64xx b/arch/arm/mach-s3c/Kconfig.s3c64xx
new file mode 100644 (file)
index 0000000..f3fcb57
--- /dev/null
@@ -0,0 +1,350 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2008 Openmoko, Inc.
+#      Simtec Electronics, Ben Dooks <ben@simtec.co.uk>
+
+menuconfig ARCH_S3C64XX
+       bool "Samsung S3C64XX"
+       depends on ARCH_MULTI_V6
+       select ARM_AMBA
+       select ARM_VIC
+       select CLKSRC_SAMSUNG_PWM
+       select COMMON_CLK_SAMSUNG
+       select GPIO_SAMSUNG if ATAGS
+       select GPIOLIB
+       select HAVE_S3C2410_I2C if I2C
+       select HAVE_TCM
+       select PLAT_SAMSUNG
+       select PM_GENERIC_DOMAINS if PM
+       select S3C_DEV_NAND if ATAGS
+       select S3C_GPIO_TRACK if ATAGS
+       select S3C2410_WATCHDOG
+       select SAMSUNG_ATAGS if ATAGS
+       select SAMSUNG_WAKEMASK if PM
+       select WATCHDOG
+       help
+         Samsung S3C64XX series based systems
+
+if ARCH_S3C64XX
+
+# Configuration options for the S3C6410 CPU
+
+config CPU_S3C6400
+       bool
+       help
+         Enable S3C6400 CPU support
+
+config CPU_S3C6410
+       bool
+       help
+         Enable S3C6410 CPU support
+
+config S3C64XX_PL080
+       def_bool DMADEVICES
+       select AMBA_PL08X
+
+config S3C64XX_SETUP_SDHCI
+       bool
+       select S3C64XX_SETUP_SDHCI_GPIO
+       help
+         Internal configuration for default SDHCI setup for S3C6400 and
+         S3C6410 SoCs.
+
+config S3C64XX_DEV_ONENAND1
+       bool
+       help
+         Compile in platform device definition for OneNAND1 controller
+
+config SAMSUNG_DEV_BACKLIGHT
+       bool
+       depends on SAMSUNG_DEV_PWM
+       help
+         Compile in platform device definition LCD backlight with PWM Timer
+
+# platform specific device setup
+
+config S3C64XX_SETUP_I2C0
+       bool
+       default y
+       help
+         Common setup code for i2c bus 0.
+
+         Note, currently since i2c0 is always compiled, this setup helper
+         is always compiled with it.
+
+config S3C64XX_SETUP_I2C1
+       bool
+       help
+         Common setup code for i2c bus 1.
+
+config S3C64XX_SETUP_IDE
+       bool
+       help
+         Common setup code for S3C64XX IDE.
+
+config S3C64XX_SETUP_FB_24BPP
+       bool
+       help
+         Common setup code for S3C64XX with an 24bpp RGB display helper.
+
+config S3C64XX_SETUP_KEYPAD
+       bool
+       help
+         Common setup code for S3C64XX KEYPAD GPIO configurations
+
+config S3C64XX_SETUP_SDHCI_GPIO
+       bool
+       help
+         Common setup code for S3C64XX SDHCI GPIO configurations
+
+config S3C64XX_SETUP_SPI
+       bool
+       help
+        Common setup code for SPI GPIO configurations
+
+config S3C64XX_SETUP_USB_PHY
+       bool
+       help
+         Common setup code for USB PHY controller
+
+# S36400 Macchine support
+
+config MACH_SMDK6400
+       bool "SMDK6400"
+       depends on ATAGS
+       select CPU_S3C6400
+       select S3C64XX_SETUP_SDHCI
+       select S3C_DEV_HSMMC1
+       help
+         Machine support for the Samsung SMDK6400
+
+# S3C6410 machine support
+
+config MACH_ANW6410
+       bool "A&W6410"
+       depends on ATAGS
+       select CPU_S3C6410
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C_DEV_FB
+       help
+         Machine support for the A&W6410
+
+config MACH_MINI6410
+       bool "MINI6410"
+       depends on ATAGS
+       select CPU_S3C6410
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C64XX_SETUP_SDHCI
+       select S3C_DEV_FB
+       select S3C_DEV_HSMMC
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       select SAMSUNG_DEV_ADC
+       select SAMSUNG_DEV_TS
+       help
+         Machine support for the FriendlyARM MINI6410
+
+config MACH_REAL6410
+       bool "REAL6410"
+       depends on ATAGS
+       select CPU_S3C6410
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C64XX_SETUP_SDHCI
+       select S3C_DEV_FB
+       select S3C_DEV_HSMMC
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       select SAMSUNG_DEV_ADC
+       select SAMSUNG_DEV_TS
+       help
+         Machine support for the CoreWind REAL6410
+
+config MACH_SMDK6410
+       bool "SMDK6410"
+       depends on ATAGS
+       select CPU_S3C6410
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C64XX_SETUP_I2C1
+       select S3C64XX_SETUP_IDE
+       select S3C64XX_SETUP_KEYPAD
+       select S3C64XX_SETUP_SDHCI
+       select S3C64XX_SETUP_USB_PHY
+       select S3C_DEV_FB
+       select S3C_DEV_HSMMC
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_I2C1
+       select S3C_DEV_RTC
+       select S3C_DEV_USB_HOST
+       select S3C_DEV_USB_HSOTG
+       select S3C_DEV_WDT
+       select SAMSUNG_DEV_ADC
+       select SAMSUNG_DEV_BACKLIGHT
+       select SAMSUNG_DEV_IDE
+       select SAMSUNG_DEV_KEYPAD
+       select SAMSUNG_DEV_PWM
+       select SAMSUNG_DEV_TS
+       help
+         Machine support for the Samsung SMDK6410
+
+# At least some of the SMDK6410s were shipped with the card detect
+# for the MMC/SD slots connected to the same input. This means that
+# either the boards need to be altered to have channel0 to an alternate
+# configuration or that only one slot can be used.
+
+choice
+       prompt "SMDK6410 MMC/SD slot setup"
+       depends on MACH_SMDK6410
+
+config SMDK6410_SD_CH0
+       bool "Use channel 0 only"
+       depends on MACH_SMDK6410
+       help
+          Select CON7 (channel 0) as the MMC/SD slot, as
+         at least some SMDK6410 boards come with the
+         resistors fitted so that the card detects for
+         channels 0 and 1 are the same.
+
+config SMDK6410_SD_CH1
+       bool "Use channel 1 only"
+       depends on MACH_SMDK6410
+       help
+          Select CON6 (channel 1) as the MMC/SD slot, as
+         at least some SMDK6410 boards come with the
+         resistors fitted so that the card detects for
+         channels 0 and 1 are the same.
+
+endchoice
+
+config SMDK6410_WM1190_EV1
+       bool "Support Wolfson Microelectronics 1190-EV1 PMIC card"
+       depends on MACH_SMDK6410
+       depends on I2C=y
+       select MFD_WM8350_I2C
+       select REGULATOR
+       select REGULATOR_WM8350
+       help
+         The Wolfson Microelectronics 1190-EV1 is a WM835x based PMIC
+         and audio daughtercard for the Samsung SMDK6410 reference
+         platform.  Enabling this option will build support for this
+         module into the kernel.  The presence of the module will be
+         detected at runtime so the resulting kernel can be used
+         with or without the 1190-EV1 fitted.
+
+config SMDK6410_WM1192_EV1
+       bool "Support Wolfson Microelectronics 1192-EV1 PMIC card"
+       depends on MACH_SMDK6410
+       depends on I2C=y
+       select MFD_WM831X
+       select MFD_WM831X_I2C
+       select REGULATOR
+       select REGULATOR_WM831X
+       help
+         The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC
+         daughtercard for the Samsung SMDK6410 reference platform.
+         Enabling this option will build support for this module into
+         the kernel.  The presence of the daughtercard will be
+         detected at runtime so the resulting kernel can be used
+         with or without the 1192-EV1 fitted.
+
+config MACH_NCP
+       bool "NCP"
+       depends on ATAGS
+       select CPU_S3C6410
+       select S3C64XX_SETUP_I2C1
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_I2C1
+       help
+          Machine support for the Samsung NCP
+
+config MACH_HMT
+       bool "Airgoo HMT"
+       depends on ATAGS
+       select CPU_S3C6410
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C_DEV_FB
+       select S3C_DEV_NAND
+       select S3C_DEV_USB_HOST
+       select SAMSUNG_DEV_PWM
+       help
+         Machine support for the Airgoo HMT
+
+config MACH_SMARTQ
+       bool
+       select CPU_S3C6410
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C64XX_SETUP_SDHCI
+       select S3C64XX_SETUP_USB_PHY
+       select S3C_DEV_FB
+       select S3C_DEV_HSMMC
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_HSMMC2
+       select S3C_DEV_HWMON
+       select S3C_DEV_RTC
+       select S3C_DEV_USB_HOST
+       select S3C_DEV_USB_HSOTG
+       select SAMSUNG_DEV_ADC
+       select SAMSUNG_DEV_PWM
+       select SAMSUNG_DEV_TS
+       help
+           Shared machine support for SmartQ 5/7
+
+config MACH_SMARTQ5
+       bool "SmartQ 5"
+       depends on ATAGS
+       select MACH_SMARTQ
+       help
+           Machine support for the SmartQ 5
+
+config MACH_SMARTQ7
+       bool "SmartQ 7"
+       depends on ATAGS
+       select MACH_SMARTQ
+       help
+           Machine support for the SmartQ 7
+
+config MACH_WLF_CRAGG_6410
+       bool "Wolfson Cragganmore 6410"
+       depends on ATAGS
+       depends on I2C=y
+       select CPU_S3C6410
+       select LEDS_GPIO_REGISTER
+       select S3C64XX_DEV_SPI0
+       select S3C64XX_SETUP_FB_24BPP
+       select S3C64XX_SETUP_I2C1
+       select S3C64XX_SETUP_IDE
+       select S3C64XX_SETUP_KEYPAD
+       select S3C64XX_SETUP_SDHCI
+       select S3C64XX_SETUP_SPI
+       select S3C64XX_SETUP_USB_PHY
+       select S3C_DEV_FB
+       select S3C_DEV_HSMMC
+       select S3C_DEV_HSMMC1
+       select S3C_DEV_HSMMC2
+       select S3C_DEV_I2C1
+       select S3C_DEV_RTC
+       select S3C_DEV_USB_HOST
+       select S3C_DEV_USB_HSOTG
+       select S3C_DEV_WDT
+       select SAMSUNG_DEV_ADC
+       select SAMSUNG_DEV_KEYPAD
+       select SAMSUNG_DEV_PWM
+       help
+         Machine support for the Wolfson Cragganmore S3C6410 variant.
+
+config MACH_S3C64XX_DT
+       bool "Samsung S3C6400/S3C6410 machine using Device Tree"
+       select CPU_S3C6400
+       select CPU_S3C6410
+       select PINCTRL
+       select PINCTRL_S3C64XX
+       help
+         Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
+         enabled.
+         Select this if a fdt blob is available for your S3C64XX SoC based
+         board.
+         Note: This is under development and not all peripherals can be
+         supported with this machine file.
+
+endif
diff --git a/arch/arm/mach-s3c/Makefile b/arch/arm/mach-s3c/Makefile
new file mode 100644 (file)
index 0000000..54188d1
--- /dev/null
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2009 Simtec Electronics
+
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include
+
+ifdef CONFIG_ARCH_S3C24XX
+include $(src)/Makefile.s3c24xx
+endif
+
+ifdef CONFIG_ARCH_S3C64XX
+include $(src)/Makefile.s3c64xx
+endif
+
+# Objects we always build independent of SoC choice
+
+obj-y                          += init.o cpu.o
+
+# ADC
+
+obj-$(CONFIG_S3C_ADC)  += adc.o
+
+# devices
+
+obj-$(CONFIG_SAMSUNG_ATAGS)    += platformdata.o
+
+obj-$(CONFIG_SAMSUNG_ATAGS)    += devs.o
+obj-$(CONFIG_SAMSUNG_ATAGS)    += dev-uart.o
+
+obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
+
+# PM support
+
+obj-$(CONFIG_SAMSUNG_PM)       += pm.o pm-common.o
+obj-$(CONFIG_SAMSUNG_PM_GPIO)  += pm-gpio.o
+
+obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
diff --git a/arch/arm/mach-s3c/Makefile.boot b/arch/arm/mach-s3c/Makefile.boot
new file mode 100644 (file)
index 0000000..7f19e22
--- /dev/null
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+
+ifeq ($(CONFIG_PM_H1940),y)
+       zreladdr-y      += 0x30108000
+       params_phys-y   := 0x30100100
+else
+       zreladdr-y      += 0x30008000
+       params_phys-y   := 0x30000100
+endif
diff --git a/arch/arm/mach-s3c/Makefile.s3c24xx b/arch/arm/mach-s3c/Makefile.s3c24xx
new file mode 100644 (file)
index 0000000..3483ab3
--- /dev/null
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2012 Samsung Electronics Co., Ltd.
+#              http://www.samsung.com/
+#
+# Copyright 2007 Simtec Electronics
+
+# core
+
+obj-y                          += s3c24xx.o
+obj-y                          += irq-s3c24xx.o
+obj-$(CONFIG_SPI_S3C24XX_FIQ)  += irq-s3c24xx-fiq.o
+obj-$(CONFIG_SPI_S3C24XX_FIQ)  += irq-s3c24xx-fiq-exports.o
+
+obj-$(CONFIG_CPU_S3C2410)      += s3c2410.o
+obj-$(CONFIG_S3C2410_PLL)      += pll-s3c2410.o
+obj-$(CONFIG_S3C2410_PM)       += pm-s3c2410.o sleep-s3c2410.o
+
+obj-$(CONFIG_CPU_S3C2412)      += s3c2412.o
+obj-$(CONFIG_S3C2412_PM)       += pm-s3c2412.o
+obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
+
+obj-$(CONFIG_CPU_S3C2416)      += s3c2416.o
+obj-$(CONFIG_S3C2416_PM)       += pm-s3c2416.o
+
+obj-$(CONFIG_CPU_S3C2440)      += s3c2440.o
+obj-$(CONFIG_CPU_S3C2442)      += s3c2442.o
+obj-$(CONFIG_CPU_S3C244X)      += s3c244x.o
+obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
+obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o
+
+obj-$(CONFIG_CPU_S3C2443)      += s3c2443.o
+
+# PM
+
+obj-$(CONFIG_PM)               += pm-s3c24xx.o
+obj-$(CONFIG_PM_SLEEP)         += irq-pm-s3c24xx.o sleep-s3c24xx.o
+
+# common code
+
+obj-$(CONFIG_ARM_S3C24XX_CPUFREQ) += cpufreq-utils-s3c24xx.o
+
+obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o
+obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
+
+#
+# machine support
+# following is ordered alphabetically by option text.
+#
+
+obj-$(CONFIG_MACH_AML_M5900)           += mach-amlm5900.o
+obj-$(CONFIG_ARCH_BAST)                        += mach-bast.o
+obj-$(CONFIG_BAST_PC104_IRQ)           += bast-irq.o
+obj-$(CONFIG_ARCH_H1940)               += mach-h1940.o
+obj-$(CONFIG_H1940BT)                  += h1940-bluetooth.o
+obj-$(CONFIG_PM_H1940)                 += pm-h1940.o
+obj-$(CONFIG_MACH_N30)                 += mach-n30.o
+obj-$(CONFIG_MACH_OTOM)                        += mach-otom.o
+obj-$(CONFIG_MACH_QT2410)              += mach-qt2410.o
+obj-$(CONFIG_ARCH_SMDK2410)            += mach-smdk2410.o
+obj-$(CONFIG_MACH_TCT_HAMMER)          += mach-tct_hammer.o
+obj-$(CONFIG_MACH_VR1000)              += mach-vr1000.o
+
+obj-$(CONFIG_MACH_JIVE)                        += mach-jive.o
+obj-$(CONFIG_MACH_SMDK2413)            += mach-smdk2413.o
+obj-$(CONFIG_MACH_VSTMS)               += mach-vstms.o
+
+obj-$(CONFIG_MACH_SMDK2416)            += mach-smdk2416.o
+obj-$(CONFIG_MACH_S3C2416_DT)          += mach-s3c2416-dt.o
+
+obj-$(CONFIG_MACH_ANUBIS)              += mach-anubis.o
+obj-$(CONFIG_MACH_AT2440EVB)           += mach-at2440evb.o
+obj-$(CONFIG_MACH_MINI2440)            += mach-mini2440.o
+obj-$(CONFIG_MACH_NEXCODER_2440)       += mach-nexcoder.o
+obj-$(CONFIG_MACH_OSIRIS)              += mach-osiris.o
+obj-$(CONFIG_MACH_RX3715)              += mach-rx3715.o
+obj-$(CONFIG_ARCH_S3C2440)             += mach-smdk2440.o
+
+obj-$(CONFIG_MACH_NEO1973_GTA02)       += mach-gta02.o
+obj-$(CONFIG_MACH_RX1950)              += mach-rx1950.o
+
+obj-$(CONFIG_MACH_SMDK2443)            += mach-smdk2443.o
+
+# common bits of machine support
+
+obj-$(CONFIG_S3C24XX_SMDK)             += common-smdk-s3c24xx.o
+obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO)     += simtec-audio.o
+obj-$(CONFIG_S3C24XX_SIMTEC_NOR)       += simtec-nor.o
+obj-$(CONFIG_S3C24XX_SIMTEC_PM)                += simtec-pm.o
+obj-$(CONFIG_S3C24XX_SIMTEC_USB)       += simtec-usb.o
+
+# machine additions
+
+obj-$(CONFIG_MACH_BAST_IDE)            += bast-ide.o
+obj-$(CONFIG_MACH_OSIRIS_DVS)          += mach-osiris-dvs.o
+
+# device setup
+
+obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio-s3c24xx.o
+obj-$(CONFIG_S3C2443_SETUP_SPI)                += setup-spi-s3c24xx.o
+obj-$(CONFIG_ARCH_S3C24XX)             += setup-i2c-s3c24xx.o
+obj-$(CONFIG_S3C24XX_SETUP_TS)         += setup-ts-s3c24xx.o
diff --git a/arch/arm/mach-s3c/Makefile.s3c64xx b/arch/arm/mach-s3c/Makefile.s3c64xx
new file mode 100644 (file)
index 0000000..0c18e31
--- /dev/null
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2008 Openmoko, Inc.
+# Copyright 2008 Simtec Electronics
+
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
+asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
+
+# PM
+
+obj-$(CONFIG_PM)               += pm-s3c64xx.o
+obj-$(CONFIG_PM_SLEEP)         += sleep-s3c64xx.o
+obj-$(CONFIG_CPU_IDLE)         += cpuidle-s3c64xx.o
+
+ifdef CONFIG_SAMSUNG_ATAGS
+
+obj-$(CONFIG_PM_SLEEP)          += irq-pm-s3c64xx.o
+
+# Core
+
+obj-y                          += s3c64xx.o
+obj-$(CONFIG_CPU_S3C6400)      += s3c6400.o
+obj-$(CONFIG_CPU_S3C6410)      += s3c6410.o
+
+# DMA support
+
+obj-$(CONFIG_S3C64XX_PL080)    += pl080.o
+
+# Device support
+
+obj-y                          += dev-uart-s3c64xx.o
+obj-y                          += dev-audio-s3c64xx.o
+
+# Device setup
+
+obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP)   += setup-fb-24bpp-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_I2C0)       += setup-i2c0-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_I2C1)       += setup-i2c1-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_IDE)                += setup-ide-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_KEYPAD)     += setup-keypad-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_SPI)                += setup-spi-s3c64xx.o
+obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy-s3c64xx.o
+
+obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)    += dev-backlight-s3c64xx.o
+
+# Machine support
+
+obj-$(CONFIG_MACH_ANW6410)             += mach-anw6410.o
+obj-$(CONFIG_MACH_HMT)                 += mach-hmt.o
+obj-$(CONFIG_MACH_MINI6410)            += mach-mini6410.o
+obj-$(CONFIG_MACH_NCP)                 += mach-ncp.o
+obj-$(CONFIG_MACH_REAL6410)            += mach-real6410.o
+obj-$(CONFIG_MACH_SMARTQ)              += mach-smartq.o
+obj-$(CONFIG_MACH_SMARTQ5)             += mach-smartq5.o
+obj-$(CONFIG_MACH_SMARTQ7)             += mach-smartq7.o
+obj-$(CONFIG_MACH_SMDK6400)            += mach-smdk6400.o
+obj-$(CONFIG_MACH_SMDK6410)            += mach-smdk6410.o
+obj-$(CONFIG_MACH_WLF_CRAGG_6410)      += mach-crag6410.o mach-crag6410-module.o
+endif
+
+obj-$(CONFIG_MACH_S3C64XX_DT)          += mach-s3c64xx-dt.o
diff --git a/arch/arm/mach-s3c/adc-core.h b/arch/arm/mach-s3c/adc-core.h
new file mode 100644 (file)
index 0000000..039f686
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * Samsung ADC Controller core functions
+ */
+
+#ifndef __ASM_PLAT_ADC_CORE_H
+#define __ASM_PLAT_ADC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_adc_setname(char *name)
+{
+#if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX)
+       s3c_device_adc.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_ADC_CORE_H */
diff --git a/arch/arm/mach-s3c/adc.c b/arch/arm/mach-s3c/adc.c
new file mode 100644 (file)
index 0000000..0232520
--- /dev/null
@@ -0,0 +1,510 @@
+// SPDX-License-Identifier: GPL-1.0+
+//
+// Copyright (c) 2008 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
+//
+// Samsung ADC device core
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/sched.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/regulator/consumer.h>
+
+#include "regs-adc.h"
+#include <linux/soc/samsung/s3c-adc.h>
+
+/* This driver is designed to control the usage of the ADC block between
+ * the touchscreen and any other drivers that may need to use it, such as
+ * the hwmon driver.
+ *
+ * Priority will be given to the touchscreen driver, but as this itself is
+ * rate limited it should not starve other requests which are processed in
+ * order that they are received.
+ *
+ * Each user registers to get a client block which uniquely identifies it
+ * and stores information such as the necessary functions to callback when
+ * action is required.
+ */
+
+enum s3c_cpu_type {
+       TYPE_ADCV1, /* S3C24XX */
+       TYPE_ADCV11, /* S3C2443 */
+       TYPE_ADCV12, /* S3C2416, S3C2450 */
+       TYPE_ADCV2, /* S3C64XX */
+       TYPE_ADCV3, /* S5PV210, S5PC110, Exynos4210 */
+};
+
+struct s3c_adc_client {
+       struct platform_device  *pdev;
+       struct list_head         pend;
+       wait_queue_head_t       *wait;
+
+       unsigned int             nr_samples;
+       int                      result;
+       unsigned char            is_ts;
+       unsigned char            channel;
+
+       void    (*select_cb)(struct s3c_adc_client *c, unsigned selected);
+       void    (*convert_cb)(struct s3c_adc_client *c,
+                             unsigned val1, unsigned val2,
+                             unsigned *samples_left);
+};
+
+struct adc_device {
+       struct platform_device  *pdev;
+       struct platform_device  *owner;
+       struct clk              *clk;
+       struct s3c_adc_client   *cur;
+       struct s3c_adc_client   *ts_pend;
+       void __iomem            *regs;
+       spinlock_t               lock;
+
+       unsigned int             prescale;
+
+       int                      irq;
+       struct regulator        *vdd;
+};
+
+static struct adc_device *adc_dev;
+
+static LIST_HEAD(adc_pending); /* protected by adc_device.lock */
+
+#define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
+
+static inline void s3c_adc_convert(struct adc_device *adc)
+{
+       unsigned con = readl(adc->regs + S3C2410_ADCCON);
+
+       con |= S3C2410_ADCCON_ENABLE_START;
+       writel(con, adc->regs + S3C2410_ADCCON);
+}
+
+static inline void s3c_adc_select(struct adc_device *adc,
+                                 struct s3c_adc_client *client)
+{
+       unsigned con = readl(adc->regs + S3C2410_ADCCON);
+       enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
+
+       client->select_cb(client, 1);
+
+       if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
+               con &= ~S3C2410_ADCCON_MUXMASK;
+       con &= ~S3C2410_ADCCON_STDBM;
+       con &= ~S3C2410_ADCCON_STARTMASK;
+
+       if (!client->is_ts) {
+               if (cpu == TYPE_ADCV3)
+                       writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
+               else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12)
+                       writel(client->channel & 0xf,
+                                               adc->regs + S3C2443_ADCMUX);
+               else
+                       con |= S3C2410_ADCCON_SELMUX(client->channel);
+       }
+
+       writel(con, adc->regs + S3C2410_ADCCON);
+}
+
+static void s3c_adc_dbgshow(struct adc_device *adc)
+{
+       adc_dbg(adc, "CON=%08x, TSC=%08x, DLY=%08x\n",
+               readl(adc->regs + S3C2410_ADCCON),
+               readl(adc->regs + S3C2410_ADCTSC),
+               readl(adc->regs + S3C2410_ADCDLY));
+}
+
+static void s3c_adc_try(struct adc_device *adc)
+{
+       struct s3c_adc_client *next = adc->ts_pend;
+
+       if (!next && !list_empty(&adc_pending)) {
+               next = list_first_entry(&adc_pending,
+                                       struct s3c_adc_client, pend);
+               list_del(&next->pend);
+       } else
+               adc->ts_pend = NULL;
+
+       if (next) {
+               adc_dbg(adc, "new client is %p\n", next);
+               adc->cur = next;
+               s3c_adc_select(adc, next);
+               s3c_adc_convert(adc);
+               s3c_adc_dbgshow(adc);
+       }
+}
+
+int s3c_adc_start(struct s3c_adc_client *client,
+                 unsigned int channel, unsigned int nr_samples)
+{
+       struct adc_device *adc = adc_dev;
+       unsigned long flags;
+
+       if (!adc) {
+               printk(KERN_ERR "%s: failed to find adc\n", __func__);
+               return -EINVAL;
+       }
+
+       spin_lock_irqsave(&adc->lock, flags);
+
+       if (client->is_ts && adc->ts_pend) {
+               spin_unlock_irqrestore(&adc->lock, flags);
+               return -EAGAIN;
+       }
+
+       client->channel = channel;
+       client->nr_samples = nr_samples;
+
+       if (client->is_ts)
+               adc->ts_pend = client;
+       else
+               list_add_tail(&client->pend, &adc_pending);
+
+       if (!adc->cur)
+               s3c_adc_try(adc);
+
+       spin_unlock_irqrestore(&adc->lock, flags);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(s3c_adc_start);
+
+static void s3c_convert_done(struct s3c_adc_client *client,
+                            unsigned v, unsigned u, unsigned *left)
+{
+       client->result = v;
+       wake_up(client->wait);
+}
+
+int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch)
+{
+       DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
+       int ret;
+
+       client->convert_cb = s3c_convert_done;
+       client->wait = &wake;
+       client->result = -1;
+
+       ret = s3c_adc_start(client, ch, 1);
+       if (ret < 0)
+               goto err;
+
+       ret = wait_event_timeout(wake, client->result >= 0, HZ / 2);
+       if (client->result < 0) {
+               ret = -ETIMEDOUT;
+               goto err;
+       }
+
+       client->convert_cb = NULL;
+       return client->result;
+
+err:
+       return ret;
+}
+EXPORT_SYMBOL_GPL(s3c_adc_read);
+
+static void s3c_adc_default_select(struct s3c_adc_client *client,
+                                  unsigned select)
+{
+}
+
+struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
+                                       void (*select)(struct s3c_adc_client *client,
+                                                      unsigned int selected),
+                                       void (*conv)(struct s3c_adc_client *client,
+                                                    unsigned d0, unsigned d1,
+                                                    unsigned *samples_left),
+                                       unsigned int is_ts)
+{
+       struct s3c_adc_client *client;
+
+       WARN_ON(!pdev);
+
+       if (!select)
+               select = s3c_adc_default_select;
+
+       if (!pdev)
+               return ERR_PTR(-EINVAL);
+
+       client = kzalloc(sizeof(*client), GFP_KERNEL);
+       if (!client)
+               return ERR_PTR(-ENOMEM);
+
+       client->pdev = pdev;
+       client->is_ts = is_ts;
+       client->select_cb = select;
+       client->convert_cb = conv;
+
+       return client;
+}
+EXPORT_SYMBOL_GPL(s3c_adc_register);
+
+void s3c_adc_release(struct s3c_adc_client *client)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&adc_dev->lock, flags);
+
+       /* We should really check that nothing is in progress. */
+       if (adc_dev->cur == client)
+               adc_dev->cur = NULL;
+       if (adc_dev->ts_pend == client)
+               adc_dev->ts_pend = NULL;
+       else {
+               struct list_head *p, *n;
+               struct s3c_adc_client *tmp;
+
+               list_for_each_safe(p, n, &adc_pending) {
+                       tmp = list_entry(p, struct s3c_adc_client, pend);
+                       if (tmp == client)
+                               list_del(&tmp->pend);
+               }
+       }
+
+       if (adc_dev->cur == NULL)
+               s3c_adc_try(adc_dev);
+
+       spin_unlock_irqrestore(&adc_dev->lock, flags);
+       kfree(client);
+}
+EXPORT_SYMBOL_GPL(s3c_adc_release);
+
+static irqreturn_t s3c_adc_irq(int irq, void *pw)
+{
+       struct adc_device *adc = pw;
+       struct s3c_adc_client *client = adc->cur;
+       enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
+       unsigned data0, data1;
+
+       if (!client) {
+               dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
+               goto exit;
+       }
+
+       data0 = readl(adc->regs + S3C2410_ADCDAT0);
+       data1 = readl(adc->regs + S3C2410_ADCDAT1);
+       adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1);
+
+       client->nr_samples--;
+
+       if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) {
+               data0 &= 0x3ff;
+               data1 &= 0x3ff;
+       } else {
+               /* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */
+               data0 &= 0xfff;
+               data1 &= 0xfff;
+       }
+
+       if (client->convert_cb)
+               (client->convert_cb)(client, data0, data1, &client->nr_samples);
+
+       if (client->nr_samples > 0) {
+               /* fire another conversion for this */
+
+               client->select_cb(client, 1);
+               s3c_adc_convert(adc);
+       } else {
+               spin_lock(&adc->lock);
+               (client->select_cb)(client, 0);
+               adc->cur = NULL;
+
+               s3c_adc_try(adc);
+               spin_unlock(&adc->lock);
+       }
+
+exit:
+       if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
+               /* Clear ADC interrupt */
+               writel(0, adc->regs + S3C64XX_ADCCLRINT);
+       }
+       return IRQ_HANDLED;
+}
+
+static int s3c_adc_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct adc_device *adc;
+       enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
+       int ret;
+       unsigned tmp;
+
+       adc = devm_kzalloc(dev, sizeof(*adc), GFP_KERNEL);
+       if (!adc)
+               return -ENOMEM;
+
+       spin_lock_init(&adc->lock);
+
+       adc->pdev = pdev;
+       adc->prescale = S3C2410_ADCCON_PRSCVL(49);
+
+       adc->vdd = devm_regulator_get(dev, "vdd");
+       if (IS_ERR(adc->vdd)) {
+               dev_err(dev, "operating without regulator \"vdd\" .\n");
+               return PTR_ERR(adc->vdd);
+       }
+
+       adc->irq = platform_get_irq(pdev, 1);
+       if (adc->irq <= 0)
+               return -ENOENT;
+
+       ret = devm_request_irq(dev, adc->irq, s3c_adc_irq, 0, dev_name(dev),
+                               adc);
+       if (ret < 0) {
+               dev_err(dev, "failed to attach adc irq\n");
+               return ret;
+       }
+
+       adc->clk = devm_clk_get(dev, "adc");
+       if (IS_ERR(adc->clk)) {
+               dev_err(dev, "failed to get adc clock\n");
+               return PTR_ERR(adc->clk);
+       }
+
+       adc->regs = devm_platform_ioremap_resource(pdev, 0);
+       if (IS_ERR(adc->regs))
+               return PTR_ERR(adc->regs);
+
+       ret = regulator_enable(adc->vdd);
+       if (ret)
+               return ret;
+
+       clk_prepare_enable(adc->clk);
+
+       tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
+
+       /* Enable 12-bit ADC resolution */
+       if (cpu == TYPE_ADCV12)
+               tmp |= S3C2416_ADCCON_RESSEL;
+       if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
+               tmp |= S3C64XX_ADCCON_RESSEL;
+
+       writel(tmp, adc->regs + S3C2410_ADCCON);
+
+       dev_info(dev, "attached adc driver\n");
+
+       platform_set_drvdata(pdev, adc);
+       adc_dev = adc;
+
+       return 0;
+}
+
+static int s3c_adc_remove(struct platform_device *pdev)
+{
+       struct adc_device *adc = platform_get_drvdata(pdev);
+
+       clk_disable_unprepare(adc->clk);
+       regulator_disable(adc->vdd);
+
+       return 0;
+}
+
+#ifdef CONFIG_PM
+static int s3c_adc_suspend(struct device *dev)
+{
+       struct adc_device *adc = dev_get_drvdata(dev);
+       unsigned long flags;
+       u32 con;
+
+       spin_lock_irqsave(&adc->lock, flags);
+
+       con = readl(adc->regs + S3C2410_ADCCON);
+       con |= S3C2410_ADCCON_STDBM;
+       writel(con, adc->regs + S3C2410_ADCCON);
+
+       disable_irq(adc->irq);
+       spin_unlock_irqrestore(&adc->lock, flags);
+       clk_disable(adc->clk);
+       regulator_disable(adc->vdd);
+
+       return 0;
+}
+
+static int s3c_adc_resume(struct device *dev)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       struct adc_device *adc = platform_get_drvdata(pdev);
+       enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
+       int ret;
+       unsigned long tmp;
+
+       ret = regulator_enable(adc->vdd);
+       if (ret)
+               return ret;
+       clk_enable(adc->clk);
+       enable_irq(adc->irq);
+
+       tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
+
+       /* Enable 12-bit ADC resolution */
+       if (cpu == TYPE_ADCV12)
+               tmp |= S3C2416_ADCCON_RESSEL;
+       if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
+               tmp |= S3C64XX_ADCCON_RESSEL;
+
+       writel(tmp, adc->regs + S3C2410_ADCCON);
+
+       return 0;
+}
+
+#else
+#define s3c_adc_suspend NULL
+#define s3c_adc_resume NULL
+#endif
+
+static const struct platform_device_id s3c_adc_driver_ids[] = {
+       {
+               .name           = "s3c24xx-adc",
+               .driver_data    = TYPE_ADCV1,
+       }, {
+               .name           = "s3c2443-adc",
+               .driver_data    = TYPE_ADCV11,
+       }, {
+               .name           = "s3c2416-adc",
+               .driver_data    = TYPE_ADCV12,
+       }, {
+               .name           = "s3c64xx-adc",
+               .driver_data    = TYPE_ADCV2,
+       }, {
+               .name           = "samsung-adc-v3",
+               .driver_data    = TYPE_ADCV3,
+       },
+       { }
+};
+MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids);
+
+static const struct dev_pm_ops adc_pm_ops = {
+       .suspend        = s3c_adc_suspend,
+       .resume         = s3c_adc_resume,
+};
+
+static struct platform_driver s3c_adc_driver = {
+       .id_table       = s3c_adc_driver_ids,
+       .driver         = {
+               .name   = "s3c-adc",
+               .pm     = &adc_pm_ops,
+       },
+       .probe          = s3c_adc_probe,
+       .remove         = s3c_adc_remove,
+};
+
+static int __init adc_init(void)
+{
+       int ret;
+
+       ret = platform_driver_register(&s3c_adc_driver);
+       if (ret)
+               printk(KERN_ERR "%s: failed to add adc driver\n", __func__);
+
+       return ret;
+}
+
+module_init(adc_init);
diff --git a/arch/arm/mach-s3c/anubis.h b/arch/arm/mach-s3c/anubis.h
new file mode 100644 (file)
index 0000000..1384729
--- /dev/null
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2005 Simtec Electronics
+ *     http://www.simtec.co.uk/products/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * ANUBIS - CPLD control constants
+ * ANUBIS - IRQ Number definitions
+ * ANUBIS - Memory map definitions
+ */
+
+#ifndef __MACH_S3C24XX_ANUBIS_H
+#define __MACH_S3C24XX_ANUBIS_H __FILE__
+
+/* CTRL2 - NAND WP control, IDE Reset assert/check */
+
+#define ANUBIS_CTRL1_NANDSEL           (0x3)
+
+/* IDREG - revision */
+
+#define ANUBIS_IDREG_REVMASK           (0x7)
+
+/* irq */
+
+#define ANUBIS_IRQ_IDE0                        IRQ_EINT2
+#define ANUBIS_IRQ_IDE1                        IRQ_EINT3
+#define ANUBIS_IRQ_ASIX                        IRQ_EINT1
+
+/* map */
+
+/* start peripherals off after the S3C2410 */
+
+#define ANUBIS_IOADDR(x)               (S3C2410_ADDR((x) + 0x01800000))
+
+#define ANUBIS_PA_CPLD                 (S3C2410_CS1 | (1<<26))
+
+/* we put the CPLD registers next, to get them out of the way */
+
+#define ANUBIS_VA_CTRL1                        ANUBIS_IOADDR(0x00000000)
+#define ANUBIS_PA_CTRL1                        ANUBIS_PA_CPLD
+
+#define ANUBIS_VA_IDREG                        ANUBIS_IOADDR(0x00300000)
+#define ANUBIS_PA_IDREG                        (ANUBIS_PA_CPLD + (3 << 23))
+
+#define ANUBIS_IDEPRI                  ANUBIS_IOADDR(0x01000000)
+#define ANUBIS_IDEPRIAUX               ANUBIS_IOADDR(0x01100000)
+#define ANUBIS_IDESEC                  ANUBIS_IOADDR(0x01200000)
+#define ANUBIS_IDESECAUX               ANUBIS_IOADDR(0x01300000)
+
+#endif /* __MACH_S3C24XX_ANUBIS_H */
diff --git a/arch/arm/mach-s3c/ata-core-s3c64xx.h b/arch/arm/mach-s3c/ata-core-s3c64xx.h
new file mode 100644 (file)
index 0000000..4863ad9
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * Samsung CF-ATA Controller core functions
+ */
+
+#ifndef __ASM_PLAT_ATA_CORE_S3C64XX_H
+#define __ASM_PLAT_ATA_CORE_S3C64XX_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+*/
+
+/* re-define device name depending on support. */
+static inline void s3c_cfcon_setname(char *name)
+{
+#ifdef CONFIG_SAMSUNG_DEV_IDE
+       s3c_device_cfcon.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_ATA_CORE_S3C64XX_H */
diff --git a/arch/arm/mach-s3c/backlight-s3c64xx.h b/arch/arm/mach-s3c/backlight-s3c64xx.h
new file mode 100644 (file)
index 0000000..2a2b358
--- /dev/null
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com
+ */
+
+#ifndef __ASM_PLAT_BACKLIGHT_S3C64XX_H
+#define __ASM_PLAT_BACKLIGHT_S3C64XX_H __FILE__
+
+/* samsung_bl_gpio_info - GPIO info for PWM Backlight control
+ * @no:                GPIO number for PWM timer out
+ * @func:      Special function of GPIO line for PWM timer
+ */
+struct samsung_bl_gpio_info {
+       int no;
+       int func;
+};
+
+extern void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
+       struct platform_pwm_backlight_data *bl_data);
+
+#endif /* __ASM_PLAT_BACKLIGHT_S3C64XX_H */
diff --git a/arch/arm/mach-s3c/bast-ide.c b/arch/arm/mach-s3c/bast-ide.c
new file mode 100644 (file)
index 0000000..da64db1
--- /dev/null
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2007 Simtec Electronics
+//     http://www.simtec.co.uk/products/EB2410ITX/
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+
+#include <asm/mach-types.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+#include <mach/irqs.h>
+
+#include "bast.h"
+
+/* IDE ports */
+
+static struct pata_platform_info bast_ide_platdata = {
+       .ioport_shift   = 5,
+};
+
+static struct resource bast_ide0_resource[] = {
+       [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20),
+       [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20),
+       [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0),
+};
+
+static struct platform_device bast_device_ide0 = {
+       .name           = "pata_platform",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(bast_ide0_resource),
+       .resource       = bast_ide0_resource,
+       .dev            = {
+               .platform_data = &bast_ide_platdata,
+               .coherent_dma_mask = ~0,
+       }
+
+};
+
+static struct resource bast_ide1_resource[] = {
+       [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20),
+       [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20),
+       [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1),
+};
+
+static struct platform_device bast_device_ide1 = {
+       .name           = "pata_platform",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(bast_ide1_resource),
+       .resource       = bast_ide1_resource,
+       .dev            = {
+               .platform_data = &bast_ide_platdata,
+               .coherent_dma_mask = ~0,
+       }
+};
+
+static struct platform_device *bast_ide_devices[] __initdata = {
+       &bast_device_ide0,
+       &bast_device_ide1,
+};
+
+static __init int bast_ide_init(void)
+{
+       if (machine_is_bast() || machine_is_vr1000())
+               return platform_add_devices(bast_ide_devices,
+                                           ARRAY_SIZE(bast_ide_devices));
+
+       return 0;
+}
+
+fs_initcall(bast_ide_init);
diff --git a/arch/arm/mach-s3c/bast-irq.c b/arch/arm/mach-s3c/bast-irq.c
new file mode 100644 (file)
index 0000000..d299f12
--- /dev/null
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright 2003-2005 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// http://www.simtec.co.uk/products/EB2410ITX/
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/ioport.h>
+#include <linux/device.h>
+#include <linux/io.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+#include <asm/mach/irq.h>
+
+#include "regs-irq.h"
+#include <mach/irqs.h>
+
+#include "bast.h"
+
+#define irqdbf(x...)
+#define irqdbf2(x...)
+
+/* handle PC104 ISA interrupts from the system CPLD */
+
+/* table of ISA irq nos to the relevant mask... zero means
+ * the irq is not implemented
+*/
+static const unsigned char bast_pc104_irqmasks[] = {
+       0,   /* 0 */
+       0,   /* 1 */
+       0,   /* 2 */
+       1,   /* 3 */
+       0,   /* 4 */
+       2,   /* 5 */
+       0,   /* 6 */
+       4,   /* 7 */
+       0,   /* 8 */
+       0,   /* 9 */
+       8,   /* 10 */
+       0,   /* 11 */
+       0,   /* 12 */
+       0,   /* 13 */
+       0,   /* 14 */
+       0,   /* 15 */
+};
+
+static const unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 };
+
+static void
+bast_pc104_mask(struct irq_data *data)
+{
+       unsigned long temp;
+
+       temp = __raw_readb(BAST_VA_PC104_IRQMASK);
+       temp &= ~bast_pc104_irqmasks[data->irq];
+       __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
+}
+
+static void
+bast_pc104_maskack(struct irq_data *data)
+{
+       struct irq_desc *desc = irq_to_desc(BAST_IRQ_ISA);
+
+       bast_pc104_mask(data);
+       desc->irq_data.chip->irq_ack(&desc->irq_data);
+}
+
+static void
+bast_pc104_unmask(struct irq_data *data)
+{
+       unsigned long temp;
+
+       temp = __raw_readb(BAST_VA_PC104_IRQMASK);
+       temp |= bast_pc104_irqmasks[data->irq];
+       __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
+}
+
+static struct irq_chip  bast_pc104_chip = {
+       .irq_mask       = bast_pc104_mask,
+       .irq_unmask     = bast_pc104_unmask,
+       .irq_ack        = bast_pc104_maskack
+};
+
+static void bast_irq_pc104_demux(struct irq_desc *desc)
+{
+       unsigned int stat;
+       unsigned int irqno;
+       int i;
+
+       stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf;
+
+       if (unlikely(stat == 0)) {
+               /* ack if we get an irq with nothing (ie, startup) */
+               desc->irq_data.chip->irq_ack(&desc->irq_data);
+       } else {
+               /* handle the IRQ */
+
+               for (i = 0; stat != 0; i++, stat >>= 1) {
+                       if (stat & 1) {
+                               irqno = bast_pc104_irqs[i];
+                               generic_handle_irq(irqno);
+                       }
+               }
+       }
+}
+
+static __init int bast_irq_init(void)
+{
+       unsigned int i;
+
+       if (machine_is_bast()) {
+               printk(KERN_INFO "BAST PC104 IRQ routing, Copyright 2005 Simtec Electronics\n");
+
+               /* zap all the IRQs */
+
+               __raw_writeb(0x0, BAST_VA_PC104_IRQMASK);
+
+               irq_set_chained_handler(BAST_IRQ_ISA, bast_irq_pc104_demux);
+
+               /* register our IRQs */
+
+               for (i = 0; i < 4; i++) {
+                       unsigned int irqno = bast_pc104_irqs[i];
+
+                       irq_set_chip_and_handler(irqno, &bast_pc104_chip,
+                                                handle_level_irq);
+                       irq_clear_status_flags(irqno, IRQ_NOREQUEST);
+               }
+       }
+
+       return 0;
+}
+
+arch_initcall(bast_irq_init);
diff --git a/arch/arm/mach-s3c/bast.h b/arch/arm/mach-s3c/bast.h
new file mode 100644 (file)
index 0000000..a7726f9
--- /dev/null
@@ -0,0 +1,194 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003-2004 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * BAST - CPLD control constants
+ * BAST - IRQ Number definitions
+ * BAST - Memory map definitions
+ */
+
+#ifndef __MACH_S3C24XX_BAST_H
+#define __MACH_S3C24XX_BAST_H __FILE__
+
+/* CTRL1 - Audio LR routing */
+
+#define BAST_CPLD_CTRL1_LRCOFF         (0x00)
+#define BAST_CPLD_CTRL1_LRCADC         (0x01)
+#define BAST_CPLD_CTRL1_LRCDAC         (0x02)
+#define BAST_CPLD_CTRL1_LRCARM         (0x03)
+#define BAST_CPLD_CTRL1_LRMASK         (0x03)
+
+/* CTRL2 - NAND WP control, IDE Reset assert/check */
+
+#define BAST_CPLD_CTRL2_WNAND          (0x04)
+#define BAST_CPLD_CTLR2_IDERST         (0x08)
+
+/* CTRL3 - rom write control, CPLD identity */
+
+#define BAST_CPLD_CTRL3_IDMASK         (0x0e)
+#define BAST_CPLD_CTRL3_ROMWEN         (0x01)
+
+/* CTRL4 - 8bit LCD interface control/status */
+
+#define BAST_CPLD_CTRL4_LLAT           (0x01)
+#define BAST_CPLD_CTRL4_LCDRW          (0x02)
+#define BAST_CPLD_CTRL4_LCDCMD         (0x04)
+#define BAST_CPLD_CTRL4_LCDE2          (0x01)
+
+/* CTRL5 - DMA routing */
+
+#define BAST_CPLD_DMA0_PRIIDE          (0)
+#define BAST_CPLD_DMA0_SECIDE          (1)
+#define BAST_CPLD_DMA0_ISA15           (2)
+#define BAST_CPLD_DMA0_ISA36           (3)
+
+#define BAST_CPLD_DMA1_PRIIDE          (0 << 2)
+#define BAST_CPLD_DMA1_SECIDE          (1 << 2)
+#define BAST_CPLD_DMA1_ISA15           (2 << 2)
+#define BAST_CPLD_DMA1_ISA36           (3 << 2)
+
+/* irq numbers to onboard peripherals */
+
+#define BAST_IRQ_USBOC                 IRQ_EINT18
+#define BAST_IRQ_IDE0                  IRQ_EINT16
+#define BAST_IRQ_IDE1                  IRQ_EINT17
+#define BAST_IRQ_PCSERIAL1             IRQ_EINT15
+#define BAST_IRQ_PCSERIAL2             IRQ_EINT14
+#define BAST_IRQ_PCPARALLEL            IRQ_EINT13
+#define BAST_IRQ_ASIX                  IRQ_EINT11
+#define BAST_IRQ_DM9000                        IRQ_EINT10
+#define BAST_IRQ_ISA                   IRQ_EINT9
+#define BAST_IRQ_SMALERT               IRQ_EINT8
+
+/* map */
+
+/*
+ * ok, we've used up to 0x13000000, now we need to find space for the
+ * peripherals that live in the nGCS[x] areas, which are quite numerous
+ * in their space. We also have the board's CPLD to find register space
+ * for.
+ */
+
+#define BAST_IOADDR(x)                 (S3C2410_ADDR((x) + 0x01300000))
+
+/* we put the CPLD registers next, to get them out of the way */
+
+#define BAST_VA_CTRL1                  BAST_IOADDR(0x00000000)
+#define BAST_PA_CTRL1                  (S3C2410_CS5 | 0x7800000)
+
+#define BAST_VA_CTRL2                  BAST_IOADDR(0x00100000)
+#define BAST_PA_CTRL2                  (S3C2410_CS1 | 0x6000000)
+
+#define BAST_VA_CTRL3                  BAST_IOADDR(0x00200000)
+#define BAST_PA_CTRL3                  (S3C2410_CS1 | 0x6800000)
+
+#define BAST_VA_CTRL4                  BAST_IOADDR(0x00300000)
+#define BAST_PA_CTRL4                  (S3C2410_CS1 | 0x7000000)
+
+/* next, we have the PC104 ISA interrupt registers */
+
+#define BAST_PA_PC104_IRQREQ           (S3C2410_CS5 | 0x6000000)
+#define BAST_VA_PC104_IRQREQ           BAST_IOADDR(0x00400000)
+
+#define BAST_PA_PC104_IRQRAW           (S3C2410_CS5 | 0x6800000)
+#define BAST_VA_PC104_IRQRAW           BAST_IOADDR(0x00500000)
+
+#define BAST_PA_PC104_IRQMASK          (S3C2410_CS5 | 0x7000000)
+#define BAST_VA_PC104_IRQMASK          BAST_IOADDR(0x00600000)
+
+#define BAST_PA_LCD_RCMD1              (0x8800000)
+#define BAST_VA_LCD_RCMD1              BAST_IOADDR(0x00700000)
+
+#define BAST_PA_LCD_WCMD1              (0x8000000)
+#define BAST_VA_LCD_WCMD1              BAST_IOADDR(0x00800000)
+
+#define BAST_PA_LCD_RDATA1             (0x9800000)
+#define BAST_VA_LCD_RDATA1             BAST_IOADDR(0x00900000)
+
+#define BAST_PA_LCD_WDATA1             (0x9000000)
+#define BAST_VA_LCD_WDATA1             BAST_IOADDR(0x00A00000)
+
+#define BAST_PA_LCD_RCMD2              (0xA800000)
+#define BAST_VA_LCD_RCMD2              BAST_IOADDR(0x00B00000)
+
+#define BAST_PA_LCD_WCMD2              (0xA000000)
+#define BAST_VA_LCD_WCMD2              BAST_IOADDR(0x00C00000)
+
+#define BAST_PA_LCD_RDATA2             (0xB800000)
+#define BAST_VA_LCD_RDATA2             BAST_IOADDR(0x00D00000)
+
+#define BAST_PA_LCD_WDATA2             (0xB000000)
+#define BAST_VA_LCD_WDATA2             BAST_IOADDR(0x00E00000)
+
+
+/*
+ * 0xE0000000 contains the IO space that is split by speed and
+ * whether the access is for 8 or 16bit IO... this ensures that
+ * the correct access is made
+ *
+ * 0x10000000 of space, partitioned as so:
+ *
+ * 0x00000000 to 0x04000000  8bit,  slow
+ * 0x04000000 to 0x08000000  16bit, slow
+ * 0x08000000 to 0x0C000000  16bit, net
+ * 0x0C000000 to 0x10000000  16bit, fast
+ *
+ * each of these spaces has the following in:
+ *
+ * 0x00000000 to 0x01000000 16MB ISA IO space
+ * 0x01000000 to 0x02000000 16MB ISA memory space
+ * 0x02000000 to 0x02100000 1MB  IDE primary channel
+ * 0x02100000 to 0x02200000 1MB  IDE primary channel aux
+ * 0x02200000 to 0x02400000 1MB  IDE secondary channel
+ * 0x02300000 to 0x02400000 1MB  IDE secondary channel aux
+ * 0x02400000 to 0x02500000 1MB  ASIX ethernet controller
+ * 0x02500000 to 0x02600000 1MB  Davicom DM9000 ethernet controller
+ * 0x02600000 to 0x02700000 1MB  PC SuperIO controller
+ *
+ * the phyiscal layout of the zones are:
+ *  nGCS2 - 8bit, slow
+ *  nGCS3 - 16bit, slow
+ *  nGCS4 - 16bit, net
+ *  nGCS5 - 16bit, fast
+ */
+
+#define BAST_VA_MULTISPACE             (0xE0000000)
+
+#define BAST_VA_ISAIO                  (BAST_VA_MULTISPACE + 0x00000000)
+#define BAST_VA_ISAMEM                 (BAST_VA_MULTISPACE + 0x01000000)
+#define BAST_VA_IDEPRI                 (BAST_VA_MULTISPACE + 0x02000000)
+#define BAST_VA_IDEPRIAUX              (BAST_VA_MULTISPACE + 0x02100000)
+#define BAST_VA_IDESEC                 (BAST_VA_MULTISPACE + 0x02200000)
+#define BAST_VA_IDESECAUX              (BAST_VA_MULTISPACE + 0x02300000)
+#define BAST_VA_ASIXNET                        (BAST_VA_MULTISPACE + 0x02400000)
+#define BAST_VA_DM9000                 (BAST_VA_MULTISPACE + 0x02500000)
+#define BAST_VA_SUPERIO                        (BAST_VA_MULTISPACE + 0x02600000)
+
+#define BAST_VAM_CS2                   (0x00000000)
+#define BAST_VAM_CS3                   (0x04000000)
+#define BAST_VAM_CS4                   (0x08000000)
+#define BAST_VAM_CS5                   (0x0C000000)
+
+/* physical offset addresses for the peripherals */
+
+#define BAST_PA_ISAIO                  (0x00000000)
+#define BAST_PA_ASIXNET                        (0x01000000)
+#define BAST_PA_SUPERIO                        (0x01800000)
+#define BAST_PA_IDEPRI                 (0x02000000)
+#define BAST_PA_IDEPRIAUX              (0x02800000)
+#define BAST_PA_IDESEC                 (0x03000000)
+#define BAST_PA_IDESECAUX              (0x03800000)
+#define BAST_PA_ISAMEM                 (0x04000000)
+#define BAST_PA_DM9000                 (0x05000000)
+
+/* some configurations for the peripherals */
+
+#define BAST_PCSIO                     (BAST_VA_SUPERIO + BAST_VAM_CS2)
+
+#define BAST_ASIXNET_CS                        BAST_VAM_CS5
+#define BAST_DM9000_CS                 BAST_VAM_CS4
+
+#define BAST_IDE_CS    S3C2410_CS5
+
+#endif /* __MACH_S3C24XX_BAST_H */
diff --git a/arch/arm/mach-s3c/common-smdk-s3c24xx.c b/arch/arm/mach-s3c/common-smdk-s3c24xx.c
new file mode 100644 (file)
index 0000000..353bc22
--- /dev/null
@@ -0,0 +1,228 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Common code for SMDK2410 and SMDK2440 boards
+//
+// http://www.fluff.org/ben/smdk2440/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/mach-types.h>
+#include <asm/irq.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <linux/platform_data/leds-s3c24xx.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "pm.h"
+
+#include "common-smdk-s3c24xx.h"
+
+/* LED devices */
+
+static struct gpiod_lookup_table smdk_led4_gpio_table = {
+       .dev_id = "s3c24xx_led.0",
+       .table = {
+               GPIO_LOOKUP("GPF", 4, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table smdk_led5_gpio_table = {
+       .dev_id = "s3c24xx_led.1",
+       .table = {
+               GPIO_LOOKUP("GPF", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table smdk_led6_gpio_table = {
+       .dev_id = "s3c24xx_led.2",
+       .table = {
+               GPIO_LOOKUP("GPF", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table smdk_led7_gpio_table = {
+       .dev_id = "s3c24xx_led.3",
+       .table = {
+               GPIO_LOOKUP("GPF", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata smdk_pdata_led4 = {
+       .name           = "led4",
+       .def_trigger    = "timer",
+};
+
+static struct s3c24xx_led_platdata smdk_pdata_led5 = {
+       .name           = "led5",
+       .def_trigger    = "nand-disk",
+};
+
+static struct s3c24xx_led_platdata smdk_pdata_led6 = {
+       .name           = "led6",
+};
+
+static struct s3c24xx_led_platdata smdk_pdata_led7 = {
+       .name           = "led7",
+};
+
+static struct platform_device smdk_led4 = {
+       .name           = "s3c24xx_led",
+       .id             = 0,
+       .dev            = {
+               .platform_data = &smdk_pdata_led4,
+       },
+};
+
+static struct platform_device smdk_led5 = {
+       .name           = "s3c24xx_led",
+       .id             = 1,
+       .dev            = {
+               .platform_data = &smdk_pdata_led5,
+       },
+};
+
+static struct platform_device smdk_led6 = {
+       .name           = "s3c24xx_led",
+       .id             = 2,
+       .dev            = {
+               .platform_data = &smdk_pdata_led6,
+       },
+};
+
+static struct platform_device smdk_led7 = {
+       .name           = "s3c24xx_led",
+       .id             = 3,
+       .dev            = {
+               .platform_data = &smdk_pdata_led7,
+       },
+};
+
+/* NAND parititon from 2.4.18-swl5 */
+
+static struct mtd_partition smdk_default_nand_part[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_16K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "S3C2410 flash partition 1",
+               .offset = 0,
+               .size   = SZ_2M,
+       },
+       [2] = {
+               .name   = "S3C2410 flash partition 2",
+               .offset = SZ_4M,
+               .size   = SZ_4M,
+       },
+       [3] = {
+               .name   = "S3C2410 flash partition 3",
+               .offset = SZ_8M,
+               .size   = SZ_2M,
+       },
+       [4] = {
+               .name   = "S3C2410 flash partition 4",
+               .offset = SZ_1M * 10,
+               .size   = SZ_4M,
+       },
+       [5] = {
+               .name   = "S3C2410 flash partition 5",
+               .offset = SZ_1M * 14,
+               .size   = SZ_1M * 10,
+       },
+       [6] = {
+               .name   = "S3C2410 flash partition 6",
+               .offset = SZ_1M * 24,
+               .size   = SZ_1M * 24,
+       },
+       [7] = {
+               .name   = "S3C2410 flash partition 7",
+               .offset = SZ_1M * 48,
+               .size   = MTDPART_SIZ_FULL,
+       }
+};
+
+static struct s3c2410_nand_set smdk_nand_sets[] = {
+       [0] = {
+               .name           = "NAND",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(smdk_default_nand_part),
+               .partitions     = smdk_default_nand_part,
+       },
+};
+
+/* choose a set of timings which should suit most 512Mbit
+ * chips and beyond.
+*/
+
+static struct s3c2410_platform_nand smdk_nand_info = {
+       .tacls          = 20,
+       .twrph0         = 60,
+       .twrph1         = 20,
+       .nr_sets        = ARRAY_SIZE(smdk_nand_sets),
+       .sets           = smdk_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+/* devices we initialise */
+
+static struct platform_device __initdata *smdk_devs[] = {
+       &s3c_device_nand,
+       &smdk_led4,
+       &smdk_led5,
+       &smdk_led6,
+       &smdk_led7,
+};
+
+void __init smdk_machine_init(void)
+{
+       if (machine_is_smdk2443())
+               smdk_nand_info.twrph0 = 50;
+
+       s3c_nand_set_platdata(&smdk_nand_info);
+
+       /* Disable pull-up on the LED lines */
+       s3c_gpio_setpull(S3C2410_GPF(4), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPF(5), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPF(6), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPF(7), S3C_GPIO_PULL_NONE);
+
+       /* Add lookups for the lines */
+       gpiod_add_lookup_table(&smdk_led4_gpio_table);
+       gpiod_add_lookup_table(&smdk_led5_gpio_table);
+       gpiod_add_lookup_table(&smdk_led6_gpio_table);
+       gpiod_add_lookup_table(&smdk_led7_gpio_table);
+
+       platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
+
+       s3c_pm_init();
+}
diff --git a/arch/arm/mach-s3c/common-smdk-s3c24xx.h b/arch/arm/mach-s3c/common-smdk-s3c24xx.h
new file mode 100644 (file)
index 0000000..c0352b0
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2006 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * Common code for SMDK2410 and SMDK2440 boards
+ *
+ * http://www.fluff.org/ben/smdk2440/
+ */
+
+extern void smdk_machine_init(void);
diff --git a/arch/arm/mach-s3c/cpu.c b/arch/arm/mach-s3c/cpu.c
new file mode 100644 (file)
index 0000000..6e97725
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com
+//
+// Samsung CPU Support
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <mach/map-base.h>
+#include "cpu.h"
+
+unsigned long samsung_cpu_id;
+
+void __init s3c64xx_init_cpu(void)
+{
+       samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118);
+       if (!samsung_cpu_id) {
+               /*
+                * S3C6400 has the ID register in a different place,
+                * and needs a write before it can be read.
+                */
+               writel_relaxed(0x0, S3C_VA_SYS + 0xA1C);
+               samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C);
+       }
+
+       pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
+}
diff --git a/arch/arm/mach-s3c/cpu.h b/arch/arm/mach-s3c/cpu.h
new file mode 100644 (file)
index 0000000..20ff98d
--- /dev/null
@@ -0,0 +1,128 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * Copyright (c) 2004-2005 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * Header file for Samsung CPU support
+ */
+
+/* todo - fix when rmk changes iodescs to use `void __iomem *` */
+
+#ifndef __SAMSUNG_PLAT_CPU_H
+#define __SAMSUNG_PLAT_CPU_H
+
+extern unsigned long samsung_cpu_id;
+
+#define S3C2410_CPU_ID         0x32410000
+#define S3C2410_CPU_MASK       0xFFFFFFFF
+
+#define S3C24XX_CPU_ID         0x32400000
+#define S3C24XX_CPU_MASK       0xFFF00000
+
+#define S3C2412_CPU_ID         0x32412000
+#define S3C2412_CPU_MASK       0xFFFFF000
+
+#define S3C6400_CPU_ID         0x36400000
+#define S3C6410_CPU_ID         0x36410000
+#define S3C64XX_CPU_MASK       0xFFFFF000
+
+#define S5PV210_CPU_ID         0x43110000
+#define S5PV210_CPU_MASK       0xFFFFF000
+
+#define IS_SAMSUNG_CPU(name, id, mask)         \
+static inline int is_samsung_##name(void)      \
+{                                              \
+       return ((samsung_cpu_id & mask) == (id & mask));        \
+}
+
+IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
+IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
+IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
+IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
+IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
+    defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
+    defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
+    defined(CONFIG_CPU_S3C2443)
+# define soc_is_s3c24xx()      is_samsung_s3c24xx()
+# define soc_is_s3c2410()      is_samsung_s3c2410()
+#else
+# define soc_is_s3c24xx()      0
+# define soc_is_s3c2410()      0
+#endif
+
+#if defined(CONFIG_CPU_S3C2412)
+# define soc_is_s3c2412()      is_samsung_s3c2412()
+#else
+# define soc_is_s3c2412()      0
+#endif
+
+#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
+# define soc_is_s3c6400()      is_samsung_s3c6400()
+# define soc_is_s3c6410()      is_samsung_s3c6410()
+# define soc_is_s3c64xx()      (is_samsung_s3c6400() || is_samsung_s3c6410())
+#else
+# define soc_is_s3c6400()      0
+# define soc_is_s3c6410()      0
+# define soc_is_s3c64xx()      0
+#endif
+
+#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
+
+#ifndef KHZ
+#define KHZ (1000)
+#endif
+
+#ifndef MHZ
+#define MHZ (1000*1000)
+#endif
+
+#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
+
+/* forward declaration */
+struct s3c24xx_uart_resources;
+struct platform_device;
+struct s3c2410_uartcfg;
+struct map_desc;
+
+/* per-cpu initialisation function table. */
+
+struct cpu_table {
+       unsigned long   idcode;
+       unsigned long   idmask;
+       void            (*map_io)(void);
+       void            (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
+       void            (*init_clocks)(int xtal);
+       int             (*init)(void);
+       const char      *name;
+};
+
+extern void s3c_init_cpu(unsigned long idcode,
+                        struct cpu_table *cpus, unsigned int cputab_size);
+
+/* core initialisation functions */
+
+extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
+
+extern void s3c64xx_init_cpu(void);
+
+extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+
+extern void s3c24xx_init_clocks(int xtal);
+
+extern void s3c24xx_init_uartdevs(char *name,
+                                 struct s3c24xx_uart_resources *res,
+                                 struct s3c2410_uartcfg *cfg, int no);
+
+extern struct syscore_ops s3c2410_pm_syscore_ops;
+extern struct syscore_ops s3c2412_pm_syscore_ops;
+extern struct syscore_ops s3c2416_pm_syscore_ops;
+extern struct syscore_ops s3c244x_pm_syscore_ops;
+
+extern struct bus_type s3c6410_subsys;
+
+#endif
diff --git a/arch/arm/mach-s3c/cpufreq-utils-s3c24xx.c b/arch/arm/mach-s3c/cpufreq-utils-s3c24xx.c
new file mode 100644 (file)
index 0000000..c1784d8
--- /dev/null
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2009 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C24XX CPU Frequency scaling - utils for S3C2410/S3C2440/S3C2442
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/cpufreq.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+
+#include "map.h"
+#include "regs-clock.h"
+
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+
+#include "regs-mem-s3c24xx.h"
+
+/**
+ * s3c2410_cpufreq_setrefresh - set SDRAM refresh value
+ * @cfg: The frequency configuration
+ *
+ * Set the SDRAM refresh value appropriately for the configured
+ * frequency.
+ */
+void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
+{
+       struct s3c_cpufreq_board *board = cfg->board;
+       unsigned long refresh;
+       unsigned long refval;
+
+       /* Reduce both the refresh time (in ns) and the frequency (in MHz)
+        * down to ensure that we do not overflow 32 bit numbers.
+        *
+        * This should work for HCLK up to 133MHz and refresh period up
+        * to 30usec.
+        */
+
+       refresh = (cfg->freq.hclk / 100) * (board->refresh / 10);
+       refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale  */
+       refresh = (1 << 11) + 1 - refresh;
+
+       s3c_freq_dbg("%s: refresh value %lu\n", __func__, refresh);
+
+       refval = __raw_readl(S3C2410_REFRESH);
+       refval &= ~((1 << 12) - 1);
+       refval |= refresh;
+       __raw_writel(refval, S3C2410_REFRESH);
+}
+
+/**
+ * s3c2410_set_fvco - set the PLL value
+ * @cfg: The frequency configuration
+ */
+void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
+{
+       if (!IS_ERR(cfg->mpll))
+               clk_set_rate(cfg->mpll, cfg->pll.frequency);
+}
+
+#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
+u32 s3c2440_read_camdivn(void)
+{
+       return __raw_readl(S3C2440_CAMDIVN);
+}
+
+void s3c2440_write_camdivn(u32 camdiv)
+{
+       __raw_writel(camdiv, S3C2440_CAMDIVN);
+}
+#endif
+
+u32 s3c24xx_read_clkdivn(void)
+{
+       return __raw_readl(S3C2410_CLKDIVN);
+}
+
+void s3c24xx_write_clkdivn(u32 clkdiv)
+{
+       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+}
+
+u32 s3c24xx_read_mpllcon(void)
+{
+       return __raw_readl(S3C2410_MPLLCON);
+}
+
+void s3c24xx_write_locktime(u32 locktime)
+{
+       return __raw_writel(locktime, S3C2410_LOCKTIME);
+}
diff --git a/arch/arm/mach-s3c/cpuidle-s3c64xx.c b/arch/arm/mach-s3c/cpuidle-s3c64xx.c
new file mode 100644 (file)
index 0000000..b1c5f43
--- /dev/null
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2011 Wolfson Microelectronics, plc
+// Copyright (c) 2011 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <linux/time.h>
+
+#include <asm/cpuidle.h>
+
+#include "cpu.h"
+#include "map.h"
+
+#include "regs-sys-s3c64xx.h"
+#include "regs-syscon-power-s3c64xx.h"
+
+static int s3c64xx_enter_idle(struct cpuidle_device *dev,
+                             struct cpuidle_driver *drv,
+                             int index)
+{
+       unsigned long tmp;
+
+       /* Setup PWRCFG to enter idle mode */
+       tmp = __raw_readl(S3C64XX_PWR_CFG);
+       tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
+       tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
+       __raw_writel(tmp, S3C64XX_PWR_CFG);
+
+       cpu_do_idle();
+
+       return index;
+}
+
+static struct cpuidle_driver s3c64xx_cpuidle_driver = {
+       .name   = "s3c64xx_cpuidle",
+       .owner  = THIS_MODULE,
+       .states = {
+               {
+                       .enter            = s3c64xx_enter_idle,
+                       .exit_latency     = 1,
+                       .target_residency = 1,
+                       .name             = "IDLE",
+                       .desc             = "System active, ARM gated",
+               },
+       },
+       .state_count = 1,
+};
+
+static int __init s3c64xx_init_cpuidle(void)
+{
+       if (soc_is_s3c64xx())
+               return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+       return 0;
+}
+device_initcall(s3c64xx_init_cpuidle);
diff --git a/arch/arm/mach-s3c/crag6410.h b/arch/arm/mach-s3c/crag6410.h
new file mode 100644 (file)
index 0000000..f39ea2c
--- /dev/null
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Cragganmore 6410 shared definitions
+ *
+ * Copyright 2011 Wolfson Microelectronics plc
+ *     Mark Brown <broonie@opensource.wolfsonmicro.com>
+ */
+
+#ifndef MACH_CRAG6410_H
+#define MACH_CRAG6410_H
+
+#include "gpio-samsung.h"
+
+#define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START
+#define BANFF_PMIC_IRQ_BASE            (IRQ_BOARD_START + 64)
+
+#define PCA935X_GPIO_BASE              GPIO_BOARD_START
+#define CODEC_GPIO_BASE                        (GPIO_BOARD_START + 8)
+#define GLENFARCLAS_PMIC_GPIO_BASE     (GPIO_BOARD_START + 32)
+#define BANFF_PMIC_GPIO_BASE           (GPIO_BOARD_START + 64)
+#define MMGPIO_GPIO_BASE               (GPIO_BOARD_START + 96)
+
+#endif
diff --git a/arch/arm/mach-s3c/dev-audio-s3c64xx.c b/arch/arm/mach-s3c/dev-audio-s3c64xx.c
new file mode 100644 (file)
index 0000000..fc2f077
--- /dev/null
@@ -0,0 +1,212 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2009 Wolfson Microelectronics
+//      Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
+#include <linux/gpio.h>
+#include <linux/export.h>
+
+#include <mach/irqs.h>
+#include "map.h"
+
+#include "devs.h"
+#include <linux/platform_data/asoc-s3c.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
+{
+       unsigned int base;
+
+       switch (pdev->id) {
+       case 0:
+               base = S3C64XX_GPD(0);
+               break;
+       case 1:
+               base = S3C64XX_GPE(0);
+               break;
+       case 2:
+               s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C_GPIO_SFN(5));
+               s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C_GPIO_SFN(5));
+               s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C_GPIO_SFN(5));
+               s3c_gpio_cfgpin_range(S3C64XX_GPH(6), 4, S3C_GPIO_SFN(5));
+               return 0;
+       default:
+               printk(KERN_DEBUG "Invalid I2S Controller number: %d\n",
+                       pdev->id);
+               return -EINVAL;
+       }
+
+       s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
+
+       return 0;
+}
+
+static struct resource s3c64xx_iis0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
+};
+
+static struct s3c_audio_pdata i2s0_pdata = {
+       .cfg_gpio = s3c64xx_i2s_cfg_gpio,
+};
+
+struct platform_device s3c64xx_device_iis0 = {
+       .name             = "samsung-i2s",
+       .id               = 0,
+       .num_resources    = ARRAY_SIZE(s3c64xx_iis0_resource),
+       .resource         = s3c64xx_iis0_resource,
+       .dev = {
+               .platform_data = &i2s0_pdata,
+       },
+};
+EXPORT_SYMBOL(s3c64xx_device_iis0);
+
+static struct resource s3c64xx_iis1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
+};
+
+static struct s3c_audio_pdata i2s1_pdata = {
+       .cfg_gpio = s3c64xx_i2s_cfg_gpio,
+};
+
+struct platform_device s3c64xx_device_iis1 = {
+       .name             = "samsung-i2s",
+       .id               = 1,
+       .num_resources    = ARRAY_SIZE(s3c64xx_iis1_resource),
+       .resource         = s3c64xx_iis1_resource,
+       .dev = {
+               .platform_data = &i2s1_pdata,
+       },
+};
+EXPORT_SYMBOL(s3c64xx_device_iis1);
+
+static struct resource s3c64xx_iisv4_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
+};
+
+static struct s3c_audio_pdata i2sv4_pdata = {
+       .cfg_gpio = s3c64xx_i2s_cfg_gpio,
+       .type = {
+               .quirks = QUIRK_PRI_6CHAN,
+       },
+};
+
+struct platform_device s3c64xx_device_iisv4 = {
+       .name = "samsung-i2s",
+       .id = 2,
+       .num_resources    = ARRAY_SIZE(s3c64xx_iisv4_resource),
+       .resource         = s3c64xx_iisv4_resource,
+       .dev = {
+               .platform_data = &i2sv4_pdata,
+       },
+};
+EXPORT_SYMBOL(s3c64xx_device_iisv4);
+
+
+/* PCM Controller platform_devices */
+
+static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
+{
+       unsigned int base;
+
+       switch (pdev->id) {
+       case 0:
+               base = S3C64XX_GPD(0);
+               break;
+       case 1:
+               base = S3C64XX_GPE(0);
+               break;
+       default:
+               printk(KERN_DEBUG "Invalid PCM Controller number: %d\n",
+                       pdev->id);
+               return -EINVAL;
+       }
+
+       s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2));
+       return 0;
+}
+
+static struct resource s3c64xx_pcm0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
+};
+
+static struct s3c_audio_pdata s3c_pcm0_pdata = {
+       .cfg_gpio = s3c64xx_pcm_cfg_gpio,
+};
+
+struct platform_device s3c64xx_device_pcm0 = {
+       .name             = "samsung-pcm",
+       .id               = 0,
+       .num_resources    = ARRAY_SIZE(s3c64xx_pcm0_resource),
+       .resource         = s3c64xx_pcm0_resource,
+       .dev = {
+               .platform_data = &s3c_pcm0_pdata,
+       },
+};
+EXPORT_SYMBOL(s3c64xx_device_pcm0);
+
+static struct resource s3c64xx_pcm1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
+};
+
+static struct s3c_audio_pdata s3c_pcm1_pdata = {
+       .cfg_gpio = s3c64xx_pcm_cfg_gpio,
+};
+
+struct platform_device s3c64xx_device_pcm1 = {
+       .name             = "samsung-pcm",
+       .id               = 1,
+       .num_resources    = ARRAY_SIZE(s3c64xx_pcm1_resource),
+       .resource         = s3c64xx_pcm1_resource,
+       .dev = {
+               .platform_data = &s3c_pcm1_pdata,
+       },
+};
+EXPORT_SYMBOL(s3c64xx_device_pcm1);
+
+/* AC97 Controller platform devices */
+
+static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev)
+{
+       return s3c_gpio_cfgpin_range(S3C64XX_GPD(0), 5, S3C_GPIO_SFN(4));
+}
+
+static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
+{
+       return s3c_gpio_cfgpin_range(S3C64XX_GPE(0), 5, S3C_GPIO_SFN(4));
+}
+
+static struct resource s3c64xx_ac97_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_AC97),
+};
+
+static struct s3c_audio_pdata s3c_ac97_pdata = {
+};
+
+static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
+
+struct platform_device s3c64xx_device_ac97 = {
+       .name             = "samsung-ac97",
+       .id               = -1,
+       .num_resources    = ARRAY_SIZE(s3c64xx_ac97_resource),
+       .resource         = s3c64xx_ac97_resource,
+       .dev = {
+               .platform_data = &s3c_ac97_pdata,
+               .dma_mask = &s3c64xx_ac97_dmamask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+       },
+};
+EXPORT_SYMBOL(s3c64xx_device_ac97);
+
+void __init s3c64xx_ac97_setup_gpio(int num)
+{
+       if (num == S3C64XX_AC97_GPD)
+               s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpd;
+       else
+               s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpe;
+}
diff --git a/arch/arm/mach-s3c/dev-backlight-s3c64xx.c b/arch/arm/mach-s3c/dev-backlight-s3c64xx.c
new file mode 100644 (file)
index 0000000..65488b6
--- /dev/null
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2011 Samsung Electronics Co., Ltd.
+//              http://www.samsung.com
+//
+// Common infrastructure for PWM Backlight for Samsung boards
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/pwm_backlight.h>
+
+#include "devs.h"
+#include "gpio-cfg.h"
+
+#include "backlight-s3c64xx.h"
+
+struct samsung_bl_drvdata {
+       struct platform_pwm_backlight_data plat_data;
+       struct samsung_bl_gpio_info *gpio_info;
+};
+
+static int samsung_bl_init(struct device *dev)
+{
+       int ret = 0;
+       struct platform_pwm_backlight_data *pdata = dev->platform_data;
+       struct samsung_bl_drvdata *drvdata = container_of(pdata,
+                                       struct samsung_bl_drvdata, plat_data);
+       struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;
+
+       ret = gpio_request(bl_gpio_info->no, "Backlight");
+       if (ret) {
+               printk(KERN_ERR "failed to request GPIO for LCD Backlight\n");
+               return ret;
+       }
+
+       /* Configure GPIO pin with specific GPIO function for PWM timer */
+       s3c_gpio_cfgpin(bl_gpio_info->no, bl_gpio_info->func);
+
+       return 0;
+}
+
+static void samsung_bl_exit(struct device *dev)
+{
+       struct platform_pwm_backlight_data *pdata = dev->platform_data;
+       struct samsung_bl_drvdata *drvdata = container_of(pdata,
+                                       struct samsung_bl_drvdata, plat_data);
+       struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;
+
+       s3c_gpio_cfgpin(bl_gpio_info->no, S3C_GPIO_OUTPUT);
+       gpio_free(bl_gpio_info->no);
+}
+
+/* Initialize few important fields of platform_pwm_backlight_data
+ * structure with default values. These fields can be overridden by
+ * board-specific values sent from machine file.
+ * For ease of operation, these fields are initialized with values
+ * used by most samsung boards.
+ * Users has the option of sending info about other parameters
+ * for their specific boards
+ */
+
+static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
+       .plat_data = {
+               .max_brightness = 255,
+               .dft_brightness = 255,
+               .init           = samsung_bl_init,
+               .exit           = samsung_bl_exit,
+       },
+};
+
+static struct platform_device samsung_dfl_bl_device __initdata = {
+       .name           = "pwm-backlight",
+};
+
+/* samsung_bl_set - Set board specific data (if any) provided by user for
+ * PWM Backlight control and register specific PWM and backlight device.
+ * @gpio_info: structure containing GPIO info for PWM timer
+ * @bl_data:   structure containing Backlight control data
+ */
+void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
+       struct platform_pwm_backlight_data *bl_data)
+{
+       int ret = 0;
+       struct platform_device *samsung_bl_device;
+       struct samsung_bl_drvdata *samsung_bl_drvdata;
+       struct platform_pwm_backlight_data *samsung_bl_data;
+
+       samsung_bl_device = kmemdup(&samsung_dfl_bl_device,
+                       sizeof(struct platform_device), GFP_KERNEL);
+       if (!samsung_bl_device)
+               return;
+
+       samsung_bl_drvdata = kmemdup(&samsung_dfl_bl_data,
+                               sizeof(samsung_dfl_bl_data), GFP_KERNEL);
+       if (!samsung_bl_drvdata)
+               goto err_data;
+
+       samsung_bl_device->dev.platform_data = &samsung_bl_drvdata->plat_data;
+       samsung_bl_drvdata->gpio_info = gpio_info;
+       samsung_bl_data = &samsung_bl_drvdata->plat_data;
+
+       /* Copy board specific data provided by user */
+       samsung_bl_device->dev.parent = &samsung_device_pwm.dev;
+
+       if (bl_data->max_brightness)
+               samsung_bl_data->max_brightness = bl_data->max_brightness;
+       if (bl_data->dft_brightness)
+               samsung_bl_data->dft_brightness = bl_data->dft_brightness;
+       if (bl_data->lth_brightness)
+               samsung_bl_data->lth_brightness = bl_data->lth_brightness;
+       if (bl_data->init)
+               samsung_bl_data->init = bl_data->init;
+       if (bl_data->notify)
+               samsung_bl_data->notify = bl_data->notify;
+       if (bl_data->notify_after)
+               samsung_bl_data->notify_after = bl_data->notify_after;
+       if (bl_data->exit)
+               samsung_bl_data->exit = bl_data->exit;
+       if (bl_data->check_fb)
+               samsung_bl_data->check_fb = bl_data->check_fb;
+
+       /* Register the Backlight dev */
+       ret = platform_device_register(samsung_bl_device);
+       if (ret) {
+               printk(KERN_ERR "failed to register backlight device: %d\n", ret);
+               goto err_plat_reg2;
+       }
+
+       return;
+
+err_plat_reg2:
+       kfree(samsung_bl_data);
+err_data:
+       kfree(samsung_bl_device);
+}
diff --git a/arch/arm/mach-s3c/dev-uart-s3c64xx.c b/arch/arm/mach-s3c/dev-uart-s3c64xx.c
new file mode 100644 (file)
index 0000000..8288e8d
--- /dev/null
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Base S3C64XX UART resource and device definitions
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/irq.h>
+#include "map.h"
+#include <mach/irqs.h>
+
+#include "devs.h"
+
+/* Serial port registrations */
+
+/* 64xx uarts are closer together */
+
+static struct resource s3c64xx_uart0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_UART0, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_UART0),
+};
+
+static struct resource s3c64xx_uart1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_UART1, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_UART1),
+};
+
+static struct resource s3c6xx_uart2_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_UART2, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_UART2),
+};
+
+static struct resource s3c64xx_uart3_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_UART3, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_UART3),
+};
+
+
+struct s3c24xx_uart_resources s3c64xx_uart_resources[] __initdata = {
+       [0] = {
+               .resources      = s3c64xx_uart0_resource,
+               .nr_resources   = ARRAY_SIZE(s3c64xx_uart0_resource),
+       },
+       [1] = {
+               .resources      = s3c64xx_uart1_resource,
+               .nr_resources   = ARRAY_SIZE(s3c64xx_uart1_resource),
+       },
+       [2] = {
+               .resources      = s3c6xx_uart2_resource,
+               .nr_resources   = ARRAY_SIZE(s3c6xx_uart2_resource),
+       },
+       [3] = {
+               .resources      = s3c64xx_uart3_resource,
+               .nr_resources   = ARRAY_SIZE(s3c64xx_uart3_resource),
+       },
+};
diff --git a/arch/arm/mach-s3c/dev-uart.c b/arch/arm/mach-s3c/dev-uart.c
new file mode 100644 (file)
index 0000000..3d1f7f2
--- /dev/null
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+//     originally from arch/arm/plat-s3c24xx/devs.c
+//
+// Copyright (c) 2004 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Base S3C24XX platform device definitions
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include "devs.h"
+
+/* uart devices */
+
+static struct platform_device s3c24xx_uart_device0 = {
+       .id             = 0,
+};
+
+static struct platform_device s3c24xx_uart_device1 = {
+       .id             = 1,
+};
+
+static struct platform_device s3c24xx_uart_device2 = {
+       .id             = 2,
+};
+
+static struct platform_device s3c24xx_uart_device3 = {
+       .id             = 3,
+};
+
+struct platform_device *s3c24xx_uart_src[4] = {
+       &s3c24xx_uart_device0,
+       &s3c24xx_uart_device1,
+       &s3c24xx_uart_device2,
+       &s3c24xx_uart_device3,
+};
+
+struct platform_device *s3c24xx_uart_devs[4] = {
+};
diff --git a/arch/arm/mach-s3c/devs.c b/arch/arm/mach-s3c/devs.c
new file mode 100644 (file)
index 0000000..06dec64
--- /dev/null
@@ -0,0 +1,1199 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2011 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com
+//
+// Base Samsung platform device definitions
+
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/dma-mapping.h>
+#include <linux/fb.h>
+#include <linux/gfp.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/onenand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mmc/host.h>
+#include <linux/ioport.h>
+#include <linux/sizes.h>
+#include <linux/platform_data/s3c-hsudc.h>
+#include <linux/platform_data/s3c-hsotg.h>
+#include <linux/platform_data/dma-s3c24xx.h>
+
+#include <linux/platform_data/media/s5p_hdmi.h>
+
+#include <asm/irq.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <mach/irqs.h>
+#include "map.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#ifdef CONFIG_PLAT_S3C24XX
+#include "regs-s3c2443-clock.h"
+#endif /* CONFIG_PLAT_S3C24XX */
+
+#include "cpu.h"
+#include "devs.h"
+#include <linux/soc/samsung/s3c-adc.h>
+#include <linux/platform_data/ata-samsung_cf.h>
+#include "fb.h"
+#include <linux/platform_data/fb-s3c2410.h>
+#include <linux/platform_data/hwmon-s3c.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "keypad.h"
+#include <linux/platform_data/mmc-s3cmci.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include "pwm-core.h"
+#include "sdhci.h"
+#include <linux/platform_data/touchscreen-s3c2410.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/usb-ohci-s3c2410.h>
+#include "usb-phy.h"
+#include <linux/platform_data/asoc-s3c.h>
+#include <linux/platform_data/spi-s3c64xx.h>
+
+#define samsung_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
+
+/* AC97 */
+#ifdef CONFIG_CPU_S3C2440
+static struct resource s3c_ac97_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
+       [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
+};
+
+struct platform_device s3c_device_ac97 = {
+       .name           = "samsung-ac97",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_ac97_resource),
+       .resource       = s3c_ac97_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+#endif /* CONFIG_CPU_S3C2440 */
+
+/* ADC */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_adc_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
+       [1] = DEFINE_RES_IRQ(IRQ_TC),
+       [2] = DEFINE_RES_IRQ(IRQ_ADC),
+};
+
+struct platform_device s3c_device_adc = {
+       .name           = "s3c24xx-adc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_adc_resource),
+       .resource       = s3c_adc_resource,
+};
+#endif /* CONFIG_PLAT_S3C24XX */
+
+#if defined(CONFIG_SAMSUNG_DEV_ADC)
+static struct resource s3c_adc_resource[] = {
+       [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_ADC),
+       [2] = DEFINE_RES_IRQ(IRQ_TC),
+};
+
+struct platform_device s3c_device_adc = {
+       .name           = "exynos-adc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_adc_resource),
+       .resource       = s3c_adc_resource,
+};
+#endif /* CONFIG_SAMSUNG_DEV_ADC */
+
+/* Camif Controller */
+
+#ifdef CONFIG_CPU_S3C2440
+static struct resource s3c_camif_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2440_PA_CAMIF, S3C2440_SZ_CAMIF),
+       [1] = DEFINE_RES_IRQ(IRQ_S3C2440_CAM_C),
+       [2] = DEFINE_RES_IRQ(IRQ_S3C2440_CAM_P),
+};
+
+struct platform_device s3c_device_camif = {
+       .name           = "s3c2440-camif",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_camif_resource),
+       .resource       = s3c_camif_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+#endif /* CONFIG_CPU_S3C2440 */
+
+/* FB */
+
+#ifdef CONFIG_S3C_DEV_FB
+static struct resource s3c_fb_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K),
+       [1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC),
+       [2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO),
+       [3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM),
+};
+
+struct platform_device s3c_device_fb = {
+       .name           = "s3c-fb",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_fb_resource),
+       .resource       = s3c_fb_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
+{
+       s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
+                        &s3c_device_fb);
+}
+#endif /* CONFIG_S3C_DEV_FB */
+
+/* HWMON */
+
+#ifdef CONFIG_S3C_DEV_HWMON
+struct platform_device s3c_device_hwmon = {
+       .name           = "s3c-hwmon",
+       .id             = -1,
+       .dev.parent     = &s3c_device_adc.dev,
+};
+
+void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
+{
+       s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
+                        &s3c_device_hwmon);
+}
+#endif /* CONFIG_S3C_DEV_HWMON */
+
+/* HSMMC */
+
+#ifdef CONFIG_S3C_DEV_HSMMC
+static struct resource s3c_hsmmc_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC0, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_HSMMC0),
+};
+
+struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
+       .max_width      = 4,
+       .host_caps      = (MMC_CAP_4_BIT_DATA |
+                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+};
+
+struct platform_device s3c_device_hsmmc0 = {
+       .name           = "s3c-sdhci",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c_hsmmc_resource),
+       .resource       = s3c_hsmmc_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &s3c_hsmmc0_def_platdata,
+       },
+};
+
+void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
+{
+       s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
+}
+#endif /* CONFIG_S3C_DEV_HSMMC */
+
+#ifdef CONFIG_S3C_DEV_HSMMC1
+static struct resource s3c_hsmmc1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC1, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_HSMMC1),
+};
+
+struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
+       .max_width      = 4,
+       .host_caps      = (MMC_CAP_4_BIT_DATA |
+                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+};
+
+struct platform_device s3c_device_hsmmc1 = {
+       .name           = "s3c-sdhci",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(s3c_hsmmc1_resource),
+       .resource       = s3c_hsmmc1_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &s3c_hsmmc1_def_platdata,
+       },
+};
+
+void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
+{
+       s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
+}
+#endif /* CONFIG_S3C_DEV_HSMMC1 */
+
+/* HSMMC2 */
+
+#ifdef CONFIG_S3C_DEV_HSMMC2
+static struct resource s3c_hsmmc2_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC2, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_HSMMC2),
+};
+
+struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
+       .max_width      = 4,
+       .host_caps      = (MMC_CAP_4_BIT_DATA |
+                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+};
+
+struct platform_device s3c_device_hsmmc2 = {
+       .name           = "s3c-sdhci",
+       .id             = 2,
+       .num_resources  = ARRAY_SIZE(s3c_hsmmc2_resource),
+       .resource       = s3c_hsmmc2_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &s3c_hsmmc2_def_platdata,
+       },
+};
+
+void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
+{
+       s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
+}
+#endif /* CONFIG_S3C_DEV_HSMMC2 */
+
+#ifdef CONFIG_S3C_DEV_HSMMC3
+static struct resource s3c_hsmmc3_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC3, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_HSMMC3),
+};
+
+struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
+       .max_width      = 4,
+       .host_caps      = (MMC_CAP_4_BIT_DATA |
+                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
+};
+
+struct platform_device s3c_device_hsmmc3 = {
+       .name           = "s3c-sdhci",
+       .id             = 3,
+       .num_resources  = ARRAY_SIZE(s3c_hsmmc3_resource),
+       .resource       = s3c_hsmmc3_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &s3c_hsmmc3_def_platdata,
+       },
+};
+
+void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
+{
+       s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
+}
+#endif /* CONFIG_S3C_DEV_HSMMC3 */
+
+/* I2C */
+
+static struct resource s3c_i2c0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC),
+};
+
+struct platform_device s3c_device_i2c0 = {
+       .name           = "s3c2410-i2c",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c_i2c0_resource),
+       .resource       = s3c_i2c0_resource,
+};
+
+struct s3c2410_platform_i2c default_i2c_data __initdata = {
+       .flags          = 0,
+       .slave_addr     = 0x10,
+       .frequency      = 100*1000,
+       .sda_delay      = 100,
+};
+
+void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 0;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c0);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c0_cfg_gpio;
+}
+
+#ifdef CONFIG_S3C_DEV_I2C1
+static struct resource s3c_i2c1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC1, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC1),
+};
+
+struct platform_device s3c_device_i2c1 = {
+       .name           = "s3c2410-i2c",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(s3c_i2c1_resource),
+       .resource       = s3c_i2c1_resource,
+};
+
+void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 1;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c1);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c1_cfg_gpio;
+}
+#endif /* CONFIG_S3C_DEV_I2C1 */
+
+#ifdef CONFIG_S3C_DEV_I2C2
+static struct resource s3c_i2c2_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC2, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC2),
+};
+
+struct platform_device s3c_device_i2c2 = {
+       .name           = "s3c2410-i2c",
+       .id             = 2,
+       .num_resources  = ARRAY_SIZE(s3c_i2c2_resource),
+       .resource       = s3c_i2c2_resource,
+};
+
+void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 2;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c2);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c2_cfg_gpio;
+}
+#endif /* CONFIG_S3C_DEV_I2C2 */
+
+#ifdef CONFIG_S3C_DEV_I2C3
+static struct resource s3c_i2c3_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC3, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC3),
+};
+
+struct platform_device s3c_device_i2c3 = {
+       .name           = "s3c2440-i2c",
+       .id             = 3,
+       .num_resources  = ARRAY_SIZE(s3c_i2c3_resource),
+       .resource       = s3c_i2c3_resource,
+};
+
+void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 3;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c3);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c3_cfg_gpio;
+}
+#endif /*CONFIG_S3C_DEV_I2C3 */
+
+#ifdef CONFIG_S3C_DEV_I2C4
+static struct resource s3c_i2c4_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC4, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC4),
+};
+
+struct platform_device s3c_device_i2c4 = {
+       .name           = "s3c2440-i2c",
+       .id             = 4,
+       .num_resources  = ARRAY_SIZE(s3c_i2c4_resource),
+       .resource       = s3c_i2c4_resource,
+};
+
+void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 4;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c4);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c4_cfg_gpio;
+}
+#endif /*CONFIG_S3C_DEV_I2C4 */
+
+#ifdef CONFIG_S3C_DEV_I2C5
+static struct resource s3c_i2c5_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC5, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC5),
+};
+
+struct platform_device s3c_device_i2c5 = {
+       .name           = "s3c2440-i2c",
+       .id             = 5,
+       .num_resources  = ARRAY_SIZE(s3c_i2c5_resource),
+       .resource       = s3c_i2c5_resource,
+};
+
+void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 5;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c5);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c5_cfg_gpio;
+}
+#endif /*CONFIG_S3C_DEV_I2C5 */
+
+#ifdef CONFIG_S3C_DEV_I2C6
+static struct resource s3c_i2c6_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC6, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC6),
+};
+
+struct platform_device s3c_device_i2c6 = {
+       .name           = "s3c2440-i2c",
+       .id             = 6,
+       .num_resources  = ARRAY_SIZE(s3c_i2c6_resource),
+       .resource       = s3c_i2c6_resource,
+};
+
+void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 6;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c6);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c6_cfg_gpio;
+}
+#endif /* CONFIG_S3C_DEV_I2C6 */
+
+#ifdef CONFIG_S3C_DEV_I2C7
+static struct resource s3c_i2c7_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_IIC7, SZ_4K),
+       [1] = DEFINE_RES_IRQ(IRQ_IIC7),
+};
+
+struct platform_device s3c_device_i2c7 = {
+       .name           = "s3c2440-i2c",
+       .id             = 7,
+       .num_resources  = ARRAY_SIZE(s3c_i2c7_resource),
+       .resource       = s3c_i2c7_resource,
+};
+
+void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd) {
+               pd = &default_i2c_data;
+               pd->bus_num = 7;
+       }
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c7);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c7_cfg_gpio;
+}
+#endif /* CONFIG_S3C_DEV_I2C7 */
+
+/* I2S */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_iis_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
+};
+
+struct platform_device s3c_device_iis = {
+       .name           = "s3c24xx-iis",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_iis_resource),
+       .resource       = s3c_iis_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+#endif /* CONFIG_PLAT_S3C24XX */
+
+/* IDE CFCON */
+
+#ifdef CONFIG_SAMSUNG_DEV_IDE
+static struct resource s3c_cfcon_resource[] = {
+       [0] = DEFINE_RES_MEM(SAMSUNG_PA_CFCON, SZ_16K),
+       [1] = DEFINE_RES_IRQ(IRQ_CFCON),
+};
+
+struct platform_device s3c_device_cfcon = {
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c_cfcon_resource),
+       .resource       = s3c_cfcon_resource,
+};
+
+void __init s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
+{
+       s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
+                        &s3c_device_cfcon);
+}
+#endif /* CONFIG_SAMSUNG_DEV_IDE */
+
+/* KEYPAD */
+
+#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
+static struct resource samsung_keypad_resources[] = {
+       [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
+       [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
+};
+
+struct platform_device samsung_device_keypad = {
+       .name           = "samsung-keypad",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(samsung_keypad_resources),
+       .resource       = samsung_keypad_resources,
+};
+
+void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
+{
+       struct samsung_keypad_platdata *npd;
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &samsung_device_keypad);
+
+       if (!npd->cfg_gpio)
+               npd->cfg_gpio = samsung_keypad_cfg_gpio;
+}
+#endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
+
+/* LCD Controller */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_lcd_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_LCD, S3C24XX_SZ_LCD),
+       [1] = DEFINE_RES_IRQ(IRQ_LCD),
+};
+
+struct platform_device s3c_device_lcd = {
+       .name           = "s3c2410-lcd",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_lcd_resource),
+       .resource       = s3c_lcd_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+
+void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
+{
+       struct s3c2410fb_mach_info *npd;
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
+       if (npd) {
+               npd->displays = kmemdup(pd->displays,
+                       sizeof(struct s3c2410fb_display) * npd->num_displays,
+                       GFP_KERNEL);
+               if (!npd->displays)
+                       printk(KERN_ERR "no memory for LCD display data\n");
+       } else {
+               printk(KERN_ERR "no memory for LCD platform data\n");
+       }
+}
+#endif /* CONFIG_PLAT_S3C24XX */
+
+/* NAND */
+
+#ifdef CONFIG_S3C_DEV_NAND
+static struct resource s3c_nand_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_NAND, SZ_1M),
+};
+
+struct platform_device s3c_device_nand = {
+       .name           = "s3c2410-nand",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_nand_resource),
+       .resource       = s3c_nand_resource,
+};
+
+/*
+ * s3c_nand_copy_set() - copy nand set data
+ * @set: The new structure, directly copied from the old.
+ *
+ * Copy all the fields from the NAND set field from what is probably __initdata
+ * to new kernel memory. The code returns 0 if the copy happened correctly or
+ * an error code for the calling function to display.
+ *
+ * Note, we currently do not try and look to see if we've already copied the
+ * data in a previous set.
+ */
+static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
+{
+       void *ptr;
+       int size;
+
+       size = sizeof(struct mtd_partition) * set->nr_partitions;
+       if (size) {
+               ptr = kmemdup(set->partitions, size, GFP_KERNEL);
+               set->partitions = ptr;
+
+               if (!ptr)
+                       return -ENOMEM;
+       }
+
+       if (set->nr_map && set->nr_chips) {
+               size = sizeof(int) * set->nr_chips;
+               ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
+               set->nr_map = ptr;
+
+               if (!ptr)
+                       return -ENOMEM;
+       }
+
+       return 0;
+}
+
+void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
+{
+       struct s3c2410_platform_nand *npd;
+       int size;
+       int ret;
+
+       /* note, if we get a failure in allocation, we simply drop out of the
+        * function. If there is so little memory available at initialisation
+        * time then there is little chance the system is going to run.
+        */
+
+       npd = s3c_set_platdata(nand, sizeof(*npd), &s3c_device_nand);
+       if (!npd)
+               return;
+
+       /* now see if we need to copy any of the nand set data */
+
+       size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
+       if (size) {
+               struct s3c2410_nand_set *from = npd->sets;
+               struct s3c2410_nand_set *to;
+               int i;
+
+               to = kmemdup(from, size, GFP_KERNEL);
+               npd->sets = to; /* set, even if we failed */
+
+               if (!to) {
+                       printk(KERN_ERR "%s: no memory for sets\n", __func__);
+                       return;
+               }
+
+               for (i = 0; i < npd->nr_sets; i++) {
+                       ret = s3c_nand_copy_set(to);
+                       if (ret) {
+                               printk(KERN_ERR "%s: failed to copy set %d\n",
+                               __func__, i);
+                               return;
+                       }
+                       to++;
+               }
+       }
+}
+#endif /* CONFIG_S3C_DEV_NAND */
+
+/* ONENAND */
+
+#ifdef CONFIG_S3C_DEV_ONENAND
+static struct resource s3c_onenand_resources[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_ONENAND, SZ_1K),
+       [1] = DEFINE_RES_MEM(S3C_PA_ONENAND_BUF, S3C_SZ_ONENAND_BUF),
+       [2] = DEFINE_RES_IRQ(IRQ_ONENAND),
+};
+
+struct platform_device s3c_device_onenand = {
+       .name           = "samsung-onenand",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c_onenand_resources),
+       .resource       = s3c_onenand_resources,
+};
+#endif /* CONFIG_S3C_DEV_ONENAND */
+
+#ifdef CONFIG_S3C64XX_DEV_ONENAND1
+static struct resource s3c64xx_onenand1_resources[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1, SZ_1K),
+       [1] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1_BUF, S3C64XX_SZ_ONENAND1_BUF),
+       [2] = DEFINE_RES_IRQ(IRQ_ONENAND1),
+};
+
+struct platform_device s3c64xx_device_onenand1 = {
+       .name           = "samsung-onenand",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(s3c64xx_onenand1_resources),
+       .resource       = s3c64xx_onenand1_resources,
+};
+
+void __init s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
+{
+       s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
+                        &s3c64xx_device_onenand1);
+}
+#endif /* CONFIG_S3C64XX_DEV_ONENAND1 */
+
+/* PWM Timer */
+
+#ifdef CONFIG_SAMSUNG_DEV_PWM
+static struct resource samsung_pwm_resource[] = {
+       DEFINE_RES_MEM(SAMSUNG_PA_TIMER, SZ_4K),
+};
+
+struct platform_device samsung_device_pwm = {
+       .name           = "samsung-pwm",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(samsung_pwm_resource),
+       .resource       = samsung_pwm_resource,
+};
+
+void __init samsung_pwm_set_platdata(struct samsung_pwm_variant *pd)
+{
+       samsung_device_pwm.dev.platform_data = pd;
+}
+#endif /* CONFIG_SAMSUNG_DEV_PWM */
+
+/* RTC */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_rtc_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_RTC, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_RTC),
+       [2] = DEFINE_RES_IRQ(IRQ_TICK),
+};
+
+struct platform_device s3c_device_rtc = {
+       .name           = "s3c2410-rtc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_rtc_resource),
+       .resource       = s3c_rtc_resource,
+};
+#endif /* CONFIG_PLAT_S3C24XX */
+
+#ifdef CONFIG_S3C_DEV_RTC
+static struct resource s3c_rtc_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_RTC, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_RTC_ALARM),
+       [2] = DEFINE_RES_IRQ(IRQ_RTC_TIC),
+};
+
+struct platform_device s3c_device_rtc = {
+       .name           = "s3c64xx-rtc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_rtc_resource),
+       .resource       = s3c_rtc_resource,
+};
+#endif /* CONFIG_S3C_DEV_RTC */
+
+/* SDI */
+
+#ifdef CONFIG_PLAT_S3C24XX
+void s3c24xx_mci_def_set_power(unsigned char power_mode, unsigned short vdd)
+{
+       switch (power_mode) {
+       case MMC_POWER_ON:
+       case MMC_POWER_UP:
+               /* Configure GPE5...GPE10 pins in SD mode */
+               s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2),
+                                     S3C_GPIO_PULL_NONE);
+               break;
+
+       case MMC_POWER_OFF:
+       default:
+               gpio_direction_output(S3C2410_GPE(5), 0);
+               break;
+       }
+}
+
+static struct resource s3c_sdi_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
+       [1] = DEFINE_RES_IRQ(IRQ_SDI),
+};
+
+static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
+       /* This is currently here to avoid a number of if (host->pdata)
+        * checks. Any zero fields to ensure reasonable defaults are picked. */
+       .no_wprotect = 1,
+       .no_detect = 1,
+       .set_power = s3c24xx_mci_def_set_power,
+};
+
+struct platform_device s3c_device_sdi = {
+       .name           = "s3c2410-sdi",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_sdi_resource),
+       .resource       = s3c_sdi_resource,
+       .dev.platform_data = &s3cmci_def_pdata,
+};
+
+void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
+{
+       s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
+                        &s3c_device_sdi);
+}
+#endif /* CONFIG_PLAT_S3C24XX */
+
+/* SPI */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_spi0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI, SZ_32),
+       [1] = DEFINE_RES_IRQ(IRQ_SPI0),
+};
+
+struct platform_device s3c_device_spi0 = {
+       .name           = "s3c2410-spi",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c_spi0_resource),
+       .resource       = s3c_spi0_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+
+static struct resource s3c_spi1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI1, SZ_32),
+       [1] = DEFINE_RES_IRQ(IRQ_SPI1),
+};
+
+struct platform_device s3c_device_spi1 = {
+       .name           = "s3c2410-spi",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(s3c_spi1_resource),
+       .resource       = s3c_spi1_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+#endif /* CONFIG_PLAT_S3C24XX */
+
+/* Touchscreen */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_ts_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
+       [1] = DEFINE_RES_IRQ(IRQ_TC),
+};
+
+struct platform_device s3c_device_ts = {
+       .name           = "s3c2410-ts",
+       .id             = -1,
+       .dev.parent     = &s3c_device_adc.dev,
+       .num_resources  = ARRAY_SIZE(s3c_ts_resource),
+       .resource       = s3c_ts_resource,
+};
+
+void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
+{
+       s3c_set_platdata(hard_s3c2410ts_info,
+                        sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
+}
+#endif /* CONFIG_PLAT_S3C24XX */
+
+#ifdef CONFIG_SAMSUNG_DEV_TS
+static struct s3c2410_ts_mach_info default_ts_data __initdata = {
+       .delay                  = 10000,
+       .presc                  = 49,
+       .oversampling_shift     = 2,
+};
+
+void __init s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
+{
+       if (!pd)
+               pd = &default_ts_data;
+
+       s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
+                        &s3c_device_adc);
+}
+#endif /* CONFIG_SAMSUNG_DEV_TS */
+
+/* USB */
+
+#ifdef CONFIG_S3C_DEV_USB_HOST
+static struct resource s3c_usb_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_USBHOST, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_USBH),
+};
+
+struct platform_device s3c_device_ohci = {
+       .name           = "s3c2410-ohci",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_usb_resource),
+       .resource       = s3c_usb_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+
+/*
+ * s3c_ohci_set_platdata - initialise OHCI device platform data
+ * @info: The platform data.
+ *
+ * This call copies the @info passed in and sets the device .platform_data
+ * field to that copy. The @info is copied so that the original can be marked
+ * __initdata.
+ */
+
+void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
+{
+       s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
+                        &s3c_device_ohci);
+}
+#endif /* CONFIG_S3C_DEV_USB_HOST */
+
+/* USB Device (Gadget) */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_usbgadget_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_USBDEV, S3C24XX_SZ_USBDEV),
+       [1] = DEFINE_RES_IRQ(IRQ_USBD),
+};
+
+struct platform_device s3c_device_usbgadget = {
+       .name           = "s3c2410-usbgadget",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_usbgadget_resource),
+       .resource       = s3c_usbgadget_resource,
+};
+
+void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
+{
+       s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
+}
+#endif /* CONFIG_PLAT_S3C24XX */
+
+/* USB HSOTG */
+
+#ifdef CONFIG_S3C_DEV_USB_HSOTG
+static struct resource s3c_usb_hsotg_resources[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
+       [1] = DEFINE_RES_IRQ(IRQ_OTG),
+};
+
+struct platform_device s3c_device_usb_hsotg = {
+       .name           = "s3c-hsotg",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_usb_hsotg_resources),
+       .resource       = s3c_usb_hsotg_resources,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd)
+{
+       struct dwc2_hsotg_plat *npd;
+
+       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_usb_hsotg);
+
+       if (!npd->phy_init)
+               npd->phy_init = s3c_usb_phy_init;
+       if (!npd->phy_exit)
+               npd->phy_exit = s3c_usb_phy_exit;
+}
+#endif /* CONFIG_S3C_DEV_USB_HSOTG */
+
+/* USB High Spped 2.0 Device (Gadget) */
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct resource s3c_hsudc_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2416_PA_HSUDC, S3C2416_SZ_HSUDC),
+       [1] = DEFINE_RES_IRQ(IRQ_USBD),
+};
+
+struct platform_device s3c_device_usb_hsudc = {
+       .name           = "s3c-hsudc",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_hsudc_resource),
+       .resource       = s3c_hsudc_resource,
+       .dev            = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
+{
+       s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
+       pd->phy_init = s3c_hsudc_init_phy;
+       pd->phy_uninit = s3c_hsudc_uninit_phy;
+}
+#endif /* CONFIG_PLAT_S3C24XX */
+
+/* WDT */
+
+#ifdef CONFIG_S3C_DEV_WDT
+static struct resource s3c_wdt_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
+       [1] = DEFINE_RES_IRQ(IRQ_WDT),
+};
+
+struct platform_device s3c_device_wdt = {
+       .name           = "s3c2410-wdt",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(s3c_wdt_resource),
+       .resource       = s3c_wdt_resource,
+};
+#endif /* CONFIG_S3C_DEV_WDT */
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct resource s3c64xx_spi0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_SPI0),
+};
+
+struct platform_device s3c64xx_device_spi0 = {
+       .name           = "s3c6410-spi",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c64xx_spi0_resource),
+       .resource       = s3c64xx_spi0_resource,
+       .dev = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
+                                               int num_cs)
+{
+       struct s3c64xx_spi_info pd;
+
+       /* Reject invalid configuration */
+       if (!num_cs || src_clk_nr < 0) {
+               pr_err("%s: Invalid SPI configuration\n", __func__);
+               return;
+       }
+
+       pd.num_cs = num_cs;
+       pd.src_clk_nr = src_clk_nr;
+       pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
+
+       s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
+}
+#endif /* CONFIG_S3C64XX_DEV_SPI0 */
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct resource s3c64xx_spi1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_SPI1),
+};
+
+struct platform_device s3c64xx_device_spi1 = {
+       .name           = "s3c6410-spi",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(s3c64xx_spi1_resource),
+       .resource       = s3c64xx_spi1_resource,
+       .dev = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
+                                               int num_cs)
+{
+       struct s3c64xx_spi_info pd;
+
+       /* Reject invalid configuration */
+       if (!num_cs || src_clk_nr < 0) {
+               pr_err("%s: Invalid SPI configuration\n", __func__);
+               return;
+       }
+
+       pd.num_cs = num_cs;
+       pd.src_clk_nr = src_clk_nr;
+       pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
+
+       s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
+}
+#endif /* CONFIG_S3C64XX_DEV_SPI1 */
+
+#ifdef CONFIG_S3C64XX_DEV_SPI2
+static struct resource s3c64xx_spi2_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_SPI2),
+};
+
+struct platform_device s3c64xx_device_spi2 = {
+       .name           = "s3c6410-spi",
+       .id             = 2,
+       .num_resources  = ARRAY_SIZE(s3c64xx_spi2_resource),
+       .resource       = s3c64xx_spi2_resource,
+       .dev = {
+               .dma_mask               = &samsung_device_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
+                                               int num_cs)
+{
+       struct s3c64xx_spi_info pd;
+
+       /* Reject invalid configuration */
+       if (!num_cs || src_clk_nr < 0) {
+               pr_err("%s: Invalid SPI configuration\n", __func__);
+               return;
+       }
+
+       pd.num_cs = num_cs;
+       pd.src_clk_nr = src_clk_nr;
+       pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
+
+       s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
+}
+#endif /* CONFIG_S3C64XX_DEV_SPI2 */
diff --git a/arch/arm/mach-s3c/devs.h b/arch/arm/mach-s3c/devs.h
new file mode 100644 (file)
index 0000000..02b0c57
--- /dev/null
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * Copyright (c) 2004 Simtec Electronics
+ * Ben Dooks <ben@simtec.co.uk>
+ *
+ * Header file for s3c2410 standard platform devices
+ */
+
+#ifndef __PLAT_DEVS_H
+#define __PLAT_DEVS_H __FILE__
+
+#include <linux/platform_device.h>
+
+struct s3c24xx_uart_resources {
+       struct resource         *resources;
+       unsigned long            nr_resources;
+};
+
+extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
+extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
+
+extern struct platform_device *s3c24xx_uart_devs[];
+extern struct platform_device *s3c24xx_uart_src[];
+
+extern struct platform_device s3c64xx_device_ac97;
+extern struct platform_device s3c64xx_device_iis0;
+extern struct platform_device s3c64xx_device_iis1;
+extern struct platform_device s3c64xx_device_iisv4;
+extern struct platform_device s3c64xx_device_onenand1;
+extern struct platform_device s3c64xx_device_pcm0;
+extern struct platform_device s3c64xx_device_pcm1;
+extern struct platform_device s3c64xx_device_spi0;
+extern struct platform_device s3c64xx_device_spi1;
+extern struct platform_device s3c64xx_device_spi2;
+
+extern struct platform_device s3c_device_adc;
+extern struct platform_device s3c_device_cfcon;
+extern struct platform_device s3c_device_fb;
+extern struct platform_device s3c_device_hwmon;
+extern struct platform_device s3c_device_hsmmc0;
+extern struct platform_device s3c_device_hsmmc1;
+extern struct platform_device s3c_device_hsmmc2;
+extern struct platform_device s3c_device_hsmmc3;
+extern struct platform_device s3c_device_i2c0;
+extern struct platform_device s3c_device_i2c1;
+extern struct platform_device s3c_device_i2c2;
+extern struct platform_device s3c_device_i2c3;
+extern struct platform_device s3c_device_i2c4;
+extern struct platform_device s3c_device_i2c5;
+extern struct platform_device s3c_device_i2c6;
+extern struct platform_device s3c_device_i2c7;
+extern struct platform_device s3c_device_iis;
+extern struct platform_device s3c_device_lcd;
+extern struct platform_device s3c_device_nand;
+extern struct platform_device s3c_device_ohci;
+extern struct platform_device s3c_device_onenand;
+extern struct platform_device s3c_device_rtc;
+extern struct platform_device s3c_device_sdi;
+extern struct platform_device s3c_device_spi0;
+extern struct platform_device s3c_device_spi1;
+extern struct platform_device s3c_device_ts;
+extern struct platform_device s3c_device_timer[];
+extern struct platform_device s3c_device_usbgadget;
+extern struct platform_device s3c_device_usb_hsotg;
+extern struct platform_device s3c_device_usb_hsudc;
+extern struct platform_device s3c_device_wdt;
+
+extern struct platform_device samsung_asoc_idma;
+extern struct platform_device samsung_device_keypad;
+extern struct platform_device samsung_device_pwm;
+
+/* s3c2440 specific devices */
+
+#ifdef CONFIG_CPU_S3C2440
+
+extern struct platform_device s3c_device_camif;
+extern struct platform_device s3c_device_ac97;
+
+#endif
+
+/**
+ * s3c_set_platdata() - helper for setting platform data
+ * @pd: The default platform data for this device.
+ * @pdsize: The size of the platform data.
+ * @pdev: Pointer to the device to fill in.
+ *
+ * This helper replaces a number of calls that copy and then set the
+ * platform data of the device.
+ */
+extern void *s3c_set_platdata(void *pd, size_t pdsize,
+                             struct platform_device *pdev);
+
+#endif /* __PLAT_DEVS_H */
diff --git a/arch/arm/mach-s3c/dma-s3c24xx.h b/arch/arm/mach-s3c/dma-s3c24xx.h
new file mode 100644 (file)
index 0000000..25fc9c2
--- /dev/null
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2003-2006 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * Samsung S3C24XX DMA support
+ */
+
+#ifndef __ASM_ARCH_DMA_H
+#define __ASM_ARCH_DMA_H __FILE__
+
+#include <linux/device.h>
+
+/* We use `virtual` dma channels to hide the fact we have only a limited
+ * number of DMA channels, and not of all of them (dependent on the device)
+ * can be attached to any DMA source. We therefore let the DMA core handle
+ * the allocation of hardware channels to clients.
+*/
+
+enum dma_ch {
+       DMACH_XD0 = 0,
+       DMACH_XD1,
+       DMACH_SDI,
+       DMACH_SPI0,
+       DMACH_SPI1,
+       DMACH_UART0,
+       DMACH_UART1,
+       DMACH_UART2,
+       DMACH_TIMER,
+       DMACH_I2S_IN,
+       DMACH_I2S_OUT,
+       DMACH_PCM_IN,
+       DMACH_PCM_OUT,
+       DMACH_MIC_IN,
+       DMACH_USB_EP1,
+       DMACH_USB_EP2,
+       DMACH_USB_EP3,
+       DMACH_USB_EP4,
+       DMACH_UART0_SRC2,       /* s3c2412 second uart sources */
+       DMACH_UART1_SRC2,
+       DMACH_UART2_SRC2,
+       DMACH_UART3,            /* s3c2443 has extra uart */
+       DMACH_UART3_SRC2,
+       DMACH_SPI0_TX,          /* s3c2443/2416/2450 hsspi0 */
+       DMACH_SPI0_RX,          /* s3c2443/2416/2450 hsspi0 */
+       DMACH_SPI1_TX,          /* s3c2443/2450 hsspi1 */
+       DMACH_SPI1_RX,          /* s3c2443/2450 hsspi1 */
+       DMACH_MAX,              /* the end entry */
+};
+
+#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-s3c/dma-s3c64xx.h b/arch/arm/mach-s3c/dma-s3c64xx.h
new file mode 100644 (file)
index 0000000..40ca8de
--- /dev/null
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* linux/arch/arm/mach-s3c6400/include/mach/dma.h
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C6400 - DMA support
+ */
+
+#ifndef __ASM_ARCH_DMA_H
+#define __ASM_ARCH_DMA_H __FILE__
+
+#define S3C64XX_DMA_CHAN(name)         ((unsigned long)(name))
+
+/* DMA0/SDMA0 */
+#define DMACH_UART0            "uart0_tx"
+#define DMACH_UART0_SRC2       "uart0_rx"
+#define DMACH_UART1            "uart1_tx"
+#define DMACH_UART1_SRC2       "uart1_rx"
+#define DMACH_UART2            "uart2_tx"
+#define DMACH_UART2_SRC2       "uart2_rx"
+#define DMACH_UART3            "uart3_tx"
+#define DMACH_UART3_SRC2       "uart3_rx"
+#define DMACH_PCM0_TX          "pcm0_tx"
+#define DMACH_PCM0_RX          "pcm0_rx"
+#define DMACH_I2S0_OUT         "i2s0_tx"
+#define DMACH_I2S0_IN          "i2s0_rx"
+#define DMACH_SPI0_TX          S3C64XX_DMA_CHAN("spi0_tx")
+#define DMACH_SPI0_RX          S3C64XX_DMA_CHAN("spi0_rx")
+#define DMACH_HSI_I2SV40_TX    "i2s2_tx"
+#define DMACH_HSI_I2SV40_RX    "i2s2_rx"
+
+/* DMA1/SDMA1 */
+#define DMACH_PCM1_TX          "pcm1_tx"
+#define DMACH_PCM1_RX          "pcm1_rx"
+#define DMACH_I2S1_OUT         "i2s1_tx"
+#define DMACH_I2S1_IN          "i2s1_rx"
+#define DMACH_SPI1_TX          S3C64XX_DMA_CHAN("spi1_tx")
+#define DMACH_SPI1_RX          S3C64XX_DMA_CHAN("spi1_rx")
+#define DMACH_AC97_PCMOUT      "ac97_out"
+#define DMACH_AC97_PCMIN       "ac97_in"
+#define DMACH_AC97_MICIN       "ac97_mic"
+#define DMACH_PWM              "pwm"
+#define DMACH_IRDA             "irda"
+#define DMACH_EXTERNAL         "external"
+#define DMACH_SECURITY_RX      "sec_rx"
+#define DMACH_SECURITY_TX      "sec_tx"
+
+enum dma_ch {
+       DMACH_MAX = 32
+};
+
+#include <linux/amba/pl08x.h>
+
+#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c/dma.h b/arch/arm/mach-s3c/dma.h
new file mode 100644 (file)
index 0000000..59a4578
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "dma-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "dma-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/fb-core-s3c24xx.h b/arch/arm/mach-s3c/fb-core-s3c24xx.h
new file mode 100644 (file)
index 0000000..0e07f3b
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2010 Samsung Electronics Co., Ltd.
+ *     Pawel Osciak <p.osciak@samsung.com>
+ *
+ * Samsung framebuffer driver core functions
+ */
+#ifndef __ASM_PLAT_FB_CORE_S3C24XX_H
+#define __ASM_PLAT_FB_CORE_S3C24XX_H __FILE__
+
+/*
+ * These functions are only for use with the core support code, such as
+ * the CPU-specific initialization code.
+ */
+
+/* Re-define device name depending on support. */
+static inline void s3c_fb_setname(char *name)
+{
+#ifdef CONFIG_S3C_DEV_FB
+       s3c_device_fb.name = name;
+#endif
+}
+
+#endif /* __ASM_PLAT_FB_CORE_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/fb.h b/arch/arm/mach-s3c/fb.h
new file mode 100644 (file)
index 0000000..615d381
--- /dev/null
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C - FB platform data definitions
+ */
+
+#ifndef __PLAT_S3C_FB_H
+#define __PLAT_S3C_FB_H __FILE__
+
+#include <linux/platform_data/video_s3c.h>
+
+/**
+ * s3c_fb_set_platdata() - Setup the FB device with platform data.
+ * @pd: The platform data to set. The data is copied from the passed structure
+ *      so the machine data can mark the data __initdata so that any unused
+ *      machines will end up dumping their data at runtime.
+ */
+extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
+
+/**
+ * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
+ *
+ * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
+ */
+extern void s3c64xx_fb_gpio_setup_24bpp(void);
+
+#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/mach-s3c/gpio-cfg-helpers.h b/arch/arm/mach-s3c/gpio-cfg-helpers.h
new file mode 100644 (file)
index 0000000..db0c56f
--- /dev/null
@@ -0,0 +1,159 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * Samsung Platform - GPIO pin configuration helper definitions
+ */
+
+/* This is meant for core cpu support, machine or other driver files
+ * should not be including this header.
+ */
+
+#ifndef __PLAT_GPIO_CFG_HELPERS_H
+#define __PLAT_GPIO_CFG_HELPERS_H __FILE__
+
+/* As a note, all gpio configuration functions are entered exclusively, either
+ * with the relevant lock held or the system prevented from doing anything else
+ * by disabling interrupts.
+*/
+
+static inline int samsung_gpio_do_setcfg(struct samsung_gpio_chip *chip,
+                                        unsigned int off, unsigned int config)
+{
+       return (chip->config->set_config)(chip, off, config);
+}
+
+static inline unsigned samsung_gpio_do_getcfg(struct samsung_gpio_chip *chip,
+                                             unsigned int off)
+{
+       return (chip->config->get_config)(chip, off);
+}
+
+static inline int samsung_gpio_do_setpull(struct samsung_gpio_chip *chip,
+                                         unsigned int off, samsung_gpio_pull_t pull)
+{
+       return (chip->config->set_pull)(chip, off, pull);
+}
+
+static inline samsung_gpio_pull_t samsung_gpio_do_getpull(struct samsung_gpio_chip *chip,
+                                                         unsigned int off)
+{
+       return chip->config->get_pull(chip, off);
+}
+
+/* Pull-{up,down} resistor controls.
+ *
+ * S3C2410,S3C2440 = Pull-UP,
+ * S3C2412,S3C2413 = Pull-Down
+ * S3C6400,S3C6410 = Pull-Both [None,Down,Up,Undef]
+ * S3C2443 = Pull-Both [not same as S3C6400]
+ */
+
+/**
+ * s3c24xx_gpio_setpull_1up() - Pull configuration for choice of up or none.
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ * @param: pull: The pull mode being requested.
+ *
+ * This is a helper function for the case where we have GPIOs with one
+ * bit configuring the presence of a pull-up resistor.
+ */
+extern int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip,
+                                   unsigned int off, samsung_gpio_pull_t pull);
+
+/**
+ * s3c24xx_gpio_setpull_1down() - Pull configuration for choice of down or none
+ * @chip: The gpio chip that is being configured
+ * @off: The offset for the GPIO being configured
+ * @param: pull: The pull mode being requested
+ *
+ * This is a helper function for the case where we have GPIOs with one
+ * bit configuring the presence of a pull-down resistor.
+ */
+extern int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip,
+                                     unsigned int off, samsung_gpio_pull_t pull);
+
+/**
+ * samsung_gpio_setpull_upown() - Pull configuration for choice of up,
+ * down or none
+ *
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ * @param: pull: The pull mode being requested.
+ *
+ * This is a helper function for the case where we have GPIOs with two
+ * bits configuring the presence of a pull resistor, in the following
+ * order:
+ *     00 = No pull resistor connected
+ *     01 = Pull-up resistor connected
+ *     10 = Pull-down resistor connected
+ */
+extern int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
+                                      unsigned int off, samsung_gpio_pull_t pull);
+
+/**
+ * samsung_gpio_getpull_updown() - Get configuration for choice of up,
+ * down or none
+ *
+ * @chip: The gpio chip that the GPIO pin belongs to
+ * @off: The offset to the pin to get the configuration of.
+ *
+ * This helper function reads the state of the pull-{up,down} resistor
+ * for the given GPIO in the same case as samsung_gpio_setpull_upown.
+*/
+extern samsung_gpio_pull_t samsung_gpio_getpull_updown(struct samsung_gpio_chip *chip,
+                                                      unsigned int off);
+
+/**
+ * s3c24xx_gpio_getpull_1up() - Get configuration for choice of up or none
+ * @chip: The gpio chip that the GPIO pin belongs to
+ * @off: The offset to the pin to get the configuration of.
+ *
+ * This helper function reads the state of the pull-up resistor for the
+ * given GPIO in the same case as s3c24xx_gpio_setpull_1up.
+*/
+extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1up(struct samsung_gpio_chip *chip,
+                                                   unsigned int off);
+
+/**
+ * s3c24xx_gpio_getpull_1down() - Get configuration for choice of down or none
+ * @chip: The gpio chip that the GPIO pin belongs to
+ * @off: The offset to the pin to get the configuration of.
+ *
+ * This helper function reads the state of the pull-down resistor for the
+ * given GPIO in the same case as s3c24xx_gpio_setpull_1down.
+*/
+extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1down(struct samsung_gpio_chip *chip,
+                                                     unsigned int off);
+
+/**
+ * s3c2443_gpio_setpull() - Pull configuration for s3c2443.
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ * @param: pull: The pull mode being requested.
+ *
+ * This is a helper function for the case where we have GPIOs with two
+ * bits configuring the presence of a pull resistor, in the following
+ * order:
+ *     00 = Pull-up resistor connected
+ *     10 = Pull-down resistor connected
+ *     x1 = No pull up resistor
+ */
+extern int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip,
+                               unsigned int off, samsung_gpio_pull_t pull);
+
+/**
+ * s3c2443_gpio_getpull() - Get configuration for s3c2443 pull resistors
+ * @chip: The gpio chip that the GPIO pin belongs to.
+ * @off: The offset to the pin to get the configuration of.
+ *
+ * This helper function reads the state of the pull-{up,down} resistor for the
+ * given GPIO in the same case as samsung_gpio_setpull_upown.
+*/
+extern samsung_gpio_pull_t s3c2443_gpio_getpull(struct samsung_gpio_chip *chip,
+                                               unsigned int off);
+
+#endif /* __PLAT_GPIO_CFG_HELPERS_H */
diff --git a/arch/arm/mach-s3c/gpio-cfg.h b/arch/arm/mach-s3c/gpio-cfg.h
new file mode 100644 (file)
index 0000000..469c220
--- /dev/null
@@ -0,0 +1,178 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C Platform - GPIO pin configuration
+ */
+
+/* This file contains the necessary definitions to get the basic gpio
+ * pin configuration done such as setting a pin to input or output or
+ * changing the pull-{up,down} configurations.
+ */
+
+/* Note, this interface is being added to the s3c64xx arch first and will
+ * be added to the s3c24xx systems later.
+ */
+
+#ifndef __PLAT_GPIO_CFG_H
+#define __PLAT_GPIO_CFG_H __FILE__
+
+#include <linux/types.h>
+
+typedef unsigned int __bitwise samsung_gpio_pull_t;
+
+/* forward declaration if gpio-core.h hasn't been included */
+struct samsung_gpio_chip;
+
+/**
+ * struct samsung_gpio_cfg GPIO configuration
+ * @cfg_eint: Configuration setting when used for external interrupt source
+ * @get_pull: Read the current pull configuration for the GPIO
+ * @set_pull: Set the current pull configuration for the GPIO
+ * @set_config: Set the current configuration for the GPIO
+ * @get_config: Read the current configuration for the GPIO
+ *
+ * Each chip can have more than one type of GPIO bank available and some
+ * have different capabilites even when they have the same control register
+ * layouts. Provide an point to vector control routine and provide any
+ * per-bank configuration information that other systems such as the
+ * external interrupt code will need.
+ *
+ * @sa samsung_gpio_cfgpin
+ * @sa s3c_gpio_getcfg
+ * @sa s3c_gpio_setpull
+ * @sa s3c_gpio_getpull
+ */
+struct samsung_gpio_cfg {
+       unsigned int    cfg_eint;
+
+       samsung_gpio_pull_t     (*get_pull)(struct samsung_gpio_chip *chip, unsigned offs);
+       int             (*set_pull)(struct samsung_gpio_chip *chip, unsigned offs,
+                                   samsung_gpio_pull_t pull);
+
+       unsigned (*get_config)(struct samsung_gpio_chip *chip, unsigned offs);
+       int      (*set_config)(struct samsung_gpio_chip *chip, unsigned offs,
+                              unsigned config);
+};
+
+#define S3C_GPIO_SPECIAL_MARK  (0xfffffff0)
+#define S3C_GPIO_SPECIAL(x)    (S3C_GPIO_SPECIAL_MARK | (x))
+
+/* Defines for generic pin configurations */
+#define S3C_GPIO_INPUT (S3C_GPIO_SPECIAL(0))
+#define S3C_GPIO_OUTPUT        (S3C_GPIO_SPECIAL(1))
+#define S3C_GPIO_SFN(x)        (S3C_GPIO_SPECIAL(x))
+
+#define samsung_gpio_is_cfg_special(_cfg) \
+       (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
+
+/**
+ * s3c_gpio_cfgpin() - Change the GPIO function of a pin.
+ * @pin pin The pin number to configure.
+ * @to to The configuration for the pin's function.
+ *
+ * Configure which function is actually connected to the external
+ * pin, such as an gpio input, output or some form of special function
+ * connected to an internal peripheral block.
+ *
+ * The @to parameter can be one of the generic S3C_GPIO_INPUT, S3C_GPIO_OUTPUT
+ * or S3C_GPIO_SFN() to indicate one of the possible values that the helper
+ * will then generate the correct bit mask and shift for the configuration.
+ *
+ * If a bank of GPIOs all needs to be set to special-function 2, then
+ * the following code will work:
+ *
+ *     for (gpio = start; gpio < end; gpio++)
+ *             s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+ *
+ * The @to parameter can also be a specific value already shifted to the
+ * correct position in the control register, although these are discouraged
+ * in newer kernels and are only being kept for compatibility.
+ */
+extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
+
+/**
+ * s3c_gpio_getcfg - Read the current function for a GPIO pin
+ * @pin: The pin to read the configuration value for.
+ *
+ * Read the configuration state of the given @pin, returning a value that
+ * could be passed back to s3c_gpio_cfgpin().
+ *
+ * @sa s3c_gpio_cfgpin
+ */
+extern unsigned s3c_gpio_getcfg(unsigned int pin);
+
+/**
+ * s3c_gpio_cfgpin_range() - Change the GPIO function for configuring pin range
+ * @start: The pin number to start at
+ * @nr: The number of pins to configure from @start.
+ * @cfg: The configuration for the pin's function
+ *
+ * Call s3c_gpio_cfgpin() for the @nr pins starting at @start.
+ *
+ * @sa s3c_gpio_cfgpin.
+ */
+extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
+                                unsigned int cfg);
+
+/* Define values for the pull-{up,down} available for each gpio pin.
+ *
+ * These values control the state of the weak pull-{up,down} resistors
+ * available on most pins on the S3C series. Not all chips support both
+ * up or down settings, and it may be dependent on the chip that is being
+ * used to whether the particular mode is available.
+ */
+#define S3C_GPIO_PULL_NONE     ((__force samsung_gpio_pull_t)0x00)
+#define S3C_GPIO_PULL_DOWN     ((__force samsung_gpio_pull_t)0x01)
+#define S3C_GPIO_PULL_UP       ((__force samsung_gpio_pull_t)0x02)
+
+/**
+ * s3c_gpio_setpull() - set the state of a gpio pin pull resistor
+ * @pin: The pin number to configure the pull resistor.
+ * @pull: The configuration for the pull resistor.
+ *
+ * This function sets the state of the pull-{up,down} resistor for the
+ * specified pin. It will return 0 if successful, or a negative error
+ * code if the pin cannot support the requested pull setting.
+ *
+ * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP.
+*/
+extern int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull);
+
+/**
+ * s3c_gpio_getpull() - get the pull resistor state of a gpio pin
+ * @pin: The pin number to get the settings for
+ *
+ * Read the pull resistor value for the specified pin.
+*/
+extern samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
+
+/* configure `all` aspects of an gpio */
+
+/**
+ * s3c_gpio_cfgall_range() - configure range of gpio functtion and pull.
+ * @start: The gpio number to start at.
+ * @nr: The number of gpio to configure from @start.
+ * @cfg: The configuration to use
+ * @pull: The pull setting to use.
+ *
+ * Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting
+ * @gpio and running for @size.
+ *
+ * @sa s3c_gpio_cfgpin
+ * @sa s3c_gpio_setpull
+ * @sa s3c_gpio_cfgpin_range
+ */
+extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
+                                unsigned int cfg, samsung_gpio_pull_t pull);
+
+static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size,
+                                          unsigned int cfg)
+{
+       return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE);
+}
+
+#endif /* __PLAT_GPIO_CFG_H */
diff --git a/arch/arm/mach-s3c/gpio-core.h b/arch/arm/mach-s3c/gpio-core.h
new file mode 100644 (file)
index 0000000..b361c8c
--- /dev/null
@@ -0,0 +1,142 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C Platform - GPIO core
+ */
+
+#ifndef __PLAT_SAMSUNG_GPIO_CORE_H
+#define __PLAT_SAMSUNG_GPIO_CORE_H
+
+/* Bring in machine-local definitions, especially S3C_GPIO_END */
+#include "gpio-samsung.h"
+#include <linux/gpio/driver.h>
+
+#define GPIOCON_OFF    (0x00)
+#define GPIODAT_OFF    (0x04)
+
+#define con_4bit_shift(__off) ((__off) * 4)
+
+/* Define the core gpiolib support functions that the s3c platforms may
+ * need to extend or change depending on the hardware and the s3c chip
+ * selected at build or found at run time.
+ *
+ * These definitions are not intended for driver inclusion, there is
+ * nothing here that should not live outside the platform and core
+ * specific code.
+*/
+
+struct samsung_gpio_chip;
+
+/**
+ * struct samsung_gpio_pm - power management (suspend/resume) information
+ * @save: Routine to save the state of the GPIO block
+ * @resume: Routine to resume the GPIO block.
+ */
+struct samsung_gpio_pm {
+       void (*save)(struct samsung_gpio_chip *chip);
+       void (*resume)(struct samsung_gpio_chip *chip);
+};
+
+struct samsung_gpio_cfg;
+
+/**
+ * struct samsung_gpio_chip - wrapper for specific implementation of gpio
+ * @chip: The chip structure to be exported via gpiolib.
+ * @base: The base pointer to the gpio configuration registers.
+ * @group: The group register number for gpio interrupt support.
+ * @irq_base: The base irq number.
+ * @config: special function and pull-resistor control information.
+ * @lock: Lock for exclusive access to this gpio bank.
+ * @pm_save: Save information for suspend/resume support.
+ * @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not.
+ *
+ * This wrapper provides the necessary information for the Samsung
+ * specific gpios being registered with gpiolib.
+ *
+ * The lock protects each gpio bank from multiple access of the shared
+ * configuration registers, or from reading of data whilst another thread
+ * is writing to the register set.
+ *
+ * Each chip has its own lock to avoid any  contention between different
+ * CPU cores trying to get one lock for different GPIO banks, where each
+ * bank of GPIO has its own register space and configuration registers.
+ */
+struct samsung_gpio_chip {
+       struct gpio_chip        chip;
+       struct samsung_gpio_cfg *config;
+       struct samsung_gpio_pm  *pm;
+       void __iomem            *base;
+       int                     irq_base;
+       int                     group;
+       spinlock_t               lock;
+#ifdef CONFIG_PM
+       u32                     pm_save[4];
+#endif
+       u32                     bitmap_gpio_int;
+};
+
+static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
+{
+       return container_of(gpc, struct samsung_gpio_chip, chip);
+}
+
+/**
+ * samsung_gpiolib_to_irq - convert gpio pin to irq number
+ * @chip: The gpio chip that the pin belongs to.
+ * @offset: The offset of the pin in the chip.
+ *
+ * This helper returns the irq number calculated from the chip->irq_base and
+ * the provided offset.
+ */
+extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
+
+/* exported for core SoC support to change */
+extern struct samsung_gpio_cfg s3c24xx_gpiocfg_default;
+
+#ifdef CONFIG_S3C_GPIO_TRACK
+extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
+
+static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip)
+{
+       return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
+}
+#else
+/* machine specific code should provide samsung_gpiolib_getchip */
+
+extern struct samsung_gpio_chip s3c24xx_gpios[];
+
+static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int pin)
+{
+       struct samsung_gpio_chip *chip;
+
+       if (pin > S3C_GPIO_END)
+               return NULL;
+
+       chip = &s3c24xx_gpios[pin/32];
+       return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL;
+}
+
+static inline void s3c_gpiolib_track(struct samsung_gpio_chip *chip) { }
+#endif
+
+#ifdef CONFIG_PM
+extern struct samsung_gpio_pm samsung_gpio_pm_1bit;
+extern struct samsung_gpio_pm samsung_gpio_pm_2bit;
+extern struct samsung_gpio_pm samsung_gpio_pm_4bit;
+#define __gpio_pm(x) x
+#else
+#define samsung_gpio_pm_1bit NULL
+#define samsung_gpio_pm_2bit NULL
+#define samsung_gpio_pm_4bit NULL
+#define __gpio_pm(x) NULL
+
+#endif /* CONFIG_PM */
+
+/* locking wrappers to deal with multiple access to the same gpio bank */
+#define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl)
+#define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl)
+
+#endif /* __PLAT_SAMSUNG_GPIO_CORE_H */
diff --git a/arch/arm/mach-s3c/gpio-samsung-s3c24xx.h b/arch/arm/mach-s3c/gpio-samsung-s3c24xx.h
new file mode 100644 (file)
index 0000000..c29fdc9
--- /dev/null
@@ -0,0 +1,103 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - GPIO lib support
+ */
+
+/* some boards require extra gpio capacity to support external
+ * devices that need GPIO.
+ */
+
+#ifndef GPIO_SAMSUNG_S3C24XX_H
+#define GPIO_SAMSUNG_S3C24XX_H
+
+#include "map.h"
+
+/*
+ * GPIO sizes for various SoCs:
+ *
+ *   2410 2412 2440 2443 2416
+ *             2442
+ *   ---- ---- ---- ---- ----
+ * A  23   22   25   16   27
+ * B  11   11   11   11   11
+ * C  16   16   16   16   16
+ * D  16   16   16   16   16
+ * E  16   16   16   16   16
+ * F  8    8    8    8    8
+ * G  16   16   16   16   8
+ * H  11   11   11   15   15
+ * J  --   --   13   16   --
+ * K  --   --   --   --   16
+ * L  --   --   --   15   14
+ * M  --   --   --   2    2
+ */
+
+/* GPIO bank sizes */
+
+#define S3C2410_GPIO_A_NR      (32)
+#define S3C2410_GPIO_B_NR      (32)
+#define S3C2410_GPIO_C_NR      (32)
+#define S3C2410_GPIO_D_NR      (32)
+#define S3C2410_GPIO_E_NR      (32)
+#define S3C2410_GPIO_F_NR      (32)
+#define S3C2410_GPIO_G_NR      (32)
+#define S3C2410_GPIO_H_NR      (32)
+#define S3C2410_GPIO_J_NR      (32)    /* technically 16. */
+#define S3C2410_GPIO_K_NR      (32)    /* technically 16. */
+#define S3C2410_GPIO_L_NR      (32)    /* technically 15. */
+#define S3C2410_GPIO_M_NR      (32)    /* technically 2. */
+
+#if CONFIG_S3C_GPIO_SPACE != 0
+#error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
+#endif
+
+#define S3C2410_GPIO_NEXT(__gpio) \
+       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0)
+
+#ifndef __ASSEMBLY__
+
+enum s3c_gpio_number {
+       S3C2410_GPIO_A_START = 0,
+       S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A),
+       S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B),
+       S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C),
+       S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D),
+       S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
+       S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
+       S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
+       S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
+       S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J),
+       S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K),
+       S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L),
+};
+
+#endif /* __ASSEMBLY__ */
+
+/* S3C2410 GPIO number definitions. */
+
+#define S3C2410_GPA(_nr)       (S3C2410_GPIO_A_START + (_nr))
+#define S3C2410_GPB(_nr)       (S3C2410_GPIO_B_START + (_nr))
+#define S3C2410_GPC(_nr)       (S3C2410_GPIO_C_START + (_nr))
+#define S3C2410_GPD(_nr)       (S3C2410_GPIO_D_START + (_nr))
+#define S3C2410_GPE(_nr)       (S3C2410_GPIO_E_START + (_nr))
+#define S3C2410_GPF(_nr)       (S3C2410_GPIO_F_START + (_nr))
+#define S3C2410_GPG(_nr)       (S3C2410_GPIO_G_START + (_nr))
+#define S3C2410_GPH(_nr)       (S3C2410_GPIO_H_START + (_nr))
+#define S3C2410_GPJ(_nr)       (S3C2410_GPIO_J_START + (_nr))
+#define S3C2410_GPK(_nr)       (S3C2410_GPIO_K_START + (_nr))
+#define S3C2410_GPL(_nr)       (S3C2410_GPIO_L_START + (_nr))
+#define S3C2410_GPM(_nr)       (S3C2410_GPIO_M_START + (_nr))
+
+#ifdef CONFIG_CPU_S3C244X
+#define S3C_GPIO_END   (S3C2410_GPJ(0) + 32)
+#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
+#define S3C_GPIO_END   (S3C2410_GPM(0) + 32)
+#else
+#define S3C_GPIO_END   (S3C2410_GPH(0) + 32)
+#endif
+
+#endif /* GPIO_SAMSUNG_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/gpio-samsung-s3c64xx.h b/arch/arm/mach-s3c/gpio-samsung-s3c64xx.h
new file mode 100644 (file)
index 0000000..8ed144a
--- /dev/null
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C6400 - GPIO lib support
+ */
+
+#ifndef GPIO_SAMSUNG_S3C64XX_H
+#define GPIO_SAMSUNG_S3C64XX_H
+
+#ifdef CONFIG_GPIO_SAMSUNG
+
+/* GPIO bank sizes */
+#define S3C64XX_GPIO_A_NR      (8)
+#define S3C64XX_GPIO_B_NR      (7)
+#define S3C64XX_GPIO_C_NR      (8)
+#define S3C64XX_GPIO_D_NR      (5)
+#define S3C64XX_GPIO_E_NR      (5)
+#define S3C64XX_GPIO_F_NR      (16)
+#define S3C64XX_GPIO_G_NR      (7)
+#define S3C64XX_GPIO_H_NR      (10)
+#define S3C64XX_GPIO_I_NR      (16)
+#define S3C64XX_GPIO_J_NR      (12)
+#define S3C64XX_GPIO_K_NR      (16)
+#define S3C64XX_GPIO_L_NR      (15)
+#define S3C64XX_GPIO_M_NR      (6)
+#define S3C64XX_GPIO_N_NR      (16)
+#define S3C64XX_GPIO_O_NR      (16)
+#define S3C64XX_GPIO_P_NR      (15)
+#define S3C64XX_GPIO_Q_NR      (9)
+
+/* GPIO bank numbes */
+
+/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
+ * space for debugging purposes so that any accidental
+ * change from one gpio bank to another can be caught.
+*/
+
+#define S3C64XX_GPIO_NEXT(__gpio) \
+       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
+
+enum s3c_gpio_number {
+       S3C64XX_GPIO_A_START = 0,
+       S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
+       S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
+       S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
+       S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
+       S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
+       S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
+       S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
+       S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
+       S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
+       S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
+       S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
+       S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
+       S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
+       S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
+       S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
+       S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
+};
+
+/* S3C64XX GPIO number definitions. */
+
+#define S3C64XX_GPA(_nr)       (S3C64XX_GPIO_A_START + (_nr))
+#define S3C64XX_GPB(_nr)       (S3C64XX_GPIO_B_START + (_nr))
+#define S3C64XX_GPC(_nr)       (S3C64XX_GPIO_C_START + (_nr))
+#define S3C64XX_GPD(_nr)       (S3C64XX_GPIO_D_START + (_nr))
+#define S3C64XX_GPE(_nr)       (S3C64XX_GPIO_E_START + (_nr))
+#define S3C64XX_GPF(_nr)       (S3C64XX_GPIO_F_START + (_nr))
+#define S3C64XX_GPG(_nr)       (S3C64XX_GPIO_G_START + (_nr))
+#define S3C64XX_GPH(_nr)       (S3C64XX_GPIO_H_START + (_nr))
+#define S3C64XX_GPI(_nr)       (S3C64XX_GPIO_I_START + (_nr))
+#define S3C64XX_GPJ(_nr)       (S3C64XX_GPIO_J_START + (_nr))
+#define S3C64XX_GPK(_nr)       (S3C64XX_GPIO_K_START + (_nr))
+#define S3C64XX_GPL(_nr)       (S3C64XX_GPIO_L_START + (_nr))
+#define S3C64XX_GPM(_nr)       (S3C64XX_GPIO_M_START + (_nr))
+#define S3C64XX_GPN(_nr)       (S3C64XX_GPIO_N_START + (_nr))
+#define S3C64XX_GPO(_nr)       (S3C64XX_GPIO_O_START + (_nr))
+#define S3C64XX_GPP(_nr)       (S3C64XX_GPIO_P_START + (_nr))
+#define S3C64XX_GPQ(_nr)       (S3C64XX_GPIO_Q_START + (_nr))
+
+/* the end of the S3C64XX specific gpios */
+#define S3C64XX_GPIO_END       (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
+#define S3C_GPIO_END           S3C64XX_GPIO_END
+
+/* define the number of gpios we need to the one after the GPQ() range */
+#define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
+
+#endif /* GPIO_SAMSUNG */
+#endif /* GPIO_SAMSUNG_S3C64XX_H */
+
diff --git a/arch/arm/mach-s3c/gpio-samsung.c b/arch/arm/mach-s3c/gpio-samsung.c
new file mode 100644 (file)
index 0000000..76ef415
--- /dev/null
@@ -0,0 +1,1324 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com/
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//      Ben Dooks <ben@simtec.co.uk>
+//      http://armlinux.simtec.co.uk/
+//
+// Samsung - GPIOlib support
+
+#include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/ioport.h>
+#include <linux/of.h>
+#include <linux/slab.h>
+#include <linux/of_address.h>
+
+#include <asm/irq.h>
+
+#include <mach/irqs.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "pm.h"
+
+int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
+                               unsigned int off, samsung_gpio_pull_t pull)
+{
+       void __iomem *reg = chip->base + 0x08;
+       int shift = off * 2;
+       u32 pup;
+
+       pup = __raw_readl(reg);
+       pup &= ~(3 << shift);
+       pup |= pull << shift;
+       __raw_writel(pup, reg);
+
+       return 0;
+}
+
+samsung_gpio_pull_t samsung_gpio_getpull_updown(struct samsung_gpio_chip *chip,
+                                               unsigned int off)
+{
+       void __iomem *reg = chip->base + 0x08;
+       int shift = off * 2;
+       u32 pup = __raw_readl(reg);
+
+       pup >>= shift;
+       pup &= 0x3;
+
+       return (__force samsung_gpio_pull_t)pup;
+}
+
+int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip,
+                        unsigned int off, samsung_gpio_pull_t pull)
+{
+       switch (pull) {
+       case S3C_GPIO_PULL_NONE:
+               pull = 0x01;
+               break;
+       case S3C_GPIO_PULL_UP:
+               pull = 0x00;
+               break;
+       case S3C_GPIO_PULL_DOWN:
+               pull = 0x02;
+               break;
+       }
+       return samsung_gpio_setpull_updown(chip, off, pull);
+}
+
+samsung_gpio_pull_t s3c2443_gpio_getpull(struct samsung_gpio_chip *chip,
+                                        unsigned int off)
+{
+       samsung_gpio_pull_t pull;
+
+       pull = samsung_gpio_getpull_updown(chip, off);
+
+       switch (pull) {
+       case 0x00:
+               pull = S3C_GPIO_PULL_UP;
+               break;
+       case 0x01:
+       case 0x03:
+               pull = S3C_GPIO_PULL_NONE;
+               break;
+       case 0x02:
+               pull = S3C_GPIO_PULL_DOWN;
+               break;
+       }
+
+       return pull;
+}
+
+static int s3c24xx_gpio_setpull_1(struct samsung_gpio_chip *chip,
+                                 unsigned int off, samsung_gpio_pull_t pull,
+                                 samsung_gpio_pull_t updown)
+{
+       void __iomem *reg = chip->base + 0x08;
+       u32 pup = __raw_readl(reg);
+
+       if (pull == updown)
+               pup &= ~(1 << off);
+       else if (pull == S3C_GPIO_PULL_NONE)
+               pup |= (1 << off);
+       else
+               return -EINVAL;
+
+       __raw_writel(pup, reg);
+       return 0;
+}
+
+static samsung_gpio_pull_t s3c24xx_gpio_getpull_1(struct samsung_gpio_chip *chip,
+                                                 unsigned int off,
+                                                 samsung_gpio_pull_t updown)
+{
+       void __iomem *reg = chip->base + 0x08;
+       u32 pup = __raw_readl(reg);
+
+       pup &= (1 << off);
+       return pup ? S3C_GPIO_PULL_NONE : updown;
+}
+
+samsung_gpio_pull_t s3c24xx_gpio_getpull_1up(struct samsung_gpio_chip *chip,
+                                            unsigned int off)
+{
+       return s3c24xx_gpio_getpull_1(chip, off, S3C_GPIO_PULL_UP);
+}
+
+int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip,
+                            unsigned int off, samsung_gpio_pull_t pull)
+{
+       return s3c24xx_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_UP);
+}
+
+samsung_gpio_pull_t s3c24xx_gpio_getpull_1down(struct samsung_gpio_chip *chip,
+                                              unsigned int off)
+{
+       return s3c24xx_gpio_getpull_1(chip, off, S3C_GPIO_PULL_DOWN);
+}
+
+int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip,
+                              unsigned int off, samsung_gpio_pull_t pull)
+{
+       return s3c24xx_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN);
+}
+
+/*
+ * samsung_gpio_setcfg_2bit - Samsung 2bit style GPIO configuration.
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ * @cfg: The configuration value to set.
+ *
+ * This helper deal with the GPIO cases where the control register
+ * has two bits of configuration per gpio, which have the following
+ * functions:
+ *     00 = input
+ *     01 = output
+ *     1x = special function
+ */
+
+static int samsung_gpio_setcfg_2bit(struct samsung_gpio_chip *chip,
+                                   unsigned int off, unsigned int cfg)
+{
+       void __iomem *reg = chip->base;
+       unsigned int shift = off * 2;
+       u32 con;
+
+       if (samsung_gpio_is_cfg_special(cfg)) {
+               cfg &= 0xf;
+               if (cfg > 3)
+                       return -EINVAL;
+
+               cfg <<= shift;
+       }
+
+       con = __raw_readl(reg);
+       con &= ~(0x3 << shift);
+       con |= cfg;
+       __raw_writel(con, reg);
+
+       return 0;
+}
+
+/*
+ * samsung_gpio_getcfg_2bit - Samsung 2bit style GPIO configuration read.
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ *
+ * The reverse of samsung_gpio_setcfg_2bit(). Will return a value which
+ * could be directly passed back to samsung_gpio_setcfg_2bit(), from the
+ * S3C_GPIO_SPECIAL() macro.
+ */
+
+static unsigned int samsung_gpio_getcfg_2bit(struct samsung_gpio_chip *chip,
+                                            unsigned int off)
+{
+       u32 con;
+
+       con = __raw_readl(chip->base);
+       con >>= off * 2;
+       con &= 3;
+
+       /* this conversion works for IN and OUT as well as special mode */
+       return S3C_GPIO_SPECIAL(con);
+}
+
+/*
+ * samsung_gpio_setcfg_4bit - Samsung 4bit single register GPIO config.
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ * @cfg: The configuration value to set.
+ *
+ * This helper deal with the GPIO cases where the control register has 4 bits
+ * of control per GPIO, generally in the form of:
+ *     0000 = Input
+ *     0001 = Output
+ *     others = Special functions (dependent on bank)
+ *
+ * Note, since the code to deal with the case where there are two control
+ * registers instead of one, we do not have a separate set of functions for
+ * each case.
+ */
+
+static int samsung_gpio_setcfg_4bit(struct samsung_gpio_chip *chip,
+                                   unsigned int off, unsigned int cfg)
+{
+       void __iomem *reg = chip->base;
+       unsigned int shift = (off & 7) * 4;
+       u32 con;
+
+       if (off < 8 && chip->chip.ngpio > 8)
+               reg -= 4;
+
+       if (samsung_gpio_is_cfg_special(cfg)) {
+               cfg &= 0xf;
+               cfg <<= shift;
+       }
+
+       con = __raw_readl(reg);
+       con &= ~(0xf << shift);
+       con |= cfg;
+       __raw_writel(con, reg);
+
+       return 0;
+}
+
+/*
+ * samsung_gpio_getcfg_4bit - Samsung 4bit single register GPIO config read.
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ *
+ * The reverse of samsung_gpio_setcfg_4bit(), turning a gpio configuration
+ * register setting into a value the software can use, such as could be passed
+ * to samsung_gpio_setcfg_4bit().
+ *
+ * @sa samsung_gpio_getcfg_2bit
+ */
+
+static unsigned samsung_gpio_getcfg_4bit(struct samsung_gpio_chip *chip,
+                                        unsigned int off)
+{
+       void __iomem *reg = chip->base;
+       unsigned int shift = (off & 7) * 4;
+       u32 con;
+
+       if (off < 8 && chip->chip.ngpio > 8)
+               reg -= 4;
+
+       con = __raw_readl(reg);
+       con >>= shift;
+       con &= 0xf;
+
+       /* this conversion works for IN and OUT as well as special mode */
+       return S3C_GPIO_SPECIAL(con);
+}
+
+#ifdef CONFIG_PLAT_S3C24XX
+/*
+ * s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A)
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ * @cfg: The configuration value to set.
+ *
+ * This helper deal with the GPIO cases where the control register
+ * has one bit of configuration for the gpio, where setting the bit
+ * means the pin is in special function mode and unset means output.
+ */
+
+static int s3c24xx_gpio_setcfg_abank(struct samsung_gpio_chip *chip,
+                                    unsigned int off, unsigned int cfg)
+{
+       void __iomem *reg = chip->base;
+       unsigned int shift = off;
+       u32 con;
+
+       if (samsung_gpio_is_cfg_special(cfg)) {
+               cfg &= 0xf;
+
+               /* Map output to 0, and SFN2 to 1 */
+               cfg -= 1;
+               if (cfg > 1)
+                       return -EINVAL;
+
+               cfg <<= shift;
+       }
+
+       con = __raw_readl(reg);
+       con &= ~(0x1 << shift);
+       con |= cfg;
+       __raw_writel(con, reg);
+
+       return 0;
+}
+
+/*
+ * s3c24xx_gpio_getcfg_abank - S3C24XX style GPIO configuration read (Bank A)
+ * @chip: The gpio chip that is being configured.
+ * @off: The offset for the GPIO being configured.
+ *
+ * The reverse of s3c24xx_gpio_setcfg_abank() turning an GPIO into a usable
+ * GPIO configuration value.
+ *
+ * @sa samsung_gpio_getcfg_2bit
+ * @sa samsung_gpio_getcfg_4bit
+ */
+
+static unsigned s3c24xx_gpio_getcfg_abank(struct samsung_gpio_chip *chip,
+                                         unsigned int off)
+{
+       u32 con;
+
+       con = __raw_readl(chip->base);
+       con >>= off;
+       con &= 1;
+       con++;
+
+       return S3C_GPIO_SFN(con);
+}
+#endif
+
+static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg,
+                                          int nr_chips)
+{
+       for (; nr_chips > 0; nr_chips--, chipcfg++) {
+               if (!chipcfg->set_config)
+                       chipcfg->set_config = samsung_gpio_setcfg_4bit;
+               if (!chipcfg->get_config)
+                       chipcfg->get_config = samsung_gpio_getcfg_4bit;
+               if (!chipcfg->set_pull)
+                       chipcfg->set_pull = samsung_gpio_setpull_updown;
+               if (!chipcfg->get_pull)
+                       chipcfg->get_pull = samsung_gpio_getpull_updown;
+       }
+}
+
+struct samsung_gpio_cfg s3c24xx_gpiocfg_default = {
+       .set_config     = samsung_gpio_setcfg_2bit,
+       .get_config     = samsung_gpio_getcfg_2bit,
+};
+
+#ifdef CONFIG_PLAT_S3C24XX
+static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = {
+       .set_config     = s3c24xx_gpio_setcfg_abank,
+       .get_config     = s3c24xx_gpio_getcfg_abank,
+};
+#endif
+
+static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
+       [0] = {
+               .cfg_eint       = 0x0,
+       },
+       [1] = {
+               .cfg_eint       = 0x3,
+       },
+       [2] = {
+               .cfg_eint       = 0x7,
+       },
+       [3] = {
+               .cfg_eint       = 0xF,
+       },
+       [4] = {
+               .cfg_eint       = 0x0,
+               .set_config     = samsung_gpio_setcfg_2bit,
+               .get_config     = samsung_gpio_getcfg_2bit,
+       },
+       [5] = {
+               .cfg_eint       = 0x2,
+               .set_config     = samsung_gpio_setcfg_2bit,
+               .get_config     = samsung_gpio_getcfg_2bit,
+       },
+       [6] = {
+               .cfg_eint       = 0x3,
+               .set_config     = samsung_gpio_setcfg_2bit,
+               .get_config     = samsung_gpio_getcfg_2bit,
+       },
+       [7] = {
+               .set_config     = samsung_gpio_setcfg_2bit,
+               .get_config     = samsung_gpio_getcfg_2bit,
+       },
+};
+
+/*
+ * Default routines for controlling GPIO, based on the original S3C24XX
+ * GPIO functions which deal with the case where each gpio bank of the
+ * chip is as following:
+ *
+ * base + 0x00: Control register, 2 bits per gpio
+ *             gpio n: 2 bits starting at (2*n)
+ *             00 = input, 01 = output, others mean special-function
+ * base + 0x04: Data register, 1 bit per gpio
+ *             bit n: data bit n
+*/
+
+static int samsung_gpiolib_2bit_input(struct gpio_chip *chip, unsigned offset)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       unsigned long flags;
+       unsigned long con;
+
+       samsung_gpio_lock(ourchip, flags);
+
+       con = __raw_readl(base + 0x00);
+       con &= ~(3 << (offset * 2));
+
+       __raw_writel(con, base + 0x00);
+
+       samsung_gpio_unlock(ourchip, flags);
+       return 0;
+}
+
+static int samsung_gpiolib_2bit_output(struct gpio_chip *chip,
+                                      unsigned offset, int value)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       unsigned long flags;
+       unsigned long dat;
+       unsigned long con;
+
+       samsung_gpio_lock(ourchip, flags);
+
+       dat = __raw_readl(base + 0x04);
+       dat &= ~(1 << offset);
+       if (value)
+               dat |= 1 << offset;
+       __raw_writel(dat, base + 0x04);
+
+       con = __raw_readl(base + 0x00);
+       con &= ~(3 << (offset * 2));
+       con |= 1 << (offset * 2);
+
+       __raw_writel(con, base + 0x00);
+       __raw_writel(dat, base + 0x04);
+
+       samsung_gpio_unlock(ourchip, flags);
+       return 0;
+}
+
+/*
+ * The samsung_gpiolib_4bit routines are to control the gpio banks where
+ * the gpio configuration register (GPxCON) has 4 bits per GPIO, as the
+ * following example:
+ *
+ * base + 0x00: Control register, 4 bits per gpio
+ *             gpio n: 4 bits starting at (4*n)
+ *             0000 = input, 0001 = output, others mean special-function
+ * base + 0x04: Data register, 1 bit per gpio
+ *             bit n: data bit n
+ *
+ * Note, since the data register is one bit per gpio and is at base + 0x4
+ * we can use samsung_gpiolib_get and samsung_gpiolib_set to change the
+ * state of the output.
+ */
+
+static int samsung_gpiolib_4bit_input(struct gpio_chip *chip,
+                                     unsigned int offset)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       unsigned long con;
+
+       con = __raw_readl(base + GPIOCON_OFF);
+       if (ourchip->bitmap_gpio_int & BIT(offset))
+               con |= 0xf << con_4bit_shift(offset);
+       else
+               con &= ~(0xf << con_4bit_shift(offset));
+       __raw_writel(con, base + GPIOCON_OFF);
+
+       pr_debug("%s: %p: CON now %08lx\n", __func__, base, con);
+
+       return 0;
+}
+
+static int samsung_gpiolib_4bit_output(struct gpio_chip *chip,
+                                      unsigned int offset, int value)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       unsigned long con;
+       unsigned long dat;
+
+       con = __raw_readl(base + GPIOCON_OFF);
+       con &= ~(0xf << con_4bit_shift(offset));
+       con |= 0x1 << con_4bit_shift(offset);
+
+       dat = __raw_readl(base + GPIODAT_OFF);
+
+       if (value)
+               dat |= 1 << offset;
+       else
+               dat &= ~(1 << offset);
+
+       __raw_writel(dat, base + GPIODAT_OFF);
+       __raw_writel(con, base + GPIOCON_OFF);
+       __raw_writel(dat, base + GPIODAT_OFF);
+
+       pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
+
+       return 0;
+}
+
+/*
+ * The next set of routines are for the case where the GPIO configuration
+ * registers are 4 bits per GPIO but there is more than one register (the
+ * bank has more than 8 GPIOs.
+ *
+ * This case is the similar to the 4 bit case, but the registers are as
+ * follows:
+ *
+ * base + 0x00: Control register, 4 bits per gpio (lower 8 GPIOs)
+ *             gpio n: 4 bits starting at (4*n)
+ *             0000 = input, 0001 = output, others mean special-function
+ * base + 0x04: Control register, 4 bits per gpio (up to 8 additions GPIOs)
+ *             gpio n: 4 bits starting at (4*n)
+ *             0000 = input, 0001 = output, others mean special-function
+ * base + 0x08: Data register, 1 bit per gpio
+ *             bit n: data bit n
+ *
+ * To allow us to use the samsung_gpiolib_get and samsung_gpiolib_set
+ * routines we store the 'base + 0x4' address so that these routines see
+ * the data register at ourchip->base + 0x04.
+ */
+
+static int samsung_gpiolib_4bit2_input(struct gpio_chip *chip,
+                                      unsigned int offset)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       void __iomem *regcon = base;
+       unsigned long con;
+
+       if (offset > 7)
+               offset -= 8;
+       else
+               regcon -= 4;
+
+       con = __raw_readl(regcon);
+       con &= ~(0xf << con_4bit_shift(offset));
+       __raw_writel(con, regcon);
+
+       pr_debug("%s: %p: CON %08lx\n", __func__, base, con);
+
+       return 0;
+}
+
+static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip,
+                                       unsigned int offset, int value)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       void __iomem *regcon = base;
+       unsigned long con;
+       unsigned long dat;
+       unsigned con_offset = offset;
+
+       if (con_offset > 7)
+               con_offset -= 8;
+       else
+               regcon -= 4;
+
+       con = __raw_readl(regcon);
+       con &= ~(0xf << con_4bit_shift(con_offset));
+       con |= 0x1 << con_4bit_shift(con_offset);
+
+       dat = __raw_readl(base + GPIODAT_OFF);
+
+       if (value)
+               dat |= 1 << offset;
+       else
+               dat &= ~(1 << offset);
+
+       __raw_writel(dat, base + GPIODAT_OFF);
+       __raw_writel(con, regcon);
+       __raw_writel(dat, base + GPIODAT_OFF);
+
+       pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
+
+       return 0;
+}
+
+#ifdef CONFIG_PLAT_S3C24XX
+/* The next set of routines are for the case of s3c24xx bank a */
+
+static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
+{
+       return -EINVAL;
+}
+
+static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
+                                       unsigned offset, int value)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       unsigned long flags;
+       unsigned long dat;
+       unsigned long con;
+
+       local_irq_save(flags);
+
+       con = __raw_readl(base + 0x00);
+       dat = __raw_readl(base + 0x04);
+
+       dat &= ~(1 << offset);
+       if (value)
+               dat |= 1 << offset;
+
+       __raw_writel(dat, base + 0x04);
+
+       con &= ~(1 << offset);
+
+       __raw_writel(con, base + 0x00);
+       __raw_writel(dat, base + 0x04);
+
+       local_irq_restore(flags);
+       return 0;
+}
+#endif
+
+static void samsung_gpiolib_set(struct gpio_chip *chip,
+                               unsigned offset, int value)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       void __iomem *base = ourchip->base;
+       unsigned long flags;
+       unsigned long dat;
+
+       samsung_gpio_lock(ourchip, flags);
+
+       dat = __raw_readl(base + 0x04);
+       dat &= ~(1 << offset);
+       if (value)
+               dat |= 1 << offset;
+       __raw_writel(dat, base + 0x04);
+
+       samsung_gpio_unlock(ourchip, flags);
+}
+
+static int samsung_gpiolib_get(struct gpio_chip *chip, unsigned offset)
+{
+       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
+       unsigned long val;
+
+       val = __raw_readl(ourchip->base + 0x04);
+       val >>= offset;
+       val &= 1;
+
+       return val;
+}
+
+/*
+ * CONFIG_S3C_GPIO_TRACK enables the tracking of the s3c specific gpios
+ * for use with the configuration calls, and other parts of the s3c gpiolib
+ * support code.
+ *
+ * Not all s3c support code will need this, as some configurations of cpu
+ * may only support one or two different configuration options and have an
+ * easy gpio to samsung_gpio_chip mapping function. If this is the case, then
+ * the machine support file should provide its own samsung_gpiolib_getchip()
+ * and any other necessary functions.
+ */
+
+#ifdef CONFIG_S3C_GPIO_TRACK
+struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
+
+static __init void s3c_gpiolib_track(struct samsung_gpio_chip *chip)
+{
+       unsigned int gpn;
+       int i;
+
+       gpn = chip->chip.base;
+       for (i = 0; i < chip->chip.ngpio; i++, gpn++) {
+               BUG_ON(gpn >= ARRAY_SIZE(s3c_gpios));
+               s3c_gpios[gpn] = chip;
+       }
+}
+#endif /* CONFIG_S3C_GPIO_TRACK */
+
+/*
+ * samsung_gpiolib_add() - add the Samsung gpio_chip.
+ * @chip: The chip to register
+ *
+ * This is a wrapper to gpiochip_add() that takes our specific gpio chip
+ * information and makes the necessary alterations for the platform and
+ * notes the information for use with the configuration systems and any
+ * other parts of the system.
+ */
+
+static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
+{
+       struct gpio_chip *gc = &chip->chip;
+       int ret;
+
+       BUG_ON(!chip->base);
+       BUG_ON(!gc->label);
+       BUG_ON(!gc->ngpio);
+
+       spin_lock_init(&chip->lock);
+
+       if (!gc->direction_input)
+               gc->direction_input = samsung_gpiolib_2bit_input;
+       if (!gc->direction_output)
+               gc->direction_output = samsung_gpiolib_2bit_output;
+       if (!gc->set)
+               gc->set = samsung_gpiolib_set;
+       if (!gc->get)
+               gc->get = samsung_gpiolib_get;
+
+#ifdef CONFIG_PM
+       if (chip->pm != NULL) {
+               if (!chip->pm->save || !chip->pm->resume)
+                       pr_err("gpio: %s has missing PM functions\n",
+                              gc->label);
+       } else
+               pr_err("gpio: %s has no PM function\n", gc->label);
+#endif
+
+       /* gpiochip_add() prints own failure message on error. */
+       ret = gpiochip_add_data(gc, chip);
+       if (ret >= 0)
+               s3c_gpiolib_track(chip);
+}
+
+static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip,
+                                            int nr_chips, void __iomem *base)
+{
+       int i;
+       struct gpio_chip *gc = &chip->chip;
+
+       for (i = 0 ; i < nr_chips; i++, chip++) {
+               /* skip banks not present on SoC */
+               if (chip->chip.base >= S3C_GPIO_END)
+                       continue;
+
+               if (!chip->config)
+                       chip->config = &s3c24xx_gpiocfg_default;
+               if (!chip->pm)
+                       chip->pm = __gpio_pm(&samsung_gpio_pm_2bit);
+               if ((base != NULL) && (chip->base == NULL))
+                       chip->base = base + ((i) * 0x10);
+
+               if (!gc->direction_input)
+                       gc->direction_input = samsung_gpiolib_2bit_input;
+               if (!gc->direction_output)
+                       gc->direction_output = samsung_gpiolib_2bit_output;
+
+               samsung_gpiolib_add(chip);
+       }
+}
+
+static void __init samsung_gpiolib_add_2bit_chips(struct samsung_gpio_chip *chip,
+                                                 int nr_chips, void __iomem *base,
+                                                 unsigned int offset)
+{
+       int i;
+
+       for (i = 0 ; i < nr_chips; i++, chip++) {
+               chip->chip.direction_input = samsung_gpiolib_2bit_input;
+               chip->chip.direction_output = samsung_gpiolib_2bit_output;
+
+               if (!chip->config)
+                       chip->config = &samsung_gpio_cfgs[7];
+               if (!chip->pm)
+                       chip->pm = __gpio_pm(&samsung_gpio_pm_2bit);
+               if ((base != NULL) && (chip->base == NULL))
+                       chip->base = base + ((i) * offset);
+
+               samsung_gpiolib_add(chip);
+       }
+}
+
+/*
+ * samsung_gpiolib_add_4bit_chips - 4bit single register GPIO config.
+ * @chip: The gpio chip that is being configured.
+ * @nr_chips: The no of chips (gpio ports) for the GPIO being configured.
+ *
+ * This helper deal with the GPIO cases where the control register has 4 bits
+ * of control per GPIO, generally in the form of:
+ * 0000 = Input
+ * 0001 = Output
+ * others = Special functions (dependent on bank)
+ *
+ * Note, since the code to deal with the case where there are two control
+ * registers instead of one, we do not have a separate set of function
+ * (samsung_gpiolib_add_4bit2_chips)for each case.
+ */
+
+static void __init samsung_gpiolib_add_4bit_chips(struct samsung_gpio_chip *chip,
+                                                 int nr_chips, void __iomem *base)
+{
+       int i;
+
+       for (i = 0 ; i < nr_chips; i++, chip++) {
+               chip->chip.direction_input = samsung_gpiolib_4bit_input;
+               chip->chip.direction_output = samsung_gpiolib_4bit_output;
+
+               if (!chip->config)
+                       chip->config = &samsung_gpio_cfgs[2];
+               if (!chip->pm)
+                       chip->pm = __gpio_pm(&samsung_gpio_pm_4bit);
+               if ((base != NULL) && (chip->base == NULL))
+                       chip->base = base + ((i) * 0x20);
+
+               chip->bitmap_gpio_int = 0;
+
+               samsung_gpiolib_add(chip);
+       }
+}
+
+static void __init samsung_gpiolib_add_4bit2_chips(struct samsung_gpio_chip *chip,
+                                                  int nr_chips)
+{
+       for (; nr_chips > 0; nr_chips--, chip++) {
+               chip->chip.direction_input = samsung_gpiolib_4bit2_input;
+               chip->chip.direction_output = samsung_gpiolib_4bit2_output;
+
+               if (!chip->config)
+                       chip->config = &samsung_gpio_cfgs[2];
+               if (!chip->pm)
+                       chip->pm = __gpio_pm(&samsung_gpio_pm_4bit);
+
+               samsung_gpiolib_add(chip);
+       }
+}
+
+int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
+{
+       struct samsung_gpio_chip *samsung_chip = gpiochip_get_data(chip);
+
+       return samsung_chip->irq_base + offset;
+}
+
+#ifdef CONFIG_PLAT_S3C24XX
+static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+       if (offset < 4) {
+               if (soc_is_s3c2412())
+                       return IRQ_EINT0_2412 + offset;
+               else
+                       return IRQ_EINT0 + offset;
+       }
+
+       if (offset < 8)
+               return IRQ_EINT4 + offset - 4;
+
+       return -EINVAL;
+}
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+static int s3c64xx_gpiolib_mbank_to_irq(struct gpio_chip *chip, unsigned pin)
+{
+       return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO;
+}
+
+static int s3c64xx_gpiolib_lbank_to_irq(struct gpio_chip *chip, unsigned pin)
+{
+       return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO;
+}
+#endif
+
+struct samsung_gpio_chip s3c24xx_gpios[] = {
+#ifdef CONFIG_PLAT_S3C24XX
+       {
+               .config = &s3c24xx_gpiocfg_banka,
+               .chip   = {
+                       .base                   = S3C2410_GPA(0),
+                       .owner                  = THIS_MODULE,
+                       .label                  = "GPIOA",
+                       .ngpio                  = 27,
+                       .direction_input        = s3c24xx_gpiolib_banka_input,
+                       .direction_output       = s3c24xx_gpiolib_banka_output,
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C2410_GPB(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOB",
+                       .ngpio  = 11,
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C2410_GPC(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOC",
+                       .ngpio  = 16,
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C2410_GPD(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOD",
+                       .ngpio  = 16,
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C2410_GPE(0),
+                       .label  = "GPIOE",
+                       .owner  = THIS_MODULE,
+                       .ngpio  = 16,
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C2410_GPF(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOF",
+                       .ngpio  = 8,
+                       .to_irq = s3c24xx_gpiolib_fbank_to_irq,
+               },
+       }, {
+               .irq_base = IRQ_EINT8,
+               .chip   = {
+                       .base   = S3C2410_GPG(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOG",
+                       .ngpio  = 16,
+                       .to_irq = samsung_gpiolib_to_irq,
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C2410_GPH(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOH",
+                       .ngpio  = 15,
+               },
+       },
+               /* GPIOS for the S3C2443 and later devices. */
+       {
+               .base   = S3C2440_GPJCON,
+               .chip   = {
+                       .base   = S3C2410_GPJ(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOJ",
+                       .ngpio  = 16,
+               },
+       }, {
+               .base   = S3C2443_GPKCON,
+               .chip   = {
+                       .base   = S3C2410_GPK(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOK",
+                       .ngpio  = 16,
+               },
+       }, {
+               .base   = S3C2443_GPLCON,
+               .chip   = {
+                       .base   = S3C2410_GPL(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOL",
+                       .ngpio  = 15,
+               },
+       }, {
+               .base   = S3C2443_GPMCON,
+               .chip   = {
+                       .base   = S3C2410_GPM(0),
+                       .owner  = THIS_MODULE,
+                       .label  = "GPIOM",
+                       .ngpio  = 2,
+               },
+       },
+#endif
+};
+
+/*
+ * GPIO bank summary:
+ *
+ * Bank        GPIOs   Style   SlpCon  ExtInt Group
+ * A   8       4Bit    Yes     1
+ * B   7       4Bit    Yes     1
+ * C   8       4Bit    Yes     2
+ * D   5       4Bit    Yes     3
+ * E   5       4Bit    Yes     None
+ * F   16      2Bit    Yes     4 [1]
+ * G   7       4Bit    Yes     5
+ * H   10      4Bit[2] Yes     6
+ * I   16      2Bit    Yes     None
+ * J   12      2Bit    Yes     None
+ * K   16      4Bit[2] No      None
+ * L   15      4Bit[2] No      None
+ * M   6       4Bit    No      IRQ_EINT
+ * N   16      2Bit    No      IRQ_EINT
+ * O   16      2Bit    Yes     7
+ * P   15      2Bit    Yes     8
+ * Q   9       2Bit    Yes     9
+ *
+ * [1] BANKF pins 14,15 do not form part of the external interrupt sources
+ * [2] BANK has two control registers, GPxCON0 and GPxCON1
+ */
+
+static struct samsung_gpio_chip s3c64xx_gpios_4bit[] = {
+#ifdef CONFIG_ARCH_S3C64XX
+       {
+               .chip   = {
+                       .base   = S3C64XX_GPA(0),
+                       .ngpio  = S3C64XX_GPIO_A_NR,
+                       .label  = "GPA",
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C64XX_GPB(0),
+                       .ngpio  = S3C64XX_GPIO_B_NR,
+                       .label  = "GPB",
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C64XX_GPC(0),
+                       .ngpio  = S3C64XX_GPIO_C_NR,
+                       .label  = "GPC",
+               },
+       }, {
+               .chip   = {
+                       .base   = S3C64XX_GPD(0),
+                       .ngpio  = S3C64XX_GPIO_D_NR,
+                       .label  = "GPD",
+               },
+       }, {
+               .config = &samsung_gpio_cfgs[0],
+               .chip   = {
+                       .base   = S3C64XX_GPE(0),
+                       .ngpio  = S3C64XX_GPIO_E_NR,
+                       .label  = "GPE",
+               },
+       }, {
+               .base   = S3C64XX_GPG_BASE,
+               .chip   = {
+                       .base   = S3C64XX_GPG(0),
+                       .ngpio  = S3C64XX_GPIO_G_NR,
+                       .label  = "GPG",
+               },
+       }, {
+               .base   = S3C64XX_GPM_BASE,
+               .config = &samsung_gpio_cfgs[1],
+               .chip   = {
+                       .base   = S3C64XX_GPM(0),
+                       .ngpio  = S3C64XX_GPIO_M_NR,
+                       .label  = "GPM",
+                       .to_irq = s3c64xx_gpiolib_mbank_to_irq,
+               },
+       },
+#endif
+};
+
+static struct samsung_gpio_chip s3c64xx_gpios_4bit2[] = {
+#ifdef CONFIG_ARCH_S3C64XX
+       {
+               .base   = S3C64XX_GPH_BASE + 0x4,
+               .chip   = {
+                       .base   = S3C64XX_GPH(0),
+                       .ngpio  = S3C64XX_GPIO_H_NR,
+                       .label  = "GPH",
+               },
+       }, {
+               .base   = S3C64XX_GPK_BASE + 0x4,
+               .config = &samsung_gpio_cfgs[0],
+               .chip   = {
+                       .base   = S3C64XX_GPK(0),
+                       .ngpio  = S3C64XX_GPIO_K_NR,
+                       .label  = "GPK",
+               },
+       }, {
+               .base   = S3C64XX_GPL_BASE + 0x4,
+               .config = &samsung_gpio_cfgs[1],
+               .chip   = {
+                       .base   = S3C64XX_GPL(0),
+                       .ngpio  = S3C64XX_GPIO_L_NR,
+                       .label  = "GPL",
+                       .to_irq = s3c64xx_gpiolib_lbank_to_irq,
+               },
+       },
+#endif
+};
+
+static struct samsung_gpio_chip s3c64xx_gpios_2bit[] = {
+#ifdef CONFIG_ARCH_S3C64XX
+       {
+               .base   = S3C64XX_GPF_BASE,
+               .config = &samsung_gpio_cfgs[6],
+               .chip   = {
+                       .base   = S3C64XX_GPF(0),
+                       .ngpio  = S3C64XX_GPIO_F_NR,
+                       .label  = "GPF",
+               },
+       }, {
+               .config = &samsung_gpio_cfgs[7],
+               .chip   = {
+                       .base   = S3C64XX_GPI(0),
+                       .ngpio  = S3C64XX_GPIO_I_NR,
+                       .label  = "GPI",
+               },
+       }, {
+               .config = &samsung_gpio_cfgs[7],
+               .chip   = {
+                       .base   = S3C64XX_GPJ(0),
+                       .ngpio  = S3C64XX_GPIO_J_NR,
+                       .label  = "GPJ",
+               },
+       }, {
+               .config = &samsung_gpio_cfgs[6],
+               .chip   = {
+                       .base   = S3C64XX_GPO(0),
+                       .ngpio  = S3C64XX_GPIO_O_NR,
+                       .label  = "GPO",
+               },
+       }, {
+               .config = &samsung_gpio_cfgs[6],
+               .chip   = {
+                       .base   = S3C64XX_GPP(0),
+                       .ngpio  = S3C64XX_GPIO_P_NR,
+                       .label  = "GPP",
+               },
+       }, {
+               .config = &samsung_gpio_cfgs[6],
+               .chip   = {
+                       .base   = S3C64XX_GPQ(0),
+                       .ngpio  = S3C64XX_GPIO_Q_NR,
+                       .label  = "GPQ",
+               },
+       }, {
+               .base   = S3C64XX_GPN_BASE,
+               .irq_base = IRQ_EINT(0),
+               .config = &samsung_gpio_cfgs[5],
+               .chip   = {
+                       .base   = S3C64XX_GPN(0),
+                       .ngpio  = S3C64XX_GPIO_N_NR,
+                       .label  = "GPN",
+                       .to_irq = samsung_gpiolib_to_irq,
+               },
+       },
+#endif
+};
+
+/* TODO: cleanup soc_is_* */
+static __init int samsung_gpiolib_init(void)
+{
+       /*
+        * Currently there are two drivers that can provide GPIO support for
+        * Samsung SoCs. For device tree enabled platforms, the new
+        * pinctrl-samsung driver is used, providing both GPIO and pin control
+        * interfaces. For legacy (non-DT) platforms this driver is used.
+        */
+       if (of_have_populated_dt())
+               return 0;
+
+       if (soc_is_s3c24xx()) {
+               samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+                               ARRAY_SIZE(samsung_gpio_cfgs));
+               s3c24xx_gpiolib_add_chips(s3c24xx_gpios,
+                               ARRAY_SIZE(s3c24xx_gpios), S3C24XX_VA_GPIO);
+       } else if (soc_is_s3c64xx()) {
+               samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+                               ARRAY_SIZE(samsung_gpio_cfgs));
+               samsung_gpiolib_add_2bit_chips(s3c64xx_gpios_2bit,
+                               ARRAY_SIZE(s3c64xx_gpios_2bit),
+                               S3C64XX_VA_GPIO + 0xE0, 0x20);
+               samsung_gpiolib_add_4bit_chips(s3c64xx_gpios_4bit,
+                               ARRAY_SIZE(s3c64xx_gpios_4bit),
+                               S3C64XX_VA_GPIO);
+               samsung_gpiolib_add_4bit2_chips(s3c64xx_gpios_4bit2,
+                               ARRAY_SIZE(s3c64xx_gpios_4bit2));
+       }
+
+       return 0;
+}
+core_initcall(samsung_gpiolib_init);
+
+int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
+{
+       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
+       unsigned long flags;
+       int offset;
+       int ret;
+
+       if (!chip)
+               return -EINVAL;
+
+       offset = pin - chip->chip.base;
+
+       samsung_gpio_lock(chip, flags);
+       ret = samsung_gpio_do_setcfg(chip, offset, config);
+       samsung_gpio_unlock(chip, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(s3c_gpio_cfgpin);
+
+int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
+                         unsigned int cfg)
+{
+       int ret;
+
+       for (; nr > 0; nr--, start++) {
+               ret = s3c_gpio_cfgpin(start, cfg);
+               if (ret != 0)
+                       return ret;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range);
+
+int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
+                         unsigned int cfg, samsung_gpio_pull_t pull)
+{
+       int ret;
+
+       for (; nr > 0; nr--, start++) {
+               s3c_gpio_setpull(start, pull);
+               ret = s3c_gpio_cfgpin(start, cfg);
+               if (ret != 0)
+                       return ret;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range);
+
+unsigned s3c_gpio_getcfg(unsigned int pin)
+{
+       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
+       unsigned long flags;
+       unsigned ret = 0;
+       int offset;
+
+       if (chip) {
+               offset = pin - chip->chip.base;
+
+               samsung_gpio_lock(chip, flags);
+               ret = samsung_gpio_do_getcfg(chip, offset);
+               samsung_gpio_unlock(chip, flags);
+       }
+
+       return ret;
+}
+EXPORT_SYMBOL(s3c_gpio_getcfg);
+
+int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull)
+{
+       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
+       unsigned long flags;
+       int offset, ret;
+
+       if (!chip)
+               return -EINVAL;
+
+       offset = pin - chip->chip.base;
+
+       samsung_gpio_lock(chip, flags);
+       ret = samsung_gpio_do_setpull(chip, offset, pull);
+       samsung_gpio_unlock(chip, flags);
+
+       return ret;
+}
+EXPORT_SYMBOL(s3c_gpio_setpull);
+
+samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin)
+{
+       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
+       unsigned long flags;
+       int offset;
+       u32 pup = 0;
+
+       if (chip) {
+               offset = pin - chip->chip.base;
+
+               samsung_gpio_lock(chip, flags);
+               pup = samsung_gpio_do_getpull(chip, offset);
+               samsung_gpio_unlock(chip, flags);
+       }
+
+       return (__force samsung_gpio_pull_t)pup;
+}
+EXPORT_SYMBOL(s3c_gpio_getpull);
+
+#ifdef CONFIG_PLAT_S3C24XX
+unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change)
+{
+       unsigned long flags;
+       unsigned long misccr;
+
+       local_irq_save(flags);
+       misccr = __raw_readl(S3C24XX_MISCCR);
+       misccr &= ~clear;
+       misccr ^= change;
+       __raw_writel(misccr, S3C24XX_MISCCR);
+       local_irq_restore(flags);
+
+       return misccr;
+}
+EXPORT_SYMBOL(s3c2410_modify_misccr);
+#endif
diff --git a/arch/arm/mach-s3c/gpio-samsung.h b/arch/arm/mach-s3c/gpio-samsung.h
new file mode 100644 (file)
index 0000000..02f6f4a
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "gpio-samsung-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "gpio-samsung-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/gta02.h b/arch/arm/mach-s3c/gta02.h
new file mode 100644 (file)
index 0000000..043ae38
--- /dev/null
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * GTA02 header
+ */
+
+#ifndef __MACH_S3C24XX_GTA02_H
+#define __MACH_S3C24XX_GTA02_H __FILE__
+
+#include "regs-gpio.h"
+
+#define GTA02_GPIO_AUX_LED     S3C2410_GPB(2)
+#define GTA02_GPIO_USB_PULLUP  S3C2410_GPB(9)
+#define GTA02_GPIO_AUX_KEY     S3C2410_GPF(6)
+#define GTA02_GPIO_HOLD_KEY    S3C2410_GPF(7)
+#define GTA02_GPIO_AMP_SHUT    S3C2410_GPJ(1)  /* v2 + v3 + v4 only */
+#define GTA02_GPIO_HP_IN       S3C2410_GPJ(2)  /* v2 + v3 + v4 only */
+
+#define GTA02_IRQ_PCF50633     IRQ_EINT9
+
+#endif /* __MACH_S3C24XX_GTA02_H */
diff --git a/arch/arm/mach-s3c/h1940-bluetooth.c b/arch/arm/mach-s3c/h1940-bluetooth.c
new file mode 100644 (file)
index 0000000..59edcf8
--- /dev/null
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-1.0+
+//
+// Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org>
+//
+//         S3C2410 bluetooth "driver"
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <linux/leds.h>
+#include <linux/gpio.h>
+#include <linux/rfkill.h>
+
+#include "gpio-cfg.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "h1940.h"
+
+#define DRV_NAME "h1940-bt"
+
+/* Bluetooth control */
+static void h1940bt_enable(int on)
+{
+       if (on) {
+               /* Power on the chip */
+               gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1);
+               /* Reset the chip */
+               mdelay(10);
+
+               gpio_set_value(S3C2410_GPH(1), 1);
+               mdelay(10);
+               gpio_set_value(S3C2410_GPH(1), 0);
+
+               h1940_led_blink_set(NULL, GPIO_LED_BLINK, NULL, NULL);
+       }
+       else {
+               gpio_set_value(S3C2410_GPH(1), 1);
+               mdelay(10);
+               gpio_set_value(S3C2410_GPH(1), 0);
+               mdelay(10);
+               gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
+
+               h1940_led_blink_set(NULL, GPIO_LED_NO_BLINK_LOW, NULL, NULL);
+       }
+}
+
+static int h1940bt_set_block(void *data, bool blocked)
+{
+       h1940bt_enable(!blocked);
+       return 0;
+}
+
+static const struct rfkill_ops h1940bt_rfkill_ops = {
+       .set_block = h1940bt_set_block,
+};
+
+static int h1940bt_probe(struct platform_device *pdev)
+{
+       struct rfkill *rfk;
+       int ret = 0;
+
+       ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev));
+       if (ret) {
+               dev_err(&pdev->dev, "could not get GPH1\n");
+               return ret;
+       }
+
+       ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(&pdev->dev));
+       if (ret) {
+               gpio_free(S3C2410_GPH(1));
+               dev_err(&pdev->dev, "could not get BT_POWER\n");
+               return ret;
+       }
+
+       /* Configures BT serial port GPIOs */
+       s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
+       s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
+       s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
+       s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
+       s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
+       s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
+       s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
+       s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
+
+       rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
+                       &h1940bt_rfkill_ops, NULL);
+       if (!rfk) {
+               ret = -ENOMEM;
+               goto err_rfk_alloc;
+       }
+
+       ret = rfkill_register(rfk);
+       if (ret)
+               goto err_rfkill;
+
+       platform_set_drvdata(pdev, rfk);
+
+       return 0;
+
+err_rfkill:
+       rfkill_destroy(rfk);
+err_rfk_alloc:
+       return ret;
+}
+
+static int h1940bt_remove(struct platform_device *pdev)
+{
+       struct rfkill *rfk = platform_get_drvdata(pdev);
+
+       platform_set_drvdata(pdev, NULL);
+       gpio_free(S3C2410_GPH(1));
+
+       if (rfk) {
+               rfkill_unregister(rfk);
+               rfkill_destroy(rfk);
+       }
+       rfk = NULL;
+
+       h1940bt_enable(0);
+
+       return 0;
+}
+
+
+static struct platform_driver h1940bt_driver = {
+       .driver         = {
+               .name   = DRV_NAME,
+       },
+       .probe          = h1940bt_probe,
+       .remove         = h1940bt_remove,
+};
+
+module_platform_driver(h1940bt_driver);
+
+MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
+MODULE_DESCRIPTION("Driver for the iPAQ H1940 bluetooth chip");
+MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-s3c/h1940.h b/arch/arm/mach-s3c/h1940.h
new file mode 100644 (file)
index 0000000..5dfe9d1
--- /dev/null
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2006 Ben Dooks <ben-linux@fluff.org>
+ *
+ * Copyright (c) 2005 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * iPAQ H1940 series definitions
+ */
+
+#ifndef __MACH_S3C24XX_H1940_H
+#define __MACH_S3C24XX_H1940_H __FILE__
+
+#define H1940_SUSPEND_CHECKSUM         (0x30003ff8)
+#define H1940_SUSPEND_RESUMEAT         (0x30081000)
+#define H1940_SUSPEND_CHECK            (0x30080000)
+
+struct gpio_desc;
+
+extern void h1940_pm_return(void);
+extern int h1940_led_blink_set(struct gpio_desc *desc, int state,
+                              unsigned long *delay_on,
+                              unsigned long *delay_off);
+
+#include <linux/gpio.h>
+
+#define H1940_LATCH_GPIO(x)            (S3C_GPIO_END + (x))
+
+/* SD layer latch */
+
+#define H1940_LATCH_LCD_P0             H1940_LATCH_GPIO(0)
+#define H1940_LATCH_LCD_P1             H1940_LATCH_GPIO(1)
+#define H1940_LATCH_LCD_P2             H1940_LATCH_GPIO(2)
+#define H1940_LATCH_LCD_P3             H1940_LATCH_GPIO(3)
+#define H1940_LATCH_MAX1698_nSHUTDOWN  H1940_LATCH_GPIO(4)
+#define H1940_LATCH_LED_RED            H1940_LATCH_GPIO(5)
+#define H1940_LATCH_SDQ7               H1940_LATCH_GPIO(6)
+#define H1940_LATCH_USB_DP             H1940_LATCH_GPIO(7)
+
+/* CPU layer latch */
+
+#define H1940_LATCH_UDA_POWER          H1940_LATCH_GPIO(8)
+#define H1940_LATCH_AUDIO_POWER                H1940_LATCH_GPIO(9)
+#define H1940_LATCH_SM803_ENABLE       H1940_LATCH_GPIO(10)
+#define H1940_LATCH_LCD_P4             H1940_LATCH_GPIO(11)
+#define H1940_LATCH_SD_POWER           H1940_LATCH_GPIO(12)
+#define H1940_LATCH_BLUETOOTH_POWER    H1940_LATCH_GPIO(13)
+#define H1940_LATCH_LED_GREEN          H1940_LATCH_GPIO(14)
+#define H1940_LATCH_LED_FLASH          H1940_LATCH_GPIO(15)
+
+#endif /* __MACH_S3C24XX_H1940_H */
diff --git a/arch/arm/mach-s3c/hardware-s3c24xx.h b/arch/arm/mach-s3c/hardware-s3c24xx.h
new file mode 100644 (file)
index 0000000..33b3746
--- /dev/null
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - hardware
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_S3C24XX_H
+#define __ASM_ARCH_HARDWARE_S3C24XX_H
+
+extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
+
+#endif /* __ASM_ARCH_HARDWARE_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/iic-core.h b/arch/arm/mach-s3c/iic-core.h
new file mode 100644 (file)
index 0000000..c5cfd5a
--- /dev/null
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C - I2C Controller core functions
+ */
+
+#ifndef __ASM_ARCH_IIC_CORE_H
+#define __ASM_ARCH_IIC_CORE_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_i2c0_setname(char *name)
+{
+       /* currently this device is always compiled in */
+       s3c_device_i2c0.name = name;
+}
+
+static inline void s3c_i2c1_setname(char *name)
+{
+#ifdef CONFIG_S3C_DEV_I2C1
+       s3c_device_i2c1.name = name;
+#endif
+}
+
+static inline void s3c_i2c2_setname(char *name)
+{
+#ifdef CONFIG_S3C_DEV_I2C2
+       s3c_device_i2c2.name = name;
+#endif
+}
+
+#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/mach-s3c/include/mach/io-s3c24xx.h b/arch/arm/mach-s3c/include/mach/io-s3c24xx.h
new file mode 100644 (file)
index 0000000..738b775
--- /dev/null
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * arch/arm/mach-s3c2410/include/mach/io.h
+ *  from arch/arm/mach-rpc/include/mach/io.h
+ *
+ * Copyright (C) 1997 Russell King
+ *          (C) 2003 Simtec Electronics
+*/
+
+#ifndef __ASM_ARM_ARCH_IO_S3C24XX_H
+#define __ASM_ARM_ARCH_IO_S3C24XX_H
+
+#include <mach/map-base.h>
+
+/*
+ * ISA style IO, for each machine to sort out mappings for,
+ * if it implements it. We reserve two 16M regions for ISA,
+ * so the PC/104 can use separate addresses for 8-bit and
+ * 16-bit port I/O.
+ */
+#define PCIO_BASE              S3C_ADDR(0x02000000)
+#define IO_SPACE_LIMIT         0x00ffffff
+#define S3C24XX_VA_ISA_WORD    (PCIO_BASE)
+#define S3C24XX_VA_ISA_BYTE    (PCIO_BASE + 0x01000000)
+
+#ifdef CONFIG_ISA
+
+#define inb(p)         readb(S3C24XX_VA_ISA_BYTE + (p))
+#define inw(p)         readw(S3C24XX_VA_ISA_WORD + (p))
+#define inl(p)         readl(S3C24XX_VA_ISA_WORD + (p))
+
+#define outb(v,p)      writeb((v), S3C24XX_VA_ISA_BYTE + (p))
+#define outw(v,p)      writew((v), S3C24XX_VA_ISA_WORD + (p))
+#define outl(v,p)      writel((v), S3C24XX_VA_ISA_WORD + (p))
+
+#define insb(p,d,l)    readsb(S3C24XX_VA_ISA_BYTE + (p),d,l)
+#define insw(p,d,l)    readsw(S3C24XX_VA_ISA_WORD + (p),d,l)
+#define insl(p,d,l)    readsl(S3C24XX_VA_ISA_WORD + (p),d,l)
+
+#define outsb(p,d,l)   writesb(S3C24XX_VA_ISA_BYTE + (p),d,l)
+#define outsw(p,d,l)   writesw(S3C24XX_VA_ISA_WORD + (p),d,l)
+#define outsl(p,d,l)   writesl(S3C24XX_VA_ISA_WORD + (p),d,l)
+
+#else
+
+#define __io(x) (PCIO_BASE + (x))
+
+#endif
+
+#endif
diff --git a/arch/arm/mach-s3c/include/mach/io.h b/arch/arm/mach-s3c/include/mach/io.h
new file mode 100644 (file)
index 0000000..30a0135
--- /dev/null
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "io-s3c24xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/include/mach/irqs-s3c24xx.h b/arch/arm/mach-s3c/include/mach/irqs-s3c24xx.h
new file mode 100644 (file)
index 0000000..aaf3bae
--- /dev/null
@@ -0,0 +1,213 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003-2005 Simtec Electronics
+ *   Ben Dooks <ben@simtec.co.uk>
+ */
+
+
+#ifndef __ASM_ARCH_IRQS_H
+#define __ASM_ARCH_IRQS_H __FILE__
+
+/* we keep the first set of CPU IRQs out of the range of
+ * the ISA space, so that the PC104 has them to itself
+ * and we don't end up having to do horrible things to the
+ * standard ISA drivers....
+ */
+
+#define S3C2410_CPUIRQ_OFFSET   (16)
+
+#define S3C2410_IRQ(x) ((x) + S3C2410_CPUIRQ_OFFSET)
+
+/* main cpu interrupts */
+#define IRQ_EINT0      S3C2410_IRQ(0)      /* 16 */
+#define IRQ_EINT1      S3C2410_IRQ(1)
+#define IRQ_EINT2      S3C2410_IRQ(2)
+#define IRQ_EINT3      S3C2410_IRQ(3)
+#define IRQ_EINT4t7    S3C2410_IRQ(4)      /* 20 */
+#define IRQ_EINT8t23   S3C2410_IRQ(5)
+#define IRQ_RESERVED6  S3C2410_IRQ(6)      /* for s3c2410 */
+#define IRQ_CAM        S3C2410_IRQ(6)      /* for s3c2440,s3c2443 */
+#define IRQ_BATT_FLT   S3C2410_IRQ(7)
+#define IRQ_TICK       S3C2410_IRQ(8)      /* 24 */
+#define IRQ_WDT               S3C2410_IRQ(9)       /* WDT/AC97 for s3c2443 */
+#define IRQ_TIMER0     S3C2410_IRQ(10)
+#define IRQ_TIMER1     S3C2410_IRQ(11)
+#define IRQ_TIMER2     S3C2410_IRQ(12)
+#define IRQ_TIMER3     S3C2410_IRQ(13)
+#define IRQ_TIMER4     S3C2410_IRQ(14)
+#define IRQ_UART2      S3C2410_IRQ(15)
+#define IRQ_LCD               S3C2410_IRQ(16)      /* 32 */
+#define IRQ_DMA0       S3C2410_IRQ(17)     /* IRQ_DMA for s3c2443 */
+#define IRQ_DMA1       S3C2410_IRQ(18)
+#define IRQ_DMA2       S3C2410_IRQ(19)
+#define IRQ_DMA3       S3C2410_IRQ(20)
+#define IRQ_SDI               S3C2410_IRQ(21)
+#define IRQ_SPI0       S3C2410_IRQ(22)
+#define IRQ_UART1      S3C2410_IRQ(23)
+#define IRQ_RESERVED24 S3C2410_IRQ(24)     /* 40 */
+#define IRQ_NFCON      S3C2410_IRQ(24)     /* for s3c2440 */
+#define IRQ_USBD       S3C2410_IRQ(25)
+#define IRQ_USBH       S3C2410_IRQ(26)
+#define IRQ_IIC               S3C2410_IRQ(27)
+#define IRQ_UART0      S3C2410_IRQ(28)     /* 44 */
+#define IRQ_SPI1       S3C2410_IRQ(29)
+#define IRQ_RTC               S3C2410_IRQ(30)
+#define IRQ_ADCPARENT  S3C2410_IRQ(31)
+
+/* interrupts generated from the external interrupts sources */
+#define IRQ_EINT0_2412 S3C2410_IRQ(32)
+#define IRQ_EINT1_2412 S3C2410_IRQ(33)
+#define IRQ_EINT2_2412 S3C2410_IRQ(34)
+#define IRQ_EINT3_2412 S3C2410_IRQ(35)
+#define IRQ_EINT4      S3C2410_IRQ(36)    /* 52 */
+#define IRQ_EINT5      S3C2410_IRQ(37)
+#define IRQ_EINT6      S3C2410_IRQ(38)
+#define IRQ_EINT7      S3C2410_IRQ(39)
+#define IRQ_EINT8      S3C2410_IRQ(40)
+#define IRQ_EINT9      S3C2410_IRQ(41)
+#define IRQ_EINT10     S3C2410_IRQ(42)
+#define IRQ_EINT11     S3C2410_IRQ(43)
+#define IRQ_EINT12     S3C2410_IRQ(44)
+#define IRQ_EINT13     S3C2410_IRQ(45)
+#define IRQ_EINT14     S3C2410_IRQ(46)
+#define IRQ_EINT15     S3C2410_IRQ(47)
+#define IRQ_EINT16     S3C2410_IRQ(48)
+#define IRQ_EINT17     S3C2410_IRQ(49)
+#define IRQ_EINT18     S3C2410_IRQ(50)
+#define IRQ_EINT19     S3C2410_IRQ(51)
+#define IRQ_EINT20     S3C2410_IRQ(52)    /* 68 */
+#define IRQ_EINT21     S3C2410_IRQ(53)
+#define IRQ_EINT22     S3C2410_IRQ(54)
+#define IRQ_EINT23     S3C2410_IRQ(55)
+
+#define IRQ_EINT_BIT(x)        ((x) - IRQ_EINT4 + 4)
+#define IRQ_EINT(x)    (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x)))
+
+#define IRQ_LCD_FIFO   S3C2410_IRQ(56)
+#define IRQ_LCD_FRAME  S3C2410_IRQ(57)
+
+/* IRQs for the interal UARTs, and ADC
+ * these need to be ordered in number of appearance in the
+ * SUBSRC mask register
+*/
+
+#define S3C2410_IRQSUB(x)      S3C2410_IRQ((x)+58)
+
+#define IRQ_S3CUART_RX0                S3C2410_IRQSUB(0)       /* 74 */
+#define IRQ_S3CUART_TX0                S3C2410_IRQSUB(1)
+#define IRQ_S3CUART_ERR0       S3C2410_IRQSUB(2)
+
+#define IRQ_S3CUART_RX1                S3C2410_IRQSUB(3)       /* 77 */
+#define IRQ_S3CUART_TX1                S3C2410_IRQSUB(4)
+#define IRQ_S3CUART_ERR1       S3C2410_IRQSUB(5)
+
+#define IRQ_S3CUART_RX2                S3C2410_IRQSUB(6)       /* 80 */
+#define IRQ_S3CUART_TX2                S3C2410_IRQSUB(7)
+#define IRQ_S3CUART_ERR2       S3C2410_IRQSUB(8)
+
+#define IRQ_TC                 S3C2410_IRQSUB(9)
+#define IRQ_ADC                        S3C2410_IRQSUB(10)
+
+/* extra irqs for s3c2412 */
+
+#define IRQ_S3C2412_CFSDI      S3C2410_IRQ(21)
+
+#define IRQ_S3C2412_SDI                S3C2410_IRQSUB(13)
+#define IRQ_S3C2412_CF         S3C2410_IRQSUB(14)
+
+
+#define IRQ_S3C2416_EINT8t15   S3C2410_IRQ(5)
+#define IRQ_S3C2416_DMA                S3C2410_IRQ(17)
+#define IRQ_S3C2416_UART3      S3C2410_IRQ(18)
+#define IRQ_S3C2416_SDI1       S3C2410_IRQ(20)
+#define IRQ_S3C2416_SDI0       S3C2410_IRQ(21)
+
+#define IRQ_S3C2416_LCD2       S3C2410_IRQSUB(15)
+#define IRQ_S3C2416_LCD3       S3C2410_IRQSUB(16)
+#define IRQ_S3C2416_LCD4       S3C2410_IRQSUB(17)
+#define IRQ_S3C2416_DMA0       S3C2410_IRQSUB(18)
+#define IRQ_S3C2416_DMA1       S3C2410_IRQSUB(19)
+#define IRQ_S3C2416_DMA2       S3C2410_IRQSUB(20)
+#define IRQ_S3C2416_DMA3       S3C2410_IRQSUB(21)
+#define IRQ_S3C2416_DMA4       S3C2410_IRQSUB(22)
+#define IRQ_S3C2416_DMA5       S3C2410_IRQSUB(23)
+#define IRQ_S32416_WDT         S3C2410_IRQSUB(27)
+#define IRQ_S32416_AC97                S3C2410_IRQSUB(28)
+
+/* second interrupt-register of s3c2416/s3c2450 */
+
+#define S3C2416_IRQ(x)         S3C2410_IRQ((x) + 58 + 29)
+#define IRQ_S3C2416_2D         S3C2416_IRQ(0)
+#define IRQ_S3C2416_IIC1       S3C2416_IRQ(1)
+#define IRQ_S3C2416_RESERVED2  S3C2416_IRQ(2)
+#define IRQ_S3C2416_RESERVED3  S3C2416_IRQ(3)
+#define IRQ_S3C2416_PCM0       S3C2416_IRQ(4)
+#define IRQ_S3C2416_PCM1       S3C2416_IRQ(5)
+#define IRQ_S3C2416_I2S0       S3C2416_IRQ(6)
+#define IRQ_S3C2416_I2S1       S3C2416_IRQ(7)
+
+/* extra irqs for s3c2440 */
+
+#define IRQ_S3C2440_CAM_C      S3C2410_IRQSUB(11)      /* S3C2443 too */
+#define IRQ_S3C2440_CAM_P      S3C2410_IRQSUB(12)      /* S3C2443 too */
+#define IRQ_S3C2440_WDT                S3C2410_IRQSUB(13)
+#define IRQ_S3C2440_AC97       S3C2410_IRQSUB(14)
+
+/* irqs for s3c2443 */
+
+#define IRQ_S3C2443_DMA                S3C2410_IRQ(17)         /* IRQ_DMA1 */
+#define IRQ_S3C2443_UART3      S3C2410_IRQ(18)         /* IRQ_DMA2 */
+#define IRQ_S3C2443_CFCON      S3C2410_IRQ(19)         /* IRQ_DMA3 */
+#define IRQ_S3C2443_HSMMC      S3C2410_IRQ(20)         /* IRQ_SDI */
+#define IRQ_S3C2443_NAND       S3C2410_IRQ(24)         /* reserved */
+
+#define IRQ_S3C2416_HSMMC0     S3C2410_IRQ(21)         /* S3C2416/S3C2450 */
+
+#define IRQ_HSMMC0             IRQ_S3C2416_HSMMC0
+#define IRQ_HSMMC1             IRQ_S3C2443_HSMMC
+
+#define IRQ_S3C2443_LCD1       S3C2410_IRQSUB(14)
+#define IRQ_S3C2443_LCD2       S3C2410_IRQSUB(15)
+#define IRQ_S3C2443_LCD3       S3C2410_IRQSUB(16)
+#define IRQ_S3C2443_LCD4       S3C2410_IRQSUB(17)
+
+#define IRQ_S3C2443_DMA0       S3C2410_IRQSUB(18)
+#define IRQ_S3C2443_DMA1       S3C2410_IRQSUB(19)
+#define IRQ_S3C2443_DMA2       S3C2410_IRQSUB(20)
+#define IRQ_S3C2443_DMA3       S3C2410_IRQSUB(21)
+#define IRQ_S3C2443_DMA4       S3C2410_IRQSUB(22)
+#define IRQ_S3C2443_DMA5       S3C2410_IRQSUB(23)
+
+/* UART3 */
+#define IRQ_S3C2443_RX3                S3C2410_IRQSUB(24)
+#define IRQ_S3C2443_TX3                S3C2410_IRQSUB(25)
+#define IRQ_S3C2443_ERR3       S3C2410_IRQSUB(26)
+
+#define IRQ_S3C2443_WDT                S3C2410_IRQSUB(27)
+#define IRQ_S3C2443_AC97       S3C2410_IRQSUB(28)
+
+#if defined(CONFIG_CPU_S3C2416)
+#define NR_IRQS (IRQ_S3C2416_I2S1 + 1)
+#else
+#define NR_IRQS (IRQ_S3C2443_AC97 + 1)
+#endif
+
+/* compatibility define. */
+#define IRQ_UART3              IRQ_S3C2443_UART3
+#define IRQ_S3CUART_RX3                IRQ_S3C2443_RX3
+#define IRQ_S3CUART_TX3                IRQ_S3C2443_TX3
+#define IRQ_S3CUART_ERR3       IRQ_S3C2443_ERR3
+
+#define IRQ_LCD_VSYNC          IRQ_S3C2443_LCD3
+#define IRQ_LCD_SYSTEM         IRQ_S3C2443_LCD2
+
+#ifdef CONFIG_CPU_S3C2440
+#define IRQ_S3C244X_AC97 IRQ_S3C2440_AC97
+#else
+#define IRQ_S3C244X_AC97 IRQ_S3C2443_AC97
+#endif
+
+/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */
+#define FIQ_START              IRQ_EINT0
+
+#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c/include/mach/irqs-s3c64xx.h b/arch/arm/mach-s3c/include/mach/irqs-s3c64xx.h
new file mode 100644 (file)
index 0000000..c244e48
--- /dev/null
@@ -0,0 +1,172 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* linux/arch/arm/mach-s3c64xx/include/mach/irqs.h
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX - IRQ support
+ */
+
+#ifndef __ASM_MACH_S3C64XX_IRQS_H
+#define __ASM_MACH_S3C64XX_IRQS_H __FILE__
+
+/* we keep the first set of CPU IRQs out of the range of
+ * the ISA space, so that the PC104 has them to itself
+ * and we don't end up having to do horrible things to the
+ * standard ISA drivers....
+ *
+ * note, since we're using the VICs, our start must be a
+ * mulitple of 32 to allow the common code to work
+ */
+
+#define S3C_IRQ_OFFSET (32)
+
+#define S3C_IRQ(x)     ((x) + S3C_IRQ_OFFSET)
+
+#define IRQ_VIC0_BASE  S3C_IRQ(0)
+#define IRQ_VIC1_BASE  S3C_IRQ(32)
+
+/* VIC based IRQs */
+
+#define S3C64XX_IRQ_VIC0(x)    (IRQ_VIC0_BASE + (x))
+#define S3C64XX_IRQ_VIC1(x)    (IRQ_VIC1_BASE + (x))
+
+/* VIC0 */
+
+#define IRQ_EINT0_3            S3C64XX_IRQ_VIC0(0)
+#define IRQ_EINT4_11           S3C64XX_IRQ_VIC0(1)
+#define IRQ_RTC_TIC            S3C64XX_IRQ_VIC0(2)
+#define IRQ_CAMIF_C            S3C64XX_IRQ_VIC0(3)
+#define IRQ_CAMIF_P            S3C64XX_IRQ_VIC0(4)
+#define IRQ_CAMIF_MC           S3C64XX_IRQ_VIC0(5)
+#define IRQ_S3C6410_IIC1       S3C64XX_IRQ_VIC0(5)
+#define IRQ_S3C6410_IIS                S3C64XX_IRQ_VIC0(6)
+#define IRQ_S3C6400_CAMIF_MP   S3C64XX_IRQ_VIC0(6)
+#define IRQ_CAMIF_WE_C         S3C64XX_IRQ_VIC0(7)
+#define IRQ_S3C6410_G3D                S3C64XX_IRQ_VIC0(8)
+#define IRQ_S3C6400_CAMIF_WE_P S3C64XX_IRQ_VIC0(8)
+#define IRQ_POST0              S3C64XX_IRQ_VIC0(9)
+#define IRQ_ROTATOR            S3C64XX_IRQ_VIC0(10)
+#define IRQ_2D                 S3C64XX_IRQ_VIC0(11)
+#define IRQ_TVENC              S3C64XX_IRQ_VIC0(12)
+#define IRQ_SCALER             S3C64XX_IRQ_VIC0(13)
+#define IRQ_BATF               S3C64XX_IRQ_VIC0(14)
+#define IRQ_JPEG               S3C64XX_IRQ_VIC0(15)
+#define IRQ_MFC                        S3C64XX_IRQ_VIC0(16)
+#define IRQ_SDMA0              S3C64XX_IRQ_VIC0(17)
+#define IRQ_SDMA1              S3C64XX_IRQ_VIC0(18)
+#define IRQ_ARM_DMAERR         S3C64XX_IRQ_VIC0(19)
+#define IRQ_ARM_DMA            S3C64XX_IRQ_VIC0(20)
+#define IRQ_ARM_DMAS           S3C64XX_IRQ_VIC0(21)
+#define IRQ_KEYPAD             S3C64XX_IRQ_VIC0(22)
+#define IRQ_TIMER0_VIC         S3C64XX_IRQ_VIC0(23)
+#define IRQ_TIMER1_VIC         S3C64XX_IRQ_VIC0(24)
+#define IRQ_TIMER2_VIC         S3C64XX_IRQ_VIC0(25)
+#define IRQ_WDT                        S3C64XX_IRQ_VIC0(26)
+#define IRQ_TIMER3_VIC         S3C64XX_IRQ_VIC0(27)
+#define IRQ_TIMER4_VIC         S3C64XX_IRQ_VIC0(28)
+#define IRQ_LCD_FIFO           S3C64XX_IRQ_VIC0(29)
+#define IRQ_LCD_VSYNC          S3C64XX_IRQ_VIC0(30)
+#define IRQ_LCD_SYSTEM         S3C64XX_IRQ_VIC0(31)
+
+/* VIC1 */
+
+#define IRQ_EINT12_19          S3C64XX_IRQ_VIC1(0)
+#define IRQ_EINT20_27          S3C64XX_IRQ_VIC1(1)
+#define IRQ_PCM0               S3C64XX_IRQ_VIC1(2)
+#define IRQ_PCM1               S3C64XX_IRQ_VIC1(3)
+#define IRQ_AC97               S3C64XX_IRQ_VIC1(4)
+#define IRQ_UART0              S3C64XX_IRQ_VIC1(5)
+#define IRQ_UART1              S3C64XX_IRQ_VIC1(6)
+#define IRQ_UART2              S3C64XX_IRQ_VIC1(7)
+#define IRQ_UART3              S3C64XX_IRQ_VIC1(8)
+#define IRQ_DMA0               S3C64XX_IRQ_VIC1(9)
+#define IRQ_DMA1               S3C64XX_IRQ_VIC1(10)
+#define IRQ_ONENAND0           S3C64XX_IRQ_VIC1(11)
+#define IRQ_ONENAND1           S3C64XX_IRQ_VIC1(12)
+#define IRQ_NFC                        S3C64XX_IRQ_VIC1(13)
+#define IRQ_CFCON              S3C64XX_IRQ_VIC1(14)
+#define IRQ_USBH               S3C64XX_IRQ_VIC1(15)
+#define IRQ_SPI0               S3C64XX_IRQ_VIC1(16)
+#define IRQ_SPI1               S3C64XX_IRQ_VIC1(17)
+#define IRQ_IIC                        S3C64XX_IRQ_VIC1(18)
+#define IRQ_HSItx              S3C64XX_IRQ_VIC1(19)
+#define IRQ_HSIrx              S3C64XX_IRQ_VIC1(20)
+#define IRQ_RESERVED           S3C64XX_IRQ_VIC1(21)
+#define IRQ_MSM                        S3C64XX_IRQ_VIC1(22)
+#define IRQ_HOSTIF             S3C64XX_IRQ_VIC1(23)
+#define IRQ_HSMMC0             S3C64XX_IRQ_VIC1(24)
+#define IRQ_HSMMC1             S3C64XX_IRQ_VIC1(25)
+#define IRQ_HSMMC2             IRQ_SPI1        /* shared with SPI1 */
+#define IRQ_OTG                        S3C64XX_IRQ_VIC1(26)
+#define IRQ_IRDA               S3C64XX_IRQ_VIC1(27)
+#define IRQ_RTC_ALARM          S3C64XX_IRQ_VIC1(28)
+#define IRQ_SEC                        S3C64XX_IRQ_VIC1(29)
+#define IRQ_PENDN              S3C64XX_IRQ_VIC1(30)
+#define IRQ_TC                 IRQ_PENDN
+#define IRQ_ADC                        S3C64XX_IRQ_VIC1(31)
+
+/* compatibility for device defines */
+
+#define IRQ_IIC1               IRQ_S3C6410_IIC1
+
+/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series
+ * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE
+ * which we place after the pair of VICs. */
+
+#define S3C_IRQ_EINT_BASE      S3C_IRQ(64+5)
+
+#define S3C_EINT(x)            ((x) + S3C_IRQ_EINT_BASE)
+#define IRQ_EINT(x)            S3C_EINT(x)
+#define IRQ_EINT_BIT(x)                ((x) - S3C_EINT(0))
+
+/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)
+ * that they are sourced from the GPIO pins but with a different scheme for
+ * priority and source indication.
+ *
+ * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
+ * interrupts, but for historical reasons they are kept apart from these
+ * next interrupts.
+ *
+ * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
+ * machine specific support files.
+ */
+
+#define IRQ_EINT_GROUP1_NR     (15)
+#define IRQ_EINT_GROUP2_NR     (8)
+#define IRQ_EINT_GROUP3_NR     (5)
+#define IRQ_EINT_GROUP4_NR     (14)
+#define IRQ_EINT_GROUP5_NR     (7)
+#define IRQ_EINT_GROUP6_NR     (10)
+#define IRQ_EINT_GROUP7_NR     (16)
+#define IRQ_EINT_GROUP8_NR     (15)
+#define IRQ_EINT_GROUP9_NR     (9)
+
+#define IRQ_EINT_GROUP_BASE    S3C_EINT(28)
+#define IRQ_EINT_GROUP1_BASE   (IRQ_EINT_GROUP_BASE + 0x00)
+#define IRQ_EINT_GROUP2_BASE   (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
+#define IRQ_EINT_GROUP3_BASE   (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
+#define IRQ_EINT_GROUP4_BASE   (IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR)
+#define IRQ_EINT_GROUP5_BASE   (IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR)
+#define IRQ_EINT_GROUP6_BASE   (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
+#define IRQ_EINT_GROUP7_BASE   (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
+#define IRQ_EINT_GROUP8_BASE   (IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR)
+#define IRQ_EINT_GROUP9_BASE   (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR)
+
+#define IRQ_EINT_GROUP(group, no)      (IRQ_EINT_GROUP##group##_BASE + (no))
+
+/* Some boards have their own IRQs behind this */
+#define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
+
+/* Set the default nr_irqs, boards can override if necessary */
+#define S3C64XX_NR_IRQS        IRQ_BOARD_START
+
+/* Compatibility */
+
+#define IRQ_ONENAND    IRQ_ONENAND0
+#define IRQ_I2S0       IRQ_S3C6410_IIS
+
+#endif /* __ASM_MACH_S3C64XX_IRQS_H */
+
diff --git a/arch/arm/mach-s3c/include/mach/irqs.h b/arch/arm/mach-s3c/include/mach/irqs.h
new file mode 100644 (file)
index 0000000..0bff1c1
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "irqs-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "irqs-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/include/mach/map-base.h b/arch/arm/mach-s3c/include/mach/map-base.h
new file mode 100644 (file)
index 0000000..34b39de
--- /dev/null
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2003, 2007 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C - Memory map definitions (virtual addresses)
+ */
+
+#ifndef __ASM_PLAT_MAP_H
+#define __ASM_PLAT_MAP_H __FILE__
+
+/* Fit all our registers in at 0xF6000000 upwards, trying to use as
+ * little of the VA space as possible so vmalloc and friends have a
+ * better chance of getting memory.
+ *
+ * we try to ensure stuff like the IRQ registers are available for
+ * an single MOVS instruction (ie, only 8 bits of set data)
+ */
+
+#define S3C_ADDR_BASE  0xF6000000
+
+#ifndef __ASSEMBLY__
+#define S3C_ADDR(x)    ((void __iomem __force *)S3C_ADDR_BASE + (x))
+#else
+#define S3C_ADDR(x)    (S3C_ADDR_BASE + (x))
+#endif
+
+#define S3C_VA_IRQ     S3C_ADDR(0x00000000)    /* irq controller(s) */
+#define S3C_VA_SYS     S3C_ADDR(0x00100000)    /* system control */
+#define S3C_VA_MEM     S3C_ADDR(0x00200000)    /* memory control */
+#define S3C_VA_TIMER   S3C_ADDR(0x00300000)    /* timer block */
+#define S3C_VA_WATCHDOG        S3C_ADDR(0x00400000)    /* watchdog */
+#define S3C_VA_UART    S3C_ADDR(0x01000000)    /* UART */
+
+/* This is used for the CPU specific mappings that may be needed, so that
+ * they do not need to directly used S3C_ADDR() and thus make it easier to
+ * modify the space for mapping.
+ */
+#define S3C_ADDR_CPU(x)        S3C_ADDR(0x00500000 + (x))
+
+#endif /* __ASM_PLAT_MAP_H */
diff --git a/arch/arm/mach-s3c/init.c b/arch/arm/mach-s3c/init.c
new file mode 100644 (file)
index 0000000..9d92f03
--- /dev/null
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// S3C series CPU initialisation
+
+/*
+ * NOTE: Code in this file is not used on S3C64xx when booting with
+ * Device Tree support.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "cpu.h"
+#include "devs.h"
+
+static struct cpu_table *cpu;
+
+static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
+                                               struct cpu_table *tab,
+                                               unsigned int count)
+{
+       for (; count != 0; count--, tab++) {
+               if ((idcode & tab->idmask) == (tab->idcode & tab->idmask))
+                       return tab;
+       }
+
+       return NULL;
+}
+
+void __init s3c_init_cpu(unsigned long idcode,
+                        struct cpu_table *cputab, unsigned int cputab_size)
+{
+       cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);
+
+       if (cpu == NULL) {
+               printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
+               panic("Unknown S3C24XX CPU");
+       }
+
+       printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
+
+       if (cpu->init == NULL) {
+               printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
+               panic("Unsupported Samsung CPU");
+       }
+
+       if (cpu->map_io)
+               cpu->map_io();
+}
+
+/* s3c24xx_init_clocks
+ *
+ * Initialise the clock subsystem and associated information from the
+ * given master crystal value.
+ *
+ * xtal  = 0 -> use default PLL crystal value (normally 12MHz)
+ *      != 0 -> PLL crystal value in Hz
+*/
+
+void __init s3c24xx_init_clocks(int xtal)
+{
+       if (xtal == 0)
+               xtal = 12*1000*1000;
+
+       if (cpu == NULL)
+               panic("s3c24xx_init_clocks: no cpu setup?\n");
+
+       if (cpu->init_clocks == NULL)
+               panic("s3c24xx_init_clocks: cpu has no clock init\n");
+       else
+               (cpu->init_clocks)(xtal);
+}
+
+/* uart management */
+#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
+static int nr_uarts __initdata = 0;
+
+#ifdef CONFIG_SERIAL_SAMSUNG_UARTS
+static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS];
+#endif
+
+/* s3c24xx_init_uartdevs
+ *
+ * copy the specified platform data and configuration into our central
+ * set of devices, before the data is thrown away after the init process.
+ *
+ * This also fills in the array passed to the serial driver for the
+ * early initialisation of the console.
+*/
+
+void __init s3c24xx_init_uartdevs(char *name,
+                                 struct s3c24xx_uart_resources *res,
+                                 struct s3c2410_uartcfg *cfg, int no)
+{
+#ifdef CONFIG_SERIAL_SAMSUNG_UARTS
+       struct platform_device *platdev;
+       struct s3c2410_uartcfg *cfgptr = uart_cfgs;
+       struct s3c24xx_uart_resources *resp;
+       int uart;
+
+       memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no);
+
+       for (uart = 0; uart < no; uart++, cfg++, cfgptr++) {
+               platdev = s3c24xx_uart_src[cfgptr->hwport];
+
+               resp = res + cfgptr->hwport;
+
+               s3c24xx_uart_devs[uart] = platdev;
+
+               platdev->name = name;
+               platdev->resource = resp->resources;
+               platdev->num_resources = resp->nr_resources;
+
+               platdev->dev.platform_data = cfgptr;
+       }
+
+       nr_uarts = no;
+#endif
+}
+
+void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       if (cpu == NULL)
+               return;
+
+       if (cpu->init_uarts == NULL && IS_ENABLED(CONFIG_SAMSUNG_ATAGS)) {
+               printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
+       } else
+               (cpu->init_uarts)(cfg, no);
+}
+#endif
+
+static int __init s3c_arch_init(void)
+{
+       int ret;
+
+       /* init is only needed for ATAGS based platforms */
+       if (!IS_ENABLED(CONFIG_ATAGS) ||
+           (!soc_is_s3c24xx() && !soc_is_s3c64xx()))
+               return 0;
+
+       // do the correct init for cpu
+
+       if (cpu == NULL) {
+               /* Not needed when booting with device tree. */
+               if (of_have_populated_dt())
+                       return 0;
+               panic("s3c_arch_init: NULL cpu\n");
+       }
+
+       ret = (cpu->init)();
+       if (ret != 0)
+               return ret;
+#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
+       ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
+#endif
+       return ret;
+}
+
+arch_initcall(s3c_arch_init);
diff --git a/arch/arm/mach-s3c/iotiming-s3c2410.c b/arch/arm/mach-s3c/iotiming-s3c2410.c
new file mode 100644 (file)
index 0000000..28d9f47
--- /dev/null
@@ -0,0 +1,472 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006-2009 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C24XX CPU Frequency scaling - IO timing for S3C2410/S3C2440/S3C2442
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/cpufreq.h>
+#include <linux/seq_file.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+
+#include "map.h"
+#include "regs-clock.h"
+
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+
+#include "regs-mem-s3c24xx.h"
+
+#define print_ns(x) ((x) / 10), ((x) % 10)
+
+/**
+ * s3c2410_print_timing - print bank timing data for debug purposes
+ * @pfx: The prefix to put on the output
+ * @timings: The timing inforamtion to print.
+*/
+static void s3c2410_print_timing(const char *pfx,
+                                struct s3c_iotimings *timings)
+{
+       struct s3c2410_iobank_timing *bt;
+       int bank;
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bt = timings->bank[bank].io_2410;
+               if (!bt)
+                       continue;
+
+               printk(KERN_DEBUG "%s %d: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, "
+                      "Tcoh=%d.%d, Tcah=%d.%d\n", pfx, bank,
+                      print_ns(bt->tacs),
+                      print_ns(bt->tcos),
+                      print_ns(bt->tacc),
+                      print_ns(bt->tcoh),
+                      print_ns(bt->tcah));
+       }
+}
+
+/**
+ * bank_reg - convert bank number to pointer to the control register.
+ * @bank: The IO bank number.
+ */
+static inline void __iomem *bank_reg(unsigned int bank)
+{
+       return S3C2410_BANKCON0 + (bank << 2);
+}
+
+/**
+ * bank_is_io - test whether bank is used for IO
+ * @bankcon: The bank control register.
+ *
+ * This is a simplistic test to see if any BANKCON[x] is not an IO
+ * bank. It currently does not take into account whether BWSCON has
+ * an illegal width-setting in it, or if the pin connected to nCS[x]
+ * is actually being handled as a chip-select.
+ */
+static inline int bank_is_io(unsigned long bankcon)
+{
+       return !(bankcon & S3C2410_BANKCON_SDRAM);
+}
+
+/**
+ * to_div - convert cycle time to divisor
+ * @cyc: The cycle time, in 10ths of nanoseconds.
+ * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
+ *
+ * Convert the given cycle time into the divisor to use to obtain it from
+ * HCLK.
+*/
+static inline unsigned int to_div(unsigned int cyc, unsigned int hclk_tns)
+{
+       if (cyc == 0)
+               return 0;
+
+       return DIV_ROUND_UP(cyc, hclk_tns);
+}
+
+/**
+ * calc_0124 - calculate divisor control for divisors that do /0, /1. /2 and /4
+ * @cyc: The cycle time, in 10ths of nanoseconds.
+ * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
+ * @v: Pointer to register to alter.
+ * @shift: The shift to get to the control bits.
+ *
+ * Calculate the divisor, and turn it into the correct control bits to
+ * set in the result, @v.
+ */
+static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns,
+                             unsigned long *v, int shift)
+{
+       unsigned int div = to_div(cyc, hclk_tns);
+       unsigned long val;
+
+       s3c_freq_iodbg("%s: cyc=%d, hclk=%lu, shift=%d => div %d\n",
+                      __func__, cyc, hclk_tns, shift, div);
+
+       switch (div) {
+       case 0:
+               val = 0;
+               break;
+       case 1:
+               val = 1;
+               break;
+       case 2:
+               val = 2;
+               break;
+       case 3:
+       case 4:
+               val = 3;
+               break;
+       default:
+               return -1;
+       }
+
+       *v |= val << shift;
+       return 0;
+}
+
+static int calc_tacp(unsigned int cyc, unsigned long hclk, unsigned long *v)
+{
+       /* Currently no support for Tacp calculations. */
+       return 0;
+}
+
+/**
+ * calc_tacc - calculate divisor control for tacc.
+ * @cyc: The cycle time, in 10ths of nanoseconds.
+ * @nwait_en: IS nWAIT enabled for this bank.
+ * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
+ * @v: Pointer to register to alter.
+ *
+ * Calculate the divisor control for tACC, taking into account whether
+ * the bank has nWAIT enabled. The result is used to modify the value
+ * pointed to by @v.
+*/
+static int calc_tacc(unsigned int cyc, int nwait_en,
+                    unsigned long hclk_tns, unsigned long *v)
+{
+       unsigned int div = to_div(cyc, hclk_tns);
+       unsigned long val;
+
+       s3c_freq_iodbg("%s: cyc=%u, nwait=%d, hclk=%lu => div=%u\n",
+                      __func__, cyc, nwait_en, hclk_tns, div);
+
+       /* if nWait enabled on an bank, Tacc must be at-least 4 cycles. */
+       if (nwait_en && div < 4)
+               div = 4;
+
+       switch (div) {
+       case 0:
+               val = 0;
+               break;
+
+       case 1:
+       case 2:
+       case 3:
+       case 4:
+               val = div - 1;
+               break;
+
+       case 5:
+       case 6:
+               val = 4;
+               break;
+
+       case 7:
+       case 8:
+               val = 5;
+               break;
+
+       case 9:
+       case 10:
+               val = 6;
+               break;
+
+       case 11:
+       case 12:
+       case 13:
+       case 14:
+               val = 7;
+               break;
+
+       default:
+               return -1;
+       }
+
+       *v |= val << 8;
+       return 0;
+}
+
+/**
+ * s3c2410_calc_bank - calculate bank timing information
+ * @cfg: The configuration we need to calculate for.
+ * @bt: The bank timing information.
+ *
+ * Given the cycle timine for a bank @bt, calculate the new BANKCON
+ * setting for the @cfg timing. This updates the timing information
+ * ready for the cpu frequency change.
+ */
+static int s3c2410_calc_bank(struct s3c_cpufreq_config *cfg,
+                            struct s3c2410_iobank_timing *bt)
+{
+       unsigned long hclk = cfg->freq.hclk_tns;
+       unsigned long res;
+       int ret;
+
+       res  = bt->bankcon;
+       res &= (S3C2410_BANKCON_SDRAM | S3C2410_BANKCON_PMC16);
+
+       /* tacp: 2,3,4,5 */
+       /* tcah: 0,1,2,4 */
+       /* tcoh: 0,1,2,4 */
+       /* tacc: 1,2,3,4,6,7,10,14 (>4 for nwait) */
+       /* tcos: 0,1,2,4 */
+       /* tacs: 0,1,2,4 */
+
+       ret  = calc_0124(bt->tacs, hclk, &res, S3C2410_BANKCON_Tacs_SHIFT);
+       ret |= calc_0124(bt->tcos, hclk, &res, S3C2410_BANKCON_Tcos_SHIFT);
+       ret |= calc_0124(bt->tcah, hclk, &res, S3C2410_BANKCON_Tcah_SHIFT);
+       ret |= calc_0124(bt->tcoh, hclk, &res, S3C2410_BANKCON_Tcoh_SHIFT);
+
+       if (ret)
+               return -EINVAL;
+
+       ret |= calc_tacp(bt->tacp, hclk, &res);
+       ret |= calc_tacc(bt->tacc, bt->nwait_en, hclk, &res);
+
+       if (ret)
+               return -EINVAL;
+
+       bt->bankcon = res;
+       return 0;
+}
+
+static const unsigned int tacc_tab[] = {
+       [0]     = 1,
+       [1]     = 2,
+       [2]     = 3,
+       [3]     = 4,
+       [4]     = 6,
+       [5]     = 9,
+       [6]     = 10,
+       [7]     = 14,
+};
+
+/**
+ * get_tacc - turn tACC value into cycle time
+ * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
+ * @val: The bank timing register value, shifed down.
+ */
+static unsigned int get_tacc(unsigned long hclk_tns,
+                            unsigned long val)
+{
+       val &= 7;
+       return hclk_tns * tacc_tab[val];
+}
+
+/**
+ * get_0124 - turn 0/1/2/4 divider into cycle time
+ * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
+ * @val: The bank timing register value, shifed down.
+ */
+static unsigned int get_0124(unsigned long hclk_tns,
+                            unsigned long val)
+{
+       val &= 3;
+       return hclk_tns * ((val == 3) ? 4 : val);
+}
+
+/**
+ * s3c2410_iotiming_getbank - turn BANKCON into cycle time information
+ * @cfg: The frequency configuration
+ * @bt: The bank timing to fill in (uses cached BANKCON)
+ *
+ * Given the BANKCON setting in @bt and the current frequency settings
+ * in @cfg, update the cycle timing information.
+ */
+static void s3c2410_iotiming_getbank(struct s3c_cpufreq_config *cfg,
+                                    struct s3c2410_iobank_timing *bt)
+{
+       unsigned long bankcon = bt->bankcon;
+       unsigned long hclk = cfg->freq.hclk_tns;
+
+       bt->tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT);
+       bt->tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT);
+       bt->tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT);
+       bt->tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT);
+       bt->tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT);
+}
+
+/**
+ * s3c2410_iotiming_debugfs - debugfs show io bank timing information
+ * @seq: The seq_file to write output to using seq_printf().
+ * @cfg: The current configuration.
+ * @iob: The IO bank information to decode.
+ */
+void s3c2410_iotiming_debugfs(struct seq_file *seq,
+                             struct s3c_cpufreq_config *cfg,
+                             union s3c_iobank *iob)
+{
+       struct s3c2410_iobank_timing *bt = iob->io_2410;
+       unsigned long bankcon = bt->bankcon;
+       unsigned long hclk = cfg->freq.hclk_tns;
+       unsigned int tacs;
+       unsigned int tcos;
+       unsigned int tacc;
+       unsigned int tcoh;
+       unsigned int tcah;
+
+       seq_printf(seq, "BANKCON=0x%08lx\n", bankcon);
+
+       tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT);
+       tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT);
+       tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT);
+       tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT);
+       tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT);
+
+       seq_printf(seq,
+                  "\tRead: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
+                  print_ns(bt->tacs),
+                  print_ns(bt->tcos),
+                  print_ns(bt->tacc),
+                  print_ns(bt->tcoh),
+                  print_ns(bt->tcah));
+
+       seq_printf(seq,
+                  "\t Set: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
+                  print_ns(tacs),
+                  print_ns(tcos),
+                  print_ns(tacc),
+                  print_ns(tcoh),
+                  print_ns(tcah));
+}
+
+/**
+ * s3c2410_iotiming_calc - Calculate bank timing for frequency change.
+ * @cfg: The frequency configuration
+ * @iot: The IO timing information to fill out.
+ *
+ * Calculate the new values for the banks in @iot based on the new
+ * frequency information in @cfg. This is then used by s3c2410_iotiming_set()
+ * to update the timing when necessary.
+ */
+int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
+                         struct s3c_iotimings *iot)
+{
+       struct s3c2410_iobank_timing *bt;
+       unsigned long bankcon;
+       int bank;
+       int ret;
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bankcon = __raw_readl(bank_reg(bank));
+               bt = iot->bank[bank].io_2410;
+
+               if (!bt)
+                       continue;
+
+               bt->bankcon = bankcon;
+
+               ret = s3c2410_calc_bank(cfg, bt);
+               if (ret) {
+                       printk(KERN_ERR "%s: cannot calculate bank %d io\n",
+                              __func__, bank);
+                       goto err;
+               }
+
+               s3c_freq_iodbg("%s: bank %d: con=%08lx\n",
+                              __func__, bank, bt->bankcon);
+       }
+
+       return 0;
+ err:
+       return ret;
+}
+
+/**
+ * s3c2410_iotiming_set - set the IO timings from the given setup.
+ * @cfg: The frequency configuration
+ * @iot: The IO timing information to use.
+ *
+ * Set all the currently used IO bank timing information generated
+ * by s3c2410_iotiming_calc() once the core has validated that all
+ * the new values are within permitted bounds.
+ */
+void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
+                         struct s3c_iotimings *iot)
+{
+       struct s3c2410_iobank_timing *bt;
+       int bank;
+
+       /* set the io timings from the specifier */
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bt = iot->bank[bank].io_2410;
+               if (!bt)
+                       continue;
+
+               __raw_writel(bt->bankcon, bank_reg(bank));
+       }
+}
+
+/**
+ * s3c2410_iotiming_get - Get the timing information from current registers.
+ * @cfg: The frequency configuration
+ * @timings: The IO timing information to fill out.
+ *
+ * Calculate the @timings timing information from the current frequency
+ * information in @cfg, and the new frequency configuration
+ * through all the IO banks, reading the state and then updating @iot
+ * as necessary.
+ *
+ * This is used at the moment on initialisation to get the current
+ * configuration so that boards do not have to carry their own setup
+ * if the timings are correct on initialisation.
+ */
+
+int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
+                        struct s3c_iotimings *timings)
+{
+       struct s3c2410_iobank_timing *bt;
+       unsigned long bankcon;
+       unsigned long bwscon;
+       int bank;
+
+       bwscon = __raw_readl(S3C2410_BWSCON);
+
+       /* look through all banks to see what is currently set. */
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bankcon = __raw_readl(bank_reg(bank));
+
+               if (!bank_is_io(bankcon))
+                       continue;
+
+               s3c_freq_iodbg("%s: bank %d: con %08lx\n",
+                              __func__, bank, bankcon);
+
+               bt = kzalloc(sizeof(*bt), GFP_KERNEL);
+               if (!bt)
+                       return -ENOMEM;
+
+               /* find out in nWait is enabled for bank. */
+
+               if (bank != 0) {
+                       unsigned long tmp  = S3C2410_BWSCON_GET(bwscon, bank);
+                       if (tmp & S3C2410_BWSCON_WS)
+                               bt->nwait_en = 1;
+               }
+
+               timings->bank[bank].io_2410 = bt;
+               bt->bankcon = bankcon;
+
+               s3c2410_iotiming_getbank(cfg, bt);
+       }
+
+       s3c2410_print_timing("get", timings);
+       return 0;
+}
diff --git a/arch/arm/mach-s3c/iotiming-s3c2412.c b/arch/arm/mach-s3c/iotiming-s3c2412.c
new file mode 100644 (file)
index 0000000..003f89c
--- /dev/null
@@ -0,0 +1,278 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006-2008 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C2412/S3C2443 (PL093 based) IO timing support
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/cpufreq.h>
+#include <linux/seq_file.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+
+#include <linux/amba/pl093.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+
+#include "s3c2412.h"
+
+#define print_ns(x) ((x) / 10), ((x) % 10)
+
+/**
+ * s3c2412_print_timing - print timing information via printk.
+ * @pfx: The prefix to print each line with.
+ * @iot: The IO timing information
+ */
+static void s3c2412_print_timing(const char *pfx, struct s3c_iotimings *iot)
+{
+       struct s3c2412_iobank_timing *bt;
+       unsigned int bank;
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bt = iot->bank[bank].io_2412;
+               if (!bt)
+                       continue;
+
+               printk(KERN_DEBUG "%s: %d: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
+                      "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", pfx, bank,
+                      print_ns(bt->idcy),
+                      print_ns(bt->wstrd),
+                      print_ns(bt->wstwr),
+                      print_ns(bt->wstoen),
+                      print_ns(bt->wstwen),
+                      print_ns(bt->wstbrd));
+       }
+}
+
+/**
+ * to_div - turn a cycle length into a divisor setting.
+ * @cyc_tns: The cycle time in 10ths of nanoseconds.
+ * @clk_tns: The clock period in 10ths of nanoseconds.
+ */
+static inline unsigned int to_div(unsigned int cyc_tns, unsigned int clk_tns)
+{
+       return cyc_tns ? DIV_ROUND_UP(cyc_tns, clk_tns) : 0;
+}
+
+/**
+ * calc_timing - calculate timing divisor value and check in range.
+ * @hwtm: The hardware timing in 10ths of nanoseconds.
+ * @clk_tns: The clock period in 10ths of nanoseconds.
+ * @err: Pointer to err variable to update in event of failure.
+ */
+static unsigned int calc_timing(unsigned int hwtm, unsigned int clk_tns,
+                               unsigned int *err)
+{
+       unsigned int ret = to_div(hwtm, clk_tns);
+
+       if (ret > 0xf)
+               *err = -EINVAL;
+
+       return ret;
+}
+
+/**
+ * s3c2412_calc_bank - calculate the bank divisor settings.
+ * @cfg: The current frequency configuration.
+ * @bt: The bank timing.
+ */
+static int s3c2412_calc_bank(struct s3c_cpufreq_config *cfg,
+                            struct s3c2412_iobank_timing *bt)
+{
+       unsigned int hclk = cfg->freq.hclk_tns;
+       int err = 0;
+
+       bt->smbidcyr = calc_timing(bt->idcy, hclk, &err);
+       bt->smbwstrd = calc_timing(bt->wstrd, hclk, &err);
+       bt->smbwstwr = calc_timing(bt->wstwr, hclk, &err);
+       bt->smbwstoen = calc_timing(bt->wstoen, hclk, &err);
+       bt->smbwstwen = calc_timing(bt->wstwen, hclk, &err);
+       bt->smbwstbrd = calc_timing(bt->wstbrd, hclk, &err);
+
+       return err;
+}
+
+/**
+ * s3c2412_iotiming_debugfs - debugfs show io bank timing information
+ * @seq: The seq_file to write output to using seq_printf().
+ * @cfg: The current configuration.
+ * @iob: The IO bank information to decode.
+*/
+void s3c2412_iotiming_debugfs(struct seq_file *seq,
+                             struct s3c_cpufreq_config *cfg,
+                             union s3c_iobank *iob)
+{
+       struct s3c2412_iobank_timing *bt = iob->io_2412;
+
+       seq_printf(seq,
+                  "\tRead: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
+                  "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n",
+                  print_ns(bt->idcy),
+                  print_ns(bt->wstrd),
+                  print_ns(bt->wstwr),
+                  print_ns(bt->wstoen),
+                  print_ns(bt->wstwen),
+                  print_ns(bt->wstbrd));
+}
+
+/**
+ * s3c2412_iotiming_calc - calculate all the bank divisor settings.
+ * @cfg: The current frequency configuration.
+ * @iot: The bank timing information.
+ *
+ * Calculate the timing information for all the banks that are
+ * configured as IO, using s3c2412_calc_bank().
+ */
+int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
+                         struct s3c_iotimings *iot)
+{
+       struct s3c2412_iobank_timing *bt;
+       int bank;
+       int ret;
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bt = iot->bank[bank].io_2412;
+               if (!bt)
+                       continue;
+
+               ret = s3c2412_calc_bank(cfg, bt);
+               if (ret) {
+                       printk(KERN_ERR "%s: cannot calculate bank %d io\n",
+                              __func__, bank);
+                       goto err;
+               }
+       }
+
+       return 0;
+ err:
+       return ret;
+}
+
+/**
+ * s3c2412_iotiming_set - set the timing information
+ * @cfg: The current frequency configuration.
+ * @iot: The bank timing information.
+ *
+ * Set the IO bank information from the details calculated earlier from
+ * calling s3c2412_iotiming_calc().
+ */
+void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
+                         struct s3c_iotimings *iot)
+{
+       struct s3c2412_iobank_timing *bt;
+       void __iomem *regs;
+       int bank;
+
+       /* set the io timings from the specifier */
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               bt = iot->bank[bank].io_2412;
+               if (!bt)
+                       continue;
+
+               regs = S3C2412_SSMC_BANK(bank);
+
+               __raw_writel(bt->smbidcyr, regs + SMBIDCYR);
+               __raw_writel(bt->smbwstrd, regs + SMBWSTRDR);
+               __raw_writel(bt->smbwstwr, regs + SMBWSTWRR);
+               __raw_writel(bt->smbwstoen, regs + SMBWSTOENR);
+               __raw_writel(bt->smbwstwen, regs + SMBWSTWENR);
+               __raw_writel(bt->smbwstbrd, regs + SMBWSTBRDR);
+       }
+}
+
+static inline unsigned int s3c2412_decode_timing(unsigned int clock, u32 reg)
+{
+       return (reg & 0xf) * clock;
+}
+
+static void s3c2412_iotiming_getbank(struct s3c_cpufreq_config *cfg,
+                                    struct s3c2412_iobank_timing *bt,
+                                    unsigned int bank)
+{
+       unsigned long clk = cfg->freq.hclk_tns;  /* ssmc clock??? */
+       void __iomem *regs = S3C2412_SSMC_BANK(bank);
+
+       bt->idcy = s3c2412_decode_timing(clk, __raw_readl(regs + SMBIDCYR));
+       bt->wstrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTRDR));
+       bt->wstoen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTOENR));
+       bt->wstwen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTWENR));
+       bt->wstbrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTBRDR));
+}
+
+/**
+ * bank_is_io - return true if bank is (possibly) IO.
+ * @bank: The bank number.
+ * @bankcfg: The value of S3C2412_EBI_BANKCFG.
+ */
+static inline bool bank_is_io(unsigned int bank, u32 bankcfg)
+{
+       if (bank < 2)
+               return true;
+
+       return !(bankcfg & (1 << bank));
+}
+
+int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
+                        struct s3c_iotimings *timings)
+{
+       struct s3c2412_iobank_timing *bt;
+       u32 bankcfg = __raw_readl(S3C2412_EBI_BANKCFG);
+       unsigned int bank;
+
+       /* look through all banks to see what is currently set. */
+
+       for (bank = 0; bank < MAX_BANKS; bank++) {
+               if (!bank_is_io(bank, bankcfg))
+                       continue;
+
+               bt = kzalloc(sizeof(*bt), GFP_KERNEL);
+               if (!bt)
+                       return -ENOMEM;
+
+               timings->bank[bank].io_2412 = bt;
+               s3c2412_iotiming_getbank(cfg, bt, bank);
+       }
+
+       s3c2412_print_timing("get", timings);
+       return 0;
+}
+
+/* this is in here as it is so small, it doesn't currently warrant a file
+ * to itself. We expect that any s3c24xx needing this is going to also
+ * need the iotiming support.
+ */
+void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
+{
+       struct s3c_cpufreq_board *board = cfg->board;
+       u32 refresh;
+
+       WARN_ON(board == NULL);
+
+       /* Reduce both the refresh time (in ns) and the frequency (in MHz)
+        * down to ensure that we do not overflow 32 bit numbers.
+        *
+        * This should work for HCLK up to 133MHz and refresh period up
+        * to 30usec.
+        */
+
+       refresh = (cfg->freq.hclk / 100) * (board->refresh / 10);
+       refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale  */
+       refresh &= ((1 << 16) - 1);
+
+       s3c_freq_dbg("%s: refresh value %u\n", __func__, (unsigned int)refresh);
+
+       __raw_writel(refresh, S3C2412_REFRESH);
+}
diff --git a/arch/arm/mach-s3c/irq-pm-s3c24xx.c b/arch/arm/mach-s3c/irq-pm-s3c24xx.c
new file mode 100644 (file)
index 0000000..4d5e283
--- /dev/null
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2003-2004 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// S3C24XX - IRQ PM code
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/syscore_ops.h>
+#include <linux/io.h>
+
+#include "cpu.h"
+#include "pm.h"
+#include <mach/map-base.h>
+#include "map-s3c.h"
+
+#include "regs-irq.h"
+#include "regs-gpio.h"
+#include "pm-core.h"
+
+#include <asm/irq.h>
+
+int s3c_irq_wake(struct irq_data *data, unsigned int state)
+{
+       unsigned long irqbit = 1 << data->hwirq;
+
+       if (!(s3c_irqwake_intallow & irqbit))
+               return -ENOENT;
+
+       pr_info("wake %s for hwirq %lu\n",
+               state ? "enabled" : "disabled", data->hwirq);
+
+       if (!state)
+               s3c_irqwake_intmask |= irqbit;
+       else
+               s3c_irqwake_intmask &= ~irqbit;
+
+       return 0;
+}
+
+static struct sleep_save irq_save[] = {
+       SAVE_ITEM(S3C2410_INTMSK),
+       SAVE_ITEM(S3C2410_INTSUBMSK),
+};
+
+/* the extint values move between the s3c2410/s3c2440 and the s3c2412
+ * so we use an array to hold them, and to calculate the address of
+ * the register at run-time
+*/
+
+static unsigned long save_extint[3];
+static unsigned long save_eintflt[4];
+static unsigned long save_eintmask;
+
+static int s3c24xx_irq_suspend(void)
+{
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(save_extint); i++)
+               save_extint[i] = __raw_readl(S3C24XX_EXTINT0 + (i*4));
+
+       for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
+               save_eintflt[i] = __raw_readl(S3C24XX_EINFLT0 + (i*4));
+
+       s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
+       save_eintmask = __raw_readl(S3C24XX_EINTMASK);
+
+       return 0;
+}
+
+static void s3c24xx_irq_resume(void)
+{
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(save_extint); i++)
+               __raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
+
+       for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
+               __raw_writel(save_eintflt[i], S3C24XX_EINFLT0 + (i*4));
+
+       s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
+       __raw_writel(save_eintmask, S3C24XX_EINTMASK);
+}
+
+struct syscore_ops s3c24xx_irq_syscore_ops = {
+       .suspend        = s3c24xx_irq_suspend,
+       .resume         = s3c24xx_irq_resume,
+};
+
+#ifdef CONFIG_CPU_S3C2416
+static struct sleep_save s3c2416_irq_save[] = {
+       SAVE_ITEM(S3C2416_INTMSK2),
+};
+
+static int s3c2416_irq_suspend(void)
+{
+       s3c_pm_do_save(s3c2416_irq_save, ARRAY_SIZE(s3c2416_irq_save));
+
+       return 0;
+}
+
+static void s3c2416_irq_resume(void)
+{
+       s3c_pm_do_restore(s3c2416_irq_save, ARRAY_SIZE(s3c2416_irq_save));
+}
+
+struct syscore_ops s3c2416_irq_syscore_ops = {
+       .suspend        = s3c2416_irq_suspend,
+       .resume         = s3c2416_irq_resume,
+};
+#endif
diff --git a/arch/arm/mach-s3c/irq-pm-s3c64xx.c b/arch/arm/mach-s3c/irq-pm-s3c64xx.c
new file mode 100644 (file)
index 0000000..4a1e935
--- /dev/null
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//      Ben Dooks <ben@simtec.co.uk>
+//      http://armlinux.simtec.co.uk/
+//
+// S3C64XX - Interrupt handling Power Management
+
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
+#include <linux/kernel.h>
+#include <linux/syscore_ops.h>
+#include <linux/interrupt.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/of.h>
+
+#include "map.h"
+
+#include "regs-gpio.h"
+#include "cpu.h"
+#include "pm.h"
+
+/* We handled all the IRQ types in this code, to save having to make several
+ * small files to handle each different type separately. Having the EINT_GRP
+ * code here shouldn't be as much bloat as the IRQ table space needed when
+ * they are enabled. The added benefit is we ensure that these registers are
+ * in the same state as we suspended.
+ */
+
+static struct sleep_save irq_save[] = {
+       SAVE_ITEM(S3C64XX_PRIORITY),
+       SAVE_ITEM(S3C64XX_EINT0CON0),
+       SAVE_ITEM(S3C64XX_EINT0CON1),
+       SAVE_ITEM(S3C64XX_EINT0FLTCON0),
+       SAVE_ITEM(S3C64XX_EINT0FLTCON1),
+       SAVE_ITEM(S3C64XX_EINT0FLTCON2),
+       SAVE_ITEM(S3C64XX_EINT0FLTCON3),
+       SAVE_ITEM(S3C64XX_EINT0MASK),
+};
+
+static struct irq_grp_save {
+       u32     fltcon;
+       u32     con;
+       u32     mask;
+} eint_grp_save[5];
+
+#ifndef CONFIG_SERIAL_SAMSUNG_UARTS
+#define SERIAL_SAMSUNG_UARTS 0
+#else
+#define        SERIAL_SAMSUNG_UARTS CONFIG_SERIAL_SAMSUNG_UARTS
+#endif
+
+static u32 irq_uart_mask[SERIAL_SAMSUNG_UARTS];
+
+static int s3c64xx_irq_pm_suspend(void)
+{
+       struct irq_grp_save *grp = eint_grp_save;
+       int i;
+
+       S3C_PMDBG("%s: suspending IRQs\n", __func__);
+
+       s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
+
+       for (i = 0; i < SERIAL_SAMSUNG_UARTS; i++)
+               irq_uart_mask[i] = __raw_readl(S3C_VA_UARTx(i) + S3C64XX_UINTM);
+
+       for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
+               grp->con = __raw_readl(S3C64XX_EINT12CON + (i * 4));
+               grp->mask = __raw_readl(S3C64XX_EINT12MASK + (i * 4));
+               grp->fltcon = __raw_readl(S3C64XX_EINT12FLTCON + (i * 4));
+       }
+
+       return 0;
+}
+
+static void s3c64xx_irq_pm_resume(void)
+{
+       struct irq_grp_save *grp = eint_grp_save;
+       int i;
+
+       S3C_PMDBG("%s: resuming IRQs\n", __func__);
+
+       s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
+
+       for (i = 0; i < SERIAL_SAMSUNG_UARTS; i++)
+               __raw_writel(irq_uart_mask[i], S3C_VA_UARTx(i) + S3C64XX_UINTM);
+
+       for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
+               __raw_writel(grp->con, S3C64XX_EINT12CON + (i * 4));
+               __raw_writel(grp->mask, S3C64XX_EINT12MASK + (i * 4));
+               __raw_writel(grp->fltcon, S3C64XX_EINT12FLTCON + (i * 4));
+       }
+
+       S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
+}
+
+static struct syscore_ops s3c64xx_irq_syscore_ops = {
+       .suspend = s3c64xx_irq_pm_suspend,
+       .resume  = s3c64xx_irq_pm_resume,
+};
+
+static __init int s3c64xx_syscore_init(void)
+{
+       /* Appropriate drivers (pinctrl, uart) handle this when using DT. */
+       if (of_have_populated_dt() || !soc_is_s3c64xx())
+               return 0;
+
+       register_syscore_ops(&s3c64xx_irq_syscore_ops);
+
+       return 0;
+}
+
+core_initcall(s3c64xx_syscore_init);
diff --git a/arch/arm/mach-s3c/irq-s3c24xx-fiq-exports.c b/arch/arm/mach-s3c/irq-s3c24xx-fiq-exports.c
new file mode 100644 (file)
index 0000000..84cf863
--- /dev/null
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/stddef.h>
+#include <linux/export.h>
+#include <linux/spi/s3c24xx-fiq.h>
+
+EXPORT_SYMBOL(s3c24xx_spi_fiq_rx);
+EXPORT_SYMBOL(s3c24xx_spi_fiq_txrx);
+EXPORT_SYMBOL(s3c24xx_spi_fiq_tx);
diff --git a/arch/arm/mach-s3c/irq-s3c24xx-fiq.S b/arch/arm/mach-s3c/irq-s3c24xx-fiq.S
new file mode 100644 (file)
index 0000000..b54cbd0
--- /dev/null
@@ -0,0 +1,115 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* linux/drivers/spi/spi_s3c24xx_fiq.S
+ *
+ * Copyright 2009 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C24XX SPI - FIQ pseudo-DMA transfer code
+*/
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+#include "map.h"
+#include "regs-irq.h"
+
+#include <linux/spi/s3c24xx-fiq.h>
+
+#define S3C2410_SPTDAT           (0x10)
+#define S3C2410_SPRDAT           (0x14)
+
+       .text
+
+       @ entry to these routines is as follows, with the register names
+       @ defined in fiq.h so that they can be shared with the C files which
+       @ setup the calling registers.
+       @
+       @ fiq_rirq      The base of the IRQ registers to find S3C2410_SRCPND
+       @ fiq_rtmp      Temporary register to hold tx/rx data
+       @ fiq_rspi      The base of the SPI register block
+       @ fiq_rtx       The tx buffer pointer
+       @ fiq_rrx       The rx buffer pointer
+       @ fiq_rcount    The number of bytes to move
+
+       @ each entry starts with a word entry of how long it is
+       @ and an offset to the irq acknowledgment word
+
+ENTRY(s3c24xx_spi_fiq_rx)
+s3c24xx_spi_fix_rx:
+       .word   fiq_rx_end - fiq_rx_start
+       .word   fiq_rx_irq_ack - fiq_rx_start
+fiq_rx_start:
+       ldr     fiq_rtmp, fiq_rx_irq_ack
+       str     fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
+
+       ldrb    fiq_rtmp, [ fiq_rspi, #  S3C2410_SPRDAT ]
+       strb    fiq_rtmp, [ fiq_rrx ], #1
+
+       mov     fiq_rtmp, #0xff
+       strb    fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
+
+       subs    fiq_rcount, fiq_rcount, #1
+       subnes  pc, lr, #4              @@ return, still have work to do
+
+       @@ set IRQ controller so that next op will trigger IRQ
+       mov     fiq_rtmp, #0
+       str     fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
+       subs    pc, lr, #4
+
+fiq_rx_irq_ack:
+       .word   0
+fiq_rx_end:
+
+ENTRY(s3c24xx_spi_fiq_txrx)
+s3c24xx_spi_fiq_txrx:
+       .word   fiq_txrx_end - fiq_txrx_start
+       .word   fiq_txrx_irq_ack - fiq_txrx_start
+fiq_txrx_start:
+
+       ldrb    fiq_rtmp, [ fiq_rspi, #  S3C2410_SPRDAT ]
+       strb    fiq_rtmp, [ fiq_rrx ], #1
+
+       ldr     fiq_rtmp, fiq_txrx_irq_ack
+       str     fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
+
+       ldrb    fiq_rtmp, [ fiq_rtx ], #1
+       strb    fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
+
+       subs    fiq_rcount, fiq_rcount, #1
+       subnes  pc, lr, #4              @@ return, still have work to do
+
+       mov     fiq_rtmp, #0
+       str     fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
+       subs    pc, lr, #4
+
+fiq_txrx_irq_ack:
+       .word   0
+
+fiq_txrx_end:
+
+ENTRY(s3c24xx_spi_fiq_tx)
+s3c24xx_spi_fix_tx:
+       .word   fiq_tx_end - fiq_tx_start
+       .word   fiq_tx_irq_ack - fiq_tx_start
+fiq_tx_start:
+       ldrb    fiq_rtmp, [ fiq_rspi, #  S3C2410_SPRDAT ]
+
+       ldr     fiq_rtmp, fiq_tx_irq_ack
+       str     fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
+
+       ldrb    fiq_rtmp, [ fiq_rtx ], #1
+       strb    fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
+
+       subs    fiq_rcount, fiq_rcount, #1
+       subnes  pc, lr, #4              @@ return, still have work to do
+
+       mov     fiq_rtmp, #0
+       str     fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
+       subs    pc, lr, #4
+
+fiq_tx_irq_ack:
+       .word   0
+
+fiq_tx_end:
+
+       .end
diff --git a/arch/arm/mach-s3c/irq-s3c24xx.c b/arch/arm/mach-s3c/irq-s3c24xx.c
new file mode 100644 (file)
index 0000000..79b5f19
--- /dev/null
@@ -0,0 +1,1337 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * S3C24XX IRQ handling
+ *
+ * Copyright (c) 2003-2004 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
+*/
+
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/err.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/device.h>
+#include <linux/irqdomain.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+#include <asm/exception.h>
+#include <asm/mach/irq.h>
+
+#include <mach/irqs.h>
+#include "regs-irq.h"
+#include "regs-gpio.h"
+
+#include "cpu.h"
+#include "regs-irqtype.h"
+#include "pm.h"
+
+#define S3C_IRQTYPE_NONE       0
+#define S3C_IRQTYPE_EINT       1
+#define S3C_IRQTYPE_EDGE       2
+#define S3C_IRQTYPE_LEVEL      3
+
+struct s3c_irq_data {
+       unsigned int type;
+       unsigned long offset;
+       unsigned long parent_irq;
+
+       /* data gets filled during init */
+       struct s3c_irq_intc *intc;
+       unsigned long sub_bits;
+       struct s3c_irq_intc *sub_intc;
+};
+
+/*
+ * Structure holding the controller data
+ * @reg_pending                register holding pending irqs
+ * @reg_intpnd         special register intpnd in main intc
+ * @reg_mask           mask register
+ * @domain             irq_domain of the controller
+ * @parent             parent controller for ext and sub irqs
+ * @irqs               irq-data, always s3c_irq_data[32]
+ */
+struct s3c_irq_intc {
+       void __iomem            *reg_pending;
+       void __iomem            *reg_intpnd;
+       void __iomem            *reg_mask;
+       struct irq_domain       *domain;
+       struct s3c_irq_intc     *parent;
+       struct s3c_irq_data     *irqs;
+};
+
+/*
+ * Array holding pointers to the global controller structs
+ * [0] ... main_intc
+ * [1] ... sub_intc
+ * [2] ... main_intc2 on s3c2416
+ */
+static struct s3c_irq_intc *s3c_intc[3];
+
+static void s3c_irq_mask(struct irq_data *data)
+{
+       struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
+       struct s3c_irq_intc *intc = irq_data->intc;
+       struct s3c_irq_intc *parent_intc = intc->parent;
+       struct s3c_irq_data *parent_data;
+       unsigned long mask;
+       unsigned int irqno;
+
+       mask = readl_relaxed(intc->reg_mask);
+       mask |= (1UL << irq_data->offset);
+       writel_relaxed(mask, intc->reg_mask);
+
+       if (parent_intc) {
+               parent_data = &parent_intc->irqs[irq_data->parent_irq];
+
+               /* check to see if we need to mask the parent IRQ
+                * The parent_irq is always in main_intc, so the hwirq
+                * for find_mapping does not need an offset in any case.
+                */
+               if ((mask & parent_data->sub_bits) == parent_data->sub_bits) {
+                       irqno = irq_find_mapping(parent_intc->domain,
+                                        irq_data->parent_irq);
+                       s3c_irq_mask(irq_get_irq_data(irqno));
+               }
+       }
+}
+
+static void s3c_irq_unmask(struct irq_data *data)
+{
+       struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
+       struct s3c_irq_intc *intc = irq_data->intc;
+       struct s3c_irq_intc *parent_intc = intc->parent;
+       unsigned long mask;
+       unsigned int irqno;
+
+       mask = readl_relaxed(intc->reg_mask);
+       mask &= ~(1UL << irq_data->offset);
+       writel_relaxed(mask, intc->reg_mask);
+
+       if (parent_intc) {
+               irqno = irq_find_mapping(parent_intc->domain,
+                                        irq_data->parent_irq);
+               s3c_irq_unmask(irq_get_irq_data(irqno));
+       }
+}
+
+static inline void s3c_irq_ack(struct irq_data *data)
+{
+       struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
+       struct s3c_irq_intc *intc = irq_data->intc;
+       unsigned long bitval = 1UL << irq_data->offset;
+
+       writel_relaxed(bitval, intc->reg_pending);
+       if (intc->reg_intpnd)
+               writel_relaxed(bitval, intc->reg_intpnd);
+}
+
+static int s3c_irq_type(struct irq_data *data, unsigned int type)
+{
+       switch (type) {
+       case IRQ_TYPE_NONE:
+               break;
+       case IRQ_TYPE_EDGE_RISING:
+       case IRQ_TYPE_EDGE_FALLING:
+       case IRQ_TYPE_EDGE_BOTH:
+               irq_set_handler(data->irq, handle_edge_irq);
+               break;
+       case IRQ_TYPE_LEVEL_LOW:
+       case IRQ_TYPE_LEVEL_HIGH:
+               irq_set_handler(data->irq, handle_level_irq);
+               break;
+       default:
+               pr_err("No such irq type %d\n", type);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int s3c_irqext_type_set(void __iomem *gpcon_reg,
+                              void __iomem *extint_reg,
+                              unsigned long gpcon_offset,
+                              unsigned long extint_offset,
+                              unsigned int type)
+{
+       unsigned long newvalue = 0, value;
+
+       /* Set the GPIO to external interrupt mode */
+       value = readl_relaxed(gpcon_reg);
+       value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset);
+       writel_relaxed(value, gpcon_reg);
+
+       /* Set the external interrupt to pointed trigger type */
+       switch (type)
+       {
+               case IRQ_TYPE_NONE:
+                       pr_warn("No edge setting!\n");
+                       break;
+
+               case IRQ_TYPE_EDGE_RISING:
+                       newvalue = S3C2410_EXTINT_RISEEDGE;
+                       break;
+
+               case IRQ_TYPE_EDGE_FALLING:
+                       newvalue = S3C2410_EXTINT_FALLEDGE;
+                       break;
+
+               case IRQ_TYPE_EDGE_BOTH:
+                       newvalue = S3C2410_EXTINT_BOTHEDGE;
+                       break;
+
+               case IRQ_TYPE_LEVEL_LOW:
+                       newvalue = S3C2410_EXTINT_LOWLEV;
+                       break;
+
+               case IRQ_TYPE_LEVEL_HIGH:
+                       newvalue = S3C2410_EXTINT_HILEV;
+                       break;
+
+               default:
+                       pr_err("No such irq type %d\n", type);
+                       return -EINVAL;
+       }
+
+       value = readl_relaxed(extint_reg);
+       value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
+       writel_relaxed(value, extint_reg);
+
+       return 0;
+}
+
+static int s3c_irqext_type(struct irq_data *data, unsigned int type)
+{
+       void __iomem *extint_reg;
+       void __iomem *gpcon_reg;
+       unsigned long gpcon_offset, extint_offset;
+
+       if ((data->hwirq >= 4) && (data->hwirq <= 7)) {
+               gpcon_reg = S3C2410_GPFCON;
+               extint_reg = S3C24XX_EXTINT0;
+               gpcon_offset = (data->hwirq) * 2;
+               extint_offset = (data->hwirq) * 4;
+       } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) {
+               gpcon_reg = S3C2410_GPGCON;
+               extint_reg = S3C24XX_EXTINT1;
+               gpcon_offset = (data->hwirq - 8) * 2;
+               extint_offset = (data->hwirq - 8) * 4;
+       } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) {
+               gpcon_reg = S3C2410_GPGCON;
+               extint_reg = S3C24XX_EXTINT2;
+               gpcon_offset = (data->hwirq - 8) * 2;
+               extint_offset = (data->hwirq - 16) * 4;
+       } else {
+               return -EINVAL;
+       }
+
+       return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
+                                  extint_offset, type);
+}
+
+static int s3c_irqext0_type(struct irq_data *data, unsigned int type)
+{
+       void __iomem *extint_reg;
+       void __iomem *gpcon_reg;
+       unsigned long gpcon_offset, extint_offset;
+
+       if (data->hwirq <= 3) {
+               gpcon_reg = S3C2410_GPFCON;
+               extint_reg = S3C24XX_EXTINT0;
+               gpcon_offset = (data->hwirq) * 2;
+               extint_offset = (data->hwirq) * 4;
+       } else {
+               return -EINVAL;
+       }
+
+       return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
+                                  extint_offset, type);
+}
+
+static struct irq_chip s3c_irq_chip = {
+       .name           = "s3c",
+       .irq_ack        = s3c_irq_ack,
+       .irq_mask       = s3c_irq_mask,
+       .irq_unmask     = s3c_irq_unmask,
+       .irq_set_type   = s3c_irq_type,
+       .irq_set_wake   = s3c_irq_wake
+};
+
+static struct irq_chip s3c_irq_level_chip = {
+       .name           = "s3c-level",
+       .irq_mask       = s3c_irq_mask,
+       .irq_unmask     = s3c_irq_unmask,
+       .irq_ack        = s3c_irq_ack,
+       .irq_set_type   = s3c_irq_type,
+};
+
+static struct irq_chip s3c_irqext_chip = {
+       .name           = "s3c-ext",
+       .irq_mask       = s3c_irq_mask,
+       .irq_unmask     = s3c_irq_unmask,
+       .irq_ack        = s3c_irq_ack,
+       .irq_set_type   = s3c_irqext_type,
+       .irq_set_wake   = s3c_irqext_wake
+};
+
+static struct irq_chip s3c_irq_eint0t4 = {
+       .name           = "s3c-ext0",
+       .irq_ack        = s3c_irq_ack,
+       .irq_mask       = s3c_irq_mask,
+       .irq_unmask     = s3c_irq_unmask,
+       .irq_set_wake   = s3c_irq_wake,
+       .irq_set_type   = s3c_irqext0_type,
+};
+
+static void s3c_irq_demux(struct irq_desc *desc)
+{
+       struct irq_chip *chip = irq_desc_get_chip(desc);
+       struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc);
+       struct s3c_irq_intc *intc = irq_data->intc;
+       struct s3c_irq_intc *sub_intc = irq_data->sub_intc;
+       unsigned int n, offset, irq;
+       unsigned long src, msk;
+
+       /* we're using individual domains for the non-dt case
+        * and one big domain for the dt case where the subintc
+        * starts at hwirq number 32.
+        */
+       offset = irq_domain_get_of_node(intc->domain) ? 32 : 0;
+
+       chained_irq_enter(chip, desc);
+
+       src = readl_relaxed(sub_intc->reg_pending);
+       msk = readl_relaxed(sub_intc->reg_mask);
+
+       src &= ~msk;
+       src &= irq_data->sub_bits;
+
+       while (src) {
+               n = __ffs(src);
+               src &= ~(1 << n);
+               irq = irq_find_mapping(sub_intc->domain, offset + n);
+               generic_handle_irq(irq);
+       }
+
+       chained_irq_exit(chip, desc);
+}
+
+static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
+                                     struct pt_regs *regs, int intc_offset)
+{
+       int pnd;
+       int offset;
+
+       pnd = readl_relaxed(intc->reg_intpnd);
+       if (!pnd)
+               return false;
+
+       /* non-dt machines use individual domains */
+       if (!irq_domain_get_of_node(intc->domain))
+               intc_offset = 0;
+
+       /* We have a problem that the INTOFFSET register does not always
+        * show one interrupt. Occasionally we get two interrupts through
+        * the prioritiser, and this causes the INTOFFSET register to show
+        * what looks like the logical-or of the two interrupt numbers.
+        *
+        * Thanks to Klaus, Shannon, et al for helping to debug this problem
+        */
+       offset = readl_relaxed(intc->reg_intpnd + 4);
+
+       /* Find the bit manually, when the offset is wrong.
+        * The pending register only ever contains the one bit of the next
+        * interrupt to handle.
+        */
+       if (!(pnd & (1 << offset)))
+               offset =  __ffs(pnd);
+
+       handle_domain_irq(intc->domain, intc_offset + offset, regs);
+       return true;
+}
+
+asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
+{
+       do {
+               if (likely(s3c_intc[0]))
+                       if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
+                               continue;
+
+               if (s3c_intc[2])
+                       if (s3c24xx_handle_intc(s3c_intc[2], regs, 64))
+                               continue;
+
+               break;
+       } while (1);
+}
+
+#ifdef CONFIG_FIQ
+/**
+ * s3c24xx_set_fiq - set the FIQ routing
+ * @irq: IRQ number to route to FIQ on processor.
+ * @ack_ptr: pointer to a location for storing the bit mask
+ * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing.
+ *
+ * Change the state of the IRQ to FIQ routing depending on @irq and @on. If
+ * @on is true, the @irq is checked to see if it can be routed and the
+ * interrupt controller updated to route the IRQ. If @on is false, the FIQ
+ * routing is cleared, regardless of which @irq is specified.
+ *
+ * returns the mask value for the register.
+ */
+int s3c24xx_set_fiq(unsigned int irq, u32 *ack_ptr, bool on)
+{
+       u32 intmod;
+       unsigned offs;
+
+       if (on) {
+               offs = irq - FIQ_START;
+               if (offs > 31)
+                       return 0;
+
+               intmod = 1 << offs;
+       } else {
+               intmod = 0;
+       }
+
+       if (ack_ptr)
+               *ack_ptr = intmod;
+       writel_relaxed(intmod, S3C2410_INTMOD);
+
+       return intmod;
+}
+
+EXPORT_SYMBOL_GPL(s3c24xx_set_fiq);
+#endif
+
+static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
+                                                       irq_hw_number_t hw)
+{
+       struct s3c_irq_intc *intc = h->host_data;
+       struct s3c_irq_data *irq_data = &intc->irqs[hw];
+       struct s3c_irq_intc *parent_intc;
+       struct s3c_irq_data *parent_irq_data;
+       unsigned int irqno;
+
+       /* attach controller pointer to irq_data */
+       irq_data->intc = intc;
+       irq_data->offset = hw;
+
+       parent_intc = intc->parent;
+
+       /* set handler and flags */
+       switch (irq_data->type) {
+       case S3C_IRQTYPE_NONE:
+               return 0;
+       case S3C_IRQTYPE_EINT:
+               /* On the S3C2412, the EINT0to3 have a parent irq
+                * but need the s3c_irq_eint0t4 chip
+                */
+               if (parent_intc && (!soc_is_s3c2412() || hw >= 4))
+                       irq_set_chip_and_handler(virq, &s3c_irqext_chip,
+                                                handle_edge_irq);
+               else
+                       irq_set_chip_and_handler(virq, &s3c_irq_eint0t4,
+                                                handle_edge_irq);
+               break;
+       case S3C_IRQTYPE_EDGE:
+               if (parent_intc || intc->reg_pending == S3C2416_SRCPND2)
+                       irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
+                                                handle_edge_irq);
+               else
+                       irq_set_chip_and_handler(virq, &s3c_irq_chip,
+                                                handle_edge_irq);
+               break;
+       case S3C_IRQTYPE_LEVEL:
+               if (parent_intc)
+                       irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
+                                                handle_level_irq);
+               else
+                       irq_set_chip_and_handler(virq, &s3c_irq_chip,
+                                                handle_level_irq);
+               break;
+       default:
+               pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type);
+               return -EINVAL;
+       }
+
+       irq_set_chip_data(virq, irq_data);
+
+       if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) {
+               if (irq_data->parent_irq > 31) {
+                       pr_err("irq-s3c24xx: parent irq %lu is out of range\n",
+                              irq_data->parent_irq);
+                       return -EINVAL;
+               }
+
+               parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
+               parent_irq_data->sub_intc = intc;
+               parent_irq_data->sub_bits |= (1UL << hw);
+
+               /* attach the demuxer to the parent irq */
+               irqno = irq_find_mapping(parent_intc->domain,
+                                        irq_data->parent_irq);
+               if (!irqno) {
+                       pr_err("irq-s3c24xx: could not find mapping for parent irq %lu\n",
+                              irq_data->parent_irq);
+                       return -EINVAL;
+               }
+               irq_set_chained_handler(irqno, s3c_irq_demux);
+       }
+
+       return 0;
+}
+
+static const struct irq_domain_ops s3c24xx_irq_ops = {
+       .map = s3c24xx_irq_map,
+       .xlate = irq_domain_xlate_twocell,
+};
+
+static void s3c24xx_clear_intc(struct s3c_irq_intc *intc)
+{
+       void __iomem *reg_source;
+       unsigned long pend;
+       unsigned long last;
+       int i;
+
+       /* if intpnd is set, read the next pending irq from there */
+       reg_source = intc->reg_intpnd ? intc->reg_intpnd : intc->reg_pending;
+
+       last = 0;
+       for (i = 0; i < 4; i++) {
+               pend = readl_relaxed(reg_source);
+
+               if (pend == 0 || pend == last)
+                       break;
+
+               writel_relaxed(pend, intc->reg_pending);
+               if (intc->reg_intpnd)
+                       writel_relaxed(pend, intc->reg_intpnd);
+
+               pr_info("irq: clearing pending status %08x\n", (int)pend);
+               last = pend;
+       }
+}
+
+static struct s3c_irq_intc * __init s3c24xx_init_intc(struct device_node *np,
+                                      struct s3c_irq_data *irq_data,
+                                      struct s3c_irq_intc *parent,
+                                      unsigned long address)
+{
+       struct s3c_irq_intc *intc;
+       void __iomem *base = (void *)0xf6000000; /* static mapping */
+       int irq_num;
+       int irq_start;
+       int ret;
+
+       intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
+       if (!intc)
+               return ERR_PTR(-ENOMEM);
+
+       intc->irqs = irq_data;
+
+       if (parent)
+               intc->parent = parent;
+
+       /* select the correct data for the controller.
+        * Need to hard code the irq num start and offset
+        * to preserve the static mapping for now
+        */
+       switch (address) {
+       case 0x4a000000:
+               pr_debug("irq: found main intc\n");
+               intc->reg_pending = base;
+               intc->reg_mask = base + 0x08;
+               intc->reg_intpnd = base + 0x10;
+               irq_num = 32;
+               irq_start = S3C2410_IRQ(0);
+               break;
+       case 0x4a000018:
+               pr_debug("irq: found subintc\n");
+               intc->reg_pending = base + 0x18;
+               intc->reg_mask = base + 0x1c;
+               irq_num = 29;
+               irq_start = S3C2410_IRQSUB(0);
+               break;
+       case 0x4a000040:
+               pr_debug("irq: found intc2\n");
+               intc->reg_pending = base + 0x40;
+               intc->reg_mask = base + 0x48;
+               intc->reg_intpnd = base + 0x50;
+               irq_num = 8;
+               irq_start = S3C2416_IRQ(0);
+               break;
+       case 0x560000a4:
+               pr_debug("irq: found eintc\n");
+               base = (void *)0xfd000000;
+
+               intc->reg_mask = base + 0xa4;
+               intc->reg_pending = base + 0xa8;
+               irq_num = 24;
+               irq_start = S3C2410_IRQ(32);
+               break;
+       default:
+               pr_err("irq: unsupported controller address\n");
+               ret = -EINVAL;
+               goto err;
+       }
+
+       /* now that all the data is complete, init the irq-domain */
+       s3c24xx_clear_intc(intc);
+       intc->domain = irq_domain_add_legacy(np, irq_num, irq_start,
+                                            0, &s3c24xx_irq_ops,
+                                            intc);
+       if (!intc->domain) {
+               pr_err("irq: could not create irq-domain\n");
+               ret = -EINVAL;
+               goto err;
+       }
+
+       set_handle_irq(s3c24xx_handle_irq);
+
+       return intc;
+
+err:
+       kfree(intc);
+       return ERR_PTR(ret);
+}
+
+static struct s3c_irq_data __maybe_unused init_eint[32] = {
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */
+};
+
+#ifdef CONFIG_CPU_S3C2410
+static struct s3c_irq_data init_s3c2410base[32] = {
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+       { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
+
+static struct s3c_irq_data init_s3c2410subint[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+};
+
+void __init s3c2410_init_irq(void)
+{
+#ifdef CONFIG_FIQ
+       init_FIQ(FIQ_START);
+#endif
+
+       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2410base[0], NULL,
+                                       0x4a000000);
+       if (IS_ERR(s3c_intc[0])) {
+               pr_err("irq: could not create main interrupt controller\n");
+               return;
+       }
+
+       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2410subint[0],
+                                       s3c_intc[0], 0x4a000018);
+       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2412
+static struct s3c_irq_data init_s3c2412base[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT1 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT2 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+       { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
+
+static struct s3c_irq_data init_s3c2412eint[32] = {
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 0 }, /* EINT0 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 1 }, /* EINT1 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 2 }, /* EINT2 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 3 }, /* EINT3 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */
+       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */
+};
+
+static struct s3c_irq_data init_s3c2412subint[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+       { .type = S3C_IRQTYPE_NONE, },
+       { .type = S3C_IRQTYPE_NONE, },
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */
+};
+
+void __init s3c2412_init_irq(void)
+{
+       pr_info("S3C2412: IRQ Support\n");
+
+#ifdef CONFIG_FIQ
+       init_FIQ(FIQ_START);
+#endif
+
+       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL,
+                                       0x4a000000);
+       if (IS_ERR(s3c_intc[0])) {
+               pr_err("irq: could not create main interrupt controller\n");
+               return;
+       }
+
+       s3c24xx_init_intc(NULL, &init_s3c2412eint[0], s3c_intc[0], 0x560000a4);
+       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2412subint[0],
+                                       s3c_intc[0], 0x4a000018);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2416
+static struct s3c_irq_data init_s3c2416base[32] = {
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
+       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+       { .type = S3C_IRQTYPE_NONE, },
+       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
+
+static struct s3c_irq_data init_s3c2416subint[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
+};
+
+static struct s3c_irq_data init_s3c2416_second[32] = {
+       { .type = S3C_IRQTYPE_EDGE }, /* 2D */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */
+};
+
+void __init s3c2416_init_irq(void)
+{
+       pr_info("S3C2416: IRQ Support\n");
+
+#ifdef CONFIG_FIQ
+       init_FIQ(FIQ_START);
+#endif
+
+       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL,
+                                       0x4a000000);
+       if (IS_ERR(s3c_intc[0])) {
+               pr_err("irq: could not create main interrupt controller\n");
+               return;
+       }
+
+       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
+       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2416subint[0],
+                                       s3c_intc[0], 0x4a000018);
+
+       s3c_intc[2] = s3c24xx_init_intc(NULL, &init_s3c2416_second[0],
+                                       NULL, 0x4a000040);
+}
+
+#endif
+
+#ifdef CONFIG_CPU_S3C2440
+static struct s3c_irq_data init_s3c2440base[32] = {
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
+       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
+
+static struct s3c_irq_data init_s3c2440subint[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
+};
+
+void __init s3c2440_init_irq(void)
+{
+       pr_info("S3C2440: IRQ Support\n");
+
+#ifdef CONFIG_FIQ
+       init_FIQ(FIQ_START);
+#endif
+
+       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL,
+                                       0x4a000000);
+       if (IS_ERR(s3c_intc[0])) {
+               pr_err("irq: could not create main interrupt controller\n");
+               return;
+       }
+
+       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
+       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2440subint[0],
+                                       s3c_intc[0], 0x4a000018);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2442
+static struct s3c_irq_data init_s3c2442base[32] = {
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
+       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+       { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
+
+static struct s3c_irq_data init_s3c2442subint[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
+};
+
+void __init s3c2442_init_irq(void)
+{
+       pr_info("S3C2442: IRQ Support\n");
+
+#ifdef CONFIG_FIQ
+       init_FIQ(FIQ_START);
+#endif
+
+       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL,
+                                       0x4a000000);
+       if (IS_ERR(s3c_intc[0])) {
+               pr_err("irq: could not create main interrupt controller\n");
+               return;
+       }
+
+       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
+       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2442subint[0],
+                                       s3c_intc[0], 0x4a000018);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2443
+static struct s3c_irq_data init_s3c2443base[32] = {
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
+       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* CFON */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
+
+
+static struct s3c_irq_data init_s3c2443subint[32] = {
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
+       { .type = S3C_IRQTYPE_NONE }, /* reserved */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD1 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
+       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
+};
+
+void __init s3c2443_init_irq(void)
+{
+       pr_info("S3C2443: IRQ Support\n");
+
+#ifdef CONFIG_FIQ
+       init_FIQ(FIQ_START);
+#endif
+
+       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL,
+                                       0x4a000000);
+       if (IS_ERR(s3c_intc[0])) {
+               pr_err("irq: could not create main interrupt controller\n");
+               return;
+       }
+
+       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
+       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2443subint[0],
+                                       s3c_intc[0], 0x4a000018);
+}
+#endif
+
+#ifdef CONFIG_OF
+static int s3c24xx_irq_map_of(struct irq_domain *h, unsigned int virq,
+                                                       irq_hw_number_t hw)
+{
+       unsigned int ctrl_num = hw / 32;
+       unsigned int intc_hw = hw % 32;
+       struct s3c_irq_intc *intc = s3c_intc[ctrl_num];
+       struct s3c_irq_intc *parent_intc = intc->parent;
+       struct s3c_irq_data *irq_data = &intc->irqs[intc_hw];
+
+       /* attach controller pointer to irq_data */
+       irq_data->intc = intc;
+       irq_data->offset = intc_hw;
+
+       if (!parent_intc)
+               irq_set_chip_and_handler(virq, &s3c_irq_chip, handle_edge_irq);
+       else
+               irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
+                                        handle_edge_irq);
+
+       irq_set_chip_data(virq, irq_data);
+
+       return 0;
+}
+
+/* Translate our of irq notation
+ * format: <ctrl_num ctrl_irq parent_irq type>
+ */
+static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n,
+                       const u32 *intspec, unsigned int intsize,
+                       irq_hw_number_t *out_hwirq, unsigned int *out_type)
+{
+       struct s3c_irq_intc *intc;
+       struct s3c_irq_intc *parent_intc;
+       struct s3c_irq_data *irq_data;
+       struct s3c_irq_data *parent_irq_data;
+       int irqno;
+
+       if (WARN_ON(intsize < 4))
+               return -EINVAL;
+
+       if (intspec[0] > 2 || !s3c_intc[intspec[0]]) {
+               pr_err("controller number %d invalid\n", intspec[0]);
+               return -EINVAL;
+       }
+       intc = s3c_intc[intspec[0]];
+
+       *out_hwirq = intspec[0] * 32 + intspec[2];
+       *out_type = intspec[3] & IRQ_TYPE_SENSE_MASK;
+
+       parent_intc = intc->parent;
+       if (parent_intc) {
+               irq_data = &intc->irqs[intspec[2]];
+               irq_data->parent_irq = intspec[1];
+               parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
+               parent_irq_data->sub_intc = intc;
+               parent_irq_data->sub_bits |= (1UL << intspec[2]);
+
+               /* parent_intc is always s3c_intc[0], so no offset */
+               irqno = irq_create_mapping(parent_intc->domain, intspec[1]);
+               if (irqno < 0) {
+                       pr_err("irq: could not map parent interrupt\n");
+                       return irqno;
+               }
+
+               irq_set_chained_handler(irqno, s3c_irq_demux);
+       }
+
+       return 0;
+}
+
+static const struct irq_domain_ops s3c24xx_irq_ops_of = {
+       .map = s3c24xx_irq_map_of,
+       .xlate = s3c24xx_irq_xlate_of,
+};
+
+struct s3c24xx_irq_of_ctrl {
+       char                    *name;
+       unsigned long           offset;
+       struct s3c_irq_intc     **handle;
+       struct s3c_irq_intc     **parent;
+       struct irq_domain_ops   *ops;
+};
+
+static int __init s3c_init_intc_of(struct device_node *np,
+                       struct device_node *interrupt_parent,
+                       struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl)
+{
+       struct s3c_irq_intc *intc;
+       struct s3c24xx_irq_of_ctrl *ctrl;
+       struct irq_domain *domain;
+       void __iomem *reg_base;
+       int i;
+
+       reg_base = of_iomap(np, 0);
+       if (!reg_base) {
+               pr_err("irq-s3c24xx: could not map irq registers\n");
+               return -EINVAL;
+       }
+
+       domain = irq_domain_add_linear(np, num_ctrl * 32,
+                                                    &s3c24xx_irq_ops_of, NULL);
+       if (!domain) {
+               pr_err("irq: could not create irq-domain\n");
+               return -EINVAL;
+       }
+
+       for (i = 0; i < num_ctrl; i++) {
+               ctrl = &s3c_ctrl[i];
+
+               pr_debug("irq: found controller %s\n", ctrl->name);
+
+               intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
+               if (!intc)
+                       return -ENOMEM;
+
+               intc->domain = domain;
+               intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data),
+                                    GFP_KERNEL);
+               if (!intc->irqs) {
+                       kfree(intc);
+                       return -ENOMEM;
+               }
+
+               if (ctrl->parent) {
+                       intc->reg_pending = reg_base + ctrl->offset;
+                       intc->reg_mask = reg_base + ctrl->offset + 0x4;
+
+                       if (*(ctrl->parent)) {
+                               intc->parent = *(ctrl->parent);
+                       } else {
+                               pr_warn("irq: parent of %s missing\n",
+                                       ctrl->name);
+                               kfree(intc->irqs);
+                               kfree(intc);
+                               continue;
+                       }
+               } else {
+                       intc->reg_pending = reg_base + ctrl->offset;
+                       intc->reg_mask = reg_base + ctrl->offset + 0x08;
+                       intc->reg_intpnd = reg_base + ctrl->offset + 0x10;
+               }
+
+               s3c24xx_clear_intc(intc);
+               s3c_intc[i] = intc;
+       }
+
+       set_handle_irq(s3c24xx_handle_irq);
+
+       return 0;
+}
+
+static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = {
+       {
+               .name = "intc",
+               .offset = 0,
+       }, {
+               .name = "subintc",
+               .offset = 0x18,
+               .parent = &s3c_intc[0],
+       }
+};
+
+int __init s3c2410_init_intc_of(struct device_node *np,
+                       struct device_node *interrupt_parent)
+{
+       return s3c_init_intc_of(np, interrupt_parent,
+                               s3c2410_ctrl, ARRAY_SIZE(s3c2410_ctrl));
+}
+IRQCHIP_DECLARE(s3c2410_irq, "samsung,s3c2410-irq", s3c2410_init_intc_of);
+
+static struct s3c24xx_irq_of_ctrl s3c2416_ctrl[] = {
+       {
+               .name = "intc",
+               .offset = 0,
+       }, {
+               .name = "subintc",
+               .offset = 0x18,
+               .parent = &s3c_intc[0],
+       }, {
+               .name = "intc2",
+               .offset = 0x40,
+       }
+};
+
+int __init s3c2416_init_intc_of(struct device_node *np,
+                       struct device_node *interrupt_parent)
+{
+       return s3c_init_intc_of(np, interrupt_parent,
+                               s3c2416_ctrl, ARRAY_SIZE(s3c2416_ctrl));
+}
+IRQCHIP_DECLARE(s3c2416_irq, "samsung,s3c2416-irq", s3c2416_init_intc_of);
+#endif
diff --git a/arch/arm/mach-s3c/irq-uart-s3c64xx.h b/arch/arm/mach-s3c/irq-uart-s3c64xx.h
new file mode 100644 (file)
index 0000000..78eccdc
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * Header file for Samsung SoC UART IRQ demux for S3C64XX and later
+ */
+
+struct s3c_uart_irq {
+       void __iomem    *regs;
+       unsigned int     base_irq;
+       unsigned int     parent_irq;
+};
+
+extern void s3c_init_uart_irqs(struct s3c_uart_irq *irq, unsigned int nr_irqs);
+
diff --git a/arch/arm/mach-s3c/keypad.h b/arch/arm/mach-s3c/keypad.h
new file mode 100644 (file)
index 0000000..9754b9a
--- /dev/null
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Samsung Platform - Keypad platform data definitions
+ *
+ * Copyright (C) 2010 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@samsung.com>
+ */
+
+#ifndef __PLAT_SAMSUNG_KEYPAD_H
+#define __PLAT_SAMSUNG_KEYPAD_H
+
+#include <linux/input/samsung-keypad.h>
+
+/**
+ * samsung_keypad_set_platdata - Set platform data for Samsung Keypad device.
+ * @pd: Platform data to register to device.
+ *
+ * Register the given platform data for use with Samsung Keypad device.
+ * The call will copy the platform data, so the board definitions can
+ * make the structure itself __initdata.
+ */
+extern void samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd);
+
+/* defined by architecture to configure gpio. */
+extern void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols);
+
+#endif /* __PLAT_SAMSUNG_KEYPAD_H */
diff --git a/arch/arm/mach-s3c/mach-amlm5900.c b/arch/arm/mach-s3c/mach-amlm5900.c
new file mode 100644 (file)
index 0000000..94c4512
--- /dev/null
@@ -0,0 +1,246 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2006 American Microsystems Limited
+//     David Anders <danders@amltd.com>
+//
+// @History:
+// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
+// Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio/machine.h>
+#include <linux/gpio.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/proc_fs.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+#include <asm/mach/flash.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+#include <linux/platform_data/fb-s3c2410.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "devs.h"
+#include "cpu.h"
+#include "gpio-cfg.h"
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/physmap.h>
+
+#include "s3c24xx.h"
+
+static struct resource amlm5900_nor_resource =
+                       DEFINE_RES_MEM(0x00000000, SZ_16M);
+
+static struct mtd_partition amlm5900_mtd_partitions[] = {
+       {
+               .name           = "System",
+               .size           = 0x240000,
+               .offset         = 0,
+               .mask_flags     = MTD_WRITEABLE,  /* force read-only */
+       }, {
+               .name           = "Kernel",
+               .size           = 0x100000,
+               .offset         = MTDPART_OFS_APPEND,
+       }, {
+               .name           = "Ramdisk",
+               .size           = 0x300000,
+               .offset         = MTDPART_OFS_APPEND,
+       }, {
+               .name           = "JFFS2",
+               .size           = 0x9A0000,
+               .offset         = MTDPART_OFS_APPEND,
+       }, {
+               .name           = "Settings",
+               .size           = MTDPART_SIZ_FULL,
+               .offset         = MTDPART_OFS_APPEND,
+       }
+};
+
+static struct physmap_flash_data amlm5900_flash_data = {
+       .width          = 2,
+       .parts          = amlm5900_mtd_partitions,
+       .nr_parts       = ARRAY_SIZE(amlm5900_mtd_partitions),
+};
+
+static struct platform_device amlm5900_device_nor = {
+       .name           = "physmap-flash",
+       .id             = 0,
+       .dev = {
+                       .platform_data = &amlm5900_flash_data,
+               },
+       .num_resources  = 1,
+       .resource       = &amlm5900_nor_resource,
+};
+
+static struct map_desc amlm5900_iodesc[] __initdata = {
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+static struct gpiod_lookup_table amlm5900_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct platform_device *amlm5900_devices[] __initdata = {
+#ifdef CONFIG_FB_S3C2410
+       &s3c_device_lcd,
+#endif
+       &s3c_device_adc,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_ohci,
+       &s3c_device_rtc,
+       &s3c_device_usbgadget,
+        &s3c_device_sdi,
+       &amlm5900_device_nor,
+};
+
+static void __init amlm5900_map_io(void)
+{
+       s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
+       s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init amlm5900_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+#ifdef CONFIG_FB_S3C2410
+static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
+       .width          = 160,
+       .height         = 160,
+
+       .type           = S3C2410_LCDCON1_STN4,
+
+       .pixclock       = 680000, /* HCLK = 100MHz */
+       .xres           = 160,
+       .yres           = 160,
+       .bpp            = 4,
+       .left_margin    = 1 << (4 + 3),
+       .right_margin   = 8 << 3,
+       .hsync_len      = 48,
+       .upper_margin   = 0,
+       .lower_margin   = 0,
+
+       .lcdcon5        = 0x00000001,
+};
+
+static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
+
+       .displays = &amlm5900_lcd_info,
+       .num_displays = 1,
+       .default_display = 0,
+
+       .gpccon =       0xaaaaaaaa,
+       .gpccon_mask =  0xffffffff,
+       .gpccon_reg =   S3C2410_GPCCON,
+       .gpcup =        0x0000ffff,
+       .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
+
+       .gpdcon =       0xaaaaaaaa,
+       .gpdcon_mask =  0xffffffff,
+       .gpdcon_reg =   S3C2410_GPDCON,
+       .gpdup =        0x0000ffff,
+       .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
+};
+#endif
+
+static irqreturn_t
+amlm5900_wake_interrupt(int irq, void *ignored)
+{
+       return IRQ_HANDLED;
+}
+
+static void amlm5900_init_pm(void)
+{
+       int ret = 0;
+
+       ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
+                               IRQF_TRIGGER_RISING | IRQF_SHARED,
+                               "amlm5900_wakeup", &amlm5900_wake_interrupt);
+       if (ret != 0) {
+               printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
+       } else {
+               enable_irq_wake(IRQ_EINT9);
+               /* configure the suspend/resume status pin */
+               s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
+               s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
+       }
+}
+static void __init amlm5900_init(void)
+{
+       amlm5900_init_pm();
+#ifdef CONFIG_FB_S3C2410
+       s3c24xx_fb_set_platdata(&amlm5900_fb_info);
+#endif
+       s3c_i2c0_set_platdata(NULL);
+       gpiod_add_lookup_table(&amlm5900_mmc_gpio_table);
+       platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
+}
+
+MACHINE_START(AML_M5900, "AML_M5900")
+       .atag_offset    = 0x100,
+       .map_io         = amlm5900_map_io,
+       .init_irq       = s3c2410_init_irq,
+       .init_machine   = amlm5900_init,
+       .init_time      = amlm5900_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-anubis.c b/arch/arm/mach-s3c/mach-anubis.c
new file mode 100644 (file)
index 0000000..969b740
--- /dev/null
@@ -0,0 +1,426 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2003-2009 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
+#include <linux/sm501.h>
+#include <linux/sm501-regs.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include <net/ax88796.h>
+
+#include "devs.h"
+#include "cpu.h"
+#include <linux/platform_data/asoc-s3c24xx_simtec.h>
+
+#include "anubis.h"
+#include "s3c24xx.h"
+#include "simtec.h"
+
+#define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics"
+
+static struct map_desc anubis_iodesc[] __initdata = {
+  /* ISA IO areas */
+
+  {
+       .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
+       .pfn            = __phys_to_pfn(0x0),
+       .length         = SZ_4M,
+       .type           = MT_DEVICE,
+  }, {
+       .virtual        = (u32)S3C24XX_VA_ISA_WORD,
+       .pfn            = __phys_to_pfn(0x0),
+       .length         = SZ_4M,
+       .type           = MT_DEVICE,
+  },
+
+  /* we could possibly compress the next set down into a set of smaller tables
+   * pagetables, but that would mean using an L2 section, and it still means
+   * we cannot actually feed the same register to an LDR due to 16K spacing
+   */
+
+  /* CPLD control registers */
+
+  {
+       .virtual        = (u32)ANUBIS_VA_CTRL1,
+       .pfn            = __phys_to_pfn(ANUBIS_PA_CTRL1),
+       .length         = SZ_4K,
+       .type           = MT_DEVICE,
+  }, {
+       .virtual        = (u32)ANUBIS_VA_IDREG,
+       .pfn            = __phys_to_pfn(ANUBIS_PA_IDREG),
+       .length         = SZ_4K,
+       .type           = MT_DEVICE,
+  },
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       },
+       [1] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       },
+};
+
+/* NAND Flash on Anubis board */
+
+static int external_map[]   = { 2 };
+static int chip0_map[]      = { 0 };
+static int chip1_map[]      = { 1 };
+
+static struct mtd_partition __initdata anubis_default_nand_part[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_16K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "/boot",
+               .size   = SZ_4M - SZ_16K,
+               .offset = SZ_16K,
+       },
+       [2] = {
+               .name   = "user1",
+               .offset = SZ_4M,
+               .size   = SZ_32M - SZ_4M,
+       },
+       [3] = {
+               .name   = "user2",
+               .offset = SZ_32M,
+               .size   = MTDPART_SIZ_FULL,
+       }
+};
+
+static struct mtd_partition __initdata anubis_default_nand_part_large[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_128K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "/boot",
+               .size   = SZ_4M - SZ_128K,
+               .offset = SZ_128K,
+       },
+       [2] = {
+               .name   = "user1",
+               .offset = SZ_4M,
+               .size   = SZ_32M - SZ_4M,
+       },
+       [3] = {
+               .name   = "user2",
+               .offset = SZ_32M,
+               .size   = MTDPART_SIZ_FULL,
+       }
+};
+
+/* the Anubis has 3 selectable slots for nand-flash, the two
+ * on-board chip areas, as well as the external slot.
+ *
+ * Note, there is no current hot-plug support for the External
+ * socket.
+*/
+
+static struct s3c2410_nand_set __initdata anubis_nand_sets[] = {
+       [1] = {
+               .name           = "External",
+               .nr_chips       = 1,
+               .nr_map         = external_map,
+               .nr_partitions  = ARRAY_SIZE(anubis_default_nand_part),
+               .partitions     = anubis_default_nand_part,
+       },
+       [0] = {
+               .name           = "chip0",
+               .nr_chips       = 1,
+               .nr_map         = chip0_map,
+               .nr_partitions  = ARRAY_SIZE(anubis_default_nand_part),
+               .partitions     = anubis_default_nand_part,
+       },
+       [2] = {
+               .name           = "chip1",
+               .nr_chips       = 1,
+               .nr_map         = chip1_map,
+               .nr_partitions  = ARRAY_SIZE(anubis_default_nand_part),
+               .partitions     = anubis_default_nand_part,
+       },
+};
+
+static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
+{
+       unsigned int tmp;
+
+       slot = set->nr_map[slot] & 3;
+
+       pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
+                slot, set, set->nr_map);
+
+       tmp = __raw_readb(ANUBIS_VA_CTRL1);
+       tmp &= ~ANUBIS_CTRL1_NANDSEL;
+       tmp |= slot;
+
+       pr_debug("anubis_nand: ctrl1 now %02x\n", tmp);
+
+       __raw_writeb(tmp, ANUBIS_VA_CTRL1);
+}
+
+static struct s3c2410_platform_nand __initdata anubis_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 55,
+       .twrph1         = 40,
+       .nr_sets        = ARRAY_SIZE(anubis_nand_sets),
+       .sets           = anubis_nand_sets,
+       .select_chip    = anubis_nand_select,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+/* IDE channels */
+
+static struct pata_platform_info anubis_ide_platdata = {
+       .ioport_shift   = 5,
+};
+
+static struct resource anubis_ide0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS3, 8 * 32),
+       [2] = DEFINE_RES_MEM(S3C2410_CS3 + (1 << 26) + (6 * 32), 32),
+       [3] = DEFINE_RES_IRQ(ANUBIS_IRQ_IDE0),
+};
+
+static struct platform_device anubis_device_ide0 = {
+       .name           = "pata_platform",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(anubis_ide0_resource),
+       .resource       = anubis_ide0_resource,
+       .dev    = {
+               .platform_data = &anubis_ide_platdata,
+               .coherent_dma_mask = ~0,
+       },
+};
+
+static struct resource anubis_ide1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS4, 8 * 32),
+       [1] = DEFINE_RES_MEM(S3C2410_CS4 + (1 << 26) + (6 * 32), 32),
+       [2] = DEFINE_RES_IRQ(ANUBIS_IRQ_IDE0),
+};
+
+static struct platform_device anubis_device_ide1 = {
+       .name           = "pata_platform",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(anubis_ide1_resource),
+       .resource       = anubis_ide1_resource,
+       .dev    = {
+               .platform_data = &anubis_ide_platdata,
+               .coherent_dma_mask = ~0,
+       },
+};
+
+/* Asix AX88796 10/100 ethernet controller */
+
+static struct ax_plat_data anubis_asix_platdata = {
+       .flags          = AXFLG_MAC_FROMDEV,
+       .wordlength     = 2,
+       .dcr_val        = 0x48,
+       .rcr_val        = 0x40,
+};
+
+static struct resource anubis_asix_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS5, 0x20 * 0x20),
+       [1] = DEFINE_RES_IRQ(ANUBIS_IRQ_ASIX),
+};
+
+static struct platform_device anubis_device_asix = {
+       .name           = "ax88796",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(anubis_asix_resource),
+       .resource       = anubis_asix_resource,
+       .dev            = {
+               .platform_data = &anubis_asix_platdata,
+       }
+};
+
+/* SM501 */
+
+static struct resource anubis_sm501_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS2, SZ_8M),
+       [1] = DEFINE_RES_MEM(S3C2410_CS2 + SZ_64M - SZ_2M, SZ_2M),
+       [2] = DEFINE_RES_IRQ(IRQ_EINT0),
+};
+
+static struct sm501_initdata anubis_sm501_initdata = {
+       .gpio_high      = {
+               .set    = 0x3F000000,           /* 24bit panel */
+               .mask   = 0x0,
+       },
+       .misc_timing    = {
+               .set    = 0x010100,             /* SDRAM timing */
+               .mask   = 0x1F1F00,
+       },
+       .misc_control   = {
+               .set    = SM501_MISC_PNL_24BIT,
+               .mask   = 0,
+       },
+
+       .devices        = SM501_USE_GPIO,
+
+       /* set the SDRAM and bus clocks */
+       .mclk           = 72 * MHZ,
+       .m1xclk         = 144 * MHZ,
+};
+
+static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = {
+       [0] = {
+               .bus_num        = 1,
+               .pin_scl        = 44,
+               .pin_sda        = 45,
+       },
+       [1] = {
+               .bus_num        = 2,
+               .pin_scl        = 40,
+               .pin_sda        = 41,
+       },
+};
+
+static struct sm501_platdata anubis_sm501_platdata = {
+       .init           = &anubis_sm501_initdata,
+       .gpio_base      = -1,
+       .gpio_i2c       = anubis_sm501_gpio_i2c,
+       .gpio_i2c_nr    = ARRAY_SIZE(anubis_sm501_gpio_i2c),
+};
+
+static struct platform_device anubis_device_sm501 = {
+       .name           = "sm501",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(anubis_sm501_resource),
+       .resource       = anubis_sm501_resource,
+       .dev            = {
+               .platform_data = &anubis_sm501_platdata,
+       },
+};
+
+/* Standard Anubis devices */
+
+static struct platform_device *anubis_devices[] __initdata = {
+       &s3c2410_device_dclk,
+       &s3c_device_ohci,
+       &s3c_device_wdt,
+       &s3c_device_adc,
+       &s3c_device_i2c0,
+       &s3c_device_rtc,
+       &s3c_device_nand,
+       &anubis_device_ide0,
+       &anubis_device_ide1,
+       &anubis_device_asix,
+       &anubis_device_sm501,
+};
+
+/* I2C devices. */
+
+static struct i2c_board_info anubis_i2c_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("tps65011", 0x48),
+               .irq    = IRQ_EINT20,
+       }
+};
+
+/* Audio setup */
+static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = {
+       .have_mic       = 1,
+       .have_lout      = 1,
+       .output_cdclk   = 1,
+       .use_mpllin     = 1,
+       .amp_gpio       = S3C2410_GPB(2),
+       .amp_gain[0]    = S3C2410_GPD(10),
+       .amp_gain[1]    = S3C2410_GPD(11),
+};
+
+static void __init anubis_map_io(void)
+{
+       s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
+       s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+
+       /* check for the newer revision boards with large page nand */
+
+       if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) {
+               printk(KERN_INFO "ANUBIS-B detected (revision %d)\n",
+                      __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK);
+               anubis_nand_sets[0].partitions = anubis_default_nand_part_large;
+               anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large);
+       } else {
+               /* ensure that the GPIO is setup */
+               gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL);
+               gpio_free(S3C2410_GPA(0));
+       }
+}
+
+static void __init anubis_init_time(void)
+{
+       s3c2440_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init anubis_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&anubis_nand_info);
+       simtec_audio_add(NULL, false, &anubis_audio);
+
+       platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
+
+       i2c_register_board_info(0, anubis_i2c_devs,
+                               ARRAY_SIZE(anubis_i2c_devs));
+}
+
+
+MACHINE_START(ANUBIS, "Simtec-Anubis")
+       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
+       .atag_offset    = 0x100,
+       .map_io         = anubis_map_io,
+       .init_machine   = anubis_init,
+       .init_irq       = s3c2440_init_irq,
+       .init_time      = anubis_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-anw6410.c b/arch/arm/mach-s3c/mach-anw6410.c
new file mode 100644 (file)
index 0000000..825714e
--- /dev/null
@@ -0,0 +1,230 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+// Copyright 2009 Kwangwoo Lee
+//     Kwangwoo Lee <kwangwoo.lee@gmail.com>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/i2c.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/dm9000.h>
+
+#include <video/platform_lcd.h>
+#include <video/samsung_fimd.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "fb.h"
+
+#include "devs.h"
+#include "cpu.h"
+#include <mach/irqs.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+
+/* DM9000 */
+#define ANW6410_PA_DM9000      (0x18000000)
+
+/* A hardware buffer to control external devices is mapped at 0x30000000.
+ * It can not be read. So current status must be kept in anw6410_extdev_status.
+ */
+#define ANW6410_VA_EXTDEV      S3C_ADDR(0x02000000)
+#define ANW6410_PA_EXTDEV      (0x30000000)
+
+#define ANW6410_EN_DM9000      (1<<11)
+#define ANW6410_EN_LCD         (1<<14)
+
+static __u32 anw6410_extdev_status;
+
+static struct s3c2410_uartcfg anw6410_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+};
+
+/* framebuffer and LCD setup. */
+static void __init anw6410_lcd_mode_set(void)
+{
+       u32 tmp;
+
+       /* set the LCD type */
+       tmp = __raw_readl(S3C64XX_SPCON);
+       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
+       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
+       __raw_writel(tmp, S3C64XX_SPCON);
+
+       /* remove the LCD bypass */
+       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
+       tmp &= ~MIFPCON_LCD_BYPASS;
+       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
+}
+
+/* GPF1 = LCD panel power
+ * GPF4 = LCD backlight control
+ */
+static void anw6410_lcd_power_set(struct plat_lcd_data *pd,
+                                  unsigned int power)
+{
+       if (power) {
+               anw6410_extdev_status |= (ANW6410_EN_LCD << 16);
+               __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
+
+               gpio_direction_output(S3C64XX_GPF(1), 1);
+               gpio_direction_output(S3C64XX_GPF(4), 1);
+       } else {
+               anw6410_extdev_status &= ~(ANW6410_EN_LCD << 16);
+               __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
+
+               gpio_direction_output(S3C64XX_GPF(1), 0);
+               gpio_direction_output(S3C64XX_GPF(4), 0);
+       }
+}
+
+static struct plat_lcd_data anw6410_lcd_power_data = {
+       .set_power      = anw6410_lcd_power_set,
+};
+
+static struct platform_device anw6410_lcd_powerdev = {
+       .name                   = "platform-lcd",
+       .dev.parent             = &s3c_device_fb.dev,
+       .dev.platform_data      = &anw6410_lcd_power_data,
+};
+
+static struct s3c_fb_pd_win anw6410_fb_win0 = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct fb_videomode anw6410_lcd_timing = {
+       .left_margin    = 8,
+       .right_margin   = 13,
+       .upper_margin   = 7,
+       .lower_margin   = 5,
+       .hsync_len      = 3,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
+static struct s3c_fb_platdata anw6410_lcd_pdata __initdata = {
+       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+       .vtiming        = &anw6410_lcd_timing,
+       .win[0]         = &anw6410_fb_win0,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+};
+
+/* DM9000AEP 10/100 ethernet controller */
+static void __init anw6410_dm9000_enable(void)
+{
+       anw6410_extdev_status |= (ANW6410_EN_DM9000 << 16);
+       __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
+}
+
+static struct resource anw6410_dm9000_resource[] = {
+       [0] = DEFINE_RES_MEM(ANW6410_PA_DM9000, 4),
+       [1] = DEFINE_RES_MEM(ANW6410_PA_DM9000 + 4, 501),
+       [2] = DEFINE_RES_NAMED(IRQ_EINT(15), 1, NULL, IORESOURCE_IRQ \
+                                       | IRQF_TRIGGER_HIGH),
+};
+
+static struct dm9000_plat_data anw6410_dm9000_pdata = {
+       .flags    = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
+       /* dev_addr can be set to provide hwaddr. */
+};
+
+static struct platform_device anw6410_device_eth = {
+       .name   = "dm9000",
+       .id     = -1,
+       .num_resources  = ARRAY_SIZE(anw6410_dm9000_resource),
+       .resource       = anw6410_dm9000_resource,
+       .dev    = {
+               .platform_data  = &anw6410_dm9000_pdata,
+       },
+};
+
+static struct map_desc anw6410_iodesc[] __initdata = {
+       {
+               .virtual        = (unsigned long)ANW6410_VA_EXTDEV,
+               .pfn            = __phys_to_pfn(ANW6410_PA_EXTDEV),
+               .length         = SZ_64K,
+               .type           = MT_DEVICE,
+       },
+};
+
+static struct platform_device *anw6410_devices[] __initdata = {
+       &s3c_device_fb,
+       &anw6410_lcd_powerdev,
+       &anw6410_device_eth,
+};
+
+static void __init anw6410_map_io(void)
+{
+       s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+
+       anw6410_lcd_mode_set();
+}
+
+static void __init anw6410_machine_init(void)
+{
+       s3c_fb_set_platdata(&anw6410_lcd_pdata);
+
+       gpio_request(S3C64XX_GPF(1), "panel power");
+       gpio_request(S3C64XX_GPF(4), "LCD backlight");
+
+       anw6410_dm9000_enable();
+
+       platform_add_devices(anw6410_devices, ARRAY_SIZE(anw6410_devices));
+}
+
+MACHINE_START(ANW6410, "A&W6410")
+       /* Maintainer: Kwangwoo Lee <kwangwoo.lee@gmail.com> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = anw6410_map_io,
+       .init_machine   = anw6410_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-at2440evb.c b/arch/arm/mach-s3c/mach-at2440evb.c
new file mode 100644 (file)
index 0000000..18ace34
--- /dev/null
@@ -0,0 +1,232 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
+//      Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
+//      and modifications by SBZ <sbz@spgui.org> and
+//      Weibing <http://weibing.blogbus.com>
+//
+// For product information, visit http://www.arm.com/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/gpio/machine.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/dm9000.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include "devs.h"
+#include "cpu.h"
+#include <linux/platform_data/mmc-s3cmci.h>
+
+#include "s3c24xx.h"
+
+static struct map_desc at2440evb_iodesc[] __initdata = {
+       /* Nothing here */
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       },
+};
+
+/* NAND Flash on AT2440EVB board */
+
+static struct mtd_partition __initdata at2440evb_default_nand_part[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_256K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "Kernel",
+               .size   = SZ_2M,
+               .offset = SZ_256K,
+       },
+       [2] = {
+               .name   = "Root",
+               .offset = SZ_256K + SZ_2M,
+               .size   = MTDPART_SIZ_FULL,
+       },
+};
+
+static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = {
+       [0] = {
+               .name           = "nand",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(at2440evb_default_nand_part),
+               .partitions     = at2440evb_default_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 55,
+       .twrph1         = 40,
+       .nr_sets        = ARRAY_SIZE(at2440evb_nand_sets),
+       .sets           = at2440evb_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+/* DM9000AEP 10/100 ethernet controller */
+
+static struct resource at2440evb_dm9k_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS3, 4),
+       [1] = DEFINE_RES_MEM(S3C2410_CS3 + 4, 4),
+       [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \
+                                       | IORESOURCE_IRQ_HIGHEDGE),
+};
+
+static struct dm9000_plat_data at2440evb_dm9k_pdata = {
+       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
+};
+
+static struct platform_device at2440evb_device_eth = {
+       .name           = "dm9000",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(at2440evb_dm9k_resource),
+       .resource       = at2440evb_dm9k_resource,
+       .dev            = {
+               .platform_data  = &at2440evb_dm9k_pdata,
+       },
+};
+
+static struct s3c24xx_mci_pdata at2440evb_mci_pdata __initdata = {
+       .set_power      = s3c24xx_mci_def_set_power,
+};
+
+static struct gpiod_lookup_table at2440evb_mci_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* Card detect S3C2410_GPG(10) */
+               GPIO_LOOKUP("GPIOG", 10, "cd", GPIO_ACTIVE_LOW),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+
+/* 7" LCD panel */
+
+static struct s3c2410fb_display at2440evb_lcd_cfg __initdata = {
+
+       .lcdcon5        = S3C2410_LCDCON5_FRM565 |
+                         S3C2410_LCDCON5_INVVLINE |
+                         S3C2410_LCDCON5_INVVFRAME |
+                         S3C2410_LCDCON5_PWREN |
+                         S3C2410_LCDCON5_HWSWP,
+
+       .type           = S3C2410_LCDCON1_TFT,
+
+       .width          = 800,
+       .height         = 480,
+
+       .pixclock       = 33333, /* HCLK 60 MHz, divisor 2 */
+       .xres           = 800,
+       .yres           = 480,
+       .bpp            = 16,
+       .left_margin    = 88,
+       .right_margin   = 40,
+       .hsync_len      = 128,
+       .upper_margin   = 32,
+       .lower_margin   = 11,
+       .vsync_len      = 2,
+};
+
+static struct s3c2410fb_mach_info at2440evb_fb_info __initdata = {
+       .displays       = &at2440evb_lcd_cfg,
+       .num_displays   = 1,
+       .default_display = 0,
+};
+
+static struct platform_device *at2440evb_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_wdt,
+       &s3c_device_adc,
+       &s3c_device_i2c0,
+       &s3c_device_rtc,
+       &s3c_device_nand,
+       &s3c_device_sdi,
+       &s3c_device_lcd,
+       &at2440evb_device_eth,
+};
+
+static void __init at2440evb_map_io(void)
+{
+       s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
+       s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init at2440evb_init_time(void)
+{
+       s3c2440_init_clocks(16934400);
+       s3c24xx_timer_init();
+}
+
+static void __init at2440evb_init(void)
+{
+       s3c24xx_fb_set_platdata(&at2440evb_fb_info);
+       gpiod_add_lookup_table(&at2440evb_mci_gpio_table);
+       s3c24xx_mci_set_platdata(&at2440evb_mci_pdata);
+       s3c_nand_set_platdata(&at2440evb_nand_info);
+       s3c_i2c0_set_platdata(NULL);
+
+       platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
+}
+
+
+MACHINE_START(AT2440EVB, "AT2440EVB")
+       .atag_offset    = 0x100,
+       .map_io         = at2440evb_map_io,
+       .init_machine   = at2440evb_init,
+       .init_irq       = s3c2440_init_irq,
+       .init_time      = at2440evb_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-bast.c b/arch/arm/mach-s3c/mach-bast.c
new file mode 100644 (file)
index 0000000..ad3c7e2
--- /dev/null
@@ -0,0 +1,587 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2003-2008 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// http://www.simtec.co.uk/products/EB2410ITX/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/syscore_ops.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/dm9000.h>
+#include <linux/ata_platform.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
+#include <linux/serial_8250.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <linux/platform_data/hwmon-s3c.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+
+#include <net/ax88796.h>
+
+#include <asm/irq.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+#include "devs.h"
+#include "gpio-cfg.h"
+
+#include "bast.h"
+#include "s3c24xx.h"
+#include "simtec.h"
+
+#define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics"
+
+/* macros for virtual address mods for the io space entries */
+#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
+#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
+#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
+#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
+
+/* macros to modify the physical addresses for io space */
+
+#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
+#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
+#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
+#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
+
+static struct map_desc bast_iodesc[] __initdata = {
+  /* ISA IO areas */
+  {
+         .virtual      = (u32)S3C24XX_VA_ISA_BYTE,
+         .pfn          = PA_CS2(BAST_PA_ISAIO),
+         .length       = SZ_16M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)S3C24XX_VA_ISA_WORD,
+         .pfn          = PA_CS3(BAST_PA_ISAIO),
+         .length       = SZ_16M,
+         .type         = MT_DEVICE,
+  },
+  /* bast CPLD control registers, and external interrupt controls */
+  {
+         .virtual      = (u32)BAST_VA_CTRL1,
+         .pfn          = __phys_to_pfn(BAST_PA_CTRL1),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)BAST_VA_CTRL2,
+         .pfn          = __phys_to_pfn(BAST_PA_CTRL2),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)BAST_VA_CTRL3,
+         .pfn          = __phys_to_pfn(BAST_PA_CTRL3),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)BAST_VA_CTRL4,
+         .pfn          = __phys_to_pfn(BAST_PA_CTRL4),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  },
+  /* PC104 IRQ mux */
+  {
+         .virtual      = (u32)BAST_VA_PC104_IRQREQ,
+         .pfn          = __phys_to_pfn(BAST_PA_PC104_IRQREQ),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)BAST_VA_PC104_IRQRAW,
+         .pfn          = __phys_to_pfn(BAST_PA_PC104_IRQRAW),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)BAST_VA_PC104_IRQMASK,
+         .pfn          = __phys_to_pfn(BAST_PA_PC104_IRQMASK),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  },
+
+  /* peripheral space... one for each of fast/slow/byte/16bit */
+  /* note, ide is only decoded in word space, even though some registers
+   * are only 8bit */
+
+  /* slow, byte */
+  { VA_C2(BAST_VA_ISAIO),   PA_CS2(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
+  { VA_C2(BAST_VA_ISAMEM),  PA_CS2(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
+  { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
+
+  /* slow, word */
+  { VA_C3(BAST_VA_ISAIO),   PA_CS3(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
+  { VA_C3(BAST_VA_ISAMEM),  PA_CS3(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
+  { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
+
+  /* fast, byte */
+  { VA_C4(BAST_VA_ISAIO),   PA_CS4(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
+  { VA_C4(BAST_VA_ISAMEM),  PA_CS4(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
+  { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
+
+  /* fast, word */
+  { VA_C5(BAST_VA_ISAIO),   PA_CS5(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
+  { VA_C5(BAST_VA_ISAMEM),  PA_CS5(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
+  { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       /* port 2 is not actually used */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+/* NAND Flash on BAST board */
+
+#ifdef CONFIG_PM
+static int bast_pm_suspend(void)
+{
+       /* ensure that an nRESET is not generated on resume. */
+       gpio_direction_output(S3C2410_GPA(21), 1);
+       return 0;
+}
+
+static void bast_pm_resume(void)
+{
+       s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
+}
+
+#else
+#define bast_pm_suspend NULL
+#define bast_pm_resume NULL
+#endif
+
+static struct syscore_ops bast_pm_syscore_ops = {
+       .suspend        = bast_pm_suspend,
+       .resume         = bast_pm_resume,
+};
+
+static int smartmedia_map[] = { 0 };
+static int chip0_map[] = { 1 };
+static int chip1_map[] = { 2 };
+static int chip2_map[] = { 3 };
+
+static struct mtd_partition __initdata bast_default_nand_part[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_16K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "/boot",
+               .size   = SZ_4M - SZ_16K,
+               .offset = SZ_16K,
+       },
+       [2] = {
+               .name   = "user",
+               .offset = SZ_4M,
+               .size   = MTDPART_SIZ_FULL,
+       }
+};
+
+/* the bast has 4 selectable slots for nand-flash, the three
+ * on-board chip areas, as well as the external SmartMedia
+ * slot.
+ *
+ * Note, there is no current hot-plug support for the SmartMedia
+ * socket.
+*/
+
+static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
+       [0] = {
+               .name           = "SmartMedia",
+               .nr_chips       = 1,
+               .nr_map         = smartmedia_map,
+               .options        = NAND_SCAN_SILENT_NODEV,
+               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
+               .partitions     = bast_default_nand_part,
+       },
+       [1] = {
+               .name           = "chip0",
+               .nr_chips       = 1,
+               .nr_map         = chip0_map,
+               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
+               .partitions     = bast_default_nand_part,
+       },
+       [2] = {
+               .name           = "chip1",
+               .nr_chips       = 1,
+               .nr_map         = chip1_map,
+               .options        = NAND_SCAN_SILENT_NODEV,
+               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
+               .partitions     = bast_default_nand_part,
+       },
+       [3] = {
+               .name           = "chip2",
+               .nr_chips       = 1,
+               .nr_map         = chip2_map,
+               .options        = NAND_SCAN_SILENT_NODEV,
+               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
+               .partitions     = bast_default_nand_part,
+       }
+};
+
+static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
+{
+       unsigned int tmp;
+
+       slot = set->nr_map[slot] & 3;
+
+       pr_debug("bast_nand: selecting slot %d (set %p,%p)\n",
+                slot, set, set->nr_map);
+
+       tmp = __raw_readb(BAST_VA_CTRL2);
+       tmp &= BAST_CPLD_CTLR2_IDERST;
+       tmp |= slot;
+       tmp |= BAST_CPLD_CTRL2_WNAND;
+
+       pr_debug("bast_nand: ctrl2 now %02x\n", tmp);
+
+       __raw_writeb(tmp, BAST_VA_CTRL2);
+}
+
+static struct s3c2410_platform_nand __initdata bast_nand_info = {
+       .tacls          = 30,
+       .twrph0         = 60,
+       .twrph1         = 60,
+       .nr_sets        = ARRAY_SIZE(bast_nand_sets),
+       .sets           = bast_nand_sets,
+       .select_chip    = bast_nand_select,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+/* DM9000 */
+
+static struct resource bast_dm9k_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000, 4),
+       [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000 + 0x40, 0x40),
+       [2] = DEFINE_RES_NAMED(BAST_IRQ_DM9000 , 1, NULL, IORESOURCE_IRQ \
+                                       | IORESOURCE_IRQ_HIGHLEVEL),
+};
+
+/* for the moment we limit ourselves to 16bit IO until some
+ * better IO routines can be written and tested
+*/
+
+static struct dm9000_plat_data bast_dm9k_platdata = {
+       .flags          = DM9000_PLATF_16BITONLY,
+};
+
+static struct platform_device bast_device_dm9k = {
+       .name           = "dm9000",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(bast_dm9k_resource),
+       .resource       = bast_dm9k_resource,
+       .dev            = {
+               .platform_data = &bast_dm9k_platdata,
+       }
+};
+
+/* serial devices */
+
+#define SERIAL_BASE  (S3C2410_CS2 + BAST_PA_SUPERIO)
+#define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ)
+#define SERIAL_CLK   (1843200)
+
+static struct plat_serial8250_port bast_sio_data[] = {
+       [0] = {
+               .mapbase        = SERIAL_BASE + 0x2f8,
+               .irq            = BAST_IRQ_PCSERIAL1,
+               .flags          = SERIAL_FLAGS,
+               .iotype         = UPIO_MEM,
+               .regshift       = 0,
+               .uartclk        = SERIAL_CLK,
+       },
+       [1] = {
+               .mapbase        = SERIAL_BASE + 0x3f8,
+               .irq            = BAST_IRQ_PCSERIAL2,
+               .flags          = SERIAL_FLAGS,
+               .iotype         = UPIO_MEM,
+               .regshift       = 0,
+               .uartclk        = SERIAL_CLK,
+       },
+       { }
+};
+
+static struct platform_device bast_sio = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_PLATFORM,
+       .dev                    = {
+               .platform_data  = &bast_sio_data,
+       },
+};
+
+/* we have devices on the bus which cannot work much over the
+ * standard 100KHz i2c bus frequency
+*/
+
+static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
+       .flags          = 0,
+       .slave_addr     = 0x10,
+       .frequency      = 100*1000,
+};
+
+/* Asix AX88796 10/100 ethernet controller */
+
+static struct ax_plat_data bast_asix_platdata = {
+       .flags          = AXFLG_MAC_FROMDEV,
+       .wordlength     = 2,
+       .dcr_val        = 0x48,
+       .rcr_val        = 0x40,
+};
+
+static struct resource bast_asix_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET, 0x18 * 0x20),
+       [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 1),
+       [2] = DEFINE_RES_IRQ(BAST_IRQ_ASIX),
+};
+
+static struct platform_device bast_device_asix = {
+       .name           = "ax88796",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(bast_asix_resource),
+       .resource       = bast_asix_resource,
+       .dev            = {
+               .platform_data = &bast_asix_platdata
+       }
+};
+
+/* Asix AX88796 10/100 ethernet controller parallel port */
+
+static struct resource bast_asixpp_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), \
+                                       0x30 * 0x20),
+};
+
+static struct platform_device bast_device_axpp = {
+       .name           = "ax88796-pp",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(bast_asixpp_resource),
+       .resource       = bast_asixpp_resource,
+};
+
+/* LCD/VGA controller */
+
+static struct s3c2410fb_display __initdata bast_lcd_info[] = {
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .pixclock       = 33333,
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 4,
+               .left_margin    = 40,
+               .right_margin   = 20,
+               .hsync_len      = 88,
+               .upper_margin   = 30,
+               .lower_margin   = 32,
+               .vsync_len      = 3,
+
+               .lcdcon5        = 0x00014b02,
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .pixclock       = 33333,
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 8,
+               .left_margin    = 40,
+               .right_margin   = 20,
+               .hsync_len      = 88,
+               .upper_margin   = 30,
+               .lower_margin   = 32,
+               .vsync_len      = 3,
+
+               .lcdcon5        = 0x00014b02,
+       },
+       {
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .pixclock       = 33333,
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 16,
+               .left_margin    = 40,
+               .right_margin   = 20,
+               .hsync_len      = 88,
+               .upper_margin   = 30,
+               .lower_margin   = 32,
+               .vsync_len      = 3,
+
+               .lcdcon5        = 0x00014b02,
+       },
+};
+
+/* LCD/VGA controller */
+
+static struct s3c2410fb_mach_info __initdata bast_fb_info = {
+
+       .displays = bast_lcd_info,
+       .num_displays = ARRAY_SIZE(bast_lcd_info),
+       .default_display = 1,
+};
+
+/* I2C devices fitted. */
+
+static struct i2c_board_info bast_i2c_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("tlv320aic23", 0x1a),
+       }, {
+               I2C_BOARD_INFO("simtec-pmu", 0x6b),
+       }, {
+               I2C_BOARD_INFO("ch7013", 0x75),
+       },
+};
+
+static struct s3c_hwmon_pdata bast_hwmon_info = {
+       /* LCD contrast (0-6.6V) */
+       .in[0] = &(struct s3c_hwmon_chcfg) {
+               .name           = "lcd-contrast",
+               .mult           = 3300,
+               .div            = 512,
+       },
+       /* LED current feedback */
+       .in[1] = &(struct s3c_hwmon_chcfg) {
+               .name           = "led-feedback",
+               .mult           = 3300,
+               .div            = 1024,
+       },
+       /* LCD feedback (0-6.6V) */
+       .in[2] = &(struct s3c_hwmon_chcfg) {
+               .name           = "lcd-feedback",
+               .mult           = 3300,
+               .div            = 512,
+       },
+       /* Vcore (1.8-2.0V), Vref 3.3V  */
+       .in[3] = &(struct s3c_hwmon_chcfg) {
+               .name           = "vcore",
+               .mult           = 3300,
+               .div            = 1024,
+       },
+};
+
+/* Standard BAST devices */
+// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
+
+static struct platform_device *bast_devices[] __initdata = {
+       &s3c2410_device_dclk,
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_rtc,
+       &s3c_device_nand,
+       &s3c_device_adc,
+       &s3c_device_hwmon,
+       &bast_device_dm9k,
+       &bast_device_asix,
+       &bast_device_axpp,
+       &bast_sio,
+};
+
+static struct s3c_cpufreq_board __initdata bast_cpufreq = {
+       .refresh        = 7800, /* 7.8usec */
+       .auto_io        = 1,
+       .need_io        = 1,
+};
+
+static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
+       .have_mic       = 1,
+       .have_lout      = 1,
+};
+
+static void __init bast_map_io(void)
+{
+       s3c_hwmon_set_platdata(&bast_hwmon_info);
+
+       s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
+       s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init bast_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init bast_init(void)
+{
+       register_syscore_ops(&bast_pm_syscore_ops);
+
+       s3c_i2c0_set_platdata(&bast_i2c_info);
+       s3c_nand_set_platdata(&bast_nand_info);
+       s3c24xx_fb_set_platdata(&bast_fb_info);
+       platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
+
+       i2c_register_board_info(0, bast_i2c_devs,
+                               ARRAY_SIZE(bast_i2c_devs));
+
+       usb_simtec_init();
+       nor_simtec_init();
+       simtec_audio_add(NULL, true, &bast_audio);
+
+       WARN_ON(gpio_request(S3C2410_GPA(21), "bast nreset"));
+       
+       s3c_cpufreq_setboard(&bast_cpufreq);
+}
+
+MACHINE_START(BAST, "Simtec-BAST")
+       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
+       .atag_offset    = 0x100,
+       .map_io         = bast_map_io,
+       .init_irq       = s3c2410_init_irq,
+       .init_machine   = bast_init,
+       .init_time      = bast_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-crag6410-module.c b/arch/arm/mach-s3c/mach-crag6410-module.c
new file mode 100644 (file)
index 0000000..407ad49
--- /dev/null
@@ -0,0 +1,445 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Speyside modules for Cragganmore - board data probing
+//
+// Copyright 2011 Wolfson Microelectronics plc
+//     Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+#include <linux/export.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/spi/spi.h>
+#include <linux/gpio/machine.h>
+
+#include <linux/mfd/wm831x/irq.h>
+#include <linux/mfd/wm831x/gpio.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include <linux/mfd/arizona/pdata.h>
+
+#include <linux/regulator/machine.h>
+
+#include <sound/wm0010.h>
+#include <sound/wm2200.h>
+#include <sound/wm5100.h>
+#include <sound/wm8996.h>
+#include <sound/wm8962.h>
+#include <sound/wm9081.h>
+
+#include <linux/platform_data/spi-s3c64xx.h>
+
+#include "cpu.h"
+#include <mach/irqs.h>
+
+#include "crag6410.h"
+
+static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
+       .line = S3C64XX_GPC(3),
+};
+
+static struct wm0010_pdata wm0010_pdata = {
+       .gpio_reset = S3C64XX_GPN(6),
+       .reset_active_high = 1, /* Active high for Glenfarclas Rev 2 */
+};
+
+static struct spi_board_info wm1253_devs[] = {
+       [0] = {
+               .modalias       = "wm0010",
+               .max_speed_hz   = 26 * 1000 * 1000,
+               .bus_num        = 0,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_0,
+               .irq            = S3C_EINT(4),
+               .controller_data = &wm0010_spi_csinfo,
+               .platform_data = &wm0010_pdata,
+       },
+};
+
+static struct spi_board_info balblair_devs[] = {
+       [0] = {
+               .modalias       = "wm0010",
+               .max_speed_hz   = 26 * 1000 * 1000,
+               .bus_num        = 0,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_0,
+               .irq            = S3C_EINT(4),
+               .controller_data = &wm0010_spi_csinfo,
+               .platform_data = &wm0010_pdata,
+       },
+};
+
+static struct wm5100_pdata wm5100_pdata = {
+       .ldo_ena = S3C64XX_GPN(7),
+       .irq_flags = IRQF_TRIGGER_HIGH,
+       .gpio_base = CODEC_GPIO_BASE,
+
+       .in_mode = {
+               WM5100_IN_DIFF,
+               WM5100_IN_DIFF,
+               WM5100_IN_DIFF,
+               WM5100_IN_SE,
+       },
+
+       .hp_pol = CODEC_GPIO_BASE + 3,
+       .jack_modes = {
+               { WM5100_MICDET_MICBIAS3, 0, 0 },
+               { WM5100_MICDET_MICBIAS2, 1, 1 },
+       },
+
+       .gpio_defaults = {
+               0,
+               0,
+               0,
+               0,
+               0x2, /* IRQ: CMOS output */
+               0x3, /* CLKOUT: CMOS output */
+       },
+};
+
+static struct wm8996_retune_mobile_config wm8996_retune[] = {
+       {
+               .name = "Sub LPF",
+               .rate = 48000,
+               .regs = {
+                       0x6318, 0x6300, 0x1000, 0x0000, 0x0004, 0x2000, 0xF000,
+                       0x0000, 0x0004, 0x2000, 0xF000, 0x0000, 0x0004, 0x2000,
+                       0xF000, 0x0000, 0x0004, 0x1000, 0x0800, 0x4000
+               },
+       },
+       {
+               .name = "Sub HPF",
+               .rate = 48000,
+               .regs = {
+                       0x000A, 0x6300, 0x1000, 0x0000, 0x0004, 0x2000, 0xF000,
+                       0x0000, 0x0004, 0x2000, 0xF000, 0x0000, 0x0004, 0x2000,
+                       0xF000, 0x0000, 0x0004, 0x1000, 0x0800, 0x4000
+               },
+       },
+};
+
+static struct wm8996_pdata wm8996_pdata __initdata = {
+       .ldo_ena = S3C64XX_GPN(7),
+       .gpio_base = CODEC_GPIO_BASE,
+       .micdet_def = 1,
+       .inl_mode = WM8996_DIFFERRENTIAL_1,
+       .inr_mode = WM8996_DIFFERRENTIAL_1,
+
+       .irq_flags = IRQF_TRIGGER_RISING,
+
+       .gpio_default = {
+               0x8001, /* GPIO1 == ADCLRCLK1 */
+               0x8001, /* GPIO2 == ADCLRCLK2, input due to CPU */
+               0x0141, /* GPIO3 == HP_SEL */
+               0x0002, /* GPIO4 == IRQ */
+               0x020e, /* GPIO5 == CLKOUT */
+       },
+
+       .retune_mobile_cfgs = wm8996_retune,
+       .num_retune_mobile_cfgs = ARRAY_SIZE(wm8996_retune),
+};
+
+static struct wm8962_pdata wm8962_pdata __initdata = {
+       .gpio_init = {
+               0,
+               WM8962_GPIO_FN_OPCLK,
+               WM8962_GPIO_FN_DMICCLK,
+               0,
+               0x8000 | WM8962_GPIO_FN_DMICDAT,
+               WM8962_GPIO_FN_IRQ,    /* Open drain mode */
+       },
+       .in4_dc_measure = true,
+};
+
+static struct wm9081_pdata wm9081_pdata __initdata = {
+       .irq_high = false,
+       .irq_cmos = false,
+};
+
+static const struct i2c_board_info wm1254_devs[] = {
+       { I2C_BOARD_INFO("wm8996", 0x1a),
+         .platform_data = &wm8996_pdata,
+         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
+       },
+       { I2C_BOARD_INFO("wm9081", 0x6c),
+         .platform_data = &wm9081_pdata, },
+};
+
+static const struct i2c_board_info wm1255_devs[] = {
+       { I2C_BOARD_INFO("wm5100", 0x1a),
+         .platform_data = &wm5100_pdata,
+         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
+       },
+       { I2C_BOARD_INFO("wm9081", 0x6c),
+         .platform_data = &wm9081_pdata, },
+};
+
+static const struct i2c_board_info wm1259_devs[] = {
+       { I2C_BOARD_INFO("wm8962", 0x1a),
+         .platform_data = &wm8962_pdata,
+         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
+       },
+};
+
+static struct regulator_init_data wm8994_ldo1 = {
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data wm8994_ldo2 = {
+       .supply_regulator = "WALLVDD",
+};
+
+static struct wm8994_pdata wm8994_pdata = {
+       .gpio_base = CODEC_GPIO_BASE,
+       .micb2_delay = 150,
+       .gpio_defaults = {
+               0x3,          /* IRQ out, active high, CMOS */
+       },
+       .ldo = {
+                { .init_data = &wm8994_ldo1, },
+                { .init_data = &wm8994_ldo2, },
+       },
+};
+
+static const struct i2c_board_info wm1277_devs[] = {
+       { I2C_BOARD_INFO("wm8958", 0x1a),  /* WM8958 is the superset */
+         .platform_data = &wm8994_pdata,
+         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
+         .dev_name = "wm8958",
+       },
+};
+
+static struct gpiod_lookup_table wm8994_gpiod_table = {
+       .dev_id = "i2c-wm8958", /* I2C device name */
+       .table = {
+               GPIO_LOOKUP("GPION", 6,
+                           "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPION", 4,
+                           "wlf,ldo2ena", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct arizona_pdata wm5102_reva_pdata = {
+       .gpio_base = CODEC_GPIO_BASE,
+       .irq_flags = IRQF_TRIGGER_HIGH,
+       .micd_pol_gpio = CODEC_GPIO_BASE + 4,
+       .micd_rate = 6,
+       .gpio_defaults = {
+               [2] = 0x10000, /* AIF3TXLRCLK */
+               [3] = 0x4,     /* OPCLK */
+       },
+};
+
+static struct s3c64xx_spi_csinfo codec_spi_csinfo = {
+       .line = S3C64XX_GPN(5),
+};
+
+static struct spi_board_info wm5102_reva_spi_devs[] = {
+       [0] = {
+               .modalias       = "wm5102",
+               .max_speed_hz   = 10 * 1000 * 1000,
+               .bus_num        = 0,
+               .chip_select    = 1,
+               .mode           = SPI_MODE_0,
+               .irq            = GLENFARCLAS_PMIC_IRQ_BASE +
+                                 WM831X_IRQ_GPIO_2,
+               .controller_data = &codec_spi_csinfo,
+               .platform_data = &wm5102_reva_pdata,
+       },
+};
+
+static struct gpiod_lookup_table wm5102_reva_gpiod_table = {
+       .dev_id = "spi0.1", /* SPI device name */
+       .table = {
+               GPIO_LOOKUP("GPION", 7,
+                           "wlf,ldoena", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct arizona_pdata wm5102_pdata = {
+       .gpio_base = CODEC_GPIO_BASE,
+       .irq_flags = IRQF_TRIGGER_HIGH,
+       .micd_pol_gpio = CODEC_GPIO_BASE + 2,
+       .gpio_defaults = {
+               [2] = 0x10000, /* AIF3TXLRCLK */
+               [3] = 0x4,     /* OPCLK */
+       },
+};
+
+static struct spi_board_info wm5102_spi_devs[] = {
+       [0] = {
+               .modalias       = "wm5102",
+               .max_speed_hz   = 10 * 1000 * 1000,
+               .bus_num        = 0,
+               .chip_select    = 1,
+               .mode           = SPI_MODE_0,
+               .irq            = GLENFARCLAS_PMIC_IRQ_BASE +
+                                 WM831X_IRQ_GPIO_2,
+               .controller_data = &codec_spi_csinfo,
+               .platform_data = &wm5102_pdata,
+       },
+};
+
+static struct gpiod_lookup_table wm5102_gpiod_table = {
+       .dev_id = "spi0.1", /* SPI device name */
+       .table = {
+               GPIO_LOOKUP("GPION", 7,
+                           "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct spi_board_info wm5110_spi_devs[] = {
+       [0] = {
+               .modalias       = "wm5110",
+               .max_speed_hz   = 10 * 1000 * 1000,
+               .bus_num        = 0,
+               .chip_select    = 1,
+               .mode           = SPI_MODE_0,
+               .irq            = GLENFARCLAS_PMIC_IRQ_BASE +
+                                 WM831X_IRQ_GPIO_2,
+               .controller_data = &codec_spi_csinfo,
+               .platform_data = &wm5102_reva_pdata,
+       },
+};
+
+static const struct i2c_board_info wm6230_i2c_devs[] = {
+       { I2C_BOARD_INFO("wm9081", 0x6c),
+         .platform_data = &wm9081_pdata, },
+};
+
+static struct wm2200_pdata wm2200_pdata = {
+       .ldo_ena = S3C64XX_GPN(7),
+       .gpio_defaults = {
+               [2] = 0x0005,  /* GPIO3 24.576MHz output clock */
+       },
+};
+
+static const struct i2c_board_info wm2200_i2c[] = {
+       { I2C_BOARD_INFO("wm2200", 0x3a),
+         .platform_data = &wm2200_pdata, },
+};
+
+static const struct {
+       u8 id;
+       u8 rev;
+       const char *name;
+       const struct i2c_board_info *i2c_devs;
+       int num_i2c_devs;
+       const struct spi_board_info *spi_devs;
+       int num_spi_devs;
+
+       struct gpiod_lookup_table *gpiod_table;
+} gf_mods[] = {
+       { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" },
+       { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" },
+       { .id = 0x03, .rev = 0xff, .name = "1252-EV1 Glenlivet" },
+       { .id = 0x06, .rev = 0xff, .name = "WM8997-6721-CS96-EV1 Lapraoig" },
+       { .id = 0x07, .rev = 0xff, .name = "WM5110-6271 Deanston",
+         .spi_devs = wm5110_spi_devs,
+         .num_spi_devs = ARRAY_SIZE(wm5110_spi_devs) },
+       { .id = 0x08, .rev = 0xff, .name = "WM8903-6102 Tamdhu" },
+       { .id = 0x09, .rev = 0xff, .name = "WM1811A-6305 Adelphi" },
+       { .id = 0x0a, .rev = 0xff, .name = "WM8996-6272 Blackadder" },
+       { .id = 0x0b, .rev = 0xff, .name = "WM8994-6235 Benromach" },
+       { .id = 0x11, .rev = 0xff, .name = "6249-EV2 Glenfarclas", },
+       { .id = 0x14, .rev = 0xff, .name = "6271-EV1 Lochnagar" },
+       { .id = 0x15, .rev = 0xff, .name = "6320-EV1 Bells",
+         .i2c_devs = wm6230_i2c_devs,
+         .num_i2c_devs = ARRAY_SIZE(wm6230_i2c_devs) },
+       { .id = 0x21, .rev = 0xff, .name = "1275-EV1 Mortlach" },
+       { .id = 0x25, .rev = 0xff, .name = "1274-EV1 Glencadam" },
+       { .id = 0x31, .rev = 0xff, .name = "1253-EV1 Tomatin",
+         .spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs) },
+       { .id = 0x32, .rev = 0xff, .name = "XXXX-EV1 Caol Illa" },
+       { .id = 0x33, .rev = 0xff, .name = "XXXX-EV1 Oban" },
+       { .id = 0x34, .rev = 0xff, .name = "WM0010-6320-CS42 Balblair",
+         .spi_devs = balblair_devs,
+         .num_spi_devs = ARRAY_SIZE(balblair_devs) },
+       { .id = 0x39, .rev = 0xff, .name = "1254-EV1 Dallas Dhu",
+         .i2c_devs = wm1254_devs, .num_i2c_devs = ARRAY_SIZE(wm1254_devs) },
+       { .id = 0x3a, .rev = 0xff, .name = "1259-EV1 Tobermory",
+         .i2c_devs = wm1259_devs, .num_i2c_devs = ARRAY_SIZE(wm1259_devs) },
+       { .id = 0x3b, .rev = 0xff, .name = "1255-EV1 Kilchoman",
+         .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) },
+       { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" },
+       { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill",
+         .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs),
+         .gpiod_table = &wm8994_gpiod_table },
+       { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut",
+         .spi_devs = wm5102_reva_spi_devs,
+         .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs),
+         .gpiod_table = &wm5102_reva_gpiod_table },
+       { .id = 0x3e, .rev = -1, .name = "WM5102-6271-EV1-CS127 Amrut",
+         .spi_devs = wm5102_spi_devs,
+         .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs),
+         .gpiod_table = &wm5102_gpiod_table },
+       { .id = 0x3f, .rev = -1, .name = "WM2200-6271-CS90-M-REV1",
+         .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) },
+};
+
+static int wlf_gf_module_probe(struct i2c_client *i2c)
+{
+       int ret, i, j, id, rev;
+
+       ret = i2c_smbus_read_byte_data(i2c, 0);
+       if (ret < 0) {
+               dev_err(&i2c->dev, "Failed to read ID: %d\n", ret);
+               return ret;
+       }
+
+       id = (ret & 0xfe) >> 2;
+       rev = ret & 0x3;
+       for (i = 0; i < ARRAY_SIZE(gf_mods); i++)
+               if (id == gf_mods[i].id && (gf_mods[i].rev == 0xff ||
+                                           rev == gf_mods[i].rev))
+                       break;
+
+       gpiod_add_lookup_table(&wm5102_reva_gpiod_table);
+       gpiod_add_lookup_table(&wm5102_gpiod_table);
+       gpiod_add_lookup_table(&wm8994_gpiod_table);
+
+       if (i < ARRAY_SIZE(gf_mods)) {
+               dev_info(&i2c->dev, "%s revision %d\n",
+                        gf_mods[i].name, rev + 1);
+
+               for (j = 0; j < gf_mods[i].num_i2c_devs; j++) {
+                       if (IS_ERR(i2c_new_client_device(i2c->adapter,
+                                                        &(gf_mods[i].i2c_devs[j]))))
+                               dev_err(&i2c->dev, "Failed to register\n");
+               }
+
+               spi_register_board_info(gf_mods[i].spi_devs,
+                                       gf_mods[i].num_spi_devs);
+
+               if (gf_mods[i].gpiod_table)
+                       gpiod_add_lookup_table(gf_mods[i].gpiod_table);
+       } else {
+               dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n",
+                        id, rev + 1);
+       }
+
+       return 0;
+}
+
+static const struct i2c_device_id wlf_gf_module_id[] = {
+       { "wlf-gf-module", 0 },
+       { }
+};
+
+static struct i2c_driver wlf_gf_module_driver = {
+       .driver = {
+               .name = "wlf-gf-module"
+       },
+       .probe_new = wlf_gf_module_probe,
+       .id_table = wlf_gf_module_id,
+};
+
+static int __init wlf_gf_module_register(void)
+{
+       if (!soc_is_s3c64xx())
+               return 0;
+
+       return i2c_add_driver(&wlf_gf_module_driver);
+}
+device_initcall(wlf_gf_module_register);
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
new file mode 100644 (file)
index 0000000..4a12c75
--- /dev/null
@@ -0,0 +1,879 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2011 Wolfson Microelectronics plc
+//     Mark Brown <broonie@opensource.wolfsonmicro.com>
+//
+// Copyright 2011 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/leds.h>
+#include <linux/delay.h>
+#include <linux/mmc/host.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
+#include <linux/pwm.h>
+#include <linux/pwm_backlight.h>
+#include <linux/dm9000.h>
+#include <linux/gpio_keys.h>
+#include <linux/gpio/driver.h>
+#include <linux/spi/spi.h>
+
+#include <linux/platform_data/pca953x.h>
+#include <linux/platform_data/s3c-hsotg.h>
+
+#include <video/platform_lcd.h>
+
+#include <linux/mfd/wm831x/core.h>
+#include <linux/mfd/wm831x/pdata.h>
+#include <linux/mfd/wm831x/irq.h>
+#include <linux/mfd/wm831x/gpio.h>
+
+#include <sound/wm1250-ev1.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach-types.h>
+
+#include <video/samsung_fimd.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <mach/irqs.h>
+
+#include "fb.h"
+#include "sdhci.h"
+#include "gpio-cfg.h"
+#include <linux/platform_data/spi-s3c64xx.h>
+
+#include "keypad.h"
+#include "devs.h"
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-adc.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "pm.h"
+
+#include "s3c64xx.h"
+#include "crag6410.h"
+#include "regs-gpio-memport-s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-sys-s3c64xx.h"
+
+/* serial port setup */
+
+#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport         = 0,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [1] = {
+               .hwport         = 1,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [2] = {
+               .hwport         = 2,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [3] = {
+               .hwport         = 3,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+};
+
+static struct pwm_lookup crag6410_pwm_lookup[] = {
+       PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 100000,
+                  PWM_POLARITY_NORMAL),
+};
+
+static struct platform_pwm_backlight_data crag6410_backlight_data = {
+       .max_brightness = 1000,
+       .dft_brightness = 600,
+};
+
+static struct platform_device crag6410_backlight_device = {
+       .name           = "pwm-backlight",
+       .id             = -1,
+       .dev            = {
+               .parent = &samsung_device_pwm.dev,
+               .platform_data = &crag6410_backlight_data,
+       },
+};
+
+static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
+{
+       pr_debug("%s: setting power %d\n", __func__, power);
+
+       if (power) {
+               gpio_set_value(S3C64XX_GPB(0), 1);
+               msleep(1);
+               s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
+       } else {
+               gpio_direction_output(S3C64XX_GPF(14), 0);
+               gpio_set_value(S3C64XX_GPB(0), 0);
+       }
+}
+
+static struct platform_device crag6410_lcd_powerdev = {
+       .name                   = "platform-lcd",
+       .id                     = -1,
+       .dev.parent             = &s3c_device_fb.dev,
+       .dev.platform_data      = &(struct plat_lcd_data) {
+               .set_power      = crag6410_lcd_power_set,
+       },
+};
+
+/* 640x480 URT */
+static struct s3c_fb_pd_win crag6410_fb_win0 = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 640,
+       .yres           = 480,
+       .virtual_y      = 480 * 2,
+       .virtual_x      = 640,
+};
+
+static struct fb_videomode crag6410_lcd_timing = {
+       .left_margin    = 150,
+       .right_margin   = 80,
+       .upper_margin   = 40,
+       .lower_margin   = 5,
+       .hsync_len      = 40,
+       .vsync_len      = 5,
+       .xres           = 640,
+       .yres           = 480,
+};
+
+/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
+static struct s3c_fb_platdata crag6410_lcd_pdata = {
+       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+       .vtiming        = &crag6410_lcd_timing,
+       .win[0]         = &crag6410_fb_win0,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+};
+
+/* 2x6 keypad */
+
+static uint32_t crag6410_keymap[] = {
+       /* KEY(row, col, keycode) */
+       KEY(0, 0, KEY_VOLUMEUP),
+       KEY(0, 1, KEY_HOME),
+       KEY(0, 2, KEY_VOLUMEDOWN),
+       KEY(0, 3, KEY_HELP),
+       KEY(0, 4, KEY_MENU),
+       KEY(0, 5, KEY_MEDIA),
+       KEY(1, 0, 232),
+       KEY(1, 1, KEY_DOWN),
+       KEY(1, 2, KEY_LEFT),
+       KEY(1, 3, KEY_UP),
+       KEY(1, 4, KEY_RIGHT),
+       KEY(1, 5, KEY_CAMERA),
+};
+
+static struct matrix_keymap_data crag6410_keymap_data = {
+       .keymap         = crag6410_keymap,
+       .keymap_size    = ARRAY_SIZE(crag6410_keymap),
+};
+
+static struct samsung_keypad_platdata crag6410_keypad_data = {
+       .keymap_data    = &crag6410_keymap_data,
+       .rows           = 2,
+       .cols           = 6,
+};
+
+static struct gpio_keys_button crag6410_gpio_keys[] = {
+       [0] = {
+               .code   = KEY_SUSPEND,
+               .gpio   = S3C64XX_GPL(10),      /* EINT 18 */
+               .type   = EV_KEY,
+               .wakeup = 1,
+               .active_low = 1,
+       },
+       [1] = {
+               .code   = SW_FRONT_PROXIMITY,
+               .gpio   = S3C64XX_GPN(11),      /* EINT 11 */
+               .type   = EV_SW,
+       },
+};
+
+static struct gpio_keys_platform_data crag6410_gpio_keydata = {
+       .buttons        = crag6410_gpio_keys,
+       .nbuttons       = ARRAY_SIZE(crag6410_gpio_keys),
+};
+
+static struct platform_device crag6410_gpio_keydev = {
+       .name           = "gpio-keys",
+       .id             = 0,
+       .dev.platform_data = &crag6410_gpio_keydata,
+};
+
+static struct resource crag6410_dm9k_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),
+       [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),
+       [2] = DEFINE_RES_NAMED(S3C_EINT(17), 1, NULL, IORESOURCE_IRQ \
+                               | IORESOURCE_IRQ_HIGHLEVEL),
+};
+
+static struct dm9000_plat_data mini6410_dm9k_pdata = {
+       .flags  = DM9000_PLATF_16BITONLY,
+};
+
+static struct platform_device crag6410_dm9k_device = {
+       .name           = "dm9000",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(crag6410_dm9k_resource),
+       .resource       = crag6410_dm9k_resource,
+       .dev.platform_data = &mini6410_dm9k_pdata,
+};
+
+static struct resource crag6410_mmgpio_resource[] = {
+       [0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),
+};
+
+static struct platform_device crag6410_mmgpio = {
+       .name           = "basic-mmio-gpio",
+       .id             = -1,
+       .resource       = crag6410_mmgpio_resource,
+       .num_resources  = ARRAY_SIZE(crag6410_mmgpio_resource),
+       .dev.platform_data = &(struct bgpio_pdata) {
+               .base   = MMGPIO_GPIO_BASE,
+       },
+};
+
+static struct platform_device speyside_device = {
+       .name           = "speyside",
+       .id             = -1,
+};
+
+static struct platform_device lowland_device = {
+       .name           = "lowland",
+       .id             = -1,
+};
+
+static struct platform_device tobermory_device = {
+       .name           = "tobermory",
+       .id             = -1,
+};
+
+static struct platform_device littlemill_device = {
+       .name           = "littlemill",
+       .id             = -1,
+};
+
+static struct platform_device bells_wm2200_device = {
+       .name           = "bells",
+       .id             = 0,
+};
+
+static struct platform_device bells_wm5102_device = {
+       .name           = "bells",
+       .id             = 1,
+};
+
+static struct platform_device bells_wm5110_device = {
+       .name           = "bells",
+       .id             = 2,
+};
+
+static struct regulator_consumer_supply wallvdd_consumers[] = {
+       REGULATOR_SUPPLY("SPKVDD", "1-001a"),
+       REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
+       REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
+       REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
+       REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
+
+       REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
+       REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
+
+       REGULATOR_SUPPLY("DC1VDD", "0-0034"),
+       REGULATOR_SUPPLY("DC2VDD", "0-0034"),
+       REGULATOR_SUPPLY("DC3VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO1VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO2VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO4VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO5VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO6VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO7VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO8VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO9VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO10VDD", "0-0034"),
+       REGULATOR_SUPPLY("LDO11VDD", "0-0034"),
+
+       REGULATOR_SUPPLY("DC1VDD", "1-0034"),
+       REGULATOR_SUPPLY("DC2VDD", "1-0034"),
+       REGULATOR_SUPPLY("DC3VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO1VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO2VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO4VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO5VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO6VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO7VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO8VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO9VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO10VDD", "1-0034"),
+       REGULATOR_SUPPLY("LDO11VDD", "1-0034"),
+};
+
+static struct regulator_init_data wallvdd_data = {
+       .constraints = {
+               .always_on = 1,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(wallvdd_consumers),
+       .consumer_supplies = wallvdd_consumers,
+};
+
+static struct fixed_voltage_config wallvdd_pdata = {
+       .supply_name = "WALLVDD",
+       .microvolts = 5000000,
+       .init_data = &wallvdd_data,
+};
+
+static struct platform_device wallvdd_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = -1,
+       .dev = {
+               .platform_data = &wallvdd_pdata,
+       },
+};
+
+static struct platform_device *crag6410_devices[] __initdata = {
+       &s3c_device_hsmmc0,
+       &s3c_device_hsmmc2,
+       &s3c_device_i2c0,
+       &s3c_device_i2c1,
+       &s3c_device_fb,
+       &s3c_device_ohci,
+       &s3c_device_usb_hsotg,
+       &samsung_device_pwm,
+       &s3c64xx_device_iis0,
+       &s3c64xx_device_iis1,
+       &samsung_device_keypad,
+       &crag6410_gpio_keydev,
+       &crag6410_dm9k_device,
+       &s3c64xx_device_spi0,
+       &crag6410_mmgpio,
+       &crag6410_lcd_powerdev,
+       &crag6410_backlight_device,
+       &speyside_device,
+       &tobermory_device,
+       &littlemill_device,
+       &lowland_device,
+       &bells_wm2200_device,
+       &bells_wm5102_device,
+       &bells_wm5110_device,
+       &wallvdd_device,
+};
+
+static struct pca953x_platform_data crag6410_pca_data = {
+       .gpio_base      = PCA935X_GPIO_BASE,
+       .irq_base       = -1,
+};
+
+/* VDDARM is controlled by DVS1 connected to GPK(0) */
+static struct wm831x_buckv_pdata vddarm_pdata = {
+       .dvs_control_src = 1,
+};
+
+static struct regulator_consumer_supply vddarm_consumers[] = {
+       REGULATOR_SUPPLY("vddarm", NULL),
+};
+
+static struct regulator_init_data vddarm = {
+       .constraints = {
+               .name = "VDDARM",
+               .min_uV = 1000000,
+               .max_uV = 1300000,
+               .always_on = 1,
+               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(vddarm_consumers),
+       .consumer_supplies = vddarm_consumers,
+       .supply_regulator = "WALLVDD",
+       .driver_data = &vddarm_pdata,
+};
+
+static struct regulator_consumer_supply vddint_consumers[] = {
+       REGULATOR_SUPPLY("vddint", NULL),
+};
+
+static struct regulator_init_data vddint = {
+       .constraints = {
+               .name = "VDDINT",
+               .min_uV = 1000000,
+               .max_uV = 1200000,
+               .always_on = 1,
+               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(vddint_consumers),
+       .consumer_supplies = vddint_consumers,
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddmem = {
+       .constraints = {
+               .name = "VDDMEM",
+               .always_on = 1,
+       },
+};
+
+static struct regulator_init_data vddsys = {
+       .constraints = {
+               .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
+               .always_on = 1,
+       },
+};
+
+static struct regulator_consumer_supply vddmmc_consumers[] = {
+       REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
+       REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
+       REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
+};
+
+static struct regulator_init_data vddmmc = {
+       .constraints = {
+               .name = "VDDMMC,UH",
+               .always_on = 1,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
+       .consumer_supplies = vddmmc_consumers,
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddotgi = {
+       .constraints = {
+               .name = "VDDOTGi",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddotg = {
+       .constraints = {
+               .name = "VDDOTG",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddhi = {
+       .constraints = {
+               .name = "VDDHI",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddadc = {
+       .constraints = {
+               .name = "VDDADC,VDDDAC",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddmem0 = {
+       .constraints = {
+               .name = "VDDMEM0",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddpll = {
+       .constraints = {
+               .name = "VDDPLL",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddlcd = {
+       .constraints = {
+               .name = "VDDLCD",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct regulator_init_data vddalive = {
+       .constraints = {
+               .name = "VDDALIVE",
+               .always_on = 1,
+       },
+       .supply_regulator = "WALLVDD",
+};
+
+static struct wm831x_backup_pdata banff_backup_pdata = {
+       .charger_enable = 1,
+       .vlim = 2500,  /* mV */
+       .ilim = 200,   /* uA */
+};
+
+static struct wm831x_status_pdata banff_red_led = {
+       .name = "banff:red:",
+       .default_src = WM831X_STATUS_MANUAL,
+};
+
+static struct wm831x_status_pdata banff_green_led = {
+       .name = "banff:green:",
+       .default_src = WM831X_STATUS_MANUAL,
+};
+
+static struct wm831x_touch_pdata touch_pdata = {
+       .data_irq = S3C_EINT(26),
+       .pd_irq = S3C_EINT(27),
+};
+
+static struct wm831x_pdata crag_pmic_pdata = {
+       .wm831x_num = 1,
+       .irq_base = BANFF_PMIC_IRQ_BASE,
+       .gpio_base = BANFF_PMIC_GPIO_BASE,
+       .soft_shutdown = true,
+
+       .backup = &banff_backup_pdata,
+
+       .gpio_defaults = {
+               /* GPIO5: DVS1_REQ - CMOS, DBVDD, active high */
+               [4] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA | 0x8,
+               /* GPIO11: Touchscreen data - CMOS, DBVDD, active high*/
+               [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
+               /* GPIO12: Touchscreen pen down - CMOS, DBVDD, active high*/
+               [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
+       },
+
+       .dcdc = {
+               &vddarm,  /* DCDC1 */
+               &vddint,  /* DCDC2 */
+               &vddmem,  /* DCDC3 */
+       },
+
+       .ldo = {
+               &vddsys,   /* LDO1 */
+               &vddmmc,   /* LDO2 */
+               NULL,      /* LDO3 */
+               &vddotgi,  /* LDO4 */
+               &vddotg,   /* LDO5 */
+               &vddhi,    /* LDO6 */
+               &vddadc,   /* LDO7 */
+               &vddmem0,  /* LDO8 */
+               &vddpll,   /* LDO9 */
+               &vddlcd,   /* LDO10 */
+               &vddalive, /* LDO11 */
+       },
+
+       .status = {
+               &banff_green_led,
+               &banff_red_led,
+       },
+
+       .touch = &touch_pdata,
+};
+
+/*
+ * VDDARM is eventually ending up as a regulator hanging on the MFD cell device
+ * "wm831x-buckv.1" spawn from drivers/mfd/wm831x-core.c.
+ *
+ * From the note on the platform data we can see that this is clearly DVS1
+ * and assigned as dcdc1 resource to the MFD core which sets .id of the cell
+ * spawning the DVS1 platform device to 1, then the cell platform device
+ * name is calculated from 10*instance + id resulting in the device name
+ * "wm831x-buckv.11"
+ */
+static struct gpiod_lookup_table crag_pmic_gpiod_table = {
+       .dev_id = "wm831x-buckv.11",
+       .table = {
+               GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct i2c_board_info i2c_devs0[] = {
+       { I2C_BOARD_INFO("24c08", 0x50), },
+       { I2C_BOARD_INFO("tca6408", 0x20),
+         .platform_data = &crag6410_pca_data,
+       },
+       { I2C_BOARD_INFO("wm8312", 0x34),
+         .platform_data = &crag_pmic_pdata,
+         .irq = S3C_EINT(23),
+       },
+};
+
+static struct s3c2410_platform_i2c i2c0_pdata = {
+       .frequency = 400000,
+};
+
+static struct regulator_consumer_supply pvdd_1v2_consumers[] = {
+       REGULATOR_SUPPLY("DCVDD", "spi0.0"),
+       REGULATOR_SUPPLY("AVDD", "spi0.0"),
+       REGULATOR_SUPPLY("AVDD", "spi0.1"),
+};
+
+static struct regulator_init_data pvdd_1v2 = {
+       .constraints = {
+               .name = "PVDD_1V2",
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+       },
+
+       .consumer_supplies = pvdd_1v2_consumers,
+       .num_consumer_supplies = ARRAY_SIZE(pvdd_1v2_consumers),
+};
+
+static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
+       REGULATOR_SUPPLY("LDOVDD", "1-001a"),
+       REGULATOR_SUPPLY("PLLVDD", "1-001a"),
+       REGULATOR_SUPPLY("DBVDD", "1-001a"),
+       REGULATOR_SUPPLY("DBVDD1", "1-001a"),
+       REGULATOR_SUPPLY("DBVDD2", "1-001a"),
+       REGULATOR_SUPPLY("DBVDD3", "1-001a"),
+       REGULATOR_SUPPLY("CPVDD", "1-001a"),
+       REGULATOR_SUPPLY("AVDD2", "1-001a"),
+       REGULATOR_SUPPLY("DCVDD", "1-001a"),
+       REGULATOR_SUPPLY("AVDD", "1-001a"),
+       REGULATOR_SUPPLY("DBVDD", "spi0.0"),
+
+       REGULATOR_SUPPLY("DBVDD", "1-003a"),
+       REGULATOR_SUPPLY("LDOVDD", "1-003a"),
+       REGULATOR_SUPPLY("CPVDD", "1-003a"),
+       REGULATOR_SUPPLY("AVDD", "1-003a"),
+       REGULATOR_SUPPLY("DBVDD1", "spi0.1"),
+       REGULATOR_SUPPLY("DBVDD2", "spi0.1"),
+       REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
+       REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
+       REGULATOR_SUPPLY("CPVDD", "spi0.1"),
+};
+
+static struct regulator_init_data pvdd_1v8 = {
+       .constraints = {
+               .name = "PVDD_1V8",
+               .always_on = 1,
+       },
+
+       .consumer_supplies = pvdd_1v8_consumers,
+       .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
+};
+
+static struct regulator_consumer_supply pvdd_3v3_consumers[] = {
+       REGULATOR_SUPPLY("MICVDD", "1-001a"),
+       REGULATOR_SUPPLY("AVDD1", "1-001a"),
+};
+
+static struct regulator_init_data pvdd_3v3 = {
+       .constraints = {
+               .name = "PVDD_3V3",
+               .always_on = 1,
+       },
+
+       .consumer_supplies = pvdd_3v3_consumers,
+       .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
+};
+
+static struct wm831x_pdata glenfarclas_pmic_pdata = {
+       .wm831x_num = 2,
+       .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
+       .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
+       .soft_shutdown = true,
+
+       .gpio_defaults = {
+               /* GPIO1-3: IRQ inputs, rising edge triggered, CMOS */
+               [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
+               [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
+               [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
+       },
+
+       .dcdc = {
+               &pvdd_1v2,  /* DCDC1 */
+               &pvdd_1v8,  /* DCDC2 */
+               &pvdd_3v3,  /* DCDC3 */
+       },
+
+       .disable_touch = true,
+};
+
+static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
+       .gpios = {
+               [WM1250_EV1_GPIO_CLK_ENA] = S3C64XX_GPN(12),
+               [WM1250_EV1_GPIO_CLK_SEL0] = S3C64XX_GPL(12),
+               [WM1250_EV1_GPIO_CLK_SEL1] = S3C64XX_GPL(13),
+               [WM1250_EV1_GPIO_OSR] = S3C64XX_GPL(14),
+               [WM1250_EV1_GPIO_MASTER] = S3C64XX_GPL(8),
+       },
+};
+
+static struct i2c_board_info i2c_devs1[] = {
+       { I2C_BOARD_INFO("wm8311", 0x34),
+         .irq = S3C_EINT(0),
+         .platform_data = &glenfarclas_pmic_pdata },
+
+       { I2C_BOARD_INFO("wlf-gf-module", 0x20) },
+       { I2C_BOARD_INFO("wlf-gf-module", 0x22) },
+       { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
+       { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
+       { I2C_BOARD_INFO("wlf-gf-module", 0x26) },
+
+       { I2C_BOARD_INFO("wm1250-ev1", 0x27),
+         .platform_data = &wm1250_ev1_pdata },
+};
+
+static struct s3c2410_platform_i2c i2c1_pdata = {
+       .frequency = 400000,
+       .bus_num = 1,
+};
+
+static void __init crag6410_map_io(void)
+{
+       s3c64xx_init_io(NULL, 0);
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+
+       /* LCD type and Bypass set by bootloader */
+}
+
+static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_PERMANENT,
+       .host_caps              = MMC_CAP_POWER_OFF_CARD,
+};
+
+static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
+{
+       /* Set all the necessary GPG pins to special-function 2 */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
+
+       /* force card-detected for prototype 0 */
+       s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
+}
+
+static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_INTERNAL,
+       .cfg_gpio               = crag6410_cfg_sdhci0,
+       .host_caps              = MMC_CAP_POWER_OFF_CARD,
+};
+
+static const struct gpio_led gpio_leds[] = {
+       {
+               .name = "d13:green:",
+               .gpio = MMGPIO_GPIO_BASE + 0,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d14:green:",
+               .gpio = MMGPIO_GPIO_BASE + 1,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d15:green:",
+               .gpio = MMGPIO_GPIO_BASE + 2,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d16:green:",
+               .gpio = MMGPIO_GPIO_BASE + 3,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d17:green:",
+               .gpio = MMGPIO_GPIO_BASE + 4,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d18:green:",
+               .gpio = MMGPIO_GPIO_BASE + 5,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d19:green:",
+               .gpio = MMGPIO_GPIO_BASE + 6,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+       {
+               .name = "d20:green:",
+               .gpio = MMGPIO_GPIO_BASE + 7,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+};
+
+static const struct gpio_led_platform_data gpio_leds_pdata = {
+       .leds = gpio_leds,
+       .num_leds = ARRAY_SIZE(gpio_leds),
+};
+
+static struct dwc2_hsotg_plat crag6410_hsotg_pdata;
+
+static void __init crag6410_machine_init(void)
+{
+       /* Open drain IRQs need pullups */
+       s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
+       s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
+
+       gpio_request(S3C64XX_GPB(0), "LCD power");
+       gpio_direction_output(S3C64XX_GPB(0), 0);
+
+       gpio_request(S3C64XX_GPF(14), "LCD PWM");
+       gpio_direction_output(S3C64XX_GPF(14), 0);  /* turn off */
+
+       gpio_request(S3C64XX_GPB(1), "SD power");
+       gpio_direction_output(S3C64XX_GPB(1), 0);
+
+       gpio_request(S3C64XX_GPF(10), "nRESETSEL");
+       gpio_direction_output(S3C64XX_GPF(10), 1);
+
+       s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
+       s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
+
+       s3c_i2c0_set_platdata(&i2c0_pdata);
+       s3c_i2c1_set_platdata(&i2c1_pdata);
+       s3c_fb_set_platdata(&crag6410_lcd_pdata);
+       dwc2_hsotg_set_platdata(&crag6410_hsotg_pdata);
+
+       gpiod_add_lookup_table(&crag_pmic_gpiod_table);
+       i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
+       i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
+
+       samsung_keypad_set_platdata(&crag6410_keypad_data);
+       s3c64xx_spi0_set_platdata(NULL, 0, 2);
+
+       pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
+       platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
+
+       gpio_led_register_device(-1, &gpio_leds_pdata);
+
+       regulator_has_full_constraints();
+
+       s3c64xx_pm_init();
+}
+
+MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
+       /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = crag6410_map_io,
+       .init_machine   = crag6410_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-gta02.c b/arch/arm/mach-s3c/mach-gta02.c
new file mode 100644 (file)
index 0000000..97a52fd
--- /dev/null
@@ -0,0 +1,580 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// S3C2442 Machine Support for Openmoko GTA02 / FreeRunner.
+//
+// Copyright (C) 2006-2009 by Openmoko, Inc.
+// Authors: Harald Welte <laforge@openmoko.org>
+//          Andy Green <andy@openmoko.org>
+//          Werner Almesberger <werner@openmoko.org>
+// All rights reserved.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/delay.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio/machine.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/workqueue.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/i2c.h>
+
+#include <linux/mmc/host.h>
+
+#include <linux/mfd/pcf50633/adc.h>
+#include <linux/mfd/pcf50633/backlight.h>
+#include <linux/mfd/pcf50633/core.h>
+#include <linux/mfd/pcf50633/gpio.h>
+#include <linux/mfd/pcf50633/mbc.h>
+#include <linux/mfd/pcf50633/pmic.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+#include <linux/regulator/machine.h>
+
+#include <linux/spi/spi.h>
+#include <linux/spi/s3c24xx.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/touchscreen-s3c2410.h>
+#include <linux/platform_data/usb-ohci-s3c2410.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/fb-s3c2410.h>
+
+#include "regs-gpio.h"
+#include "regs-irq.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "gpio-cfg.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "gta02.h"
+
+static struct pcf50633 *gta02_pcf;
+
+/*
+ * This gets called frequently when we paniced.
+ */
+
+static long gta02_panic_blink(int state)
+{
+       long delay = 0;
+       char led;
+
+       led = (state) ? 1 : 0;
+       gpio_direction_output(GTA02_GPIO_AUX_LED, led);
+
+       return delay;
+}
+
+
+static struct map_desc gta02_iodesc[] __initdata = {
+       {
+               .virtual        = 0xe0000000,
+               .pfn            = __phys_to_pfn(S3C2410_CS3 + 0x01000000),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE
+       },
+};
+
+#define UCON (S3C2410_UCON_DEFAULT | S3C2443_UCON_RXERR_IRQEN)
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg gta02_uartcfgs[] = {
+       [0] = {
+               .hwport         = 0,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [1] = {
+               .hwport         = 1,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [2] = {
+               .hwport         = 2,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+};
+
+#ifdef CONFIG_CHARGER_PCF50633
+/*
+ * On GTA02 the 1A charger features a 48K resistor to 0V on the ID pin.
+ * We use this to recognize that we can pull 1A from the USB socket.
+ *
+ * These constants are the measured pcf50633 ADC levels with the 1A
+ * charger / 48K resistor, and with no pulldown resistor.
+ */
+
+#define ADC_NOM_CHG_DETECT_1A 6
+#define ADC_NOM_CHG_DETECT_USB 43
+
+#ifdef CONFIG_PCF50633_ADC
+static void
+gta02_configure_pmu_for_charger(struct pcf50633 *pcf, void *unused, int res)
+{
+       int  ma;
+
+       /* Interpret charger type */
+       if (res < ((ADC_NOM_CHG_DETECT_USB + ADC_NOM_CHG_DETECT_1A) / 2)) {
+
+               /*
+                * Sanity - stop GPO driving out now that we have a 1A charger
+                * GPO controls USB Host power generation on GTA02
+                */
+               pcf50633_gpio_set(pcf, PCF50633_GPO, 0);
+
+               ma = 1000;
+       } else
+               ma = 100;
+
+       pcf50633_mbc_usb_curlim_set(pcf, ma);
+}
+#endif
+
+static struct delayed_work gta02_charger_work;
+static int gta02_usb_vbus_draw;
+
+static void gta02_charger_worker(struct work_struct *work)
+{
+       if (gta02_usb_vbus_draw) {
+               pcf50633_mbc_usb_curlim_set(gta02_pcf, gta02_usb_vbus_draw);
+               return;
+       }
+
+#ifdef CONFIG_PCF50633_ADC
+       pcf50633_adc_async_read(gta02_pcf,
+                               PCF50633_ADCC1_MUX_ADCIN1,
+                               PCF50633_ADCC1_AVERAGE_16,
+                               gta02_configure_pmu_for_charger,
+                               NULL);
+#else
+       /*
+        * If the PCF50633 ADC is disabled we fallback to a
+        * 100mA limit for safety.
+        */
+       pcf50633_mbc_usb_curlim_set(gta02_pcf, 100);
+#endif
+}
+
+#define GTA02_CHARGER_CONFIGURE_TIMEOUT ((3000 * HZ) / 1000)
+
+static void gta02_pmu_event_callback(struct pcf50633 *pcf, int irq)
+{
+       if (irq == PCF50633_IRQ_USBINS) {
+               schedule_delayed_work(&gta02_charger_work,
+                                     GTA02_CHARGER_CONFIGURE_TIMEOUT);
+
+               return;
+       }
+
+       if (irq == PCF50633_IRQ_USBREM) {
+               cancel_delayed_work_sync(&gta02_charger_work);
+               gta02_usb_vbus_draw = 0;
+       }
+}
+
+static void gta02_udc_vbus_draw(unsigned int ma)
+{
+       if (!gta02_pcf)
+               return;
+
+       gta02_usb_vbus_draw = ma;
+
+       schedule_delayed_work(&gta02_charger_work,
+                             GTA02_CHARGER_CONFIGURE_TIMEOUT);
+}
+#else /* !CONFIG_CHARGER_PCF50633 */
+#define gta02_pmu_event_callback       NULL
+#define gta02_udc_vbus_draw            NULL
+#endif
+
+static char *gta02_batteries[] = {
+       "battery",
+};
+
+static struct pcf50633_bl_platform_data gta02_backlight_data = {
+       .default_brightness = 0x3f,
+       .default_brightness_limit = 0,
+       .ramp_time = 5,
+};
+
+static struct pcf50633_platform_data gta02_pcf_pdata = {
+       .resumers = {
+               [0] =   PCF50633_INT1_USBINS |
+                       PCF50633_INT1_USBREM |
+                       PCF50633_INT1_ALARM,
+               [1] =   PCF50633_INT2_ONKEYF,
+               [2] =   PCF50633_INT3_ONKEY1S,
+               [3] =   PCF50633_INT4_LOWSYS |
+                       PCF50633_INT4_LOWBAT |
+                       PCF50633_INT4_HIGHTMP,
+       },
+
+       .batteries = gta02_batteries,
+       .num_batteries = ARRAY_SIZE(gta02_batteries),
+
+       .charger_reference_current_ma = 1000,
+
+       .backlight_data = &gta02_backlight_data,
+
+       .reg_init_data = {
+               [PCF50633_REGULATOR_AUTO] = {
+                       .constraints = {
+                               .min_uV = 3300000,
+                               .max_uV = 3300000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .always_on = 1,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_DOWN1] = {
+                       .constraints = {
+                               .min_uV = 1300000,
+                               .max_uV = 1600000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .always_on = 1,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_DOWN2] = {
+                       .constraints = {
+                               .min_uV = 1800000,
+                               .max_uV = 1800000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .apply_uV = 1,
+                               .always_on = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_HCLDO] = {
+                       .constraints = {
+                               .min_uV = 2000000,
+                               .max_uV = 3300000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
+                                               REGULATOR_CHANGE_STATUS,
+                       },
+               },
+               [PCF50633_REGULATOR_LDO1] = {
+                       .constraints = {
+                               .min_uV = 3300000,
+                               .max_uV = 3300000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_LDO2] = {
+                       .constraints = {
+                               .min_uV = 3300000,
+                               .max_uV = 3300000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_LDO3] = {
+                       .constraints = {
+                               .min_uV = 3000000,
+                               .max_uV = 3000000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_LDO4] = {
+                       .constraints = {
+                               .min_uV = 3200000,
+                               .max_uV = 3200000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_LDO5] = {
+                       .constraints = {
+                               .min_uV = 3000000,
+                               .max_uV = 3000000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+                               .apply_uV = 1,
+                       },
+               },
+               [PCF50633_REGULATOR_LDO6] = {
+                       .constraints = {
+                               .min_uV = 3000000,
+                               .max_uV = 3000000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                       },
+               },
+               [PCF50633_REGULATOR_MEMLDO] = {
+                       .constraints = {
+                               .min_uV = 1800000,
+                               .max_uV = 1800000,
+                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
+                       },
+               },
+
+       },
+       .mbc_event_callback = gta02_pmu_event_callback,
+};
+
+
+/* NOR Flash. */
+
+#define GTA02_FLASH_BASE       0x18000000 /* GCS3 */
+#define GTA02_FLASH_SIZE       0x200000 /* 2MBytes */
+
+static struct physmap_flash_data gta02_nor_flash_data = {
+       .width          = 2,
+};
+
+static struct resource gta02_nor_flash_resource =
+       DEFINE_RES_MEM(GTA02_FLASH_BASE, GTA02_FLASH_SIZE);
+
+static struct platform_device gta02_nor_flash = {
+       .name           = "physmap-flash",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &gta02_nor_flash_data,
+       },
+       .resource       = &gta02_nor_flash_resource,
+       .num_resources  = 1,
+};
+
+
+static struct platform_device s3c24xx_pwm_device = {
+       .name           = "s3c24xx_pwm",
+       .num_resources  = 0,
+};
+
+static struct platform_device gta02_dfbmcs320_device = {
+       .name = "dfbmcs320",
+};
+
+static struct i2c_board_info gta02_i2c_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("pcf50633", 0x73),
+               .irq = GTA02_IRQ_PCF50633,
+               .platform_data = &gta02_pcf_pdata,
+       },
+       {
+               I2C_BOARD_INFO("wm8753", 0x1a),
+       },
+};
+
+static struct s3c2410_nand_set __initdata gta02_nand_sets[] = {
+       [0] = {
+               /*
+                * This name is also hard-coded in the boot loaders, so
+                * changing it would would require all users to upgrade
+                * their boot loaders, some of which are stored in a NOR
+                * that is considered to be immutable.
+                */
+               .name           = "neo1973-nand",
+               .nr_chips       = 1,
+               .flash_bbt      = 1,
+       },
+};
+
+/*
+ * Choose a set of timings derived from S3C@2442B MCP54
+ * data sheet (K5D2G13ACM-D075 MCP Memory).
+ */
+
+static struct s3c2410_platform_nand __initdata gta02_nand_info = {
+       .tacls          = 0,
+       .twrph0         = 25,
+       .twrph1         = 15,
+       .nr_sets        = ARRAY_SIZE(gta02_nand_sets),
+       .sets           = gta02_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+
+/* Get PMU to set USB current limit accordingly. */
+static struct s3c2410_udc_mach_info gta02_udc_cfg __initdata = {
+       .vbus_draw      = gta02_udc_vbus_draw,
+       .pullup_pin = GTA02_GPIO_USB_PULLUP,
+};
+
+/* USB */
+static struct s3c2410_hcd_info gta02_usb_info __initdata = {
+       .port[0]        = {
+               .flags  = S3C_HCDFLG_USED,
+       },
+       .port[1]        = {
+               .flags  = 0,
+       },
+};
+
+/* Touchscreen */
+static struct s3c2410_ts_mach_info gta02_ts_info = {
+       .delay                  = 10000,
+       .presc                  = 0xff, /* slow as we can go */
+       .oversampling_shift     = 2,
+};
+
+/* Buttons */
+static struct gpio_keys_button gta02_buttons[] = {
+       {
+               .gpio = GTA02_GPIO_AUX_KEY,
+               .code = KEY_PHONE,
+               .desc = "Aux",
+               .type = EV_KEY,
+               .debounce_interval = 100,
+       },
+       {
+               .gpio = GTA02_GPIO_HOLD_KEY,
+               .code = KEY_PAUSE,
+               .desc = "Hold",
+               .type = EV_KEY,
+               .debounce_interval = 100,
+       },
+};
+
+static struct gpio_keys_platform_data gta02_buttons_pdata = {
+       .buttons = gta02_buttons,
+       .nbuttons = ARRAY_SIZE(gta02_buttons),
+};
+
+static struct platform_device gta02_buttons_device = {
+       .name = "gpio-keys",
+       .id = -1,
+       .dev = {
+               .platform_data = &gta02_buttons_pdata,
+       },
+};
+
+static struct gpiod_lookup_table gta02_audio_gpio_table = {
+       .dev_id = "neo1973-audio",
+       .table = {
+               GPIO_LOOKUP("GPIOJ", 2, "amp-shut", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOJ", 1, "hp", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct platform_device gta02_audio = {
+       .name = "neo1973-audio",
+       .id = -1,
+};
+
+static struct gpiod_lookup_table gta02_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static void __init gta02_map_io(void)
+{
+       s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
+       s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+
+/* These are the guys that don't need to be children of PMU. */
+
+static struct platform_device *gta02_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_wdt,
+       &s3c_device_sdi,
+       &s3c_device_usbgadget,
+       &s3c_device_nand,
+       &gta02_nor_flash,
+       &s3c24xx_pwm_device,
+       &s3c_device_iis,
+       &s3c_device_i2c0,
+       &gta02_dfbmcs320_device,
+       &gta02_buttons_device,
+       &s3c_device_adc,
+       &s3c_device_ts,
+       &gta02_audio,
+};
+
+static void gta02_poweroff(void)
+{
+       pcf50633_reg_set_bit_mask(gta02_pcf, PCF50633_REG_OOCSHDWN, 1, 1);
+}
+
+static void __init gta02_machine_init(void)
+{
+       /* Set the panic callback to turn AUX LED on or off. */
+       panic_blink = gta02_panic_blink;
+
+       s3c_pm_init();
+
+#ifdef CONFIG_CHARGER_PCF50633
+       INIT_DELAYED_WORK(&gta02_charger_work, gta02_charger_worker);
+#endif
+
+       s3c24xx_udc_set_platdata(&gta02_udc_cfg);
+       s3c24xx_ts_set_platdata(&gta02_ts_info);
+       s3c_ohci_set_platdata(&gta02_usb_info);
+       s3c_nand_set_platdata(&gta02_nand_info);
+       s3c_i2c0_set_platdata(NULL);
+
+       i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
+       gpiod_add_lookup_table(&gta02_audio_gpio_table);
+       gpiod_add_lookup_table(&gta02_mmc_gpio_table);
+       platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
+       pm_power_off = gta02_poweroff;
+
+       regulator_has_full_constraints();
+}
+
+static void __init gta02_init_time(void)
+{
+       s3c2442_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+MACHINE_START(NEO1973_GTA02, "GTA02")
+       /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */
+       .atag_offset    = 0x100,
+       .map_io         = gta02_map_io,
+       .init_irq       = s3c2442_init_irq,
+       .init_machine   = gta02_machine_init,
+       .init_time      = gta02_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-h1940.c b/arch/arm/mach-s3c/mach-h1940.c
new file mode 100644 (file)
index 0000000..53d51aa
--- /dev/null
@@ -0,0 +1,793 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2003-2005 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// https://www.handhelds.org/projects/h1940.html
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/memblock.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+#include <linux/pwm.h>
+#include <linux/pwm_backlight.h>
+#include <linux/i2c.h>
+#include <linux/leds.h>
+#include <linux/pda_power.h>
+#include <linux/s3c_adc_battery.h>
+#include <linux/delay.h>
+
+#include <video/platform_lcd.h>
+
+#include <linux/mmc/host.h>
+#include <linux/export.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/mmc-s3cmci.h>
+#include <linux/platform_data/touchscreen-s3c2410.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+
+#include <sound/uda1380.h>
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include "map.h"
+#include "hardware-s3c24xx.h"
+#include "regs-clock.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "gpio-cfg.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "h1940.h"
+
+#define H1940_LATCH            ((void __force __iomem *)0xF8000000)
+
+#define H1940_PA_LATCH         S3C2410_CS2
+
+#define H1940_LATCH_BIT(x)     (1 << ((x) + 16 - S3C_GPIO_END))
+
+#define S3C24XX_PLL_MDIV_SHIFT         (12)
+#define S3C24XX_PLL_PDIV_SHIFT         (4)
+#define S3C24XX_PLL_SDIV_SHIFT         (0)
+
+static struct map_desc h1940_iodesc[] __initdata = {
+       [0] = {
+               .virtual        = (unsigned long)H1940_LATCH,
+               .pfn            = __phys_to_pfn(H1940_PA_LATCH),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE
+       },
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x245,
+               .ulcon       = 0x03,
+               .ufcon       = 0x00,
+       },
+       /* IR port */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .uart_flags  = UPF_CONS_FLOW,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x43,
+               .ufcon       = 0x51,
+       }
+};
+
+/* Board control latch control */
+
+static unsigned int latch_state;
+
+static void h1940_latch_control(unsigned int clear, unsigned int set)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+
+       latch_state &= ~clear;
+       latch_state |= set;
+
+       __raw_writel(latch_state, H1940_LATCH);
+
+       local_irq_restore(flags);
+}
+
+static inline int h1940_gpiolib_to_latch(int offset)
+{
+       return 1 << (offset + 16);
+}
+
+static void h1940_gpiolib_latch_set(struct gpio_chip *chip,
+                                       unsigned offset, int value)
+{
+       int latch_bit = h1940_gpiolib_to_latch(offset);
+
+       h1940_latch_control(value ? 0 : latch_bit,
+               value ? latch_bit : 0);
+}
+
+static int h1940_gpiolib_latch_output(struct gpio_chip *chip,
+                                       unsigned offset, int value)
+{
+       h1940_gpiolib_latch_set(chip, offset, value);
+       return 0;
+}
+
+static int h1940_gpiolib_latch_get(struct gpio_chip *chip,
+                                       unsigned offset)
+{
+       return (latch_state >> (offset + 16)) & 1;
+}
+
+static struct gpio_chip h1940_latch_gpiochip = {
+       .base                   = H1940_LATCH_GPIO(0),
+       .owner                  = THIS_MODULE,
+       .label                  = "H1940_LATCH",
+       .ngpio                  = 16,
+       .direction_output       = h1940_gpiolib_latch_output,
+       .set                    = h1940_gpiolib_latch_set,
+       .get                    = h1940_gpiolib_latch_get,
+};
+
+static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
+       .vbus_pin               = S3C2410_GPG(5),
+       .vbus_pin_inverted      = 1,
+       .pullup_pin             = H1940_LATCH_USB_DP,
+};
+
+static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
+               .delay = 10000,
+               .presc = 49,
+               .oversampling_shift = 2,
+               .cfg_gpio = s3c24xx_ts_cfg_gpio,
+};
+
+/*
+ * Set lcd on or off
+ */
+static struct s3c2410fb_display h1940_lcd __initdata = {
+       .lcdcon5=       S3C2410_LCDCON5_FRM565 | \
+                       S3C2410_LCDCON5_INVVLINE | \
+                       S3C2410_LCDCON5_HWSWP,
+
+       .type =         S3C2410_LCDCON1_TFT,
+       .width =        240,
+       .height =       320,
+       .pixclock =     260000,
+       .xres =         240,
+       .yres =         320,
+       .bpp =          16,
+       .left_margin =  8,
+       .right_margin = 20,
+       .hsync_len =    4,
+       .upper_margin = 8,
+       .lower_margin = 7,
+       .vsync_len =    1,
+};
+
+static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
+       .displays = &h1940_lcd,
+       .num_displays = 1,
+       .default_display = 0,
+
+       .lpcsel =       0x02,
+       .gpccon =       0xaa940659,
+       .gpccon_mask =  0xffffc0f0,
+       .gpccon_reg =   S3C2410_GPCCON,
+       .gpcup =        0x0000ffff,
+       .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
+       .gpdcon =       0xaa84aaa0,
+       .gpdcon_mask =  0xffffffff,
+       .gpdcon_reg =   S3C2410_GPDCON,
+       .gpdup =        0x0000faff,
+       .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
+};
+
+static int power_supply_init(struct device *dev)
+{
+       return gpio_request(S3C2410_GPF(2), "cable plugged");
+}
+
+static int h1940_is_ac_online(void)
+{
+       return !gpio_get_value(S3C2410_GPF(2));
+}
+
+static void power_supply_exit(struct device *dev)
+{
+       gpio_free(S3C2410_GPF(2));
+}
+
+static char *h1940_supplicants[] = {
+       "main-battery",
+       "backup-battery",
+};
+
+static struct pda_power_pdata power_supply_info = {
+       .init                   = power_supply_init,
+       .is_ac_online           = h1940_is_ac_online,
+       .exit                   = power_supply_exit,
+       .supplied_to            = h1940_supplicants,
+       .num_supplicants        = ARRAY_SIZE(h1940_supplicants),
+};
+
+static struct resource power_supply_resources[] = {
+       [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
+                       | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
+};
+
+static struct platform_device power_supply = {
+       .name           = "pda-power",
+       .id             = -1,
+       .dev            = {
+                               .platform_data =
+                                       &power_supply_info,
+       },
+       .resource       = power_supply_resources,
+       .num_resources  = ARRAY_SIZE(power_supply_resources),
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
+       { .volt = 4070, .cur = 162, .level = 100},
+       { .volt = 4040, .cur = 165, .level = 95},
+       { .volt = 4016, .cur = 164, .level = 90},
+       { .volt = 3996, .cur = 166, .level = 85},
+       { .volt = 3971, .cur = 168, .level = 80},
+       { .volt = 3951, .cur = 168, .level = 75},
+       { .volt = 3931, .cur = 170, .level = 70},
+       { .volt = 3903, .cur = 172, .level = 65},
+       { .volt = 3886, .cur = 172, .level = 60},
+       { .volt = 3858, .cur = 176, .level = 55},
+       { .volt = 3842, .cur = 176, .level = 50},
+       { .volt = 3818, .cur = 176, .level = 45},
+       { .volt = 3789, .cur = 180, .level = 40},
+       { .volt = 3769, .cur = 180, .level = 35},
+       { .volt = 3749, .cur = 184, .level = 30},
+       { .volt = 3732, .cur = 184, .level = 25},
+       { .volt = 3716, .cur = 184, .level = 20},
+       { .volt = 3708, .cur = 184, .level = 15},
+       { .volt = 3716, .cur = 96, .level = 10},
+       { .volt = 3700, .cur = 96, .level = 5},
+       { .volt = 3684, .cur = 96, .level = 0},
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
+       { .volt = 4130, .cur = 0, .level = 100},
+       { .volt = 3982, .cur = 0, .level = 50},
+       { .volt = 3854, .cur = 0, .level = 10},
+       { .volt = 3841, .cur = 0, .level = 0},
+};
+
+static int h1940_bat_init(void)
+{
+       int ret;
+
+       ret = gpio_request(H1940_LATCH_SM803_ENABLE, "h1940-charger-enable");
+       if (ret)
+               return ret;
+       gpio_direction_output(H1940_LATCH_SM803_ENABLE, 0);
+
+       return 0;
+
+}
+
+static void h1940_bat_exit(void)
+{
+       gpio_free(H1940_LATCH_SM803_ENABLE);
+}
+
+static void h1940_enable_charger(void)
+{
+       gpio_set_value(H1940_LATCH_SM803_ENABLE, 1);
+}
+
+static void h1940_disable_charger(void)
+{
+       gpio_set_value(H1940_LATCH_SM803_ENABLE, 0);
+}
+
+static struct s3c_adc_bat_pdata h1940_bat_cfg = {
+       .init = h1940_bat_init,
+       .exit = h1940_bat_exit,
+       .enable_charger = h1940_enable_charger,
+       .disable_charger = h1940_disable_charger,
+       .gpio_charge_finished = S3C2410_GPF(3),
+       .gpio_inverted = 1,
+       .lut_noac = bat_lut_noac,
+       .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
+       .lut_acin = bat_lut_acin,
+       .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
+       .volt_channel = 0,
+       .current_channel = 1,
+       .volt_mult = 4056,
+       .current_mult = 1893,
+       .internal_impedance = 200,
+       .backup_volt_channel = 3,
+       /* TODO Check backup volt multiplier */
+       .backup_volt_mult = 4056,
+       .backup_volt_min = 0,
+       .backup_volt_max = 4149288
+};
+
+static struct platform_device h1940_battery = {
+       .name             = "s3c-adc-battery",
+       .id               = -1,
+       .dev = {
+               .parent = &s3c_device_adc.dev,
+               .platform_data = &h1940_bat_cfg,
+       },
+};
+
+static DEFINE_SPINLOCK(h1940_blink_spin);
+
+int h1940_led_blink_set(struct gpio_desc *desc, int state,
+       unsigned long *delay_on, unsigned long *delay_off)
+{
+       int blink_gpio, check_gpio1, check_gpio2;
+       int gpio = desc ? desc_to_gpio(desc) : -EINVAL;
+
+       switch (gpio) {
+       case H1940_LATCH_LED_GREEN:
+               blink_gpio = S3C2410_GPA(7);
+               check_gpio1 = S3C2410_GPA(1);
+               check_gpio2 = S3C2410_GPA(3);
+               break;
+       case H1940_LATCH_LED_RED:
+               blink_gpio = S3C2410_GPA(1);
+               check_gpio1 = S3C2410_GPA(7);
+               check_gpio2 = S3C2410_GPA(3);
+               break;
+       default:
+               blink_gpio = S3C2410_GPA(3);
+               check_gpio1 = S3C2410_GPA(1);
+               check_gpio2 = S3C2410_GPA(7);
+               break;
+       }
+
+       if (delay_on && delay_off && !*delay_on && !*delay_off)
+               *delay_on = *delay_off = 500;
+
+       spin_lock(&h1940_blink_spin);
+
+       switch (state) {
+       case GPIO_LED_NO_BLINK_LOW:
+       case GPIO_LED_NO_BLINK_HIGH:
+               if (!gpio_get_value(check_gpio1) &&
+                   !gpio_get_value(check_gpio2))
+                       gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+               gpio_set_value(blink_gpio, 0);
+               if (gpio_is_valid(gpio))
+                       gpio_set_value(gpio, state);
+               break;
+       case GPIO_LED_BLINK:
+               if (gpio_is_valid(gpio))
+                       gpio_set_value(gpio, 0);
+               gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+               gpio_set_value(blink_gpio, 1);
+               break;
+       }
+
+       spin_unlock(&h1940_blink_spin);
+
+       return 0;
+}
+EXPORT_SYMBOL(h1940_led_blink_set);
+
+static struct gpio_led h1940_leds_desc[] = {
+       {
+               .name                   = "Green",
+               .default_trigger        = "main-battery-full",
+               .gpio                   = H1940_LATCH_LED_GREEN,
+               .retain_state_suspended = 1,
+       },
+       {
+               .name                   = "Red",
+               .default_trigger
+                       = "main-battery-charging-blink-full-solid",
+               .gpio                   = H1940_LATCH_LED_RED,
+               .retain_state_suspended = 1,
+       },
+};
+
+static struct gpio_led_platform_data h1940_leds_pdata = {
+       .num_leds       = ARRAY_SIZE(h1940_leds_desc),
+       .leds           = h1940_leds_desc,
+       .gpio_blink_set = h1940_led_blink_set,
+};
+
+static struct platform_device h1940_device_leds = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+                       .platform_data = &h1940_leds_pdata,
+       },
+};
+
+static struct platform_device h1940_device_bluetooth = {
+       .name             = "h1940-bt",
+       .id               = -1,
+};
+
+static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
+{
+       s3c24xx_mci_def_set_power(power_mode, vdd);
+
+       switch (power_mode) {
+       case MMC_POWER_OFF:
+               gpio_set_value(H1940_LATCH_SD_POWER, 0);
+               break;
+       case MMC_POWER_UP:
+       case MMC_POWER_ON:
+               gpio_set_value(H1940_LATCH_SD_POWER, 1);
+               break;
+       default:
+               break;
+       }
+}
+
+static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
+       .set_power     = h1940_set_mmc_power,
+       .ocr_avail     = MMC_VDD_32_33,
+};
+
+static struct gpiod_lookup_table h1940_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* Card detect S3C2410_GPF(5) */
+               GPIO_LOOKUP("GPIOF", 5, "cd", GPIO_ACTIVE_LOW),
+               /* Write protect S3C2410_GPH(8) */
+               GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table h1940_audio_gpio_table = {
+       .dev_id = "h1940-audio",
+       .table = {
+               GPIO_LOOKUP("H1940_LATCH",
+                           H1940_LATCH_AUDIO_POWER - H1940_LATCH_GPIO(0),
+                           "speaker-power", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOG", 4, "hp", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct platform_device h1940_audio = {
+       .name = "h1940-audio",
+       .id   = -1,
+};
+
+static struct pwm_lookup h1940_pwm_lookup[] = {
+       PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 36296,
+                  PWM_POLARITY_NORMAL),
+};
+
+static int h1940_backlight_init(struct device *dev)
+{
+       gpio_request(S3C2410_GPB(0), "Backlight");
+
+       gpio_direction_output(S3C2410_GPB(0), 0);
+       s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
+       s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+       gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
+
+       return 0;
+}
+
+static int h1940_backlight_notify(struct device *dev, int brightness)
+{
+       if (!brightness) {
+               gpio_direction_output(S3C2410_GPB(0), 1);
+               gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
+       } else {
+               gpio_direction_output(S3C2410_GPB(0), 0);
+               s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
+               s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+               gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
+       }
+       return brightness;
+}
+
+static void h1940_backlight_exit(struct device *dev)
+{
+       gpio_direction_output(S3C2410_GPB(0), 1);
+       gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
+}
+
+
+static struct platform_pwm_backlight_data backlight_data = {
+       .max_brightness = 100,
+       .dft_brightness = 50,
+       .init           = h1940_backlight_init,
+       .notify         = h1940_backlight_notify,
+       .exit           = h1940_backlight_exit,
+};
+
+static struct platform_device h1940_backlight = {
+       .name = "pwm-backlight",
+       .dev  = {
+               .parent = &samsung_device_pwm.dev,
+               .platform_data = &backlight_data,
+       },
+       .id   = -1,
+};
+
+static void h1940_lcd_power_set(struct plat_lcd_data *pd,
+                                       unsigned int power)
+{
+       int value, retries = 100;
+
+       if (!power) {
+               gpio_set_value(S3C2410_GPC(0), 0);
+               /* wait for 3ac */
+               do {
+                       value = gpio_get_value(S3C2410_GPC(6));
+               } while (value && retries--);
+
+               gpio_set_value(H1940_LATCH_LCD_P2, 0);
+               gpio_set_value(H1940_LATCH_LCD_P3, 0);
+               gpio_set_value(H1940_LATCH_LCD_P4, 0);
+
+               gpio_direction_output(S3C2410_GPC(1), 0);
+               gpio_direction_output(S3C2410_GPC(4), 0);
+
+               gpio_set_value(H1940_LATCH_LCD_P1, 0);
+               gpio_set_value(H1940_LATCH_LCD_P0, 0);
+
+               gpio_set_value(S3C2410_GPC(5), 0);
+
+       } else {
+               gpio_set_value(H1940_LATCH_LCD_P0, 1);
+               gpio_set_value(H1940_LATCH_LCD_P1, 1);
+
+               gpio_direction_input(S3C2410_GPC(1));
+               gpio_direction_input(S3C2410_GPC(4));
+               mdelay(10);
+               s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
+               s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
+
+               gpio_set_value(S3C2410_GPC(5), 1);
+               gpio_set_value(S3C2410_GPC(0), 1);
+
+               gpio_set_value(H1940_LATCH_LCD_P3, 1);
+               gpio_set_value(H1940_LATCH_LCD_P2, 1);
+               gpio_set_value(H1940_LATCH_LCD_P4, 1);
+       }
+}
+
+static struct plat_lcd_data h1940_lcd_power_data = {
+       .set_power      = h1940_lcd_power_set,
+};
+
+static struct platform_device h1940_lcd_powerdev = {
+       .name                   = "platform-lcd",
+       .dev.parent             = &s3c_device_lcd.dev,
+       .dev.platform_data      = &h1940_lcd_power_data,
+};
+
+static struct uda1380_platform_data uda1380_info = {
+       .gpio_power     = H1940_LATCH_UDA_POWER,
+       .gpio_reset     = S3C2410_GPA(12),
+       .dac_clk        = UDA1380_DAC_CLK_SYSCLK,
+};
+
+static struct i2c_board_info h1940_i2c_devices[] = {
+       {
+               I2C_BOARD_INFO("uda1380", 0x1a),
+               .platform_data = &uda1380_info,
+       },
+};
+
+#define DECLARE_BUTTON(p, k, n, w)     \
+       {                               \
+               .gpio           = p,    \
+               .code           = k,    \
+               .desc           = n,    \
+               .wakeup         = w,    \
+               .active_low     = 1,    \
+       }
+
+static struct gpio_keys_button h1940_buttons[] = {
+       DECLARE_BUTTON(S3C2410_GPF(0),       KEY_POWER,          "Power", 1),
+       DECLARE_BUTTON(S3C2410_GPF(6),       KEY_ENTER,         "Select", 1),
+       DECLARE_BUTTON(S3C2410_GPF(7),      KEY_RECORD,         "Record", 0),
+       DECLARE_BUTTON(S3C2410_GPG(0),         KEY_F11,       "Calendar", 0),
+       DECLARE_BUTTON(S3C2410_GPG(2),         KEY_F12,       "Contacts", 0),
+       DECLARE_BUTTON(S3C2410_GPG(3),        KEY_MAIL,           "Mail", 0),
+       DECLARE_BUTTON(S3C2410_GPG(6),        KEY_LEFT,     "Left_arrow", 0),
+       DECLARE_BUTTON(S3C2410_GPG(7),    KEY_HOMEPAGE,           "Home", 0),
+       DECLARE_BUTTON(S3C2410_GPG(8),       KEY_RIGHT,    "Right_arrow", 0),
+       DECLARE_BUTTON(S3C2410_GPG(9),          KEY_UP,       "Up_arrow", 0),
+       DECLARE_BUTTON(S3C2410_GPG(10),       KEY_DOWN,     "Down_arrow", 0),
+};
+
+static struct gpio_keys_platform_data h1940_buttons_data = {
+       .buttons        = h1940_buttons,
+       .nbuttons       = ARRAY_SIZE(h1940_buttons),
+};
+
+static struct platform_device h1940_dev_buttons = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &h1940_buttons_data,
+       }
+};
+
+static struct platform_device *h1940_devices[] __initdata = {
+       &h1940_dev_buttons,
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_usbgadget,
+       &h1940_device_leds,
+       &h1940_device_bluetooth,
+       &s3c_device_sdi,
+       &s3c_device_rtc,
+       &samsung_device_pwm,
+       &h1940_backlight,
+       &h1940_lcd_powerdev,
+       &s3c_device_adc,
+       &s3c_device_ts,
+       &power_supply,
+       &h1940_battery,
+       &h1940_audio,
+};
+
+static void __init h1940_map_io(void)
+{
+       s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
+       s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+
+       /* setup PM */
+
+#ifdef CONFIG_PM_H1940
+       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
+#endif
+       s3c_pm_init();
+
+       /* Add latch gpio chip, set latch initial value */
+       h1940_latch_control(0, 0);
+       WARN_ON(gpiochip_add_data(&h1940_latch_gpiochip, NULL));
+}
+
+static void __init h1940_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+/* H1940 and RX3715 need to reserve this for suspend */
+static void __init h1940_reserve(void)
+{
+       memblock_reserve(0x30003000, 0x1000);
+       memblock_reserve(0x30081000, 0x1000);
+}
+
+static void __init h1940_init(void)
+{
+       u32 tmp;
+
+       s3c24xx_fb_set_platdata(&h1940_fb_info);
+       gpiod_add_lookup_table(&h1940_mmc_gpio_table);
+       gpiod_add_lookup_table(&h1940_audio_gpio_table);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       s3c24xx_mci_set_platdata(&h1940_mmc_cfg);
+       s3c24xx_udc_set_platdata(&h1940_udc_cfg);
+       s3c24xx_ts_set_platdata(&h1940_ts_cfg);
+       s3c_i2c0_set_platdata(NULL);
+
+       /* Turn off suspend on both USB ports, and switch the
+        * selectable USB port to USB device mode. */
+
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                             S3C2410_MISCCR_USBSUSPND0 |
+                             S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+       tmp =   (0x78 << S3C24XX_PLL_MDIV_SHIFT)
+             | (0x02 << S3C24XX_PLL_PDIV_SHIFT)
+             | (0x03 << S3C24XX_PLL_SDIV_SHIFT);
+       writel(tmp, S3C2410_UPLLCON);
+
+       gpio_request(S3C2410_GPC(0), "LCD power");
+       gpio_request(S3C2410_GPC(1), "LCD power");
+       gpio_request(S3C2410_GPC(4), "LCD power");
+       gpio_request(S3C2410_GPC(5), "LCD power");
+       gpio_request(S3C2410_GPC(6), "LCD power");
+       gpio_request(H1940_LATCH_LCD_P0, "LCD power");
+       gpio_request(H1940_LATCH_LCD_P1, "LCD power");
+       gpio_request(H1940_LATCH_LCD_P2, "LCD power");
+       gpio_request(H1940_LATCH_LCD_P3, "LCD power");
+       gpio_request(H1940_LATCH_LCD_P4, "LCD power");
+       gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
+       gpio_direction_output(S3C2410_GPC(0), 0);
+       gpio_direction_output(S3C2410_GPC(1), 0);
+       gpio_direction_output(S3C2410_GPC(4), 0);
+       gpio_direction_output(S3C2410_GPC(5), 0);
+       gpio_direction_input(S3C2410_GPC(6));
+       gpio_direction_output(H1940_LATCH_LCD_P0, 0);
+       gpio_direction_output(H1940_LATCH_LCD_P1, 0);
+       gpio_direction_output(H1940_LATCH_LCD_P2, 0);
+       gpio_direction_output(H1940_LATCH_LCD_P3, 0);
+       gpio_direction_output(H1940_LATCH_LCD_P4, 0);
+       gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
+
+       gpio_request(H1940_LATCH_SD_POWER, "SD power");
+       gpio_direction_output(H1940_LATCH_SD_POWER, 0);
+
+       pwm_add_table(h1940_pwm_lookup, ARRAY_SIZE(h1940_pwm_lookup));
+       platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
+
+       gpio_request(S3C2410_GPA(1), "Red LED blink");
+       gpio_request(S3C2410_GPA(3), "Blue LED blink");
+       gpio_request(S3C2410_GPA(7), "Green LED blink");
+       gpio_request(H1940_LATCH_LED_FLASH, "LED blink");
+       gpio_direction_output(S3C2410_GPA(1), 0);
+       gpio_direction_output(S3C2410_GPA(3), 0);
+       gpio_direction_output(S3C2410_GPA(7), 0);
+       gpio_direction_output(H1940_LATCH_LED_FLASH, 0);
+
+       i2c_register_board_info(0, h1940_i2c_devices,
+               ARRAY_SIZE(h1940_i2c_devices));
+}
+
+MACHINE_START(H1940, "IPAQ-H1940")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+       .map_io         = h1940_map_io,
+       .reserve        = h1940_reserve,
+       .init_irq       = s3c2410_init_irq,
+       .init_machine   = h1940_init,
+       .init_time      = h1940_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-hmt.c b/arch/arm/mach-s3c/mach-hmt.c
new file mode 100644 (file)
index 0000000..c58cd1f
--- /dev/null
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// mach-hmt.c - Platform code for Airgoo HMT
+//
+// Copyright 2009 Peter Korsgaard <jacmet@sunsite.dk>
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/i2c.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/leds.h>
+#include <linux/pwm.h>
+#include <linux/pwm_backlight.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <video/samsung_fimd.h>
+#include "map.h"
+#include <mach/irqs.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "gpio-samsung.h"
+#include "fb.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+};
+
+static struct pwm_lookup hmt_pwm_lookup[] = {
+       PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
+                  1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
+};
+
+static int hmt_bl_init(struct device *dev)
+{
+       int ret;
+
+       ret = gpio_request(S3C64XX_GPB(4), "lcd backlight enable");
+       if (!ret)
+               ret = gpio_direction_output(S3C64XX_GPB(4), 0);
+
+       return ret;
+}
+
+static int hmt_bl_notify(struct device *dev, int brightness)
+{
+       /*
+        * translate from CIELUV/CIELAB L*->brightness, E.G. from
+        * perceived luminance to light output. Assumes range 0..25600
+        */
+       if (brightness < 0x800) {
+               /* Y = Yn * L / 903.3 */
+               brightness = (100*256 * brightness + 231245/2) / 231245;
+       } else {
+               /* Y = Yn * ((L + 16) / 116 )^3 */
+               int t = (brightness*4 + 16*1024 + 58)/116;
+               brightness = 25 * ((t * t * t + 0x100000/2) / 0x100000);
+       }
+
+       gpio_set_value(S3C64XX_GPB(4), brightness);
+
+       return brightness;
+}
+
+static void hmt_bl_exit(struct device *dev)
+{
+       gpio_free(S3C64XX_GPB(4));
+}
+
+static struct platform_pwm_backlight_data hmt_backlight_data = {
+       .max_brightness = 100 * 256,
+       .dft_brightness = 40 * 256,
+       .init           = hmt_bl_init,
+       .notify         = hmt_bl_notify,
+       .exit           = hmt_bl_exit,
+
+};
+
+static struct platform_device hmt_backlight_device = {
+       .name           = "pwm-backlight",
+       .dev            = {
+               .parent = &samsung_device_pwm.dev,
+               .platform_data = &hmt_backlight_data,
+       },
+};
+
+static struct s3c_fb_pd_win hmt_fb_win0 = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct fb_videomode hmt_lcd_timing = {
+       .left_margin    = 8,
+       .right_margin   = 13,
+       .upper_margin   = 7,
+       .lower_margin   = 5,
+       .hsync_len      = 3,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
+static struct s3c_fb_platdata hmt_lcd_pdata __initdata = {
+       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+       .vtiming        = &hmt_lcd_timing,
+       .win[0]         = &hmt_fb_win0,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+};
+
+static struct mtd_partition hmt_nand_part[] = {
+       [0] = {
+               .name   = "uboot",
+               .size   = SZ_512K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "uboot-env1",
+               .size   = SZ_256K,
+               .offset = SZ_512K,
+       },
+       [2] = {
+               .name   = "uboot-env2",
+               .size   = SZ_256K,
+               .offset = SZ_512K + SZ_256K,
+       },
+       [3] = {
+               .name   = "kernel",
+               .size   = SZ_2M,
+               .offset = SZ_1M,
+       },
+       [4] = {
+               .name   = "rootfs",
+               .size   = MTDPART_SIZ_FULL,
+               .offset = SZ_1M + SZ_2M,
+       },
+};
+
+static struct s3c2410_nand_set hmt_nand_sets[] = {
+       [0] = {
+               .name           = "nand",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(hmt_nand_part),
+               .partitions     = hmt_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand hmt_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 55,
+       .twrph1         = 40,
+       .nr_sets        = ARRAY_SIZE(hmt_nand_sets),
+       .sets           = hmt_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+static struct gpio_led hmt_leds[] = {
+       { /* left function keys */
+               .name                   = "left:blue",
+               .gpio                   = S3C64XX_GPO(12),
+               .default_trigger        = "default-on",
+       },
+       { /* right function keys - red */
+               .name                   = "right:red",
+               .gpio                   = S3C64XX_GPO(13),
+       },
+       { /* right function keys - green */
+               .name                   = "right:green",
+               .gpio                   = S3C64XX_GPO(14),
+       },
+       { /* right function keys - blue */
+               .name                   = "right:blue",
+               .gpio                   = S3C64XX_GPO(15),
+               .default_trigger        = "default-on",
+       },
+};
+
+static struct gpio_led_platform_data hmt_led_data = {
+       .num_leds = ARRAY_SIZE(hmt_leds),
+       .leds = hmt_leds,
+};
+
+static struct platform_device hmt_leds_device = {
+       .name                   = "leds-gpio",
+       .id                     = -1,
+       .dev.platform_data      = &hmt_led_data,
+};
+
+static struct map_desc hmt_iodesc[] = {};
+
+static struct platform_device *hmt_devices[] __initdata = {
+       &s3c_device_i2c0,
+       &s3c_device_nand,
+       &s3c_device_fb,
+       &s3c_device_ohci,
+       &samsung_device_pwm,
+       &hmt_backlight_device,
+       &hmt_leds_device,
+};
+
+static void __init hmt_map_io(void)
+{
+       s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+}
+
+static void __init hmt_machine_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       s3c_fb_set_platdata(&hmt_lcd_pdata);
+       s3c_nand_set_platdata(&hmt_nand_info);
+
+       gpio_request(S3C64XX_GPC(7), "usb power");
+       gpio_direction_output(S3C64XX_GPC(7), 0);
+       gpio_request(S3C64XX_GPM(0), "usb power");
+       gpio_direction_output(S3C64XX_GPM(0), 1);
+       gpio_request(S3C64XX_GPK(7), "usb power");
+       gpio_direction_output(S3C64XX_GPK(7), 1);
+       gpio_request(S3C64XX_GPF(13), "usb power");
+       gpio_direction_output(S3C64XX_GPF(13), 1);
+
+       pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
+       platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
+}
+
+MACHINE_START(HMT, "Airgoo-HMT")
+       /* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = hmt_map_io,
+       .init_machine   = hmt_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-jive.c b/arch/arm/mach-s3c/mach-jive.c
new file mode 100644 (file)
index 0000000..94b16b2
--- /dev/null
@@ -0,0 +1,684 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2007 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://armlinux.simtec.co.uk/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/syscore_ops.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+
+#include <video/ili9320.h>
+
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_gpio.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+#include <linux/platform_data/fb-s3c2410.h>
+#include "gpio-samsung.h"
+
+#include <asm/mach-types.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
+#include <linux/platform_data/usb-s3c2410_udc.h>
+
+#include "s3c24xx.h"
+#include "s3c2412-power.h"
+
+static struct map_desc jive_iodesc[] __initdata = {
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg jive_uartcfgs[] = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+/* Jive flash assignment
+ *
+ * 0x00000000-0x00028000 : uboot
+ * 0x00028000-0x0002c000 : uboot env
+ * 0x0002c000-0x00030000 : spare
+ * 0x00030000-0x00200000 : zimage A
+ * 0x00200000-0x01600000 : cramfs A
+ * 0x01600000-0x017d0000 : zimage B
+ * 0x017d0000-0x02bd0000 : cramfs B
+ * 0x02bd0000-0x03fd0000 : yaffs
+ */
+static struct mtd_partition __initdata jive_imageA_nand_part[] = {
+
+#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
+       /* Don't allow access to the bootloader from linux */
+       {
+               .name           = "uboot",
+               .offset         = 0,
+               .size           = (160 * SZ_1K),
+               .mask_flags     = MTD_WRITEABLE, /* force read-only */
+       },
+
+       /* spare */
+        {
+                .name           = "spare",
+                .offset         = (176 * SZ_1K),
+                .size           = (16 * SZ_1K),
+        },
+#endif
+
+       /* booted images */
+        {
+               .name           = "kernel (ro)",
+               .offset         = (192 * SZ_1K),
+               .size           = (SZ_2M) - (192 * SZ_1K),
+               .mask_flags     = MTD_WRITEABLE, /* force read-only */
+        }, {
+                .name           = "root (ro)",
+                .offset         = (SZ_2M),
+                .size           = (20 * SZ_1M),
+               .mask_flags     = MTD_WRITEABLE, /* force read-only */
+        },
+
+       /* yaffs */
+       {
+               .name           = "yaffs",
+               .offset         = (44 * SZ_1M),
+               .size           = (20 * SZ_1M),
+       },
+
+       /* bootloader environment */
+       {
+                .name          = "env",
+               .offset         = (160 * SZ_1K),
+               .size           = (16 * SZ_1K),
+       },
+
+       /* upgrade images */
+        {
+               .name           = "zimage",
+               .offset         = (22 * SZ_1M),
+               .size           = (2 * SZ_1M) - (192 * SZ_1K),
+        }, {
+               .name           = "cramfs",
+               .offset         = (24 * SZ_1M) - (192*SZ_1K),
+               .size           = (20 * SZ_1M),
+        },
+};
+
+static struct mtd_partition __initdata jive_imageB_nand_part[] = {
+
+#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
+       /* Don't allow access to the bootloader from linux */
+       {
+               .name           = "uboot",
+               .offset         = 0,
+               .size           = (160 * SZ_1K),
+               .mask_flags     = MTD_WRITEABLE, /* force read-only */
+       },
+
+       /* spare */
+        {
+                .name           = "spare",
+                .offset         = (176 * SZ_1K),
+                .size           = (16 * SZ_1K),
+        },
+#endif
+
+       /* booted images */
+        {
+               .name           = "kernel (ro)",
+               .offset         = (22 * SZ_1M),
+               .size           = (2 * SZ_1M) - (192 * SZ_1K),
+               .mask_flags     = MTD_WRITEABLE, /* force read-only */
+        },
+       {
+               .name           = "root (ro)",
+               .offset         = (24 * SZ_1M) - (192 * SZ_1K),
+                .size          = (20 * SZ_1M),
+               .mask_flags     = MTD_WRITEABLE, /* force read-only */
+       },
+
+       /* yaffs */
+       {
+               .name           = "yaffs",
+               .offset         = (44 * SZ_1M),
+               .size           = (20 * SZ_1M),
+        },
+
+       /* bootloader environment */
+       {
+               .name           = "env",
+               .offset         = (160 * SZ_1K),
+               .size           = (16 * SZ_1K),
+       },
+
+       /* upgrade images */
+       {
+               .name           = "zimage",
+               .offset         = (192 * SZ_1K),
+               .size           = (2 * SZ_1M) - (192 * SZ_1K),
+        }, {
+               .name           = "cramfs",
+               .offset         = (2 * SZ_1M),
+               .size           = (20 * SZ_1M),
+        },
+};
+
+static struct s3c2410_nand_set __initdata jive_nand_sets[] = {
+       [0] = {
+               .name           = "flash",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(jive_imageA_nand_part),
+               .partitions     = jive_imageA_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand __initdata jive_nand_info = {
+       /* set taken from osiris nand timings, possibly still conservative */
+       .tacls          = 30,
+       .twrph0         = 55,
+       .twrph1         = 40,
+       .sets           = jive_nand_sets,
+       .nr_sets        = ARRAY_SIZE(jive_nand_sets),
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+static int __init jive_mtdset(char *options)
+{
+       struct s3c2410_nand_set *nand = &jive_nand_sets[0];
+       unsigned long set;
+
+       if (options == NULL || options[0] == '\0')
+               return 0;
+
+       if (kstrtoul(options, 10, &set)) {
+               printk(KERN_ERR "failed to parse mtdset=%s\n", options);
+               return 0;
+       }
+
+       switch (set) {
+       case 1:
+               nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part);
+               nand->partitions = jive_imageB_nand_part;
+       case 0:
+               /* this is already setup in the nand info */
+               break;
+       default:
+               printk(KERN_ERR "Unknown mtd set %ld specified,"
+                      "using default.", set);
+       }
+
+       return 0;
+}
+
+/* parse the mtdset= option given to the kernel command line */
+__setup("mtdset=", jive_mtdset);
+
+/* LCD timing and setup */
+
+#define LCD_XRES        (240)
+#define LCD_YRES        (320)
+#define LCD_LEFT_MARGIN  (12)
+#define LCD_RIGHT_MARGIN (12)
+#define LCD_LOWER_MARGIN (12)
+#define LCD_UPPER_MARGIN (12)
+#define LCD_VSYNC       (2)
+#define LCD_HSYNC       (2)
+
+#define LCD_REFRESH     (60)
+
+#define LCD_HTOT (LCD_HSYNC + LCD_LEFT_MARGIN + LCD_XRES + LCD_RIGHT_MARGIN)
+#define LCD_VTOT (LCD_VSYNC + LCD_LOWER_MARGIN + LCD_YRES + LCD_UPPER_MARGIN)
+
+static struct s3c2410fb_display jive_vgg2432a4_display[] = {
+       [0] = {
+               .width          = LCD_XRES,
+               .height         = LCD_YRES,
+               .xres           = LCD_XRES,
+               .yres           = LCD_YRES,
+               .left_margin    = LCD_LEFT_MARGIN,
+               .right_margin   = LCD_RIGHT_MARGIN,
+               .upper_margin   = LCD_UPPER_MARGIN,
+               .lower_margin   = LCD_LOWER_MARGIN,
+               .hsync_len      = LCD_HSYNC,
+               .vsync_len      = LCD_VSYNC,
+
+               .pixclock       = (1000000000000LL /
+                                  (LCD_REFRESH * LCD_HTOT * LCD_VTOT)),
+
+               .bpp            = 16,
+               .type           = (S3C2410_LCDCON1_TFT16BPP |
+                                  S3C2410_LCDCON1_TFT),
+
+               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
+                                  S3C2410_LCDCON5_INVVLINE |
+                                  S3C2410_LCDCON5_INVVFRAME |
+                                  S3C2410_LCDCON5_INVVDEN |
+                                  S3C2410_LCDCON5_PWREN),
+       },
+};
+
+/* todo - put into gpio header */
+
+#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
+#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
+
+static struct s3c2410fb_mach_info jive_lcd_config = {
+       .displays        = jive_vgg2432a4_display,
+       .num_displays    = ARRAY_SIZE(jive_vgg2432a4_display),
+       .default_display = 0,
+
+       /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
+        * and disable the pull down resistors on pins we are using for LCD
+        * data. */
+
+       .gpcup          = (0xf << 1) | (0x3f << 10),
+       .gpcup_reg      = S3C2410_GPCUP,
+
+       .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
+                          S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
+                          S3C2410_GPC10_VD2   | S3C2410_GPC11_VD3 |
+                          S3C2410_GPC12_VD4   | S3C2410_GPC13_VD5 |
+                          S3C2410_GPC14_VD6   | S3C2410_GPC15_VD7),
+
+       .gpccon_mask    = (S3C2410_GPCCON_MASK(1)  | S3C2410_GPCCON_MASK(2)  |
+                          S3C2410_GPCCON_MASK(3)  | S3C2410_GPCCON_MASK(4)  |
+                          S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
+                          S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
+                          S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
+
+       .gpccon_reg     = S3C2410_GPCCON,
+
+       .gpdup          = (0x3f << 2) | (0x3f << 10),
+
+       .gpdup_reg      = S3C2410_GPDUP,
+
+       .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
+                          S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
+                          S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
+                          S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
+                          S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
+                          S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
+
+       .gpdcon_mask    = (S3C2410_GPDCON_MASK(2)  | S3C2410_GPDCON_MASK(3) |
+                          S3C2410_GPDCON_MASK(4)  | S3C2410_GPDCON_MASK(5) |
+                          S3C2410_GPDCON_MASK(6)  | S3C2410_GPDCON_MASK(7) |
+                          S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
+                          S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
+                          S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
+
+       .gpdcon_reg     = S3C2410_GPDCON,
+};
+
+/* ILI9320 support. */
+
+static void jive_lcm_reset(unsigned int set)
+{
+       printk(KERN_DEBUG "%s(%d)\n", __func__, set);
+
+       gpio_set_value(S3C2410_GPG(13), set);
+}
+
+#undef LCD_UPPER_MARGIN
+#define LCD_UPPER_MARGIN 2
+
+static struct ili9320_platdata jive_lcm_config = {
+       .hsize          = LCD_XRES,
+       .vsize          = LCD_YRES,
+
+       .reset          = jive_lcm_reset,
+       .suspend        = ILI9320_SUSPEND_DEEP,
+
+       .entry_mode     = ILI9320_ENTRYMODE_ID(3) | ILI9320_ENTRYMODE_BGR,
+       .display2       = (ILI9320_DISPLAY2_FP(LCD_UPPER_MARGIN) |
+                          ILI9320_DISPLAY2_BP(LCD_LOWER_MARGIN)),
+       .display3       = 0x0,
+       .display4       = 0x0,
+       .rgb_if1        = (ILI9320_RGBIF1_RIM_RGB18 |
+                          ILI9320_RGBIF1_RM | ILI9320_RGBIF1_CLK_RGBIF),
+       .rgb_if2        = ILI9320_RGBIF2_DPL,
+       .interface2     = 0x0,
+       .interface3     = 0x3,
+       .interface4     = (ILI9320_INTERFACE4_RTNE(16) |
+                          ILI9320_INTERFACE4_DIVE(1)),
+       .interface5     = 0x0,
+       .interface6     = 0x0,
+};
+
+/* LCD SPI support */
+
+static struct spi_gpio_platform_data jive_lcd_spi = {
+       .num_chipselect = 1,
+};
+
+static struct platform_device jive_device_lcdspi = {
+       .name           = "spi_gpio",
+       .id             = 1,
+       .dev.platform_data = &jive_lcd_spi,
+};
+
+static struct gpiod_lookup_table jive_lcdspi_gpiod_table = {
+       .dev_id         = "spi_gpio",
+       .table          = {
+               GPIO_LOOKUP("GPIOG", 8,
+                           "sck", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOB", 8,
+                           "mosi", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOB", 7,
+                           "cs", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+/* WM8750 audio code SPI definition */
+
+static struct spi_gpio_platform_data jive_wm8750_spi = {
+       .num_chipselect = 1,
+};
+
+static struct platform_device jive_device_wm8750 = {
+       .name           = "spi_gpio",
+       .id             = 2,
+       .dev.platform_data = &jive_wm8750_spi,
+};
+
+static struct gpiod_lookup_table jive_wm8750_gpiod_table = {
+       .dev_id         = "spi_gpio",
+       .table          = {
+               GPIO_LOOKUP("GPIOB", 4,
+                           "sck", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOB", 9,
+                           "mosi", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOH", 10,
+                           "cs", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+/* JIVE SPI devices. */
+
+static struct spi_board_info __initdata jive_spi_devs[] = {
+       [0] = {
+               .modalias       = "VGG2432A4",
+               .bus_num        = 1,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_3,   /* CPOL=1, CPHA=1 */
+               .max_speed_hz   = 100000,
+               .platform_data  = &jive_lcm_config,
+       }, {
+               .modalias       = "WM8750",
+               .bus_num        = 2,
+               .chip_select    = 0,
+               .mode           = SPI_MODE_0,   /* CPOL=0, CPHA=0 */
+               .max_speed_hz   = 100000,
+       },
+};
+
+/* I2C bus and device configuration. */
+
+static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
+       .frequency      = 80 * 1000,
+       .flags          = S3C_IICFLG_FILTER,
+       .sda_delay      = 2,
+};
+
+static struct i2c_board_info jive_i2c_devs[] __initdata = {
+       [0] = {
+               I2C_BOARD_INFO("lis302dl", 0x1c),
+               .irq    = IRQ_EINT14,
+       },
+};
+
+/* The platform devices being used. */
+
+static struct platform_device *jive_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_rtc,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_lcd,
+       &jive_device_lcdspi,
+       &jive_device_wm8750,
+       &s3c_device_nand,
+       &s3c_device_usbgadget,
+       &s3c2412_device_dma,
+};
+
+static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
+       .vbus_pin       = S3C2410_GPG(1),               /* detect is on GPG1 */
+};
+
+/* Jive power management device */
+
+#ifdef CONFIG_PM
+static int jive_pm_suspend(void)
+{
+       /* Write the magic value u-boot uses to check for resume into
+        * the INFORM0 register, and ensure INFORM1 is set to the
+        * correct address to resume from. */
+
+       __raw_writel(0x2BED, S3C2412_INFORM0);
+       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
+
+       return 0;
+}
+
+static void jive_pm_resume(void)
+{
+       __raw_writel(0x0, S3C2412_INFORM0);
+}
+
+#else
+#define jive_pm_suspend NULL
+#define jive_pm_resume NULL
+#endif
+
+static struct syscore_ops jive_pm_syscore_ops = {
+       .suspend        = jive_pm_suspend,
+       .resume         = jive_pm_resume,
+};
+
+static void __init jive_map_io(void)
+{
+       s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
+       s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init jive_init_time(void)
+{
+       s3c2412_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void jive_power_off(void)
+{
+       printk(KERN_INFO "powering system down...\n");
+
+       gpio_request_one(S3C2410_GPC(5), GPIOF_OUT_INIT_HIGH, NULL);
+       gpio_free(S3C2410_GPC(5));
+}
+
+static void __init jive_machine_init(void)
+{
+       /* register system core operations for managing low level suspend */
+
+       register_syscore_ops(&jive_pm_syscore_ops);
+
+       /* write our sleep configurations for the IO. Pull down all unused
+        * IO, ensure that we have turned off all peripherals we do not
+        * need, and configure the ones we do need. */
+
+       /* Port B sleep */
+
+       __raw_writel(S3C2412_SLPCON_IN(0)   |
+                    S3C2412_SLPCON_PULL(1) |
+                    S3C2412_SLPCON_HIGH(2) |
+                    S3C2412_SLPCON_PULL(3) |
+                    S3C2412_SLPCON_PULL(4) |
+                    S3C2412_SLPCON_PULL(5) |
+                    S3C2412_SLPCON_PULL(6) |
+                    S3C2412_SLPCON_HIGH(7) |
+                    S3C2412_SLPCON_PULL(8) |
+                    S3C2412_SLPCON_PULL(9) |
+                    S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON);
+
+       /* Port C sleep */
+
+       __raw_writel(S3C2412_SLPCON_PULL(0) |
+                    S3C2412_SLPCON_PULL(1) |
+                    S3C2412_SLPCON_PULL(2) |
+                    S3C2412_SLPCON_PULL(3) |
+                    S3C2412_SLPCON_PULL(4) |
+                    S3C2412_SLPCON_PULL(5) |
+                    S3C2412_SLPCON_LOW(6)  |
+                    S3C2412_SLPCON_PULL(6) |
+                    S3C2412_SLPCON_PULL(7) |
+                    S3C2412_SLPCON_PULL(8) |
+                    S3C2412_SLPCON_PULL(9) |
+                    S3C2412_SLPCON_PULL(10) |
+                    S3C2412_SLPCON_PULL(11) |
+                    S3C2412_SLPCON_PULL(12) |
+                    S3C2412_SLPCON_PULL(13) |
+                    S3C2412_SLPCON_PULL(14) |
+                    S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON);
+
+       /* Port D sleep */
+
+       __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON);
+
+       /* Port F sleep */
+
+       __raw_writel(S3C2412_SLPCON_LOW(0)  |
+                    S3C2412_SLPCON_LOW(1)  |
+                    S3C2412_SLPCON_LOW(2)  |
+                    S3C2412_SLPCON_EINT(3) |
+                    S3C2412_SLPCON_EINT(4) |
+                    S3C2412_SLPCON_EINT(5) |
+                    S3C2412_SLPCON_EINT(6) |
+                    S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON);
+
+       /* Port G sleep */
+
+       __raw_writel(S3C2412_SLPCON_IN(0)    |
+                    S3C2412_SLPCON_IN(1)    |
+                    S3C2412_SLPCON_IN(2)    |
+                    S3C2412_SLPCON_IN(3)    |
+                    S3C2412_SLPCON_IN(4)    |
+                    S3C2412_SLPCON_IN(5)    |
+                    S3C2412_SLPCON_IN(6)    |
+                    S3C2412_SLPCON_IN(7)    |
+                    S3C2412_SLPCON_PULL(8)  |
+                    S3C2412_SLPCON_PULL(9)  |
+                    S3C2412_SLPCON_IN(10)   |
+                    S3C2412_SLPCON_PULL(11) |
+                    S3C2412_SLPCON_PULL(12) |
+                    S3C2412_SLPCON_PULL(13) |
+                    S3C2412_SLPCON_IN(14)   |
+                    S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON);
+
+       /* Port H sleep */
+
+       __raw_writel(S3C2412_SLPCON_PULL(0) |
+                    S3C2412_SLPCON_PULL(1) |
+                    S3C2412_SLPCON_PULL(2) |
+                    S3C2412_SLPCON_PULL(3) |
+                    S3C2412_SLPCON_PULL(4) |
+                    S3C2412_SLPCON_PULL(5) |
+                    S3C2412_SLPCON_PULL(6) |
+                    S3C2412_SLPCON_IN(7)   |
+                    S3C2412_SLPCON_IN(8)   |
+                    S3C2412_SLPCON_PULL(9) |
+                    S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON);
+
+       /* initialise the power management now we've setup everything. */
+
+       s3c_pm_init();
+
+       /** TODO - check that this is after the cmdline option! */
+       s3c_nand_set_platdata(&jive_nand_info);
+
+       gpio_request(S3C2410_GPG(13), "lcm reset");
+       gpio_direction_output(S3C2410_GPG(13), 0);
+
+       gpio_request_one(S3C2410_GPB(6), GPIOF_OUT_INIT_LOW, NULL);
+       gpio_free(S3C2410_GPB(6));
+
+       /* Turn off suspend on both USB ports, and switch the
+        * selectable USB port to USB device mode. */
+
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                             S3C2410_MISCCR_USBSUSPND0 |
+                             S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+       s3c24xx_udc_set_platdata(&jive_udc_cfg);
+       s3c24xx_fb_set_platdata(&jive_lcd_config);
+
+       spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
+
+       s3c_i2c0_set_platdata(&jive_i2c_cfg);
+       i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
+
+       pm_power_off = jive_power_off;
+
+       gpiod_add_lookup_table(&jive_lcdspi_gpiod_table);
+       gpiod_add_lookup_table(&jive_wm8750_gpiod_table);
+       platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
+}
+
+MACHINE_START(JIVE, "JIVE")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+
+       .init_irq       = s3c2412_init_irq,
+       .map_io         = jive_map_io,
+       .init_machine   = jive_machine_init,
+       .init_time      = jive_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-mini2440.c b/arch/arm/mach-s3c/mach-mini2440.c
new file mode 100644 (file)
index 0000000..0f4f2a9
--- /dev/null
@@ -0,0 +1,792 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
+//      Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
+//      and modifications by SBZ <sbz@spgui.org> and
+//      Weibing <http://weibing.blogbus.com> and
+//      Michel Pollet <buserror@gmail.com>
+//
+// For product information, visit https://code.google.com/p/mini2440/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/dm9000.h>
+#include <linux/property.h>
+#include <linux/platform_device.h>
+#include <linux/gpio_keys.h>
+#include <linux/i2c.h>
+#include <linux/mmc/host.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include <linux/platform_data/leds-s3c24xx.h>
+#include <mach/irqs.h>
+#include "gpio-samsung.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/mmc-s3cmci.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+
+#include <sound/s3c24xx_uda134x.h>
+
+#include "s3c24xx.h"
+
+#define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
+
+static struct map_desc mini2440_iodesc[] __initdata = {
+       /* nothing to declare, move along */
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+
+static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport         = 0,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [1] = {
+               .hwport         = 1,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+       [2] = {
+               .hwport         = 2,
+               .flags          = 0,
+               .ucon           = UCON,
+               .ulcon          = ULCON,
+               .ufcon          = UFCON,
+       },
+};
+
+/* USB device UDC support */
+
+static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
+       .pullup_pin = S3C2410_GPC(5),
+};
+
+
+/* LCD timing and setup */
+
+/*
+ * This macro simplifies the table bellow
+ */
+#define _LCD_DECLARE(_clock, _xres, margin_left, margin_right, hsync, \
+                       _yres, margin_top, margin_bottom, vsync, refresh) \
+       .width = _xres, \
+       .xres = _xres, \
+       .height = _yres, \
+       .yres = _yres, \
+       .left_margin    = margin_left,  \
+       .right_margin   = margin_right, \
+       .upper_margin   = margin_top,   \
+       .lower_margin   = margin_bottom,        \
+       .hsync_len      = hsync,        \
+       .vsync_len      = vsync,        \
+       .pixclock       = ((_clock*100000000000LL) /    \
+                          ((refresh) * \
+                          (hsync + margin_left + _xres + margin_right) * \
+                          (vsync + margin_top + _yres + margin_bottom))), \
+       .bpp            = 16,\
+       .type           = (S3C2410_LCDCON1_TFT16BPP |\
+                          S3C2410_LCDCON1_TFT)
+
+static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
+       [0] = { /* mini2440 + 3.5" TFT + touchscreen */
+               _LCD_DECLARE(
+                       7,                      /* The 3.5 is quite fast */
+                       240, 21, 38, 6,         /* x timing */
+                       320, 4, 4, 2,           /* y timing */
+                       60),                    /* refresh rate */
+               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
+                                  S3C2410_LCDCON5_INVVLINE |
+                                  S3C2410_LCDCON5_INVVFRAME |
+                                  S3C2410_LCDCON5_INVVDEN |
+                                  S3C2410_LCDCON5_PWREN),
+       },
+       [1] = { /* mini2440 + 7" TFT + touchscreen */
+               _LCD_DECLARE(
+                       10,                     /* the 7" runs slower */
+                       800, 40, 40, 48,        /* x timing */
+                       480, 29, 3, 3,          /* y timing */
+                       50),                    /* refresh rate */
+               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
+                                  S3C2410_LCDCON5_INVVLINE |
+                                  S3C2410_LCDCON5_INVVFRAME |
+                                  S3C2410_LCDCON5_PWREN),
+       },
+       /* The VGA shield can outout at several resolutions. All share
+        * the same timings, however, anything smaller than 1024x768
+        * will only be displayed in the top left corner of a 1024x768
+        * XGA output unless you add optional dip switches to the shield.
+        * Therefore timings for other resolutions have been omitted here.
+        */
+       [2] = {
+               _LCD_DECLARE(
+                       10,
+                       1024, 1, 2, 2,          /* y timing */
+                       768, 200, 16, 16,       /* x timing */
+                       24),    /* refresh rate, maximum stable,
+                                * tested with the FPGA shield
+                                */
+               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
+                                  S3C2410_LCDCON5_HWSWP),
+       },
+       /* mini2440 + 3.5" TFT (LCD-W35i, LQ035Q1DG06 type) + touchscreen*/
+       [3] = {
+               _LCD_DECLARE(
+                       /* clock */
+                       7,
+                       /* xres, margin_right, margin_left, hsync */
+                       320, 68, 66, 4,
+                       /* yres, margin_top, margin_bottom, vsync */
+                       240, 4, 4, 9,
+                       /* refresh rate */
+                       60),
+               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
+                                  S3C2410_LCDCON5_INVVDEN |
+                                  S3C2410_LCDCON5_INVVFRAME |
+                                  S3C2410_LCDCON5_INVVLINE |
+                                  S3C2410_LCDCON5_INVVCLK |
+                                  S3C2410_LCDCON5_HWSWP),
+       },
+};
+
+/* todo - put into gpio header */
+
+#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
+#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
+
+static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
+       .displays        = &mini2440_lcd_cfg[0], /* not constant! see init */
+       .num_displays    = 1,
+       .default_display = 0,
+
+       /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
+        * and disable the pull down resistors on pins we are using for LCD
+        * data.
+        */
+
+       .gpcup          = (0xf << 1) | (0x3f << 10),
+
+       .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
+                          S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
+                          S3C2410_GPC10_VD2   | S3C2410_GPC11_VD3 |
+                          S3C2410_GPC12_VD4   | S3C2410_GPC13_VD5 |
+                          S3C2410_GPC14_VD6   | S3C2410_GPC15_VD7),
+
+       .gpccon_mask    = (S3C2410_GPCCON_MASK(1)  | S3C2410_GPCCON_MASK(2)  |
+                          S3C2410_GPCCON_MASK(3)  | S3C2410_GPCCON_MASK(4)  |
+                          S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
+                          S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
+                          S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
+
+       .gpccon_reg     = S3C2410_GPCCON,
+       .gpcup_reg      = S3C2410_GPCUP,
+
+       .gpdup          = (0x3f << 2) | (0x3f << 10),
+
+       .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
+                          S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
+                          S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
+                          S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
+                          S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
+                          S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
+
+       .gpdcon_mask    = (S3C2410_GPDCON_MASK(2)  | S3C2410_GPDCON_MASK(3) |
+                          S3C2410_GPDCON_MASK(4)  | S3C2410_GPDCON_MASK(5) |
+                          S3C2410_GPDCON_MASK(6)  | S3C2410_GPDCON_MASK(7) |
+                          S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
+                          S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
+                          S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
+
+       .gpdcon_reg     = S3C2410_GPDCON,
+       .gpdup_reg      = S3C2410_GPDUP,
+};
+
+/* MMC/SD  */
+
+static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
+       .wprotect_invert        = 1,
+       .set_power              = s3c24xx_mci_def_set_power,
+       .ocr_avail              = MMC_VDD_32_33|MMC_VDD_33_34,
+};
+
+static struct gpiod_lookup_table mini2440_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* Card detect S3C2410_GPG(8) */
+               GPIO_LOOKUP("GPIOG", 8, "cd", GPIO_ACTIVE_LOW),
+               /* Write protect S3C2410_GPH(8) */
+               GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_HIGH),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+/* NAND Flash on MINI2440 board */
+
+static struct mtd_partition mini2440_default_nand_part[] __initdata = {
+       [0] = {
+               .name   = "u-boot",
+               .size   = SZ_256K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "u-boot-env",
+               .size   = SZ_128K,
+               .offset = SZ_256K,
+       },
+       [2] = {
+               .name   = "kernel",
+               /* 5 megabytes, for a kernel with no modules
+                * or a uImage with a ramdisk attached
+                */
+               .size   = 0x00500000,
+               .offset = SZ_256K + SZ_128K,
+       },
+       [3] = {
+               .name   = "root",
+               .offset = SZ_256K + SZ_128K + 0x00500000,
+               .size   = MTDPART_SIZ_FULL,
+       },
+};
+
+static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
+       [0] = {
+               .name           = "nand",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(mini2440_default_nand_part),
+               .partitions     = mini2440_default_nand_part,
+               .flash_bbt      = 1, /* we use u-boot to create a BBT */
+       },
+};
+
+static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
+       .tacls          = 0,
+       .twrph0         = 25,
+       .twrph1         = 15,
+       .nr_sets        = ARRAY_SIZE(mini2440_nand_sets),
+       .sets           = mini2440_nand_sets,
+       .ignore_unset_ecc = 1,
+       .ecc_mode       = NAND_ECC_HW,
+};
+
+/* DM9000AEP 10/100 ethernet controller */
+
+static struct resource mini2440_dm9k_resource[] = {
+       [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
+       [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
+       [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ
+                                               | IORESOURCE_IRQ_HIGHEDGE),
+};
+
+/*
+ * The DM9000 has no eeprom, and it's MAC address is set by
+ * the bootloader before starting the kernel.
+ */
+static struct dm9000_plat_data mini2440_dm9k_pdata = {
+       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
+};
+
+static struct platform_device mini2440_device_eth = {
+       .name           = "dm9000",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(mini2440_dm9k_resource),
+       .resource       = mini2440_dm9k_resource,
+       .dev            = {
+               .platform_data  = &mini2440_dm9k_pdata,
+       },
+};
+
+/*  CON5
+ *     +--+     /-----\
+ *     |  |    |       |
+ *     |  |    |  BAT  |
+ *     |  |     \_____/
+ *     |  |
+ *     |  |  +----+  +----+
+ *     |  |  | K5 |  | K1 |
+ *     |  |  +----+  +----+
+ *     |  |  +----+  +----+
+ *     |  |  | K4 |  | K2 |
+ *     |  |  +----+  +----+
+ *     |  |  +----+  +----+
+ *     |  |  | K6 |  | K3 |
+ *     |  |  +----+  +----+
+ *       .....
+ */
+static struct gpio_keys_button mini2440_buttons[] = {
+       {
+               .gpio           = S3C2410_GPG(0),               /* K1 */
+               .code           = KEY_F1,
+               .desc           = "Button 1",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = S3C2410_GPG(3),               /* K2 */
+               .code           = KEY_F2,
+               .desc           = "Button 2",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = S3C2410_GPG(5),               /* K3 */
+               .code           = KEY_F3,
+               .desc           = "Button 3",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = S3C2410_GPG(6),               /* K4 */
+               .code           = KEY_POWER,
+               .desc           = "Power",
+               .active_low     = 1,
+       },
+       {
+               .gpio           = S3C2410_GPG(7),               /* K5 */
+               .code           = KEY_F5,
+               .desc           = "Button 5",
+               .active_low     = 1,
+       },
+#if 0
+       /* this pin is also known as TCLK1 and seems to already
+        * marked as "in use" somehow in the kernel -- possibly wrongly
+        */
+       {
+               .gpio           = S3C2410_GPG(11),      /* K6 */
+               .code           = KEY_F6,
+               .desc           = "Button 6",
+               .active_low     = 1,
+       },
+#endif
+};
+
+static struct gpio_keys_platform_data mini2440_button_data = {
+       .buttons        = mini2440_buttons,
+       .nbuttons       = ARRAY_SIZE(mini2440_buttons),
+};
+
+static struct platform_device mini2440_button_device = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &mini2440_button_data,
+       }
+};
+
+/* LEDS */
+
+static struct gpiod_lookup_table mini2440_led1_gpio_table = {
+       .dev_id = "s3c24xx_led.1",
+       .table = {
+               GPIO_LOOKUP("GPB", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table mini2440_led2_gpio_table = {
+       .dev_id = "s3c24xx_led.2",
+       .table = {
+               GPIO_LOOKUP("GPB", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table mini2440_led3_gpio_table = {
+       .dev_id = "s3c24xx_led.3",
+       .table = {
+               GPIO_LOOKUP("GPB", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table mini2440_led4_gpio_table = {
+       .dev_id = "s3c24xx_led.4",
+       .table = {
+               GPIO_LOOKUP("GPB", 8, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table mini2440_backlight_gpio_table = {
+       .dev_id = "s3c24xx_led.5",
+       .table = {
+               GPIO_LOOKUP("GPG", 4, NULL, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata mini2440_led1_pdata = {
+       .name           = "led1",
+       .def_trigger    = "heartbeat",
+};
+
+static struct s3c24xx_led_platdata mini2440_led2_pdata = {
+       .name           = "led2",
+       .def_trigger    = "nand-disk",
+};
+
+static struct s3c24xx_led_platdata mini2440_led3_pdata = {
+       .name           = "led3",
+       .def_trigger    = "mmc0",
+};
+
+static struct s3c24xx_led_platdata mini2440_led4_pdata = {
+       .name           = "led4",
+       .def_trigger    = "",
+};
+
+static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
+       .name           = "backlight",
+       .def_trigger    = "backlight",
+};
+
+static struct platform_device mini2440_led1 = {
+       .name           = "s3c24xx_led",
+       .id             = 1,
+       .dev            = {
+               .platform_data  = &mini2440_led1_pdata,
+       },
+};
+
+static struct platform_device mini2440_led2 = {
+       .name           = "s3c24xx_led",
+       .id             = 2,
+       .dev            = {
+               .platform_data  = &mini2440_led2_pdata,
+       },
+};
+
+static struct platform_device mini2440_led3 = {
+       .name           = "s3c24xx_led",
+       .id             = 3,
+       .dev            = {
+               .platform_data  = &mini2440_led3_pdata,
+       },
+};
+
+static struct platform_device mini2440_led4 = {
+       .name           = "s3c24xx_led",
+       .id             = 4,
+       .dev            = {
+               .platform_data  = &mini2440_led4_pdata,
+       },
+};
+
+static struct platform_device mini2440_led_backlight = {
+       .name           = "s3c24xx_led",
+       .id             = 5,
+       .dev            = {
+               .platform_data  = &mini2440_led_backlight_pdata,
+       },
+};
+
+/* AUDIO */
+
+static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
+       .l3_clk = S3C2410_GPB(4),
+       .l3_mode = S3C2410_GPB(2),
+       .l3_data = S3C2410_GPB(3),
+       .model = UDA134X_UDA1341
+};
+
+static struct platform_device mini2440_audio = {
+       .name           = "s3c24xx_uda134x",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &mini2440_audio_pins,
+       },
+};
+
+/*
+ * I2C devices
+ */
+static const struct property_entry mini2440_at24_properties[] = {
+       PROPERTY_ENTRY_U32("pagesize", 16),
+       { }
+};
+
+static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("24c08", 0x50),
+               .properties = mini2440_at24_properties,
+       },
+};
+
+static struct uda134x_platform_data s3c24xx_uda134x = {
+       .l3 = {
+               .gpio_clk = S3C2410_GPB(4),
+               .gpio_data = S3C2410_GPB(3),
+               .gpio_mode = S3C2410_GPB(2),
+               .use_gpios = 1,
+               .data_hold = 1,
+               .data_setup = 1,
+               .clock_high = 1,
+               .mode_hold = 1,
+               .mode = 1,
+               .mode_setup = 1,
+       },
+       .model = UDA134X_UDA1341,
+};
+
+static struct platform_device uda1340_codec = {
+               .name = "uda134x-codec",
+               .id = -1,
+               .dev = {
+                       .platform_data  = &s3c24xx_uda134x,
+               },
+};
+
+static struct platform_device *mini2440_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_rtc,
+       &s3c_device_usbgadget,
+       &mini2440_device_eth,
+       &mini2440_led1,
+       &mini2440_led2,
+       &mini2440_led3,
+       &mini2440_led4,
+       &mini2440_button_device,
+       &s3c_device_nand,
+       &s3c_device_sdi,
+       &s3c2440_device_dma,
+       &s3c_device_iis,
+       &uda1340_codec,
+       &mini2440_audio,
+};
+
+static void __init mini2440_map_io(void)
+{
+       s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
+       s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init mini2440_init_time(void)
+{
+       s3c2440_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+/*
+ * mini2440_features string
+ *
+ * t = Touchscreen present
+ * b = backlight control
+ * c = camera [TODO]
+ * 0-9 LCD configuration
+ *
+ */
+static char mini2440_features_str[12] __initdata = "0tb";
+
+static int __init mini2440_features_setup(char *str)
+{
+       if (str)
+               strlcpy(mini2440_features_str, str,
+                       sizeof(mini2440_features_str));
+       return 1;
+}
+
+__setup("mini2440=", mini2440_features_setup);
+
+#define FEATURE_SCREEN (1 << 0)
+#define FEATURE_BACKLIGHT (1 << 1)
+#define FEATURE_TOUCH (1 << 2)
+#define FEATURE_CAMERA (1 << 3)
+
+struct mini2440_features_t {
+       int count;
+       int done;
+       int lcd_index;
+       struct platform_device *optional[8];
+};
+
+static void __init mini2440_parse_features(
+               struct mini2440_features_t *features,
+               const char *features_str)
+{
+       const char *fp = features_str;
+
+       features->count = 0;
+       features->done = 0;
+       features->lcd_index = -1;
+
+       while (*fp) {
+               char f = *fp++;
+
+               switch (f) {
+               case '0'...'9': /* tft screen */
+                       if (features->done & FEATURE_SCREEN) {
+                               pr_info("MINI2440: '%c' ignored, screen type already set\n",
+                                       f);
+                       } else {
+                               int li = f - '0';
+
+                               if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
+                                       pr_info("MINI2440: '%c' out of range LCD mode\n",
+                                               f);
+                               else {
+                                       features->optional[features->count++] =
+                                                       &s3c_device_lcd;
+                                       features->lcd_index = li;
+                               }
+                       }
+                       features->done |= FEATURE_SCREEN;
+                       break;
+               case 'b':
+                       if (features->done & FEATURE_BACKLIGHT)
+                               pr_info("MINI2440: '%c' ignored, backlight already set\n",
+                                       f);
+                       else {
+                               features->optional[features->count++] =
+                                               &mini2440_led_backlight;
+                       }
+                       features->done |= FEATURE_BACKLIGHT;
+                       break;
+               case 't':
+                       pr_info("MINI2440: '%c' ignored, touchscreen not compiled in\n",
+                               f);
+                       break;
+               case 'c':
+                       if (features->done & FEATURE_CAMERA)
+                               pr_info("MINI2440: '%c' ignored, camera already registered\n",
+                                       f);
+                       else
+                               features->optional[features->count++] =
+                                       &s3c_device_camif;
+                       features->done |= FEATURE_CAMERA;
+                       break;
+               }
+       }
+}
+
+static void __init mini2440_init(void)
+{
+       struct mini2440_features_t features = { 0 };
+       int i;
+
+       pr_info("MINI2440: Option string mini2440=%s\n",
+                       mini2440_features_str);
+
+       /* Parse the feature string */
+       mini2440_parse_features(&features, mini2440_features_str);
+
+       /* turn LCD on */
+       s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
+
+       /* Turn the backlight early on */
+       WARN_ON(gpio_request_one(S3C2410_GPG(4), GPIOF_OUT_INIT_HIGH, NULL));
+       gpio_free(S3C2410_GPG(4));
+
+       /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
+       gpio_request_one(S3C2410_GPB(1), GPIOF_IN, NULL);
+       s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
+       gpio_free(S3C2410_GPB(1));
+
+       /* mark the key as input, without pullups (there is one on the board) */
+       for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
+               s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
+               s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT);
+       }
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
+       if (features.lcd_index != -1) {
+               int li;
+
+               mini2440_fb_info.displays =
+                       &mini2440_lcd_cfg[features.lcd_index];
+
+               pr_info("MINI2440: LCD");
+               for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
+                       if (li == features.lcd_index)
+                               pr_cont(" [%d:%dx%d]", li,
+                                       mini2440_lcd_cfg[li].width,
+                                       mini2440_lcd_cfg[li].height);
+                       else
+                               pr_cont(" %d:%dx%d", li,
+                                       mini2440_lcd_cfg[li].width,
+                                       mini2440_lcd_cfg[li].height);
+               pr_cont("\n");
+               s3c24xx_fb_set_platdata(&mini2440_fb_info);
+       }
+
+       s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
+       gpiod_add_lookup_table(&mini2440_mmc_gpio_table);
+       s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
+       s3c_nand_set_platdata(&mini2440_nand_info);
+       s3c_i2c0_set_platdata(NULL);
+
+       i2c_register_board_info(0, mini2440_i2c_devs,
+                               ARRAY_SIZE(mini2440_i2c_devs));
+
+       /* Disable pull-up on the LED lines */
+       s3c_gpio_setpull(S3C2410_GPB(5), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPB(6), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPB(7), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPB(8), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPG(4), S3C_GPIO_PULL_NONE);
+
+       /* Add lookups for the lines */
+       gpiod_add_lookup_table(&mini2440_led1_gpio_table);
+       gpiod_add_lookup_table(&mini2440_led2_gpio_table);
+       gpiod_add_lookup_table(&mini2440_led3_gpio_table);
+       gpiod_add_lookup_table(&mini2440_led4_gpio_table);
+       gpiod_add_lookup_table(&mini2440_backlight_gpio_table);
+
+       platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
+
+       if (features.count)     /* the optional features */
+               platform_add_devices(features.optional, features.count);
+
+}
+
+
+MACHINE_START(MINI2440, "MINI2440")
+       /* Maintainer: Michel Pollet <buserror@gmail.com> */
+       .atag_offset    = 0x100,
+       .map_io         = mini2440_map_io,
+       .init_machine   = mini2440_init,
+       .init_irq       = s3c2440_init_irq,
+       .init_time      = mini2440_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-mini6410.c b/arch/arm/mach-s3c/mach-mini6410.c
new file mode 100644 (file)
index 0000000..75f2ec4
--- /dev/null
@@ -0,0 +1,365 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2010 Darius Augulis <augulis.darius@gmail.com>
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/dm9000.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/types.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include <linux/soc/samsung/s3c-adc.h>
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/mmc-sdhci-s3c.h>
+#include "sdhci.h"
+#include <linux/platform_data/touchscreen-s3c2410.h>
+#include <mach/irqs.h>
+
+#include <video/platform_lcd.h>
+#include <video/samsung_fimd.h>
+
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-srom-s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg mini6410_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport = 0,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+       [1] = {
+               .hwport = 1,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+       [2] = {
+               .hwport = 2,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+       [3] = {
+               .hwport = 3,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+};
+
+/* DM9000AEP 10/100 ethernet controller */
+
+static struct resource mini6410_dm9k_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
+       [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
+       [2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
+                                       | IORESOURCE_IRQ_HIGHLEVEL),
+};
+
+static struct dm9000_plat_data mini6410_dm9k_pdata = {
+       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
+};
+
+static struct platform_device mini6410_device_eth = {
+       .name           = "dm9000",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(mini6410_dm9k_resource),
+       .resource       = mini6410_dm9k_resource,
+       .dev            = {
+               .platform_data  = &mini6410_dm9k_pdata,
+       },
+};
+
+static struct mtd_partition mini6410_nand_part[] = {
+       [0] = {
+               .name   = "uboot",
+               .size   = SZ_1M,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "kernel",
+               .size   = SZ_2M,
+               .offset = SZ_1M,
+       },
+       [2] = {
+               .name   = "rootfs",
+               .size   = MTDPART_SIZ_FULL,
+               .offset = SZ_1M + SZ_2M,
+       },
+};
+
+static struct s3c2410_nand_set mini6410_nand_sets[] = {
+       [0] = {
+               .name           = "nand",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(mini6410_nand_part),
+               .partitions     = mini6410_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand mini6410_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 55,
+       .twrph1         = 40,
+       .nr_sets        = ARRAY_SIZE(mini6410_nand_sets),
+       .sets           = mini6410_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+static struct s3c_fb_pd_win mini6410_lcd_type0_fb_win = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 480,
+       .yres           = 272,
+};
+
+static struct fb_videomode mini6410_lcd_type0_timing = {
+       /* 4.3" 480x272 */
+       .left_margin    = 3,
+       .right_margin   = 2,
+       .upper_margin   = 1,
+       .lower_margin   = 1,
+       .hsync_len      = 40,
+       .vsync_len      = 1,
+       .xres           = 480,
+       .yres           = 272,
+};
+
+static struct s3c_fb_pd_win mini6410_lcd_type1_fb_win = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct fb_videomode mini6410_lcd_type1_timing = {
+       /* 7.0" 800x480 */
+       .left_margin    = 8,
+       .right_margin   = 13,
+       .upper_margin   = 7,
+       .lower_margin   = 5,
+       .hsync_len      = 3,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct s3c_fb_platdata mini6410_lcd_pdata[] __initdata = {
+       {
+               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+               .vtiming        = &mini6410_lcd_type0_timing,
+               .win[0]         = &mini6410_lcd_type0_fb_win,
+               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+       }, {
+               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+               .vtiming        = &mini6410_lcd_type1_timing,
+               .win[0]         = &mini6410_lcd_type1_fb_win,
+               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+       },
+       { },
+};
+
+static void mini6410_lcd_power_set(struct plat_lcd_data *pd,
+                                  unsigned int power)
+{
+       if (power)
+               gpio_direction_output(S3C64XX_GPE(0), 1);
+       else
+               gpio_direction_output(S3C64XX_GPE(0), 0);
+}
+
+static struct plat_lcd_data mini6410_lcd_power_data = {
+       .set_power      = mini6410_lcd_power_set,
+};
+
+static struct platform_device mini6410_lcd_powerdev = {
+       .name                   = "platform-lcd",
+       .dev.parent             = &s3c_device_fb.dev,
+       .dev.platform_data      = &mini6410_lcd_power_data,
+};
+
+static struct s3c_sdhci_platdata mini6410_hsmmc1_pdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_GPIO,
+       .ext_cd_gpio            = S3C64XX_GPN(10),
+       .ext_cd_gpio_invert     = true,
+};
+
+static struct platform_device *mini6410_devices[] __initdata = {
+       &mini6410_device_eth,
+       &s3c_device_hsmmc0,
+       &s3c_device_hsmmc1,
+       &s3c_device_ohci,
+       &s3c_device_nand,
+       &s3c_device_fb,
+       &mini6410_lcd_powerdev,
+       &s3c_device_adc,
+};
+
+static void __init mini6410_map_io(void)
+{
+       u32 tmp;
+
+       s3c64xx_init_io(NULL, 0);
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+
+       /* set the LCD type */
+       tmp = __raw_readl(S3C64XX_SPCON);
+       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
+       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
+       __raw_writel(tmp, S3C64XX_SPCON);
+
+       /* remove the LCD bypass */
+       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
+       tmp &= ~MIFPCON_LCD_BYPASS;
+       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
+}
+
+/*
+ * mini6410_features string
+ *
+ * 0-9 LCD configuration
+ *
+ */
+static char mini6410_features_str[12] __initdata = "0";
+
+static int __init mini6410_features_setup(char *str)
+{
+       if (str)
+               strlcpy(mini6410_features_str, str,
+                       sizeof(mini6410_features_str));
+       return 1;
+}
+
+__setup("mini6410=", mini6410_features_setup);
+
+#define FEATURE_SCREEN (1 << 0)
+
+struct mini6410_features_t {
+       int done;
+       int lcd_index;
+};
+
+static void mini6410_parse_features(
+               struct mini6410_features_t *features,
+               const char *features_str)
+{
+       const char *fp = features_str;
+
+       features->done = 0;
+       features->lcd_index = 0;
+
+       while (*fp) {
+               char f = *fp++;
+
+               switch (f) {
+               case '0'...'9': /* tft screen */
+                       if (features->done & FEATURE_SCREEN) {
+                               printk(KERN_INFO "MINI6410: '%c' ignored, "
+                                       "screen type already set\n", f);
+                       } else {
+                               int li = f - '0';
+                               if (li >= ARRAY_SIZE(mini6410_lcd_pdata))
+                                       printk(KERN_INFO "MINI6410: '%c' out "
+                                               "of range LCD mode\n", f);
+                               else {
+                                       features->lcd_index = li;
+                               }
+                       }
+                       features->done |= FEATURE_SCREEN;
+                       break;
+               }
+       }
+}
+
+static void __init mini6410_machine_init(void)
+{
+       u32 cs1;
+       struct mini6410_features_t features = { 0 };
+
+       printk(KERN_INFO "MINI6410: Option string mini6410=%s\n",
+                       mini6410_features_str);
+
+       /* Parse the feature string */
+       mini6410_parse_features(&features, mini6410_features_str);
+
+       printk(KERN_INFO "MINI6410: selected LCD display is %dx%d\n",
+               mini6410_lcd_pdata[features.lcd_index].win[0]->xres,
+               mini6410_lcd_pdata[features.lcd_index].win[0]->yres);
+
+       s3c_nand_set_platdata(&mini6410_nand_info);
+       s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]);
+       s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);
+       s3c64xx_ts_set_platdata(NULL);
+
+       /* configure nCS1 width to 16 bits */
+
+       cs1 = __raw_readl(S3C64XX_SROM_BW) &
+               ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
+       cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
+               (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
+               (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
+                       S3C64XX_SROM_BW__NCS1__SHIFT;
+       __raw_writel(cs1, S3C64XX_SROM_BW);
+
+       /* set timing for nCS1 suitable for ethernet chip */
+
+       __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
+               (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
+               (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
+               (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
+               (13 << S3C64XX_SROM_BCX__TACC__SHIFT) |
+               (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
+               (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
+
+       gpio_request(S3C64XX_GPF(15), "LCD power");
+       gpio_request(S3C64XX_GPE(0), "LCD power");
+
+       platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices));
+}
+
+MACHINE_START(MINI6410, "MINI6410")
+       /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = mini6410_map_io,
+       .init_machine   = mini6410_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-n30.c b/arch/arm/mach-s3c/mach-n30.c
new file mode 100644 (file)
index 0000000..e40c1fc
--- /dev/null
@@ -0,0 +1,673 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
+// Yakumo AlphaX and Airis NC05 PDAs.
+//
+// Copyright (c) 2003-2005 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
+//
+// There is a wiki with more information about the n30 port at
+// https://handhelds.org/moin/moin.cgi/AcerN30Documentation .
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include <linux/gpio_keys.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/timer.h>
+#include <linux/io.h>
+#include <linux/mmc/host.h>
+
+#include "hardware-s3c24xx.h"
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include <linux/platform_data/leds-s3c24xx.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include <asm/mach/arch.h>
+#include <asm/mach/irq.h>
+#include <asm/mach/map.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "cpu.h"
+#include "devs.h"
+#include <linux/platform_data/mmc-s3cmci.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+
+#include "s3c24xx.h"
+
+static struct map_desc n30_iodesc[] __initdata = {
+       /* nothing here yet */
+};
+
+static struct s3c2410_uartcfg n30_uartcfgs[] = {
+       /* Normal serial port */
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x2c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       /* IR port */
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .uart_flags  = UPF_CONS_FLOW,
+               .ucon        = 0x2c5,
+               .ulcon       = 0x43,
+               .ufcon       = 0x51,
+       },
+       /* On the N30 the bluetooth controller is connected here.
+        * On the N35 and variants the GPS receiver is connected here. */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = 0x2c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+};
+
+static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
+       .vbus_pin               = S3C2410_GPG(1),
+       .vbus_pin_inverted      = 0,
+       .pullup_pin             = S3C2410_GPB(3),
+};
+
+static struct gpio_keys_button n30_buttons[] = {
+       {
+               .gpio           = S3C2410_GPF(0),
+               .code           = KEY_POWER,
+               .desc           = "Power",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(9),
+               .code           = KEY_UP,
+               .desc           = "Thumbwheel Up",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(8),
+               .code           = KEY_DOWN,
+               .desc           = "Thumbwheel Down",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(7),
+               .code           = KEY_ENTER,
+               .desc           = "Thumbwheel Press",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(7),
+               .code           = KEY_HOMEPAGE,
+               .desc           = "Home",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(6),
+               .code           = KEY_CALENDAR,
+               .desc           = "Calendar",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(5),
+               .code           = KEY_ADDRESSBOOK,
+               .desc           = "Contacts",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(4),
+               .code           = KEY_MAIL,
+               .desc           = "Mail",
+               .active_low     = 0,
+       },
+};
+
+static struct gpio_keys_platform_data n30_button_data = {
+       .buttons        = n30_buttons,
+       .nbuttons       = ARRAY_SIZE(n30_buttons),
+};
+
+static struct platform_device n30_button_device = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &n30_button_data,
+       }
+};
+
+static struct gpio_keys_button n35_buttons[] = {
+       {
+               .gpio           = S3C2410_GPF(0),
+               .code           = KEY_POWER,
+               .type           = EV_PWR,
+               .desc           = "Power",
+               .active_low     = 0,
+               .wakeup         = 1,
+       },
+       {
+               .gpio           = S3C2410_GPG(9),
+               .code           = KEY_UP,
+               .desc           = "Joystick Up",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(8),
+               .code           = KEY_DOWN,
+               .desc           = "Joystick Down",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(6),
+               .code           = KEY_DOWN,
+               .desc           = "Joystick Left",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(5),
+               .code           = KEY_DOWN,
+               .desc           = "Joystick Right",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(7),
+               .code           = KEY_ENTER,
+               .desc           = "Joystick Press",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(7),
+               .code           = KEY_HOMEPAGE,
+               .desc           = "Home",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(6),
+               .code           = KEY_CALENDAR,
+               .desc           = "Calendar",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(5),
+               .code           = KEY_ADDRESSBOOK,
+               .desc           = "Contacts",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(4),
+               .code           = KEY_MAIL,
+               .desc           = "Mail",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPF(3),
+               .code           = SW_RADIO,
+               .desc           = "GPS Antenna",
+               .active_low     = 0,
+       },
+       {
+               .gpio           = S3C2410_GPG(2),
+               .code           = SW_HEADPHONE_INSERT,
+               .desc           = "Headphone",
+               .active_low     = 0,
+       },
+};
+
+static struct gpio_keys_platform_data n35_button_data = {
+       .buttons        = n35_buttons,
+       .nbuttons       = ARRAY_SIZE(n35_buttons),
+};
+
+static struct platform_device n35_button_device = {
+       .name           = "gpio-keys",
+       .id             = -1,
+       .num_resources  = 0,
+       .dev            = {
+               .platform_data  = &n35_button_data,
+       }
+};
+
+/* This is the bluetooth LED on the device. */
+
+static struct gpiod_lookup_table n30_blue_led_gpio_table = {
+       .dev_id = "s3c24xx_led.1",
+       .table = {
+               GPIO_LOOKUP("GPG", 6, NULL, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata n30_blue_led_pdata = {
+       .name           = "blue_led",
+       .def_trigger    = "",
+};
+
+/* This is the blue LED on the device. Originally used to indicate GPS activity
+ * by flashing. */
+
+static struct gpiod_lookup_table n35_blue_led_gpio_table = {
+       .dev_id = "s3c24xx_led.1",
+       .table = {
+               GPIO_LOOKUP("GPD", 8, NULL, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata n35_blue_led_pdata = {
+       .name           = "blue_led",
+       .def_trigger    = "",
+};
+
+/* This LED is driven by the battery microcontroller, and is blinking
+ * red, blinking green or solid green when the battery is low,
+ * charging or full respectively.  By driving GPD9 low, it's possible
+ * to force the LED to blink red, so call that warning LED.  */
+
+static struct gpiod_lookup_table n30_warning_led_gpio_table = {
+       .dev_id = "s3c24xx_led.2",
+       .table = {
+               GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata n30_warning_led_pdata = {
+       .name           = "warning_led",
+       .def_trigger    = "",
+};
+
+static struct gpiod_lookup_table n35_warning_led_gpio_table = {
+       .dev_id = "s3c24xx_led.2",
+       .table = {
+               GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata n35_warning_led_pdata = {
+       .name           = "warning_led",
+       .def_trigger    = "",
+};
+
+static struct platform_device n30_blue_led = {
+       .name           = "s3c24xx_led",
+       .id             = 1,
+       .dev            = {
+               .platform_data  = &n30_blue_led_pdata,
+       },
+};
+
+static struct platform_device n35_blue_led = {
+       .name           = "s3c24xx_led",
+       .id             = 1,
+       .dev            = {
+               .platform_data  = &n35_blue_led_pdata,
+       },
+};
+
+static struct platform_device n30_warning_led = {
+       .name           = "s3c24xx_led",
+       .id             = 2,
+       .dev            = {
+               .platform_data  = &n30_warning_led_pdata,
+       },
+};
+
+static struct platform_device n35_warning_led = {
+       .name           = "s3c24xx_led",
+       .id             = 2,
+       .dev            = {
+               .platform_data  = &n35_warning_led_pdata,
+       },
+};
+
+static struct s3c2410fb_display n30_display __initdata = {
+       .type           = S3C2410_LCDCON1_TFT,
+       .width          = 240,
+       .height         = 320,
+       .pixclock       = 170000,
+
+       .xres           = 240,
+       .yres           = 320,
+       .bpp            = 16,
+       .left_margin    = 3,
+       .right_margin   = 40,
+       .hsync_len      = 40,
+       .upper_margin   = 2,
+       .lower_margin   = 3,
+       .vsync_len      = 2,
+
+       .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
+};
+
+static struct s3c2410fb_mach_info n30_fb_info __initdata = {
+       .displays       = &n30_display,
+       .num_displays   = 1,
+       .default_display = 0,
+       .lpcsel         = 0x06,
+};
+
+static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
+{
+       s3c24xx_mci_def_set_power(power_mode, vdd);
+
+       switch (power_mode) {
+       case MMC_POWER_ON:
+       case MMC_POWER_UP:
+               gpio_set_value(S3C2410_GPG(4), 1);
+               break;
+       case MMC_POWER_OFF:
+       default:
+               gpio_set_value(S3C2410_GPG(4), 0);
+               break;
+       }
+}
+
+static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = {
+       .ocr_avail      = MMC_VDD_32_33,
+       .set_power      = n30_sdi_set_power,
+};
+
+static struct gpiod_lookup_table n30_mci_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* Card detect S3C2410_GPF(1) */
+               GPIO_LOOKUP("GPIOF", 1, "cd", GPIO_ACTIVE_LOW),
+               /* Write protect S3C2410_GPG(10) */
+               GPIO_LOOKUP("GPIOG", 10, "wp", GPIO_ACTIVE_LOW),
+               { },
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+       },
+};
+
+static struct platform_device *n30_devices[] __initdata = {
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_ohci,
+       &s3c_device_rtc,
+       &s3c_device_usbgadget,
+       &s3c_device_sdi,
+       &n30_button_device,
+       &n30_blue_led,
+       &n30_warning_led,
+};
+
+static struct platform_device *n35_devices[] __initdata = {
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_rtc,
+       &s3c_device_usbgadget,
+       &s3c_device_sdi,
+       &n35_button_device,
+       &n35_blue_led,
+       &n35_warning_led,
+};
+
+static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
+       .flags          = 0,
+       .slave_addr     = 0x10,
+       .frequency      = 10*1000,
+};
+
+/* Lots of hardcoded stuff, but it sets up the hardware in a useful
+ * state so that we can boot Linux directly from flash. */
+static void __init n30_hwinit(void)
+{
+       /* GPA0-11 special functions -- unknown what they do
+        * GPA12 N30 special function -- unknown what it does
+        *       N35/PiN output -- unknown what it does
+        *
+        * A12 is nGCS1 on the N30 and an output on the N35/PiN.  I
+        * don't think it does anything useful on the N30, so I ought
+        * to make it an output there too since it always driven to 0
+        * as far as I can tell. */
+       if (machine_is_n30())
+               __raw_writel(0x007fffff, S3C2410_GPACON);
+       if (machine_is_n35())
+               __raw_writel(0x007fefff, S3C2410_GPACON);
+       __raw_writel(0x00000000, S3C2410_GPADAT);
+
+       /* GPB0 TOUT0 backlight level
+        * GPB1 output 1=backlight on
+        * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
+        * GPB3 output USB D+ pull up 0=disabled, 1=enabled
+        * GPB4 N30 output -- unknown function
+        *      N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
+        * GPB5 output -- unknown function
+        * GPB6 input -- unknown function
+        * GPB7 output -- unknown function
+        * GPB8 output -- probably LCD driver enable
+        * GPB9 output -- probably LCD VSYNC driver enable
+        * GPB10 output -- probably LCD HSYNC driver enable
+        */
+       __raw_writel(0x00154556, S3C2410_GPBCON);
+       __raw_writel(0x00000750, S3C2410_GPBDAT);
+       __raw_writel(0x00000073, S3C2410_GPBUP);
+
+       /* GPC0 input RS232 DCD/DSR/RI
+        * GPC1 LCD
+        * GPC2 output RS232 DTR?
+        * GPC3 input RS232 DCD/DSR/RI
+        * GPC4 LCD
+        * GPC5 output 0=NAND write enabled, 1=NAND write protect
+        * GPC6 input -- unknown function
+        * GPC7 input charger status 0=charger connected
+        *      this input can be triggered by power on the USB device
+        *      port too, but will go back to disconnected soon after.
+        * GPC8 N30/N35 output -- unknown function, always driven to 1
+        *      PiN input -- unknown function, always read as 1
+        *      Make it an input with a pull up for all models.
+        * GPC9-15 LCD
+        */
+       __raw_writel(0xaaa80618, S3C2410_GPCCON);
+       __raw_writel(0x0000014c, S3C2410_GPCDAT);
+       __raw_writel(0x0000fef2, S3C2410_GPCUP);
+
+       /* GPD0 input -- unknown function
+        * GPD1-D7 LCD
+        * GPD8 N30 output -- unknown function
+        *      N35/PiN output 1=GPS LED on
+        * GPD9 output 0=power led blinks red, 1=normal power led function
+        * GPD10 output -- unknown function
+        * GPD11-15 LCD drivers
+        */
+       __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
+       __raw_writel(0x00000601, S3C2410_GPDDAT);
+       __raw_writel(0x0000fbfe, S3C2410_GPDUP);
+
+       /* GPE0-4 I2S audio bus
+        * GPE5-10 SD/MMC bus
+        * E11-13 outputs -- unknown function, probably power management
+        * E14-15 I2C bus connected to the battery controller
+        */
+       __raw_writel(0xa56aaaaa, S3C2410_GPECON);
+       __raw_writel(0x0000efc5, S3C2410_GPEDAT);
+       __raw_writel(0x0000f81f, S3C2410_GPEUP);
+
+       /* GPF0  input 0=power button pressed
+        * GPF1  input SD/MMC switch 0=card present
+        * GPF2  N30 1=reset button pressed (inverted compared to the rest)
+        *       N35/PiN 0=reset button pressed
+        * GPF3  N30/PiN input -- unknown function
+        *       N35 input GPS antenna position, 0=antenna closed, 1=open
+        * GPF4  input 0=button 4 pressed
+        * GPF5  input 0=button 3 pressed
+        * GPF6  input 0=button 2 pressed
+        * GPF7  input 0=button 1 pressed
+        */
+       __raw_writel(0x0000aaaa, S3C2410_GPFCON);
+       __raw_writel(0x00000000, S3C2410_GPFDAT);
+       __raw_writel(0x000000ff, S3C2410_GPFUP);
+
+       /* GPG0  input RS232 DCD/DSR/RI
+        * GPG1  input 1=USB gadget port has power from a host
+        * GPG2  N30 input -- unknown function
+        *       N35/PiN input 0=headphones plugged in, 1=not plugged in
+        * GPG3  N30 output -- unknown function
+        *       N35/PiN input with unknown function
+        * GPG4  N30 output 0=MMC enabled, 1=MMC disabled
+        * GPG5  N30 output 0=BlueTooth chip disabled, 1=enabled
+        *       N35/PiN input joystick right
+        * GPG6  N30 output 0=blue led on, 1=off
+        *       N35/PiN input joystick left
+        * GPG7  input 0=thumbwheel pressed
+        * GPG8  input 0=thumbwheel down
+        * GPG9  input 0=thumbwheel up
+        * GPG10 input SD/MMC write protect switch
+        * GPG11 N30 input -- unknown function
+        *       N35 output 0=GPS antenna powered, 1=not powered
+        *       PiN output -- unknown function
+        * GPG12-15 touch screen functions
+        *
+        * The pullups differ between the models, so enable all
+        * pullups that are enabled on any of the models.
+        */
+       if (machine_is_n30())
+               __raw_writel(0xff0a956a, S3C2410_GPGCON);
+       if (machine_is_n35())
+               __raw_writel(0xff4aa92a, S3C2410_GPGCON);
+       __raw_writel(0x0000e800, S3C2410_GPGDAT);
+       __raw_writel(0x0000f86f, S3C2410_GPGUP);
+
+       /* GPH0/1/2/3 RS232 serial port
+        * GPH4/5 IrDA serial port
+        * GPH6/7  N30 BlueTooth serial port
+        *         N35/PiN GPS receiver
+        * GPH8 input -- unknown function
+        * GPH9 CLKOUT0 HCLK -- unknown use
+        * GPH10 CLKOUT1 FCLK -- unknown use
+        *
+        * The pull ups for H6/H7 are enabled on N30 but not on the
+        * N35/PiN.  I suppose is useful for a budget model of the N30
+        * with no bluetooth.  It doesn't hurt to have the pull ups
+        * enabled on the N35, so leave them enabled for all models.
+        */
+       __raw_writel(0x0028aaaa, S3C2410_GPHCON);
+       __raw_writel(0x000005ef, S3C2410_GPHDAT);
+       __raw_writel(0x0000063f, S3C2410_GPHUP);
+}
+
+static void __init n30_map_io(void)
+{
+       s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
+       n30_hwinit();
+       s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init n30_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+/* GPB3 is the line that controls the pull-up for the USB D+ line */
+
+static void __init n30_init(void)
+{
+       WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
+
+       s3c24xx_fb_set_platdata(&n30_fb_info);
+       s3c24xx_udc_set_platdata(&n30_udc_cfg);
+       gpiod_add_lookup_table(&n30_mci_gpio_table);
+       s3c24xx_mci_set_platdata(&n30_mci_cfg);
+       s3c_i2c0_set_platdata(&n30_i2ccfg);
+
+       /* Turn off suspend on both USB ports, and switch the
+        * selectable USB port to USB device mode. */
+
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                             S3C2410_MISCCR_USBSUSPND0 |
+                             S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
+       if (machine_is_n30()) {
+               /* Turn off suspend on both USB ports, and switch the
+                * selectable USB port to USB device mode. */
+               s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                                     S3C2410_MISCCR_USBSUSPND0 |
+                                     S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+               /* Disable pull-up and add GPIO tables */
+               s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
+               s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
+               gpiod_add_lookup_table(&n30_blue_led_gpio_table);
+               gpiod_add_lookup_table(&n30_warning_led_gpio_table);
+
+               platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
+       }
+
+       if (machine_is_n35()) {
+               /* Turn off suspend and switch the selectable USB port
+                * to USB device mode.  Turn on suspend for the host
+                * port since it is not connected on the N35.
+                *
+                * Actually, the host port is available at some pads
+                * on the back of the device, so it would actually be
+                * possible to add a USB device inside the N35 if you
+                * are willing to do some hardware modifications. */
+               s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                                     S3C2410_MISCCR_USBSUSPND0 |
+                                     S3C2410_MISCCR_USBSUSPND1,
+                                     S3C2410_MISCCR_USBSUSPND0);
+
+               /* Disable pull-up and add GPIO tables */
+               s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
+               s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
+               gpiod_add_lookup_table(&n35_blue_led_gpio_table);
+               gpiod_add_lookup_table(&n35_warning_led_gpio_table);
+
+               platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
+       }
+}
+
+MACHINE_START(N30, "Acer-N30")
+       /* Maintainer: Christer Weinigel <christer@weinigel.se>,
+                               Ben Dooks <ben-linux@fluff.org>
+       */
+       .atag_offset    = 0x100,
+       .init_time      = n30_init_time,
+       .init_machine   = n30_init,
+       .init_irq       = s3c2410_init_irq,
+       .map_io         = n30_map_io,
+MACHINE_END
+
+MACHINE_START(N35, "Acer-N35")
+       /* Maintainer: Christer Weinigel <christer@weinigel.se>
+       */
+       .atag_offset    = 0x100,
+       .init_time      = n30_init_time,
+       .init_machine   = n30_init,
+       .init_irq       = s3c2410_init_irq,
+       .map_io         = n30_map_io,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-ncp.c b/arch/arm/mach-s3c/mach-ncp.c
new file mode 100644 (file)
index 0000000..1a45bed
--- /dev/null
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2008-2009 Samsung Electronics
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/i2c.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+
+#include <video/platform_lcd.h>
+#include <video/samsung_fimd.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <mach/irqs.h>
+#include "map.h"
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "fb.h"
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg ncp_uartcfgs[] __initdata = {
+       /* REVISIT: NCP uses only serial 1, 2 */
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+};
+
+static struct platform_device *ncp_devices[] __initdata = {
+       &s3c_device_hsmmc1,
+       &s3c_device_i2c0,
+};
+
+static struct map_desc ncp_iodesc[] __initdata = {};
+
+static void __init ncp_map_io(void)
+{
+       s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+}
+
+static void __init ncp_machine_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+
+       platform_add_devices(ncp_devices, ARRAY_SIZE(ncp_devices));
+}
+
+MACHINE_START(NCP, "NCP")
+       /* Maintainer: Samsung Electronics */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = ncp_map_io,
+       .init_machine   = ncp_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-nexcoder.c b/arch/arm/mach-s3c/mach-nexcoder.c
new file mode 100644 (file)
index 0000000..2a454c9
--- /dev/null
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-2.0
+// linux/arch/arm/mach-s3c2440/mach-nexcoder.c
+//
+// Copyright (c) 2004 Nex Vision
+//   Guillaume GOURAT <guillaume.gourat@nexvision.tv>
+//
+// Modifications:
+//     15-10-2004 GG  Created initial version
+//     12-03-2005 BJD Updated for release
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/string.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <linux/mtd/map.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/setup.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+//#include <asm/debug-ll.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c24xx.h"
+
+static struct map_desc nexcoder_iodesc[] __initdata = {
+       /* nothing here yet */
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg nexcoder_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+/* NOR Flash on NexVision NexCoder 2440 board */
+
+static struct resource nexcoder_nor_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_8M),
+};
+
+static struct map_info nexcoder_nor_map = {
+       .bankwidth = 2,
+};
+
+static struct platform_device nexcoder_device_nor = {
+       .name           = "mtd-flash",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(nexcoder_nor_resource),
+       .resource       = nexcoder_nor_resource,
+       .dev =
+       {
+               .platform_data = &nexcoder_nor_map,
+       }
+};
+
+/* Standard Nexcoder devices */
+
+static struct platform_device *nexcoder_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_rtc,
+       &s3c_device_camif,
+       &s3c_device_spi0,
+       &s3c_device_spi1,
+       &nexcoder_device_nor,
+};
+
+static void __init nexcoder_sensorboard_init(void)
+{
+       /* Initialize SCCB bus */
+       gpio_request_one(S3C2410_GPE(14), GPIOF_OUT_INIT_HIGH, NULL);
+       gpio_free(S3C2410_GPE(14)); /* IICSCL */
+       gpio_request_one(S3C2410_GPE(15), GPIOF_OUT_INIT_HIGH, NULL);
+       gpio_free(S3C2410_GPE(15)); /* IICSDA */
+
+       /* Power up the sensor board */
+       gpio_request_one(S3C2410_GPF(1), GPIOF_OUT_INIT_HIGH, NULL);
+       gpio_free(S3C2410_GPF(1)); /* CAM_GPIO7 => nLDO_PWRDN */
+       gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL);
+       gpio_free(S3C2410_GPF(2)); /* CAM_GPIO6 => CAM_PWRDN */
+}
+
+static void __init nexcoder_map_io(void)
+{
+       s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
+       s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+
+       nexcoder_sensorboard_init();
+}
+
+static void __init nexcoder_init_time(void)
+{
+       s3c2440_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init nexcoder_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
+       platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices));
+};
+
+MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
+       /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
+       .atag_offset    = 0x100,
+       .map_io         = nexcoder_map_io,
+       .init_machine   = nexcoder_init,
+       .init_irq       = s3c2440_init_irq,
+       .init_time      = nexcoder_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-osiris-dvs.c b/arch/arm/mach-s3c/mach-osiris-dvs.c
new file mode 100644 (file)
index 0000000..2e283ae
--- /dev/null
@@ -0,0 +1,178 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2009 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Simtec Osiris Dynamic Voltage Scaling support.
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/cpufreq.h>
+#include <linux/gpio.h>
+
+#include <linux/mfd/tps65010.h>
+
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+#include "gpio-samsung.h"
+
+#define OSIRIS_GPIO_DVS        S3C2410_GPB(5)
+
+static bool dvs_en;
+
+static void osiris_dvs_tps_setdvs(bool on)
+{
+       unsigned vregs1 = 0, vdcdc2 = 0;
+
+       if (!on) {
+               vdcdc2 = TPS_VCORE_DISCH | TPS_LP_COREOFF;
+               vregs1 = TPS_LDO1_OFF;  /* turn off in low-power mode */
+       }
+
+       dvs_en = on;
+       vdcdc2 |= TPS_VCORE_1_3V | TPS_VCORE_LP_1_0V;
+       vregs1 |= TPS_LDO2_ENABLE | TPS_LDO1_ENABLE;
+
+       tps65010_config_vregs1(vregs1);
+       tps65010_config_vdcdc2(vdcdc2);
+}
+
+static bool is_dvs(struct s3c_freq *f)
+{
+       /* at the moment, we assume ARMCLK = HCLK => DVS */
+       return f->armclk == f->hclk;
+}
+
+/* keep track of current state */
+static bool cur_dvs = false;
+
+static int osiris_dvs_notify(struct notifier_block *nb,
+                             unsigned long val, void *data)
+{
+       struct cpufreq_freqs *cf = data;
+       struct s3c_cpufreq_freqs *freqs = to_s3c_cpufreq(cf);
+       bool old_dvs = is_dvs(&freqs->old);
+       bool new_dvs = is_dvs(&freqs->new);
+       int ret = 0;
+
+       if (!dvs_en)
+               return 0;
+
+       printk(KERN_DEBUG "%s: old %ld,%ld new %ld,%ld\n", __func__,
+              freqs->old.armclk, freqs->old.hclk,
+              freqs->new.armclk, freqs->new.hclk);
+
+       switch (val) {
+       case CPUFREQ_PRECHANGE:
+               if ((old_dvs && !new_dvs) ||
+                   (cur_dvs && !new_dvs)) {
+                       pr_debug("%s: exiting dvs\n", __func__);
+                       cur_dvs = false;
+                       gpio_set_value(OSIRIS_GPIO_DVS, 1);
+               }
+               break;
+       case CPUFREQ_POSTCHANGE:
+               if ((!old_dvs && new_dvs) ||
+                   (!cur_dvs && new_dvs)) {
+                       pr_debug("entering dvs\n");
+                       cur_dvs = true;
+                       gpio_set_value(OSIRIS_GPIO_DVS, 0);
+               }
+               break;
+       }
+
+       return ret;
+}
+
+static struct notifier_block osiris_dvs_nb = {
+       .notifier_call  = osiris_dvs_notify,
+};
+
+static int osiris_dvs_probe(struct platform_device *pdev)
+{
+       int ret;
+
+       dev_info(&pdev->dev, "initialising\n");
+
+       ret = gpio_request(OSIRIS_GPIO_DVS, "osiris-dvs");
+       if (ret) {
+               dev_err(&pdev->dev, "cannot claim gpio\n");
+               goto err_nogpio;
+       }
+
+       /* start with dvs disabled */
+       gpio_direction_output(OSIRIS_GPIO_DVS, 1);
+
+       ret = cpufreq_register_notifier(&osiris_dvs_nb,
+                                       CPUFREQ_TRANSITION_NOTIFIER);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to register with cpufreq\n");
+               goto err_nofreq;
+       }
+
+       osiris_dvs_tps_setdvs(true);
+
+       return 0;
+
+err_nofreq:
+       gpio_free(OSIRIS_GPIO_DVS);
+
+err_nogpio:
+       return ret;
+}
+
+static int osiris_dvs_remove(struct platform_device *pdev)
+{
+       dev_info(&pdev->dev, "exiting\n");
+
+       /* disable any current dvs */
+       gpio_set_value(OSIRIS_GPIO_DVS, 1);
+       osiris_dvs_tps_setdvs(false);
+
+       cpufreq_unregister_notifier(&osiris_dvs_nb,
+                                   CPUFREQ_TRANSITION_NOTIFIER);
+
+       gpio_free(OSIRIS_GPIO_DVS);
+
+       return 0;
+}
+
+/* the CONFIG_PM block is so small, it isn't worth actually compiling it
+ * out if the configuration isn't set. */
+
+static int osiris_dvs_suspend(struct device *dev)
+{
+       gpio_set_value(OSIRIS_GPIO_DVS, 1);
+       osiris_dvs_tps_setdvs(false);
+       cur_dvs = false;
+
+       return 0;
+}
+
+static int osiris_dvs_resume(struct device *dev)
+{
+       osiris_dvs_tps_setdvs(true);
+       return 0;
+}
+
+static const struct dev_pm_ops osiris_dvs_pm = {
+       .suspend        = osiris_dvs_suspend,
+       .resume         = osiris_dvs_resume,
+};
+
+static struct platform_driver osiris_dvs_driver = {
+       .probe          = osiris_dvs_probe,
+       .remove         = osiris_dvs_remove,
+       .driver         = {
+               .name   = "osiris-dvs",
+               .pm     = &osiris_dvs_pm,
+       },
+};
+
+module_platform_driver(osiris_dvs_driver);
+
+MODULE_DESCRIPTION("Simtec OSIRIS DVS support");
+MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:osiris-dvs");
diff --git a/arch/arm/mach-s3c/mach-osiris.c b/arch/arm/mach-s3c/mach-osiris.c
new file mode 100644 (file)
index 0000000..4e94683
--- /dev/null
@@ -0,0 +1,409 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2005-2008 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/clk.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+
+#include <linux/mfd/tps65010.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+#include <asm/irq.h>
+
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+#include "devs.h"
+#include "gpio-cfg.h"
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "s3c24xx.h"
+#include "osiris.h"
+#include "regs-mem-s3c24xx.h"
+
+/* onboard perihperal map */
+
+static struct map_desc osiris_iodesc[] __initdata = {
+  /* ISA IO areas (may be over-written later) */
+
+  {
+         .virtual      = (u32)S3C24XX_VA_ISA_BYTE,
+         .pfn          = __phys_to_pfn(S3C2410_CS5),
+         .length       = SZ_16M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)S3C24XX_VA_ISA_WORD,
+         .pfn          = __phys_to_pfn(S3C2410_CS5),
+         .length       = SZ_16M,
+         .type         = MT_DEVICE,
+  },
+
+  /* CPLD control registers */
+
+  {
+         .virtual      = (u32)OSIRIS_VA_CTRL0,
+         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL0),
+         .length       = SZ_16K,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)OSIRIS_VA_CTRL1,
+         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL1),
+         .length       = SZ_16K,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)OSIRIS_VA_CTRL2,
+         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL2),
+         .length       = SZ_16K,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)OSIRIS_VA_IDREG,
+         .pfn          = __phys_to_pfn(OSIRIS_PA_IDREG),
+         .length       = SZ_16K,
+         .type         = MT_DEVICE,
+  },
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg osiris_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
+       }
+};
+
+/* NAND Flash on Osiris board */
+
+static int external_map[]   = { 2 };
+static int chip0_map[]      = { 0 };
+static int chip1_map[]      = { 1 };
+
+static struct mtd_partition __initdata osiris_default_nand_part[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_16K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "/boot",
+               .size   = SZ_4M - SZ_16K,
+               .offset = SZ_16K,
+       },
+       [2] = {
+               .name   = "user1",
+               .offset = SZ_4M,
+               .size   = SZ_32M - SZ_4M,
+       },
+       [3] = {
+               .name   = "user2",
+               .offset = SZ_32M,
+               .size   = MTDPART_SIZ_FULL,
+       }
+};
+
+static struct mtd_partition __initdata osiris_default_nand_part_large[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = SZ_128K,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "/boot",
+               .size   = SZ_4M - SZ_128K,
+               .offset = SZ_128K,
+       },
+       [2] = {
+               .name   = "user1",
+               .offset = SZ_4M,
+               .size   = SZ_32M - SZ_4M,
+       },
+       [3] = {
+               .name   = "user2",
+               .offset = SZ_32M,
+               .size   = MTDPART_SIZ_FULL,
+       }
+};
+
+/* the Osiris has 3 selectable slots for nand-flash, the two
+ * on-board chip areas, as well as the external slot.
+ *
+ * Note, there is no current hot-plug support for the External
+ * socket.
+*/
+
+static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
+       [1] = {
+               .name           = "External",
+               .nr_chips       = 1,
+               .nr_map         = external_map,
+               .options        = NAND_SCAN_SILENT_NODEV,
+               .nr_partitions  = ARRAY_SIZE(osiris_default_nand_part),
+               .partitions     = osiris_default_nand_part,
+       },
+       [0] = {
+               .name           = "chip0",
+               .nr_chips       = 1,
+               .nr_map         = chip0_map,
+               .nr_partitions  = ARRAY_SIZE(osiris_default_nand_part),
+               .partitions     = osiris_default_nand_part,
+       },
+       [2] = {
+               .name           = "chip1",
+               .nr_chips       = 1,
+               .nr_map         = chip1_map,
+               .options        = NAND_SCAN_SILENT_NODEV,
+               .nr_partitions  = ARRAY_SIZE(osiris_default_nand_part),
+               .partitions     = osiris_default_nand_part,
+       },
+};
+
+static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
+{
+       unsigned int tmp;
+
+       slot = set->nr_map[slot] & 3;
+
+       pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n",
+                slot, set, set->nr_map);
+
+       tmp = __raw_readb(OSIRIS_VA_CTRL0);
+       tmp &= ~OSIRIS_CTRL0_NANDSEL;
+       tmp |= slot;
+
+       pr_debug("osiris_nand: ctrl0 now %02x\n", tmp);
+
+       __raw_writeb(tmp, OSIRIS_VA_CTRL0);
+}
+
+static struct s3c2410_platform_nand __initdata osiris_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 60,
+       .twrph1         = 60,
+       .nr_sets        = ARRAY_SIZE(osiris_nand_sets),
+       .sets           = osiris_nand_sets,
+       .select_chip    = osiris_nand_select,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+/* PCMCIA control and configuration */
+
+static struct resource osiris_pcmcia_resource[] = {
+       [0] = DEFINE_RES_MEM(0x0f000000, SZ_1M),
+       [1] = DEFINE_RES_MEM(0x0c000000, SZ_1M),
+};
+
+static struct platform_device osiris_pcmcia = {
+       .name           = "osiris-pcmcia",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(osiris_pcmcia_resource),
+       .resource       = osiris_pcmcia_resource,
+};
+
+/* Osiris power management device */
+
+#ifdef CONFIG_PM
+static unsigned char pm_osiris_ctrl0;
+
+static int osiris_pm_suspend(void)
+{
+       unsigned int tmp;
+
+       pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0);
+       tmp = pm_osiris_ctrl0 & ~OSIRIS_CTRL0_NANDSEL;
+
+       /* ensure correct NAND slot is selected on resume */
+       if ((pm_osiris_ctrl0 & OSIRIS_CTRL0_BOOT_INT) == 0)
+               tmp |= 2;
+
+       __raw_writeb(tmp, OSIRIS_VA_CTRL0);
+
+       /* ensure that an nRESET is not generated on resume. */
+       gpio_request_one(S3C2410_GPA(21), GPIOF_OUT_INIT_HIGH, NULL);
+       gpio_free(S3C2410_GPA(21));
+
+       return 0;
+}
+
+static void osiris_pm_resume(void)
+{
+       if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
+               __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
+
+       __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0);
+
+       s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
+}
+
+#else
+#define osiris_pm_suspend NULL
+#define osiris_pm_resume NULL
+#endif
+
+static struct syscore_ops osiris_pm_syscore_ops = {
+       .suspend        = osiris_pm_suspend,
+       .resume         = osiris_pm_resume,
+};
+
+/* Link for DVS driver to TPS65011 */
+
+static void osiris_tps_release(struct device *dev)
+{
+       /* static device, do not need to release anything */
+}
+
+static struct platform_device osiris_tps_device = {
+       .name   = "osiris-dvs",
+       .id     = -1,
+       .dev.release = osiris_tps_release,
+};
+
+static int osiris_tps_setup(struct i2c_client *client, void *context)
+{
+       osiris_tps_device.dev.parent = &client->dev;
+       return platform_device_register(&osiris_tps_device);
+}
+
+static int osiris_tps_remove(struct i2c_client *client, void *context)
+{
+       platform_device_unregister(&osiris_tps_device);
+       return 0;
+}
+
+static struct tps65010_board osiris_tps_board = {
+       .base           = -1,   /* GPIO can go anywhere at the moment */
+       .setup          = osiris_tps_setup,
+       .teardown       = osiris_tps_remove,
+};
+
+/* I2C devices fitted. */
+
+static struct i2c_board_info osiris_i2c_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("tps65011", 0x48),
+               .irq    = IRQ_EINT20,
+               .platform_data = &osiris_tps_board,
+       },
+};
+
+/* Standard Osiris devices */
+
+static struct platform_device *osiris_devices[] __initdata = {
+       &s3c2410_device_dclk,
+       &s3c_device_i2c0,
+       &s3c_device_wdt,
+       &s3c_device_nand,
+       &osiris_pcmcia,
+};
+
+static struct s3c_cpufreq_board __initdata osiris_cpufreq = {
+       .refresh        = 7800, /* refresh period is 7.8usec */
+       .auto_io        = 1,
+       .need_io        = 1,
+};
+
+static void __init osiris_map_io(void)
+{
+       unsigned long flags;
+
+       s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
+       s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+
+       /* check for the newer revision boards with large page nand */
+
+       if ((__raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK) >= 4) {
+               printk(KERN_INFO "OSIRIS-B detected (revision %d)\n",
+                      __raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK);
+               osiris_nand_sets[0].partitions = osiris_default_nand_part_large;
+               osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large);
+       } else {
+               /* write-protect line to the NAND */
+               gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL);
+               gpio_free(S3C2410_GPA(0));
+       }
+
+       /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */
+
+       local_irq_save(flags);
+       __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON);
+       local_irq_restore(flags);
+}
+
+static void __init osiris_init_time(void)
+{
+       s3c2440_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init osiris_init(void)
+{
+       register_syscore_ops(&osiris_pm_syscore_ops);
+
+       s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&osiris_nand_info);
+
+       s3c_cpufreq_setboard(&osiris_cpufreq);
+
+       i2c_register_board_info(0, osiris_i2c_devs,
+                               ARRAY_SIZE(osiris_i2c_devs));
+
+       platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices));
+};
+
+MACHINE_START(OSIRIS, "Simtec-OSIRIS")
+       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
+       .atag_offset    = 0x100,
+       .map_io         = osiris_map_io,
+       .init_irq       = s3c2440_init_irq,
+       .init_machine   = osiris_init,
+       .init_time      = osiris_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-otom.c b/arch/arm/mach-s3c/mach-otom.c
new file mode 100644 (file)
index 0000000..460ee97
--- /dev/null
@@ -0,0 +1,123 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2004 Nex Vision
+//   Guillaume GOURAT <guillaume.gourat@nexvision.fr>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include "cpu.h"
+#include "devs.h"
+
+#include "s3c24xx.h"
+#include "otom.h"
+
+static struct map_desc otom11_iodesc[] __initdata = {
+  /* Device area */
+       { (u32)OTOM_VA_CS8900A_BASE, OTOM_PA_CS8900A_BASE, SZ_16M, MT_DEVICE },
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg otom11_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       /* port 2 is not actually used */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+/* NOR Flash on NexVision OTOM board */
+
+static struct resource otom_nor_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_4M),
+};
+
+static struct platform_device otom_device_nor = {
+       .name           = "mtd-flash",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(otom_nor_resource),
+       .resource       = otom_nor_resource,
+};
+
+/* Standard OTOM devices */
+
+static struct platform_device *otom11_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_rtc,
+       &otom_device_nor,
+};
+
+static void __init otom11_map_io(void)
+{
+       s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
+       s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init otom11_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init otom11_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices));
+}
+
+MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
+       /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
+       .atag_offset    = 0x100,
+       .map_io         = otom11_map_io,
+       .init_machine   = otom11_init,
+       .init_irq       = s3c2410_init_irq,
+       .init_time      = otom11_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-qt2410.c b/arch/arm/mach-s3c/mach-qt2410.c
new file mode 100644 (file)
index 0000000..9a4212e
--- /dev/null
@@ -0,0 +1,374 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2006 by OpenMoko, Inc.
+// Author: Harald Welte <laforge@openmoko.org>
+// All rights reserved.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/leds-s3c24xx.h>
+#include <linux/platform_data/fb-s3c2410.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "gpio-samsung.h"
+
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
+
+static struct map_desc qt2410_iodesc[] __initdata = {
+       { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+/* LCD driver info */
+
+static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
+       {
+               /* Configuration for 640x480 SHARP LQ080V3DG01 */
+               .lcdcon5 = S3C2410_LCDCON5_FRM565 |
+                          S3C2410_LCDCON5_INVVLINE |
+                          S3C2410_LCDCON5_INVVFRAME |
+                          S3C2410_LCDCON5_PWREN |
+                          S3C2410_LCDCON5_HWSWP,
+
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 640,
+               .height         = 480,
+
+               .pixclock       = 40000, /* HCLK/4 */
+               .xres           = 640,
+               .yres           = 480,
+               .bpp            = 16,
+               .left_margin    = 44,
+               .right_margin   = 116,
+               .hsync_len      = 96,
+               .upper_margin   = 19,
+               .lower_margin   = 11,
+               .vsync_len      = 15,
+       },
+       {
+               /* Configuration for 480x640 toppoly TD028TTEC1 */
+               .lcdcon5 = S3C2410_LCDCON5_FRM565 |
+                          S3C2410_LCDCON5_INVVLINE |
+                          S3C2410_LCDCON5_INVVFRAME |
+                          S3C2410_LCDCON5_PWREN |
+                          S3C2410_LCDCON5_HWSWP,
+
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 480,
+               .height         = 640,
+               .pixclock       = 40000, /* HCLK/4 */
+               .xres           = 480,
+               .yres           = 640,
+               .bpp            = 16,
+               .left_margin    = 8,
+               .right_margin   = 24,
+               .hsync_len      = 8,
+               .upper_margin   = 2,
+               .lower_margin   = 4,
+               .vsync_len      = 2,
+       },
+       {
+               /* Config for 240x320 LCD */
+               .lcdcon5 = S3C2410_LCDCON5_FRM565 |
+                          S3C2410_LCDCON5_INVVLINE |
+                          S3C2410_LCDCON5_INVVFRAME |
+                          S3C2410_LCDCON5_PWREN |
+                          S3C2410_LCDCON5_HWSWP,
+
+               .type           = S3C2410_LCDCON1_TFT,
+               .width          = 240,
+               .height         = 320,
+               .pixclock       = 100000, /* HCLK/10 */
+               .xres           = 240,
+               .yres           = 320,
+               .bpp            = 16,
+               .left_margin    = 13,
+               .right_margin   = 8,
+               .hsync_len      = 4,
+               .upper_margin   = 2,
+               .lower_margin   = 7,
+               .vsync_len      = 4,
+       },
+};
+
+
+static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
+       .displays       = qt2410_lcd_cfg,
+       .num_displays   = ARRAY_SIZE(qt2410_lcd_cfg),
+       .default_display = 0,
+
+       .lpcsel         = ((0xCE6) & ~7) | 1<<4,
+};
+
+/* CS8900 */
+
+static struct resource qt2410_cs89x0_resources[] = {
+       [0] = DEFINE_RES_MEM(0x19000000, 17),
+       [1] = DEFINE_RES_IRQ(IRQ_EINT9),
+};
+
+static struct platform_device qt2410_cs89x0 = {
+       .name           = "cirrus-cs89x0",
+       .num_resources  = ARRAY_SIZE(qt2410_cs89x0_resources),
+       .resource       = qt2410_cs89x0_resources,
+};
+
+/* LED */
+
+static struct gpiod_lookup_table qt2410_led_gpio_table = {
+       .dev_id = "s3c24xx_led.0",
+       .table = {
+               GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata qt2410_pdata_led = {
+       .name           = "led",
+       .def_trigger    = "timer",
+};
+
+static struct platform_device qt2410_led = {
+       .name           = "s3c24xx_led",
+       .id             = 0,
+       .dev            = {
+               .platform_data = &qt2410_pdata_led,
+       },
+};
+
+/* SPI */
+
+static struct spi_gpio_platform_data spi_gpio_cfg = {
+       .num_chipselect = 1,
+};
+
+static struct platform_device qt2410_spi = {
+       .name           = "spi_gpio",
+       .id             = 1,
+       .dev.platform_data = &spi_gpio_cfg,
+};
+
+static struct gpiod_lookup_table qt2410_spi_gpiod_table = {
+       .dev_id         = "spi_gpio",
+       .table          = {
+               GPIO_LOOKUP("GPIOG", 7,
+                           "sck", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOG", 6,
+                           "mosi", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOG", 5,
+                           "miso", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOB", 5,
+                           "cs", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table qt2410_mmc_gpiod_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+/* Board devices */
+
+static struct platform_device *qt2410_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_sdi,
+       &s3c_device_usbgadget,
+       &qt2410_spi,
+       &qt2410_cs89x0,
+       &qt2410_led,
+};
+
+static struct mtd_partition __initdata qt2410_nand_part[] = {
+       [0] = {
+               .name   = "U-Boot",
+               .size   = 0x30000,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "U-Boot environment",
+               .offset = 0x30000,
+               .size   = 0x4000,
+       },
+       [2] = {
+               .name   = "kernel",
+               .offset = 0x34000,
+               .size   = SZ_2M,
+       },
+       [3] = {
+               .name   = "initrd",
+               .offset = 0x234000,
+               .size   = SZ_4M,
+       },
+       [4] = {
+               .name   = "jffs2",
+               .offset = 0x634000,
+               .size   = 0x39cc000,
+       },
+};
+
+static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
+       [0] = {
+               .name           = "NAND",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(qt2410_nand_part),
+               .partitions     = qt2410_nand_part,
+       },
+};
+
+/* choose a set of timings which should suit most 512Mbit
+ * chips and beyond.
+ */
+
+static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
+       .tacls          = 20,
+       .twrph0         = 60,
+       .twrph1         = 20,
+       .nr_sets        = ARRAY_SIZE(qt2410_nand_sets),
+       .sets           = qt2410_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+/* UDC */
+
+static struct s3c2410_udc_mach_info qt2410_udc_cfg = {
+};
+
+static char tft_type = 's';
+
+static int __init qt2410_tft_setup(char *str)
+{
+       tft_type = str[0];
+       return 1;
+}
+
+__setup("tft=", qt2410_tft_setup);
+
+static void __init qt2410_map_io(void)
+{
+       s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
+       s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init qt2410_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init qt2410_machine_init(void)
+{
+       s3c_nand_set_platdata(&qt2410_nand_info);
+
+       switch (tft_type) {
+       case 'p': /* production */
+               qt2410_fb_info.default_display = 1;
+               break;
+       case 'b': /* big */
+               qt2410_fb_info.default_display = 0;
+               break;
+       case 's': /* small */
+       default:
+               qt2410_fb_info.default_display = 2;
+               break;
+       }
+       s3c24xx_fb_set_platdata(&qt2410_fb_info);
+
+       /* set initial state of the LED GPIO */
+       WARN_ON(gpio_request_one(S3C2410_GPB(0), GPIOF_OUT_INIT_HIGH, NULL));
+       gpio_free(S3C2410_GPB(0));
+
+       s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
+       s3c_i2c0_set_platdata(NULL);
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       gpiod_add_lookup_table(&qt2410_spi_gpiod_table);
+       s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
+       gpiod_add_lookup_table(&qt2410_led_gpio_table);
+       gpiod_add_lookup_table(&qt2410_mmc_gpiod_table);
+       platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
+       s3c_pm_init();
+}
+
+MACHINE_START(QT2410, "QT2410")
+       .atag_offset    = 0x100,
+       .map_io         = qt2410_map_io,
+       .init_irq       = s3c2410_init_irq,
+       .init_machine   = qt2410_machine_init,
+       .init_time      = qt2410_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-real6410.c b/arch/arm/mach-s3c/mach-real6410.c
new file mode 100644 (file)
index 0000000..147e660
--- /dev/null
@@ -0,0 +1,333 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2010 Darius Augulis <augulis.darius@gmail.com>
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/dm9000.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/types.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <mach/irqs.h>
+
+#include <linux/soc/samsung/s3c-adc.h>
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/touchscreen-s3c2410.h>
+
+#include <video/platform_lcd.h>
+#include <video/samsung_fimd.h>
+
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-srom-s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg real6410_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport = 0,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+       [1] = {
+               .hwport = 1,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+       [2] = {
+               .hwport = 2,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+       [3] = {
+               .hwport = 3,
+               .flags  = 0,
+               .ucon   = UCON,
+               .ulcon  = ULCON,
+               .ufcon  = UFCON,
+       },
+};
+
+/* DM9000AEP 10/100 ethernet controller */
+
+static struct resource real6410_dm9k_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
+       [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
+       [2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
+                                       | IORESOURCE_IRQ_HIGHLEVEL),
+};
+
+static struct dm9000_plat_data real6410_dm9k_pdata = {
+       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
+};
+
+static struct platform_device real6410_device_eth = {
+       .name           = "dm9000",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(real6410_dm9k_resource),
+       .resource       = real6410_dm9k_resource,
+       .dev            = {
+               .platform_data  = &real6410_dm9k_pdata,
+       },
+};
+
+static struct s3c_fb_pd_win real6410_lcd_type0_fb_win = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 480,
+       .yres           = 272,
+};
+
+static struct fb_videomode real6410_lcd_type0_timing = {
+       /* 4.3" 480x272 */
+       .left_margin    = 3,
+       .right_margin   = 2,
+       .upper_margin   = 1,
+       .lower_margin   = 1,
+       .hsync_len      = 40,
+       .vsync_len      = 1,
+};
+
+static struct s3c_fb_pd_win real6410_lcd_type1_fb_win = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct fb_videomode real6410_lcd_type1_timing = {
+       /* 7.0" 800x480 */
+       .left_margin    = 8,
+       .right_margin   = 13,
+       .upper_margin   = 7,
+       .lower_margin   = 5,
+       .hsync_len      = 3,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct s3c_fb_platdata real6410_lcd_pdata[] __initdata = {
+       {
+               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+               .vtiming        = &real6410_lcd_type0_timing,
+               .win[0]         = &real6410_lcd_type0_fb_win,
+               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+       }, {
+               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+               .vtiming        = &real6410_lcd_type1_timing,
+               .win[0]         = &real6410_lcd_type1_fb_win,
+               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+       },
+       { },
+};
+
+static struct mtd_partition real6410_nand_part[] = {
+       [0] = {
+               .name   = "uboot",
+               .size   = SZ_1M,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "kernel",
+               .size   = SZ_2M,
+               .offset = SZ_1M,
+       },
+       [2] = {
+               .name   = "rootfs",
+               .size   = MTDPART_SIZ_FULL,
+               .offset = SZ_1M + SZ_2M,
+       },
+};
+
+static struct s3c2410_nand_set real6410_nand_sets[] = {
+       [0] = {
+               .name           = "nand",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(real6410_nand_part),
+               .partitions     = real6410_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand real6410_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 55,
+       .twrph1         = 40,
+       .nr_sets        = ARRAY_SIZE(real6410_nand_sets),
+       .sets           = real6410_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+static struct platform_device *real6410_devices[] __initdata = {
+       &real6410_device_eth,
+       &s3c_device_hsmmc0,
+       &s3c_device_hsmmc1,
+       &s3c_device_fb,
+       &s3c_device_nand,
+       &s3c_device_adc,
+       &s3c_device_ohci,
+};
+
+static void __init real6410_map_io(void)
+{
+       u32 tmp;
+
+       s3c64xx_init_io(NULL, 0);
+       s3c24xx_init_clocks(12000000);
+       s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+
+       /* set the LCD type */
+       tmp = __raw_readl(S3C64XX_SPCON);
+       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
+       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
+       __raw_writel(tmp, S3C64XX_SPCON);
+
+       /* remove the LCD bypass */
+       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
+       tmp &= ~MIFPCON_LCD_BYPASS;
+       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
+}
+
+/*
+ * real6410_features string
+ *
+ * 0-9 LCD configuration
+ *
+ */
+static char real6410_features_str[12] __initdata = "0";
+
+static int __init real6410_features_setup(char *str)
+{
+       if (str)
+               strlcpy(real6410_features_str, str,
+                       sizeof(real6410_features_str));
+       return 1;
+}
+
+__setup("real6410=", real6410_features_setup);
+
+#define FEATURE_SCREEN (1 << 0)
+
+struct real6410_features_t {
+       int done;
+       int lcd_index;
+};
+
+static void real6410_parse_features(
+               struct real6410_features_t *features,
+               const char *features_str)
+{
+       const char *fp = features_str;
+
+       features->done = 0;
+       features->lcd_index = 0;
+
+       while (*fp) {
+               char f = *fp++;
+
+               switch (f) {
+               case '0'...'9': /* tft screen */
+                       if (features->done & FEATURE_SCREEN) {
+                               printk(KERN_INFO "REAL6410: '%c' ignored, "
+                                       "screen type already set\n", f);
+                       } else {
+                               int li = f - '0';
+                               if (li >= ARRAY_SIZE(real6410_lcd_pdata))
+                                       printk(KERN_INFO "REAL6410: '%c' out "
+                                               "of range LCD mode\n", f);
+                               else {
+                                       features->lcd_index = li;
+                               }
+                       }
+                       features->done |= FEATURE_SCREEN;
+                       break;
+               }
+       }
+}
+
+static void __init real6410_machine_init(void)
+{
+       u32 cs1;
+       struct real6410_features_t features = { 0 };
+
+       printk(KERN_INFO "REAL6410: Option string real6410=%s\n",
+                       real6410_features_str);
+
+       /* Parse the feature string */
+       real6410_parse_features(&features, real6410_features_str);
+
+       printk(KERN_INFO "REAL6410: selected LCD display is %dx%d\n",
+               real6410_lcd_pdata[features.lcd_index].win[0]->xres,
+               real6410_lcd_pdata[features.lcd_index].win[0]->yres);
+
+       s3c_fb_set_platdata(&real6410_lcd_pdata[features.lcd_index]);
+       s3c_nand_set_platdata(&real6410_nand_info);
+       s3c64xx_ts_set_platdata(NULL);
+
+       /* configure nCS1 width to 16 bits */
+
+       cs1 = __raw_readl(S3C64XX_SROM_BW) &
+               ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
+       cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
+               (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
+               (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
+                       S3C64XX_SROM_BW__NCS1__SHIFT;
+       __raw_writel(cs1, S3C64XX_SROM_BW);
+
+       /* set timing for nCS1 suitable for ethernet chip */
+
+       __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
+               (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
+               (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
+               (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
+               (13 << S3C64XX_SROM_BCX__TACC__SHIFT) |
+               (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
+               (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
+
+       gpio_request(S3C64XX_GPF(15), "LCD power");
+
+       platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices));
+}
+
+MACHINE_START(REAL6410, "REAL6410")
+       /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = real6410_map_io,
+       .init_machine   = real6410_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-rx1950.c b/arch/arm/mach-s3c/mach-rx1950.c
new file mode 100644 (file)
index 0000000..4df7a54
--- /dev/null
@@ -0,0 +1,867 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev,
+// Copyright (c) 2007-2010 Vasily Khoruzhick
+//
+// based on smdk2440 written by Ben Dooks
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/memblock.h>
+#include <linux/delay.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+#include <linux/device.h>
+#include <linux/pda_power.h>
+#include <linux/pwm_backlight.h>
+#include <linux/pwm.h>
+#include <linux/s3c_adc_battery.h>
+#include <linux/leds.h>
+#include <linux/i2c.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+#include <linux/mmc/host.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/mmc-s3cmci.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/touchscreen-s3c2410.h>
+#include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/fb-s3c2410.h>
+
+#include <sound/uda1380.h>
+
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+#include "gpio-cfg.h"
+
+#include "s3c24xx.h"
+#include "h1940.h"
+
+#define LCD_PWM_PERIOD 192960
+#define LCD_PWM_DUTY 127353
+
+static struct map_desc rx1950_iodesc[] __initdata = {
+};
+
+static struct s3c2410_uartcfg rx1950_uartcfgs[] __initdata = {
+       [0] = {
+              .hwport = 0,
+              .flags = 0,
+              .ucon = 0x3c5,
+              .ulcon = 0x03,
+              .ufcon = 0x51,
+               .clk_sel = S3C2410_UCON_CLKSEL3,
+       },
+       [1] = {
+              .hwport = 1,
+              .flags = 0,
+              .ucon = 0x3c5,
+              .ulcon = 0x03,
+              .ufcon = 0x51,
+               .clk_sel = S3C2410_UCON_CLKSEL3,
+       },
+       /* IR port */
+       [2] = {
+              .hwport = 2,
+              .flags = 0,
+              .ucon = 0x3c5,
+              .ulcon = 0x43,
+              .ufcon = 0xf1,
+               .clk_sel = S3C2410_UCON_CLKSEL3,
+       },
+};
+
+static struct s3c2410fb_display rx1950_display = {
+       .type = S3C2410_LCDCON1_TFT,
+       .width = 240,
+       .height = 320,
+       .xres = 240,
+       .yres = 320,
+       .bpp = 16,
+
+       .pixclock = 260000,
+       .left_margin = 10,
+       .right_margin = 20,
+       .hsync_len = 10,
+       .upper_margin = 2,
+       .lower_margin = 2,
+       .vsync_len = 2,
+
+       .lcdcon5 = S3C2410_LCDCON5_FRM565 |
+                          S3C2410_LCDCON5_INVVCLK |
+                          S3C2410_LCDCON5_INVVLINE |
+                          S3C2410_LCDCON5_INVVFRAME |
+                          S3C2410_LCDCON5_HWSWP |
+                          (0x02 << 13) |
+                          (0x02 << 15),
+
+};
+
+static int power_supply_init(struct device *dev)
+{
+       return gpio_request(S3C2410_GPF(2), "cable plugged");
+}
+
+static int rx1950_is_ac_online(void)
+{
+       return !gpio_get_value(S3C2410_GPF(2));
+}
+
+static void power_supply_exit(struct device *dev)
+{
+       gpio_free(S3C2410_GPF(2));
+}
+
+static char *rx1950_supplicants[] = {
+       "main-battery"
+};
+
+static struct pda_power_pdata power_supply_info = {
+       .init                   = power_supply_init,
+       .is_ac_online           = rx1950_is_ac_online,
+       .exit                   = power_supply_exit,
+       .supplied_to            = rx1950_supplicants,
+       .num_supplicants        = ARRAY_SIZE(rx1950_supplicants),
+};
+
+static struct resource power_supply_resources[] = {
+       [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
+                       | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
+};
+
+static struct platform_device power_supply = {
+       .name                   = "pda-power",
+       .id                     = -1,
+       .dev                    = {
+                                       .platform_data =
+                                               &power_supply_info,
+       },
+       .resource               = power_supply_resources,
+       .num_resources          = ARRAY_SIZE(power_supply_resources),
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
+       { .volt = 4100, .cur = 156, .level = 100},
+       { .volt = 4050, .cur = 156, .level = 95},
+       { .volt = 4025, .cur = 141, .level = 90},
+       { .volt = 3995, .cur = 144, .level = 85},
+       { .volt = 3957, .cur = 162, .level = 80},
+       { .volt = 3931, .cur = 147, .level = 75},
+       { .volt = 3902, .cur = 147, .level = 70},
+       { .volt = 3863, .cur = 153, .level = 65},
+       { .volt = 3838, .cur = 150, .level = 60},
+       { .volt = 3800, .cur = 153, .level = 55},
+       { .volt = 3765, .cur = 153, .level = 50},
+       { .volt = 3748, .cur = 172, .level = 45},
+       { .volt = 3740, .cur = 153, .level = 40},
+       { .volt = 3714, .cur = 175, .level = 35},
+       { .volt = 3710, .cur = 156, .level = 30},
+       { .volt = 3963, .cur = 156, .level = 25},
+       { .volt = 3672, .cur = 178, .level = 20},
+       { .volt = 3651, .cur = 178, .level = 15},
+       { .volt = 3629, .cur = 178, .level = 10},
+       { .volt = 3612, .cur = 162, .level = 5},
+       { .volt = 3605, .cur = 162, .level = 0},
+};
+
+static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
+       { .volt = 4200, .cur = 0, .level = 100},
+       { .volt = 4190, .cur = 0, .level = 99},
+       { .volt = 4178, .cur = 0, .level = 95},
+       { .volt = 4110, .cur = 0, .level = 70},
+       { .volt = 4076, .cur = 0, .level = 65},
+       { .volt = 4046, .cur = 0, .level = 60},
+       { .volt = 4021, .cur = 0, .level = 55},
+       { .volt = 3999, .cur = 0, .level = 50},
+       { .volt = 3982, .cur = 0, .level = 45},
+       { .volt = 3965, .cur = 0, .level = 40},
+       { .volt = 3957, .cur = 0, .level = 35},
+       { .volt = 3948, .cur = 0, .level = 30},
+       { .volt = 3936, .cur = 0, .level = 25},
+       { .volt = 3927, .cur = 0, .level = 20},
+       { .volt = 3906, .cur = 0, .level = 15},
+       { .volt = 3880, .cur = 0, .level = 10},
+       { .volt = 3829, .cur = 0, .level = 5},
+       { .volt = 3820, .cur = 0, .level = 0},
+};
+
+static int rx1950_bat_init(void)
+{
+       int ret;
+
+       ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1");
+       if (ret)
+               goto err_gpio1;
+       ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2");
+       if (ret)
+               goto err_gpio2;
+
+       return 0;
+
+err_gpio2:
+       gpio_free(S3C2410_GPJ(2));
+err_gpio1:
+       return ret;
+}
+
+static void rx1950_bat_exit(void)
+{
+       gpio_free(S3C2410_GPJ(2));
+       gpio_free(S3C2410_GPJ(3));
+}
+
+static void rx1950_enable_charger(void)
+{
+       gpio_direction_output(S3C2410_GPJ(2), 1);
+       gpio_direction_output(S3C2410_GPJ(3), 1);
+}
+
+static void rx1950_disable_charger(void)
+{
+       gpio_direction_output(S3C2410_GPJ(2), 0);
+       gpio_direction_output(S3C2410_GPJ(3), 0);
+}
+
+static DEFINE_SPINLOCK(rx1950_blink_spin);
+
+static int rx1950_led_blink_set(struct gpio_desc *desc, int state,
+       unsigned long *delay_on, unsigned long *delay_off)
+{
+       int gpio = desc_to_gpio(desc);
+       int blink_gpio, check_gpio;
+
+       switch (gpio) {
+       case S3C2410_GPA(6):
+               blink_gpio = S3C2410_GPA(4);
+               check_gpio = S3C2410_GPA(3);
+               break;
+       case S3C2410_GPA(7):
+               blink_gpio = S3C2410_GPA(3);
+               check_gpio = S3C2410_GPA(4);
+               break;
+       default:
+               return -EINVAL;
+               break;
+       }
+
+       if (delay_on && delay_off && !*delay_on && !*delay_off)
+               *delay_on = *delay_off = 500;
+
+       spin_lock(&rx1950_blink_spin);
+
+       switch (state) {
+       case GPIO_LED_NO_BLINK_LOW:
+       case GPIO_LED_NO_BLINK_HIGH:
+               if (!gpio_get_value(check_gpio))
+                       gpio_set_value(S3C2410_GPJ(6), 0);
+               gpio_set_value(blink_gpio, 0);
+               gpio_set_value(gpio, state);
+               break;
+       case GPIO_LED_BLINK:
+               gpio_set_value(gpio, 0);
+               gpio_set_value(S3C2410_GPJ(6), 1);
+               gpio_set_value(blink_gpio, 1);
+               break;
+       }
+
+       spin_unlock(&rx1950_blink_spin);
+
+       return 0;
+}
+
+static struct gpio_led rx1950_leds_desc[] = {
+       {
+               .name                   = "Green",
+               .default_trigger        = "main-battery-full",
+               .gpio                   = S3C2410_GPA(6),
+               .retain_state_suspended = 1,
+       },
+       {
+               .name                   = "Red",
+               .default_trigger
+                       = "main-battery-charging-blink-full-solid",
+               .gpio                   = S3C2410_GPA(7),
+               .retain_state_suspended = 1,
+       },
+       {
+               .name                   = "Blue",
+               .default_trigger        = "rx1950-acx-mem",
+               .gpio                   = S3C2410_GPA(11),
+               .retain_state_suspended = 1,
+       },
+};
+
+static struct gpio_led_platform_data rx1950_leds_pdata = {
+       .num_leds       = ARRAY_SIZE(rx1950_leds_desc),
+       .leds           = rx1950_leds_desc,
+       .gpio_blink_set = rx1950_led_blink_set,
+};
+
+static struct platform_device rx1950_leds = {
+       .name   = "leds-gpio",
+       .id             = -1,
+       .dev    = {
+                               .platform_data = &rx1950_leds_pdata,
+       },
+};
+
+static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
+       .init = rx1950_bat_init,
+       .exit = rx1950_bat_exit,
+       .enable_charger = rx1950_enable_charger,
+       .disable_charger = rx1950_disable_charger,
+       .gpio_charge_finished = S3C2410_GPF(3),
+       .lut_noac = bat_lut_noac,
+       .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
+       .lut_acin = bat_lut_acin,
+       .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
+       .volt_channel = 0,
+       .current_channel = 1,
+       .volt_mult = 4235,
+       .current_mult = 2900,
+       .internal_impedance = 200,
+};
+
+static struct platform_device rx1950_battery = {
+       .name             = "s3c-adc-battery",
+       .id               = -1,
+       .dev = {
+               .parent = &s3c_device_adc.dev,
+               .platform_data = &rx1950_bat_cfg,
+       },
+};
+
+static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
+       .displays = &rx1950_display,
+       .num_displays = 1,
+       .default_display = 0,
+
+       .lpcsel = 0x02,
+       .gpccon = 0xaa9556a9,
+       .gpccon_mask = 0xffc003fc,
+       .gpccon_reg = S3C2410_GPCCON,
+       .gpcup = 0x0000ffff,
+       .gpcup_mask = 0xffffffff,
+       .gpcup_reg = S3C2410_GPCUP,
+
+       .gpdcon = 0xaa90aaa1,
+       .gpdcon_mask = 0xffc0fff0,
+       .gpdcon_reg = S3C2410_GPDCON,
+       .gpdup = 0x0000fcfd,
+       .gpdup_mask = 0xffffffff,
+       .gpdup_reg = S3C2410_GPDUP,
+};
+
+static struct pwm_lookup rx1950_pwm_lookup[] = {
+       PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
+                  PWM_POLARITY_NORMAL),
+};
+
+static struct pwm_device *lcd_pwm;
+static struct pwm_state lcd_pwm_state;
+
+static void rx1950_lcd_power(int enable)
+{
+       int i;
+       static int enabled;
+       if (enabled == enable)
+               return;
+       if (!enable) {
+
+               /* GPC11-GPC15->OUTPUT */
+               for (i = 11; i < 16; i++)
+                       gpio_direction_output(S3C2410_GPC(i), 1);
+
+               /* Wait a bit here... */
+               mdelay(100);
+
+               /* GPD2-GPD7->OUTPUT */
+               /* GPD11-GPD15->OUTPUT */
+               /* GPD2-GPD7->1, GPD11-GPD15->1 */
+               for (i = 2; i < 8; i++)
+                       gpio_direction_output(S3C2410_GPD(i), 1);
+               for (i = 11; i < 16; i++)
+                       gpio_direction_output(S3C2410_GPD(i), 1);
+
+               /* Wait a bit here...*/
+               mdelay(100);
+
+               /* GPB0->OUTPUT, GPB0->0 */
+               gpio_direction_output(S3C2410_GPB(0), 0);
+
+               /* GPC1-GPC4->OUTPUT, GPC1-4->0 */
+               for (i = 1; i < 5; i++)
+                       gpio_direction_output(S3C2410_GPC(i), 0);
+
+               /* GPC15-GPC11->0 */
+               for (i = 11; i < 16; i++)
+                       gpio_direction_output(S3C2410_GPC(i), 0);
+
+               /* GPD15-GPD11->0, GPD2->GPD7->0 */
+               for (i = 11; i < 16; i++)
+                       gpio_direction_output(S3C2410_GPD(i), 0);
+
+               for (i = 2; i < 8; i++)
+                       gpio_direction_output(S3C2410_GPD(i), 0);
+
+               /* GPC6->0, GPC7->0, GPC5->0 */
+               gpio_direction_output(S3C2410_GPC(6), 0);
+               gpio_direction_output(S3C2410_GPC(7), 0);
+               gpio_direction_output(S3C2410_GPC(5), 0);
+
+               /* GPB1->OUTPUT, GPB1->0 */
+               gpio_direction_output(S3C2410_GPB(1), 0);
+
+               lcd_pwm_state.enabled = false;
+               pwm_apply_state(lcd_pwm, &lcd_pwm_state);
+
+               /* GPC0->0, GPC10->0 */
+               gpio_direction_output(S3C2410_GPC(0), 0);
+               gpio_direction_output(S3C2410_GPC(10), 0);
+       } else {
+               lcd_pwm_state.enabled = true;
+               pwm_apply_state(lcd_pwm, &lcd_pwm_state);
+
+               gpio_direction_output(S3C2410_GPC(0), 1);
+               gpio_direction_output(S3C2410_GPC(5), 1);
+
+               s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1);
+               gpio_direction_output(S3C2410_GPC(7), 1);
+
+               for (i = 1; i < 5; i++)
+                       s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
+
+               for (i = 11; i < 16; i++)
+                       s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
+
+               for (i = 2; i < 8; i++)
+                       s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
+
+               for (i = 11; i < 16; i++)
+                       s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
+
+               gpio_direction_output(S3C2410_GPC(10), 1);
+               gpio_direction_output(S3C2410_GPC(6), 1);
+       }
+       enabled = enable;
+}
+
+static void rx1950_bl_power(int enable)
+{
+       static int enabled;
+       if (enabled == enable)
+               return;
+       if (!enable) {
+                       gpio_direction_output(S3C2410_GPB(0), 0);
+       } else {
+                       /* LED driver need a "push" to power on */
+                       gpio_direction_output(S3C2410_GPB(0), 1);
+                       /* Warm up backlight for one period of PWM.
+                        * Without this trick its almost impossible to
+                        * enable backlight with low brightness value
+                        */
+                       ndelay(48000);
+                       s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+       }
+       enabled = enable;
+}
+
+static int rx1950_backlight_init(struct device *dev)
+{
+       WARN_ON(gpio_request(S3C2410_GPB(0), "Backlight"));
+       lcd_pwm = pwm_request(1, "RX1950 LCD");
+       if (IS_ERR(lcd_pwm)) {
+               dev_err(dev, "Unable to request PWM for LCD power!\n");
+               return PTR_ERR(lcd_pwm);
+       }
+
+       /*
+        * This is only required to initialize .polarity; all other values are
+        * fixed in this driver.
+        */
+       pwm_init_state(lcd_pwm, &lcd_pwm_state);
+
+       lcd_pwm_state.period = LCD_PWM_PERIOD;
+       lcd_pwm_state.duty_cycle = LCD_PWM_DUTY;
+
+       rx1950_lcd_power(1);
+       rx1950_bl_power(1);
+
+       return 0;
+}
+
+static void rx1950_backlight_exit(struct device *dev)
+{
+       rx1950_bl_power(0);
+       rx1950_lcd_power(0);
+
+       pwm_free(lcd_pwm);
+       gpio_free(S3C2410_GPB(0));
+}
+
+
+static int rx1950_backlight_notify(struct device *dev, int brightness)
+{
+       if (!brightness) {
+               rx1950_bl_power(0);
+               rx1950_lcd_power(0);
+       } else {
+               rx1950_lcd_power(1);
+               rx1950_bl_power(1);
+       }
+       return brightness;
+}
+
+static struct platform_pwm_backlight_data rx1950_backlight_data = {
+       .max_brightness = 24,
+       .dft_brightness = 4,
+       .init = rx1950_backlight_init,
+       .notify = rx1950_backlight_notify,
+       .exit = rx1950_backlight_exit,
+};
+
+static struct platform_device rx1950_backlight = {
+       .name = "pwm-backlight",
+       .dev = {
+               .parent = &samsung_device_pwm.dev,
+               .platform_data = &rx1950_backlight_data,
+       },
+};
+
+static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd)
+{
+       s3c24xx_mci_def_set_power(power_mode, vdd);
+
+       switch (power_mode) {
+       case MMC_POWER_OFF:
+               gpio_direction_output(S3C2410_GPJ(1), 0);
+               break;
+       case MMC_POWER_UP:
+       case MMC_POWER_ON:
+               gpio_direction_output(S3C2410_GPJ(1), 1);
+               break;
+       default:
+               break;
+       }
+}
+
+static struct s3c24xx_mci_pdata rx1950_mmc_cfg __initdata = {
+       .set_power = rx1950_set_mmc_power,
+       .ocr_avail = MMC_VDD_32_33,
+};
+
+static struct gpiod_lookup_table rx1950_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* Card detect S3C2410_GPF(5) */
+               GPIO_LOOKUP("GPIOF", 5, "cd", GPIO_ACTIVE_LOW),
+               /* Write protect S3C2410_GPH(8) */
+               GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW),
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct mtd_partition rx1950_nand_part[] = {
+       [0] = {
+                       .name = "Boot0",
+                       .offset = 0,
+                       .size = 0x4000,
+                       .mask_flags = MTD_WRITEABLE,
+       },
+       [1] = {
+                       .name = "Boot1",
+                       .offset = MTDPART_OFS_APPEND,
+                       .size = 0x40000,
+                       .mask_flags = MTD_WRITEABLE,
+       },
+       [2] = {
+                       .name = "Kernel",
+                       .offset = MTDPART_OFS_APPEND,
+                       .size = 0x300000,
+                       .mask_flags = 0,
+       },
+       [3] = {
+                       .name = "Filesystem",
+                       .offset = MTDPART_OFS_APPEND,
+                       .size = MTDPART_SIZ_FULL,
+                       .mask_flags = 0,
+       },
+};
+
+static struct s3c2410_nand_set rx1950_nand_sets[] = {
+       [0] = {
+                       .name = "Internal",
+                       .nr_chips = 1,
+                       .nr_partitions = ARRAY_SIZE(rx1950_nand_part),
+                       .partitions = rx1950_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand rx1950_nand_info = {
+       .tacls = 25,
+       .twrph0 = 50,
+       .twrph1 = 15,
+       .nr_sets = ARRAY_SIZE(rx1950_nand_sets),
+       .sets = rx1950_nand_sets,
+       .ecc_mode = NAND_ECC_SOFT,
+};
+
+static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = {
+       .vbus_pin = S3C2410_GPG(5),
+       .vbus_pin_inverted = 1,
+       .pullup_pin = S3C2410_GPJ(5),
+};
+
+static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = {
+       .delay = 10000,
+       .presc = 49,
+       .oversampling_shift = 3,
+};
+
+static struct gpio_keys_button rx1950_gpio_keys_table[] = {
+       {
+               .code           = KEY_POWER,
+               .gpio           = S3C2410_GPF(0),
+               .active_low     = 1,
+               .desc           = "Power button",
+               .wakeup         = 1,
+       },
+       {
+               .code           = KEY_F5,
+               .gpio           = S3C2410_GPF(7),
+               .active_low     = 1,
+               .desc           = "Record button",
+       },
+       {
+               .code           = KEY_F1,
+               .gpio           = S3C2410_GPG(0),
+               .active_low     = 1,
+               .desc           = "Calendar button",
+       },
+       {
+               .code           = KEY_F2,
+               .gpio           = S3C2410_GPG(2),
+               .active_low     = 1,
+               .desc           = "Contacts button",
+       },
+       {
+               .code           = KEY_F3,
+               .gpio           = S3C2410_GPG(3),
+               .active_low     = 1,
+               .desc           = "Mail button",
+       },
+       {
+               .code           = KEY_F4,
+               .gpio           = S3C2410_GPG(7),
+               .active_low     = 1,
+               .desc           = "WLAN button",
+       },
+       {
+               .code           = KEY_LEFT,
+               .gpio           = S3C2410_GPG(10),
+               .active_low     = 1,
+               .desc           = "Left button",
+       },
+       {
+               .code           = KEY_RIGHT,
+               .gpio           = S3C2410_GPG(11),
+               .active_low     = 1,
+               .desc           = "Right button",
+       },
+       {
+               .code           = KEY_UP,
+               .gpio           = S3C2410_GPG(4),
+               .active_low     = 1,
+               .desc           = "Up button",
+       },
+       {
+               .code           = KEY_DOWN,
+               .gpio           = S3C2410_GPG(6),
+               .active_low     = 1,
+               .desc           = "Down button",
+       },
+       {
+               .code           = KEY_ENTER,
+               .gpio           = S3C2410_GPG(9),
+               .active_low     = 1,
+               .desc           = "Ok button"
+       },
+};
+
+static struct gpio_keys_platform_data rx1950_gpio_keys_data = {
+       .buttons = rx1950_gpio_keys_table,
+       .nbuttons = ARRAY_SIZE(rx1950_gpio_keys_table),
+};
+
+static struct platform_device rx1950_device_gpiokeys = {
+       .name = "gpio-keys",
+       .dev.platform_data = &rx1950_gpio_keys_data,
+};
+
+static struct uda1380_platform_data uda1380_info = {
+       .gpio_power     = S3C2410_GPJ(0),
+       .gpio_reset     = S3C2410_GPD(0),
+       .dac_clk        = UDA1380_DAC_CLK_SYSCLK,
+};
+
+static struct i2c_board_info rx1950_i2c_devices[] = {
+       {
+               I2C_BOARD_INFO("uda1380", 0x1a),
+               .platform_data = &uda1380_info,
+       },
+};
+
+static struct gpiod_lookup_table rx1950_audio_gpio_table = {
+       .dev_id = "rx1950-audio",
+       .table = {
+               GPIO_LOOKUP("GPIOG", 12, "hp-gpio", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOA", 1, "speaker-power", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct platform_device rx1950_audio = {
+       .name = "rx1950-audio",
+       .id = -1,
+};
+
+static struct platform_device *rx1950_devices[] __initdata = {
+       &s3c2410_device_dclk,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_usbgadget,
+       &s3c_device_rtc,
+       &s3c_device_nand,
+       &s3c_device_sdi,
+       &s3c_device_adc,
+       &s3c_device_ts,
+       &samsung_device_pwm,
+       &rx1950_backlight,
+       &rx1950_device_gpiokeys,
+       &power_supply,
+       &rx1950_battery,
+       &rx1950_leds,
+       &rx1950_audio,
+};
+
+static void __init rx1950_map_io(void)
+{
+       s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
+       s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+
+       /* setup PM */
+
+#ifdef CONFIG_PM_H1940
+       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 8);
+#endif
+
+       s3c_pm_init();
+}
+
+static void __init rx1950_init_time(void)
+{
+       s3c2442_init_clocks(16934000);
+       s3c24xx_timer_init();
+}
+
+static void __init rx1950_init_machine(void)
+{
+       int i;
+
+       s3c24xx_fb_set_platdata(&rx1950_lcd_cfg);
+       s3c24xx_udc_set_platdata(&rx1950_udc_cfg);
+       s3c24xx_ts_set_platdata(&rx1950_ts_cfg);
+       gpiod_add_lookup_table(&rx1950_mmc_gpio_table);
+       s3c24xx_mci_set_platdata(&rx1950_mmc_cfg);
+       s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&rx1950_nand_info);
+
+       /* Turn off suspend on both USB ports, and switch the
+        * selectable USB port to USB device mode. */
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                                               S3C2410_MISCCR_USBSUSPND0 |
+                                               S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+       /* mmc power is disabled by default */
+       WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
+       gpio_direction_output(S3C2410_GPJ(1), 0);
+
+       for (i = 0; i < 8; i++)
+               WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
+
+       for (i = 10; i < 16; i++)
+               WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
+
+       for (i = 2; i < 8; i++)
+               WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
+
+       for (i = 11; i < 16; i++)
+               WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
+
+       WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
+
+       WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
+       WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
+       WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
+       gpio_direction_output(S3C2410_GPA(3), 0);
+       gpio_direction_output(S3C2410_GPA(4), 0);
+       gpio_direction_output(S3C2410_GPJ(6), 0);
+
+       pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
+       gpiod_add_lookup_table(&rx1950_audio_gpio_table);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
+
+       i2c_register_board_info(0, rx1950_i2c_devices,
+               ARRAY_SIZE(rx1950_i2c_devices));
+}
+
+/* H1940 and RX3715 need to reserve this for suspend */
+static void __init rx1950_reserve(void)
+{
+       memblock_reserve(0x30003000, 0x1000);
+       memblock_reserve(0x30081000, 0x1000);
+}
+
+MACHINE_START(RX1950, "HP iPAQ RX1950")
+    /* Maintainers: Vasily Khoruzhick */
+       .atag_offset = 0x100,
+       .map_io = rx1950_map_io,
+       .reserve        = rx1950_reserve,
+       .init_irq       = s3c2442_init_irq,
+       .init_machine = rx1950_init_machine,
+       .init_time      = rx1950_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-rx3715.c b/arch/arm/mach-s3c/mach-rx3715.c
new file mode 100644 (file)
index 0000000..889e44d
--- /dev/null
@@ -0,0 +1,218 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2003-2004 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// https://www.handhelds.org/projects/rx3715.html
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/memblock.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/serial.h>
+#include <linux/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/irq.h>
+#include <asm/mach/map.h>
+
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/fb-s3c2410.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "h1940.h"
+
+static struct map_desc rx3715_iodesc[] __initdata = {
+       /* dump ISA space somewhere unused */
+
+       {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
+               .pfn            = __phys_to_pfn(S3C2410_CS3),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
+               .pfn            = __phys_to_pfn(S3C2410_CS3),
+               .length         = SZ_1M,
+               .type           = MT_DEVICE,
+       },
+};
+
+static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+               .clk_sel        = S3C2410_UCON_CLKSEL3,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x00,
+               .clk_sel        = S3C2410_UCON_CLKSEL3,
+       },
+       /* IR port */
+       [2] = {
+               .hwport      = 2,
+               .uart_flags  = UPF_CONS_FLOW,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x43,
+               .ufcon       = 0x51,
+               .clk_sel        = S3C2410_UCON_CLKSEL3,
+       }
+};
+
+/* framebuffer lcd controller information */
+
+static struct s3c2410fb_display rx3715_lcdcfg __initdata = {
+       .lcdcon5 =      S3C2410_LCDCON5_INVVLINE |
+                       S3C2410_LCDCON5_FRM565 |
+                       S3C2410_LCDCON5_HWSWP,
+
+       .type           = S3C2410_LCDCON1_TFT,
+       .width          = 240,
+       .height         = 320,
+
+       .pixclock       = 260000,
+       .xres           = 240,
+       .yres           = 320,
+       .bpp            = 16,
+       .left_margin    = 36,
+       .right_margin   = 36,
+       .hsync_len      = 8,
+       .upper_margin   = 6,
+       .lower_margin   = 7,
+       .vsync_len      = 3,
+};
+
+static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
+
+       .displays =     &rx3715_lcdcfg,
+       .num_displays = 1,
+       .default_display = 0,
+
+       .lpcsel =       0xf82,
+
+       .gpccon =       0xaa955699,
+       .gpccon_mask =  0xffc003cc,
+       .gpccon_reg =   S3C2410_GPCCON,
+       .gpcup =        0x0000ffff,
+       .gpcup_mask =   0xffffffff,
+       .gpcup_reg =    S3C2410_GPCUP,
+
+       .gpdcon =       0xaa95aaa1,
+       .gpdcon_mask =  0xffc0fff0,
+       .gpdcon_reg =   S3C2410_GPDCON,
+       .gpdup =        0x0000faff,
+       .gpdup_mask =   0xffffffff,
+       .gpdup_reg =    S3C2410_GPDUP,
+};
+
+static struct mtd_partition __initdata rx3715_nand_part[] = {
+       [0] = {
+               .name           = "Whole Flash",
+               .offset         = 0,
+               .size           = MTDPART_SIZ_FULL,
+               .mask_flags     = MTD_WRITEABLE,
+       }
+};
+
+static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
+       [0] = {
+               .name           = "Internal",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(rx3715_nand_part),
+               .partitions     = rx3715_nand_part,
+       },
+};
+
+static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
+       .tacls          = 25,
+       .twrph0         = 50,
+       .twrph1         = 15,
+       .nr_sets        = ARRAY_SIZE(rx3715_nand_sets),
+       .sets           = rx3715_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+static struct platform_device *rx3715_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_nand,
+};
+
+static void __init rx3715_map_io(void)
+{
+       s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
+       s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init rx3715_init_time(void)
+{
+       s3c2440_init_clocks(16934000);
+       s3c24xx_timer_init();
+}
+
+/* H1940 and RX3715 need to reserve this for suspend */
+static void __init rx3715_reserve(void)
+{
+       memblock_reserve(0x30003000, 0x1000);
+       memblock_reserve(0x30081000, 0x1000);
+}
+
+static void __init rx3715_init_machine(void)
+{
+#ifdef CONFIG_PM_H1940
+       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
+#endif
+       s3c_pm_init();
+
+       s3c_nand_set_platdata(&rx3715_nand_info);
+       s3c24xx_fb_set_platdata(&rx3715_fb_info);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
+}
+
+MACHINE_START(RX3715, "IPAQ-RX3715")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+       .map_io         = rx3715_map_io,
+       .reserve        = rx3715_reserve,
+       .init_irq       = s3c2440_init_irq,
+       .init_machine   = rx3715_init_machine,
+       .init_time      = rx3715_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-s3c2416-dt.c b/arch/arm/mach-s3c/mach-s3c2416-dt.c
new file mode 100644 (file)
index 0000000..418544d
--- /dev/null
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Samsung's S3C2416 flattened device tree enabled machine
+//
+// Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
+//
+// based on mach-exynos/mach-exynos4-dt.c
+//
+// Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com
+// Copyright (c) 2010-2011 Linaro Ltd.
+//             www.linaro.org
+
+#include <linux/clocksource.h>
+#include <linux/irqchip.h>
+#include <linux/serial_s3c.h>
+
+#include <asm/mach/arch.h>
+#include "map.h"
+
+#include "cpu.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+
+static void __init s3c2416_dt_map_io(void)
+{
+       s3c24xx_init_io(NULL, 0);
+}
+
+static void __init s3c2416_dt_machine_init(void)
+{
+       s3c_pm_init();
+}
+
+static const char *const s3c2416_dt_compat[] __initconst = {
+       "samsung,s3c2416",
+       "samsung,s3c2450",
+       NULL
+};
+
+DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
+       /* Maintainer: Heiko Stuebner <heiko@sntech.de> */
+       .dt_compat      = s3c2416_dt_compat,
+       .map_io         = s3c2416_dt_map_io,
+       .init_irq       = irqchip_init,
+       .init_machine   = s3c2416_dt_machine_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-s3c64xx-dt.c b/arch/arm/mach-s3c/mach-s3c64xx-dt.c
new file mode 100644 (file)
index 0000000..00169c1
--- /dev/null
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Samsung's S3C64XX flattened device tree enabled machine
+//
+// Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/system_misc.h>
+
+#include "cpu.h"
+#include "map.h"
+
+#include "s3c64xx.h"
+
+/*
+ * IO mapping for shared system controller IP.
+ *
+ * FIXME: Make remaining drivers use dynamic mapping.
+ */
+static struct map_desc s3c64xx_dt_iodesc[] __initdata = {
+       {
+               .virtual        = (unsigned long)S3C_VA_SYS,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_SYSCON),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       },
+};
+
+static void __init s3c64xx_dt_map_io(void)
+{
+       debug_ll_io_init();
+       iotable_init(s3c64xx_dt_iodesc, ARRAY_SIZE(s3c64xx_dt_iodesc));
+
+       s3c64xx_init_cpu();
+
+       if (!soc_is_s3c64xx())
+               panic("SoC is not S3C64xx!");
+}
+
+static const char *const s3c64xx_dt_compat[] __initconst = {
+       "samsung,s3c6400",
+       "samsung,s3c6410",
+       NULL
+};
+
+DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)")
+       /* Maintainer: Tomasz Figa <tomasz.figa@gmail.com> */
+       .dt_compat      = s3c64xx_dt_compat,
+       .map_io         = s3c64xx_dt_map_io,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smartq.c b/arch/arm/mach-s3c/mach-smartq.c
new file mode 100644 (file)
index 0000000..5b6e7c2
--- /dev/null
@@ -0,0 +1,424 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2010 Maurus Cuelenaere
+
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/pwm.h>
+#include <linux/pwm_backlight.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/platform_data/s3c-hsotg.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/map.h>
+
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "gpio-cfg.h"
+#include <linux/platform_data/hwmon-s3c.h>
+#include <linux/platform_data/usb-ohci-s3c2410.h>
+#include "sdhci.h"
+#include <linux/platform_data/touchscreen-s3c2410.h>
+
+#include <video/platform_lcd.h>
+
+#include "s3c64xx.h"
+#include "mach-smartq.h"
+#include "regs-modem-s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
+#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
+
+static struct s3c2410_uartcfg smartq_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+};
+
+static void smartq_usb_host_powercontrol(int port, int to)
+{
+       pr_debug("%s(%d, %d)\n", __func__, port, to);
+
+       if (port == 0) {
+               gpio_set_value(S3C64XX_GPL(0), to);
+               gpio_set_value(S3C64XX_GPL(1), to);
+       }
+}
+
+static irqreturn_t smartq_usb_host_ocirq(int irq, void *pw)
+{
+       struct s3c2410_hcd_info *info = pw;
+
+       if (gpio_get_value(S3C64XX_GPL(10)) == 0) {
+               pr_debug("%s: over-current irq (oc detected)\n", __func__);
+               s3c2410_usb_report_oc(info, 3);
+       } else {
+               pr_debug("%s: over-current irq (oc cleared)\n", __func__);
+               s3c2410_usb_report_oc(info, 0);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static void smartq_usb_host_enableoc(struct s3c2410_hcd_info *info, int on)
+{
+       int ret;
+
+       /* This isn't present on a SmartQ 5 board */
+       if (machine_is_smartq5())
+               return;
+
+       if (on) {
+               ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)),
+                                 smartq_usb_host_ocirq,
+                                 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+                                 "USB host overcurrent", info);
+               if (ret != 0)
+                       pr_err("failed to request usb oc irq: %d\n", ret);
+       } else {
+               free_irq(gpio_to_irq(S3C64XX_GPL(10)), info);
+       }
+}
+
+static struct s3c2410_hcd_info smartq_usb_host_info = {
+       .port[0]        = {
+               .flags  = S3C_HCDFLG_USED
+       },
+       .port[1]        = {
+               .flags  = 0
+       },
+
+       .power_control  = smartq_usb_host_powercontrol,
+       .enable_oc      = smartq_usb_host_enableoc,
+};
+
+static struct gpiod_lookup_table smartq_usb_otg_vbus_gpiod_table = {
+       .dev_id = "gpio-vbus",
+       .table = {
+               GPIO_LOOKUP("GPL", 9, "vbus", GPIO_ACTIVE_LOW),
+               { },
+       },
+};
+
+static struct platform_device smartq_usb_otg_vbus_dev = {
+       .name                   = "gpio-vbus",
+};
+
+static struct pwm_lookup smartq_pwm_lookup[] = {
+       PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
+                  1000000000 / (1000 * 20), PWM_POLARITY_NORMAL),
+};
+
+static int smartq_bl_init(struct device *dev)
+{
+    s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
+
+    return 0;
+}
+
+static struct platform_pwm_backlight_data smartq_backlight_data = {
+       .max_brightness = 1000,
+       .dft_brightness = 600,
+       .init           = smartq_bl_init,
+};
+
+static struct platform_device smartq_backlight_device = {
+       .name           = "pwm-backlight",
+       .dev            = {
+               .parent = &samsung_device_pwm.dev,
+               .platform_data = &smartq_backlight_data,
+       },
+};
+
+static struct s3c2410_ts_mach_info smartq_touchscreen_pdata __initdata = {
+       .delay                  = 65535,
+       .presc                  = 99,
+       .oversampling_shift     = 4,
+};
+
+static struct s3c_sdhci_platdata smartq_internal_hsmmc_pdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_PERMANENT,
+};
+
+static struct s3c_hwmon_pdata smartq_hwmon_pdata __initdata = {
+       /* Battery voltage (?-4.2V) */
+       .in[0] = &(struct s3c_hwmon_chcfg) {
+               .name           = "smartq:battery-voltage",
+               .mult           = 3300,
+               .div            = 2048,
+       },
+       /* Reference voltage (1.2V) */
+       .in[1] = &(struct s3c_hwmon_chcfg) {
+               .name           = "smartq:reference-voltage",
+               .mult           = 3300,
+               .div            = 4096,
+       },
+};
+
+static struct dwc2_hsotg_plat smartq_hsotg_pdata;
+
+static int __init smartq_lcd_setup_gpio(void)
+{
+       int ret;
+
+       ret = gpio_request(S3C64XX_GPM(3), "LCD power");
+       if (ret < 0)
+               return ret;
+
+       /* turn power off */
+       gpio_direction_output(S3C64XX_GPM(3), 0);
+
+       return 0;
+}
+
+/* GPM0 -> CS */
+static struct spi_gpio_platform_data smartq_lcd_control = {
+       .num_chipselect = 1,
+};
+
+static struct platform_device smartq_lcd_control_device = {
+       .name                   = "spi_gpio",
+       .id                     = 1,
+       .dev.platform_data      = &smartq_lcd_control,
+};
+
+static struct gpiod_lookup_table smartq_lcd_control_gpiod_table = {
+       .dev_id         = "spi_gpio",
+       .table          = {
+               GPIO_LOOKUP("GPIOM", 1,
+                           "sck", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOM", 2,
+                           "mosi", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOM", 3,
+                           "miso", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOM", 0,
+                           "cs", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static void smartq_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
+{
+       gpio_direction_output(S3C64XX_GPM(3), power);
+}
+
+static struct plat_lcd_data smartq_lcd_power_data = {
+       .set_power      = smartq_lcd_power_set,
+};
+
+static struct platform_device smartq_lcd_power_device = {
+       .name                   = "platform-lcd",
+       .dev.parent             = &s3c_device_fb.dev,
+       .dev.platform_data      = &smartq_lcd_power_data,
+};
+
+static struct i2c_board_info smartq_i2c_devs[] __initdata = {
+       { I2C_BOARD_INFO("wm8987", 0x1a), },
+};
+
+static struct platform_device *smartq_devices[] __initdata = {
+       &s3c_device_hsmmc1,     /* Init iNAND first, ... */
+       &s3c_device_hsmmc0,     /* ... then the external SD card */
+       &s3c_device_hsmmc2,
+       &s3c_device_adc,
+       &s3c_device_fb,
+       &s3c_device_hwmon,
+       &s3c_device_i2c0,
+       &s3c_device_ohci,
+       &s3c_device_rtc,
+       &samsung_device_pwm,
+       &s3c_device_usb_hsotg,
+       &s3c64xx_device_iis0,
+       &smartq_backlight_device,
+       &smartq_lcd_control_device,
+       &smartq_lcd_power_device,
+       &smartq_usb_otg_vbus_dev,
+};
+
+static void __init smartq_lcd_mode_set(void)
+{
+       u32 tmp;
+
+       /* set the LCD type */
+       tmp = __raw_readl(S3C64XX_SPCON);
+       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
+       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
+       __raw_writel(tmp, S3C64XX_SPCON);
+
+       /* remove the LCD bypass */
+       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
+       tmp &= ~MIFPCON_LCD_BYPASS;
+       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
+}
+
+static void smartq_power_off(void)
+{
+       gpio_direction_output(S3C64XX_GPK(15), 1);
+}
+
+static int __init smartq_power_off_init(void)
+{
+       int ret;
+
+       ret = gpio_request(S3C64XX_GPK(15), "Power control");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPK15\n", __func__);
+               return ret;
+       }
+
+       /* leave power on */
+       gpio_direction_output(S3C64XX_GPK(15), 0);
+
+       pm_power_off = smartq_power_off;
+
+       return ret;
+}
+
+static int __init smartq_usb_host_init(void)
+{
+       int ret;
+
+       ret = gpio_request(S3C64XX_GPL(0), "USB power control");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPL0\n", __func__);
+               return ret;
+       }
+
+       ret = gpio_request(S3C64XX_GPL(1), "USB host power control");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPL1\n", __func__);
+               goto err;
+       }
+
+       if (!machine_is_smartq5()) {
+               /* This isn't present on a SmartQ 5 board */
+               ret = gpio_request(S3C64XX_GPL(10), "USB host overcurrent");
+               if (ret < 0) {
+                       pr_err("%s: failed to get GPL10\n", __func__);
+                       goto err2;
+               }
+       }
+
+       /* turn power off */
+       gpio_direction_output(S3C64XX_GPL(0), 0);
+       gpio_direction_output(S3C64XX_GPL(1), 0);
+       if (!machine_is_smartq5())
+               gpio_direction_input(S3C64XX_GPL(10));
+
+       s3c_device_ohci.dev.platform_data = &smartq_usb_host_info;
+
+       return 0;
+
+err2:
+       gpio_free(S3C64XX_GPL(1));
+err:
+       gpio_free(S3C64XX_GPL(0));
+       return ret;
+}
+
+static int __init smartq_wifi_init(void)
+{
+       int ret;
+
+       ret = gpio_request(S3C64XX_GPK(1), "wifi control");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPK1\n", __func__);
+               return ret;
+       }
+
+       ret = gpio_request(S3C64XX_GPK(2), "wifi reset");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPK2\n", __func__);
+               gpio_free(S3C64XX_GPK(1));
+               return ret;
+       }
+
+       /* turn power on */
+       gpio_direction_output(S3C64XX_GPK(1), 1);
+
+       /* reset device */
+       gpio_direction_output(S3C64XX_GPK(2), 0);
+       mdelay(100);
+       gpio_set_value(S3C64XX_GPK(2), 1);
+       gpio_direction_input(S3C64XX_GPK(2));
+
+       return 0;
+}
+
+static struct map_desc smartq_iodesc[] __initdata = {};
+void __init smartq_map_io(void)
+{
+       s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
+       s3c64xx_set_xtal_freq(12000000);
+       s3c64xx_set_xusbxti_freq(12000000);
+       s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+
+       smartq_lcd_mode_set();
+}
+
+static struct gpiod_lookup_table smartq_audio_gpios = {
+       .dev_id = "smartq-audio",
+       .table = {
+               GPIO_LOOKUP("GPL", 12, "headphone detect", 0),
+               GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", 0),
+               { },
+       },
+};
+
+void __init smartq_machine_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       dwc2_hsotg_set_platdata(&smartq_hsotg_pdata);
+       s3c_hwmon_set_platdata(&smartq_hwmon_pdata);
+       s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata);
+       s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata);
+       s3c64xx_ts_set_platdata(&smartq_touchscreen_pdata);
+
+       i2c_register_board_info(0, smartq_i2c_devs,
+                               ARRAY_SIZE(smartq_i2c_devs));
+
+       WARN_ON(smartq_lcd_setup_gpio());
+       WARN_ON(smartq_power_off_init());
+       WARN_ON(smartq_usb_host_init());
+       WARN_ON(smartq_wifi_init());
+
+       pwm_add_table(smartq_pwm_lookup, ARRAY_SIZE(smartq_pwm_lookup));
+       gpiod_add_lookup_table(&smartq_lcd_control_gpiod_table);
+       gpiod_add_lookup_table(&smartq_usb_otg_vbus_gpiod_table);
+       platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
+
+       gpiod_add_lookup_table(&smartq_audio_gpios);
+       platform_device_register_simple("smartq-audio", -1, NULL, 0);
+}
diff --git a/arch/arm/mach-s3c/mach-smartq.h b/arch/arm/mach-s3c/mach-smartq.h
new file mode 100644 (file)
index 0000000..f98132f
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * linux/arch/arm/mach-s3c64xx/mach-smartq.h
+ *
+ * Copyright (C) 2010 Maurus Cuelenaere
+ */
+
+#ifndef __MACH_SMARTQ_H
+#define __MACH_SMARTQ_H __FILE__
+
+#include <linux/init.h>
+
+extern void __init smartq_map_io(void);
+extern void __init smartq_machine_init(void);
+
+#endif /* __MACH_SMARTQ_H */
diff --git a/arch/arm/mach-s3c/mach-smartq5.c b/arch/arm/mach-s3c/mach-smartq5.c
new file mode 100644 (file)
index 0000000..8c94022
--- /dev/null
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2010 Maurus Cuelenaere
+
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include <video/samsung_fimd.h>
+#include <mach/irqs.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
+#include "gpio-cfg.h"
+
+#include "s3c64xx.h"
+#include "mach-smartq.h"
+
+static struct gpio_led smartq5_leds[] = {
+       {
+               .name                   = "smartq5:green",
+               .active_low             = 1,
+               .gpio                   = S3C64XX_GPN(8),
+       },
+       {
+               .name                   = "smartq5:red",
+               .active_low             = 1,
+               .gpio                   = S3C64XX_GPN(9),
+       },
+};
+
+static struct gpio_led_platform_data smartq5_led_data = {
+       .num_leds = ARRAY_SIZE(smartq5_leds),
+       .leds = smartq5_leds,
+};
+
+static struct platform_device smartq5_leds_device = {
+       .name                   = "leds-gpio",
+       .id                     = -1,
+       .dev.platform_data      = &smartq5_led_data,
+};
+
+/* Labels according to the SmartQ manual */
+static struct gpio_keys_button smartq5_buttons[] = {
+       {
+               .gpio                   = S3C64XX_GPL(14),
+               .code                   = KEY_POWER,
+               .desc                   = "Power",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(2),
+               .code                   = KEY_KPMINUS,
+               .desc                   = "Minus",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(12),
+               .code                   = KEY_KPPLUS,
+               .desc                   = "Plus",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(15),
+               .code                   = KEY_ENTER,
+               .desc                   = "Move",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+};
+
+static struct gpio_keys_platform_data smartq5_buttons_data  = {
+       .buttons        = smartq5_buttons,
+       .nbuttons       = ARRAY_SIZE(smartq5_buttons),
+};
+
+static struct platform_device smartq5_buttons_device  = {
+       .name           = "gpio-keys",
+       .id             = 0,
+       .num_resources  = 0,
+       .dev            = {
+               .platform_data  = &smartq5_buttons_data,
+       }
+};
+
+static struct s3c_fb_pd_win smartq5_fb_win0 = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct fb_videomode smartq5_lcd_timing = {
+       .left_margin    = 216,
+       .right_margin   = 40,
+       .upper_margin   = 35,
+       .lower_margin   = 10,
+       .hsync_len      = 1,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+       .refresh        = 80,
+};
+
+static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
+       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+       .vtiming        = &smartq5_lcd_timing,
+       .win[0]         = &smartq5_fb_win0,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
+                         VIDCON1_INV_VDEN,
+};
+
+static struct platform_device *smartq5_devices[] __initdata = {
+       &smartq5_leds_device,
+       &smartq5_buttons_device,
+};
+
+static void __init smartq5_machine_init(void)
+{
+       s3c_fb_set_platdata(&smartq5_lcd_pdata);
+
+       smartq_machine_init();
+
+       platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
+}
+
+MACHINE_START(SMARTQ5, "SmartQ 5")
+       /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = smartq_map_io,
+       .init_machine   = smartq5_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smartq7.c b/arch/arm/mach-s3c/mach-smartq7.c
new file mode 100644 (file)
index 0000000..ab24396
--- /dev/null
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2010 Maurus Cuelenaere
+
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include <video/samsung_fimd.h>
+#include <mach/irqs.h>
+#include "map.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "fb.h"
+#include "gpio-cfg.h"
+
+#include "s3c64xx.h"
+#include "mach-smartq.h"
+
+static struct gpio_led smartq7_leds[] = {
+       {
+               .name                   = "smartq7:red",
+               .active_low             = 1,
+               .gpio                   = S3C64XX_GPN(8),
+       },
+       {
+               .name                   = "smartq7:green",
+               .active_low             = 1,
+               .gpio                   = S3C64XX_GPN(9),
+       },
+};
+
+static struct gpio_led_platform_data smartq7_led_data = {
+       .num_leds = ARRAY_SIZE(smartq7_leds),
+       .leds = smartq7_leds,
+};
+
+static struct platform_device smartq7_leds_device = {
+       .name                   = "leds-gpio",
+       .id                     = -1,
+       .dev.platform_data      = &smartq7_led_data,
+};
+
+/* Labels according to the SmartQ manual */
+static struct gpio_keys_button smartq7_buttons[] = {
+       {
+               .gpio                   = S3C64XX_GPL(14),
+               .code                   = KEY_POWER,
+               .desc                   = "Power",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(2),
+               .code                   = KEY_FN,
+               .desc                   = "Function",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(3),
+               .code                   = KEY_KPMINUS,
+               .desc                   = "Minus",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(4),
+               .code                   = KEY_KPPLUS,
+               .desc                   = "Plus",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(12),
+               .code                   = KEY_ENTER,
+               .desc                   = "Enter",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+       {
+               .gpio                   = S3C64XX_GPN(15),
+               .code                   = KEY_ESC,
+               .desc                   = "Cancel",
+               .active_low             = 1,
+               .debounce_interval      = 5,
+               .type                   = EV_KEY,
+       },
+};
+
+static struct gpio_keys_platform_data smartq7_buttons_data  = {
+       .buttons        = smartq7_buttons,
+       .nbuttons       = ARRAY_SIZE(smartq7_buttons),
+};
+
+static struct platform_device smartq7_buttons_device  = {
+       .name           = "gpio-keys",
+       .id             = 0,
+       .num_resources  = 0,
+       .dev            = {
+               .platform_data  = &smartq7_buttons_data,
+       }
+};
+
+static struct s3c_fb_pd_win smartq7_fb_win0 = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static struct fb_videomode smartq7_lcd_timing = {
+       .left_margin    = 3,
+       .right_margin   = 5,
+       .upper_margin   = 1,
+       .lower_margin   = 20,
+       .hsync_len      = 10,
+       .vsync_len      = 3,
+       .xres           = 800,
+       .yres           = 480,
+       .refresh        = 80,
+};
+
+static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
+       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+       .vtiming        = &smartq7_lcd_timing,
+       .win[0]         = &smartq7_fb_win0,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
+                         VIDCON1_INV_VCLK,
+};
+
+static struct platform_device *smartq7_devices[] __initdata = {
+       &smartq7_leds_device,
+       &smartq7_buttons_device,
+};
+
+static void __init smartq7_machine_init(void)
+{
+       s3c_fb_set_platdata(&smartq7_lcd_pdata);
+
+       smartq_machine_init();
+
+       platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
+}
+
+MACHINE_START(SMARTQ7, "SmartQ 7")
+       /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = smartq_map_io,
+       .init_machine   = smartq7_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk2410.c b/arch/arm/mach-s3c/mach-smdk2410.c
new file mode 100644 (file)
index 0000000..ca83d5a
--- /dev/null
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2004 by FS Forth-Systeme GmbH
+// All rights reserved.
+//
+// @Author: Jonas Dietsche
+//
+// @History:
+// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
+// Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
+
+static struct map_desc smdk2410_iodesc[] __initdata = {
+  /* nothing here yet */
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+static struct platform_device *smdk2410_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+};
+
+static void __init smdk2410_map_io(void)
+{
+       s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
+       s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init smdk2410_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init smdk2410_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       smdk_machine_init();
+}
+
+MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
+                                   * to SMDK2410 */
+       /* Maintainer: Jonas Dietsche */
+       .atag_offset    = 0x100,
+       .map_io         = smdk2410_map_io,
+       .init_irq       = s3c2410_init_irq,
+       .init_machine   = smdk2410_init,
+       .init_time      = smdk2410_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk2413.c b/arch/arm/mach-s3c/mach-smdk2413.c
new file mode 100644 (file)
index 0000000..c43095b
--- /dev/null
@@ -0,0 +1,160 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Thanks to Dimity Andric (TomTom) and Steven Ryu (Samsung) for the
+// loans of SMDK2413 to work with.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/memblock.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/hardware/iomd.h>
+#include <asm/setup.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+//#include <asm/debug-ll.h>
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+
+#include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/fb-s3c2410.h>
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
+
+static struct map_desc smdk2413_iodesc[] __initdata = {
+};
+
+static struct s3c2410_uartcfg smdk2413_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       /* IR port */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x43,
+               .ufcon       = 0x51,
+       }
+};
+
+
+static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = {
+       .pullup_pin = S3C2410_GPF(2),
+};
+
+
+static struct platform_device *smdk2413_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_usbgadget,
+       &s3c2412_device_dma,
+};
+
+static void __init smdk2413_fixup(struct tag *tags, char **cmdline)
+{
+       if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
+               memblock_add(0x30000000, SZ_64M);
+       }
+}
+
+static void __init smdk2413_map_io(void)
+{
+       s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
+       s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init smdk2413_init_time(void)
+{
+       s3c2412_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init smdk2413_machine_init(void)
+{      /* Turn off suspend on both USB ports, and switch the
+        * selectable USB port to USB device mode. */
+
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                             S3C2410_MISCCR_USBSUSPND0 |
+                             S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+
+       s3c24xx_udc_set_platdata(&smdk2413_udc_cfg);
+       s3c_i2c0_set_platdata(NULL);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
+       platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices));
+       smdk_machine_init();
+}
+
+MACHINE_START(S3C2413, "S3C2413")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+
+       .fixup          = smdk2413_fixup,
+       .init_irq       = s3c2412_init_irq,
+       .map_io         = smdk2413_map_io,
+       .init_machine   = smdk2413_machine_init,
+       .init_time      = s3c24xx_timer_init,
+MACHINE_END
+
+MACHINE_START(SMDK2412, "SMDK2412")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+
+       .fixup          = smdk2413_fixup,
+       .init_irq       = s3c2412_init_irq,
+       .map_io         = smdk2413_map_io,
+       .init_machine   = smdk2413_machine_init,
+       .init_time      = s3c24xx_timer_init,
+MACHINE_END
+
+MACHINE_START(SMDK2413, "SMDK2413")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+
+       .fixup          = smdk2413_fixup,
+       .init_irq       = s3c2412_init_irq,
+       .map_io         = smdk2413_map_io,
+       .init_machine   = smdk2413_machine_init,
+       .init_time      = smdk2413_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk2416.c b/arch/arm/mach-s3c/mach-smdk2416.c
new file mode 100644 (file)
index 0000000..4d883a7
--- /dev/null
@@ -0,0 +1,257 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
+//     as part of OpenInkpot project
+// Copyright (c) 2009 Promwad Innovation Company
+//     Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/mtd/partitions.h>
+#include <linux/gpio.h>
+#include <linux/fb.h>
+#include <linux/delay.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <video/samsung_fimd.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+#include "regs-s3c2443-clock.h"
+#include "gpio-samsung.h"
+
+#include <linux/platform_data/leds-s3c24xx.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "gpio-cfg.h"
+#include "devs.h"
+#include "cpu.h"
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+#include "sdhci.h"
+#include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/s3c-hsudc.h>
+
+#include "fb.h"
+
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
+
+static struct map_desc smdk2416_iodesc[] __initdata = {
+       /* ISA IO Space map (memory space selected by A24) */
+
+       {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
+               .pfn            = __phys_to_pfn(S3C2410_CS2),
+               .length         = 0x10000,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
+               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
+               .length         = SZ_4M,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
+               .pfn            = __phys_to_pfn(S3C2410_CS2),
+               .length         = 0x10000,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
+               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
+               .length         = SZ_4M,
+               .type           = MT_DEVICE,
+       }
+};
+
+#define UCON (S3C2410_UCON_DEFAULT     | \
+               S3C2440_UCON_PCLK       | \
+               S3C2443_UCON_RXERR_IRQEN)
+
+#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
+
+#define UFCON (S3C2410_UFCON_RXTRIG8   | \
+               S3C2410_UFCON_FIFOMODE  | \
+               S3C2440_UFCON_TXTRIG16)
+
+static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       /* IR port */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON | 0x50,
+               .ufcon       = UFCON,
+       },
+       [3] = {
+               .hwport      = 3,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+static void smdk2416_hsudc_gpio_init(void)
+{
+       s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
+       s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
+       s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
+       s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
+}
+
+static void smdk2416_hsudc_gpio_uninit(void)
+{
+       s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
+       s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
+       s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
+}
+
+static struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
+       .epnum = 9,
+       .gpio_init = smdk2416_hsudc_gpio_init,
+       .gpio_uninit = smdk2416_hsudc_gpio_uninit,
+};
+
+static struct s3c_fb_pd_win smdk2416_fb_win[] = {
+       [0] = {
+               .default_bpp    = 16,
+               .max_bpp        = 32,
+               .xres           = 800,
+               .yres           = 480,
+       },
+};
+
+static struct fb_videomode smdk2416_lcd_timing = {
+       .pixclock       = 41094,
+       .left_margin    = 8,
+       .right_margin   = 13,
+       .upper_margin   = 7,
+       .lower_margin   = 5,
+       .hsync_len      = 3,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+static void s3c2416_fb_gpio_setup_24bpp(void)
+{
+       unsigned int gpio;
+
+       for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+
+       for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+
+       for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+}
+
+static struct s3c_fb_platdata smdk2416_fb_platdata = {
+       .win[0]         = &smdk2416_fb_win[0],
+       .vtiming        = &smdk2416_lcd_timing,
+       .setup_gpio     = s3c2416_fb_gpio_setup_24bpp,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+};
+
+static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_GPIO,
+       .ext_cd_gpio            = S3C2410_GPF(1),
+       .ext_cd_gpio_invert     = 1,
+};
+
+static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_NONE,
+};
+
+static struct platform_device *smdk2416_devices[] __initdata = {
+       &s3c_device_fb,
+       &s3c_device_wdt,
+       &s3c_device_ohci,
+       &s3c_device_i2c0,
+       &s3c_device_hsmmc0,
+       &s3c_device_hsmmc1,
+       &s3c_device_usb_hsudc,
+       &s3c2443_device_dma,
+};
+
+static void __init smdk2416_init_time(void)
+{
+       s3c2416_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init smdk2416_map_io(void)
+{
+       s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
+       s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init smdk2416_machine_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       s3c_fb_set_platdata(&smdk2416_fb_platdata);
+
+       s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
+       s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
+
+       s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
+
+       gpio_request(S3C2410_GPB(4), "USBHost Power");
+       gpio_direction_output(S3C2410_GPB(4), 1);
+
+       gpio_request(S3C2410_GPB(3), "Display Power");
+       gpio_direction_output(S3C2410_GPB(3), 1);
+
+       gpio_request(S3C2410_GPB(1), "Display Reset");
+       gpio_direction_output(S3C2410_GPB(1), 1);
+
+       platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
+       smdk_machine_init();
+}
+
+MACHINE_START(SMDK2416, "SMDK2416")
+       /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */
+       .atag_offset    = 0x100,
+
+       .init_irq       = s3c2416_init_irq,
+       .map_io         = smdk2416_map_io,
+       .init_machine   = smdk2416_machine_init,
+       .init_time      = smdk2416_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk2440.c b/arch/arm/mach-s3c/mach-smdk2440.c
new file mode 100644 (file)
index 0000000..7f6fe0d
--- /dev/null
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0
+// linux/arch/arm/mach-s3c2440/mach-smdk2440.c
+//
+// Copyright (c) 2004-2005 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://www.fluff.org/ben/smdk2440/
+//
+// Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
+
+static struct map_desc smdk2440_iodesc[] __initdata = {
+       /* ISA IO Space map (memory space selected by A24) */
+
+       {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
+               .pfn            = __phys_to_pfn(S3C2410_CS2),
+               .length         = 0x10000,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
+               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
+               .length         = SZ_4M,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
+               .pfn            = __phys_to_pfn(S3C2410_CS2),
+               .length         = 0x10000,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
+               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
+               .length         = SZ_4M,
+               .type           = MT_DEVICE,
+       }
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       /* IR port */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x43,
+               .ufcon       = 0x51,
+       }
+};
+
+/* LCD driver info */
+
+static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
+
+       .lcdcon5        = S3C2410_LCDCON5_FRM565 |
+                         S3C2410_LCDCON5_INVVLINE |
+                         S3C2410_LCDCON5_INVVFRAME |
+                         S3C2410_LCDCON5_PWREN |
+                         S3C2410_LCDCON5_HWSWP,
+
+       .type           = S3C2410_LCDCON1_TFT,
+
+       .width          = 240,
+       .height         = 320,
+
+       .pixclock       = 166667, /* HCLK 60 MHz, divisor 10 */
+       .xres           = 240,
+       .yres           = 320,
+       .bpp            = 16,
+       .left_margin    = 20,
+       .right_margin   = 8,
+       .hsync_len      = 4,
+       .upper_margin   = 8,
+       .lower_margin   = 7,
+       .vsync_len      = 4,
+};
+
+static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
+       .displays       = &smdk2440_lcd_cfg,
+       .num_displays   = 1,
+       .default_display = 0,
+
+#if 0
+       /* currently setup by downloader */
+       .gpccon         = 0xaa940659,
+       .gpccon_mask    = 0xffffffff,
+       .gpcup          = 0x0000ffff,
+       .gpcup_mask     = 0xffffffff,
+       .gpdcon         = 0xaa84aaa0,
+       .gpdcon_mask    = 0xffffffff,
+       .gpdup          = 0x0000faff,
+       .gpdup_mask     = 0xffffffff,
+
+       .gpccon_reg     = S3C2410_GPCCON,
+       .gpcup_reg      = S3C2410_GPCUP,
+       .gpdcon_reg     = S3C2410_GPDCON,
+       .gpdup_reg      = S3C2410_GPDUP,
+#endif
+
+       .lpcsel         = ((0xCE6) & ~7) | 1<<4,
+};
+
+static struct platform_device *smdk2440_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+};
+
+static void __init smdk2440_map_io(void)
+{
+       s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
+       s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init smdk2440_init_time(void)
+{
+       s3c2440_init_clocks(16934400);
+       s3c24xx_timer_init();
+}
+
+static void __init smdk2440_machine_init(void)
+{
+       s3c24xx_fb_set_platdata(&smdk2440_fb_info);
+       s3c_i2c0_set_platdata(NULL);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
+       smdk_machine_init();
+}
+
+MACHINE_START(S3C2440, "SMDK2440")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+
+       .init_irq       = s3c2440_init_irq,
+       .map_io         = smdk2440_map_io,
+       .init_machine   = smdk2440_machine_init,
+       .init_time      = smdk2440_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk2443.c b/arch/arm/mach-s3c/mach-smdk2443.c
new file mode 100644 (file)
index 0000000..fc54c91
--- /dev/null
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2007 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://www.fluff.org/ben/smdk2443/
+//
+// Thanks to Samsung for the loan of an SMDK2443
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+
+#include <linux/platform_data/fb-s3c2410.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c24xx.h"
+#include "common-smdk-s3c24xx.h"
+
+static struct map_desc smdk2443_iodesc[] __initdata = {
+       /* ISA IO Space map (memory space selected by A24) */
+
+       {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
+               .pfn            = __phys_to_pfn(S3C2410_CS2),
+               .length         = 0x10000,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
+               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
+               .length         = SZ_4M,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
+               .pfn            = __phys_to_pfn(S3C2410_CS2),
+               .length         = 0x10000,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
+               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
+               .length         = SZ_4M,
+               .type           = MT_DEVICE,
+       }
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk2443_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       /* IR port */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x43,
+               .ufcon       = 0x51,
+       },
+       [3] = {
+               .hwport      = 3,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       }
+};
+
+static struct platform_device *smdk2443_devices[] __initdata = {
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_hsmmc1,
+       &s3c2443_device_dma,
+};
+
+static void __init smdk2443_map_io(void)
+{
+       s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
+       s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init smdk2443_init_time(void)
+{
+       s3c2443_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init smdk2443_machine_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       platform_add_devices(smdk2443_devices, ARRAY_SIZE(smdk2443_devices));
+       smdk_machine_init();
+}
+
+MACHINE_START(SMDK2443, "SMDK2443")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+
+       .init_irq       = s3c2443_init_irq,
+       .map_io         = smdk2443_map_io,
+       .init_machine   = smdk2443_machine_init,
+       .init_time      = smdk2443_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk6400.c b/arch/arm/mach-s3c/mach-smdk6400.c
new file mode 100644 (file)
index 0000000..8272213
--- /dev/null
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
+
+#include <asm/mach-types.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <mach/irqs.h>
+#include "map.h"
+
+#include "devs.h"
+#include "cpu.h"
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "gpio-samsung.h"
+
+#include "s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk6400_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+};
+
+static struct map_desc smdk6400_iodesc[] = {};
+
+static void __init smdk6400_map_io(void)
+{
+       s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+}
+
+static struct platform_device *smdk6400_devices[] __initdata = {
+       &s3c_device_hsmmc1,
+       &s3c_device_i2c0,
+};
+
+static struct i2c_board_info i2c_devs[] __initdata = {
+       { I2C_BOARD_INFO("wm8753", 0x1A), },
+       { I2C_BOARD_INFO("24c08", 0x50), },
+};
+
+static void __init smdk6400_machine_init(void)
+{
+       i2c_register_board_info(0, i2c_devs, ARRAY_SIZE(i2c_devs));
+       platform_add_devices(smdk6400_devices, ARRAY_SIZE(smdk6400_devices));
+}
+
+MACHINE_START(SMDK6400, "SMDK6400")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6400_init_irq,
+       .map_io         = smdk6400_map_io,
+       .init_machine   = smdk6400_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-smdk6410.c b/arch/arm/mach-s3c/mach-smdk6410.c
new file mode 100644 (file)
index 0000000..ae18c13
--- /dev/null
@@ -0,0 +1,706 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/i2c.h>
+#include <linux/leds.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/smsc911x.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
+#include <linux/pwm.h>
+#include <linux/pwm_backlight.h>
+#include <linux/platform_data/s3c-hsotg.h>
+
+#ifdef CONFIG_SMDK6410_WM1190_EV1
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/pmic.h>
+#endif
+
+#ifdef CONFIG_SMDK6410_WM1192_EV1
+#include <linux/mfd/wm831x/core.h>
+#include <linux/mfd/wm831x/pdata.h>
+#endif
+
+#include <video/platform_lcd.h>
+#include <video/samsung_fimd.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <mach/irqs.h>
+#include "map.h"
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include <linux/platform_data/ata-samsung_cf.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "fb.h"
+#include "gpio-cfg.h"
+
+#include "devs.h"
+#include "cpu.h"
+#include <linux/soc/samsung/s3c-adc.h>
+#include <linux/platform_data/touchscreen-s3c2410.h>
+#include "keypad.h"
+
+#include "backlight-s3c64xx.h"
+#include "s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-srom-s3c64xx.h"
+#include "regs-sys-s3c64xx.h"
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [3] = {
+               .hwport      = 3,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+};
+
+/* framebuffer and LCD setup. */
+
+/* GPF15 = LCD backlight control
+ * GPF13 => Panel power
+ * GPN5 = LCD nRESET signal
+ * PWM_TOUT1 => backlight brightness
+ */
+
+static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
+                                  unsigned int power)
+{
+       if (power) {
+               gpio_direction_output(S3C64XX_GPF(13), 1);
+
+               /* fire nRESET on power up */
+               gpio_direction_output(S3C64XX_GPN(5), 0);
+               msleep(10);
+               gpio_direction_output(S3C64XX_GPN(5), 1);
+               msleep(1);
+       } else {
+               gpio_direction_output(S3C64XX_GPF(13), 0);
+       }
+}
+
+static struct plat_lcd_data smdk6410_lcd_power_data = {
+       .set_power      = smdk6410_lcd_power_set,
+};
+
+static struct platform_device smdk6410_lcd_powerdev = {
+       .name                   = "platform-lcd",
+       .dev.parent             = &s3c_device_fb.dev,
+       .dev.platform_data      = &smdk6410_lcd_power_data,
+};
+
+static struct s3c_fb_pd_win smdk6410_fb_win0 = {
+       .max_bpp        = 32,
+       .default_bpp    = 16,
+       .xres           = 800,
+       .yres           = 480,
+       .virtual_y      = 480 * 2,
+       .virtual_x      = 800,
+};
+
+static struct fb_videomode smdk6410_lcd_timing = {
+       .left_margin    = 8,
+       .right_margin   = 13,
+       .upper_margin   = 7,
+       .lower_margin   = 5,
+       .hsync_len      = 3,
+       .vsync_len      = 1,
+       .xres           = 800,
+       .yres           = 480,
+};
+
+/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
+static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
+       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
+       .vtiming        = &smdk6410_lcd_timing,
+       .win[0]         = &smdk6410_fb_win0,
+       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
+       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
+};
+
+/*
+ * Configuring Ethernet on SMDK6410
+ *
+ * Both CS8900A and LAN9115 chips share one chip select mediated by CFG6.
+ * The constant address below corresponds to nCS1
+ *
+ *  1) Set CFGB2 p3 ON others off, no other CFGB selects "ethernet"
+ *  2) CFG6 needs to be switched to "LAN9115" side
+ */
+
+static struct resource smdk6410_smsc911x_resources[] = {
+       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, SZ_64K),
+       [1] = DEFINE_RES_NAMED(S3C_EINT(10), 1, NULL, IORESOURCE_IRQ \
+                                       | IRQ_TYPE_LEVEL_LOW),
+};
+
+static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
+       .irq_polarity  = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
+       .irq_type      = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
+       .flags         = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
+       .phy_interface = PHY_INTERFACE_MODE_MII,
+};
+
+
+static struct platform_device smdk6410_smsc911x = {
+       .name          = "smsc911x",
+       .id            = -1,
+       .num_resources = ARRAY_SIZE(smdk6410_smsc911x_resources),
+       .resource      = &smdk6410_smsc911x_resources[0],
+       .dev = {
+               .platform_data = &smdk6410_smsc911x_pdata,
+       },
+};
+
+#ifdef CONFIG_REGULATOR
+static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] = {
+       REGULATOR_SUPPLY("PVDD", "0-001b"),
+       REGULATOR_SUPPLY("AVDD", "0-001b"),
+};
+
+static struct regulator_init_data __maybe_unused smdk6410_b_pwr_5v_data = {
+       .constraints = {
+               .always_on = 1,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
+       .consumer_supplies = smdk6410_b_pwr_5v_consumers,
+};
+
+static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
+       .supply_name = "B_PWR_5V",
+       .microvolts = 5000000,
+       .init_data = &smdk6410_b_pwr_5v_data,
+};
+
+static struct platform_device smdk6410_b_pwr_5v = {
+       .name          = "reg-fixed-voltage",
+       .id            = -1,
+       .dev = {
+               .platform_data = &smdk6410_b_pwr_5v_pdata,
+       },
+};
+#endif
+
+static struct s3c_ide_platdata smdk6410_ide_pdata __initdata = {
+       .setup_gpio     = s3c64xx_ide_setup_gpio,
+};
+
+static uint32_t smdk6410_keymap[] __initdata = {
+       /* KEY(row, col, keycode) */
+       KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
+       KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
+       KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
+       KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
+};
+
+static struct matrix_keymap_data smdk6410_keymap_data __initdata = {
+       .keymap         = smdk6410_keymap,
+       .keymap_size    = ARRAY_SIZE(smdk6410_keymap),
+};
+
+static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
+       .keymap_data    = &smdk6410_keymap_data,
+       .rows           = 2,
+       .cols           = 8,
+};
+
+static struct map_desc smdk6410_iodesc[] = {};
+
+static struct platform_device *smdk6410_devices[] __initdata = {
+#ifdef CONFIG_SMDK6410_SD_CH0
+       &s3c_device_hsmmc0,
+#endif
+#ifdef CONFIG_SMDK6410_SD_CH1
+       &s3c_device_hsmmc1,
+#endif
+       &s3c_device_i2c0,
+       &s3c_device_i2c1,
+       &s3c_device_fb,
+       &s3c_device_ohci,
+       &samsung_device_pwm,
+       &s3c_device_usb_hsotg,
+       &s3c64xx_device_iisv4,
+       &samsung_device_keypad,
+
+#ifdef CONFIG_REGULATOR
+       &smdk6410_b_pwr_5v,
+#endif
+       &smdk6410_lcd_powerdev,
+
+       &smdk6410_smsc911x,
+       &s3c_device_adc,
+       &s3c_device_cfcon,
+       &s3c_device_rtc,
+       &s3c_device_wdt,
+};
+
+#ifdef CONFIG_REGULATOR
+/* ARM core */
+static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
+       REGULATOR_SUPPLY("vddarm", NULL),
+};
+
+/* VDDARM, BUCK1 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddarm = {
+       .constraints = {
+               .name = "PVDD_ARM",
+               .min_uV = 1000000,
+               .max_uV = 1300000,
+               .always_on = 1,
+               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(smdk6410_vddarm_consumers),
+       .consumer_supplies = smdk6410_vddarm_consumers,
+};
+
+/* VDD_INT, BUCK2 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddint = {
+       .constraints = {
+               .name = "PVDD_INT",
+               .min_uV = 1000000,
+               .max_uV = 1200000,
+               .always_on = 1,
+               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+       },
+};
+
+/* VDD_HI, LDO3 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddhi = {
+       .constraints = {
+               .name = "PVDD_HI",
+               .always_on = 1,
+       },
+};
+
+/* VDD_PLL, LDO2 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddpll = {
+       .constraints = {
+               .name = "PVDD_PLL",
+               .always_on = 1,
+       },
+};
+
+/* VDD_UH_MMC, LDO5 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vdduh_mmc = {
+       .constraints = {
+               .name = "PVDD_UH+PVDD_MMC",
+               .always_on = 1,
+       },
+};
+
+/* VCCM3BT, LDO8 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vccmc3bt = {
+       .constraints = {
+               .name = "PVCCM3BT",
+               .always_on = 1,
+       },
+};
+
+/* VCCM2MTV, LDO11 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vccm2mtv = {
+       .constraints = {
+               .name = "PVCCM2MTV",
+               .always_on = 1,
+       },
+};
+
+/* VDD_LCD, LDO12 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddlcd = {
+       .constraints = {
+               .name = "PVDD_LCD",
+               .always_on = 1,
+       },
+};
+
+/* VDD_OTGI, LDO9 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddotgi = {
+       .constraints = {
+               .name = "PVDD_OTGI",
+               .always_on = 1,
+       },
+};
+
+/* VDD_OTG, LDO14 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddotg = {
+       .constraints = {
+               .name = "PVDD_OTG",
+               .always_on = 1,
+       },
+};
+
+/* VDD_ALIVE, LDO15 on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddalive = {
+       .constraints = {
+               .name = "PVDD_ALIVE",
+               .always_on = 1,
+       },
+};
+
+/* VDD_AUDIO, VLDO_AUDIO on J5 */
+static struct regulator_init_data __maybe_unused smdk6410_vddaudio = {
+       .constraints = {
+               .name = "PVDD_AUDIO",
+               .always_on = 1,
+       },
+};
+#endif
+
+#ifdef CONFIG_SMDK6410_WM1190_EV1
+/* S3C64xx internal logic & PLL */
+static struct regulator_init_data __maybe_unused wm8350_dcdc1_data = {
+       .constraints = {
+               .name = "PVDD_INT+PVDD_PLL",
+               .min_uV = 1200000,
+               .max_uV = 1200000,
+               .always_on = 1,
+               .apply_uV = 1,
+       },
+};
+
+/* Memory */
+static struct regulator_init_data __maybe_unused wm8350_dcdc3_data = {
+       .constraints = {
+               .name = "PVDD_MEM",
+               .min_uV = 1800000,
+               .max_uV = 1800000,
+               .always_on = 1,
+               .state_mem = {
+                        .uV = 1800000,
+                        .mode = REGULATOR_MODE_NORMAL,
+                        .enabled = 1,
+               },
+               .initial_state = PM_SUSPEND_MEM,
+       },
+};
+
+/* USB, EXT, PCM, ADC/DAC, USB, MMC */
+static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
+       REGULATOR_SUPPLY("DVDD", "0-001b"),
+};
+
+static struct regulator_init_data __maybe_unused wm8350_dcdc4_data = {
+       .constraints = {
+               .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
+               .min_uV = 3000000,
+               .max_uV = 3000000,
+               .always_on = 1,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
+       .consumer_supplies = wm8350_dcdc4_consumers,
+};
+
+/* OTGi/1190-EV1 HPVDD & AVDD */
+static struct regulator_init_data __maybe_unused wm8350_ldo4_data = {
+       .constraints = {
+               .name = "PVDD_OTGI+HPVDD+AVDD",
+               .min_uV = 1200000,
+               .max_uV = 1200000,
+               .apply_uV = 1,
+               .always_on = 1,
+       },
+};
+
+static struct {
+       int regulator;
+       struct regulator_init_data *initdata;
+} wm1190_regulators[] = {
+       { WM8350_DCDC_1, &wm8350_dcdc1_data },
+       { WM8350_DCDC_3, &wm8350_dcdc3_data },
+       { WM8350_DCDC_4, &wm8350_dcdc4_data },
+       { WM8350_DCDC_6, &smdk6410_vddarm },
+       { WM8350_LDO_1, &smdk6410_vddalive },
+       { WM8350_LDO_2, &smdk6410_vddotg },
+       { WM8350_LDO_3, &smdk6410_vddlcd },
+       { WM8350_LDO_4, &wm8350_ldo4_data },
+};
+
+static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
+{
+       int i;
+
+       /* Configure the IRQ line */
+       s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
+
+       /* Instantiate the regulators */
+       for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
+               wm8350_register_regulator(wm8350,
+                                         wm1190_regulators[i].regulator,
+                                         wm1190_regulators[i].initdata);
+
+       return 0;
+}
+
+static struct wm8350_platform_data __initdata smdk6410_wm8350_pdata = {
+       .init = smdk6410_wm8350_init,
+       .irq_high = 1,
+       .irq_base = IRQ_BOARD_START,
+};
+#endif
+
+#ifdef CONFIG_SMDK6410_WM1192_EV1
+static struct gpio_led wm1192_pmic_leds[] = {
+       {
+               .name = "PMIC:red:power",
+               .gpio = GPIO_BOARD_START + 3,
+               .default_state = LEDS_GPIO_DEFSTATE_ON,
+       },
+};
+
+static struct gpio_led_platform_data wm1192_pmic_led = {
+       .num_leds = ARRAY_SIZE(wm1192_pmic_leds),
+       .leds = wm1192_pmic_leds,
+};
+
+static struct platform_device wm1192_pmic_led_dev = {
+       .name          = "leds-gpio",
+       .id            = -1,
+       .dev = {
+               .platform_data = &wm1192_pmic_led,
+       },
+};
+
+static int wm1192_pre_init(struct wm831x *wm831x)
+{
+       int ret;
+
+       /* Configure the IRQ line */
+       s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
+
+       ret = platform_device_register(&wm1192_pmic_led_dev);
+       if (ret != 0)
+               dev_err(wm831x->dev, "Failed to add PMIC LED: %d\n", ret);
+
+       return 0;
+}
+
+static struct wm831x_backlight_pdata wm1192_backlight_pdata = {
+       .isink = 1,
+       .max_uA = 27554,
+};
+
+static struct regulator_init_data __maybe_unused wm1192_dcdc3 = {
+       .constraints = {
+               .name = "PVDD_MEM+PVDD_GPS",
+               .always_on = 1,
+       },
+};
+
+static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
+       REGULATOR_SUPPLY("DVDD", "0-001b"),   /* WM8580 */
+};
+
+static struct regulator_init_data __maybe_unused wm1192_ldo1 = {
+       .constraints = {
+               .name = "PVDD_LCD+PVDD_EXT",
+               .always_on = 1,
+       },
+       .consumer_supplies = wm1192_ldo1_consumers,
+       .num_consumer_supplies = ARRAY_SIZE(wm1192_ldo1_consumers),
+};
+
+static struct wm831x_status_pdata wm1192_led7_pdata = {
+       .name = "LED7:green:",
+};
+
+static struct wm831x_status_pdata wm1192_led8_pdata = {
+       .name = "LED8:green:",
+};
+
+static struct wm831x_pdata smdk6410_wm1192_pdata = {
+       .pre_init = wm1192_pre_init,
+
+       .backlight = &wm1192_backlight_pdata,
+       .dcdc = {
+               &smdk6410_vddarm,  /* DCDC1 */
+               &smdk6410_vddint,  /* DCDC2 */
+               &wm1192_dcdc3,
+       },
+       .gpio_base = GPIO_BOARD_START,
+       .ldo = {
+                &wm1192_ldo1,        /* LDO1 */
+                &smdk6410_vdduh_mmc, /* LDO2 */
+                NULL,                /* LDO3 NC */
+                &smdk6410_vddotgi,   /* LDO4 */
+                &smdk6410_vddotg,    /* LDO5 */
+                &smdk6410_vddhi,     /* LDO6 */
+                &smdk6410_vddaudio,  /* LDO7 */
+                &smdk6410_vccm2mtv,  /* LDO8 */
+                &smdk6410_vddpll,    /* LDO9 */
+                &smdk6410_vccmc3bt,  /* LDO10 */
+                &smdk6410_vddalive,  /* LDO11 */
+       },
+       .status = {
+               &wm1192_led7_pdata,
+               &wm1192_led8_pdata,
+       },
+};
+#endif
+
+static struct i2c_board_info i2c_devs0[] __initdata = {
+       { I2C_BOARD_INFO("24c08", 0x50), },
+       { I2C_BOARD_INFO("wm8580", 0x1b), },
+
+#ifdef CONFIG_SMDK6410_WM1192_EV1
+       { I2C_BOARD_INFO("wm8312", 0x34),
+         .platform_data = &smdk6410_wm1192_pdata,
+         .irq = S3C_EINT(12),
+       },
+#endif
+
+#ifdef CONFIG_SMDK6410_WM1190_EV1
+       { I2C_BOARD_INFO("wm8350", 0x1a),
+         .platform_data = &smdk6410_wm8350_pdata,
+         .irq = S3C_EINT(12),
+       },
+#endif
+};
+
+static struct i2c_board_info i2c_devs1[] __initdata = {
+       { I2C_BOARD_INFO("24c128", 0x57), },    /* Samsung S524AD0XD1 */
+};
+
+/* LCD Backlight data */
+static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
+       .no = S3C64XX_GPF(15),
+       .func = S3C_GPIO_SFN(2),
+};
+
+static struct pwm_lookup smdk6410_pwm_lookup[] = {
+       PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL, 78770,
+                  PWM_POLARITY_NORMAL),
+};
+
+static struct platform_pwm_backlight_data smdk6410_bl_data = {
+       /* Intentionally blank */
+};
+
+static struct dwc2_hsotg_plat smdk6410_hsotg_pdata;
+
+static void __init smdk6410_map_io(void)
+{
+       u32 tmp;
+
+       s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
+       s3c64xx_set_xtal_freq(12000000);
+       s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
+       s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
+
+       /* set the LCD type */
+
+       tmp = __raw_readl(S3C64XX_SPCON);
+       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
+       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
+       __raw_writel(tmp, S3C64XX_SPCON);
+
+       /* remove the lcd bypass */
+       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
+       tmp &= ~MIFPCON_LCD_BYPASS;
+       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
+}
+
+static void __init smdk6410_machine_init(void)
+{
+       u32 cs1;
+
+       s3c_i2c0_set_platdata(NULL);
+       s3c_i2c1_set_platdata(NULL);
+       s3c_fb_set_platdata(&smdk6410_lcd_pdata);
+       dwc2_hsotg_set_platdata(&smdk6410_hsotg_pdata);
+
+       samsung_keypad_set_platdata(&smdk6410_keypad_data);
+
+       s3c64xx_ts_set_platdata(NULL);
+
+       /* configure nCS1 width to 16 bits */
+
+       cs1 = __raw_readl(S3C64XX_SROM_BW) &
+                   ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
+       cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
+               (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
+               (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
+                                                  S3C64XX_SROM_BW__NCS1__SHIFT;
+       __raw_writel(cs1, S3C64XX_SROM_BW);
+
+       /* set timing for nCS1 suitable for ethernet chip */
+
+       __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
+                    (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
+                    (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
+                    (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
+                    (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
+                    (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
+                    (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
+
+       gpio_request(S3C64XX_GPN(5), "LCD power");
+       gpio_request(S3C64XX_GPF(13), "LCD power");
+
+       i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
+       i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
+
+       s3c_ide_set_platdata(&smdk6410_ide_pdata);
+
+       platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
+
+       pwm_add_table(smdk6410_pwm_lookup, ARRAY_SIZE(smdk6410_pwm_lookup));
+       samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
+}
+
+MACHINE_START(SMDK6410, "SMDK6410")
+       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
+       .atag_offset    = 0x100,
+       .nr_irqs        = S3C64XX_NR_IRQS,
+       .init_irq       = s3c6410_init_irq,
+       .map_io         = smdk6410_map_io,
+       .init_machine   = smdk6410_machine_init,
+       .init_time      = s3c64xx_timer_init,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-tct_hammer.c b/arch/arm/mach-s3c/mach-tct_hammer.c
new file mode 100644 (file)
index 0000000..2a61df3
--- /dev/null
@@ -0,0 +1,156 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2007 TinCanTools
+//     David Anders <danders@amltd.com>
+//
+// @History:
+// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
+// Ben Dooks <ben@simtec.co.uk>
+
+#include <linux/gpio/machine.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+#include <asm/mach/flash.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "devs.h"
+#include "cpu.h"
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/physmap.h>
+
+#include "s3c24xx.h"
+
+static struct resource tct_hammer_nor_resource =
+                       DEFINE_RES_MEM(0x00000000, SZ_16M);
+
+static struct mtd_partition tct_hammer_mtd_partitions[] = {
+       {
+               .name           = "System",
+               .size           = 0x240000,
+               .offset         = 0,
+               .mask_flags     = MTD_WRITEABLE,  /* force read-only */
+       }, {
+               .name           = "JFFS2",
+               .size           = MTDPART_SIZ_FULL,
+               .offset         = MTDPART_OFS_APPEND,
+       }
+};
+
+static struct physmap_flash_data tct_hammer_flash_data = {
+       .width          = 2,
+       .parts          = tct_hammer_mtd_partitions,
+       .nr_parts       = ARRAY_SIZE(tct_hammer_mtd_partitions),
+};
+
+static struct platform_device tct_hammer_device_nor = {
+       .name           = "physmap-flash",
+       .id             = 0,
+       .dev = {
+                       .platform_data = &tct_hammer_flash_data,
+               },
+       .num_resources  = 1,
+       .resource       = &tct_hammer_nor_resource,
+};
+
+static struct map_desc tct_hammer_iodesc[] __initdata = {
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
+       .dev_id = "s3c2410-sdi",
+       .table = {
+               /* bus pins */
+               GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct platform_device *tct_hammer_devices[] __initdata = {
+       &s3c_device_adc,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_ohci,
+       &s3c_device_rtc,
+       &s3c_device_usbgadget,
+       &s3c_device_sdi,
+       &tct_hammer_device_nor,
+};
+
+static void __init tct_hammer_map_io(void)
+{
+       s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
+       s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init tct_hammer_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init tct_hammer_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
+       platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
+}
+
+MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
+       .atag_offset    = 0x100,
+       .map_io         = tct_hammer_map_io,
+       .init_irq       = s3c2410_init_irq,
+       .init_machine   = tct_hammer_init,
+       .init_time      = tct_hammer_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-vr1000.c b/arch/arm/mach-s3c/mach-vr1000.c
new file mode 100644 (file)
index 0000000..5c3d07c
--- /dev/null
@@ -0,0 +1,368 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2003-2008 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// Machine support for Thorcom VR1000 board. Designed for Thorcom by
+// Simtec Electronics, http://www.simtec.co.uk/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
+#include <linux/dm9000.h>
+#include <linux/i2c.h>
+
+#include <linux/serial.h>
+#include <linux/tty.h>
+#include <linux/serial_8250.h>
+#include <linux/serial_reg.h>
+#include <linux/serial_s3c.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <linux/platform_data/leds-s3c24xx.h>
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/asoc-s3c24xx_simtec.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include "cpu.h"
+#include "devs.h"
+
+#include "bast.h"
+#include "s3c24xx.h"
+#include "simtec.h"
+#include "vr1000.h"
+
+/* macros for virtual address mods for the io space entries */
+#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
+#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
+#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
+#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
+
+/* macros to modify the physical addresses for io space */
+
+#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
+#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
+#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
+#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
+
+static struct map_desc vr1000_iodesc[] __initdata = {
+  /* ISA IO areas */
+  {
+         .virtual      = (u32)S3C24XX_VA_ISA_BYTE,
+         .pfn          = PA_CS2(BAST_PA_ISAIO),
+         .length       = SZ_16M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)S3C24XX_VA_ISA_WORD,
+         .pfn          = PA_CS3(BAST_PA_ISAIO),
+         .length       = SZ_16M,
+         .type         = MT_DEVICE,
+  },
+
+  /*  CPLD control registers, and external interrupt controls */
+  {
+         .virtual      = (u32)VR1000_VA_CTRL1,
+         .pfn          = __phys_to_pfn(VR1000_PA_CTRL1),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)VR1000_VA_CTRL2,
+         .pfn          = __phys_to_pfn(VR1000_PA_CTRL2),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)VR1000_VA_CTRL3,
+         .pfn          = __phys_to_pfn(VR1000_PA_CTRL3),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  }, {
+         .virtual      = (u32)VR1000_VA_CTRL4,
+         .pfn          = __phys_to_pfn(VR1000_PA_CTRL4),
+         .length       = SZ_1M,
+         .type         = MT_DEVICE,
+  },
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       },
+       /* port 2 is not actually used */
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = UCON,
+               .ulcon       = ULCON,
+               .ufcon       = UFCON,
+       }
+};
+
+/* definitions for the vr1000 extra 16550 serial ports */
+
+#define VR1000_BAUDBASE (3692307)
+
+#define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5))
+
+static struct plat_serial8250_port serial_platform_data[] = {
+       [0] = {
+               .mapbase        = VR1000_SERIAL_MAPBASE(0),
+               .irq            = VR1000_IRQ_SERIAL + 0,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 0,
+               .uartclk        = VR1000_BAUDBASE,
+       },
+       [1] = {
+               .mapbase        = VR1000_SERIAL_MAPBASE(1),
+               .irq            = VR1000_IRQ_SERIAL + 1,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 0,
+               .uartclk        = VR1000_BAUDBASE,
+       },
+       [2] = {
+               .mapbase        = VR1000_SERIAL_MAPBASE(2),
+               .irq            = VR1000_IRQ_SERIAL + 2,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 0,
+               .uartclk        = VR1000_BAUDBASE,
+       },
+       [3] = {
+               .mapbase        = VR1000_SERIAL_MAPBASE(3),
+               .irq            = VR1000_IRQ_SERIAL + 3,
+               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
+               .iotype         = UPIO_MEM,
+               .regshift       = 0,
+               .uartclk        = VR1000_BAUDBASE,
+       },
+       { },
+};
+
+static struct platform_device serial_device = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_PLATFORM,
+       .dev                    = {
+               .platform_data  = serial_platform_data,
+       },
+};
+
+/* DM9000 ethernet devices */
+
+static struct resource vr1000_dm9k0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000, 4),
+       [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, 0x40),
+       [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000A, 1, NULL, IORESOURCE_IRQ \
+                                               | IORESOURCE_IRQ_HIGHLEVEL),
+};
+
+static struct resource vr1000_dm9k1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 4),
+       [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, 0x40),
+       [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000N, 1, NULL, IORESOURCE_IRQ \
+                                               | IORESOURCE_IRQ_HIGHLEVEL),
+};
+
+/* for the moment we limit ourselves to 16bit IO until some
+ * better IO routines can be written and tested
+*/
+
+static struct dm9000_plat_data vr1000_dm9k_platdata = {
+       .flags          = DM9000_PLATF_16BITONLY,
+};
+
+static struct platform_device vr1000_dm9k0 = {
+       .name           = "dm9000",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(vr1000_dm9k0_resource),
+       .resource       = vr1000_dm9k0_resource,
+       .dev            = {
+               .platform_data = &vr1000_dm9k_platdata,
+       }
+};
+
+static struct platform_device vr1000_dm9k1 = {
+       .name           = "dm9000",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(vr1000_dm9k1_resource),
+       .resource       = vr1000_dm9k1_resource,
+       .dev            = {
+               .platform_data = &vr1000_dm9k_platdata,
+       }
+};
+
+/* LEDS */
+
+static struct gpiod_lookup_table vr1000_led1_gpio_table = {
+       .dev_id = "s3c24xx_led.1",
+       .table = {
+               GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table vr1000_led2_gpio_table = {
+       .dev_id = "s3c24xx_led.2",
+       .table = {
+               GPIO_LOOKUP("GPB", 1, NULL, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct gpiod_lookup_table vr1000_led3_gpio_table = {
+       .dev_id = "s3c24xx_led.3",
+       .table = {
+               GPIO_LOOKUP("GPB", 2, NULL, GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct s3c24xx_led_platdata vr1000_led1_pdata = {
+       .name           = "led1",
+       .def_trigger    = "",
+};
+
+static struct s3c24xx_led_platdata vr1000_led2_pdata = {
+       .name           = "led2",
+       .def_trigger    = "",
+};
+
+static struct s3c24xx_led_platdata vr1000_led3_pdata = {
+       .name           = "led3",
+       .def_trigger    = "",
+};
+
+static struct platform_device vr1000_led1 = {
+       .name           = "s3c24xx_led",
+       .id             = 1,
+       .dev            = {
+               .platform_data  = &vr1000_led1_pdata,
+       },
+};
+
+static struct platform_device vr1000_led2 = {
+       .name           = "s3c24xx_led",
+       .id             = 2,
+       .dev            = {
+               .platform_data  = &vr1000_led2_pdata,
+       },
+};
+
+static struct platform_device vr1000_led3 = {
+       .name           = "s3c24xx_led",
+       .id             = 3,
+       .dev            = {
+               .platform_data  = &vr1000_led3_pdata,
+       },
+};
+
+/* I2C devices. */
+
+static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
+       {
+               I2C_BOARD_INFO("tlv320aic23", 0x1a),
+       }, {
+               I2C_BOARD_INFO("tmp101", 0x48),
+       }, {
+               I2C_BOARD_INFO("m41st87", 0x68),
+       },
+};
+
+/* devices for this board */
+
+static struct platform_device *vr1000_devices[] __initdata = {
+       &s3c2410_device_dclk,
+       &s3c_device_ohci,
+       &s3c_device_lcd,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_adc,
+       &serial_device,
+       &vr1000_dm9k0,
+       &vr1000_dm9k1,
+       &vr1000_led1,
+       &vr1000_led2,
+       &vr1000_led3,
+};
+
+static void vr1000_power_off(void)
+{
+       gpio_direction_output(S3C2410_GPB(9), 1);
+}
+
+static void __init vr1000_map_io(void)
+{
+       pm_power_off = vr1000_power_off;
+
+       s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
+       s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init vr1000_init_time(void)
+{
+       s3c2410_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init vr1000_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+
+       /* Disable pull-up on LED lines and register GPIO lookups */
+       s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_NONE);
+       s3c_gpio_setpull(S3C2410_GPB(2), S3C_GPIO_PULL_NONE);
+       gpiod_add_lookup_table(&vr1000_led1_gpio_table);
+       gpiod_add_lookup_table(&vr1000_led2_gpio_table);
+       gpiod_add_lookup_table(&vr1000_led3_gpio_table);
+
+       platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
+
+       i2c_register_board_info(0, vr1000_i2c_devs,
+                               ARRAY_SIZE(vr1000_i2c_devs));
+
+       nor_simtec_init();
+       simtec_audio_add(NULL, true, NULL);
+
+       WARN_ON(gpio_request(S3C2410_GPB(9), "power off"));
+}
+
+MACHINE_START(VR1000, "Thorcom-VR1000")
+       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
+       .atag_offset    = 0x100,
+       .map_io         = vr1000_map_io,
+       .init_machine   = vr1000_init,
+       .init_irq       = s3c2410_init_irq,
+       .init_time      = vr1000_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/mach-vstms.c b/arch/arm/mach-s3c/mach-vstms.c
new file mode 100644 (file)
index 0000000..0a67641
--- /dev/null
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// (C) 2006 Thomas Gleixner <tglx@linutronix.de>
+//
+// Derived from mach-smdk2413.c - (C) 2006 Simtec Electronics
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+#include <linux/memblock.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/setup.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include <linux/platform_data/fb-s3c2410.h>
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/mtd-nand-s3c2410.h>
+
+#include "devs.h"
+#include "cpu.h"
+
+#include "s3c24xx.h"
+
+static struct map_desc vstms_iodesc[] __initdata = {
+};
+
+static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
+       [0] = {
+               .hwport      = 0,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [1] = {
+               .hwport      = 1,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       },
+       [2] = {
+               .hwport      = 2,
+               .flags       = 0,
+               .ucon        = 0x3c5,
+               .ulcon       = 0x03,
+               .ufcon       = 0x51,
+       }
+};
+
+static struct mtd_partition __initdata vstms_nand_part[] = {
+       [0] = {
+               .name   = "Boot Agent",
+               .size   = 0x7C000,
+               .offset = 0,
+       },
+       [1] = {
+               .name   = "UBoot Config",
+               .offset = 0x7C000,
+               .size   = 0x4000,
+       },
+       [2] = {
+               .name   = "Kernel",
+               .offset = 0x80000,
+               .size   = 0x200000,
+       },
+       [3] = {
+               .name   = "RFS",
+               .offset = 0x280000,
+               .size   = 0x3d80000,
+       },
+};
+
+static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
+       [0] = {
+               .name           = "NAND",
+               .nr_chips       = 1,
+               .nr_partitions  = ARRAY_SIZE(vstms_nand_part),
+               .partitions     = vstms_nand_part,
+       },
+};
+
+/* choose a set of timings which should suit most 512Mbit
+ * chips and beyond.
+*/
+
+static struct s3c2410_platform_nand __initdata vstms_nand_info = {
+       .tacls          = 20,
+       .twrph0         = 60,
+       .twrph1         = 20,
+       .nr_sets        = ARRAY_SIZE(vstms_nand_sets),
+       .sets           = vstms_nand_sets,
+       .ecc_mode       = NAND_ECC_SOFT,
+};
+
+static struct platform_device *vstms_devices[] __initdata = {
+       &s3c_device_ohci,
+       &s3c_device_wdt,
+       &s3c_device_i2c0,
+       &s3c_device_iis,
+       &s3c_device_rtc,
+       &s3c_device_nand,
+       &s3c2412_device_dma,
+};
+
+static void __init vstms_fixup(struct tag *tags, char **cmdline)
+{
+       if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
+               memblock_add(0x30000000, SZ_64M);
+       }
+}
+
+static void __init vstms_map_io(void)
+{
+       s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
+       s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
+       s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
+}
+
+static void __init vstms_init_time(void)
+{
+       s3c2412_init_clocks(12000000);
+       s3c24xx_timer_init();
+}
+
+static void __init vstms_init(void)
+{
+       s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&vstms_nand_info);
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+       platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
+}
+
+MACHINE_START(VSTMS, "VSTMS")
+       .atag_offset    = 0x100,
+
+       .fixup          = vstms_fixup,
+       .init_irq       = s3c2412_init_irq,
+       .init_machine   = vstms_init,
+       .map_io         = vstms_map_io,
+       .init_time      = vstms_init_time,
+MACHINE_END
diff --git a/arch/arm/mach-s3c/map-s3c.h b/arch/arm/mach-s3c/map-s3c.h
new file mode 100644 (file)
index 0000000..a18fdd3
--- /dev/null
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C24XX - Memory map definitions
+ */
+
+#ifndef __ASM_PLAT_MAP_S3C_H
+#define __ASM_PLAT_MAP_S3C_H __FILE__
+
+#include "map.h"
+
+#define S3C24XX_VA_IRQ         S3C_VA_IRQ
+#define S3C24XX_VA_MEMCTRL     S3C_VA_MEM
+#define S3C24XX_VA_UART                S3C_VA_UART
+
+#define S3C24XX_VA_TIMER       S3C_VA_TIMER
+#define S3C24XX_VA_CLKPWR      S3C_VA_SYS
+#define S3C24XX_VA_WATCHDOG    S3C_VA_WATCHDOG
+
+#define S3C2412_VA_SSMC                S3C_ADDR_CPU(0x00000000)
+#define S3C2412_VA_EBI         S3C_ADDR_CPU(0x00100000)
+
+#define S3C2410_PA_UART                (0x50000000)
+#define S3C24XX_PA_UART                S3C2410_PA_UART
+
+/*
+ * GPIO ports
+ *
+ * the calculation for the VA of this must ensure that
+ * it is the same distance apart from the UART in the
+ * phsyical address space, as the initial mapping for the IO
+ * is done as a 1:1 mapping. This puts it (currently) at
+ * 0xFA800000, which is not in the way of any current mapping
+ * by the base system.
+*/
+
+#define S3C2410_PA_GPIO                (0x56000000)
+#define S3C24XX_PA_GPIO                S3C2410_PA_GPIO
+
+#define S3C24XX_VA_GPIO                ((S3C24XX_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
+#define S3C64XX_VA_GPIO                S3C_ADDR_CPU(0x00000000)
+
+#define S3C64XX_VA_MODEM       S3C_ADDR_CPU(0x00100000)
+#define S3C64XX_VA_USB_HSPHY   S3C_ADDR_CPU(0x00200000)
+
+#define S3C_VA_USB_HSPHY       S3C64XX_VA_USB_HSPHY
+
+#define S3C2410_ADDR(x)                S3C_ADDR(x)
+
+/* deal with the registers that move under the 2412/2413 */
+
+#if defined(CONFIG_CPU_S3C2412)
+#ifndef __ASSEMBLY__
+extern void __iomem *s3c24xx_va_gpio2;
+#endif
+#ifdef CONFIG_CPU_S3C2412_ONLY
+#define S3C24XX_VA_GPIO2       (S3C24XX_VA_GPIO + 0x10)
+#else
+#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
+#endif
+#else
+#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
+#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
+#endif
+
+#include "map-s5p.h"
+
+#endif /* __ASM_PLAT_MAP_S3C_H */
diff --git a/arch/arm/mach-s3c/map-s3c24xx.h b/arch/arm/mach-s3c/map-s3c24xx.h
new file mode 100644 (file)
index 0000000..b5dba78
--- /dev/null
@@ -0,0 +1,159 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - Memory map definitions
+ */
+
+#ifndef __ASM_ARCH_MAP_H
+#define __ASM_ARCH_MAP_H
+
+#include <mach/map-base.h>
+#include "map-s3c.h"
+
+/*
+ * interrupt controller is the first thing we put in, to make
+ * the assembly code for the irq detection easier
+ */
+#define S3C2410_PA_IRQ         (0x4A000000)
+#define S3C24XX_SZ_IRQ         SZ_1M
+
+/* memory controller registers */
+#define S3C2410_PA_MEMCTRL     (0x48000000)
+#define S3C24XX_SZ_MEMCTRL     SZ_1M
+
+/* Timers */
+#define S3C2410_PA_TIMER       (0x51000000)
+#define S3C24XX_SZ_TIMER       SZ_1M
+
+/* Clock and Power management */
+#define S3C24XX_SZ_CLKPWR      SZ_1M
+
+/* USB Device port */
+#define S3C2410_PA_USBDEV      (0x52000000)
+#define S3C24XX_SZ_USBDEV      SZ_1M
+
+/* Watchdog */
+#define S3C2410_PA_WATCHDOG    (0x53000000)
+#define S3C24XX_SZ_WATCHDOG    SZ_1M
+
+/* Standard size definitions for peripheral blocks. */
+
+#define S3C24XX_SZ_UART                SZ_1M
+#define S3C24XX_SZ_IIS         SZ_1M
+#define S3C24XX_SZ_ADC         SZ_1M
+#define S3C24XX_SZ_SPI         SZ_1M
+#define S3C24XX_SZ_SDI         SZ_1M
+#define S3C24XX_SZ_NAND                SZ_1M
+#define S3C24XX_SZ_GPIO                SZ_1M
+
+/* USB host controller */
+#define S3C2410_PA_USBHOST (0x49000000)
+
+/* S3C2416/S3C2443/S3C2450 High-Speed USB Gadget */
+#define S3C2416_PA_HSUDC       (0x49800000)
+#define S3C2416_SZ_HSUDC       (SZ_4K)
+
+/* DMA controller */
+#define S3C2410_PA_DMA    (0x4B000000)
+#define S3C24XX_SZ_DMA    SZ_1M
+
+/* Clock and Power management */
+#define S3C2410_PA_CLKPWR  (0x4C000000)
+
+/* LCD controller */
+#define S3C2410_PA_LCD    (0x4D000000)
+#define S3C24XX_SZ_LCD    SZ_1M
+
+/* NAND flash controller */
+#define S3C2410_PA_NAND           (0x4E000000)
+
+/* IIC hardware controller */
+#define S3C2410_PA_IIC    (0x54000000)
+
+/* IIS controller */
+#define S3C2410_PA_IIS    (0x55000000)
+
+/* RTC */
+#define S3C2410_PA_RTC    (0x57000000)
+#define S3C24XX_SZ_RTC    SZ_1M
+
+/* ADC */
+#define S3C2410_PA_ADC    (0x58000000)
+
+/* SPI */
+#define S3C2410_PA_SPI    (0x59000000)
+#define S3C2443_PA_SPI0                (0x52000000)
+#define S3C2443_PA_SPI1                S3C2410_PA_SPI
+#define S3C2410_SPI1           (0x20)
+#define S3C2412_SPI1           (0x100)
+
+/* SDI */
+#define S3C2410_PA_SDI    (0x5A000000)
+
+/* CAMIF */
+#define S3C2440_PA_CAMIF   (0x4F000000)
+#define S3C2440_SZ_CAMIF   SZ_1M
+
+/* AC97 */
+
+#define S3C2440_PA_AC97           (0x5B000000)
+#define S3C2440_SZ_AC97           SZ_1M
+
+/* S3C2443/S3C2416 High-speed SD/MMC */
+#define S3C2443_PA_HSMMC   (0x4A800000)
+#define S3C2416_PA_HSMMC0  (0x4AC00000)
+
+#define        S3C2443_PA_FB   (0x4C800000)
+
+/* S3C2412 memory and IO controls */
+#define S3C2412_PA_SSMC        (0x4F000000)
+
+#define S3C2412_PA_EBI (0x48800000)
+
+/* physical addresses of all the chip-select areas */
+
+#define S3C2410_CS0 (0x00000000)
+#define S3C2410_CS1 (0x08000000)
+#define S3C2410_CS2 (0x10000000)
+#define S3C2410_CS3 (0x18000000)
+#define S3C2410_CS4 (0x20000000)
+#define S3C2410_CS5 (0x28000000)
+#define S3C2410_CS6 (0x30000000)
+#define S3C2410_CS7 (0x38000000)
+
+#define S3C2410_SDRAM_PA    (S3C2410_CS6)
+
+/* Use a single interface for common resources between S3C24XX cpus */
+
+#define S3C24XX_PA_IRQ      S3C2410_PA_IRQ
+#define S3C24XX_PA_MEMCTRL  S3C2410_PA_MEMCTRL
+#define S3C24XX_PA_DMA      S3C2410_PA_DMA
+#define S3C24XX_PA_CLKPWR   S3C2410_PA_CLKPWR
+#define S3C24XX_PA_LCD      S3C2410_PA_LCD
+#define S3C24XX_PA_TIMER    S3C2410_PA_TIMER
+#define S3C24XX_PA_USBDEV   S3C2410_PA_USBDEV
+#define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG
+#define S3C24XX_PA_IIS      S3C2410_PA_IIS
+#define S3C24XX_PA_RTC      S3C2410_PA_RTC
+#define S3C24XX_PA_ADC      S3C2410_PA_ADC
+#define S3C24XX_PA_SPI      S3C2410_PA_SPI
+#define S3C24XX_PA_SPI1                (S3C2410_PA_SPI + S3C2410_SPI1)
+#define S3C24XX_PA_SDI      S3C2410_PA_SDI
+#define S3C24XX_PA_NAND            S3C2410_PA_NAND
+
+#define S3C_PA_FB          S3C2443_PA_FB
+#define S3C_PA_IIC          S3C2410_PA_IIC
+#define S3C_PA_USBHOST S3C2410_PA_USBHOST
+#define S3C_PA_HSMMC0      S3C2416_PA_HSMMC0
+#define S3C_PA_HSMMC1      S3C2443_PA_HSMMC
+#define S3C_PA_WDT         S3C2410_PA_WATCHDOG
+#define S3C_PA_NAND        S3C24XX_PA_NAND
+
+#define S3C_PA_SPI0            S3C2443_PA_SPI0
+#define S3C_PA_SPI1            S3C2443_PA_SPI1
+
+#define SAMSUNG_PA_TIMER       S3C2410_PA_TIMER
+
+#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s3c/map-s3c64xx.h b/arch/arm/mach-s3c/map-s3c64xx.h
new file mode 100644 (file)
index 0000000..d7740d2
--- /dev/null
@@ -0,0 +1,122 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C64XX - Memory map definitions
+ */
+
+#ifndef __ASM_ARCH_MAP_H
+#define __ASM_ARCH_MAP_H __FILE__
+
+#include <mach/map-base.h>
+#include "map-s3c.h"
+
+/*
+ * Post-mux Chip Select Regions Xm0CSn_
+ * These may be used by SROM, NAND or CF depending on settings
+ */
+
+#define S3C64XX_PA_XM0CSN0 (0x10000000)
+#define S3C64XX_PA_XM0CSN1 (0x18000000)
+#define S3C64XX_PA_XM0CSN2 (0x20000000)
+#define S3C64XX_PA_XM0CSN3 (0x28000000)
+#define S3C64XX_PA_XM0CSN4 (0x30000000)
+#define S3C64XX_PA_XM0CSN5 (0x38000000)
+
+/* HSMMC units */
+#define S3C64XX_PA_HSMMC(x)    (0x7C200000 + ((x) * 0x100000))
+#define S3C64XX_PA_HSMMC0      S3C64XX_PA_HSMMC(0)
+#define S3C64XX_PA_HSMMC1      S3C64XX_PA_HSMMC(1)
+#define S3C64XX_PA_HSMMC2      S3C64XX_PA_HSMMC(2)
+
+#define S3C_PA_UART            (0x7F005000)
+#define S3C_PA_UART0           (S3C_PA_UART + 0x00)
+#define S3C_PA_UART1           (S3C_PA_UART + 0x400)
+#define S3C_PA_UART2           (S3C_PA_UART + 0x800)
+#define S3C_PA_UART3           (S3C_PA_UART + 0xC00)
+#define S3C_UART_OFFSET                (0x400)
+
+/* See notes on UART VA mapping in debug-macro.S */
+#define S3C_VA_UARTx(x)        (S3C_VA_UART + (S3C_PA_UART & 0xfffff) + ((x) * S3C_UART_OFFSET))
+
+#define S3C_VA_UART0           S3C_VA_UARTx(0)
+#define S3C_VA_UART1           S3C_VA_UARTx(1)
+#define S3C_VA_UART2           S3C_VA_UARTx(2)
+#define S3C_VA_UART3           S3C_VA_UARTx(3)
+
+#define S3C64XX_PA_SROM                (0x70000000)
+
+#define S3C64XX_PA_ONENAND0    (0x70100000)
+#define S3C64XX_PA_ONENAND0_BUF        (0x20000000)
+#define S3C64XX_SZ_ONENAND0_BUF (SZ_64M)
+
+/* NAND and OneNAND1 controllers occupy the same register region
+   (depending on SoC POP version) */
+#define S3C64XX_PA_ONENAND1    (0x70200000)
+#define S3C64XX_PA_ONENAND1_BUF        (0x28000000)
+#define S3C64XX_SZ_ONENAND1_BUF        (SZ_64M)
+
+#define S3C64XX_PA_NAND                (0x70200000)
+#define S3C64XX_PA_FB          (0x77100000)
+#define S3C64XX_PA_USB_HSOTG   (0x7C000000)
+#define S3C64XX_PA_WATCHDOG    (0x7E004000)
+#define S3C64XX_PA_RTC         (0x7E005000)
+#define S3C64XX_PA_KEYPAD      (0x7E00A000)
+#define S3C64XX_PA_ADC         (0x7E00B000)
+#define S3C64XX_PA_SYSCON      (0x7E00F000)
+#define S3C64XX_PA_AC97                (0x7F001000)
+#define S3C64XX_PA_IIS0                (0x7F002000)
+#define S3C64XX_PA_IIS1                (0x7F003000)
+#define S3C64XX_PA_TIMER       (0x7F006000)
+#define S3C64XX_PA_IIC0                (0x7F004000)
+#define S3C64XX_PA_SPI0                (0x7F00B000)
+#define S3C64XX_PA_SPI1                (0x7F00C000)
+#define S3C64XX_PA_PCM0                (0x7F009000)
+#define S3C64XX_PA_PCM1                (0x7F00A000)
+#define S3C64XX_PA_IISV4       (0x7F00D000)
+#define S3C64XX_PA_IIC1                (0x7F00F000)
+
+#define S3C64XX_PA_GPIO                (0x7F008000)
+#define S3C64XX_SZ_GPIO                SZ_4K
+
+#define S3C64XX_PA_SDRAM       (0x50000000)
+
+#define S3C64XX_PA_CFCON       (0x70300000)
+
+#define S3C64XX_PA_VIC0                (0x71200000)
+#define S3C64XX_PA_VIC1                (0x71300000)
+
+#define S3C64XX_PA_MODEM       (0x74108000)
+
+#define S3C64XX_PA_USBHOST     (0x74300000)
+
+#define S3C64XX_PA_USB_HSPHY   (0x7C100000)
+
+/* compatibility defines. */
+#define S3C_PA_TIMER           S3C64XX_PA_TIMER
+#define S3C_PA_HSMMC0          S3C64XX_PA_HSMMC0
+#define S3C_PA_HSMMC1          S3C64XX_PA_HSMMC1
+#define S3C_PA_HSMMC2          S3C64XX_PA_HSMMC2
+#define S3C_PA_IIC             S3C64XX_PA_IIC0
+#define S3C_PA_IIC1            S3C64XX_PA_IIC1
+#define S3C_PA_NAND            S3C64XX_PA_NAND
+#define S3C_PA_ONENAND         S3C64XX_PA_ONENAND0
+#define S3C_PA_ONENAND_BUF     S3C64XX_PA_ONENAND0_BUF
+#define S3C_SZ_ONENAND_BUF     S3C64XX_SZ_ONENAND0_BUF
+#define S3C_PA_FB              S3C64XX_PA_FB
+#define S3C_PA_USBHOST         S3C64XX_PA_USBHOST
+#define S3C_PA_USB_HSOTG       S3C64XX_PA_USB_HSOTG
+#define S3C_PA_RTC             S3C64XX_PA_RTC
+#define S3C_PA_WDT             S3C64XX_PA_WATCHDOG
+#define S3C_PA_SPI0            S3C64XX_PA_SPI0
+#define S3C_PA_SPI1            S3C64XX_PA_SPI1
+
+#define SAMSUNG_PA_ADC         S3C64XX_PA_ADC
+#define SAMSUNG_PA_CFCON       S3C64XX_PA_CFCON
+#define SAMSUNG_PA_KEYPAD      S3C64XX_PA_KEYPAD
+#define SAMSUNG_PA_TIMER       S3C64XX_PA_TIMER
+
+#endif /* __ASM_ARCH_6400_MAP_H */
diff --git a/arch/arm/mach-s3c/map-s5p.h b/arch/arm/mach-s3c/map-s5p.h
new file mode 100644 (file)
index 0000000..cd23792
--- /dev/null
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * S5P - Memory map definitions
+ */
+
+#ifndef __ASM_PLAT_MAP_S5P_H
+#define __ASM_PLAT_MAP_S5P_H __FILE__
+
+#define VA_VIC(x)              (S3C_VA_IRQ + ((x) * 0x10000))
+#define VA_VIC0                        VA_VIC(0)
+#define VA_VIC1                        VA_VIC(1)
+#define VA_VIC2                        VA_VIC(2)
+#define VA_VIC3                        VA_VIC(3)
+
+#include "map-s3c.h"
+
+#endif /* __ASM_PLAT_MAP_S5P_H */
diff --git a/arch/arm/mach-s3c/map.h b/arch/arm/mach-s3c/map.h
new file mode 100644 (file)
index 0000000..7cfb517
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "map-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "map-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/nand-core-s3c24xx.h b/arch/arm/mach-s3c/nand-core-s3c24xx.h
new file mode 100644 (file)
index 0000000..a143167
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * S3C -  Nand Controller core functions
+ */
+
+#ifndef __ASM_ARCH_NAND_CORE_S3C24XX_H
+#define __ASM_ARCH_NAND_CORE_S3C24XX_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_nand_setname(char *name)
+{
+#ifdef CONFIG_S3C_DEV_NAND
+       s3c_device_nand.name = name;
+#endif
+}
+
+#endif /* __ASM_ARCH_NAND_CORE_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/onenand-core-s3c64xx.h b/arch/arm/mach-s3c/onenand-core-s3c64xx.h
new file mode 100644 (file)
index 0000000..e2dfdd1
--- /dev/null
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Copyright (c) 2010 Samsung Electronics
+ *  Kyungmin Park <kyungmin.park@samsung.com>
+ *  Marek Szyprowski <m.szyprowski@samsung.com>
+ *
+ * Samsung OneNAD Controller core functions
+ */
+
+#ifndef __ASM_ARCH_ONENAND_CORE_S3C64XX_H
+#define __ASM_ARCH_ONENAND_CORE_S3C64XX_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c_onenand_setname(char *name)
+{
+#ifdef CONFIG_S3C_DEV_ONENAND
+       s3c_device_onenand.name = name;
+#endif
+}
+
+static inline void s3c64xx_onenand1_setname(char *name)
+{
+#ifdef CONFIG_S3C64XX_DEV_ONENAND1
+       s3c64xx_device_onenand1.name = name;
+#endif
+}
+
+#endif /* __ASM_ARCH_ONENAND_CORE_S3C64XX_H */
diff --git a/arch/arm/mach-s3c/osiris.h b/arch/arm/mach-s3c/osiris.h
new file mode 100644 (file)
index 0000000..b6c9c5e
--- /dev/null
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2005 Simtec Electronics
+ *     http://www.simtec.co.uk/products/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * OSIRIS - CPLD control constants
+ * OSIRIS - Memory map definitions
+ */
+
+#ifndef __MACH_S3C24XX_OSIRIS_H
+#define __MACH_S3C24XX_OSIRIS_H __FILE__
+
+/* CTRL0 - NAND WP control */
+
+#define OSIRIS_CTRL0_NANDSEL           (0x3)
+#define OSIRIS_CTRL0_BOOT_INT          (1<<3)
+#define OSIRIS_CTRL0_PCMCIA            (1<<4)
+#define OSIRIS_CTRL0_FIX8              (1<<5)
+#define OSIRIS_CTRL0_PCMCIA_nWAIT      (1<<6)
+#define OSIRIS_CTRL0_PCMCIA_nIOIS16    (1<<7)
+
+#define OSIRIS_CTRL1_FIX8              (1<<0)
+
+#define OSIRIS_ID_REVMASK              (0x7)
+
+/* start peripherals off after the S3C2410 */
+
+#define OSIRIS_IOADDR(x)       (S3C2410_ADDR((x) + 0x04000000))
+
+#define OSIRIS_PA_CPLD         (S3C2410_CS1 | (1<<26))
+
+/* we put the CPLD registers next, to get them out of the way */
+
+#define OSIRIS_VA_CTRL0                OSIRIS_IOADDR(0x00000000)
+#define OSIRIS_PA_CTRL0                (OSIRIS_PA_CPLD)
+
+#define OSIRIS_VA_CTRL1                OSIRIS_IOADDR(0x00100000)
+#define OSIRIS_PA_CTRL1                (OSIRIS_PA_CPLD + (1<<23))
+
+#define OSIRIS_VA_CTRL2                OSIRIS_IOADDR(0x00200000)
+#define OSIRIS_PA_CTRL2                (OSIRIS_PA_CPLD + (2<<23))
+
+#define OSIRIS_VA_CTRL3                OSIRIS_IOADDR(0x00300000)
+#define OSIRIS_PA_CTRL3                (OSIRIS_PA_CPLD + (2<<23))
+
+#define OSIRIS_VA_IDREG                OSIRIS_IOADDR(0x00700000)
+#define OSIRIS_PA_IDREG                (OSIRIS_PA_CPLD + (7<<23))
+
+#endif /* __MACH_S3C24XX_OSIRIS_H */
diff --git a/arch/arm/mach-s3c/otom.h b/arch/arm/mach-s3c/otom.h
new file mode 100644 (file)
index 0000000..c800f67
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * (c) 2005 Guillaume GOURAT / NexVision
+ *          guillaume.gourat@nexvision.fr
+ *
+ * NexVision OTOM board memory map definitions
+ */
+
+/*
+ * ok, we've used up to 0x01300000, now we need to find space for the
+ * peripherals that live in the nGCS[x] areas, which are quite numerous
+ * in their space.
+ */
+
+#ifndef __MACH_S3C24XX_OTOM_H
+#define __MACH_S3C24XX_OTOM_H __FILE__
+
+#define OTOM_PA_CS8900A_BASE   (S3C2410_CS3 + 0x01000000)      /* nGCS3 +0x01000000 */
+#define OTOM_VA_CS8900A_BASE   S3C2410_ADDR(0x04000000)        /* 0xF4000000 */
+
+/* physical offset addresses for the peripherals */
+
+#define OTOM_PA_FLASH0_BASE    (S3C2410_CS0)
+
+#endif /* __MACH_S3C24XX_OTOM_H */
diff --git a/arch/arm/mach-s3c/pl080.c b/arch/arm/mach-s3c/pl080.c
new file mode 100644 (file)
index 0000000..4730f08
--- /dev/null
@@ -0,0 +1,264 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Samsung's S3C64XX generic DMA support using amba-pl08x driver.
+//
+// Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
+
+#include <linux/kernel.h>
+#include <linux/amba/bus.h>
+#include <linux/amba/pl080.h>
+#include <linux/amba/pl08x.h>
+#include <linux/of.h>
+
+#include "cpu.h"
+#include <mach/irqs.h>
+#include "map.h"
+
+#include "regs-sys-s3c64xx.h"
+
+static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd)
+{
+       return cd->min_signal;
+}
+
+static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch)
+{
+}
+
+/*
+ * DMA0
+ */
+
+static struct pl08x_channel_data s3c64xx_dma0_info[] = {
+       {
+               .bus_id = "uart0_tx",
+               .min_signal = 0,
+               .max_signal = 0,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart0_rx",
+               .min_signal = 1,
+               .max_signal = 1,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart1_tx",
+               .min_signal = 2,
+               .max_signal = 2,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart1_rx",
+               .min_signal = 3,
+               .max_signal = 3,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart2_tx",
+               .min_signal = 4,
+               .max_signal = 4,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart2_rx",
+               .min_signal = 5,
+               .max_signal = 5,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart3_tx",
+               .min_signal = 6,
+               .max_signal = 6,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart3_rx",
+               .min_signal = 7,
+               .max_signal = 7,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pcm0_tx",
+               .min_signal = 8,
+               .max_signal = 8,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pcm0_rx",
+               .min_signal = 9,
+               .max_signal = 9,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s0_tx",
+               .min_signal = 10,
+               .max_signal = 10,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s0_rx",
+               .min_signal = 11,
+               .max_signal = 11,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi0_tx",
+               .min_signal = 12,
+               .max_signal = 12,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi0_rx",
+               .min_signal = 13,
+               .max_signal = 13,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s2_tx",
+               .min_signal = 14,
+               .max_signal = 14,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s2_rx",
+               .min_signal = 15,
+               .max_signal = 15,
+               .periph_buses = PL08X_AHB2,
+       }
+};
+
+static const struct dma_slave_map s3c64xx_dma0_slave_map[] = {
+       { "s3c6400-uart.0", "tx", &s3c64xx_dma0_info[0] },
+       { "s3c6400-uart.0", "rx", &s3c64xx_dma0_info[1] },
+       { "s3c6400-uart.1", "tx", &s3c64xx_dma0_info[2] },
+       { "s3c6400-uart.1", "rx", &s3c64xx_dma0_info[3] },
+       { "s3c6400-uart.2", "tx", &s3c64xx_dma0_info[4] },
+       { "s3c6400-uart.2", "rx", &s3c64xx_dma0_info[5] },
+       { "s3c6400-uart.3", "tx", &s3c64xx_dma0_info[6] },
+       { "s3c6400-uart.3", "rx", &s3c64xx_dma0_info[7] },
+       { "samsung-pcm.0", "tx", &s3c64xx_dma0_info[8] },
+       { "samsung-pcm.0", "rx", &s3c64xx_dma0_info[9] },
+       { "samsung-i2s.0", "tx", &s3c64xx_dma0_info[10] },
+       { "samsung-i2s.0", "rx", &s3c64xx_dma0_info[11] },
+       { "s3c6410-spi.0", "tx", &s3c64xx_dma0_info[12] },
+       { "s3c6410-spi.0", "rx", &s3c64xx_dma0_info[13] },
+       { "samsung-i2s.2", "tx", &s3c64xx_dma0_info[14] },
+       { "samsung-i2s.2", "rx", &s3c64xx_dma0_info[15] },
+};
+
+struct pl08x_platform_data s3c64xx_dma0_plat_data = {
+       .memcpy_burst_size = PL08X_BURST_SZ_4,
+       .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
+       .memcpy_prot_buff = true,
+       .memcpy_prot_cache = true,
+       .lli_buses = PL08X_AHB1,
+       .mem_buses = PL08X_AHB1,
+       .get_xfer_signal = pl08x_get_xfer_signal,
+       .put_xfer_signal = pl08x_put_xfer_signal,
+       .slave_channels = s3c64xx_dma0_info,
+       .num_slave_channels = ARRAY_SIZE(s3c64xx_dma0_info),
+       .slave_map = s3c64xx_dma0_slave_map,
+       .slave_map_len = ARRAY_SIZE(s3c64xx_dma0_slave_map),
+};
+
+static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0,
+                       0x75000000, {IRQ_DMA0}, &s3c64xx_dma0_plat_data);
+
+/*
+ * DMA1
+ */
+
+static struct pl08x_channel_data s3c64xx_dma1_info[] = {
+       {
+               .bus_id = "pcm1_tx",
+               .min_signal = 0,
+               .max_signal = 0,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pcm1_rx",
+               .min_signal = 1,
+               .max_signal = 1,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s1_tx",
+               .min_signal = 2,
+               .max_signal = 2,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s1_rx",
+               .min_signal = 3,
+               .max_signal = 3,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi1_tx",
+               .min_signal = 4,
+               .max_signal = 4,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi1_rx",
+               .min_signal = 5,
+               .max_signal = 5,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "ac97_out",
+               .min_signal = 6,
+               .max_signal = 6,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "ac97_in",
+               .min_signal = 7,
+               .max_signal = 7,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "ac97_mic",
+               .min_signal = 8,
+               .max_signal = 8,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pwm",
+               .min_signal = 9,
+               .max_signal = 9,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "irda",
+               .min_signal = 10,
+               .max_signal = 10,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "external",
+               .min_signal = 11,
+               .max_signal = 11,
+               .periph_buses = PL08X_AHB2,
+       },
+};
+
+static const struct dma_slave_map s3c64xx_dma1_slave_map[] = {
+       { "samsung-pcm.1", "tx", &s3c64xx_dma1_info[0] },
+       { "samsung-pcm.1", "rx", &s3c64xx_dma1_info[1] },
+       { "samsung-i2s.1", "tx", &s3c64xx_dma1_info[2] },
+       { "samsung-i2s.1", "rx", &s3c64xx_dma1_info[3] },
+       { "s3c6410-spi.1", "tx", &s3c64xx_dma1_info[4] },
+       { "s3c6410-spi.1", "rx", &s3c64xx_dma1_info[5] },
+};
+
+struct pl08x_platform_data s3c64xx_dma1_plat_data = {
+       .memcpy_burst_size = PL08X_BURST_SZ_4,
+       .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
+       .memcpy_prot_buff = true,
+       .memcpy_prot_cache = true,
+       .lli_buses = PL08X_AHB1,
+       .mem_buses = PL08X_AHB1,
+       .get_xfer_signal = pl08x_get_xfer_signal,
+       .put_xfer_signal = pl08x_put_xfer_signal,
+       .slave_channels = s3c64xx_dma1_info,
+       .num_slave_channels = ARRAY_SIZE(s3c64xx_dma1_info),
+       .slave_map = s3c64xx_dma1_slave_map,
+       .slave_map_len = ARRAY_SIZE(s3c64xx_dma1_slave_map),
+};
+
+static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
+                       0x75100000, {IRQ_DMA1}, &s3c64xx_dma1_plat_data);
+
+static int __init s3c64xx_pl080_init(void)
+{
+       if (!soc_is_s3c64xx())
+               return 0;
+
+       /* Set all DMA configuration to be DMA, not SDMA */
+       writel(0xffffff, S3C64XX_SDMA_SEL);
+
+       if (of_have_populated_dt())
+               return 0;
+
+       amba_device_register(&s3c64xx_dma0_device, &iomem_resource);
+       amba_device_register(&s3c64xx_dma1_device, &iomem_resource);
+
+       return 0;
+}
+arch_initcall(s3c64xx_pl080_init);
diff --git a/arch/arm/mach-s3c/platformdata.c b/arch/arm/mach-s3c/platformdata.c
new file mode 100644 (file)
index 0000000..e643c81
--- /dev/null
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
+//
+// Helper for platform data setting
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include "devs.h"
+#include "sdhci.h"
+
+void __init *s3c_set_platdata(void *pd, size_t pdsize,
+                             struct platform_device *pdev)
+{
+       void *npd;
+
+       if (!pd) {
+               /* too early to use dev_name(), may not be registered */
+               printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
+               return NULL;
+       }
+
+       npd = kmemdup(pd, pdsize, GFP_KERNEL);
+       if (!npd)
+               return NULL;
+
+       pdev->dev.platform_data = npd;
+       return npd;
+}
+
+void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
+                            struct s3c_sdhci_platdata *set)
+{
+       set->cd_type = pd->cd_type;
+       set->ext_cd_init = pd->ext_cd_init;
+       set->ext_cd_cleanup = pd->ext_cd_cleanup;
+       set->ext_cd_gpio = pd->ext_cd_gpio;
+       set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
+
+       if (pd->max_width)
+               set->max_width = pd->max_width;
+       if (pd->cfg_gpio)
+               set->cfg_gpio = pd->cfg_gpio;
+       if (pd->host_caps)
+               set->host_caps |= pd->host_caps;
+       if (pd->host_caps2)
+               set->host_caps2 |= pd->host_caps2;
+       if (pd->pm_caps)
+               set->pm_caps |= pd->pm_caps;
+}
diff --git a/arch/arm/mach-s3c/pll-s3c2410.c b/arch/arm/mach-s3c/pll-s3c2410.c
new file mode 100644 (file)
index 0000000..3fbc99e
--- /dev/null
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2006-2007 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//     Vincent Sanders <vince@arm.linux.org.uk>
+//
+// S3C2410 CPU PLL tables
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
+
+/* This array should be sorted in ascending order of the frequencies */
+static struct cpufreq_frequency_table pll_vals_12MHz[] = {
+    { .frequency = 34000000,  .driver_data = PLLVAL(82, 2, 3),   },
+    { .frequency = 45000000,  .driver_data = PLLVAL(82, 1, 3),   },
+    { .frequency = 48000000,  .driver_data = PLLVAL(120, 2, 3),  },
+    { .frequency = 51000000,  .driver_data = PLLVAL(161, 3, 3),  },
+    { .frequency = 56000000,  .driver_data = PLLVAL(142, 2, 3),  },
+    { .frequency = 68000000,  .driver_data = PLLVAL(82, 2, 2),   },
+    { .frequency = 79000000,  .driver_data = PLLVAL(71, 1, 2),   },
+    { .frequency = 85000000,  .driver_data = PLLVAL(105, 2, 2),  },
+    { .frequency = 90000000,  .driver_data = PLLVAL(112, 2, 2),  },
+    { .frequency = 101000000, .driver_data = PLLVAL(127, 2, 2),  },
+    { .frequency = 113000000, .driver_data = PLLVAL(105, 1, 2),  },
+    { .frequency = 118000000, .driver_data = PLLVAL(150, 2, 2),  },
+    { .frequency = 124000000, .driver_data = PLLVAL(116, 1, 2),  },
+    { .frequency = 135000000, .driver_data = PLLVAL(82, 2, 1),   },
+    { .frequency = 147000000, .driver_data = PLLVAL(90, 2, 1),   },
+    { .frequency = 152000000, .driver_data = PLLVAL(68, 1, 1),   },
+    { .frequency = 158000000, .driver_data = PLLVAL(71, 1, 1),   },
+    { .frequency = 170000000, .driver_data = PLLVAL(77, 1, 1),   },
+    { .frequency = 180000000, .driver_data = PLLVAL(82, 1, 1),   },
+    { .frequency = 186000000, .driver_data = PLLVAL(85, 1, 1),   },
+    { .frequency = 192000000, .driver_data = PLLVAL(88, 1, 1),   },
+    { .frequency = 203000000, .driver_data = PLLVAL(161, 3, 1),  },
+
+    /* 2410A extras */
+
+    { .frequency = 210000000, .driver_data = PLLVAL(132, 2, 1),  },
+    { .frequency = 226000000, .driver_data = PLLVAL(105, 1, 1),  },
+    { .frequency = 266000000, .driver_data = PLLVAL(125, 1, 1),  },
+    { .frequency = 268000000, .driver_data = PLLVAL(126, 1, 1),  },
+    { .frequency = 270000000, .driver_data = PLLVAL(127, 1, 1),  },
+};
+
+static int s3c2410_plls_add(struct device *dev, struct subsys_interface *sif)
+{
+       return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz));
+}
+
+static struct subsys_interface s3c2410_plls_interface = {
+       .name           = "s3c2410_plls",
+       .subsys         = &s3c2410_subsys,
+       .add_dev        = s3c2410_plls_add,
+};
+
+static int __init s3c2410_pll_init(void)
+{
+       return subsys_interface_register(&s3c2410_plls_interface);
+
+}
+arch_initcall(s3c2410_pll_init);
+
+static struct subsys_interface s3c2410a_plls_interface = {
+       .name           = "s3c2410a_plls",
+       .subsys         = &s3c2410a_subsys,
+       .add_dev        = s3c2410_plls_add,
+};
+
+static int __init s3c2410a_pll_init(void)
+{
+       return subsys_interface_register(&s3c2410a_plls_interface);
+}
+arch_initcall(s3c2410a_pll_init);
diff --git a/arch/arm/mach-s3c/pll-s3c2440-12000000.c b/arch/arm/mach-s3c/pll-s3c2440-12000000.c
new file mode 100644 (file)
index 0000000..fdb8e8c
--- /dev/null
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006-2007 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//     Vincent Sanders <vince@arm.linux.org.uk>
+//
+// S3C2440/S3C2442 CPU PLL tables (12MHz Crystal)
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
+
+/* This array should be sorted in ascending order of the frequencies */
+static struct cpufreq_frequency_table s3c2440_plls_12[] = {
+       { .frequency = 75000000,        .driver_data = PLLVAL(0x75, 3, 3),  },  /* FVco 600.000000 */
+       { .frequency = 80000000,        .driver_data = PLLVAL(0x98, 4, 3),  },  /* FVco 640.000000 */
+       { .frequency = 90000000,        .driver_data = PLLVAL(0x70, 2, 3),  },  /* FVco 720.000000 */
+       { .frequency = 100000000,       .driver_data = PLLVAL(0x5c, 1, 3),  },  /* FVco 800.000000 */
+       { .frequency = 110000000,       .driver_data = PLLVAL(0x66, 1, 3),  },  /* FVco 880.000000 */
+       { .frequency = 120000000,       .driver_data = PLLVAL(0x70, 1, 3),  },  /* FVco 960.000000 */
+       { .frequency = 150000000,       .driver_data = PLLVAL(0x75, 3, 2),  },  /* FVco 600.000000 */
+       { .frequency = 160000000,       .driver_data = PLLVAL(0x98, 4, 2),  },  /* FVco 640.000000 */
+       { .frequency = 170000000,       .driver_data = PLLVAL(0x4d, 1, 2),  },  /* FVco 680.000000 */
+       { .frequency = 180000000,       .driver_data = PLLVAL(0x70, 2, 2),  },  /* FVco 720.000000 */
+       { .frequency = 190000000,       .driver_data = PLLVAL(0x57, 1, 2),  },  /* FVco 760.000000 */
+       { .frequency = 200000000,       .driver_data = PLLVAL(0x5c, 1, 2),  },  /* FVco 800.000000 */
+       { .frequency = 210000000,       .driver_data = PLLVAL(0x84, 2, 2),  },  /* FVco 840.000000 */
+       { .frequency = 220000000,       .driver_data = PLLVAL(0x66, 1, 2),  },  /* FVco 880.000000 */
+       { .frequency = 230000000,       .driver_data = PLLVAL(0x6b, 1, 2),  },  /* FVco 920.000000 */
+       { .frequency = 240000000,       .driver_data = PLLVAL(0x70, 1, 2),  },  /* FVco 960.000000 */
+       { .frequency = 300000000,       .driver_data = PLLVAL(0x75, 3, 1),  },  /* FVco 600.000000 */
+       { .frequency = 310000000,       .driver_data = PLLVAL(0x93, 4, 1),  },  /* FVco 620.000000 */
+       { .frequency = 320000000,       .driver_data = PLLVAL(0x98, 4, 1),  },  /* FVco 640.000000 */
+       { .frequency = 330000000,       .driver_data = PLLVAL(0x66, 2, 1),  },  /* FVco 660.000000 */
+       { .frequency = 340000000,       .driver_data = PLLVAL(0x4d, 1, 1),  },  /* FVco 680.000000 */
+       { .frequency = 350000000,       .driver_data = PLLVAL(0xa7, 4, 1),  },  /* FVco 700.000000 */
+       { .frequency = 360000000,       .driver_data = PLLVAL(0x70, 2, 1),  },  /* FVco 720.000000 */
+       { .frequency = 370000000,       .driver_data = PLLVAL(0xb1, 4, 1),  },  /* FVco 740.000000 */
+       { .frequency = 380000000,       .driver_data = PLLVAL(0x57, 1, 1),  },  /* FVco 760.000000 */
+       { .frequency = 390000000,       .driver_data = PLLVAL(0x7a, 2, 1),  },  /* FVco 780.000000 */
+       { .frequency = 400000000,       .driver_data = PLLVAL(0x5c, 1, 1),  },  /* FVco 800.000000 */
+};
+
+static int s3c2440_plls12_add(struct device *dev, struct subsys_interface *sif)
+{
+       struct clk *xtal_clk;
+       unsigned long xtal;
+
+       xtal_clk = clk_get(NULL, "xtal");
+       if (IS_ERR(xtal_clk))
+               return PTR_ERR(xtal_clk);
+
+       xtal = clk_get_rate(xtal_clk);
+       clk_put(xtal_clk);
+
+       if (xtal == 12000000) {
+               printk(KERN_INFO "Using PLL table for 12MHz crystal\n");
+               return s3c_plltab_register(s3c2440_plls_12,
+                                          ARRAY_SIZE(s3c2440_plls_12));
+       }
+
+       return 0;
+}
+
+static struct subsys_interface s3c2440_plls12_interface = {
+       .name           = "s3c2440_plls12",
+       .subsys         = &s3c2440_subsys,
+       .add_dev        = s3c2440_plls12_add,
+};
+
+static int __init s3c2440_pll_12mhz(void)
+{
+       return subsys_interface_register(&s3c2440_plls12_interface);
+
+}
+arch_initcall(s3c2440_pll_12mhz);
+
+static struct subsys_interface s3c2442_plls12_interface = {
+       .name           = "s3c2442_plls12",
+       .subsys         = &s3c2442_subsys,
+       .add_dev        = s3c2440_plls12_add,
+};
+
+static int __init s3c2442_pll_12mhz(void)
+{
+       return subsys_interface_register(&s3c2442_plls12_interface);
+
+}
+arch_initcall(s3c2442_pll_12mhz);
diff --git a/arch/arm/mach-s3c/pll-s3c2440-16934400.c b/arch/arm/mach-s3c/pll-s3c2440-16934400.c
new file mode 100644 (file)
index 0000000..438b6fc
--- /dev/null
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006-2008 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//     Vincent Sanders <vince@arm.linux.org.uk>
+//
+// S3C2440/S3C2442 CPU PLL tables (16.93444MHz Crystal)
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
+
+/* This array should be sorted in ascending order of the frequencies */
+static struct cpufreq_frequency_table s3c2440_plls_169344[] = {
+       { .frequency = 78019200,        .driver_data = PLLVAL(121, 5, 3),       },      /* FVco 624.153600 */
+       { .frequency = 84067200,        .driver_data = PLLVAL(131, 5, 3),       },      /* FVco 672.537600 */
+       { .frequency = 90115200,        .driver_data = PLLVAL(141, 5, 3),       },      /* FVco 720.921600 */
+       { .frequency = 96163200,        .driver_data = PLLVAL(151, 5, 3),       },      /* FVco 769.305600 */
+       { .frequency = 102135600,       .driver_data = PLLVAL(185, 6, 3),       },      /* FVco 817.084800 */
+       { .frequency = 108259200,       .driver_data = PLLVAL(171, 5, 3),       },      /* FVco 866.073600 */
+       { .frequency = 114307200,       .driver_data = PLLVAL(127, 3, 3),       },      /* FVco 914.457600 */
+       { .frequency = 120234240,       .driver_data = PLLVAL(134, 3, 3),       },      /* FVco 961.873920 */
+       { .frequency = 126161280,       .driver_data = PLLVAL(141, 3, 3),       },      /* FVco 1009.290240 */
+       { .frequency = 132088320,       .driver_data = PLLVAL(148, 3, 3),       },      /* FVco 1056.706560 */
+       { .frequency = 138015360,       .driver_data = PLLVAL(155, 3, 3),       },      /* FVco 1104.122880 */
+       { .frequency = 144789120,       .driver_data = PLLVAL(163, 3, 3),       },      /* FVco 1158.312960 */
+       { .frequency = 150100363,       .driver_data = PLLVAL(187, 9, 2),       },      /* FVco 600.401454 */
+       { .frequency = 156038400,       .driver_data = PLLVAL(121, 5, 2),       },      /* FVco 624.153600 */
+       { .frequency = 162086400,       .driver_data = PLLVAL(126, 5, 2),       },      /* FVco 648.345600 */
+       { .frequency = 168134400,       .driver_data = PLLVAL(131, 5, 2),       },      /* FVco 672.537600 */
+       { .frequency = 174048000,       .driver_data = PLLVAL(177, 7, 2),       },      /* FVco 696.192000 */
+       { .frequency = 180230400,       .driver_data = PLLVAL(141, 5, 2),       },      /* FVco 720.921600 */
+       { .frequency = 186278400,       .driver_data = PLLVAL(124, 4, 2),       },      /* FVco 745.113600 */
+       { .frequency = 192326400,       .driver_data = PLLVAL(151, 5, 2),       },      /* FVco 769.305600 */
+       { .frequency = 198132480,       .driver_data = PLLVAL(109, 3, 2),       },      /* FVco 792.529920 */
+       { .frequency = 204271200,       .driver_data = PLLVAL(185, 6, 2),       },      /* FVco 817.084800 */
+       { .frequency = 210268800,       .driver_data = PLLVAL(141, 4, 2),       },      /* FVco 841.075200 */
+       { .frequency = 216518400,       .driver_data = PLLVAL(171, 5, 2),       },      /* FVco 866.073600 */
+       { .frequency = 222264000,       .driver_data = PLLVAL(97, 2, 2),        },      /* FVco 889.056000 */
+       { .frequency = 228614400,       .driver_data = PLLVAL(127, 3, 2),       },      /* FVco 914.457600 */
+       { .frequency = 234259200,       .driver_data = PLLVAL(158, 4, 2),       },      /* FVco 937.036800 */
+       { .frequency = 240468480,       .driver_data = PLLVAL(134, 3, 2),       },      /* FVco 961.873920 */
+       { .frequency = 246960000,       .driver_data = PLLVAL(167, 4, 2),       },      /* FVco 987.840000 */
+       { .frequency = 252322560,       .driver_data = PLLVAL(141, 3, 2),       },      /* FVco 1009.290240 */
+       { .frequency = 258249600,       .driver_data = PLLVAL(114, 2, 2),       },      /* FVco 1032.998400 */
+       { .frequency = 264176640,       .driver_data = PLLVAL(148, 3, 2),       },      /* FVco 1056.706560 */
+       { .frequency = 270950400,       .driver_data = PLLVAL(120, 2, 2),       },      /* FVco 1083.801600 */
+       { .frequency = 276030720,       .driver_data = PLLVAL(155, 3, 2),       },      /* FVco 1104.122880 */
+       { .frequency = 282240000,       .driver_data = PLLVAL(92, 1, 2),        },      /* FVco 1128.960000 */
+       { .frequency = 289578240,       .driver_data = PLLVAL(163, 3, 2),       },      /* FVco 1158.312960 */
+       { .frequency = 294235200,       .driver_data = PLLVAL(131, 2, 2),       },      /* FVco 1176.940800 */
+       { .frequency = 300200727,       .driver_data = PLLVAL(187, 9, 1),       },      /* FVco 600.401454 */
+       { .frequency = 306358690,       .driver_data = PLLVAL(191, 9, 1),       },      /* FVco 612.717380 */
+       { .frequency = 312076800,       .driver_data = PLLVAL(121, 5, 1),       },      /* FVco 624.153600 */
+       { .frequency = 318366720,       .driver_data = PLLVAL(86, 3, 1),        },      /* FVco 636.733440 */
+       { .frequency = 324172800,       .driver_data = PLLVAL(126, 5, 1),       },      /* FVco 648.345600 */
+       { .frequency = 330220800,       .driver_data = PLLVAL(109, 4, 1),       },      /* FVco 660.441600 */
+       { .frequency = 336268800,       .driver_data = PLLVAL(131, 5, 1),       },      /* FVco 672.537600 */
+       { .frequency = 342074880,       .driver_data = PLLVAL(93, 3, 1),        },      /* FVco 684.149760 */
+       { .frequency = 348096000,       .driver_data = PLLVAL(177, 7, 1),       },      /* FVco 696.192000 */
+       { .frequency = 355622400,       .driver_data = PLLVAL(118, 4, 1),       },      /* FVco 711.244800 */
+       { .frequency = 360460800,       .driver_data = PLLVAL(141, 5, 1),       },      /* FVco 720.921600 */
+       { .frequency = 366206400,       .driver_data = PLLVAL(165, 6, 1),       },      /* FVco 732.412800 */
+       { .frequency = 372556800,       .driver_data = PLLVAL(124, 4, 1),       },      /* FVco 745.113600 */
+       { .frequency = 378201600,       .driver_data = PLLVAL(126, 4, 1),       },      /* FVco 756.403200 */
+       { .frequency = 384652800,       .driver_data = PLLVAL(151, 5, 1),       },      /* FVco 769.305600 */
+       { .frequency = 391608000,       .driver_data = PLLVAL(177, 6, 1),       },      /* FVco 783.216000 */
+       { .frequency = 396264960,       .driver_data = PLLVAL(109, 3, 1),       },      /* FVco 792.529920 */
+       { .frequency = 402192000,       .driver_data = PLLVAL(87, 2, 1),        },      /* FVco 804.384000 */
+};
+
+static int s3c2440_plls169344_add(struct device *dev,
+                                 struct subsys_interface *sif)
+{
+       struct clk *xtal_clk;
+       unsigned long xtal;
+
+       xtal_clk = clk_get(NULL, "xtal");
+       if (IS_ERR(xtal_clk))
+               return PTR_ERR(xtal_clk);
+
+       xtal = clk_get_rate(xtal_clk);
+       clk_put(xtal_clk);
+
+       if (xtal == 169344000) {
+               printk(KERN_INFO "Using PLL table for 16.9344MHz crystal\n");
+               return s3c_plltab_register(s3c2440_plls_169344,
+                                          ARRAY_SIZE(s3c2440_plls_169344));
+       }
+
+       return 0;
+}
+
+static struct subsys_interface s3c2440_plls169344_interface = {
+       .name           = "s3c2440_plls169344",
+       .subsys         = &s3c2440_subsys,
+       .add_dev        = s3c2440_plls169344_add,
+};
+
+static int __init s3c2440_pll_16934400(void)
+{
+       return subsys_interface_register(&s3c2440_plls169344_interface);
+}
+arch_initcall(s3c2440_pll_16934400);
+
+static struct subsys_interface s3c2442_plls169344_interface = {
+       .name           = "s3c2442_plls169344",
+       .subsys         = &s3c2442_subsys,
+       .add_dev        = s3c2440_plls169344_add,
+};
+
+static int __init s3c2442_pll_16934400(void)
+{
+       return subsys_interface_register(&s3c2442_plls169344_interface);
+}
+arch_initcall(s3c2442_pll_16934400);
diff --git a/arch/arm/mach-s3c/pm-common.c b/arch/arm/mach-s3c/pm-common.c
new file mode 100644 (file)
index 0000000..618bd44
--- /dev/null
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2013 Samsung Electronics Co., Ltd.
+//     Tomasz Figa <t.figa@samsung.com>
+// Copyright (C) 2008 Openmoko, Inc.
+// Copyright (C) 2004-2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Samsung common power management helper functions.
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+
+#include "pm-common.h"
+
+/* helper functions to save and restore register state */
+
+/**
+ * s3c_pm_do_save() - save a set of registers for restoration on resume.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Run through the list of registers given, saving their contents in the
+ * array for later restoration when we wakeup.
+ */
+void s3c_pm_do_save(struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++) {
+               ptr->val = readl_relaxed(ptr->reg);
+               S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
+       }
+}
+
+/**
+ * s3c_pm_do_restore() - restore register values from the save list.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Restore the register values saved from s3c_pm_do_save().
+ *
+ * Note, we do not use S3C_PMDBG() in here, as the system may not have
+ * restore the UARTs state yet
+*/
+
+void s3c_pm_do_restore(const struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++) {
+               pr_debug("restore %p (restore %08lx, was %08x)\n",
+                               ptr->reg, ptr->val, readl_relaxed(ptr->reg));
+
+               writel_relaxed(ptr->val, ptr->reg);
+       }
+}
+
+/**
+ * s3c_pm_do_restore_core() - early restore register values from save list.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * This is similar to s3c_pm_do_restore() except we try and minimise the
+ * side effects of the function in case registers that hardware might need
+ * to work has been restored.
+ *
+ * WARNING: Do not put any debug in here that may effect memory or use
+ * peripherals, as things may be changing!
+*/
+
+void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++)
+               writel_relaxed(ptr->val, ptr->reg);
+}
diff --git a/arch/arm/mach-s3c/pm-common.h b/arch/arm/mach-s3c/pm-common.h
new file mode 100644 (file)
index 0000000..18b9607
--- /dev/null
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ *     Tomasz Figa <t.figa@samsung.com>
+ * Copyright (c) 2004 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Written by Ben Dooks, <ben@simtec.co.uk>
+ */
+
+#ifndef __PLAT_SAMSUNG_PM_COMMON_H
+#define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
+
+#include <linux/irq.h>
+#include <linux/soc/samsung/s3c-pm.h>
+
+/* sleep save info */
+
+/**
+ * struct sleep_save - save information for shared peripherals.
+ * @reg: Pointer to the register to save.
+ * @val: Holder for the value saved from reg.
+ *
+ * This describes a list of registers which is used by the pm core and
+ * other subsystem to save and restore register values over suspend.
+ */
+struct sleep_save {
+       void __iomem    *reg;
+       unsigned long   val;
+};
+
+#define SAVE_ITEM(x) \
+       { .reg = (x) }
+
+/* helper functions to save/restore lists of registers. */
+
+extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
+extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
+extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
+
+#endif
diff --git a/arch/arm/mach-s3c/pm-core-s3c24xx.h b/arch/arm/mach-s3c/pm-core-s3c24xx.h
new file mode 100644 (file)
index 0000000..bcb7978
--- /dev/null
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C24xx - PM core support for arch/arm/plat-s3c/pm.c
+ */
+
+#include <linux/delay.h>
+#include <linux/io.h>
+
+#include "regs-clock.h"
+#include "regs-irq-s3c24xx.h"
+#include <mach/irqs.h>
+
+static inline void s3c_pm_debug_init_uart(void)
+{
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+       unsigned long tmp = __raw_readl(S3C2410_CLKCON);
+
+       /* re-start uart clocks */
+       tmp |= S3C2410_CLKCON_UART0;
+       tmp |= S3C2410_CLKCON_UART1;
+       tmp |= S3C2410_CLKCON_UART2;
+
+       __raw_writel(tmp, S3C2410_CLKCON);
+       udelay(10);
+#endif
+}
+
+static inline void s3c_pm_arch_prepare_irqs(void)
+{
+       __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
+       __raw_writel(s3c_irqwake_eintmask, S3C2410_EINTMASK);
+
+       /* ack any outstanding external interrupts before we go to sleep */
+
+       __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
+       __raw_writel(__raw_readl(S3C2410_INTPND), S3C2410_INTPND);
+       __raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND);
+
+}
+
+static inline void s3c_pm_arch_stop_clocks(void)
+{
+       __raw_writel(0x00, S3C2410_CLKCON);  /* turn off clocks over sleep */
+}
+
+/* s3c2410_pm_show_resume_irqs
+ *
+ * print any IRQs asserted at resume time (ie, we woke from)
+*/
+static inline void s3c_pm_show_resume_irqs(int start, unsigned long which,
+                                          unsigned long mask)
+{
+       int i;
+
+       which &= ~mask;
+
+       for (i = 0; i <= 31; i++) {
+               if (which & (1L<<i)) {
+                       S3C_PMDBG("IRQ %d asserted at resume\n", start+i);
+               }
+       }
+}
+
+static inline void s3c_pm_arch_show_resume_irqs(void)
+{
+       S3C_PMDBG("post sleep: IRQs 0x%08x, 0x%08x\n",
+                 __raw_readl(S3C2410_SRCPND),
+                 __raw_readl(S3C2410_EINTPEND));
+
+       s3c_pm_show_resume_irqs(IRQ_EINT0, __raw_readl(S3C2410_SRCPND),
+                               s3c_irqwake_intmask);
+
+       s3c_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
+                               s3c_irqwake_eintmask);
+}
+
+static inline void s3c_pm_restored_gpios(void) { }
+static inline void samsung_pm_saved_gpios(void) { }
+
+/* state for IRQs over sleep */
+
+/* default is to allow for EINT0..EINT15, and IRQ_RTC as wakeup sources
+ *
+ * set bit to 1 in allow bitfield to enable the wakeup settings on it
+*/
+#ifdef CONFIG_PM_SLEEP
+#define s3c_irqwake_intallow   (1L << 30 | 0xfL)
+#define s3c_irqwake_eintallow  (0x0000fff0L)
+#else
+#define s3c_irqwake_eintallow 0
+#define s3c_irqwake_intallow  0
+#endif
diff --git a/arch/arm/mach-s3c/pm-core-s3c64xx.h b/arch/arm/mach-s3c/pm-core-s3c64xx.h
new file mode 100644 (file)
index 0000000..06f564e
--- /dev/null
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX - PM core support for arch/arm/plat-s3c/pm.c
+ */
+
+#ifndef __MACH_S3C64XX_PM_CORE_H
+#define __MACH_S3C64XX_PM_CORE_H __FILE__
+
+#include <linux/serial_s3c.h>
+#include <linux/delay.h>
+
+#include "regs-gpio.h"
+#include "regs-clock.h"
+#include "map.h"
+
+static inline void s3c_pm_debug_init_uart(void)
+{
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+       u32 tmp = __raw_readl(S3C_PCLK_GATE);
+
+       /* As a note, since the S3C64XX UARTs generally have multiple
+        * clock sources, we simply enable PCLK at the moment and hope
+        * that the resume settings for the UART are suitable for the
+        * use with PCLK.
+        */
+
+       tmp |= S3C_CLKCON_PCLK_UART0;
+       tmp |= S3C_CLKCON_PCLK_UART1;
+       tmp |= S3C_CLKCON_PCLK_UART2;
+       tmp |= S3C_CLKCON_PCLK_UART3;
+
+       __raw_writel(tmp, S3C_PCLK_GATE);
+       udelay(10);
+#endif
+}
+
+static inline void s3c_pm_arch_prepare_irqs(void)
+{
+       /* VIC should have already been taken care of */
+
+       /* clear any pending EINT0 interrupts */
+       __raw_writel(__raw_readl(S3C64XX_EINT0PEND), S3C64XX_EINT0PEND);
+}
+
+static inline void s3c_pm_arch_stop_clocks(void)
+{
+}
+
+static inline void s3c_pm_arch_show_resume_irqs(void)
+{
+}
+
+/* make these defines, we currently do not have any need to change
+ * the IRQ wake controls depending on the CPU we are running on */
+#ifdef CONFIG_PM_SLEEP
+#define s3c_irqwake_eintallow  ((1 << 28) - 1)
+#define s3c_irqwake_intallow   (~0)
+#else
+#define s3c_irqwake_eintallow 0
+#define s3c_irqwake_intallow  0
+#endif
+
+static inline void s3c_pm_restored_gpios(void)
+{
+       /* ensure sleep mode has been cleared from the system */
+
+       __raw_writel(0, S3C64XX_SLPEN);
+}
+
+static inline void samsung_pm_saved_gpios(void)
+{
+       /* turn on the sleep mode and keep it there, as it seems that during
+        * suspend the xCON registers get re-set and thus you can end up with
+        * problems between going to sleep and resuming.
+        */
+
+       __raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN);
+}
+#endif /* __MACH_S3C64XX_PM_CORE_H */
diff --git a/arch/arm/mach-s3c/pm-core.h b/arch/arm/mach-s3c/pm-core.h
new file mode 100644 (file)
index 0000000..b0e1d27
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "pm-core-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "pm-core-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/pm-gpio.c b/arch/arm/mach-s3c/pm-gpio.c
new file mode 100644 (file)
index 0000000..cfdbc23
--- /dev/null
@@ -0,0 +1,380 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// S3C series GPIO PM code
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+
+#include "gpio-samsung.h"
+
+#include "gpio-core.h"
+#include "pm.h"
+
+/* PM GPIO helpers */
+
+#define OFFS_CON       (0x00)
+#define OFFS_DAT       (0x04)
+#define OFFS_UP                (0x08)
+
+static void samsung_gpio_pm_1bit_save(struct samsung_gpio_chip *chip)
+{
+       chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
+       chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
+}
+
+static void samsung_gpio_pm_1bit_resume(struct samsung_gpio_chip *chip)
+{
+       void __iomem *base = chip->base;
+       u32 old_gpcon = __raw_readl(base + OFFS_CON);
+       u32 old_gpdat = __raw_readl(base + OFFS_DAT);
+       u32 gps_gpcon = chip->pm_save[0];
+       u32 gps_gpdat = chip->pm_save[1];
+       u32 gpcon;
+
+       /* GPACON only has one bit per control / data and no PULLUPs.
+        * GPACON[x] = 0 => Output, 1 => SFN */
+
+       /* first set all SFN bits to SFN */
+
+       gpcon = old_gpcon | gps_gpcon;
+       __raw_writel(gpcon, base + OFFS_CON);
+
+       /* now set all the other bits */
+
+       __raw_writel(gps_gpdat, base + OFFS_DAT);
+       __raw_writel(gps_gpcon, base + OFFS_CON);
+
+       S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
+                 chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
+}
+
+struct samsung_gpio_pm samsung_gpio_pm_1bit = {
+       .save   = samsung_gpio_pm_1bit_save,
+       .resume = samsung_gpio_pm_1bit_resume,
+};
+
+static void samsung_gpio_pm_2bit_save(struct samsung_gpio_chip *chip)
+{
+       chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
+       chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
+       chip->pm_save[2] = __raw_readl(chip->base + OFFS_UP);
+}
+
+/* Test whether the given masked+shifted bits of an GPIO configuration
+ * are one of the SFN (special function) modes. */
+
+static inline int is_sfn(unsigned long con)
+{
+       return con >= 2;
+}
+
+/* Test if the given masked+shifted GPIO configuration is an input */
+
+static inline int is_in(unsigned long con)
+{
+       return con == 0;
+}
+
+/* Test if the given masked+shifted GPIO configuration is an output */
+
+static inline int is_out(unsigned long con)
+{
+       return con == 1;
+}
+
+/**
+ * samsung_gpio_pm_2bit_resume() - restore the given GPIO bank
+ * @chip: The chip information to resume.
+ *
+ * Restore one of the GPIO banks that was saved during suspend. This is
+ * not as simple as once thought, due to the possibility of glitches
+ * from the order that the CON and DAT registers are set in.
+ *
+ * The three states the pin can be are {IN,OUT,SFN} which gives us 9
+ * combinations of changes to check. Three of these, if the pin stays
+ * in the same configuration can be discounted. This leaves us with
+ * the following:
+ *
+ * { IN => OUT }  Change DAT first
+ * { IN => SFN }  Change CON first
+ * { OUT => SFN } Change CON first, so new data will not glitch
+ * { OUT => IN }  Change CON first, so new data will not glitch
+ * { SFN => IN }  Change CON first
+ * { SFN => OUT } Change DAT first, so new data will not glitch [1]
+ *
+ * We do not currently deal with the UP registers as these control
+ * weak resistors, so a small delay in change should not need to bring
+ * these into the calculations.
+ *
+ * [1] this assumes that writing to a pin DAT whilst in SFN will set the
+ *     state for when it is next output.
+ */
+static void samsung_gpio_pm_2bit_resume(struct samsung_gpio_chip *chip)
+{
+       void __iomem *base = chip->base;
+       u32 old_gpcon = __raw_readl(base + OFFS_CON);
+       u32 old_gpdat = __raw_readl(base + OFFS_DAT);
+       u32 gps_gpcon = chip->pm_save[0];
+       u32 gps_gpdat = chip->pm_save[1];
+       u32 gpcon, old, new, mask;
+       u32 change_mask = 0x0;
+       int nr;
+
+       /* restore GPIO pull-up settings */
+       __raw_writel(chip->pm_save[2], base + OFFS_UP);
+
+       /* Create a change_mask of all the items that need to have
+        * their CON value changed before their DAT value, so that
+        * we minimise the work between the two settings.
+        */
+
+       for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {
+               old = (old_gpcon & mask) >> nr;
+               new = (gps_gpcon & mask) >> nr;
+
+               /* If there is no change, then skip */
+
+               if (old == new)
+                       continue;
+
+               /* If both are special function, then skip */
+
+               if (is_sfn(old) && is_sfn(new))
+                       continue;
+
+               /* Change is IN => OUT, do not change now */
+
+               if (is_in(old) && is_out(new))
+                       continue;
+
+               /* Change is SFN => OUT, do not change now */
+
+               if (is_sfn(old) && is_out(new))
+                       continue;
+
+               /* We should now be at the case of IN=>SFN,
+                * OUT=>SFN, OUT=>IN, SFN=>IN. */
+
+               change_mask |= mask;
+       }
+
+
+       /* Write the new CON settings */
+
+       gpcon = old_gpcon & ~change_mask;
+       gpcon |= gps_gpcon & change_mask;
+
+       __raw_writel(gpcon, base + OFFS_CON);
+
+       /* Now change any items that require DAT,CON */
+
+       __raw_writel(gps_gpdat, base + OFFS_DAT);
+       __raw_writel(gps_gpcon, base + OFFS_CON);
+
+       S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
+                 chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
+}
+
+struct samsung_gpio_pm samsung_gpio_pm_2bit = {
+       .save   = samsung_gpio_pm_2bit_save,
+       .resume = samsung_gpio_pm_2bit_resume,
+};
+
+#if defined(CONFIG_ARCH_S3C64XX)
+static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip)
+{
+       chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
+       chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT);
+       chip->pm_save[3] = __raw_readl(chip->base + OFFS_UP);
+
+       if (chip->chip.ngpio > 8)
+               chip->pm_save[0] = __raw_readl(chip->base - 4);
+}
+
+static u32 samsung_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon)
+{
+       u32 old, new, mask;
+       u32 change_mask = 0x0;
+       int nr;
+
+       for (nr = 0, mask = 0x0f; nr < 16; nr += 4, mask <<= 4) {
+               old = (old_gpcon & mask) >> nr;
+               new = (gps_gpcon & mask) >> nr;
+
+               /* If there is no change, then skip */
+
+               if (old == new)
+                       continue;
+
+               /* If both are special function, then skip */
+
+               if (is_sfn(old) && is_sfn(new))
+                       continue;
+
+               /* Change is IN => OUT, do not change now */
+
+               if (is_in(old) && is_out(new))
+                       continue;
+
+               /* Change is SFN => OUT, do not change now */
+
+               if (is_sfn(old) && is_out(new))
+                       continue;
+
+               /* We should now be at the case of IN=>SFN,
+                * OUT=>SFN, OUT=>IN, SFN=>IN. */
+
+               change_mask |= mask;
+       }
+
+       return change_mask;
+}
+
+static void samsung_gpio_pm_4bit_con(struct samsung_gpio_chip *chip, int index)
+{
+       void __iomem *con = chip->base + (index * 4);
+       u32 old_gpcon = __raw_readl(con);
+       u32 gps_gpcon = chip->pm_save[index + 1];
+       u32 gpcon, mask;
+
+       mask = samsung_gpio_pm_4bit_mask(old_gpcon, gps_gpcon);
+
+       gpcon = old_gpcon & ~mask;
+       gpcon |= gps_gpcon & mask;
+
+       __raw_writel(gpcon, con);
+}
+
+static void samsung_gpio_pm_4bit_resume(struct samsung_gpio_chip *chip)
+{
+       void __iomem *base = chip->base;
+       u32 old_gpcon[2];
+       u32 old_gpdat = __raw_readl(base + OFFS_DAT);
+       u32 gps_gpdat = chip->pm_save[2];
+
+       /* First, modify the CON settings */
+
+       old_gpcon[0] = 0;
+       old_gpcon[1] = __raw_readl(base + OFFS_CON);
+
+       samsung_gpio_pm_4bit_con(chip, 0);
+       if (chip->chip.ngpio > 8) {
+               old_gpcon[0] = __raw_readl(base - 4);
+               samsung_gpio_pm_4bit_con(chip, -1);
+       }
+
+       /* Now change the configurations that require DAT,CON */
+
+       __raw_writel(chip->pm_save[2], base + OFFS_DAT);
+       __raw_writel(chip->pm_save[1], base + OFFS_CON);
+       if (chip->chip.ngpio > 8)
+               __raw_writel(chip->pm_save[0], base - 4);
+
+       __raw_writel(chip->pm_save[2], base + OFFS_DAT);
+       __raw_writel(chip->pm_save[3], base + OFFS_UP);
+
+       if (chip->chip.ngpio > 8) {
+               S3C_PMDBG("%s: CON4 %08x,%08x => %08x,%08x, DAT %08x => %08x\n",
+                         chip->chip.label, old_gpcon[0], old_gpcon[1],
+                         __raw_readl(base - 4),
+                         __raw_readl(base + OFFS_CON),
+                         old_gpdat, gps_gpdat);
+       } else
+               S3C_PMDBG("%s: CON4 %08x => %08x, DAT %08x => %08x\n",
+                         chip->chip.label, old_gpcon[1],
+                         __raw_readl(base + OFFS_CON),
+                         old_gpdat, gps_gpdat);
+}
+
+struct samsung_gpio_pm samsung_gpio_pm_4bit = {
+       .save   = samsung_gpio_pm_4bit_save,
+       .resume = samsung_gpio_pm_4bit_resume,
+};
+#endif /* CONFIG_ARCH_S3C64XX */
+
+/**
+ * samsung_pm_save_gpio() - save gpio chip data for suspend
+ * @ourchip: The chip for suspend.
+ */
+static void samsung_pm_save_gpio(struct samsung_gpio_chip *ourchip)
+{
+       struct samsung_gpio_pm *pm = ourchip->pm;
+
+       if (pm == NULL || pm->save == NULL)
+               S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
+       else
+               pm->save(ourchip);
+}
+
+/**
+ * samsung_pm_save_gpios() - Save the state of the GPIO banks.
+ *
+ * For all the GPIO banks, save the state of each one ready for going
+ * into a suspend mode.
+ */
+void samsung_pm_save_gpios(void)
+{
+       struct samsung_gpio_chip *ourchip;
+       unsigned int gpio_nr;
+
+       for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
+               ourchip = samsung_gpiolib_getchip(gpio_nr);
+               if (!ourchip) {
+                       gpio_nr++;
+                       continue;
+               }
+
+               samsung_pm_save_gpio(ourchip);
+
+               S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n",
+                         ourchip->chip.label,
+                         ourchip->pm_save[0],
+                         ourchip->pm_save[1],
+                         ourchip->pm_save[2],
+                         ourchip->pm_save[3]);
+
+               gpio_nr += ourchip->chip.ngpio;
+               gpio_nr += CONFIG_S3C_GPIO_SPACE;
+       }
+}
+
+/**
+ * samsung_pm_resume_gpio() - restore gpio chip data after suspend
+ * @ourchip: The suspended chip.
+ */
+static void samsung_pm_resume_gpio(struct samsung_gpio_chip *ourchip)
+{
+       struct samsung_gpio_pm *pm = ourchip->pm;
+
+       if (pm == NULL || pm->resume == NULL)
+               S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
+       else
+               pm->resume(ourchip);
+}
+
+void samsung_pm_restore_gpios(void)
+{
+       struct samsung_gpio_chip *ourchip;
+       unsigned int gpio_nr;
+
+       for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
+               ourchip = samsung_gpiolib_getchip(gpio_nr);
+               if (!ourchip) {
+                       gpio_nr++;
+                       continue;
+               }
+
+               samsung_pm_resume_gpio(ourchip);
+
+               gpio_nr += ourchip->chip.ngpio;
+               gpio_nr += CONFIG_S3C_GPIO_SPACE;
+       }
+}
diff --git a/arch/arm/mach-s3c/pm-h1940.S b/arch/arm/mach-s3c/pm-h1940.S
new file mode 100644 (file)
index 0000000..3bf6685
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2006 Ben Dooks <ben-linux@fluff.org>
+ *
+ * H1940 Suspend to RAM
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include "map.h"
+
+#include "regs-gpio.h"
+
+       .text
+       .global h1940_pm_return
+
+h1940_pm_return:
+       mov     r0, #S3C2410_PA_GPIO
+       ldr     pc, [r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO]
diff --git a/arch/arm/mach-s3c/pm-s3c2410.c b/arch/arm/mach-s3c/pm-s3c2410.c
new file mode 100644 (file)
index 0000000..a664198
--- /dev/null
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2006 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C2410 (and compatible) Power Manager (Suspend-To-RAM) support
+
+#include <linux/init.h>
+#include <linux/suspend.h>
+#include <linux/errno.h>
+#include <linux/time.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+
+#include <asm/mach-types.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "gpio-cfg.h"
+#include "cpu.h"
+#include "pm.h"
+
+#include "h1940.h"
+
+static void s3c2410_pm_prepare(void)
+{
+       /* ensure at least GSTATUS3 has the resume address */
+
+       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2410_GSTATUS3);
+
+       S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
+       S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
+
+       if (machine_is_h1940()) {
+               void *base = phys_to_virt(H1940_SUSPEND_CHECK);
+               unsigned long ptr;
+               unsigned long calc = 0;
+
+               /* generate check for the bootloader to check on resume */
+
+               for (ptr = 0; ptr < 0x40000; ptr += 0x400)
+                       calc += __raw_readl(base+ptr);
+
+               __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM));
+       }
+
+       /* RX3715 and RX1950 use similar to H1940 code and the
+        * same offsets for resume and checksum pointers */
+
+       if (machine_is_rx3715() || machine_is_rx1950()) {
+               void *base = phys_to_virt(H1940_SUSPEND_CHECK);
+               unsigned long ptr;
+               unsigned long calc = 0;
+
+               /* generate check for the bootloader to check on resume */
+
+               for (ptr = 0; ptr < 0x40000; ptr += 0x4)
+                       calc += __raw_readl(base+ptr);
+
+               __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM));
+       }
+
+       if (machine_is_aml_m5900()) {
+               gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_HIGH, NULL);
+               gpio_free(S3C2410_GPF(2));
+       }
+
+       if (machine_is_rx1950()) {
+               /* According to S3C2442 user's manual, page 7-17,
+                * when the system is operating in NAND boot mode,
+                * the hardware pin configuration - EINT[23:21] â€“
+                * must be set as input for starting up after
+                * wakeup from sleep mode
+                */
+               s3c_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_INPUT);
+               s3c_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPIO_INPUT);
+               s3c_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPIO_INPUT);
+       }
+}
+
+static void s3c2410_pm_resume(void)
+{
+       unsigned long tmp;
+
+       /* unset the return-from-sleep flag, to ensure reset */
+
+       tmp = __raw_readl(S3C2410_GSTATUS2);
+       tmp &= S3C2410_GSTATUS2_OFFRESET;
+       __raw_writel(tmp, S3C2410_GSTATUS2);
+
+       if (machine_is_aml_m5900()) {
+               gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL);
+               gpio_free(S3C2410_GPF(2));
+       }
+}
+
+struct syscore_ops s3c2410_pm_syscore_ops = {
+       .resume         = s3c2410_pm_resume,
+};
+
+static int s3c2410_pm_add(struct device *dev, struct subsys_interface *sif)
+{
+       pm_cpu_prep = s3c2410_pm_prepare;
+       pm_cpu_sleep = s3c2410_cpu_suspend;
+
+       return 0;
+}
+
+#if defined(CONFIG_CPU_S3C2410)
+static struct subsys_interface s3c2410_pm_interface = {
+       .name           = "s3c2410_pm",
+       .subsys         = &s3c2410_subsys,
+       .add_dev        = s3c2410_pm_add,
+};
+
+/* register ourselves */
+
+static int __init s3c2410_pm_drvinit(void)
+{
+       return subsys_interface_register(&s3c2410_pm_interface);
+}
+
+arch_initcall(s3c2410_pm_drvinit);
+
+static struct subsys_interface s3c2410a_pm_interface = {
+       .name           = "s3c2410a_pm",
+       .subsys         = &s3c2410a_subsys,
+       .add_dev        = s3c2410_pm_add,
+};
+
+static int __init s3c2410a_pm_drvinit(void)
+{
+       return subsys_interface_register(&s3c2410a_pm_interface);
+}
+
+arch_initcall(s3c2410a_pm_drvinit);
+#endif
+
+#if defined(CONFIG_CPU_S3C2440)
+static struct subsys_interface s3c2440_pm_interface = {
+       .name           = "s3c2440_pm",
+       .subsys         = &s3c2440_subsys,
+       .add_dev        = s3c2410_pm_add,
+};
+
+static int __init s3c2440_pm_drvinit(void)
+{
+       return subsys_interface_register(&s3c2440_pm_interface);
+}
+
+arch_initcall(s3c2440_pm_drvinit);
+#endif
+
+#if defined(CONFIG_CPU_S3C2442)
+static struct subsys_interface s3c2442_pm_interface = {
+       .name           = "s3c2442_pm",
+       .subsys         = &s3c2442_subsys,
+       .add_dev        = s3c2410_pm_add,
+};
+
+static int __init s3c2442_pm_drvinit(void)
+{
+       return subsys_interface_register(&s3c2442_pm_interface);
+}
+
+arch_initcall(s3c2442_pm_drvinit);
+#endif
diff --git a/arch/arm/mach-s3c/pm-s3c2412.c b/arch/arm/mach-s3c/pm-s3c2412.c
new file mode 100644 (file)
index 0000000..6a96044
--- /dev/null
@@ -0,0 +1,126 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://armlinux.simtec.co.uk/.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <asm/cacheflush.h>
+#include <asm/irq.h>
+
+#include <mach/irqs.h>
+#include "regs-gpio.h"
+
+#include "cpu.h"
+#include "pm.h"
+#include "wakeup-mask.h"
+
+#include "regs-dsc-s3c24xx.h"
+#include "s3c2412-power.h"
+
+extern void s3c2412_sleep_enter(void);
+
+static int s3c2412_cpu_suspend(unsigned long arg)
+{
+       unsigned long tmp;
+
+       /* set our standby method to sleep */
+
+       tmp = __raw_readl(S3C2412_PWRCFG);
+       tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP;
+       __raw_writel(tmp, S3C2412_PWRCFG);
+
+       s3c2412_sleep_enter();
+
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
+}
+
+/* mapping of interrupts to parts of the wakeup mask */
+static const struct samsung_wakeup_mask wake_irqs[] = {
+       { .irq = IRQ_RTC,       .bit = S3C2412_PWRCFG_RTC_MASKIRQ, },
+};
+
+static void s3c2412_pm_prepare(void)
+{
+       samsung_sync_wakemask(S3C2412_PWRCFG,
+                             wake_irqs, ARRAY_SIZE(wake_irqs));
+}
+
+static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif)
+{
+       pm_cpu_prep = s3c2412_pm_prepare;
+       pm_cpu_sleep = s3c2412_cpu_suspend;
+
+       return 0;
+}
+
+static struct sleep_save s3c2412_sleep[] = {
+       SAVE_ITEM(S3C2412_DSC0),
+       SAVE_ITEM(S3C2412_DSC1),
+       SAVE_ITEM(S3C2413_GPJDAT),
+       SAVE_ITEM(S3C2413_GPJCON),
+       SAVE_ITEM(S3C2413_GPJUP),
+
+       /* save the PWRCFG to get back to original sleep method */
+
+       SAVE_ITEM(S3C2412_PWRCFG),
+
+       /* save the sleep configuration anyway, just in case these
+        * get damaged during wakeup */
+
+       SAVE_ITEM(S3C2412_GPBSLPCON),
+       SAVE_ITEM(S3C2412_GPCSLPCON),
+       SAVE_ITEM(S3C2412_GPDSLPCON),
+       SAVE_ITEM(S3C2412_GPFSLPCON),
+       SAVE_ITEM(S3C2412_GPGSLPCON),
+       SAVE_ITEM(S3C2412_GPHSLPCON),
+       SAVE_ITEM(S3C2413_GPJSLPCON),
+};
+
+static struct subsys_interface s3c2412_pm_interface = {
+       .name           = "s3c2412_pm",
+       .subsys         = &s3c2412_subsys,
+       .add_dev        = s3c2412_pm_add,
+};
+
+static __init int s3c2412_pm_init(void)
+{
+       return subsys_interface_register(&s3c2412_pm_interface);
+}
+
+arch_initcall(s3c2412_pm_init);
+
+static int s3c2412_pm_suspend(void)
+{
+       s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
+       return 0;
+}
+
+static void s3c2412_pm_resume(void)
+{
+       unsigned long tmp;
+
+       tmp = __raw_readl(S3C2412_PWRCFG);
+       tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
+       tmp |=  S3C2412_PWRCFG_STANDBYWFI_IDLE;
+       __raw_writel(tmp, S3C2412_PWRCFG);
+
+       s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
+}
+
+struct syscore_ops s3c2412_pm_syscore_ops = {
+       .suspend        = s3c2412_pm_suspend,
+       .resume         = s3c2412_pm_resume,
+};
diff --git a/arch/arm/mach-s3c/pm-s3c2416.c b/arch/arm/mach-s3c/pm-s3c2416.c
new file mode 100644 (file)
index 0000000..f69ad84
--- /dev/null
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2010 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com
+//
+// S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support)
+
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/io.h>
+
+#include <asm/cacheflush.h>
+
+#include "regs-s3c2443-clock.h"
+
+#include "cpu.h"
+#include "pm.h"
+
+#include "s3c2412-power.h"
+
+#ifdef CONFIG_PM_SLEEP
+extern void s3c2412_sleep_enter(void);
+
+static int s3c2416_cpu_suspend(unsigned long arg)
+{
+       /* enable wakeup sources regardless of battery state */
+       __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
+
+       /* set the mode as sleep, 2BED represents "Go to BED" */
+       __raw_writel(0x2BED, S3C2443_PWRMODE);
+
+       s3c2412_sleep_enter();
+
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
+}
+
+static void s3c2416_pm_prepare(void)
+{
+       /*
+        * write the magic value u-boot uses to check for resume into
+        * the INFORM0 register, and ensure INFORM1 is set to the
+        * correct address to resume from.
+        */
+       __raw_writel(0x2BED, S3C2412_INFORM0);
+       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
+}
+
+static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif)
+{
+       pm_cpu_prep = s3c2416_pm_prepare;
+       pm_cpu_sleep = s3c2416_cpu_suspend;
+
+       return 0;
+}
+
+static struct subsys_interface s3c2416_pm_interface = {
+       .name           = "s3c2416_pm",
+       .subsys         = &s3c2416_subsys,
+       .add_dev        = s3c2416_pm_add,
+};
+
+static __init int s3c2416_pm_init(void)
+{
+       return subsys_interface_register(&s3c2416_pm_interface);
+}
+
+arch_initcall(s3c2416_pm_init);
+#endif
+
+static void s3c2416_pm_resume(void)
+{
+       /* unset the return-from-sleep amd inform flags */
+       __raw_writel(0x0, S3C2443_PWRMODE);
+       __raw_writel(0x0, S3C2412_INFORM0);
+       __raw_writel(0x0, S3C2412_INFORM1);
+}
+
+struct syscore_ops s3c2416_pm_syscore_ops = {
+       .resume         = s3c2416_pm_resume,
+};
diff --git a/arch/arm/mach-s3c/pm-s3c24xx.c b/arch/arm/mach-s3c/pm-s3c24xx.c
new file mode 100644 (file)
index 0000000..3a8f5c3
--- /dev/null
@@ -0,0 +1,121 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2004-2006 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C24XX Power Manager (Suspend-To-RAM) support
+//
+// See Documentation/arm/samsung-s3c24xx/suspend.rst for more information
+//
+// Parts based on arch/arm/mach-pxa/pm.c
+//
+// Thanks to Dimitry Andric for debugging
+
+#include <linux/init.h>
+#include <linux/suspend.h>
+#include <linux/errno.h>
+#include <linux/time.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/io.h>
+
+#include "regs-clock.h"
+#include "regs-gpio.h"
+#include "regs-irq.h"
+#include "gpio-samsung.h"
+
+#include <asm/mach/time.h>
+
+#include "gpio-cfg.h"
+#include "pm.h"
+
+#include "regs-mem-s3c24xx.h"
+
+#define PFX "s3c24xx-pm: "
+
+#ifdef CONFIG_PM_SLEEP
+static struct sleep_save core_save[] = {
+       /* we restore the timings here, with the proviso that the board
+        * brings the system up in an slower, or equal frequency setting
+        * to the original system.
+        *
+        * if we cannot guarantee this, then things are going to go very
+        * wrong here, as we modify the refresh and both pll settings.
+        */
+
+       SAVE_ITEM(S3C2410_BWSCON),
+       SAVE_ITEM(S3C2410_BANKCON0),
+       SAVE_ITEM(S3C2410_BANKCON1),
+       SAVE_ITEM(S3C2410_BANKCON2),
+       SAVE_ITEM(S3C2410_BANKCON3),
+       SAVE_ITEM(S3C2410_BANKCON4),
+       SAVE_ITEM(S3C2410_BANKCON5),
+};
+#endif
+
+/* s3c_pm_check_resume_pin
+ *
+ * check to see if the pin is configured correctly for sleep mode, and
+ * make any necessary adjustments if it is not
+*/
+
+static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
+{
+       unsigned long irqstate;
+       unsigned long pinstate;
+       int irq = gpio_to_irq(pin);
+
+       if (irqoffs < 4)
+               irqstate = s3c_irqwake_intmask & (1L<<irqoffs);
+       else
+               irqstate = s3c_irqwake_eintmask & (1L<<irqoffs);
+
+       pinstate = s3c_gpio_getcfg(pin);
+
+       if (!irqstate) {
+               if (pinstate == S3C2410_GPIO_IRQ)
+                       S3C_PMDBG("Leaving IRQ %d (pin %d) as is\n", irq, pin);
+       } else {
+               if (pinstate == S3C2410_GPIO_IRQ) {
+                       S3C_PMDBG("Disabling IRQ %d (pin %d)\n", irq, pin);
+                       s3c_gpio_cfgpin(pin, S3C2410_GPIO_INPUT);
+               }
+       }
+}
+
+/* s3c_pm_configure_extint
+ *
+ * configure all external interrupt pins
+*/
+
+void s3c_pm_configure_extint(void)
+{
+       int pin;
+
+       /* for each of the external interrupts (EINT0..EINT15) we
+        * need to check whether it is an external interrupt source,
+        * and then configure it as an input if it is not
+       */
+
+       for (pin = S3C2410_GPF(0); pin <= S3C2410_GPF(7); pin++) {
+               s3c_pm_check_resume_pin(pin, pin - S3C2410_GPF(0));
+       }
+
+       for (pin = S3C2410_GPG(0); pin <= S3C2410_GPG(7); pin++) {
+               s3c_pm_check_resume_pin(pin, (pin - S3C2410_GPG(0))+8);
+       }
+}
+
+#ifdef CONFIG_PM_SLEEP
+void s3c_pm_restore_core(void)
+{
+       s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
+}
+
+void s3c_pm_save_core(void)
+{
+       s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
+}
+#endif
diff --git a/arch/arm/mach-s3c/pm-s3c64xx.c b/arch/arm/mach-s3c/pm-s3c64xx.c
new file mode 100644 (file)
index 0000000..4f17781
--- /dev/null
@@ -0,0 +1,400 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// S3C64XX CPU PM support.
+
+#include <linux/init.h>
+#include <linux/suspend.h>
+#include <linux/serial_core.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/pm_domain.h>
+
+#include "map.h"
+#include <mach/irqs.h>
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+#include "wakeup-mask.h"
+
+#include "regs-gpio.h"
+#include "regs-clock.h"
+#include "gpio-samsung.h"
+
+#include "regs-gpio-memport-s3c64xx.h"
+#include "regs-modem-s3c64xx.h"
+#include "regs-sys-s3c64xx.h"
+#include "regs-syscon-power-s3c64xx.h"
+
+struct s3c64xx_pm_domain {
+       char *const name;
+       u32 ena;
+       u32 pwr_stat;
+       struct generic_pm_domain pd;
+};
+
+static int s3c64xx_pd_off(struct generic_pm_domain *domain)
+{
+       struct s3c64xx_pm_domain *pd;
+       u32 val;
+
+       pd = container_of(domain, struct s3c64xx_pm_domain, pd);
+
+       val = __raw_readl(S3C64XX_NORMAL_CFG);
+       val &= ~(pd->ena);
+       __raw_writel(val, S3C64XX_NORMAL_CFG);
+
+       return 0;
+}
+
+static int s3c64xx_pd_on(struct generic_pm_domain *domain)
+{
+       struct s3c64xx_pm_domain *pd;
+       u32 val;
+       long retry = 1000000L;
+
+       pd = container_of(domain, struct s3c64xx_pm_domain, pd);
+
+       val = __raw_readl(S3C64XX_NORMAL_CFG);
+       val |= pd->ena;
+       __raw_writel(val, S3C64XX_NORMAL_CFG);
+
+       /* Not all domains provide power status readback */
+       if (pd->pwr_stat) {
+               do {
+                       cpu_relax();
+                       if (__raw_readl(S3C64XX_BLK_PWR_STAT) & pd->pwr_stat)
+                               break;
+               } while (retry--);
+
+               if (!retry) {
+                       pr_err("Failed to start domain %s\n", pd->name);
+                       return -EBUSY;
+               }
+       }
+
+       return 0;
+}
+
+static struct s3c64xx_pm_domain s3c64xx_pm_irom = {
+       .name = "IROM",
+       .ena = S3C64XX_NORMALCFG_IROM_ON,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_etm = {
+       .name = "ETM",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_ETM_ON,
+       .pwr_stat = S3C64XX_BLKPWRSTAT_ETM,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_s = {
+       .name = "S",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_S_ON,
+       .pwr_stat = S3C64XX_BLKPWRSTAT_S,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_f = {
+       .name = "F",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_F_ON,
+       .pwr_stat = S3C64XX_BLKPWRSTAT_F,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_p = {
+       .name = "P",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_P_ON,
+       .pwr_stat = S3C64XX_BLKPWRSTAT_P,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_i = {
+       .name = "I",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_I_ON,
+       .pwr_stat = S3C64XX_BLKPWRSTAT_I,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_g = {
+       .name = "G",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_G_ON,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain s3c64xx_pm_v = {
+       .name = "V",
+       .ena = S3C64XX_NORMALCFG_DOMAIN_V_ON,
+       .pwr_stat = S3C64XX_BLKPWRSTAT_V,
+       .pd = {
+               .power_off = s3c64xx_pd_off,
+               .power_on = s3c64xx_pd_on,
+       },
+};
+
+static struct s3c64xx_pm_domain *s3c64xx_always_on_pm_domains[] = {
+       &s3c64xx_pm_irom,
+};
+
+static struct s3c64xx_pm_domain *s3c64xx_pm_domains[] = {
+       &s3c64xx_pm_etm,
+       &s3c64xx_pm_g,
+       &s3c64xx_pm_v,
+       &s3c64xx_pm_i,
+       &s3c64xx_pm_p,
+       &s3c64xx_pm_s,
+       &s3c64xx_pm_f,
+};
+
+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
+void s3c_pm_debug_smdkled(u32 set, u32 clear)
+{
+       unsigned long flags;
+       int i;
+
+       local_irq_save(flags);
+       for (i = 0; i < 4; i++) {
+               if (clear & (1 << i))
+                       gpio_set_value(S3C64XX_GPN(12 + i), 0);
+               if (set & (1 << i))
+                       gpio_set_value(S3C64XX_GPN(12 + i), 1);
+       }
+       local_irq_restore(flags);
+}
+#endif
+
+#ifdef CONFIG_PM_SLEEP
+static struct sleep_save core_save[] = {
+       SAVE_ITEM(S3C64XX_MEM0DRVCON),
+       SAVE_ITEM(S3C64XX_MEM1DRVCON),
+};
+
+static struct sleep_save misc_save[] = {
+       SAVE_ITEM(S3C64XX_AHB_CON0),
+       SAVE_ITEM(S3C64XX_AHB_CON1),
+       SAVE_ITEM(S3C64XX_AHB_CON2),
+       
+       SAVE_ITEM(S3C64XX_SPCON),
+
+       SAVE_ITEM(S3C64XX_MEM0CONSTOP),
+       SAVE_ITEM(S3C64XX_MEM1CONSTOP),
+       SAVE_ITEM(S3C64XX_MEM0CONSLP0),
+       SAVE_ITEM(S3C64XX_MEM0CONSLP1),
+       SAVE_ITEM(S3C64XX_MEM1CONSLP),
+
+       SAVE_ITEM(S3C64XX_SDMA_SEL),
+       SAVE_ITEM(S3C64XX_MODEM_MIFPCON),
+
+       SAVE_ITEM(S3C64XX_NORMAL_CFG),
+};
+
+void s3c_pm_configure_extint(void)
+{
+       __raw_writel(s3c_irqwake_eintmask, S3C64XX_EINT_MASK);
+}
+
+void s3c_pm_restore_core(void)
+{
+       __raw_writel(0, S3C64XX_EINT_MASK);
+
+       s3c_pm_debug_smdkled(1 << 2, 0);
+
+       s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
+       s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
+}
+
+void s3c_pm_save_core(void)
+{
+       s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
+       s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
+}
+#endif
+
+/* since both s3c6400 and s3c6410 share the same sleep pm calls, we
+ * put the per-cpu code in here until any new cpu comes along and changes
+ * this.
+ */
+
+static int s3c64xx_cpu_suspend(unsigned long arg)
+{
+       unsigned long tmp;
+
+       /* set our standby method to sleep */
+
+       tmp = __raw_readl(S3C64XX_PWR_CFG);
+       tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
+       tmp |= S3C64XX_PWRCFG_CFG_WFI_SLEEP;
+       __raw_writel(tmp, S3C64XX_PWR_CFG);
+
+       /* clear any old wakeup */
+
+       __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT),
+                    S3C64XX_WAKEUP_STAT);
+
+       /* set the LED state to 0110 over sleep */
+       s3c_pm_debug_smdkled(3 << 1, 0xf);
+
+       /* issue the standby signal into the pm unit. Note, we
+        * issue a write-buffer drain just in case */
+
+       tmp = 0;
+
+       asm("b 1f\n\t"
+           ".align 5\n\t"
+           "1:\n\t"
+           "mcr p15, 0, %0, c7, c10, 5\n\t"
+           "mcr p15, 0, %0, c7, c10, 4\n\t"
+           "mcr p15, 0, %0, c7, c0, 4" :: "r" (tmp));
+
+       /* we should never get past here */
+
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
+}
+
+/* mapping of interrupts to parts of the wakeup mask */
+static const struct samsung_wakeup_mask wake_irqs[] = {
+       { .irq = IRQ_RTC_ALARM, .bit = S3C64XX_PWRCFG_RTC_ALARM_DISABLE, },
+       { .irq = IRQ_RTC_TIC,   .bit = S3C64XX_PWRCFG_RTC_TICK_DISABLE, },
+       { .irq = IRQ_PENDN,     .bit = S3C64XX_PWRCFG_TS_DISABLE, },
+       { .irq = IRQ_HSMMC0,    .bit = S3C64XX_PWRCFG_MMC0_DISABLE, },
+       { .irq = IRQ_HSMMC1,    .bit = S3C64XX_PWRCFG_MMC1_DISABLE, },
+       { .irq = IRQ_HSMMC2,    .bit = S3C64XX_PWRCFG_MMC2_DISABLE, },
+       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_BATF_DISABLE},
+       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_MSM_DISABLE },
+       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_HSI_DISABLE },
+       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_MSM_DISABLE },
+};
+
+static void s3c64xx_pm_prepare(void)
+{
+       samsung_sync_wakemask(S3C64XX_PWR_CFG,
+                             wake_irqs, ARRAY_SIZE(wake_irqs));
+
+       /* store address of resume. */
+       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C64XX_INFORM0);
+
+       /* ensure previous wakeup state is cleared before sleeping */
+       __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT);
+}
+
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+void s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
+{
+       u32 ucon;
+       u32 ucon_clk
+       u32 save_clk;
+       u32 new_ucon;
+       u32 delta;
+
+       if (!soc_is_s3c64xx())
+               return;
+
+       ucon = __raw_readl(regs + S3C2410_UCON);
+       ucon_clk = ucon & S3C6400_UCON_CLKMASK;
+       sav_clk = save->ucon & S3C6400_UCON_CLKMASK;
+
+       /* S3C64XX UART blocks only support level interrupts, so ensure that
+        * when we restore unused UART blocks we force the level interrupt
+        * settigs. */
+       save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
+
+       /* We have a constraint on changing the clock type of the UART
+        * between UCLKx and PCLK, so ensure that when we restore UCON
+        * that the CLK field is correctly modified if the bootloader
+        * has changed anything.
+        */
+       if (ucon_clk != save_clk) {
+               new_ucon = save->ucon;
+               delta = ucon_clk ^ save_clk;
+
+               /* change from UCLKx => wrong PCLK,
+                * either UCLK can be tested for by a bit-test
+                * with UCLK0 */
+               if (ucon_clk & S3C6400_UCON_UCLK0 &&
+                   !(save_clk & S3C6400_UCON_UCLK0) &&
+                   delta & S3C6400_UCON_PCLK2) {
+                       new_ucon &= ~S3C6400_UCON_UCLK0;
+               } else if (delta == S3C6400_UCON_PCLK2) {
+                       /* as an precaution, don't change from
+                        * PCLK2 => PCLK or vice-versa */
+                       new_ucon ^= S3C6400_UCON_PCLK2;
+               }
+
+               S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
+                         ucon, new_ucon, save->ucon);
+               save->ucon = new_ucon;
+       }
+}
+#endif
+
+int __init s3c64xx_pm_init(void)
+{
+       int i;
+
+       s3c_pm_init();
+
+       for (i = 0; i < ARRAY_SIZE(s3c64xx_always_on_pm_domains); i++)
+               pm_genpd_init(&s3c64xx_always_on_pm_domains[i]->pd,
+                             &pm_domain_always_on_gov, false);
+
+       for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++)
+               pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false);
+
+#ifdef CONFIG_S3C_DEV_FB
+       if (dev_get_platdata(&s3c_device_fb.dev))
+               pm_genpd_add_device(&s3c64xx_pm_f.pd, &s3c_device_fb.dev);
+#endif
+
+       return 0;
+}
+
+static __init int s3c64xx_pm_initcall(void)
+{
+       if (!soc_is_s3c64xx())
+               return 0;
+
+       pm_cpu_prep = s3c64xx_pm_prepare;
+       pm_cpu_sleep = s3c64xx_cpu_suspend;
+
+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
+       gpio_request(S3C64XX_GPN(12), "DEBUG_LED0");
+       gpio_request(S3C64XX_GPN(13), "DEBUG_LED1");
+       gpio_request(S3C64XX_GPN(14), "DEBUG_LED2");
+       gpio_request(S3C64XX_GPN(15), "DEBUG_LED3");
+       gpio_direction_output(S3C64XX_GPN(12), 0);
+       gpio_direction_output(S3C64XX_GPN(13), 0);
+       gpio_direction_output(S3C64XX_GPN(14), 0);
+       gpio_direction_output(S3C64XX_GPN(15), 0);
+#endif
+
+       return 0;
+}
+arch_initcall(s3c64xx_pm_initcall);
diff --git a/arch/arm/mach-s3c/pm.c b/arch/arm/mach-s3c/pm.c
new file mode 100644 (file)
index 0000000..c563bb9
--- /dev/null
@@ -0,0 +1,199 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2004-2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// S3C common power management (suspend to ram) support.
+
+#include <linux/init.h>
+#include <linux/suspend.h>
+#include <linux/errno.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/serial_s3c.h>
+#include <linux/io.h>
+
+#include <asm/cacheflush.h>
+#include <asm/suspend.h>
+
+#include "map.h"
+#include "regs-clock.h"
+#include "regs-irq.h"
+#include <mach/irqs.h>
+
+#include <asm/irq.h>
+
+#include "cpu.h"
+#include "pm.h"
+#include "pm-core.h"
+
+/* for external use */
+
+unsigned long s3c_pm_flags;
+
+/* The IRQ ext-int code goes here, it is too small to currently bother
+ * with its own file. */
+
+unsigned long s3c_irqwake_intmask      = 0xffffffffL;
+unsigned long s3c_irqwake_eintmask     = 0xffffffffL;
+
+int s3c_irqext_wake(struct irq_data *data, unsigned int state)
+{
+       unsigned long bit = 1L << IRQ_EINT_BIT(data->irq);
+
+       if (!(s3c_irqwake_eintallow & bit))
+               return -ENOENT;
+
+       printk(KERN_INFO "wake %s for irq %d\n",
+              state ? "enabled" : "disabled", data->irq);
+
+       if (!state)
+               s3c_irqwake_eintmask |= bit;
+       else
+               s3c_irqwake_eintmask &= ~bit;
+
+       return 0;
+}
+
+void (*pm_cpu_prep)(void);
+int (*pm_cpu_sleep)(unsigned long);
+
+#define any_allowed(mask, allow) (((mask) & (allow)) != (allow))
+
+/* s3c_pm_enter
+ *
+ * central control for sleep/resume process
+*/
+
+static int s3c_pm_enter(suspend_state_t state)
+{
+       int ret;
+       /* ensure the debug is initialised (if enabled) */
+       s3c_pm_debug_init_uart();
+
+       S3C_PMDBG("%s(%d)\n", __func__, state);
+
+       if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) {
+               printk(KERN_ERR "%s: error: no cpu sleep function\n", __func__);
+               return -EINVAL;
+       }
+
+       /* check if we have anything to wake-up with... bad things seem
+        * to happen if you suspend with no wakeup (system will often
+        * require a full power-cycle)
+       */
+
+       if (!of_have_populated_dt() &&
+           !any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) &&
+           !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) {
+               printk(KERN_ERR "%s: No wake-up sources!\n", __func__);
+               printk(KERN_ERR "%s: Aborting sleep\n", __func__);
+               return -EINVAL;
+       }
+
+       /* save all necessary core registers not covered by the drivers */
+
+       if (!of_have_populated_dt()) {
+               samsung_pm_save_gpios();
+               samsung_pm_saved_gpios();
+       }
+
+       s3c_pm_save_uarts(soc_is_s3c2410());
+       s3c_pm_save_core();
+
+       /* set the irq configuration for wake */
+
+       s3c_pm_configure_extint();
+
+       S3C_PMDBG("sleep: irq wakeup masks: %08lx,%08lx\n",
+           s3c_irqwake_intmask, s3c_irqwake_eintmask);
+
+       s3c_pm_arch_prepare_irqs();
+
+       /* call cpu specific preparation */
+
+       pm_cpu_prep();
+
+       /* flush cache back to ram */
+
+       flush_cache_all();
+
+       s3c_pm_check_store();
+
+       /* send the cpu to sleep... */
+
+       s3c_pm_arch_stop_clocks();
+
+       /* this will also act as our return point from when
+        * we resume as it saves its own register state and restores it
+        * during the resume.  */
+
+       ret = cpu_suspend(0, pm_cpu_sleep);
+       if (ret)
+               return ret;
+
+       /* restore the system state */
+
+       s3c_pm_restore_core();
+       s3c_pm_restore_uarts(soc_is_s3c2410());
+
+       if (!of_have_populated_dt()) {
+               samsung_pm_restore_gpios();
+               s3c_pm_restored_gpios();
+       }
+
+       s3c_pm_debug_init_uart();
+
+       /* check what irq (if any) restored the system */
+
+       s3c_pm_arch_show_resume_irqs();
+
+       S3C_PMDBG("%s: post sleep, preparing to return\n", __func__);
+
+       /* LEDs should now be 1110 */
+       s3c_pm_debug_smdkled(1 << 1, 0);
+
+       s3c_pm_check_restore();
+
+       /* ok, let's return from sleep */
+
+       S3C_PMDBG("S3C PM Resume (post-restore)\n");
+       return 0;
+}
+
+static int s3c_pm_prepare(void)
+{
+       /* prepare check area if configured */
+
+       s3c_pm_check_prepare();
+       return 0;
+}
+
+static void s3c_pm_finish(void)
+{
+       s3c_pm_check_cleanup();
+}
+
+static const struct platform_suspend_ops s3c_pm_ops = {
+       .enter          = s3c_pm_enter,
+       .prepare        = s3c_pm_prepare,
+       .finish         = s3c_pm_finish,
+       .valid          = suspend_valid_only_mem,
+};
+
+/* s3c_pm_init
+ *
+ * Attach the power management functions. This should be called
+ * from the board specific initialisation if the board supports
+ * it.
+*/
+
+int __init s3c_pm_init(void)
+{
+       printk("S3C Power Management, Copyright 2004 Simtec Electronics\n");
+
+       suspend_set_ops(&s3c_pm_ops);
+       return 0;
+}
diff --git a/arch/arm/mach-s3c/pm.h b/arch/arm/mach-s3c/pm.h
new file mode 100644 (file)
index 0000000..eed61e5
--- /dev/null
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Written by Ben Dooks, <ben@simtec.co.uk>
+ */
+
+/* s3c_pm_init
+ *
+ * called from board at initialisation time to setup the power
+ * management
+*/
+
+#include "pm-common.h"
+
+struct device;
+
+#ifdef CONFIG_SAMSUNG_PM
+
+extern __init int s3c_pm_init(void);
+extern __init int s3c64xx_pm_init(void);
+
+#else
+
+static inline int s3c_pm_init(void)
+{
+       return 0;
+}
+
+static inline int s3c64xx_pm_init(void)
+{
+       return 0;
+}
+#endif
+
+/* configuration for the IRQ mask over sleep */
+extern unsigned long s3c_irqwake_intmask;
+extern unsigned long s3c_irqwake_eintmask;
+
+/* per-cpu sleep functions */
+
+extern void (*pm_cpu_prep)(void);
+extern int (*pm_cpu_sleep)(unsigned long);
+
+/* Flags for PM Control */
+
+extern unsigned long s3c_pm_flags;
+
+/* from sleep.S */
+
+extern int s3c2410_cpu_suspend(unsigned long);
+
+#ifdef CONFIG_PM_SLEEP
+extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
+extern void s3c_cpu_resume(void);
+#else
+#define s3c_irq_wake NULL
+#define s3c_cpu_resume NULL
+#endif
+
+#ifdef CONFIG_SAMSUNG_PM
+extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
+#else
+#define s3c_irqext_wake NULL
+#endif
+
+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
+/**
+ * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
+ * @set: set bits for the state of the LEDs
+ * @clear: clear bits for the state of the LEDs.
+ */
+extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
+
+#else
+static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
+#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
+
+/**
+ * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
+ *
+ * Setup all the necessary GPIO pins for waking the system on external
+ * interrupt.
+ */
+extern void s3c_pm_configure_extint(void);
+
+#ifdef CONFIG_GPIO_SAMSUNG
+/**
+ * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
+ *
+ * Restore the state of the GPIO pins after sleep, which may involve ensuring
+ * that we do not glitch the state of the pins from that the bootloader's
+ * resume code has done.
+*/
+extern void samsung_pm_restore_gpios(void);
+
+/**
+ * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
+ *
+ * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
+ */
+extern void samsung_pm_save_gpios(void);
+#else
+static inline void samsung_pm_restore_gpios(void) {}
+static inline void samsung_pm_save_gpios(void) {}
+#endif
+
+extern void s3c_pm_save_core(void);
+extern void s3c_pm_restore_core(void);
diff --git a/arch/arm/mach-s3c/pwm-core.h b/arch/arm/mach-s3c/pwm-core.h
new file mode 100644 (file)
index 0000000..05e3448
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2013 Tomasz Figa <tomasz.figa@gmail.com>
+ *
+ * Samsung PWM controller platform data helpers.
+ */
+
+#ifndef __ASM_ARCH_PWM_CORE_H
+#define __ASM_ARCH_PWM_CORE_H __FILE__
+
+#include <clocksource/samsung_pwm.h>
+
+#ifdef CONFIG_SAMSUNG_DEV_PWM
+extern void samsung_pwm_set_platdata(struct samsung_pwm_variant *pd);
+#else
+static inline void samsung_pwm_set_platdata(struct samsung_pwm_variant *pd) { }
+#endif
+
+#endif /* __ASM_ARCH_PWM_CORE_H */
diff --git a/arch/arm/mach-s3c/regs-adc.h b/arch/arm/mach-s3c/regs-adc.h
new file mode 100644 (file)
index 0000000..58953c7
--- /dev/null
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Shannon Holland <holland@loser.net>
+ *
+ * S3C2410 ADC registers
+ */
+
+#ifndef __ASM_ARCH_REGS_ADC_H
+#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
+
+#define S3C2410_ADCREG(x) (x)
+
+#define S3C2410_ADCCON    S3C2410_ADCREG(0x00)
+#define S3C2410_ADCTSC    S3C2410_ADCREG(0x04)
+#define S3C2410_ADCDLY    S3C2410_ADCREG(0x08)
+#define S3C2410_ADCDAT0           S3C2410_ADCREG(0x0C)
+#define S3C2410_ADCDAT1           S3C2410_ADCREG(0x10)
+#define S3C64XX_ADCUPDN                S3C2410_ADCREG(0x14)
+#define S3C2443_ADCMUX         S3C2410_ADCREG(0x18)
+#define S3C64XX_ADCCLRINT      S3C2410_ADCREG(0x18)
+#define S5P_ADCMUX             S3C2410_ADCREG(0x1C)
+#define S3C64XX_ADCCLRINTPNDNUP        S3C2410_ADCREG(0x20)
+
+
+/* ADCCON Register Bits */
+#define S3C64XX_ADCCON_RESSEL          (1<<16)
+#define S3C2410_ADCCON_ECFLG           (1<<15)
+#define S3C2410_ADCCON_PRSCEN          (1<<14)
+#define S3C2410_ADCCON_PRSCVL(x)       (((x)&0xFF)<<6)
+#define S3C2410_ADCCON_PRSCVLMASK      (0xFF<<6)
+#define S3C2410_ADCCON_SELMUX(x)       (((x)&0x7)<<3)
+#define S3C2410_ADCCON_MUXMASK         (0x7<<3)
+#define S3C2416_ADCCON_RESSEL          (1 << 3)
+#define S3C2410_ADCCON_STDBM           (1<<2)
+#define S3C2410_ADCCON_READ_START      (1<<1)
+#define S3C2410_ADCCON_ENABLE_START    (1<<0)
+#define S3C2410_ADCCON_STARTMASK       (0x3<<0)
+
+
+/* ADCTSC Register Bits */
+#define S3C2443_ADCTSC_UD_SEN          (1 << 8)
+#define S3C2410_ADCTSC_YM_SEN          (1<<7)
+#define S3C2410_ADCTSC_YP_SEN          (1<<6)
+#define S3C2410_ADCTSC_XM_SEN          (1<<5)
+#define S3C2410_ADCTSC_XP_SEN          (1<<4)
+#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
+#define S3C2410_ADCTSC_AUTO_PST                (1<<2)
+#define S3C2410_ADCTSC_XY_PST(x)       (((x)&0x3)<<0)
+
+/* ADCDAT0 Bits */
+#define S3C2410_ADCDAT0_UPDOWN         (1<<15)
+#define S3C2410_ADCDAT0_AUTO_PST       (1<<14)
+#define S3C2410_ADCDAT0_XY_PST         (0x3<<12)
+#define S3C2410_ADCDAT0_XPDATA_MASK    (0x03FF)
+
+/* ADCDAT1 Bits */
+#define S3C2410_ADCDAT1_UPDOWN         (1<<15)
+#define S3C2410_ADCDAT1_AUTO_PST       (1<<14)
+#define S3C2410_ADCDAT1_XY_PST         (0x3<<12)
+#define S3C2410_ADCDAT1_YPDATA_MASK    (0x03FF)
+
+#endif /* __ASM_ARCH_REGS_ADC_H */
+
+
diff --git a/arch/arm/mach-s3c/regs-clock-s3c24xx.h b/arch/arm/mach-s3c/regs-clock-s3c24xx.h
new file mode 100644 (file)
index 0000000..933ddb5
--- /dev/null
@@ -0,0 +1,146 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * S3C2410 clock register definitions
+ */
+
+#ifndef __ASM_ARM_REGS_CLOCK
+#define __ASM_ARM_REGS_CLOCK
+
+#include "map.h"
+
+#define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
+
+#define S3C2410_PLLVAL(_m,_p,_s) ((_m) << 12 | ((_p) << 4) | ((_s)))
+
+#define S3C2410_LOCKTIME    S3C2410_CLKREG(0x00)
+#define S3C2410_MPLLCON            S3C2410_CLKREG(0x04)
+#define S3C2410_UPLLCON            S3C2410_CLKREG(0x08)
+#define S3C2410_CLKCON     S3C2410_CLKREG(0x0C)
+#define S3C2410_CLKSLOW            S3C2410_CLKREG(0x10)
+#define S3C2410_CLKDIVN            S3C2410_CLKREG(0x14)
+
+#define S3C2410_CLKCON_IDLE         (1<<2)
+#define S3C2410_CLKCON_POWER        (1<<3)
+#define S3C2410_CLKCON_NAND         (1<<4)
+#define S3C2410_CLKCON_LCDC         (1<<5)
+#define S3C2410_CLKCON_USBH         (1<<6)
+#define S3C2410_CLKCON_USBD         (1<<7)
+#define S3C2410_CLKCON_PWMT         (1<<8)
+#define S3C2410_CLKCON_SDI          (1<<9)
+#define S3C2410_CLKCON_UART0        (1<<10)
+#define S3C2410_CLKCON_UART1        (1<<11)
+#define S3C2410_CLKCON_UART2        (1<<12)
+#define S3C2410_CLKCON_GPIO         (1<<13)
+#define S3C2410_CLKCON_RTC          (1<<14)
+#define S3C2410_CLKCON_ADC          (1<<15)
+#define S3C2410_CLKCON_IIC          (1<<16)
+#define S3C2410_CLKCON_IIS          (1<<17)
+#define S3C2410_CLKCON_SPI          (1<<18)
+
+#define S3C2410_CLKDIVN_PDIVN       (1<<0)
+#define S3C2410_CLKDIVN_HDIVN       (1<<1)
+
+#define S3C2410_CLKSLOW_UCLK_OFF       (1<<7)
+#define S3C2410_CLKSLOW_MPLL_OFF       (1<<5)
+#define S3C2410_CLKSLOW_SLOW           (1<<4)
+#define S3C2410_CLKSLOW_SLOWVAL(x)     (x)
+#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)
+
+#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
+
+/* extra registers */
+#define S3C2440_CAMDIVN            S3C2410_CLKREG(0x18)
+
+#define S3C2440_CLKCON_CAMERA        (1<<19)
+#define S3C2440_CLKCON_AC97          (1<<20)
+
+#define S3C2440_CLKDIVN_PDIVN       (1<<0)
+#define S3C2440_CLKDIVN_HDIVN_MASK   (3<<1)
+#define S3C2440_CLKDIVN_HDIVN_1      (0<<1)
+#define S3C2440_CLKDIVN_HDIVN_2      (1<<1)
+#define S3C2440_CLKDIVN_HDIVN_4_8    (2<<1)
+#define S3C2440_CLKDIVN_HDIVN_3_6    (3<<1)
+#define S3C2440_CLKDIVN_UCLK         (1<<3)
+
+#define S3C2440_CAMDIVN_CAMCLK_MASK  (0xf<<0)
+#define S3C2440_CAMDIVN_CAMCLK_SEL   (1<<4)
+#define S3C2440_CAMDIVN_HCLK3_HALF   (1<<8)
+#define S3C2440_CAMDIVN_HCLK4_HALF   (1<<9)
+#define S3C2440_CAMDIVN_DVSEN        (1<<12)
+
+#define S3C2442_CAMDIVN_CAMCLK_DIV3  (1<<5)
+
+#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */
+
+#if defined(CONFIG_CPU_S3C2412)
+
+#define S3C2412_OSCSET         S3C2410_CLKREG(0x18)
+#define S3C2412_CLKSRC         S3C2410_CLKREG(0x1C)
+
+#define S3C2412_PLLCON_OFF             (1<<20)
+
+#define S3C2412_CLKDIVN_PDIVN          (1<<2)
+#define S3C2412_CLKDIVN_HDIVN_MASK     (3<<0)
+#define S3C2412_CLKDIVN_ARMDIVN                (1<<3)
+#define S3C2412_CLKDIVN_DVSEN          (1<<4)
+#define S3C2412_CLKDIVN_HALFHCLK       (1<<5)
+#define S3C2412_CLKDIVN_USB48DIV       (1<<6)
+#define S3C2412_CLKDIVN_UARTDIV_MASK   (15<<8)
+#define S3C2412_CLKDIVN_UARTDIV_SHIFT  (8)
+#define S3C2412_CLKDIVN_I2SDIV_MASK    (15<<12)
+#define S3C2412_CLKDIVN_I2SDIV_SHIFT   (12)
+#define S3C2412_CLKDIVN_CAMDIV_MASK    (15<<16)
+#define S3C2412_CLKDIVN_CAMDIV_SHIFT   (16)
+
+#define S3C2412_CLKCON_WDT             (1<<28)
+#define S3C2412_CLKCON_SPI             (1<<27)
+#define S3C2412_CLKCON_IIS             (1<<26)
+#define S3C2412_CLKCON_IIC             (1<<25)
+#define S3C2412_CLKCON_ADC             (1<<24)
+#define S3C2412_CLKCON_RTC             (1<<23)
+#define S3C2412_CLKCON_GPIO            (1<<22)
+#define S3C2412_CLKCON_UART2           (1<<21)
+#define S3C2412_CLKCON_UART1           (1<<20)
+#define S3C2412_CLKCON_UART0           (1<<19)
+#define S3C2412_CLKCON_SDI             (1<<18)
+#define S3C2412_CLKCON_PWMT            (1<<17)
+#define S3C2412_CLKCON_USBD            (1<<16)
+#define S3C2412_CLKCON_CAMCLK          (1<<15)
+#define S3C2412_CLKCON_UARTCLK         (1<<14)
+/* missing 13 */
+#define S3C2412_CLKCON_USB_HOST48      (1<<12)
+#define S3C2412_CLKCON_USB_DEV48       (1<<11)
+#define S3C2412_CLKCON_HCLKdiv2                (1<<10)
+#define S3C2412_CLKCON_HCLKx2          (1<<9)
+#define S3C2412_CLKCON_SDRAM           (1<<8)
+/* missing 7 */
+#define S3C2412_CLKCON_USBH            S3C2410_CLKCON_USBH
+#define S3C2412_CLKCON_LCDC            S3C2410_CLKCON_LCDC
+#define S3C2412_CLKCON_NAND            S3C2410_CLKCON_NAND
+#define S3C2412_CLKCON_DMA3            (1<<3)
+#define S3C2412_CLKCON_DMA2            (1<<2)
+#define S3C2412_CLKCON_DMA1            (1<<1)
+#define S3C2412_CLKCON_DMA0            (1<<0)
+
+/* clock sourec controls */
+
+#define S3C2412_CLKSRC_EXTCLKDIV_MASK          (7 << 0)
+#define S3C2412_CLKSRC_EXTCLKDIV_SHIFT         (0)
+#define S3C2412_CLKSRC_MDIVCLK_EXTCLKDIV       (1<<3)
+#define S3C2412_CLKSRC_MSYSCLK_MPLL            (1<<4)
+#define S3C2412_CLKSRC_USYSCLK_UPLL            (1<<5)
+#define S3C2412_CLKSRC_UARTCLK_MPLL            (1<<8)
+#define S3C2412_CLKSRC_I2SCLK_MPLL             (1<<9)
+#define S3C2412_CLKSRC_USBCLK_HCLK             (1<<10)
+#define S3C2412_CLKSRC_CAMCLK_HCLK             (1<<11)
+#define S3C2412_CLKSRC_UREFCLK_EXTCLK  (1<<12)
+#define S3C2412_CLKSRC_EREFCLK_EXTCLK  (1<<14)
+
+#endif /* CONFIG_CPU_S3C2412 */
+
+#define S3C2416_CLKDIV2                S3C2410_CLKREG(0x28)
+
+#endif /* __ASM_ARM_REGS_CLOCK */
diff --git a/arch/arm/mach-s3c/regs-clock-s3c64xx.h b/arch/arm/mach-s3c/regs-clock-s3c64xx.h
new file mode 100644 (file)
index 0000000..35a6876
--- /dev/null
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX clock register definitions
+ */
+
+#ifndef __PLAT_REGS_CLOCK_H
+#define __PLAT_REGS_CLOCK_H __FILE__
+
+/*
+ * FIXME: Remove remaining definitions
+ */
+
+#define S3C_CLKREG(x)          (S3C_VA_SYS + (x))
+
+#define S3C_PCLK_GATE          S3C_CLKREG(0x34)
+#define S3C6410_CLK_SRC2       S3C_CLKREG(0x10C)
+#define S3C_MEM_SYS_CFG                S3C_CLKREG(0x120)
+
+/* PCLK GATE Registers */
+#define S3C_CLKCON_PCLK_UART3          (1<<4)
+#define S3C_CLKCON_PCLK_UART2          (1<<3)
+#define S3C_CLKCON_PCLK_UART1          (1<<2)
+#define S3C_CLKCON_PCLK_UART0          (1<<1)
+
+/* MEM_SYS_CFG */
+#define MEM_SYS_CFG_INDEP_CF           0x4000
+#define MEM_SYS_CFG_EBI_FIX_PRI_CFCON  0x30
+
+#endif /* _PLAT_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s3c/regs-clock.h b/arch/arm/mach-s3c/regs-clock.h
new file mode 100644 (file)
index 0000000..7df31f2
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "regs-clock-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "regs-clock-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/regs-dsc-s3c24xx.h b/arch/arm/mach-s3c/regs-dsc-s3c24xx.h
new file mode 100644 (file)
index 0000000..8b8b572
--- /dev/null
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
+ *                   http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * S3C2440/S3C2412 Signal Drive Strength Control
+ */
+
+
+#ifndef __ASM_ARCH_REGS_DSC_S3C24XX_H
+#define __ASM_ARCH_REGS_DSC_S3C24XX_H __FILE__
+
+/* S3C2412 */
+#define S3C2412_DSC0      S3C2410_GPIOREG(0xdc)
+#define S3C2412_DSC1      S3C2410_GPIOREG(0xe0)
+
+/* S3C2440 */
+#define S3C2440_DSC0      S3C2410_GPIOREG(0xc4)
+#define S3C2440_DSC1      S3C2410_GPIOREG(0xc8)
+
+#endif /* __ASM_ARCH_REGS_DSC_S3C24XX_H */
+
diff --git a/arch/arm/mach-s3c/regs-gpio-memport-s3c64xx.h b/arch/arm/mach-s3c/regs-gpio-memport-s3c64xx.h
new file mode 100644 (file)
index 0000000..589afe1
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX - GPIO memory port register definitions
+ */
+
+#ifndef __MACH_S3C64XX_REGS_GPIO_MEMPORT_H
+#define __MACH_S3C64XX_REGS_GPIO_MEMPORT_H __FILE__
+
+#define S3C64XX_MEM0CONSTOP    S3C64XX_GPIOREG(0x1B0)
+#define S3C64XX_MEM1CONSTOP    S3C64XX_GPIOREG(0x1B4)
+
+#define S3C64XX_MEM0CONSLP0    S3C64XX_GPIOREG(0x1C0)
+#define S3C64XX_MEM0CONSLP1    S3C64XX_GPIOREG(0x1C4)
+#define S3C64XX_MEM1CONSLP     S3C64XX_GPIOREG(0x1C8)
+
+#define S3C64XX_MEM0DRVCON     S3C64XX_GPIOREG(0x1D0)
+#define S3C64XX_MEM1DRVCON     S3C64XX_GPIOREG(0x1D4)
+
+#endif /* __MACH_S3C64XX_REGS_GPIO_MEMPORT_H */
+
diff --git a/arch/arm/mach-s3c/regs-gpio-s3c24xx.h b/arch/arm/mach-s3c/regs-gpio-s3c24xx.h
new file mode 100644 (file)
index 0000000..9a7e262
--- /dev/null
@@ -0,0 +1,608 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003-2004 Simtec Electronics <linux@simtec.co.uk>
+ *     http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * S3C2410 GPIO register definitions
+ */
+
+
+#ifndef __ASM_ARCH_REGS_GPIO_H
+#define __ASM_ARCH_REGS_GPIO_H
+
+#include "map-s3c.h"
+
+#define S3C24XX_MISCCR         S3C24XX_GPIOREG2(0x80)
+
+/* general configuration options */
+
+#define S3C2410_GPIO_LEAVE   (0xFFFFFFFF)
+#define S3C2410_GPIO_INPUT   (0xFFFFFFF0)      /* not available on A */
+#define S3C2410_GPIO_OUTPUT  (0xFFFFFFF1)
+#define S3C2410_GPIO_IRQ     (0xFFFFFFF2)      /* not available for all */
+#define S3C2410_GPIO_SFN2    (0xFFFFFFF2)      /* bank A => addr/cs/nand */
+#define S3C2410_GPIO_SFN3    (0xFFFFFFF3)      /* not available on A */
+
+/* register address for the GPIO registers.
+ * S3C24XX_GPIOREG2 is for the second set of registers in the
+ * GPIO which move between s3c2410 and s3c2412 type systems */
+
+#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
+#define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2)
+
+
+/* configure GPIO ports A..G */
+
+/* port A - S3C2410: 22bits, zero in bit X makes pin X output
+ * 1 makes port special function, this is default
+*/
+#define S3C2410_GPACON    S3C2410_GPIOREG(0x00)
+#define S3C2410_GPADAT    S3C2410_GPIOREG(0x04)
+
+#define S3C2410_GPA0_ADDR0   (1<<0)
+#define S3C2410_GPA1_ADDR16  (1<<1)
+#define S3C2410_GPA2_ADDR17  (1<<2)
+#define S3C2410_GPA3_ADDR18  (1<<3)
+#define S3C2410_GPA4_ADDR19  (1<<4)
+#define S3C2410_GPA5_ADDR20  (1<<5)
+#define S3C2410_GPA6_ADDR21  (1<<6)
+#define S3C2410_GPA7_ADDR22  (1<<7)
+#define S3C2410_GPA8_ADDR23  (1<<8)
+#define S3C2410_GPA9_ADDR24  (1<<9)
+#define S3C2410_GPA10_ADDR25 (1<<10)
+#define S3C2410_GPA11_ADDR26 (1<<11)
+#define S3C2410_GPA12_nGCS1  (1<<12)
+#define S3C2410_GPA13_nGCS2  (1<<13)
+#define S3C2410_GPA14_nGCS3  (1<<14)
+#define S3C2410_GPA15_nGCS4  (1<<15)
+#define S3C2410_GPA16_nGCS5  (1<<16)
+#define S3C2410_GPA17_CLE    (1<<17)
+#define S3C2410_GPA18_ALE    (1<<18)
+#define S3C2410_GPA19_nFWE   (1<<19)
+#define S3C2410_GPA20_nFRE   (1<<20)
+#define S3C2410_GPA21_nRSTOUT (1<<21)
+#define S3C2410_GPA22_nFCE   (1<<22)
+
+/* 0x08 and 0x0c are reserved on S3C2410 */
+
+/* S3C2410:
+ * GPB is 10 IO pins, each configured by 2 bits each in GPBCON.
+ *   00 = input, 01 = output, 10=special function, 11=reserved
+
+ * bit 0,1 = pin 0, 2,3= pin 1...
+ *
+ * CPBUP = pull up resistor control, 1=disabled, 0=enabled
+*/
+
+#define S3C2410_GPBCON    S3C2410_GPIOREG(0x10)
+#define S3C2410_GPBDAT    S3C2410_GPIOREG(0x14)
+#define S3C2410_GPBUP     S3C2410_GPIOREG(0x18)
+
+/* no i/o pin in port b can have value 3 (unless it is a s3c2443) ! */
+
+#define S3C2410_GPB0_TOUT0   (0x02 << 0)
+
+#define S3C2410_GPB1_TOUT1   (0x02 << 2)
+
+#define S3C2410_GPB2_TOUT2   (0x02 << 4)
+
+#define S3C2410_GPB3_TOUT3   (0x02 << 6)
+
+#define S3C2410_GPB4_TCLK0   (0x02 << 8)
+#define S3C2410_GPB4_MASK    (0x03 << 8)
+
+#define S3C2410_GPB5_nXBACK  (0x02 << 10)
+#define S3C2443_GPB5_XBACK   (0x03 << 10)
+
+#define S3C2410_GPB6_nXBREQ  (0x02 << 12)
+#define S3C2443_GPB6_XBREQ   (0x03 << 12)
+
+#define S3C2410_GPB7_nXDACK1 (0x02 << 14)
+#define S3C2443_GPB7_XDACK1  (0x03 << 14)
+
+#define S3C2410_GPB8_nXDREQ1 (0x02 << 16)
+
+#define S3C2410_GPB9_nXDACK0 (0x02 << 18)
+#define S3C2443_GPB9_XDACK0  (0x03 << 18)
+
+#define S3C2410_GPB10_nXDRE0 (0x02 << 20)
+#define S3C2443_GPB10_XDREQ0 (0x03 << 20)
+
+#define S3C2410_GPB_PUPDIS(x)  (1<<(x))
+
+/* Port C consits of 16 GPIO/Special function
+ *
+ * almost identical setup to port b, but the special functions are mostly
+ * to do with the video system's sync/etc.
+*/
+
+#define S3C2410_GPCCON    S3C2410_GPIOREG(0x20)
+#define S3C2410_GPCDAT    S3C2410_GPIOREG(0x24)
+#define S3C2410_GPCUP     S3C2410_GPIOREG(0x28)
+#define S3C2410_GPC0_LEND      (0x02 << 0)
+#define S3C2410_GPC1_VCLK      (0x02 << 2)
+#define S3C2410_GPC2_VLINE     (0x02 << 4)
+#define S3C2410_GPC3_VFRAME    (0x02 << 6)
+#define S3C2410_GPC4_VM                (0x02 << 8)
+#define S3C2410_GPC5_LCDVF0    (0x02 << 10)
+#define S3C2410_GPC6_LCDVF1    (0x02 << 12)
+#define S3C2410_GPC7_LCDVF2    (0x02 << 14)
+#define S3C2410_GPC8_VD0       (0x02 << 16)
+#define S3C2410_GPC9_VD1       (0x02 << 18)
+#define S3C2410_GPC10_VD2      (0x02 << 20)
+#define S3C2410_GPC11_VD3      (0x02 << 22)
+#define S3C2410_GPC12_VD4      (0x02 << 24)
+#define S3C2410_GPC13_VD5      (0x02 << 26)
+#define S3C2410_GPC14_VD6      (0x02 << 28)
+#define S3C2410_GPC15_VD7      (0x02 << 30)
+#define S3C2410_GPC_PUPDIS(x)  (1<<(x))
+
+/*
+ * S3C2410: Port D consists of 16 GPIO/Special function
+ *
+ * almost identical setup to port b, but the special functions are mostly
+ * to do with the video system's data.
+ *
+ * almost identical setup to port c
+*/
+
+#define S3C2410_GPDCON    S3C2410_GPIOREG(0x30)
+#define S3C2410_GPDDAT    S3C2410_GPIOREG(0x34)
+#define S3C2410_GPDUP     S3C2410_GPIOREG(0x38)
+
+#define S3C2410_GPD0_VD8       (0x02 << 0)
+#define S3C2442_GPD0_nSPICS1   (0x03 << 0)
+
+#define S3C2410_GPD1_VD9       (0x02 << 2)
+#define S3C2442_GPD1_SPICLK1   (0x03 << 2)
+
+#define S3C2410_GPD2_VD10      (0x02 << 4)
+
+#define S3C2410_GPD3_VD11      (0x02 << 6)
+
+#define S3C2410_GPD4_VD12      (0x02 << 8)
+
+#define S3C2410_GPD5_VD13      (0x02 << 10)
+
+#define S3C2410_GPD6_VD14      (0x02 << 12)
+
+#define S3C2410_GPD7_VD15      (0x02 << 14)
+
+#define S3C2410_GPD8_VD16      (0x02 << 16)
+#define S3C2440_GPD8_SPIMISO1  (0x03 << 16)
+
+#define S3C2410_GPD9_VD17      (0x02 << 18)
+#define S3C2440_GPD9_SPIMOSI1  (0x03 << 18)
+
+#define S3C2410_GPD10_VD18     (0x02 << 20)
+#define S3C2440_GPD10_SPICLK1  (0x03 << 20)
+
+#define S3C2410_GPD11_VD19     (0x02 << 22)
+
+#define S3C2410_GPD12_VD20     (0x02 << 24)
+
+#define S3C2410_GPD13_VD21     (0x02 << 26)
+
+#define S3C2410_GPD14_VD22     (0x02 << 28)
+#define S3C2410_GPD14_nSS1     (0x03 << 28)
+
+#define S3C2410_GPD15_VD23     (0x02 << 30)
+#define S3C2410_GPD15_nSS0     (0x03 << 30)
+
+#define S3C2410_GPD_PUPDIS(x)  (1<<(x))
+
+/* S3C2410:
+ * Port E consists of 16 GPIO/Special function
+ *
+ * again, the same as port B, but dealing with I2S, SDI, and
+ * more miscellaneous functions
+ *
+ * GPIO / interrupt inputs
+*/
+
+#define S3C2410_GPECON    S3C2410_GPIOREG(0x40)
+#define S3C2410_GPEDAT    S3C2410_GPIOREG(0x44)
+#define S3C2410_GPEUP     S3C2410_GPIOREG(0x48)
+
+#define S3C2410_GPE0_I2SLRCK   (0x02 << 0)
+#define S3C2443_GPE0_AC_nRESET (0x03 << 0)
+#define S3C2410_GPE0_MASK      (0x03 << 0)
+
+#define S3C2410_GPE1_I2SSCLK   (0x02 << 2)
+#define S3C2443_GPE1_AC_SYNC   (0x03 << 2)
+#define S3C2410_GPE1_MASK      (0x03 << 2)
+
+#define S3C2410_GPE2_CDCLK     (0x02 << 4)
+#define S3C2443_GPE2_AC_BITCLK (0x03 << 4)
+
+#define S3C2410_GPE3_I2SSDI    (0x02 << 6)
+#define S3C2443_GPE3_AC_SDI    (0x03 << 6)
+#define S3C2410_GPE3_nSS0      (0x03 << 6)
+#define S3C2410_GPE3_MASK      (0x03 << 6)
+
+#define S3C2410_GPE4_I2SSDO    (0x02 << 8)
+#define S3C2443_GPE4_AC_SDO    (0x03 << 8)
+#define S3C2410_GPE4_I2SSDI    (0x03 << 8)
+#define S3C2410_GPE4_MASK      (0x03 << 8)
+
+#define S3C2410_GPE5_SDCLK     (0x02 << 10)
+#define S3C2443_GPE5_SD1_CLK   (0x02 << 10)
+#define S3C2443_GPE5_AC_BITCLK (0x03 << 10)
+
+#define S3C2410_GPE6_SDCMD     (0x02 << 12)
+#define S3C2443_GPE6_SD1_CMD   (0x02 << 12)
+#define S3C2443_GPE6_AC_SDI    (0x03 << 12)
+
+#define S3C2410_GPE7_SDDAT0    (0x02 << 14)
+#define S3C2443_GPE5_SD1_DAT0  (0x02 << 14)
+#define S3C2443_GPE7_AC_SDO    (0x03 << 14)
+
+#define S3C2410_GPE8_SDDAT1    (0x02 << 16)
+#define S3C2443_GPE8_SD1_DAT1  (0x02 << 16)
+#define S3C2443_GPE8_AC_SYNC   (0x03 << 16)
+
+#define S3C2410_GPE9_SDDAT2    (0x02 << 18)
+#define S3C2443_GPE9_SD1_DAT2  (0x02 << 18)
+#define S3C2443_GPE9_AC_nRESET (0x03 << 18)
+
+#define S3C2410_GPE10_SDDAT3   (0x02 << 20)
+#define S3C2443_GPE10_SD1_DAT3 (0x02 << 20)
+
+#define S3C2410_GPE11_SPIMISO0 (0x02 << 22)
+
+#define S3C2410_GPE12_SPIMOSI0 (0x02 << 24)
+
+#define S3C2410_GPE13_SPICLK0  (0x02 << 26)
+
+#define S3C2410_GPE14_IICSCL   (0x02 << 28)
+#define S3C2410_GPE14_MASK     (0x03 << 28)
+
+#define S3C2410_GPE15_IICSDA   (0x02 << 30)
+#define S3C2410_GPE15_MASK     (0x03 << 30)
+
+#define S3C2440_GPE0_ACSYNC    (0x03 << 0)
+#define S3C2440_GPE1_ACBITCLK  (0x03 << 2)
+#define S3C2440_GPE2_ACRESET   (0x03 << 4)
+#define S3C2440_GPE3_ACIN      (0x03 << 6)
+#define S3C2440_GPE4_ACOUT     (0x03 << 8)
+
+#define S3C2410_GPE_PUPDIS(x)  (1<<(x))
+
+/* S3C2410:
+ * Port F consists of 8 GPIO/Special function
+ *
+ * GPIO / interrupt inputs
+ *
+ * GPFCON has 2 bits for each of the input pins on port F
+ *   00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined
+ *
+ * pull up works like all other ports.
+ *
+ * GPIO/serial/misc pins
+*/
+
+#define S3C2410_GPFCON    S3C2410_GPIOREG(0x50)
+#define S3C2410_GPFDAT    S3C2410_GPIOREG(0x54)
+#define S3C2410_GPFUP     S3C2410_GPIOREG(0x58)
+
+#define S3C2410_GPF0_EINT0  (0x02 << 0)
+#define S3C2410_GPF1_EINT1  (0x02 << 2)
+#define S3C2410_GPF2_EINT2  (0x02 << 4)
+#define S3C2410_GPF3_EINT3  (0x02 << 6)
+#define S3C2410_GPF4_EINT4  (0x02 << 8)
+#define S3C2410_GPF5_EINT5  (0x02 << 10)
+#define S3C2410_GPF6_EINT6  (0x02 << 12)
+#define S3C2410_GPF7_EINT7  (0x02 << 14)
+#define S3C2410_GPF_PUPDIS(x)  (1<<(x))
+
+/* S3C2410:
+ * Port G consists of 8 GPIO/IRQ/Special function
+ *
+ * GPGCON has 2 bits for each of the input pins on port G
+ *   00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
+ *
+ * pull up works like all other ports.
+*/
+
+#define S3C2410_GPGCON    S3C2410_GPIOREG(0x60)
+#define S3C2410_GPGDAT    S3C2410_GPIOREG(0x64)
+#define S3C2410_GPGUP     S3C2410_GPIOREG(0x68)
+
+#define S3C2410_GPG0_EINT8    (0x02 << 0)
+
+#define S3C2410_GPG1_EINT9    (0x02 << 2)
+
+#define S3C2410_GPG2_EINT10   (0x02 << 4)
+#define S3C2410_GPG2_nSS0     (0x03 << 4)
+
+#define S3C2410_GPG3_EINT11   (0x02 << 6)
+#define S3C2410_GPG3_nSS1     (0x03 << 6)
+
+#define S3C2410_GPG4_EINT12   (0x02 << 8)
+#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
+#define S3C2443_GPG4_LCDPWRDN (0x03 << 8)
+
+#define S3C2410_GPG5_EINT13   (0x02 << 10)
+#define S3C2410_GPG5_SPIMISO1 (0x03 << 10)     /* not s3c2443 */
+
+#define S3C2410_GPG6_EINT14   (0x02 << 12)
+#define S3C2410_GPG6_SPIMOSI1 (0x03 << 12)
+
+#define S3C2410_GPG7_EINT15   (0x02 << 14)
+#define S3C2410_GPG7_SPICLK1  (0x03 << 14)
+
+#define S3C2410_GPG8_EINT16   (0x02 << 16)
+
+#define S3C2410_GPG9_EINT17   (0x02 << 18)
+
+#define S3C2410_GPG10_EINT18  (0x02 << 20)
+
+#define S3C2410_GPG11_EINT19  (0x02 << 22)
+#define S3C2410_GPG11_TCLK1   (0x03 << 22)
+#define S3C2443_GPG11_CF_nIREQ (0x03 << 22)
+
+#define S3C2410_GPG12_EINT20  (0x02 << 24)
+#define S3C2410_GPG12_XMON    (0x03 << 24)
+#define S3C2442_GPG12_nSPICS0 (0x03 << 24)
+#define S3C2443_GPG12_nINPACK (0x03 << 24)
+
+#define S3C2410_GPG13_EINT21  (0x02 << 26)
+#define S3C2410_GPG13_nXPON   (0x03 << 26)
+#define S3C2443_GPG13_CF_nREG (0x03 << 26)
+
+#define S3C2410_GPG14_EINT22  (0x02 << 28)
+#define S3C2410_GPG14_YMON    (0x03 << 28)
+#define S3C2443_GPG14_CF_RESET (0x03 << 28)
+
+#define S3C2410_GPG15_EINT23  (0x02 << 30)
+#define S3C2410_GPG15_nYPON   (0x03 << 30)
+#define S3C2443_GPG15_CF_PWR  (0x03 << 30)
+
+#define S3C2410_GPG_PUPDIS(x)  (1<<(x))
+
+/* Port H consists of11 GPIO/serial/Misc pins
+ *
+ * GPHCON has 2 bits for each of the input pins on port H
+ *   00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
+ *
+ * pull up works like all other ports.
+*/
+
+#define S3C2410_GPHCON    S3C2410_GPIOREG(0x70)
+#define S3C2410_GPHDAT    S3C2410_GPIOREG(0x74)
+#define S3C2410_GPHUP     S3C2410_GPIOREG(0x78)
+
+#define S3C2410_GPH0_nCTS0  (0x02 << 0)
+#define S3C2416_GPH0_TXD0  (0x02 << 0)
+
+#define S3C2410_GPH1_nRTS0  (0x02 << 2)
+#define S3C2416_GPH1_RXD0  (0x02 << 2)
+
+#define S3C2410_GPH2_TXD0   (0x02 << 4)
+#define S3C2416_GPH2_TXD1   (0x02 << 4)
+
+#define S3C2410_GPH3_RXD0   (0x02 << 6)
+#define S3C2416_GPH3_RXD1   (0x02 << 6)
+
+#define S3C2410_GPH4_TXD1   (0x02 << 8)
+#define S3C2416_GPH4_TXD2   (0x02 << 8)
+
+#define S3C2410_GPH5_RXD1   (0x02 << 10)
+#define S3C2416_GPH5_RXD2   (0x02 << 10)
+
+#define S3C2410_GPH6_TXD2   (0x02 << 12)
+#define S3C2416_GPH6_TXD3   (0x02 << 12)
+#define S3C2410_GPH6_nRTS1  (0x03 << 12)
+#define S3C2416_GPH6_nRTS2  (0x03 << 12)
+
+#define S3C2410_GPH7_RXD2   (0x02 << 14)
+#define S3C2416_GPH7_RXD3   (0x02 << 14)
+#define S3C2410_GPH7_nCTS1  (0x03 << 14)
+#define S3C2416_GPH7_nCTS2  (0x03 << 14)
+
+#define S3C2410_GPH8_UCLK   (0x02 << 16)
+#define S3C2416_GPH8_nCTS0  (0x02 << 16)
+
+#define S3C2410_GPH9_CLKOUT0  (0x02 << 18)
+#define S3C2442_GPH9_nSPICS0  (0x03 << 18)
+#define S3C2416_GPH9_nRTS0    (0x02 << 18)
+
+#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
+#define S3C2416_GPH10_nCTS1   (0x02 << 20)
+
+#define S3C2416_GPH11_nRTS1   (0x02 << 22)
+
+#define S3C2416_GPH12_EXTUARTCLK (0x02 << 24)
+
+#define S3C2416_GPH13_CLKOUT0 (0x02 << 26)
+
+#define S3C2416_GPH14_CLKOUT1 (0x02 << 28)
+
+/* The S3C2412 and S3C2413 move the GPJ register set to after
+ * GPH, which means all registers after 0x80 are now offset by 0x10
+ * for the 2412/2413 from the 2410/2440/2442
+*/
+
+/*
+ * Port J consists of 13 GPIO/Camera pins. GPJCON has 2 bits
+ * for each of the pins on port J.
+ *   00 - input, 01 output, 10 - camera
+ *
+ * Pull up works like all other ports.
+ */
+
+#define S3C2413_GPJCON    S3C2410_GPIOREG(0x80)
+#define S3C2413_GPJDAT    S3C2410_GPIOREG(0x84)
+#define S3C2413_GPJUP     S3C2410_GPIOREG(0x88)
+#define S3C2413_GPJSLPCON  S3C2410_GPIOREG(0x8C)
+
+/* S3C2443 and above */
+#define S3C2440_GPJCON    S3C2410_GPIOREG(0xD0)
+#define S3C2440_GPJDAT    S3C2410_GPIOREG(0xD4)
+#define S3C2440_GPJUP     S3C2410_GPIOREG(0xD8)
+
+#define S3C2443_GPKCON    S3C2410_GPIOREG(0xE0)
+#define S3C2443_GPKDAT    S3C2410_GPIOREG(0xE4)
+#define S3C2443_GPKUP     S3C2410_GPIOREG(0xE8)
+
+#define S3C2443_GPLCON    S3C2410_GPIOREG(0xF0)
+#define S3C2443_GPLDAT    S3C2410_GPIOREG(0xF4)
+#define S3C2443_GPLUP     S3C2410_GPIOREG(0xF8)
+
+#define S3C2443_GPMCON    S3C2410_GPIOREG(0x100)
+#define S3C2443_GPMDAT    S3C2410_GPIOREG(0x104)
+#define S3C2443_GPMUP     S3C2410_GPIOREG(0x108)
+
+/* miscellaneous control */
+#define S3C2410_MISCCR    S3C2410_GPIOREG(0x80)
+
+/* see clock.h for dclk definitions */
+
+/* pullup control on databus */
+#define S3C2410_MISCCR_SPUCR_HEN    (0<<0)
+#define S3C2410_MISCCR_SPUCR_HDIS   (1<<0)
+#define S3C2410_MISCCR_SPUCR_LEN    (0<<1)
+#define S3C2410_MISCCR_SPUCR_LDIS   (1<<1)
+
+#define S3C2410_MISCCR_USBDEV      (0<<3)
+#define S3C2410_MISCCR_USBHOST     (1<<3)
+
+#define S3C2410_MISCCR_CLK0_MPLL    (0<<4)
+#define S3C2410_MISCCR_CLK0_UPLL    (1<<4)
+#define S3C2410_MISCCR_CLK0_FCLK    (2<<4)
+#define S3C2410_MISCCR_CLK0_HCLK    (3<<4)
+#define S3C2410_MISCCR_CLK0_PCLK    (4<<4)
+#define S3C2410_MISCCR_CLK0_DCLK0   (5<<4)
+#define S3C2410_MISCCR_CLK0_MASK    (7<<4)
+
+#define S3C2412_MISCCR_CLK0_RTC            (2<<4)
+
+#define S3C2410_MISCCR_CLK1_MPLL    (0<<8)
+#define S3C2410_MISCCR_CLK1_UPLL    (1<<8)
+#define S3C2410_MISCCR_CLK1_FCLK    (2<<8)
+#define S3C2410_MISCCR_CLK1_HCLK    (3<<8)
+#define S3C2410_MISCCR_CLK1_PCLK    (4<<8)
+#define S3C2410_MISCCR_CLK1_DCLK1   (5<<8)
+#define S3C2410_MISCCR_CLK1_MASK    (7<<8)
+
+#define S3C2412_MISCCR_CLK1_CLKsrc  (0<<8)
+
+#define S3C2410_MISCCR_USBSUSPND0   (1<<12)
+#define S3C2416_MISCCR_SEL_SUSPND   (1<<12)
+#define S3C2410_MISCCR_USBSUSPND1   (1<<13)
+
+#define S3C2410_MISCCR_nRSTCON     (1<<16)
+
+#define S3C2410_MISCCR_nEN_SCLK0    (1<<17)
+#define S3C2410_MISCCR_nEN_SCLK1    (1<<18)
+#define S3C2410_MISCCR_nEN_SCLKE    (1<<19)    /* not 2412 */
+#define S3C2410_MISCCR_SDSLEEP     (7<<17)
+
+#define S3C2416_MISCCR_FLT_I2C      (1<<24)
+#define S3C2416_MISCCR_HSSPI_EN2    (1<<31)
+
+/* external interrupt control... */
+/* S3C2410_EXTINT0 -> irq sense control for EINT0..EINT7
+ * S3C2410_EXTINT1 -> irq sense control for EINT8..EINT15
+ * S3C2410_EXTINT2 -> irq sense control for EINT16..EINT23
+ *
+ * note S3C2410_EXTINT2 has filtering options for EINT16..EINT23
+ *
+ * Samsung datasheet p9-25
+*/
+#define S3C2410_EXTINT0           S3C2410_GPIOREG(0x88)
+#define S3C2410_EXTINT1           S3C2410_GPIOREG(0x8C)
+#define S3C2410_EXTINT2           S3C2410_GPIOREG(0x90)
+
+#define S3C24XX_EXTINT0           S3C24XX_GPIOREG2(0x88)
+#define S3C24XX_EXTINT1           S3C24XX_GPIOREG2(0x8C)
+#define S3C24XX_EXTINT2           S3C24XX_GPIOREG2(0x90)
+
+/* interrupt filtering control for EINT16..EINT23 */
+#define S3C2410_EINFLT0           S3C2410_GPIOREG(0x94)
+#define S3C2410_EINFLT1           S3C2410_GPIOREG(0x98)
+#define S3C2410_EINFLT2           S3C2410_GPIOREG(0x9C)
+#define S3C2410_EINFLT3           S3C2410_GPIOREG(0xA0)
+
+#define S3C24XX_EINFLT0           S3C24XX_GPIOREG2(0x94)
+#define S3C24XX_EINFLT1           S3C24XX_GPIOREG2(0x98)
+#define S3C24XX_EINFLT2           S3C24XX_GPIOREG2(0x9C)
+#define S3C24XX_EINFLT3           S3C24XX_GPIOREG2(0xA0)
+
+/* values for interrupt filtering */
+#define S3C2410_EINTFLT_PCLK           (0x00)
+#define S3C2410_EINTFLT_EXTCLK         (1<<7)
+#define S3C2410_EINTFLT_WIDTHMSK(x)    ((x) & 0x3f)
+
+/* removed EINTxxxx defs from here, not meant for this */
+
+/* GSTATUS have miscellaneous information in them
+ *
+ * These move between s3c2410 and s3c2412 style systems.
+ */
+
+#define S3C2410_GSTATUS0   S3C2410_GPIOREG(0x0AC)
+#define S3C2410_GSTATUS1   S3C2410_GPIOREG(0x0B0)
+#define S3C2410_GSTATUS2   S3C2410_GPIOREG(0x0B4)
+#define S3C2410_GSTATUS3   S3C2410_GPIOREG(0x0B8)
+#define S3C2410_GSTATUS4   S3C2410_GPIOREG(0x0BC)
+
+#define S3C2412_GSTATUS0   S3C2410_GPIOREG(0x0BC)
+#define S3C2412_GSTATUS1   S3C2410_GPIOREG(0x0C0)
+#define S3C2412_GSTATUS2   S3C2410_GPIOREG(0x0C4)
+#define S3C2412_GSTATUS3   S3C2410_GPIOREG(0x0C8)
+#define S3C2412_GSTATUS4   S3C2410_GPIOREG(0x0CC)
+
+#define S3C24XX_GSTATUS0   S3C24XX_GPIOREG2(0x0AC)
+#define S3C24XX_GSTATUS1   S3C24XX_GPIOREG2(0x0B0)
+#define S3C24XX_GSTATUS2   S3C24XX_GPIOREG2(0x0B4)
+#define S3C24XX_GSTATUS3   S3C24XX_GPIOREG2(0x0B8)
+#define S3C24XX_GSTATUS4   S3C24XX_GPIOREG2(0x0BC)
+
+#define S3C2410_GSTATUS0_nWAIT    (1<<3)
+#define S3C2410_GSTATUS0_NCON     (1<<2)
+#define S3C2410_GSTATUS0_RnB      (1<<1)
+#define S3C2410_GSTATUS0_nBATTFLT  (1<<0)
+
+#define S3C2410_GSTATUS1_IDMASK           (0xffff0000)
+#define S3C2410_GSTATUS1_2410     (0x32410000)
+#define S3C2410_GSTATUS1_2412     (0x32412001)
+#define S3C2410_GSTATUS1_2416     (0x32416003)
+#define S3C2410_GSTATUS1_2440     (0x32440000)
+#define S3C2410_GSTATUS1_2442     (0x32440aaa)
+/* some 2416 CPUs report this value also */
+#define S3C2410_GSTATUS1_2450     (0x32450003)
+
+#define S3C2410_GSTATUS2_WTRESET   (1<<2)
+#define S3C2410_GSTATUS2_OFFRESET  (1<<1)
+#define S3C2410_GSTATUS2_PONRESET  (1<<0)
+
+/* 2412/2413 sleep configuration registers */
+
+#define S3C2412_GPBSLPCON      S3C2410_GPIOREG(0x1C)
+#define S3C2412_GPCSLPCON      S3C2410_GPIOREG(0x2C)
+#define S3C2412_GPDSLPCON      S3C2410_GPIOREG(0x3C)
+#define S3C2412_GPFSLPCON      S3C2410_GPIOREG(0x5C)
+#define S3C2412_GPGSLPCON      S3C2410_GPIOREG(0x6C)
+#define S3C2412_GPHSLPCON      S3C2410_GPIOREG(0x7C)
+
+/* definitions for each pin bit */
+#define S3C2412_GPIO_SLPCON_LOW         ( 0x00 )
+#define S3C2412_GPIO_SLPCON_HIGH ( 0x01 )
+#define S3C2412_GPIO_SLPCON_IN   ( 0x02 )
+#define S3C2412_GPIO_SLPCON_PULL ( 0x03 )
+
+#define S3C2412_SLPCON_LOW(x)  ( 0x00 << ((x) * 2))
+#define S3C2412_SLPCON_HIGH(x) ( 0x01 << ((x) * 2))
+#define S3C2412_SLPCON_IN(x)   ( 0x02 << ((x) * 2))
+#define S3C2412_SLPCON_PULL(x) ( 0x03 << ((x) * 2))
+#define S3C2412_SLPCON_EINT(x) ( 0x02 << ((x) * 2))  /* only IRQ pins */
+#define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2))
+
+#define S3C2412_SLPCON_ALL_LOW (0x0)
+#define S3C2412_SLPCON_ALL_HIGH        (0x11111111 | 0x44444444)
+#define S3C2412_SLPCON_ALL_IN          (0x22222222 | 0x88888888)
+#define S3C2412_SLPCON_ALL_PULL        (0x33333333)
+
+#endif /* __ASM_ARCH_REGS_GPIO_H */
+
diff --git a/arch/arm/mach-s3c/regs-gpio-s3c64xx.h b/arch/arm/mach-s3c/regs-gpio-s3c64xx.h
new file mode 100644 (file)
index 0000000..592a2be
--- /dev/null
@@ -0,0 +1,188 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* linux/arch/arm/plat-s3c64xx/include/mach/regs-gpio.h
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX - GPIO register definitions
+ */
+
+#ifndef __ASM_PLAT_S3C64XX_REGS_GPIO_H
+#define __ASM_PLAT_S3C64XX_REGS_GPIO_H __FILE__
+
+/* Base addresses for each of the banks */
+
+#define S3C64XX_GPIOREG(reg)   (S3C64XX_VA_GPIO + (reg))
+
+#define S3C64XX_GPA_BASE       S3C64XX_GPIOREG(0x0000)
+#define S3C64XX_GPB_BASE       S3C64XX_GPIOREG(0x0020)
+#define S3C64XX_GPC_BASE       S3C64XX_GPIOREG(0x0040)
+#define S3C64XX_GPD_BASE       S3C64XX_GPIOREG(0x0060)
+#define S3C64XX_GPE_BASE       S3C64XX_GPIOREG(0x0080)
+#define S3C64XX_GPF_BASE       S3C64XX_GPIOREG(0x00A0)
+#define S3C64XX_GPG_BASE       S3C64XX_GPIOREG(0x00C0)
+#define S3C64XX_GPH_BASE       S3C64XX_GPIOREG(0x00E0)
+#define S3C64XX_GPI_BASE       S3C64XX_GPIOREG(0x0100)
+#define S3C64XX_GPJ_BASE       S3C64XX_GPIOREG(0x0120)
+#define S3C64XX_GPK_BASE       S3C64XX_GPIOREG(0x0800)
+#define S3C64XX_GPL_BASE       S3C64XX_GPIOREG(0x0810)
+#define S3C64XX_GPM_BASE       S3C64XX_GPIOREG(0x0820)
+#define S3C64XX_GPN_BASE       S3C64XX_GPIOREG(0x0830)
+#define S3C64XX_GPO_BASE       S3C64XX_GPIOREG(0x0140)
+#define S3C64XX_GPP_BASE       S3C64XX_GPIOREG(0x0160)
+#define S3C64XX_GPQ_BASE       S3C64XX_GPIOREG(0x0180)
+
+/* SPCON */
+
+#define S3C64XX_SPCON          S3C64XX_GPIOREG(0x1A0)
+
+#define S3C64XX_SPCON_DRVCON_CAM_MASK          (0x3 << 30)
+#define S3C64XX_SPCON_DRVCON_CAM_SHIFT         (30)
+#define S3C64XX_SPCON_DRVCON_CAM_2mA           (0x0 << 30)
+#define S3C64XX_SPCON_DRVCON_CAM_4mA           (0x1 << 30)
+#define S3C64XX_SPCON_DRVCON_CAM_7mA           (0x2 << 30)
+#define S3C64XX_SPCON_DRVCON_CAM_9mA           (0x3 << 30)
+
+#define S3C64XX_SPCON_DRVCON_HSSPI_MASK                (0x3 << 28)
+#define S3C64XX_SPCON_DRVCON_HSSPI_SHIFT       (28)
+#define S3C64XX_SPCON_DRVCON_HSSPI_2mA         (0x0 << 28)
+#define S3C64XX_SPCON_DRVCON_HSSPI_4mA         (0x1 << 28)
+#define S3C64XX_SPCON_DRVCON_HSSPI_7mA         (0x2 << 28)
+#define S3C64XX_SPCON_DRVCON_HSSPI_9mA         (0x3 << 28)
+
+#define S3C64XX_SPCON_DRVCON_HSMMC_MASK                (0x3 << 26)
+#define S3C64XX_SPCON_DRVCON_HSMMC_SHIFT       (26)
+#define S3C64XX_SPCON_DRVCON_HSMMC_2mA         (0x0 << 26)
+#define S3C64XX_SPCON_DRVCON_HSMMC_4mA         (0x1 << 26)
+#define S3C64XX_SPCON_DRVCON_HSMMC_7mA         (0x2 << 26)
+#define S3C64XX_SPCON_DRVCON_HSMMC_9mA         (0x3 << 26)
+
+#define S3C64XX_SPCON_DRVCON_LCD_MASK          (0x3 << 24)
+#define S3C64XX_SPCON_DRVCON_LCD_SHIFT         (24)
+#define S3C64XX_SPCON_DRVCON_LCD_2mA           (0x0 << 24)
+#define S3C64XX_SPCON_DRVCON_LCD_4mA           (0x1 << 24)
+#define S3C64XX_SPCON_DRVCON_LCD_7mA           (0x2 << 24)
+#define S3C64XX_SPCON_DRVCON_LCD_9mA           (0x3 << 24)
+
+#define S3C64XX_SPCON_DRVCON_MODEM_MASK                (0x3 << 22)
+#define S3C64XX_SPCON_DRVCON_MODEM_SHIFT       (22)
+#define S3C64XX_SPCON_DRVCON_MODEM_2mA         (0x0 << 22)
+#define S3C64XX_SPCON_DRVCON_MODEM_4mA         (0x1 << 22)
+#define S3C64XX_SPCON_DRVCON_MODEM_7mA         (0x2 << 22)
+#define S3C64XX_SPCON_DRVCON_MODEM_9mA         (0x3 << 22)
+
+#define S3C64XX_SPCON_nRSTOUT_OEN              (1 << 21)
+
+#define S3C64XX_SPCON_DRVCON_SPICLK1_MASK      (0x3 << 18)
+#define S3C64XX_SPCON_DRVCON_SPICLK1_SHIFT     (18)
+#define S3C64XX_SPCON_DRVCON_SPICLK1_2mA       (0x0 << 18)
+#define S3C64XX_SPCON_DRVCON_SPICLK1_4mA       (0x1 << 18)
+#define S3C64XX_SPCON_DRVCON_SPICLK1_7mA       (0x2 << 18)
+#define S3C64XX_SPCON_DRVCON_SPICLK1_9mA       (0x3 << 18)
+
+#define S3C64XX_SPCON_MEM1_DQS_PUD_MASK                (0x3 << 16)
+#define S3C64XX_SPCON_MEM1_DQS_PUD_SHIFT       (16)
+#define S3C64XX_SPCON_MEM1_DQS_PUD_DISABLED    (0x0 << 16)
+#define S3C64XX_SPCON_MEM1_DQS_PUD_DOWN                (0x1 << 16)
+#define S3C64XX_SPCON_MEM1_DQS_PUD_UP          (0x2 << 16)
+
+#define S3C64XX_SPCON_MEM1_D_PUD1_MASK         (0x3 << 14)
+#define S3C64XX_SPCON_MEM1_D_PUD1_SHIFT                (14)
+#define S3C64XX_SPCON_MEM1_D_PUD1_DISABLED     (0x0 << 14)
+#define S3C64XX_SPCON_MEM1_D_PUD1_DOWN         (0x1 << 14)
+#define S3C64XX_SPCON_MEM1_D_PUD1_UP           (0x2 << 14)
+
+#define S3C64XX_SPCON_MEM1_D_PUD0_MASK         (0x3 << 12)
+#define S3C64XX_SPCON_MEM1_D_PUD0_SHIFT                (12)
+#define S3C64XX_SPCON_MEM1_D_PUD0_DISABLED     (0x0 << 12)
+#define S3C64XX_SPCON_MEM1_D_PUD0_DOWN         (0x1 << 12)
+#define S3C64XX_SPCON_MEM1_D_PUD0_UP           (0x2 << 12)
+
+#define S3C64XX_SPCON_MEM0_D_PUD_MASK          (0x3 << 8)
+#define S3C64XX_SPCON_MEM0_D_PUD_SHIFT         (8)
+#define S3C64XX_SPCON_MEM0_D_PUD_DISABLED      (0x0 << 8)
+#define S3C64XX_SPCON_MEM0_D_PUD_DOWN          (0x1 << 8)
+#define S3C64XX_SPCON_MEM0_D_PUD_UP            (0x2 << 8)
+
+#define S3C64XX_SPCON_USBH_DMPD                        (1 << 7)
+#define S3C64XX_SPCON_USBH_DPPD                        (1 << 6)
+#define S3C64XX_SPCON_USBH_PUSW2               (1 << 5)
+#define S3C64XX_SPCON_USBH_PUSW1               (1 << 4)
+#define S3C64XX_SPCON_USBH_SUSPND              (1 << 3)
+
+#define S3C64XX_SPCON_LCD_SEL_MASK             (0x3 << 0)
+#define S3C64XX_SPCON_LCD_SEL_SHIFT            (0)
+#define S3C64XX_SPCON_LCD_SEL_HOST             (0x0 << 0)
+#define S3C64XX_SPCON_LCD_SEL_RGB              (0x1 << 0)
+#define S3C64XX_SPCON_LCD_SEL_606_656          (0x2 << 0)
+
+
+/* External interrupt registers */
+
+#define S3C64XX_EINT12CON      S3C64XX_GPIOREG(0x200)
+#define S3C64XX_EINT34CON      S3C64XX_GPIOREG(0x204)
+#define S3C64XX_EINT56CON      S3C64XX_GPIOREG(0x208)
+#define S3C64XX_EINT78CON      S3C64XX_GPIOREG(0x20C)
+#define S3C64XX_EINT9CON       S3C64XX_GPIOREG(0x210)
+
+#define S3C64XX_EINT12FLTCON   S3C64XX_GPIOREG(0x220)
+#define S3C64XX_EINT34FLTCON   S3C64XX_GPIOREG(0x224)
+#define S3C64XX_EINT56FLTCON   S3C64XX_GPIOREG(0x228)
+#define S3C64XX_EINT78FLTCON   S3C64XX_GPIOREG(0x22C)
+#define S3C64XX_EINT9FLTCON    S3C64XX_GPIOREG(0x230)
+
+#define S3C64XX_EINT12MASK     S3C64XX_GPIOREG(0x240)
+#define S3C64XX_EINT34MASK     S3C64XX_GPIOREG(0x244)
+#define S3C64XX_EINT56MASK     S3C64XX_GPIOREG(0x248)
+#define S3C64XX_EINT78MASK     S3C64XX_GPIOREG(0x24C)
+#define S3C64XX_EINT9MASK      S3C64XX_GPIOREG(0x250)
+
+#define S3C64XX_EINT12PEND     S3C64XX_GPIOREG(0x260)
+#define S3C64XX_EINT34PEND     S3C64XX_GPIOREG(0x264)
+#define S3C64XX_EINT56PEND     S3C64XX_GPIOREG(0x268)
+#define S3C64XX_EINT78PEND     S3C64XX_GPIOREG(0x26C)
+#define S3C64XX_EINT9PEND      S3C64XX_GPIOREG(0x270)
+
+#define S3C64XX_PRIORITY       S3C64XX_GPIOREG(0x280)
+#define S3C64XX_PRIORITY_ARB(x)        (1 << (x))
+
+#define S3C64XX_SERVICE                S3C64XX_GPIOREG(0x284)
+#define S3C64XX_SERVICEPEND    S3C64XX_GPIOREG(0x288)
+
+#define S3C64XX_EINT0CON0      S3C64XX_GPIOREG(0x900)
+#define S3C64XX_EINT0CON1      S3C64XX_GPIOREG(0x904)
+#define S3C64XX_EINT0FLTCON0   S3C64XX_GPIOREG(0x910)
+#define S3C64XX_EINT0FLTCON1   S3C64XX_GPIOREG(0x914)
+#define S3C64XX_EINT0FLTCON2   S3C64XX_GPIOREG(0x918)
+#define S3C64XX_EINT0FLTCON3   S3C64XX_GPIOREG(0x91C)
+
+#define S3C64XX_EINT0MASK      S3C64XX_GPIOREG(0x920)
+#define S3C64XX_EINT0PEND      S3C64XX_GPIOREG(0x924)
+
+/* GPIO sleep configuration */
+
+#define S3C64XX_SPCONSLP       S3C64XX_GPIOREG(0x880)
+
+#define S3C64XX_SPCONSLP_TDO_PULLDOWN  (1 << 14)
+#define S3C64XX_SPCONSLP_CKE1INIT      (1 << 5)
+
+#define S3C64XX_SPCONSLP_RSTOUT_MASK   (0x3 << 12)
+#define S3C64XX_SPCONSLP_RSTOUT_OUT0   (0x0 << 12)
+#define S3C64XX_SPCONSLP_RSTOUT_OUT1   (0x1 << 12)
+#define S3C64XX_SPCONSLP_RSTOUT_HIZ    (0x2 << 12)
+
+#define S3C64XX_SPCONSLP_KPCOL_MASK    (0x3 << 0)
+#define S3C64XX_SPCONSLP_KPCOL_OUT0    (0x0 << 0)
+#define S3C64XX_SPCONSLP_KPCOL_OUT1    (0x1 << 0)
+#define S3C64XX_SPCONSLP_KPCOL_INP     (0x2 << 0)
+
+
+#define S3C64XX_SLPEN          S3C64XX_GPIOREG(0x930)
+
+#define S3C64XX_SLPEN_USE_xSLP         (1 << 0)
+#define S3C64XX_SLPEN_CFG_BYSLPEN      (1 << 1)
+
+#endif /* __ASM_PLAT_S3C64XX_REGS_GPIO_H */
+
diff --git a/arch/arm/mach-s3c/regs-gpio.h b/arch/arm/mach-s3c/regs-gpio.h
new file mode 100644 (file)
index 0000000..0d41cb7
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "regs-gpio-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "regs-gpio-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/regs-irq-s3c24xx.h b/arch/arm/mach-s3c/regs-irq-s3c24xx.h
new file mode 100644 (file)
index 0000000..c0b97b2
--- /dev/null
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
+ *                   http://www.simtec.co.uk/products/SWLINUX/
+ */
+
+
+#ifndef ___ASM_ARCH_REGS_IRQ_H
+#define ___ASM_ARCH_REGS_IRQ_H
+
+#include "map-s3c.h"
+
+/* interrupt controller */
+
+#define S3C2410_IRQREG(x)   ((x) + S3C24XX_VA_IRQ)
+#define S3C2410_EINTREG(x)  ((x) + S3C24XX_VA_GPIO)
+#define S3C24XX_EINTREG(x)  ((x) + S3C24XX_VA_GPIO2)
+
+#define S3C2410_SRCPND        S3C2410_IRQREG(0x000)
+#define S3C2410_INTMOD        S3C2410_IRQREG(0x004)
+#define S3C2410_INTMSK        S3C2410_IRQREG(0x008)
+#define S3C2410_PRIORITY       S3C2410_IRQREG(0x00C)
+#define S3C2410_INTPND        S3C2410_IRQREG(0x010)
+#define S3C2410_INTOFFSET      S3C2410_IRQREG(0x014)
+#define S3C2410_SUBSRCPND      S3C2410_IRQREG(0x018)
+#define S3C2410_INTSUBMSK      S3C2410_IRQREG(0x01C)
+
+#define S3C2416_PRIORITY_MODE1         S3C2410_IRQREG(0x030)
+#define S3C2416_PRIORITY_UPDATE1       S3C2410_IRQREG(0x034)
+#define S3C2416_SRCPND2                        S3C2410_IRQREG(0x040)
+#define S3C2416_INTMOD2                        S3C2410_IRQREG(0x044)
+#define S3C2416_INTMSK2                        S3C2410_IRQREG(0x048)
+#define S3C2416_INTPND2                        S3C2410_IRQREG(0x050)
+#define S3C2416_INTOFFSET2             S3C2410_IRQREG(0x054)
+#define S3C2416_PRIORITY_MODE2         S3C2410_IRQREG(0x070)
+#define S3C2416_PRIORITY_UPDATE2       S3C2410_IRQREG(0x074)
+
+/* mask: 0=enable, 1=disable
+ * 1 bit EINT, 4=EINT4, 23=EINT23
+ * EINT0,1,2,3 are not handled here.
+*/
+
+#define S3C2410_EINTMASK       S3C2410_EINTREG(0x0A4)
+#define S3C2410_EINTPEND       S3C2410_EINTREG(0X0A8)
+#define S3C2412_EINTMASK       S3C2410_EINTREG(0x0B4)
+#define S3C2412_EINTPEND       S3C2410_EINTREG(0X0B8)
+
+#define S3C24XX_EINTMASK       S3C24XX_EINTREG(0x0A4)
+#define S3C24XX_EINTPEND       S3C24XX_EINTREG(0X0A8)
+
+#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c/regs-irq-s3c64xx.h b/arch/arm/mach-s3c/regs-irq-s3c64xx.h
new file mode 100644 (file)
index 0000000..b18c7bc
--- /dev/null
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C64XX - IRQ register definitions
+ */
+
+#ifndef __ASM_ARCH_REGS_IRQ_H
+#define __ASM_ARCH_REGS_IRQ_H __FILE__
+
+
+#endif /* __ASM_ARCH_6400_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c/regs-irq.h b/arch/arm/mach-s3c/regs-irq.h
new file mode 100644 (file)
index 0000000..57f0dda
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_ARCH_S3C24XX
+#include "regs-irq-s3c24xx.h"
+#endif
+
+#ifdef CONFIG_ARCH_S3C64XX
+#include "regs-irq-s3c64xx.h"
+#endif
diff --git a/arch/arm/mach-s3c/regs-irqtype.h b/arch/arm/mach-s3c/regs-irqtype.h
new file mode 100644 (file)
index 0000000..ec5c4c5
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * S3C - IRQ detection types.
+ */
+
+/* values for S3C2410_EXTINT0/1/2 and other cpus in the series, including
+ * the S3C64XX
+*/
+#define S3C2410_EXTINT_LOWLEV   (0x00)
+#define S3C2410_EXTINT_HILEV    (0x01)
+#define S3C2410_EXTINT_FALLEDGE         (0x02)
+#define S3C2410_EXTINT_RISEEDGE         (0x04)
+#define S3C2410_EXTINT_BOTHEDGE         (0x06)
diff --git a/arch/arm/mach-s3c/regs-mem-s3c24xx.h b/arch/arm/mach-s3c/regs-mem-s3c24xx.h
new file mode 100644 (file)
index 0000000..8fed34a
--- /dev/null
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
+ *             http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * S3C2410 Memory Control register definitions
+ */
+
+#ifndef __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H
+#define __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H __FILE__
+
+#include "map-s3c.h"
+
+#define S3C2410_MEMREG(x)              (S3C24XX_VA_MEMCTRL + (x))
+
+#define S3C2410_BWSCON                 S3C2410_MEMREG(0x00)
+#define S3C2410_BANKCON0               S3C2410_MEMREG(0x04)
+#define S3C2410_BANKCON1               S3C2410_MEMREG(0x08)
+#define S3C2410_BANKCON2               S3C2410_MEMREG(0x0C)
+#define S3C2410_BANKCON3               S3C2410_MEMREG(0x10)
+#define S3C2410_BANKCON4               S3C2410_MEMREG(0x14)
+#define S3C2410_BANKCON5               S3C2410_MEMREG(0x18)
+#define S3C2410_BANKCON6               S3C2410_MEMREG(0x1C)
+#define S3C2410_BANKCON7               S3C2410_MEMREG(0x20)
+#define S3C2410_REFRESH                        S3C2410_MEMREG(0x24)
+#define S3C2410_BANKSIZE               S3C2410_MEMREG(0x28)
+
+#define S3C2410_BWSCON_ST1             (1 << 7)
+#define S3C2410_BWSCON_ST2             (1 << 11)
+#define S3C2410_BWSCON_ST3             (1 << 15)
+#define S3C2410_BWSCON_ST4             (1 << 19)
+#define S3C2410_BWSCON_ST5             (1 << 23)
+
+#define S3C2410_BWSCON_GET(_bwscon, _bank) (((_bwscon) >> ((_bank) * 4)) & 0xf)
+
+#define S3C2410_BWSCON_WS              (1 << 2)
+
+#define S3C2410_BANKCON_PMC16          (0x3)
+
+#define S3C2410_BANKCON_Tacp_SHIFT     (2)
+#define S3C2410_BANKCON_Tcah_SHIFT     (4)
+#define S3C2410_BANKCON_Tcoh_SHIFT     (6)
+#define S3C2410_BANKCON_Tacc_SHIFT     (8)
+#define S3C2410_BANKCON_Tcos_SHIFT     (11)
+#define S3C2410_BANKCON_Tacs_SHIFT     (13)
+
+#define S3C2410_BANKCON_SDRAM          (0x3 << 15)
+
+#define S3C2410_REFRESH_SELF           (1 << 22)
+
+#define S3C2410_BANKSIZE_MASK          (0x7 << 0)
+
+#endif /* __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H */
diff --git a/arch/arm/mach-s3c/regs-modem-s3c64xx.h b/arch/arm/mach-s3c/regs-modem-s3c64xx.h
new file mode 100644 (file)
index 0000000..136ad44
--- /dev/null
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      http://armlinux.simtec.co.uk/
+ *      Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C64XX - modem block registers
+ */
+
+#ifndef __MACH_S3C64XX_REGS_MODEM_H
+#define __MACH_S3C64XX_REGS_MODEM_H __FILE__
+
+#define S3C64XX_MODEMREG(x)                    (S3C64XX_VA_MODEM + (x))
+
+#define S3C64XX_MODEM_INT2AP                   S3C64XX_MODEMREG(0x0)
+#define S3C64XX_MODEM_INT2MODEM                        S3C64XX_MODEMREG(0x4)
+#define S3C64XX_MODEM_MIFCON                   S3C64XX_MODEMREG(0x8)
+#define S3C64XX_MODEM_MIFPCON                  S3C64XX_MODEMREG(0xC)
+#define S3C64XX_MODEM_INTCLR                   S3C64XX_MODEMREG(0x10)
+#define S3C64XX_MODEM_DMA_TXADDR               S3C64XX_MODEMREG(0x14)
+#define S3C64XX_MODEM_DMA_RXADDR               S3C64XX_MODEMREG(0x18)
+
+#define MIFPCON_INT2M_LEVEL                    (1 << 4)
+#define MIFPCON_LCD_BYPASS                     (1 << 3)
+
+#endif /* __MACH_S3C64XX_REGS_MODEM_H */
diff --git a/arch/arm/mach-s3c/regs-s3c2443-clock.h b/arch/arm/mach-s3c/regs-s3c2443-clock.h
new file mode 100644 (file)
index 0000000..b3b670d
--- /dev/null
@@ -0,0 +1,238 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2007 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * S3C2443 clock register definitions
+ */
+
+#ifndef __ASM_ARM_REGS_S3C2443_CLOCK
+#define __ASM_ARM_REGS_S3C2443_CLOCK
+
+#include <linux/delay.h>
+#include "map-s3c.h"
+
+#define S3C2443_CLKREG(x)              ((x) + S3C24XX_VA_CLKPWR)
+
+#define S3C2443_PLLCON_MDIVSHIFT       16
+#define S3C2443_PLLCON_PDIVSHIFT       8
+#define S3C2443_PLLCON_SDIVSHIFT       0
+#define S3C2443_PLLCON_MDIVMASK                ((1<<(1+(23-16)))-1)
+#define S3C2443_PLLCON_PDIVMASK                ((1<<(1+(9-8)))-1)
+#define S3C2443_PLLCON_SDIVMASK                (3)
+
+#define S3C2443_MPLLCON                        S3C2443_CLKREG(0x10)
+#define S3C2443_EPLLCON                        S3C2443_CLKREG(0x18)
+#define S3C2443_CLKSRC                 S3C2443_CLKREG(0x20)
+#define S3C2443_CLKDIV0                        S3C2443_CLKREG(0x24)
+#define S3C2443_CLKDIV1                        S3C2443_CLKREG(0x28)
+#define S3C2443_HCLKCON                        S3C2443_CLKREG(0x30)
+#define S3C2443_PCLKCON                        S3C2443_CLKREG(0x34)
+#define S3C2443_SCLKCON                        S3C2443_CLKREG(0x38)
+#define S3C2443_PWRMODE                        S3C2443_CLKREG(0x40)
+#define S3C2443_SWRST                  S3C2443_CLKREG(0x44)
+#define S3C2443_BUSPRI0                        S3C2443_CLKREG(0x50)
+#define S3C2443_SYSID                  S3C2443_CLKREG(0x5C)
+#define S3C2443_PWRCFG                 S3C2443_CLKREG(0x60)
+#define S3C2443_RSTCON                 S3C2443_CLKREG(0x64)
+#define S3C2443_PHYCTRL                        S3C2443_CLKREG(0x80)
+#define S3C2443_PHYPWR                 S3C2443_CLKREG(0x84)
+#define S3C2443_URSTCON                        S3C2443_CLKREG(0x88)
+#define S3C2443_UCLKCON                        S3C2443_CLKREG(0x8C)
+
+#define S3C2443_PLLCON_OFF             (1<<24)
+
+#define S3C2443_CLKSRC_EPLLREF_XTAL    (2<<7)
+#define S3C2443_CLKSRC_EPLLREF_EXTCLK  (3<<7)
+#define S3C2443_CLKSRC_EPLLREF_MPLLREF (0<<7)
+#define S3C2443_CLKSRC_EPLLREF_MPLLREF2        (1<<7)
+#define S3C2443_CLKSRC_EPLLREF_MASK    (3<<7)
+
+#define S3C2443_CLKSRC_EXTCLK_DIV      (1<<3)
+
+#define S3C2443_CLKDIV0_HALF_HCLK      (1<<3)
+#define S3C2443_CLKDIV0_HALF_PCLK      (1<<2)
+
+#define S3C2443_CLKDIV0_HCLKDIV_MASK   (3<<0)
+
+#define S3C2443_CLKDIV0_EXTDIV_MASK    (3<<6)
+#define S3C2443_CLKDIV0_EXTDIV_SHIFT   (6)
+
+#define S3C2443_CLKDIV0_PREDIV_MASK    (3<<4)
+#define S3C2443_CLKDIV0_PREDIV_SHIFT   (4)
+
+#define S3C2416_CLKDIV0_ARMDIV_MASK    (7 << 9)
+#define S3C2443_CLKDIV0_ARMDIV_MASK    (15<<9)
+#define S3C2443_CLKDIV0_ARMDIV_SHIFT   (9)
+#define S3C2443_CLKDIV0_ARMDIV_1       (0<<9)
+#define S3C2443_CLKDIV0_ARMDIV_2       (8<<9)
+#define S3C2443_CLKDIV0_ARMDIV_3       (2<<9)
+#define S3C2443_CLKDIV0_ARMDIV_4       (9<<9)
+#define S3C2443_CLKDIV0_ARMDIV_6       (10<<9)
+#define S3C2443_CLKDIV0_ARMDIV_8       (11<<9)
+#define S3C2443_CLKDIV0_ARMDIV_12      (13<<9)
+#define S3C2443_CLKDIV0_ARMDIV_16      (15<<9)
+
+/* S3C2443_CLKDIV1 removed, only used in clock.c code */
+
+#define S3C2443_CLKCON_NAND
+
+#define S3C2443_HCLKCON_DMA0           (1<<0)
+#define S3C2443_HCLKCON_DMA1           (1<<1)
+#define S3C2443_HCLKCON_DMA2           (1<<2)
+#define S3C2443_HCLKCON_DMA3           (1<<3)
+#define S3C2443_HCLKCON_DMA4           (1<<4)
+#define S3C2443_HCLKCON_DMA5           (1<<5)
+#define S3C2443_HCLKCON_CAMIF          (1<<8)
+#define S3C2443_HCLKCON_LCDC           (1<<9)
+#define S3C2443_HCLKCON_USBH           (1<<11)
+#define S3C2443_HCLKCON_USBD           (1<<12)
+#define S3C2416_HCLKCON_HSMMC0         (1<<15)
+#define S3C2443_HCLKCON_HSMMC          (1<<16)
+#define S3C2443_HCLKCON_CFC            (1<<17)
+#define S3C2443_HCLKCON_SSMC           (1<<18)
+#define S3C2443_HCLKCON_DRAMC          (1<<19)
+
+#define S3C2443_PCLKCON_UART0          (1<<0)
+#define S3C2443_PCLKCON_UART1          (1<<1)
+#define S3C2443_PCLKCON_UART2          (1<<2)
+#define S3C2443_PCLKCON_UART3          (1<<3)
+#define S3C2443_PCLKCON_IIC            (1<<4)
+#define S3C2443_PCLKCON_SDI            (1<<5)
+#define S3C2443_PCLKCON_HSSPI          (1<<6)
+#define S3C2443_PCLKCON_ADC            (1<<7)
+#define S3C2443_PCLKCON_AC97           (1<<8)
+#define S3C2443_PCLKCON_IIS            (1<<9)
+#define S3C2443_PCLKCON_PWMT           (1<<10)
+#define S3C2443_PCLKCON_WDT            (1<<11)
+#define S3C2443_PCLKCON_RTC            (1<<12)
+#define S3C2443_PCLKCON_GPIO           (1<<13)
+#define S3C2443_PCLKCON_SPI0           (1<<14)
+#define S3C2443_PCLKCON_SPI1           (1<<15)
+
+#define S3C2443_SCLKCON_DDRCLK         (1<<16)
+#define S3C2443_SCLKCON_SSMCCLK                (1<<15)
+#define S3C2443_SCLKCON_HSSPICLK       (1<<14)
+#define S3C2443_SCLKCON_HSMMCCLK_EXT   (1<<13)
+#define S3C2443_SCLKCON_HSMMCCLK_EPLL  (1<<12)
+#define S3C2443_SCLKCON_CAMCLK         (1<<11)
+#define S3C2443_SCLKCON_DISPCLK                (1<<10)
+#define S3C2443_SCLKCON_I2SCLK         (1<<9)
+#define S3C2443_SCLKCON_UARTCLK                (1<<8)
+#define S3C2443_SCLKCON_USBHOST                (1<<1)
+
+#define S3C2443_PWRCFG_SLEEP           (1<<15)
+
+#define S3C2443_PWRCFG_USBPHY          (1 << 4)
+
+#define S3C2443_URSTCON_FUNCRST                (1 << 2)
+#define S3C2443_URSTCON_PHYRST         (1 << 0)
+
+#define S3C2443_PHYCTRL_CLKSEL         (1 << 3)
+#define S3C2443_PHYCTRL_EXTCLK         (1 << 2)
+#define S3C2443_PHYCTRL_PLLSEL         (1 << 1)
+#define S3C2443_PHYCTRL_DSPORT         (1 << 0)
+
+#define S3C2443_PHYPWR_COMMON_ON       (1 << 31)
+#define S3C2443_PHYPWR_ANALOG_PD       (1 << 4)
+#define S3C2443_PHYPWR_PLL_REFCLK      (1 << 3)
+#define S3C2443_PHYPWR_XO_ON           (1 << 2)
+#define S3C2443_PHYPWR_PLL_PWRDN       (1 << 1)
+#define S3C2443_PHYPWR_FSUSPEND                (1 << 0)
+
+#define S3C2443_UCLKCON_DETECT_VBUS    (1 << 31)
+#define S3C2443_UCLKCON_FUNC_CLKEN     (1 << 2)
+#define S3C2443_UCLKCON_TCLKEN         (1 << 0)
+
+#include <asm/div64.h>
+
+static inline unsigned int
+s3c2443_get_mpll(unsigned int pllval, unsigned int baseclk)
+{
+       unsigned int mdiv, pdiv, sdiv;
+       uint64_t fvco;
+
+       mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
+       pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
+       sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
+
+       mdiv &= S3C2443_PLLCON_MDIVMASK;
+       pdiv &= S3C2443_PLLCON_PDIVMASK;
+       sdiv &= S3C2443_PLLCON_SDIVMASK;
+
+       fvco = (uint64_t)baseclk * (2 * (mdiv + 8));
+       do_div(fvco, pdiv << sdiv);
+
+       return (unsigned int)fvco;
+}
+
+static inline unsigned int
+s3c2443_get_epll(unsigned int pllval, unsigned int baseclk)
+{
+       unsigned int mdiv, pdiv, sdiv;
+       uint64_t fvco;
+
+       mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
+       pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
+       sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
+
+       mdiv &= S3C2443_PLLCON_MDIVMASK;
+       pdiv &= S3C2443_PLLCON_PDIVMASK;
+       sdiv &= S3C2443_PLLCON_SDIVMASK;
+
+       fvco = (uint64_t)baseclk * (mdiv + 8);
+       do_div(fvco, (pdiv + 2) << sdiv);
+
+       return (unsigned int)fvco;
+}
+
+static inline void s3c_hsudc_init_phy(void)
+{
+       u32 cfg;
+
+       cfg = readl(S3C2443_PWRCFG) | S3C2443_PWRCFG_USBPHY;
+       writel(cfg, S3C2443_PWRCFG);
+
+       cfg = readl(S3C2443_URSTCON);
+       cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
+       writel(cfg, S3C2443_URSTCON);
+       mdelay(1);
+
+       cfg = readl(S3C2443_URSTCON);
+       cfg &= ~(S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
+       writel(cfg, S3C2443_URSTCON);
+
+       cfg = readl(S3C2443_PHYCTRL);
+       cfg &= ~(S3C2443_PHYCTRL_CLKSEL | S3C2443_PHYCTRL_DSPORT);
+       cfg |= (S3C2443_PHYCTRL_EXTCLK | S3C2443_PHYCTRL_PLLSEL);
+       writel(cfg, S3C2443_PHYCTRL);
+
+       cfg = readl(S3C2443_PHYPWR);
+       cfg &= ~(S3C2443_PHYPWR_FSUSPEND | S3C2443_PHYPWR_PLL_PWRDN |
+               S3C2443_PHYPWR_XO_ON | S3C2443_PHYPWR_PLL_REFCLK |
+               S3C2443_PHYPWR_ANALOG_PD);
+       cfg |= S3C2443_PHYPWR_COMMON_ON;
+       writel(cfg, S3C2443_PHYPWR);
+
+       cfg = readl(S3C2443_UCLKCON);
+       cfg |= (S3C2443_UCLKCON_DETECT_VBUS | S3C2443_UCLKCON_FUNC_CLKEN |
+               S3C2443_UCLKCON_TCLKEN);
+       writel(cfg, S3C2443_UCLKCON);
+}
+
+static inline void s3c_hsudc_uninit_phy(void)
+{
+       u32 cfg;
+
+       cfg = readl(S3C2443_PWRCFG) & ~S3C2443_PWRCFG_USBPHY;
+       writel(cfg, S3C2443_PWRCFG);
+
+       writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR);
+
+       cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN;
+       writel(cfg, S3C2443_UCLKCON);
+}
+
+#endif /*  __ASM_ARM_REGS_S3C2443_CLOCK */
+
diff --git a/arch/arm/mach-s3c/regs-srom-s3c64xx.h b/arch/arm/mach-s3c/regs-srom-s3c64xx.h
new file mode 100644 (file)
index 0000000..2b37988
--- /dev/null
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2009 Andy Green <andy@warmcat.com>
+ *
+ * S3C64XX SROM definitions
+ */
+
+#ifndef __MACH_S3C64XX_REGS_SROM_H
+#define __MACH_S3C64XX_REGS_SROM_H __FILE__
+
+#define S3C64XX_SROMREG(x)     (S3C_VA_MEM + (x))
+
+#define S3C64XX_SROM_BW                S3C64XX_SROMREG(0)
+#define S3C64XX_SROM_BC0       S3C64XX_SROMREG(4)
+#define S3C64XX_SROM_BC1       S3C64XX_SROMREG(8)
+#define S3C64XX_SROM_BC2       S3C64XX_SROMREG(0xc)
+#define S3C64XX_SROM_BC3       S3C64XX_SROMREG(0x10)
+#define S3C64XX_SROM_BC4       S3C64XX_SROMREG(0x14)
+#define S3C64XX_SROM_BC5       S3C64XX_SROMREG(0x18)
+
+/*
+ * one register BW holds 5 x 4-bit packed settings for NCS0 - NCS4
+ */
+
+#define S3C64XX_SROM_BW__DATAWIDTH__SHIFT      0
+#define S3C64XX_SROM_BW__WAITENABLE__SHIFT     2
+#define S3C64XX_SROM_BW__BYTEENABLE__SHIFT     3
+#define S3C64XX_SROM_BW__CS_MASK               0xf
+
+#define S3C64XX_SROM_BW__NCS0__SHIFT   0
+#define S3C64XX_SROM_BW__NCS1__SHIFT   4
+#define S3C64XX_SROM_BW__NCS2__SHIFT   8
+#define S3C64XX_SROM_BW__NCS3__SHIFT   0xc
+#define S3C64XX_SROM_BW__NCS4__SHIFT   0x10
+
+/*
+ * applies to same to BCS0 - BCS4
+ */
+
+#define S3C64XX_SROM_BCX__PMC__SHIFT   0
+#define S3C64XX_SROM_BCX__PMC__MASK    3
+#define S3C64XX_SROM_BCX__TACP__SHIFT  4
+#define S3C64XX_SROM_BCX__TACP__MASK   0xf
+#define S3C64XX_SROM_BCX__TCAH__SHIFT  8
+#define S3C64XX_SROM_BCX__TCAH__MASK   0xf
+#define S3C64XX_SROM_BCX__TCOH__SHIFT  12
+#define S3C64XX_SROM_BCX__TCOH__MASK   0xf
+#define S3C64XX_SROM_BCX__TACC__SHIFT  16
+#define S3C64XX_SROM_BCX__TACC__MASK   0x1f
+#define S3C64XX_SROM_BCX__TCOS__SHIFT  24
+#define S3C64XX_SROM_BCX__TCOS__MASK   0xf
+#define S3C64XX_SROM_BCX__TACS__SHIFT  28
+#define S3C64XX_SROM_BCX__TACS__MASK   0xf
+
+#endif /* __MACH_S3C64XX_REGS_SROM_H */
diff --git a/arch/arm/mach-s3c/regs-sys-s3c64xx.h b/arch/arm/mach-s3c/regs-sys-s3c64xx.h
new file mode 100644 (file)
index 0000000..3687325
--- /dev/null
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX system register definitions
+*/
+
+#ifndef __MACH_S3C64XX_REGS_SYS_H
+#define __MACH_S3C64XX_REGS_SYS_H __FILE__
+
+#define S3C_SYSREG(x)                  (S3C_VA_SYS + (x))
+
+#define S3C64XX_AHB_CON0               S3C_SYSREG(0x100)
+#define S3C64XX_AHB_CON1               S3C_SYSREG(0x104)
+#define S3C64XX_AHB_CON2               S3C_SYSREG(0x108)
+
+#define S3C64XX_SDMA_SEL               S3C_SYSREG(0x110)
+
+#define S3C64XX_OTHERS                 S3C_SYSREG(0x900)
+
+#define S3C64XX_OTHERS_USBMASK         (1 << 16)
+#define S3C64XX_OTHERS_SYNCMUXSEL      (1 << 6)
+
+#endif /* __MACH_S3C64XX_REGS_SYS_H */
diff --git a/arch/arm/mach-s3c/regs-syscon-power-s3c64xx.h b/arch/arm/mach-s3c/regs-syscon-power-s3c64xx.h
new file mode 100644 (file)
index 0000000..a35811c
--- /dev/null
@@ -0,0 +1,112 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      http://armlinux.simtec.co.uk/
+ *      Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C64XX - syscon power and sleep control registers
+*/
+
+#ifndef __MACH_S3C64XX_REGS_SYSCON_POWER_H
+#define __MACH_S3C64XX_REGS_SYSCON_POWER_H __FILE__
+
+#define S3C64XX_PWR_CFG                                S3C_SYSREG(0x804)
+
+#define S3C64XX_PWRCFG_OSC_OTG_DISABLE         (1 << 17)
+#define S3C64XX_PWRCFG_MMC2_DISABLE            (1 << 16)
+#define S3C64XX_PWRCFG_MMC1_DISABLE            (1 << 15)
+#define S3C64XX_PWRCFG_MMC0_DISABLE            (1 << 14)
+#define S3C64XX_PWRCFG_HSI_DISABLE             (1 << 13)
+#define S3C64XX_PWRCFG_TS_DISABLE              (1 << 12)
+#define S3C64XX_PWRCFG_RTC_TICK_DISABLE                (1 << 11)
+#define S3C64XX_PWRCFG_RTC_ALARM_DISABLE       (1 << 10)
+#define S3C64XX_PWRCFG_MSM_DISABLE             (1 << 9)
+#define S3C64XX_PWRCFG_KEY_DISABLE             (1 << 8)
+#define S3C64XX_PWRCFG_BATF_DISABLE            (1 << 7)
+
+#define S3C64XX_PWRCFG_CFG_WFI_MASK            (0x3 << 5)
+#define S3C64XX_PWRCFG_CFG_WFI_SHIFT           (5)
+#define S3C64XX_PWRCFG_CFG_WFI_IGNORE          (0x0 << 5)
+#define S3C64XX_PWRCFG_CFG_WFI_IDLE            (0x1 << 5)
+#define S3C64XX_PWRCFG_CFG_WFI_STOP            (0x2 << 5)
+#define S3C64XX_PWRCFG_CFG_WFI_SLEEP           (0x3 << 5)
+
+#define S3C64XX_PWRCFG_CFG_BATFLT_MASK         (0x3 << 3)
+#define S3C64XX_PWRCFG_CFG_BATFLT_SHIFT                (3)
+#define S3C64XX_PWRCFG_CFG_BATFLT_IGNORE       (0x0 << 3)
+#define S3C64XX_PWRCFG_CFG_BATFLT_IRQ          (0x1 << 3)
+#define S3C64XX_PWRCFG_CFG_BATFLT_SLEEP                (0x3 << 3)
+
+#define S3C64XX_PWRCFG_CFG_BAT_WAKE            (1 << 2)
+#define S3C64XX_PWRCFG_OSC27_EN                        (1 << 0)
+
+#define S3C64XX_EINT_MASK                      S3C_SYSREG(0x808)
+
+#define S3C64XX_NORMAL_CFG                     S3C_SYSREG(0x810)
+
+#define S3C64XX_NORMALCFG_IROM_ON              (1 << 30)
+#define S3C64XX_NORMALCFG_DOMAIN_ETM_ON                (1 << 16)
+#define S3C64XX_NORMALCFG_DOMAIN_S_ON          (1 << 15)
+#define S3C64XX_NORMALCFG_DOMAIN_F_ON          (1 << 14)
+#define S3C64XX_NORMALCFG_DOMAIN_P_ON          (1 << 13)
+#define S3C64XX_NORMALCFG_DOMAIN_I_ON          (1 << 12)
+#define S3C64XX_NORMALCFG_DOMAIN_G_ON          (1 << 10)
+#define S3C64XX_NORMALCFG_DOMAIN_V_ON          (1 << 9)
+
+#define S3C64XX_STOP_CFG                       S3C_SYSREG(0x814)
+
+#define S3C64XX_STOPCFG_MEMORY_ARM_ON          (1 << 29)
+#define S3C64XX_STOPCFG_TOP_MEMORY_ON          (1 << 20)
+#define S3C64XX_STOPCFG_ARM_LOGIC_ON           (1 << 17)
+#define S3C64XX_STOPCFG_TOP_LOGIC_ON           (1 << 8)
+#define S3C64XX_STOPCFG_OSC_EN                 (1 << 0)
+
+#define S3C64XX_SLEEP_CFG                      S3C_SYSREG(0x818)
+
+#define S3C64XX_SLEEPCFG_OSC_EN                        (1 << 0)
+
+#define S3C64XX_STOP_MEM_CFG                   S3C_SYSREG(0x81c)
+
+#define S3C64XX_STOPMEMCFG_MODEMIF_RETAIN      (1 << 6)
+#define S3C64XX_STOPMEMCFG_HOSTIF_RETAIN       (1 << 5)
+#define S3C64XX_STOPMEMCFG_OTG_RETAIN          (1 << 4)
+#define S3C64XX_STOPMEMCFG_HSMCC_RETAIN                (1 << 3)
+#define S3C64XX_STOPMEMCFG_IROM_RETAIN         (1 << 2)
+#define S3C64XX_STOPMEMCFG_IRDA_RETAIN         (1 << 1)
+#define S3C64XX_STOPMEMCFG_NFCON_RETAIN                (1 << 0)
+
+#define S3C64XX_OSC_STABLE                     S3C_SYSREG(0x824)
+#define S3C64XX_PWR_STABLE                     S3C_SYSREG(0x828)
+
+#define S3C64XX_WAKEUP_STAT                    S3C_SYSREG(0x908)
+
+#define S3C64XX_WAKEUPSTAT_MMC2                        (1 << 11)
+#define S3C64XX_WAKEUPSTAT_MMC1                        (1 << 10)
+#define S3C64XX_WAKEUPSTAT_MMC0                        (1 << 9)
+#define S3C64XX_WAKEUPSTAT_HSI                 (1 << 8)
+#define S3C64XX_WAKEUPSTAT_BATFLT              (1 << 6)
+#define S3C64XX_WAKEUPSTAT_MSM                 (1 << 5)
+#define S3C64XX_WAKEUPSTAT_KEY                 (1 << 4)
+#define S3C64XX_WAKEUPSTAT_TS                  (1 << 3)
+#define S3C64XX_WAKEUPSTAT_RTC_TICK            (1 << 2)
+#define S3C64XX_WAKEUPSTAT_RTC_ALARM           (1 << 1)
+#define S3C64XX_WAKEUPSTAT_EINT                        (1 << 0)
+
+#define S3C64XX_BLK_PWR_STAT                   S3C_SYSREG(0x90c)
+
+#define S3C64XX_BLKPWRSTAT_G                   (1 << 7)
+#define S3C64XX_BLKPWRSTAT_ETM                 (1 << 6)
+#define S3C64XX_BLKPWRSTAT_S                   (1 << 5)
+#define S3C64XX_BLKPWRSTAT_F                   (1 << 4)
+#define S3C64XX_BLKPWRSTAT_P                   (1 << 3)
+#define S3C64XX_BLKPWRSTAT_I                   (1 << 2)
+#define S3C64XX_BLKPWRSTAT_V                   (1 << 1)
+#define S3C64XX_BLKPWRSTAT_TOP                 (1 << 0)
+
+#define S3C64XX_INFORM0                                S3C_SYSREG(0xA00)
+#define S3C64XX_INFORM1                                S3C_SYSREG(0xA04)
+#define S3C64XX_INFORM2                                S3C_SYSREG(0xA08)
+#define S3C64XX_INFORM3                                S3C_SYSREG(0xA0C)
+
+#endif /* __MACH_S3C64XX_REGS_SYSCON_POWER_H */
diff --git a/arch/arm/mach-s3c/regs-usb-hsotg-phy-s3c64xx.h b/arch/arm/mach-s3c/regs-usb-hsotg-phy-s3c64xx.h
new file mode 100644 (file)
index 0000000..deb1dd2
--- /dev/null
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      http://armlinux.simtec.co.uk/
+ *      Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C - USB2.0 Highspeed/OtG device PHY registers
+*/
+
+/* Note, this is a separate header file as some of the clock framework
+ * needs to touch this if the clk_48m is used as the USB OHCI or other
+ * peripheral source.
+*/
+
+#ifndef __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H
+#define __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H __FILE__
+
+/* S3C64XX_PA_USB_HSPHY */
+
+#define S3C_HSOTG_PHYREG(x)    ((x) + S3C_VA_USB_HSPHY)
+
+#define S3C_PHYPWR                             S3C_HSOTG_PHYREG(0x00)
+#define S3C_PHYPWR_NORMAL_MASK                 (0x19 << 0)
+#define S3C_PHYPWR_OTG_DISABLE                 (1 << 4)
+#define S3C_PHYPWR_ANALOG_POWERDOWN            (1 << 3)
+#define SRC_PHYPWR_FORCE_SUSPEND               (1 << 1)
+
+#define S3C_PHYCLK                             S3C_HSOTG_PHYREG(0x04)
+#define S3C_PHYCLK_MODE_USB11                  (1 << 6)
+#define S3C_PHYCLK_EXT_OSC                     (1 << 5)
+#define S3C_PHYCLK_CLK_FORCE                   (1 << 4)
+#define S3C_PHYCLK_ID_PULL                     (1 << 2)
+#define S3C_PHYCLK_CLKSEL_MASK                 (0x3 << 0)
+#define S3C_PHYCLK_CLKSEL_SHIFT                        (0)
+#define S3C_PHYCLK_CLKSEL_48M                  (0x0 << 0)
+#define S3C_PHYCLK_CLKSEL_12M                  (0x2 << 0)
+#define S3C_PHYCLK_CLKSEL_24M                  (0x3 << 0)
+
+#define S3C_RSTCON                             S3C_HSOTG_PHYREG(0x08)
+#define S3C_RSTCON_PHYCLK                      (1 << 2)
+#define S3C_RSTCON_HCLK                                (1 << 1)
+#define S3C_RSTCON_PHY                         (1 << 0)
+
+#define S3C_PHYTUNE                            S3C_HSOTG_PHYREG(0x20)
+
+#endif /* __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H */
diff --git a/arch/arm/mach-s3c/rtc-core-s3c24xx.h b/arch/arm/mach-s3c/rtc-core-s3c24xx.h
new file mode 100644 (file)
index 0000000..e7258b2
--- /dev/null
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
+ *
+ * Samsung RTC Controller core functions
+ */
+
+#ifndef __RTC_CORE_S3C24XX_H
+#define __RTC_CORE_S3C24XX_H __FILE__
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+extern struct platform_device s3c_device_rtc;
+
+/* re-define device name depending on support. */
+static inline void s3c_rtc_setname(char *name)
+{
+       s3c_device_rtc.name = name;
+}
+
+#endif /* __RTC_CORE_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/s3c2410.c b/arch/arm/mach-s3c/s3c2410.c
new file mode 100644 (file)
index 0000000..4d39d99
--- /dev/null
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2003-2005 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://www.simtec.co.uk/products/EB2410ITX/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/clk.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+#include "gpio-samsung.h"
+#include <asm/irq.h>
+#include <asm/system_misc.h>
+
+
+#include "regs-clock.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+
+#include "s3c24xx.h"
+
+/* Initial IO mappings */
+
+static struct map_desc s3c2410_iodesc[] __initdata __maybe_unused = {
+       IODESC_ENT(CLKPWR),
+       IODESC_ENT(TIMER),
+       IODESC_ENT(WATCHDOG),
+};
+
+/* our uart devices */
+
+/* uart registration process */
+
+void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
+}
+
+/* s3c2410_map_io
+ *
+ * register the standard cpu IO areas, and any passed in from the
+ * machine specific initialisation.
+*/
+
+void __init s3c2410_map_io(void)
+{
+       s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
+       s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
+
+       iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
+}
+
+struct bus_type s3c2410_subsys = {
+       .name = "s3c2410-core",
+       .dev_name = "s3c2410-core",
+};
+
+/* Note, we would have liked to name this s3c2410-core, but we cannot
+ * register two subsystems with the same name.
+ */
+struct bus_type s3c2410a_subsys = {
+       .name = "s3c2410a-core",
+       .dev_name = "s3c2410a-core",
+};
+
+static struct device s3c2410_dev = {
+       .bus            = &s3c2410_subsys,
+};
+
+/* need to register the subsystem before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2410 based system)
+ * as a driver which may support both 2410 and 2440 may try and use it.
+*/
+
+static int __init s3c2410_core_init(void)
+{
+       return subsys_system_register(&s3c2410_subsys, NULL);
+}
+
+core_initcall(s3c2410_core_init);
+
+static int __init s3c2410a_core_init(void)
+{
+       return subsys_system_register(&s3c2410a_subsys, NULL);
+}
+
+core_initcall(s3c2410a_core_init);
+
+int __init s3c2410_init(void)
+{
+       printk("S3C2410: Initialising architecture\n");
+
+#ifdef CONFIG_PM_SLEEP
+       register_syscore_ops(&s3c2410_pm_syscore_ops);
+       register_syscore_ops(&s3c24xx_irq_syscore_ops);
+#endif
+
+       return device_register(&s3c2410_dev);
+}
+
+int __init s3c2410a_init(void)
+{
+       s3c2410_dev.bus = &s3c2410a_subsys;
+       return s3c2410_init();
+}
diff --git a/arch/arm/mach-s3c/s3c2412-power.h b/arch/arm/mach-s3c/s3c2412-power.h
new file mode 100644 (file)
index 0000000..0031cfa
--- /dev/null
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ */
+
+#ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H
+#define __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H __FILE__
+
+#define S3C24XX_PWRREG(x)                      ((x) + S3C24XX_VA_CLKPWR)
+
+#define S3C2412_PWRMODECON                     S3C24XX_PWRREG(0x20)
+#define S3C2412_PWRCFG                         S3C24XX_PWRREG(0x24)
+
+#define S3C2412_INFORM0                                S3C24XX_PWRREG(0x70)
+#define S3C2412_INFORM1                                S3C24XX_PWRREG(0x74)
+#define S3C2412_INFORM2                                S3C24XX_PWRREG(0x78)
+#define S3C2412_INFORM3                                S3C24XX_PWRREG(0x7C)
+
+#define S3C2412_PWRCFG_BATF_IRQ                        (1 << 0)
+#define S3C2412_PWRCFG_BATF_IGNORE             (2 << 0)
+#define S3C2412_PWRCFG_BATF_SLEEP              (3 << 0)
+#define S3C2412_PWRCFG_BATF_MASK               (3 << 0)
+
+#define S3C2412_PWRCFG_STANDBYWFI_IGNORE       (0 << 6)
+#define S3C2412_PWRCFG_STANDBYWFI_IDLE         (1 << 6)
+#define S3C2412_PWRCFG_STANDBYWFI_STOP         (2 << 6)
+#define S3C2412_PWRCFG_STANDBYWFI_SLEEP                (3 << 6)
+#define S3C2412_PWRCFG_STANDBYWFI_MASK         (3 << 6)
+
+#define S3C2412_PWRCFG_RTC_MASKIRQ             (1 << 8)
+#define S3C2412_PWRCFG_NAND_NORST              (1 << 9)
+
+#endif /* __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H */
diff --git a/arch/arm/mach-s3c/s3c2412.c b/arch/arm/mach-s3c/s3c2412.c
new file mode 100644 (file)
index 0000000..0b1ca78
--- /dev/null
@@ -0,0 +1,175 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2006 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://armlinux.simtec.co.uk/.
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/reboot.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/proc-fns.h>
+#include <asm/irq.h>
+#include <asm/system_misc.h>
+
+#include "map.h"
+#include "regs-clock.h"
+#include "regs-gpio.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "regs-dsc-s3c24xx.h"
+#include "s3c2412-power.h"
+
+#ifndef CONFIG_CPU_S3C2412_ONLY
+void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
+
+static inline void s3c2412_init_gpio2(void)
+{
+       s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10;
+}
+#else
+#define s3c2412_init_gpio2() do { } while(0)
+#endif
+
+/* Initial IO mappings */
+
+static struct map_desc s3c2412_iodesc[] __initdata __maybe_unused = {
+       IODESC_ENT(CLKPWR),
+       IODESC_ENT(TIMER),
+       IODESC_ENT(WATCHDOG),
+       {
+               .virtual = (unsigned long)S3C2412_VA_SSMC,
+               .pfn     = __phys_to_pfn(S3C2412_PA_SSMC),
+               .length  = SZ_1M,
+               .type    = MT_DEVICE,
+       },
+       {
+               .virtual = (unsigned long)S3C2412_VA_EBI,
+               .pfn     = __phys_to_pfn(S3C2412_PA_EBI),
+               .length  = SZ_1M,
+               .type    = MT_DEVICE,
+       },
+};
+
+/* uart registration process */
+
+void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c24xx_init_uartdevs("s3c2412-uart", s3c2410_uart_resources, cfg, no);
+
+       /* rename devices that are s3c2412/s3c2413 specific */
+       s3c_device_sdi.name  = "s3c2412-sdi";
+       s3c_device_lcd.name  = "s3c2412-lcd";
+       s3c_nand_setname("s3c2412-nand");
+
+       /* alter IRQ of SDI controller */
+
+       s3c_device_sdi.resource[1].start = IRQ_S3C2412_SDI;
+       s3c_device_sdi.resource[1].end   = IRQ_S3C2412_SDI;
+
+       /* spi channel related changes, s3c2412/13 specific */
+       s3c_device_spi0.name = "s3c2412-spi";
+       s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24;
+       s3c_device_spi1.name = "s3c2412-spi";
+       s3c_device_spi1.resource[0].start = S3C24XX_PA_SPI + S3C2412_SPI1;
+       s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x24;
+
+}
+
+/* s3c2412_idle
+ *
+ * use the standard idle call by ensuring the idle mode
+ * in power config, then issuing the idle co-processor
+ * instruction
+*/
+
+static void s3c2412_idle(void)
+{
+       unsigned long tmp;
+
+       /* ensure our idle mode is to go to idle */
+
+       tmp = __raw_readl(S3C2412_PWRCFG);
+       tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
+       tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
+       __raw_writel(tmp, S3C2412_PWRCFG);
+
+       cpu_do_idle();
+}
+
+/* s3c2412_map_io
+ *
+ * register the standard cpu IO areas, and any passed in from the
+ * machine specific initialisation.
+*/
+
+void __init s3c2412_map_io(void)
+{
+       /* move base of IO */
+
+       s3c2412_init_gpio2();
+
+       /* set our idle function */
+
+       arm_pm_idle = s3c2412_idle;
+
+       /* register our io-tables */
+
+       iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
+}
+
+/* need to register the subsystem before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2412 based system)
+ * as a driver which may support both 2410 and 2440 may try and use it.
+*/
+
+struct bus_type s3c2412_subsys = {
+       .name = "s3c2412-core",
+       .dev_name = "s3c2412-core",
+};
+
+static int __init s3c2412_core_init(void)
+{
+       return subsys_system_register(&s3c2412_subsys, NULL);
+}
+
+core_initcall(s3c2412_core_init);
+
+static struct device s3c2412_dev = {
+       .bus            = &s3c2412_subsys,
+};
+
+int __init s3c2412_init(void)
+{
+       printk("S3C2412: Initialising architecture\n");
+
+#ifdef CONFIG_PM_SLEEP
+       register_syscore_ops(&s3c2412_pm_syscore_ops);
+       register_syscore_ops(&s3c24xx_irq_syscore_ops);
+#endif
+
+       return device_register(&s3c2412_dev);
+}
diff --git a/arch/arm/mach-s3c/s3c2412.h b/arch/arm/mach-s3c/s3c2412.h
new file mode 100644 (file)
index 0000000..ed09a0e
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ */
+
+#ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_H
+#define __ARCH_ARM_MACH_S3C24XX_S3C2412_H __FILE__
+
+#include "map-s3c.h"
+
+#define S3C2412_MEMREG(x)              (S3C24XX_VA_MEMCTRL + (x))
+#define S3C2412_EBIREG(x)              (S3C2412_VA_EBI + (x))
+
+#define S3C2412_SSMCREG(x)             (S3C2412_VA_SSMC + (x))
+#define S3C2412_SSMC(x, o)             (S3C2412_SSMCREG((x * 0x20) + (o)))
+
+#define S3C2412_REFRESH                        S3C2412_MEMREG(0x10)
+
+#define S3C2412_EBI_BANKCFG            S3C2412_EBIREG(0x4)
+
+#define S3C2412_SSMC_BANK(x)           S3C2412_SSMC(x, 0x0)
+
+#endif /* __ARCH_ARM_MACH_S3C24XX_S3C2412_H */
diff --git a/arch/arm/mach-s3c/s3c2416.c b/arch/arm/mach-s3c/s3c2416.c
new file mode 100644 (file)
index 0000000..126e6ed
--- /dev/null
@@ -0,0 +1,132 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
+//     as part of OpenInkpot project
+// Copyright (c) 2009 Promwad Innovation Company
+//     Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
+//
+// Samsung S3C2416 Mobile CPU support
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/reboot.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+#include "gpio-samsung.h"
+#include <asm/proc-fns.h>
+#include <asm/irq.h>
+#include <asm/system_misc.h>
+
+#include "regs-s3c2443-clock.h"
+#include "rtc-core-s3c24xx.h"
+
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "devs.h"
+#include "cpu.h"
+#include "sdhci.h"
+#include "pm.h"
+
+#include "iic-core.h"
+#include "adc-core.h"
+
+#include "s3c24xx.h"
+#include "fb-core-s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "spi-core-s3c24xx.h"
+
+static struct map_desc s3c2416_iodesc[] __initdata __maybe_unused = {
+       IODESC_ENT(WATCHDOG),
+       IODESC_ENT(CLKPWR),
+       IODESC_ENT(TIMER),
+};
+
+struct bus_type s3c2416_subsys = {
+       .name = "s3c2416-core",
+       .dev_name = "s3c2416-core",
+};
+
+static struct device s3c2416_dev = {
+       .bus            = &s3c2416_subsys,
+};
+
+int __init s3c2416_init(void)
+{
+       printk(KERN_INFO "S3C2416: Initializing architecture\n");
+
+       /* change WDT IRQ number */
+       s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
+       s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
+
+       /* the i2c devices are directly compatible with s3c2440 */
+       s3c_i2c0_setname("s3c2440-i2c");
+       s3c_i2c1_setname("s3c2440-i2c");
+
+       s3c_fb_setname("s3c2443-fb");
+
+       s3c_adc_setname("s3c2416-adc");
+       s3c_rtc_setname("s3c2416-rtc");
+
+#ifdef CONFIG_PM_SLEEP
+       register_syscore_ops(&s3c2416_pm_syscore_ops);
+       register_syscore_ops(&s3c24xx_irq_syscore_ops);
+       register_syscore_ops(&s3c2416_irq_syscore_ops);
+#endif
+
+       return device_register(&s3c2416_dev);
+}
+
+void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
+
+       s3c_nand_setname("s3c2412-nand");
+}
+
+/* s3c2416_map_io
+ *
+ * register the standard cpu IO areas, and any passed in from the
+ * machine specific initialisation.
+ */
+
+void __init s3c2416_map_io(void)
+{
+       s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown;
+       s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown;
+
+       /* initialize device information early */
+       s3c2416_default_sdhci0();
+       s3c2416_default_sdhci1();
+       s3c24xx_spi_setname("s3c2443-spi");
+
+       iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
+}
+
+/* need to register the subsystem before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2416 based system)
+ * as a driver which may support both 2443 and 2440 may try and use it.
+*/
+
+static int __init s3c2416_core_init(void)
+{
+       return subsys_system_register(&s3c2416_subsys, NULL);
+}
+
+core_initcall(s3c2416_core_init);
diff --git a/arch/arm/mach-s3c/s3c2440.c b/arch/arm/mach-s3c/s3c2440.c
new file mode 100644 (file)
index 0000000..c6cdee4
--- /dev/null
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2004-2006 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// Samsung S3C2440 Mobile CPU support
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/gpio.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
+
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "gpio-samsung.h"
+
+#include "s3c24xx.h"
+
+static struct device s3c2440_dev = {
+       .bus            = &s3c2440_subsys,
+};
+
+int __init s3c2440_init(void)
+{
+       printk("S3C2440: Initialising architecture\n");
+
+       /* change irq for watchdog */
+
+       s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
+       s3c_device_wdt.resource[1].end   = IRQ_S3C2440_WDT;
+
+       /* register suspend/resume handlers */
+
+#ifdef CONFIG_PM_SLEEP
+       register_syscore_ops(&s3c2410_pm_syscore_ops);
+       register_syscore_ops(&s3c24xx_irq_syscore_ops);
+       register_syscore_ops(&s3c244x_pm_syscore_ops);
+#endif
+
+       /* register our system device for everything else */
+
+       return device_register(&s3c2440_dev);
+}
+
+void __init s3c2440_map_io(void)
+{
+       s3c244x_map_io();
+
+       s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
+       s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
+}
diff --git a/arch/arm/mach-s3c/s3c2442.c b/arch/arm/mach-s3c/s3c2442.c
new file mode 100644 (file)
index 0000000..0c0e30b
--- /dev/null
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2004-2005 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C2442 core and lock support
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/mutex.h>
+#include <linux/gpio.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <linux/atomic.h>
+#include <asm/irq.h>
+
+#include "regs-clock.h"
+
+#include "cpu.h"
+#include "pm.h"
+
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "gpio-samsung.h"
+
+#include "s3c24xx.h"
+
+static struct device s3c2442_dev = {
+       .bus            = &s3c2442_subsys,
+};
+
+int __init s3c2442_init(void)
+{
+       printk("S3C2442: Initialising architecture\n");
+
+#ifdef CONFIG_PM_SLEEP
+       register_syscore_ops(&s3c2410_pm_syscore_ops);
+       register_syscore_ops(&s3c24xx_irq_syscore_ops);
+       register_syscore_ops(&s3c244x_pm_syscore_ops);
+#endif
+
+       return device_register(&s3c2442_dev);
+}
+
+void __init s3c2442_map_io(void)
+{
+       s3c244x_map_io();
+
+       s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1down;
+       s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1down;
+}
diff --git a/arch/arm/mach-s3c/s3c2443.c b/arch/arm/mach-s3c/s3c2443.c
new file mode 100644 (file)
index 0000000..08f9101
--- /dev/null
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2007 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// Samsung S3C2443 Mobile CPU support
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/serial_core.h>
+#include <linux/device.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/reboot.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+#include "gpio-samsung.h"
+#include <mach/irqs.h>
+#include <asm/irq.h>
+#include <asm/system_misc.h>
+
+#include "regs-s3c2443-clock.h"
+#include "rtc-core-s3c24xx.h"
+
+#include "gpio-core.h"
+#include "gpio-cfg.h"
+#include "gpio-cfg-helpers.h"
+#include "devs.h"
+#include "cpu.h"
+#include "adc-core.h"
+
+#include "s3c24xx.h"
+#include "fb-core-s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "spi-core-s3c24xx.h"
+
+static struct map_desc s3c2443_iodesc[] __initdata __maybe_unused = {
+       IODESC_ENT(WATCHDOG),
+       IODESC_ENT(CLKPWR),
+       IODESC_ENT(TIMER),
+};
+
+struct bus_type s3c2443_subsys = {
+       .name = "s3c2443-core",
+       .dev_name = "s3c2443-core",
+};
+
+static struct device s3c2443_dev = {
+       .bus            = &s3c2443_subsys,
+};
+
+int __init s3c2443_init(void)
+{
+       printk("S3C2443: Initialising architecture\n");
+
+       s3c_nand_setname("s3c2412-nand");
+       s3c_fb_setname("s3c2443-fb");
+
+       s3c_adc_setname("s3c2443-adc");
+       s3c_rtc_setname("s3c2443-rtc");
+
+       /* change WDT IRQ number */
+       s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
+       s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
+
+       return device_register(&s3c2443_dev);
+}
+
+void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
+}
+
+/* s3c2443_map_io
+ *
+ * register the standard cpu IO areas, and any passed in from the
+ * machine specific initialisation.
+ */
+
+void __init s3c2443_map_io(void)
+{
+       s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull;
+       s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull;
+
+       /* initialize device information early */
+       s3c24xx_spi_setname("s3c2443-spi");
+
+       iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
+}
+
+/* need to register the subsystem before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2443 based system)
+ * as a driver which may support both 2443 and 2440 may try and use it.
+*/
+
+static int __init s3c2443_core_init(void)
+{
+       return subsys_system_register(&s3c2443_subsys, NULL);
+}
+
+core_initcall(s3c2443_core_init);
diff --git a/arch/arm/mach-s3c/s3c244x.c b/arch/arm/mach-s3c/s3c244x.c
new file mode 100644 (file)
index 0000000..95df349
--- /dev/null
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2004-2006 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443)
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/device.h>
+#include <linux/syscore_ops.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <asm/system_misc.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+#include <asm/irq.h>
+
+#include "regs-clock.h"
+#include "regs-gpio.h"
+
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
+
+#include "s3c24xx.h"
+#include "nand-core-s3c24xx.h"
+#include "regs-dsc-s3c24xx.h"
+
+static struct map_desc s3c244x_iodesc[] __initdata __maybe_unused = {
+       IODESC_ENT(CLKPWR),
+       IODESC_ENT(TIMER),
+       IODESC_ENT(WATCHDOG),
+};
+
+/* uart initialisation */
+
+void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
+}
+
+void __init s3c244x_map_io(void)
+{
+       /* register our io-tables */
+
+       iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
+
+       /* rename any peripherals used differing from the s3c2410 */
+
+       s3c_device_sdi.name  = "s3c2440-sdi";
+       s3c_device_i2c0.name  = "s3c2440-i2c";
+       s3c_nand_setname("s3c2440-nand");
+       s3c_device_ts.name = "s3c2440-ts";
+       s3c_device_usbgadget.name = "s3c2440-usbgadget";
+       s3c2410_device_dclk.name = "s3c2440-dclk";
+}
+
+/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
+
+struct bus_type s3c2440_subsys = {
+       .name           = "s3c2440-core",
+       .dev_name       = "s3c2440-core",
+};
+
+struct bus_type s3c2442_subsys = {
+       .name           = "s3c2442-core",
+       .dev_name       = "s3c2442-core",
+};
+
+/* need to register the subsystem before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2440 based system)
+ * as a driver which may support both 2410 and 2440 may try and use it.
+*/
+
+static int __init s3c2440_core_init(void)
+{
+       return subsys_system_register(&s3c2440_subsys, NULL);
+}
+
+core_initcall(s3c2440_core_init);
+
+static int __init s3c2442_core_init(void)
+{
+       return subsys_system_register(&s3c2442_subsys, NULL);
+}
+
+core_initcall(s3c2442_core_init);
+
+
+#ifdef CONFIG_PM_SLEEP
+static struct sleep_save s3c244x_sleep[] = {
+       SAVE_ITEM(S3C2440_DSC0),
+       SAVE_ITEM(S3C2440_DSC1),
+       SAVE_ITEM(S3C2440_GPJDAT),
+       SAVE_ITEM(S3C2440_GPJCON),
+       SAVE_ITEM(S3C2440_GPJUP)
+};
+
+static int s3c244x_suspend(void)
+{
+       s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
+       return 0;
+}
+
+static void s3c244x_resume(void)
+{
+       s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
+}
+
+struct syscore_ops s3c244x_pm_syscore_ops = {
+       .suspend        = s3c244x_suspend,
+       .resume         = s3c244x_resume,
+};
+#endif
diff --git a/arch/arm/mach-s3c/s3c24xx.c b/arch/arm/mach-s3c/s3c24xx.c
new file mode 100644 (file)
index 0000000..ccfed48
--- /dev/null
@@ -0,0 +1,680 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2004-2005 Simtec Electronics
+//     http://www.simtec.co.uk/products/SWLINUX/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Common code for S3C24XX machines
+
+#include <linux/dma-mapping.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <clocksource/samsung_pwm.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/platform_data/clk-s3c2410.h>
+#include <linux/platform_data/dma-s3c24xx.h>
+#include <linux/dmaengine.h>
+#include <linux/clk/samsung.h>
+
+#include "hardware-s3c24xx.h"
+#include "map.h"
+#include "regs-clock.h"
+#include <asm/irq.h>
+#include <asm/cacheflush.h>
+#include <asm/system_info.h>
+#include <asm/system_misc.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "regs-gpio.h"
+#include "dma-s3c24xx.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pwm-core.h"
+
+#include "s3c24xx.h"
+
+/* table of supported CPUs */
+
+static const char name_s3c2410[]  = "S3C2410";
+static const char name_s3c2412[]  = "S3C2412";
+static const char name_s3c2416[]  = "S3C2416/S3C2450";
+static const char name_s3c2440[]  = "S3C2440";
+static const char name_s3c2442[]  = "S3C2442";
+static const char name_s3c2442b[]  = "S3C2442B";
+static const char name_s3c2443[]  = "S3C2443";
+static const char name_s3c2410a[] = "S3C2410A";
+static const char name_s3c2440a[] = "S3C2440A";
+
+static struct cpu_table cpu_ids[] __initdata = {
+       {
+               .idcode         = 0x32410000,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2410_map_io,
+               .init_uarts     = s3c2410_init_uarts,
+               .init           = s3c2410_init,
+               .name           = name_s3c2410
+       },
+       {
+               .idcode         = 0x32410002,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2410_map_io,
+               .init_uarts     = s3c2410_init_uarts,
+               .init           = s3c2410a_init,
+               .name           = name_s3c2410a
+       },
+       {
+               .idcode         = 0x32440000,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2440_map_io,
+               .init_uarts     = s3c244x_init_uarts,
+               .init           = s3c2440_init,
+               .name           = name_s3c2440
+       },
+       {
+               .idcode         = 0x32440001,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2440_map_io,
+               .init_uarts     = s3c244x_init_uarts,
+               .init           = s3c2440_init,
+               .name           = name_s3c2440a
+       },
+       {
+               .idcode         = 0x32440aaa,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2442_map_io,
+               .init_uarts     = s3c244x_init_uarts,
+               .init           = s3c2442_init,
+               .name           = name_s3c2442
+       },
+       {
+               .idcode         = 0x32440aab,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2442_map_io,
+               .init_uarts     = s3c244x_init_uarts,
+               .init           = s3c2442_init,
+               .name           = name_s3c2442b
+       },
+       {
+               .idcode         = 0x32412001,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2412_map_io,
+               .init_uarts     = s3c2412_init_uarts,
+               .init           = s3c2412_init,
+               .name           = name_s3c2412,
+       },
+       {                       /* a newer version of the s3c2412 */
+               .idcode         = 0x32412003,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2412_map_io,
+               .init_uarts     = s3c2412_init_uarts,
+               .init           = s3c2412_init,
+               .name           = name_s3c2412,
+       },
+       {                       /* a strange version of the s3c2416 */
+               .idcode         = 0x32450003,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2416_map_io,
+               .init_uarts     = s3c2416_init_uarts,
+               .init           = s3c2416_init,
+               .name           = name_s3c2416,
+       },
+       {
+               .idcode         = 0x32443001,
+               .idmask         = 0xffffffff,
+               .map_io         = s3c2443_map_io,
+               .init_uarts     = s3c2443_init_uarts,
+               .init           = s3c2443_init,
+               .name           = name_s3c2443,
+       },
+};
+
+/* minimal IO mapping */
+
+static struct map_desc s3c_iodesc[] __initdata __maybe_unused = {
+       IODESC_ENT(GPIO),
+       IODESC_ENT(IRQ),
+       IODESC_ENT(MEMCTRL),
+       IODESC_ENT(UART)
+};
+
+/* read cpu identificaiton code */
+
+static unsigned long s3c24xx_read_idcode_v5(void)
+{
+#if defined(CONFIG_CPU_S3C2416)
+       /* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */
+
+       u32 gs = __raw_readl(S3C24XX_GSTATUS1);
+
+       /* test for s3c2416 or similar device */
+       if ((gs >> 16) == 0x3245)
+               return gs;
+#endif
+
+#if defined(CONFIG_CPU_S3C2412)
+       return __raw_readl(S3C2412_GSTATUS1);
+#else
+       return 1UL;     /* don't look like an 2400 */
+#endif
+}
+
+static unsigned long s3c24xx_read_idcode_v4(void)
+{
+       return __raw_readl(S3C2410_GSTATUS1);
+}
+
+static void s3c24xx_default_idle(void)
+{
+       unsigned long tmp = 0;
+       int i;
+
+       /* idle the system by using the idle mode which will wait for an
+        * interrupt to happen before restarting the system.
+        */
+
+       /* Warning: going into idle state upsets jtag scanning */
+
+       __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
+                    S3C2410_CLKCON);
+
+       /* the samsung port seems to do a loop and then unset idle.. */
+       for (i = 0; i < 50; i++)
+               tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
+
+       /* this bit is not cleared on re-start... */
+
+       __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
+                    S3C2410_CLKCON);
+}
+
+static struct samsung_pwm_variant s3c24xx_pwm_variant = {
+       .bits           = 16,
+       .div_base       = 1,
+       .has_tint_cstat = false,
+       .tclk_mask      = (1 << 4),
+};
+
+void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
+{
+       arm_pm_idle = s3c24xx_default_idle;
+
+       /* initialise the io descriptors we need for initialisation */
+       iotable_init(mach_desc, size);
+       iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
+
+       if (cpu_architecture() >= CPU_ARCH_ARMv5) {
+               samsung_cpu_id = s3c24xx_read_idcode_v5();
+       } else {
+               samsung_cpu_id = s3c24xx_read_idcode_v4();
+       }
+
+       s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+       samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
+}
+
+void __init s3c24xx_set_timer_source(unsigned int event, unsigned int source)
+{
+       s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
+       s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
+}
+
+void __init s3c24xx_timer_init(void)
+{
+       unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
+               IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
+       };
+
+       samsung_pwm_clocksource_init(S3C_VA_TIMER,
+                                       timer_irqs, &s3c24xx_pwm_variant);
+}
+
+/* Serial port registrations */
+
+#define S3C2410_PA_UART0      (S3C24XX_PA_UART)
+#define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
+#define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
+#define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )
+
+static struct resource s3c2410_uart0_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
+       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
+                       IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
+                       NULL, IORESOURCE_IRQ)
+};
+
+static struct resource s3c2410_uart1_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
+       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
+                       IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
+                       NULL, IORESOURCE_IRQ)
+};
+
+static struct resource s3c2410_uart2_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
+       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
+                       IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
+                       NULL, IORESOURCE_IRQ)
+};
+
+static struct resource s3c2410_uart3_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
+       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
+                       IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
+                       NULL, IORESOURCE_IRQ)
+};
+
+struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
+       [0] = {
+               .resources      = s3c2410_uart0_resource,
+               .nr_resources   = ARRAY_SIZE(s3c2410_uart0_resource),
+       },
+       [1] = {
+               .resources      = s3c2410_uart1_resource,
+               .nr_resources   = ARRAY_SIZE(s3c2410_uart1_resource),
+       },
+       [2] = {
+               .resources      = s3c2410_uart2_resource,
+               .nr_resources   = ARRAY_SIZE(s3c2410_uart2_resource),
+       },
+       [3] = {
+               .resources      = s3c2410_uart3_resource,
+               .nr_resources   = ARRAY_SIZE(s3c2410_uart3_resource),
+       },
+};
+
+#define s3c24xx_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
+       defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
+static struct resource s3c2410_dma_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
+       [1] = DEFINE_RES_IRQ(IRQ_DMA0),
+       [2] = DEFINE_RES_IRQ(IRQ_DMA1),
+       [3] = DEFINE_RES_IRQ(IRQ_DMA2),
+       [4] = DEFINE_RES_IRQ(IRQ_DMA3),
+};
+#endif
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
+static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
+                                               S3C24XX_DMA_CHANREQ(2, 2) |
+                                               S3C24XX_DMA_CHANREQ(1, 3),
+       },
+       [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
+       [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
+                                                S3C24XX_DMA_CHANREQ(3, 2) |
+                                                S3C24XX_DMA_CHANREQ(3, 3),
+       },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
+                                                 S3C24XX_DMA_CHANREQ(1, 2),
+       },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
+       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
+       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
+       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
+       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
+};
+
+static const struct dma_slave_map s3c2410_dma_slave_map[] = {
+       { "s3c2410-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0_RX },
+       { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0_TX },
+       { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1_RX },
+       { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1_TX },
+       /*
+        * The DMA request source[1] (DMACH_UARTx_SRC2) are
+        * not used in the UART driver.
+        */
+       { "s3c2410-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2410-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2410-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2410-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2410-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2410-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
+       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
+       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
+};
+
+static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
+       .num_phy_channels = 4,
+       .channels = s3c2410_dma_channels,
+       .num_channels = DMACH_MAX,
+       .slave_map = s3c2410_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2410_dma_slave_map),
+};
+
+struct platform_device s3c2410_device_dma = {
+       .name           = "s3c2410-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
+       .resource       = s3c2410_dma_resource,
+       .dev    = {
+               .dma_mask = &s3c24xx_device_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+               .platform_data = &s3c2410_dma_platdata,
+       },
+};
+#endif
+
+#ifdef CONFIG_CPU_S3C2412
+static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
+       [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
+       [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
+       [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
+       [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
+       [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
+       [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
+       [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
+       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
+       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
+       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
+       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
+};
+
+static const struct dma_slave_map s3c2412_dma_slave_map[] = {
+       { "s3c2412-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2412-spi.0", "rx", (void *)DMACH_SPI0_RX },
+       { "s3c2412-spi.0", "tx", (void *)DMACH_SPI0_TX },
+       { "s3c2412-spi.1", "rx", (void *)DMACH_SPI1_RX },
+       { "s3c2412-spi.1", "tx", (void *)DMACH_SPI1_TX },
+       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c2412-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c2412-iis", "tx", (void *)DMACH_I2S_OUT },
+       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
+       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
+};
+
+static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
+       .num_phy_channels = 4,
+       .channels = s3c2412_dma_channels,
+       .num_channels = DMACH_MAX,
+       .slave_map = s3c2412_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2412_dma_slave_map),
+};
+
+struct platform_device s3c2412_device_dma = {
+       .name           = "s3c2412-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
+       .resource       = s3c2410_dma_resource,
+       .dev    = {
+               .dma_mask = &s3c24xx_device_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+               .platform_data = &s3c2412_dma_platdata,
+       },
+};
+#endif
+
+#if defined(CONFIG_CPU_S3C2440)
+static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
+                                               S3C24XX_DMA_CHANREQ(6, 1) |
+                                               S3C24XX_DMA_CHANREQ(2, 2) |
+                                               S3C24XX_DMA_CHANREQ(1, 3),
+       },
+       [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
+       [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
+                                                S3C24XX_DMA_CHANREQ(3, 2) |
+                                                S3C24XX_DMA_CHANREQ(3, 3),
+       },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
+                                                 S3C24XX_DMA_CHANREQ(1, 2),
+       },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
+                                                  S3C24XX_DMA_CHANREQ(0, 2),
+       },
+       [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
+                                                 S3C24XX_DMA_CHANREQ(5, 2),
+       },
+       [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
+                                                 S3C24XX_DMA_CHANREQ(6, 3),
+       },
+       [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
+                                                 S3C24XX_DMA_CHANREQ(5, 3),
+       },
+       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
+       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
+       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
+       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
+};
+
+static const struct dma_slave_map s3c2440_dma_slave_map[] = {
+       /* TODO: DMACH_XD0 */
+       /* TODO: DMACH_XD1 */
+       { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0 },
+       { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0 },
+       { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1 },
+       { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1 },
+       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
+       { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
+       /* TODO: DMACH_TIMER */
+       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
+       { "samsung-ac97", "rx", (void *)DMACH_PCM_IN },
+       { "samsung-ac97", "tx", (void *)DMACH_PCM_OUT },
+       { "samsung-ac97", "rx", (void *)DMACH_MIC_IN },
+       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
+       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
+};
+
+static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
+       .num_phy_channels = 4,
+       .channels = s3c2440_dma_channels,
+       .num_channels = DMACH_MAX,
+       .slave_map = s3c2440_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2440_dma_slave_map),
+};
+
+struct platform_device s3c2440_device_dma = {
+       .name           = "s3c2410-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
+       .resource       = s3c2410_dma_resource,
+       .dev    = {
+               .dma_mask = &s3c24xx_device_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+               .platform_data = &s3c2440_dma_platdata,
+       },
+};
+#endif
+
+#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
+static struct resource s3c2443_dma_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
+       [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
+       [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
+       [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
+       [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
+       [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
+       [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
+};
+
+static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
+       [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
+       [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
+       [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
+       [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
+       [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
+       [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
+       [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
+       [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
+       [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
+       [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
+       [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
+       [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
+};
+
+static const struct dma_slave_map s3c2443_dma_slave_map[] = {
+       { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2443-spi.0", "rx", (void *)DMACH_SPI0_RX },
+       { "s3c2443-spi.0", "tx", (void *)DMACH_SPI0_TX },
+       { "s3c2443-spi.1", "rx", (void *)DMACH_SPI1_RX },
+       { "s3c2443-spi.1", "tx", (void *)DMACH_SPI1_TX },
+       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
+       { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
+       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
+};
+
+static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
+       .num_phy_channels = 6,
+       .channels = s3c2443_dma_channels,
+       .num_channels = DMACH_MAX,
+       .slave_map = s3c2443_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2443_dma_slave_map),
+};
+
+struct platform_device s3c2443_device_dma = {
+       .name           = "s3c2443-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2443_dma_resource),
+       .resource       = s3c2443_dma_resource,
+       .dev    = {
+               .dma_mask = &s3c24xx_device_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+               .platform_data = &s3c2443_dma_platdata,
+       },
+};
+#endif
+
+#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
+void __init s3c2410_init_clocks(int xtal)
+{
+       s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2412
+void __init s3c2412_init_clocks(int xtal)
+{
+       s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2416
+void __init s3c2416_init_clocks(int xtal)
+{
+       s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
+}
+#endif
+
+#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
+void __init s3c2440_init_clocks(int xtal)
+{
+       s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
+}
+#endif
+
+#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
+void __init s3c2442_init_clocks(int xtal)
+{
+       s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
+}
+#endif
+
+#ifdef CONFIG_CPU_S3C2443
+void __init s3c2443_init_clocks(int xtal)
+{
+       s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
+}
+#endif
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
+       defined(CONFIG_CPU_S3C2442)
+static struct resource s3c2410_dclk_resource[] = {
+       [0] = DEFINE_RES_MEM(0x56000084, 0x4),
+};
+
+static struct s3c2410_clk_platform_data s3c_clk_platform_data = {
+       .modify_misccr = s3c2410_modify_misccr,
+};
+
+struct platform_device s3c2410_device_dclk = {
+       .name           = "s3c2410-dclk",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dclk_resource),
+       .resource       = s3c2410_dclk_resource,
+       .dev            = {
+               .platform_data = &s3c_clk_platform_data,
+       },
+};
+#endif
diff --git a/arch/arm/mach-s3c/s3c24xx.h b/arch/arm/mach-s3c/s3c24xx.h
new file mode 100644 (file)
index 0000000..5848bef
--- /dev/null
@@ -0,0 +1,124 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * Common Header for S3C24XX SoCs
+ */
+
+#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H
+#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__
+
+#include <linux/reboot.h>
+#include <mach/irqs.h>
+
+struct s3c2410_uartcfg;
+
+#ifdef CONFIG_CPU_S3C2410
+extern  int s3c2410_init(void);
+extern  int s3c2410a_init(void);
+extern void s3c2410_map_io(void);
+extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+extern void s3c2410_init_clocks(int xtal);
+extern void s3c2410_init_irq(void);
+#else
+#define s3c2410_init_clocks NULL
+#define s3c2410_init_uarts NULL
+#define s3c2410_map_io NULL
+#define s3c2410_init NULL
+#define s3c2410a_init NULL
+#endif
+
+#ifdef CONFIG_CPU_S3C2412
+extern  int s3c2412_init(void);
+extern void s3c2412_map_io(void);
+extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+extern void s3c2412_init_clocks(int xtal);
+extern  int s3c2412_baseclk_add(void);
+extern void s3c2412_init_irq(void);
+#else
+#define s3c2412_init_clocks NULL
+#define s3c2412_init_uarts NULL
+#define s3c2412_map_io NULL
+#define s3c2412_init NULL
+#endif
+
+#ifdef CONFIG_CPU_S3C2416
+extern  int s3c2416_init(void);
+extern void s3c2416_map_io(void);
+extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+extern void s3c2416_init_clocks(int xtal);
+extern  int s3c2416_baseclk_add(void);
+extern void s3c2416_init_irq(void);
+
+extern struct syscore_ops s3c2416_irq_syscore_ops;
+#else
+#define s3c2416_init_clocks NULL
+#define s3c2416_init_uarts NULL
+#define s3c2416_map_io NULL
+#define s3c2416_init NULL
+#endif
+
+#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
+extern void s3c244x_map_io(void);
+extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+#else
+#define s3c244x_init_uarts NULL
+#endif
+
+#ifdef CONFIG_CPU_S3C2440
+extern  int s3c2440_init(void);
+extern void s3c2440_map_io(void);
+extern void s3c2440_init_clocks(int xtal);
+extern void s3c2440_init_irq(void);
+#else
+#define s3c2440_init NULL
+#define s3c2440_map_io NULL
+#endif
+
+#ifdef CONFIG_CPU_S3C2442
+extern  int s3c2442_init(void);
+extern void s3c2442_map_io(void);
+extern void s3c2442_init_clocks(int xtal);
+extern void s3c2442_init_irq(void);
+#else
+#define s3c2442_init NULL
+#define s3c2442_map_io NULL
+#endif
+
+#ifdef CONFIG_CPU_S3C2443
+extern  int s3c2443_init(void);
+extern void s3c2443_map_io(void);
+extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
+extern void s3c2443_init_clocks(int xtal);
+extern  int s3c2443_baseclk_add(void);
+extern void s3c2443_init_irq(void);
+#else
+#define s3c2443_init_clocks NULL
+#define s3c2443_init_uarts NULL
+#define s3c2443_map_io NULL
+#define s3c2443_init NULL
+#endif
+
+extern struct syscore_ops s3c24xx_irq_syscore_ops;
+
+extern struct platform_device s3c2410_device_dma;
+extern struct platform_device s3c2412_device_dma;
+extern struct platform_device s3c2440_device_dma;
+extern struct platform_device s3c2443_device_dma;
+
+extern struct platform_device s3c2410_device_dclk;
+
+enum s3c24xx_timer_mode {
+       S3C24XX_PWM0,
+       S3C24XX_PWM1,
+       S3C24XX_PWM2,
+       S3C24XX_PWM3,
+       S3C24XX_PWM4,
+};
+
+extern void __init s3c24xx_set_timer_source(enum s3c24xx_timer_mode event,
+                                           enum s3c24xx_timer_mode source);
+extern void __init s3c24xx_timer_init(void);
+
+#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
diff --git a/arch/arm/mach-s3c/s3c6400.c b/arch/arm/mach-s3c/s3c6400.c
new file mode 100644 (file)
index 0000000..802f4fb
--- /dev/null
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2009 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+
+#include "regs-clock.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "sdhci.h"
+#include "iic-core.h"
+
+#include "s3c64xx.h"
+#include "onenand-core-s3c64xx.h"
+
+void __init s3c6400_map_io(void)
+{
+       /* setup SDHCI */
+
+       s3c6400_default_sdhci0();
+       s3c6400_default_sdhci1();
+       s3c6400_default_sdhci2();
+
+       /* the i2c devices are directly compatible with s3c2440 */
+       s3c_i2c0_setname("s3c2440-i2c");
+
+       s3c_device_nand.name = "s3c6400-nand";
+
+       s3c_onenand_setname("s3c6400-onenand");
+       s3c64xx_onenand1_setname("s3c6400-onenand");
+}
+
+void __init s3c6400_init_irq(void)
+{
+       /* VIC0 does not have IRQS 5..7,
+        * VIC1 is fully populated. */
+       s3c64xx_init_irq(~0 & ~(0xf << 5), ~0);
+}
+
+static struct bus_type s3c6400_subsys = {
+       .name           = "s3c6400-core",
+       .dev_name       = "s3c6400-core",
+};
+
+static struct device s3c6400_dev = {
+       .bus    = &s3c6400_subsys,
+};
+
+static int __init s3c6400_core_init(void)
+{
+       /* Not applicable when using DT. */
+       if (of_have_populated_dt() || soc_is_s3c64xx())
+               return 0;
+
+       return subsys_system_register(&s3c6400_subsys, NULL);
+}
+
+core_initcall(s3c6400_core_init);
+
+int __init s3c6400_init(void)
+{
+       printk("S3C6400: Initialising architecture\n");
+
+       return device_register(&s3c6400_dev);
+}
diff --git a/arch/arm/mach-s3c/s3c6410.c b/arch/arm/mach-s3c/s3c6410.c
new file mode 100644 (file)
index 0000000..dae17d5
--- /dev/null
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Simtec Electronics
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/device.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+
+#include <linux/soc/samsung/s3c-pm.h>
+#include "regs-clock.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "sdhci.h"
+#include "adc-core.h"
+#include "iic-core.h"
+
+#include "ata-core-s3c64xx.h"
+#include "s3c64xx.h"
+#include "onenand-core-s3c64xx.h"
+
+void __init s3c6410_map_io(void)
+{
+       /* initialise device information early */
+       s3c6410_default_sdhci0();
+       s3c6410_default_sdhci1();
+       s3c6410_default_sdhci2();
+
+       /* the i2c devices are directly compatible with s3c2440 */
+       s3c_i2c0_setname("s3c2440-i2c");
+       s3c_i2c1_setname("s3c2440-i2c");
+
+       s3c_adc_setname("s3c64xx-adc");
+       s3c_device_nand.name = "s3c6400-nand";
+       s3c_onenand_setname("s3c6410-onenand");
+       s3c64xx_onenand1_setname("s3c6410-onenand");
+       s3c_cfcon_setname("s3c64xx-pata");
+}
+
+void __init s3c6410_init_irq(void)
+{
+       /* VIC0 is missing IRQ7, VIC1 is fully populated. */
+       s3c64xx_init_irq(~0 & ~(1 << 7), ~0);
+}
+
+struct bus_type s3c6410_subsys = {
+       .name           = "s3c6410-core",
+       .dev_name       = "s3c6410-core",
+};
+
+static struct device s3c6410_dev = {
+       .bus    = &s3c6410_subsys,
+};
+
+static int __init s3c6410_core_init(void)
+{
+       /* Not applicable when using DT. */
+       if (of_have_populated_dt() || !soc_is_s3c64xx())
+               return 0;
+
+       return subsys_system_register(&s3c6410_subsys, NULL);
+}
+
+core_initcall(s3c6410_core_init);
+
+int __init s3c6410_init(void)
+{
+       printk("S3C6410: Initialising architecture\n");
+
+       return device_register(&s3c6410_dev);
+}
diff --git a/arch/arm/mach-s3c/s3c64xx.c b/arch/arm/mach-s3c/s3c64xx.c
new file mode 100644 (file)
index 0000000..4dfb648
--- /dev/null
@@ -0,0 +1,427 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2011 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Common Codes for S3C64XX machines
+
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/io.h>
+#include <linux/clk/samsung.h>
+#include <linux/dma-mapping.h>
+#include <linux/irq.h>
+#include <linux/gpio.h>
+#include <linux/irqchip/arm-vic.h>
+#include <clocksource/samsung_pwm.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/system_misc.h>
+
+#include "map.h"
+#include <mach/irqs.h>
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+#include "cpu.h"
+#include "devs.h"
+#include "pm.h"
+#include "gpio-cfg.h"
+#include "pwm-core.h"
+#include "regs-irqtype.h"
+#include "s3c64xx.h"
+#include "irq-uart-s3c64xx.h"
+
+/* External clock frequency */
+static unsigned long xtal_f __ro_after_init = 12000000;
+static unsigned long xusbxti_f __ro_after_init = 48000000;
+
+void __init s3c64xx_set_xtal_freq(unsigned long freq)
+{
+       xtal_f = freq;
+}
+
+void __init s3c64xx_set_xusbxti_freq(unsigned long freq)
+{
+       xusbxti_f = freq;
+}
+
+/* uart registration process */
+
+static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
+}
+
+/* table of supported CPUs */
+
+static const char name_s3c6400[] = "S3C6400";
+static const char name_s3c6410[] = "S3C6410";
+
+static struct cpu_table cpu_ids[] __initdata = {
+       {
+               .idcode         = S3C6400_CPU_ID,
+               .idmask         = S3C64XX_CPU_MASK,
+               .map_io         = s3c6400_map_io,
+               .init_uarts     = s3c64xx_init_uarts,
+               .init           = s3c6400_init,
+               .name           = name_s3c6400,
+       }, {
+               .idcode         = S3C6410_CPU_ID,
+               .idmask         = S3C64XX_CPU_MASK,
+               .map_io         = s3c6410_map_io,
+               .init_uarts     = s3c64xx_init_uarts,
+               .init           = s3c6410_init,
+               .name           = name_s3c6410,
+       },
+};
+
+/* minimal IO mapping */
+
+/*
+ * note, for the boot process to work we have to keep the UART
+ * virtual address aligned to an 1MiB boundary for the L1
+ * mapping the head code makes. We keep the UART virtual address
+ * aligned and add in the offset when we load the value here.
+ */
+#define UART_OFFS (S3C_PA_UART & 0xfffff)
+
+static struct map_desc s3c_iodesc[] __initdata = {
+       {
+               .virtual        = (unsigned long)S3C_VA_SYS,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_SYSCON),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S3C_VA_MEM,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_SROM),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)(S3C_VA_UART + UART_OFFS),
+               .pfn            = __phys_to_pfn(S3C_PA_UART),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)VA_VIC0,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_VIC0),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)VA_VIC1,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_VIC1),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S3C_VA_TIMER,
+               .pfn            = __phys_to_pfn(S3C_PA_TIMER),
+               .length         = SZ_16K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S3C64XX_VA_GPIO,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_GPIO),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S3C64XX_VA_MODEM,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_MODEM),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S3C_VA_WATCHDOG,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_WATCHDOG),
+               .length         = SZ_4K,
+               .type           = MT_DEVICE,
+       }, {
+               .virtual        = (unsigned long)S3C_VA_USB_HSPHY,
+               .pfn            = __phys_to_pfn(S3C64XX_PA_USB_HSPHY),
+               .length         = SZ_1K,
+               .type           = MT_DEVICE,
+       },
+};
+
+static struct bus_type s3c64xx_subsys = {
+       .name           = "s3c64xx-core",
+       .dev_name       = "s3c64xx-core",
+};
+
+static struct device s3c64xx_dev = {
+       .bus    = &s3c64xx_subsys,
+};
+
+static struct samsung_pwm_variant s3c64xx_pwm_variant = {
+       .bits           = 32,
+       .div_base       = 0,
+       .has_tint_cstat = true,
+       .tclk_mask      = (1 << 7) | (1 << 6) | (1 << 5),
+};
+
+void __init s3c64xx_set_timer_source(unsigned int event, unsigned int source)
+{
+       s3c64xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
+       s3c64xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
+}
+
+void __init s3c64xx_timer_init(void)
+{
+       unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
+               IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+               IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
+       };
+
+       samsung_pwm_clocksource_init(S3C_VA_TIMER,
+                                       timer_irqs, &s3c64xx_pwm_variant);
+}
+
+/* read cpu identification code */
+
+void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
+{
+       /* initialise the io descriptors we need for initialisation */
+       iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
+       iotable_init(mach_desc, size);
+
+       /* detect cpu id */
+       s3c64xx_init_cpu();
+
+       s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+       samsung_pwm_set_platdata(&s3c64xx_pwm_variant);
+}
+
+static __init int s3c64xx_dev_init(void)
+{
+       /* Not applicable when using DT. */
+       if (of_have_populated_dt() || !soc_is_s3c64xx())
+               return 0;
+
+       subsys_system_register(&s3c64xx_subsys, NULL);
+       return device_register(&s3c64xx_dev);
+}
+core_initcall(s3c64xx_dev_init);
+
+/*
+ * setup the sources the vic should advertise resume
+ * for, even though it is not doing the wake
+ * (set_irq_wake needs to be valid)
+ */
+#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE))
+#define IRQ_VIC1_RESUME (1 << (IRQ_RTC_ALARM - IRQ_VIC1_BASE) |        \
+                        1 << (IRQ_PENDN - IRQ_VIC1_BASE) |     \
+                        1 << (IRQ_HSMMC0 - IRQ_VIC1_BASE) |    \
+                        1 << (IRQ_HSMMC1 - IRQ_VIC1_BASE) |    \
+                        1 << (IRQ_HSMMC2 - IRQ_VIC1_BASE))
+
+void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
+{
+       s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
+
+       printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
+
+       /* initialise the pair of VICs */
+       vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
+       vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
+}
+
+#define eint_offset(irq)       ((irq) - IRQ_EINT(0))
+#define eint_irq_to_bit(irq)   ((u32)(1 << eint_offset(irq)))
+
+static inline void s3c_irq_eint_mask(struct irq_data *data)
+{
+       u32 mask;
+
+       mask = __raw_readl(S3C64XX_EINT0MASK);
+       mask |= (u32)data->chip_data;
+       __raw_writel(mask, S3C64XX_EINT0MASK);
+}
+
+static void s3c_irq_eint_unmask(struct irq_data *data)
+{
+       u32 mask;
+
+       mask = __raw_readl(S3C64XX_EINT0MASK);
+       mask &= ~((u32)data->chip_data);
+       __raw_writel(mask, S3C64XX_EINT0MASK);
+}
+
+static inline void s3c_irq_eint_ack(struct irq_data *data)
+{
+       __raw_writel((u32)data->chip_data, S3C64XX_EINT0PEND);
+}
+
+static void s3c_irq_eint_maskack(struct irq_data *data)
+{
+       /* compiler should in-line these */
+       s3c_irq_eint_mask(data);
+       s3c_irq_eint_ack(data);
+}
+
+static int s3c_irq_eint_set_type(struct irq_data *data, unsigned int type)
+{
+       int offs = eint_offset(data->irq);
+       int pin, pin_val;
+       int shift;
+       u32 ctrl, mask;
+       u32 newvalue = 0;
+       void __iomem *reg;
+
+       if (offs > 27)
+               return -EINVAL;
+
+       if (offs <= 15)
+               reg = S3C64XX_EINT0CON0;
+       else
+               reg = S3C64XX_EINT0CON1;
+
+       switch (type) {
+       case IRQ_TYPE_NONE:
+               printk(KERN_WARNING "No edge setting!\n");
+               break;
+
+       case IRQ_TYPE_EDGE_RISING:
+               newvalue = S3C2410_EXTINT_RISEEDGE;
+               break;
+
+       case IRQ_TYPE_EDGE_FALLING:
+               newvalue = S3C2410_EXTINT_FALLEDGE;
+               break;
+
+       case IRQ_TYPE_EDGE_BOTH:
+               newvalue = S3C2410_EXTINT_BOTHEDGE;
+               break;
+
+       case IRQ_TYPE_LEVEL_LOW:
+               newvalue = S3C2410_EXTINT_LOWLEV;
+               break;
+
+       case IRQ_TYPE_LEVEL_HIGH:
+               newvalue = S3C2410_EXTINT_HILEV;
+               break;
+
+       default:
+               printk(KERN_ERR "No such irq type %d", type);
+               return -1;
+       }
+
+       if (offs <= 15)
+               shift = (offs / 2) * 4;
+       else
+               shift = ((offs - 16) / 2) * 4;
+       mask = 0x7 << shift;
+
+       ctrl = __raw_readl(reg);
+       ctrl &= ~mask;
+       ctrl |= newvalue << shift;
+       __raw_writel(ctrl, reg);
+
+       /* set the GPIO pin appropriately */
+
+       if (offs < 16) {
+               pin = S3C64XX_GPN(offs);
+               pin_val = S3C_GPIO_SFN(2);
+       } else if (offs < 23) {
+               pin = S3C64XX_GPL(offs + 8 - 16);
+               pin_val = S3C_GPIO_SFN(3);
+       } else {
+               pin = S3C64XX_GPM(offs - 23);
+               pin_val = S3C_GPIO_SFN(3);
+       }
+
+       s3c_gpio_cfgpin(pin, pin_val);
+
+       return 0;
+}
+
+static struct irq_chip s3c_irq_eint = {
+       .name           = "s3c-eint",
+       .irq_mask       = s3c_irq_eint_mask,
+       .irq_unmask     = s3c_irq_eint_unmask,
+       .irq_mask_ack   = s3c_irq_eint_maskack,
+       .irq_ack        = s3c_irq_eint_ack,
+       .irq_set_type   = s3c_irq_eint_set_type,
+       .irq_set_wake   = s3c_irqext_wake,
+};
+
+/* s3c_irq_demux_eint
+ *
+ * This function demuxes the IRQ from the group0 external interrupts,
+ * from IRQ_EINT(0) to IRQ_EINT(27). It is designed to be inlined into
+ * the specific handlers s3c_irq_demux_eintX_Y.
+ */
+static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end)
+{
+       u32 status = __raw_readl(S3C64XX_EINT0PEND);
+       u32 mask = __raw_readl(S3C64XX_EINT0MASK);
+       unsigned int irq;
+
+       status &= ~mask;
+       status >>= start;
+       status &= (1 << (end - start + 1)) - 1;
+
+       for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
+               if (status & 1)
+                       generic_handle_irq(irq);
+
+               status >>= 1;
+       }
+}
+
+static void s3c_irq_demux_eint0_3(struct irq_desc *desc)
+{
+       s3c_irq_demux_eint(0, 3);
+}
+
+static void s3c_irq_demux_eint4_11(struct irq_desc *desc)
+{
+       s3c_irq_demux_eint(4, 11);
+}
+
+static void s3c_irq_demux_eint12_19(struct irq_desc *desc)
+{
+       s3c_irq_demux_eint(12, 19);
+}
+
+static void s3c_irq_demux_eint20_27(struct irq_desc *desc)
+{
+       s3c_irq_demux_eint(20, 27);
+}
+
+static int __init s3c64xx_init_irq_eint(void)
+{
+       int irq;
+
+       /* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
+       if (of_have_populated_dt() || !soc_is_s3c64xx())
+               return -ENODEV;
+
+       for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
+               irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq);
+               irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq));
+               irq_clear_status_flags(irq, IRQ_NOREQUEST);
+       }
+
+       irq_set_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3);
+       irq_set_chained_handler(IRQ_EINT4_11, s3c_irq_demux_eint4_11);
+       irq_set_chained_handler(IRQ_EINT12_19, s3c_irq_demux_eint12_19);
+       irq_set_chained_handler(IRQ_EINT20_27, s3c_irq_demux_eint20_27);
+
+       return 0;
+}
+arch_initcall(s3c64xx_init_irq_eint);
diff --git a/arch/arm/mach-s3c/s3c64xx.h b/arch/arm/mach-s3c/s3c64xx.h
new file mode 100644 (file)
index 0000000..92258e4
--- /dev/null
@@ -0,0 +1,66 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * Common Header for S3C64XX machines
+ */
+
+#ifndef __ARCH_ARM_MACH_S3C64XX_COMMON_H
+#define __ARCH_ARM_MACH_S3C64XX_COMMON_H
+
+#include <linux/reboot.h>
+
+void s3c64xx_init_irq(u32 vic0, u32 vic1);
+void s3c64xx_init_io(struct map_desc *mach_desc, int size);
+
+struct device_node;
+void s3c64xx_set_xtal_freq(unsigned long freq);
+void s3c64xx_set_xusbxti_freq(unsigned long freq);
+
+#ifdef CONFIG_CPU_S3C6400
+
+extern  int s3c6400_init(void);
+extern void s3c6400_init_irq(void);
+extern void s3c6400_map_io(void);
+
+#else
+#define s3c6400_map_io NULL
+#define s3c6400_init NULL
+#endif
+
+#ifdef CONFIG_CPU_S3C6410
+
+extern  int s3c6410_init(void);
+extern void s3c6410_init_irq(void);
+extern void s3c6410_map_io(void);
+
+#else
+#define s3c6410_map_io NULL
+#define s3c6410_init NULL
+#endif
+
+#ifdef CONFIG_S3C64XX_PL080
+extern struct pl08x_platform_data s3c64xx_dma0_plat_data;
+extern struct pl08x_platform_data s3c64xx_dma1_plat_data;
+#endif
+
+/* Samsung HR-Timer Clock mode */
+enum s3c64xx_timer_mode {
+       S3C64XX_PWM0,
+       S3C64XX_PWM1,
+       S3C64XX_PWM2,
+       S3C64XX_PWM3,
+       S3C64XX_PWM4,
+};
+
+extern void __init s3c64xx_set_timer_source(enum s3c64xx_timer_mode event,
+                                           enum s3c64xx_timer_mode source);
+extern void __init s3c64xx_timer_init(void);
+
+#endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */
diff --git a/arch/arm/mach-s3c/sdhci.h b/arch/arm/mach-s3c/sdhci.h
new file mode 100644 (file)
index 0000000..9f9d419
--- /dev/null
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C Platform - SDHCI (HSMMC) platform data definitions
+ */
+
+#ifndef __PLAT_S3C_SDHCI_H
+#define __PLAT_S3C_SDHCI_H __FILE__
+
+#include <linux/platform_data/mmc-sdhci-s3c.h>
+#include "devs.h"
+
+/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
+ * @pd: The default platform data for this device.
+ * @set: Pointer to the platform data to fill in.
+ */
+extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
+                                   struct s3c_sdhci_platdata *set);
+
+/**
+ * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
+ * @pd: Platform data to register to device.
+ *
+ * Register the given platform data for use withe S3C SDHCI device.
+ * The call will copy the platform data, so the board definitions can
+ * make the structure itself __initdata.
+ */
+extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
+extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
+extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
+extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
+
+/* Default platform data, exported so that per-cpu initialisation can
+ * set the correct one when there are more than one cpu type selected.
+*/
+
+extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
+extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
+extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
+extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
+
+/* Helper function availability */
+
+extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
+extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
+extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
+extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
+extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
+
+/* S3C2416 SDHCI setup */
+
+#ifdef CONFIG_S3C2416_SETUP_SDHCI
+static inline void s3c2416_default_sdhci0(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC
+       s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
+#endif /* CONFIG_S3C_DEV_HSMMC */
+}
+
+static inline void s3c2416_default_sdhci1(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC1
+       s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
+#endif /* CONFIG_S3C_DEV_HSMMC1 */
+}
+
+#else
+static inline void s3c2416_default_sdhci0(void) { }
+static inline void s3c2416_default_sdhci1(void) { }
+
+#endif /* CONFIG_S3C2416_SETUP_SDHCI */
+
+/* S3C64XX SDHCI setup */
+
+#ifdef CONFIG_S3C64XX_SETUP_SDHCI
+static inline void s3c6400_default_sdhci0(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC
+       s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
+#endif
+}
+
+static inline void s3c6400_default_sdhci1(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC1
+       s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
+#endif
+}
+
+static inline void s3c6400_default_sdhci2(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC2
+       s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
+#endif
+}
+
+static inline void s3c6410_default_sdhci0(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC
+       s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
+#endif
+}
+
+static inline void s3c6410_default_sdhci1(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC1
+       s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
+#endif
+}
+
+static inline void s3c6410_default_sdhci2(void)
+{
+#ifdef CONFIG_S3C_DEV_HSMMC2
+       s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
+#endif
+}
+
+#else
+static inline void s3c6410_default_sdhci0(void) { }
+static inline void s3c6410_default_sdhci1(void) { }
+static inline void s3c6410_default_sdhci2(void) { }
+static inline void s3c6400_default_sdhci0(void) { }
+static inline void s3c6400_default_sdhci1(void) { }
+static inline void s3c6400_default_sdhci2(void) { }
+
+#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
+
+static inline void s3c_sdhci_setname(int id, char *name)
+{
+       switch (id) {
+#ifdef CONFIG_S3C_DEV_HSMMC
+       case 0:
+               s3c_device_hsmmc0.name = name;
+               break;
+#endif
+#ifdef CONFIG_S3C_DEV_HSMMC1
+       case 1:
+               s3c_device_hsmmc1.name = name;
+               break;
+#endif
+#ifdef CONFIG_S3C_DEV_HSMMC2
+       case 2:
+               s3c_device_hsmmc2.name = name;
+               break;
+#endif
+#ifdef CONFIG_S3C_DEV_HSMMC3
+       case 3:
+               s3c_device_hsmmc3.name = name;
+               break;
+#endif
+       default:
+               break;
+       }
+}
+#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/mach-s3c/setup-fb-24bpp-s3c64xx.c b/arch/arm/mach-s3c/setup-fb-24bpp-s3c64xx.c
new file mode 100644 (file)
index 0000000..cfa34b5
--- /dev/null
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Base S3C64XX setup information for 24bpp LCD framebuffer
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/fb.h>
+#include <linux/gpio.h>
+
+#include "fb.h"
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+void s3c64xx_fb_gpio_setup_24bpp(void)
+{
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2));
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2));
+}
diff --git a/arch/arm/mach-s3c/setup-i2c-s3c24xx.c b/arch/arm/mach-s3c/setup-i2c-s3c24xx.c
new file mode 100644 (file)
index 0000000..0d88366
--- /dev/null
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C24XX Base setup for i2c device
+
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+
+struct platform_device;
+
+#include <linux/platform_data/i2c-s3c2410.h>
+
+#include "gpio-cfg.h"
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+
+void s3c_i2c0_cfg_gpio(struct platform_device *dev)
+{
+       s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPE15_IICSDA);
+       s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPE14_IICSCL);
+}
diff --git a/arch/arm/mach-s3c/setup-i2c0-s3c64xx.c b/arch/arm/mach-s3c/setup-i2c0-s3c64xx.c
new file mode 100644 (file)
index 0000000..a6ef8d2
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Base S3C64XX I2C bus 0 gpio configuration
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/gpio.h>
+
+struct platform_device; /* don't need the contents */
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+void s3c_i2c0_cfg_gpio(struct platform_device *dev)
+{
+       s3c_gpio_cfgall_range(S3C64XX_GPB(5), 2,
+                             S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+}
diff --git a/arch/arm/mach-s3c/setup-i2c1-s3c64xx.c b/arch/arm/mach-s3c/setup-i2c1-s3c64xx.c
new file mode 100644 (file)
index 0000000..0fe3736
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Openmoko, Inc.
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Base S3C64XX I2C bus 1 gpio configuration
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/gpio.h>
+
+struct platform_device; /* don't need the contents */
+
+#include <linux/platform_data/i2c-s3c2410.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+void s3c_i2c1_cfg_gpio(struct platform_device *dev)
+{
+       s3c_gpio_cfgall_range(S3C64XX_GPB(2), 2,
+                             S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
+}
diff --git a/arch/arm/mach-s3c/setup-ide-s3c64xx.c b/arch/arm/mach-s3c/setup-ide-s3c64xx.c
new file mode 100644 (file)
index 0000000..f11f2b0
--- /dev/null
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2010 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com/
+//
+// S3C64XX setup information for IDE
+
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+
+#include <linux/platform_data/ata-samsung_cf.h>
+
+#include "map.h"
+#include "regs-clock.h"
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+void s3c64xx_ide_setup_gpio(void)
+{
+       u32 reg;
+
+       reg = readl(S3C_MEM_SYS_CFG) & (~0x3f);
+
+       /* Independent CF interface, CF chip select configuration */
+       writel(reg | MEM_SYS_CFG_INDEP_CF |
+               MEM_SYS_CFG_EBI_FIX_PRI_CFCON, S3C_MEM_SYS_CFG);
+
+       s3c_gpio_cfgpin(S3C64XX_GPB(4), S3C_GPIO_SFN(4));
+
+       /* Set XhiDATA[15:0] pins as CF Data[15:0] */
+       s3c_gpio_cfgpin_range(S3C64XX_GPK(0), 16, S3C_GPIO_SFN(5));
+
+       /* Set XhiADDR[2:0] pins as CF ADDR[2:0] */
+       s3c_gpio_cfgpin_range(S3C64XX_GPL(0), 3, S3C_GPIO_SFN(6));
+
+       /* Set Xhi ctrl pins as CF ctrl pins(IORDY, IOWR, IORD, CE[0:1]) */
+       s3c_gpio_cfgpin(S3C64XX_GPM(5), S3C_GPIO_SFN(1));
+       s3c_gpio_cfgpin_range(S3C64XX_GPM(0), 5, S3C_GPIO_SFN(6));
+}
diff --git a/arch/arm/mach-s3c/setup-keypad-s3c64xx.c b/arch/arm/mach-s3c/setup-keypad-s3c64xx.c
new file mode 100644 (file)
index 0000000..8463ad3
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2010 Samsung Electronics Co., Ltd.
+//             http://www.samsung.com/
+//
+// GPIO configuration for S3C64XX KeyPad device
+
+#include <linux/gpio.h>
+#include "gpio-cfg.h"
+#include "keypad.h"
+#include "gpio-samsung.h"
+
+void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
+{
+       /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), rows, S3C_GPIO_SFN(3));
+
+       /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3));
+}
diff --git a/arch/arm/mach-s3c/setup-sdhci-gpio-s3c24xx.c b/arch/arm/mach-s3c/setup-sdhci-gpio-s3c24xx.c
new file mode 100644 (file)
index 0000000..02131b3
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2010 Promwad Innovation Company
+//     Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
+//
+// S3C2416 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
+//
+// Based on mach-s3c64xx/setup-sdhci-gpio.c
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+#include "sdhci.h"
+
+void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
+{
+       s3c_gpio_cfgrange_nopull(S3C2410_GPE(5), 2 + width, S3C_GPIO_SFN(2));
+}
+
+void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
+{
+       s3c_gpio_cfgrange_nopull(S3C2410_GPL(0), width, S3C_GPIO_SFN(2));
+       s3c_gpio_cfgrange_nopull(S3C2410_GPL(8), 2, S3C_GPIO_SFN(2));
+}
diff --git a/arch/arm/mach-s3c/setup-sdhci-gpio-s3c64xx.c b/arch/arm/mach-s3c/setup-sdhci-gpio-s3c64xx.c
new file mode 100644 (file)
index 0000000..646ff94
--- /dev/null
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// S3C64XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+
+#include "gpio-cfg.h"
+#include "sdhci.h"
+#include "gpio-samsung.h"
+
+void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
+{
+       struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
+
+       /* Set all the necessary GPG pins to special-function 2 */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
+
+       if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+               s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
+               s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
+       }
+}
+
+void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
+{
+       struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
+
+       /* Set all the necessary GPH pins to special-function 2 */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPH(0), 2 + width, S3C_GPIO_SFN(2));
+
+       if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
+               s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
+               s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
+       }
+}
+
+void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
+{
+       /* Set all the necessary GPH pins to special-function 3 */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPH(6), width, S3C_GPIO_SFN(3));
+
+       /* Set all the necessary GPC pins to special-function 3 */
+       s3c_gpio_cfgrange_nopull(S3C64XX_GPC(4), 2, S3C_GPIO_SFN(3));
+}
diff --git a/arch/arm/mach-s3c/setup-spi-s3c24xx.c b/arch/arm/mach-s3c/setup-spi-s3c24xx.c
new file mode 100644 (file)
index 0000000..93fa1bb
--- /dev/null
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// HS-SPI device setup for S3C2443/S3C2416
+//
+// Copyright (C) 2011 Samsung Electronics Ltd.
+//             http://www.samsung.com/
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include "gpio-cfg.h"
+
+#include "hardware-s3c24xx.h"
+#include "regs-gpio.h"
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+int s3c64xx_spi0_cfg_gpio(void)
+{
+       /* enable hsspi bit in misccr */
+       s3c2410_modify_misccr(S3C2416_MISCCR_HSSPI_EN2, 1);
+
+       s3c_gpio_cfgall_range(S3C2410_GPE(11), 3,
+                             S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+
+       return 0;
+}
+#endif
diff --git a/arch/arm/mach-s3c/setup-spi-s3c64xx.c b/arch/arm/mach-s3c/setup-spi-s3c64xx.c
new file mode 100644 (file)
index 0000000..efcf78d
--- /dev/null
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2011 Samsung Electronics Ltd.
+//             http://www.samsung.com/
+
+#include <linux/gpio.h>
+#include <linux/platform_data/spi-s3c64xx.h>
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+int s3c64xx_spi0_cfg_gpio(void)
+{
+       s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3,
+                               S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+int s3c64xx_spi1_cfg_gpio(void)
+{
+       s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3,
+                               S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+       return 0;
+}
+#endif
diff --git a/arch/arm/mach-s3c/setup-ts-s3c24xx.c b/arch/arm/mach-s3c/setup-ts-s3c24xx.c
new file mode 100644 (file)
index 0000000..57363ea
--- /dev/null
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2010 Samsung Electronics Co., Ltd.
+//                     http://www.samsung.com/
+//
+// Based on S3C24XX setup for i2c device
+
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+
+struct platform_device; /* don't need the contents */
+
+#include <linux/platform_data/touchscreen-s3c2410.h>
+
+#include "gpio-cfg.h"
+#include "gpio-samsung.h"
+
+/**
+ * s3c24xx_ts_cfg_gpio - configure gpio for s3c2410 systems
+ * @dev: Device to configure GPIO for (ignored)
+ *
+ * Configure the GPIO for the S3C2410 system, where we have external FETs
+ * connected to the device (later systems such as the S3C2440 integrate
+ * these into the device).
+ */
+void s3c24xx_ts_cfg_gpio(struct platform_device *dev)
+{
+       s3c_gpio_cfgpin_range(S3C2410_GPG(12), 4, S3C_GPIO_SFN(3));
+}
diff --git a/arch/arm/mach-s3c/setup-usb-phy-s3c64xx.c b/arch/arm/mach-s3c/setup-usb-phy-s3c64xx.c
new file mode 100644 (file)
index 0000000..500d105
--- /dev/null
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2011 Samsung Electronics Co.Ltd
+// Author: Joonyoung Shim <jy0922.shim@samsung.com>
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include "map.h"
+#include "cpu.h"
+#include "usb-phy.h"
+
+#include "regs-sys-s3c64xx.h"
+#include "regs-usb-hsotg-phy-s3c64xx.h"
+
+enum samsung_usb_phy_type {
+       USB_PHY_TYPE_DEVICE,
+       USB_PHY_TYPE_HOST,
+};
+
+static int s3c_usb_otgphy_init(struct platform_device *pdev)
+{
+       struct clk *xusbxti;
+       u32 phyclk;
+
+       writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
+
+       /* set clock frequency for PLL */
+       phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
+
+       xusbxti = clk_get(&pdev->dev, "xusbxti");
+       if (!IS_ERR(xusbxti)) {
+               switch (clk_get_rate(xusbxti)) {
+               case 12 * MHZ:
+                       phyclk |= S3C_PHYCLK_CLKSEL_12M;
+                       break;
+               case 24 * MHZ:
+                       phyclk |= S3C_PHYCLK_CLKSEL_24M;
+                       break;
+               default:
+               case 48 * MHZ:
+                       /* default reference clock */
+                       break;
+               }
+               clk_put(xusbxti);
+       }
+
+       /* TODO: select external clock/oscillator */
+       writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
+
+       /* set to normal OTG PHY */
+       writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
+       mdelay(1);
+
+       /* reset OTG PHY and Link */
+       writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
+                       S3C_RSTCON);
+       udelay(20);     /* at-least 10uS */
+       writel(0, S3C_RSTCON);
+
+       return 0;
+}
+
+static int s3c_usb_otgphy_exit(struct platform_device *pdev)
+{
+       writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
+                               S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
+
+       writel(readl(S3C64XX_OTHERS) & ~S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
+
+       return 0;
+}
+
+int s3c_usb_phy_init(struct platform_device *pdev, int type)
+{
+       if (type == USB_PHY_TYPE_DEVICE)
+               return s3c_usb_otgphy_init(pdev);
+
+       return -EINVAL;
+}
+
+int s3c_usb_phy_exit(struct platform_device *pdev, int type)
+{
+       if (type == USB_PHY_TYPE_DEVICE)
+               return s3c_usb_otgphy_exit(pdev);
+
+       return -EINVAL;
+}
diff --git a/arch/arm/mach-s3c/simtec-audio.c b/arch/arm/mach-s3c/simtec-audio.c
new file mode 100644 (file)
index 0000000..487485b
--- /dev/null
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2009 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Audio setup for various Simtec S3C24XX implementations
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/io.h>
+
+#include "regs-gpio.h"
+#include "gpio-samsung.h"
+#include "gpio-cfg.h"
+
+#include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include "devs.h"
+
+#include "bast.h"
+#include "simtec.h"
+
+/* platform ops for audio */
+
+static void simtec_audio_startup_lrroute(void)
+{
+       unsigned int tmp;
+       unsigned long flags;
+
+       local_irq_save(flags);
+
+       tmp = __raw_readb(BAST_VA_CTRL1);
+       tmp &= ~BAST_CPLD_CTRL1_LRMASK;
+       tmp |= BAST_CPLD_CTRL1_LRCDAC;
+       __raw_writeb(tmp, BAST_VA_CTRL1);
+
+       local_irq_restore(flags);
+}
+
+static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
+static char our_name[32];
+
+static struct platform_device simtec_audio_dev = {
+       .name   = our_name,
+       .id     = -1,
+       .dev    = {
+               .parent         = &s3c_device_iis.dev,
+               .platform_data  = &simtec_audio_platdata,
+       },
+};
+
+int __init simtec_audio_add(const char *name, bool has_lr_routing,
+                           struct s3c24xx_audio_simtec_pdata *spd)
+{
+       if (!name)
+               name = "tlv320aic23";
+
+       snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
+
+       /* copy platform data so the source can be __initdata */
+       if (spd)
+               simtec_audio_platdata = *spd;
+
+       if (has_lr_routing)
+               simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
+
+       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
+       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
+                             S3C_GPIO_PULL_NONE);
+
+       platform_device_register(&s3c_device_iis);
+       platform_device_register(&simtec_audio_dev);
+       return 0;
+}
diff --git a/arch/arm/mach-s3c/simtec-nor.c b/arch/arm/mach-s3c/simtec-nor.c
new file mode 100644 (file)
index 0000000..a6fba05
--- /dev/null
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (c) 2008 Simtec Electronics
+//     http://armlinux.simtec.co.uk/
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// Simtec NOR mapping
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/physmap.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "map.h"
+
+#include "bast.h"
+#include "simtec.h"
+
+static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
+{
+       unsigned int val;
+
+       val = __raw_readb(BAST_VA_CTRL3);
+
+       printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
+
+       if (vpp)
+               val |= BAST_CPLD_CTRL3_ROMWEN;
+       else
+               val &= ~BAST_CPLD_CTRL3_ROMWEN;
+
+       __raw_writeb(val, BAST_VA_CTRL3);
+}
+
+static struct physmap_flash_data simtec_nor_pdata = {
+       .width          = 2,
+       .set_vpp        = simtec_nor_vpp,
+       .nr_parts       = 0,
+};
+
+static struct resource simtec_nor_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
+};
+
+static struct platform_device simtec_device_nor = {
+       .name           = "physmap-flash",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(simtec_nor_resource),
+       .resource       = simtec_nor_resource,
+       .dev            = {
+               .platform_data = &simtec_nor_pdata,
+       },
+};
+
+void __init nor_simtec_init(void)
+{
+       int ret;
+
+       ret = platform_device_register(&simtec_device_nor);
+       if (ret < 0)
+               printk(KERN_ERR "failed to register physmap-flash device\n");
+       else
+               simtec_nor_vpp(NULL, 1);
+}
diff --git a/arch/arm/mach-s3c/simtec-pm.c b/arch/arm/mach-s3c/simtec-pm.c
new file mode 100644 (file)
index 0000000..490256a
--- /dev/null
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2004 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// http://armlinux.simtec.co.uk/
+//
+// Power Management helpers for Simtec S3C24XX implementations
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "map.h"
+#include "regs-gpio.h"
+
+#include <asm/mach-types.h>
+
+#include "pm.h"
+
+#include "regs-mem-s3c24xx.h"
+
+#define COPYRIGHT ", Copyright 2005 Simtec Electronics"
+
+/* pm_simtec_init
+ *
+ * enable the power management functions
+*/
+
+static __init int pm_simtec_init(void)
+{
+       unsigned long gstatus4;
+
+       /* check which machine we are running on */
+
+       if (!machine_is_bast() && !machine_is_vr1000() &&
+           !machine_is_anubis() && !machine_is_osiris() &&
+           !machine_is_aml_m5900())
+               return 0;
+
+       printk(KERN_INFO "Simtec Board Power Management" COPYRIGHT "\n");
+
+       gstatus4  = (__raw_readl(S3C2410_BANKCON7) & 0x3) << 30;
+       gstatus4 |= (__raw_readl(S3C2410_BANKCON6) & 0x3) << 28;
+       gstatus4 |= (__raw_readl(S3C2410_BANKSIZE) & S3C2410_BANKSIZE_MASK);
+
+       __raw_writel(gstatus4, S3C2410_GSTATUS4);
+
+       return s3c_pm_init();
+}
+
+arch_initcall(pm_simtec_init);
diff --git a/arch/arm/mach-s3c/simtec-usb.c b/arch/arm/mach-s3c/simtec-usb.c
new file mode 100644 (file)
index 0000000..18fe064
--- /dev/null
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2004-2005 Simtec Electronics
+//   Ben Dooks <ben@simtec.co.uk>
+//
+// http://www.simtec.co.uk/products/EB2410ITX/
+//
+// Simtec BAST and Thorcom VR1000 USB port support functions
+
+#define DEBUG
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/gpio.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include "gpio-samsung.h"
+#include <mach/irqs.h>
+#include <asm/irq.h>
+
+#include <linux/platform_data/usb-ohci-s3c2410.h>
+#include "devs.h"
+
+#include "bast.h"
+#include "simtec.h"
+
+/* control power and monitor over-current events on various Simtec
+ * designed boards.
+*/
+
+static unsigned int power_state[2];
+
+static void
+usb_simtec_powercontrol(int port, int to)
+{
+       pr_debug("usb_simtec_powercontrol(%d,%d)\n", port, to);
+
+       power_state[port] = to;
+
+       if (power_state[0] && power_state[1])
+               gpio_set_value(S3C2410_GPB(4), 0);
+       else
+               gpio_set_value(S3C2410_GPB(4), 1);
+}
+
+static irqreturn_t
+usb_simtec_ocirq(int irq, void *pw)
+{
+       struct s3c2410_hcd_info *info = pw;
+
+       if (gpio_get_value(S3C2410_GPG(10)) == 0) {
+               pr_debug("usb_simtec: over-current irq (oc detected)\n");
+               s3c2410_usb_report_oc(info, 3);
+       } else {
+               pr_debug("usb_simtec: over-current irq (oc cleared)\n");
+               s3c2410_usb_report_oc(info, 0);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on)
+{
+       int ret;
+
+       if (on) {
+               ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq,
+                                 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+                                 "USB Over-current", info);
+               if (ret != 0) {
+                       printk(KERN_ERR "failed to request usb oc irq\n");
+               }
+       } else {
+               free_irq(BAST_IRQ_USBOC, info);
+       }
+}
+
+static struct s3c2410_hcd_info usb_simtec_info __initdata = {
+       .port[0]        = {
+               .flags  = S3C_HCDFLG_USED
+       },
+       .port[1]        = {
+               .flags  = S3C_HCDFLG_USED
+       },
+
+       .power_control  = usb_simtec_powercontrol,
+       .enable_oc      = usb_simtec_enableoc,
+};
+
+
+int __init usb_simtec_init(void)
+{
+       int ret;
+
+       printk("USB Power Control, Copyright 2004 Simtec Electronics\n");
+
+       ret = gpio_request(S3C2410_GPB(4), "USB power control");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPB4\n", __func__);
+               return ret;
+       }
+
+       ret = gpio_request(S3C2410_GPG(10), "USB overcurrent");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPG10\n", __func__);
+               gpio_free(S3C2410_GPB(4));
+               return ret;
+       }
+
+       /* turn power on */
+       gpio_direction_output(S3C2410_GPB(4), 1);
+       gpio_direction_input(S3C2410_GPG(10));
+
+       s3c_ohci_set_platdata(&usb_simtec_info);
+       return 0;
+}
diff --git a/arch/arm/mach-s3c/simtec.h b/arch/arm/mach-s3c/simtec.h
new file mode 100644 (file)
index 0000000..d96bd60
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * Simtec common functions
+ */
+
+struct s3c24xx_audio_simtec_pdata;
+
+extern void nor_simtec_init(void);
+
+extern int usb_simtec_init(void);
+
+extern int simtec_audio_add(const char *codec_name, bool has_lr_routing,
+                           struct s3c24xx_audio_simtec_pdata *pdata);
diff --git a/arch/arm/mach-s3c/sleep-s3c2410.S b/arch/arm/mach-s3c/sleep-s3c2410.S
new file mode 100644 (file)
index 0000000..04aded9
--- /dev/null
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2004 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 Power Manager (Suspend-To-RAM) support
+ *
+ * Based on PXA/SA1100 sleep code by:
+ *     Nicolas Pitre, (c) 2002 Monta Vista Software Inc
+ *     Cliff Brake, (c) 2001
+ */
+
+#include <linux/linkage.h>
+#include <linux/serial_s3c.h>
+#include <asm/assembler.h>
+#include "map.h"
+
+#include "regs-gpio.h"
+#include "regs-clock.h"
+
+#include "regs-mem-s3c24xx.h"
+
+       /* s3c2410_cpu_suspend
+        *
+        * put the cpu into sleep mode
+       */
+
+ENTRY(s3c2410_cpu_suspend)
+       @@ prepare cpu to sleep
+
+       ldr     r4, =S3C2410_REFRESH
+       ldr     r5, =S3C24XX_MISCCR
+       ldr     r6, =S3C2410_CLKCON
+       ldr     r7, [r4]                @ get REFRESH (and ensure in TLB)
+       ldr     r8, [r5]                @ get MISCCR (and ensure in TLB)
+       ldr     r9, [r6]                @ get CLKCON (and ensure in TLB)
+
+       orr     r7, r7, #S3C2410_REFRESH_SELF   @ SDRAM sleep command
+       orr     r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals
+       orr     r9, r9, #S3C2410_CLKCON_POWER   @ power down command
+
+       teq     pc, #0                  @ first as a trial-run to load cache
+       bl      s3c2410_do_sleep
+       teq     r0, r0                  @ now do it for real
+       b       s3c2410_do_sleep        @
+
+       @@ align next bit of code to cache line
+       .align  5
+s3c2410_do_sleep:
+       streq   r7, [r4]                        @ SDRAM sleep command
+       streq   r8, [r5]                        @ SDRAM power-down config
+       streq   r9, [r6]                        @ CPU sleep
+1:     beq     1b
+       ret     lr
diff --git a/arch/arm/mach-s3c/sleep-s3c2412.S b/arch/arm/mach-s3c/sleep-s3c2412.S
new file mode 100644 (file)
index 0000000..b4b6173
--- /dev/null
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2007 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2412 Power Manager low-level sleep support
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include "map.h"
+
+#include "regs-irq.h"
+
+       .text
+
+       .global s3c2412_sleep_enter
+
+s3c2412_sleep_enter:
+       mov     r0, #0                  /* argument for coprocessors */
+       ldr     r1, =S3C2410_INTPND
+       ldr     r2, =S3C2410_SRCPND
+       ldr     r3, =S3C2410_EINTPEND
+
+       teq     r0, r0
+       bl      s3c2412_sleep_enter1
+       teq     pc, r0
+       bl      s3c2412_sleep_enter1
+
+       .align  5
+
+       /* this is called twice, first with the Z flag to ensure that the
+        * instructions have been loaded into the cache, and the second
+        * time to try and suspend the system.
+       */
+s3c2412_sleep_enter1:
+       mcr     p15, 0, r0, c7, c10, 4
+       mcrne   p15, 0, r0, c7, c0, 4
+
+       /* if we return from here, it is because an interrupt was
+        * active when we tried to shutdown. Try and ack the IRQ and
+        * retry, as simply returning causes the system to lock.
+       */
+
+       ldrne   r9, [r1]
+       strne   r9, [r1]
+       ldrne   r9, [r2]
+       strne   r9, [r2]
+       ldrne   r9, [r3]
+       strne   r9, [r3]
+       bne     s3c2412_sleep_enter1
+
+       ret     lr
diff --git a/arch/arm/mach-s3c/sleep-s3c24xx.S b/arch/arm/mach-s3c/sleep-s3c24xx.S
new file mode 100644 (file)
index 0000000..4b2af91
--- /dev/null
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2004 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 Power Manager (Suspend-To-RAM) support
+ *
+ * Based on PXA/SA1100 sleep code by:
+ *     Nicolas Pitre, (c) 2002 Monta Vista Software Inc
+ *     Cliff Brake, (c) 2001
+ */
+
+#include <linux/linkage.h>
+#include <linux/serial_s3c.h>
+#include <asm/assembler.h>
+#include "map.h"
+
+#include "regs-gpio.h"
+#include "regs-clock.h"
+
+/*
+ * S3C24XX_DEBUG_RESUME is dangerous if your bootloader does not
+ * reset the UART configuration, only enable if you really need this!
+ */
+//#define S3C24XX_DEBUG_RESUME
+
+       .text
+
+       /* sleep magic, to allow the bootloader to check for an valid
+        * image to resume to. Must be the first word before the
+        * s3c_cpu_resume entry.
+       */
+
+       .word   0x2bedf00d
+
+       /* s3c_cpu_resume
+        *
+        * resume code entry for bootloader to call
+       */
+
+ENTRY(s3c_cpu_resume)
+       mov     r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
+       msr     cpsr_c, r0
+
+       @@ load UART to allow us to print the two characters for
+       @@ resume debug
+
+       mov     r2, #S3C24XX_PA_UART & 0xff000000
+       orr     r2, r2, #S3C24XX_PA_UART & 0xff000
+
+#if 0
+       /* SMDK2440 LED set */
+       mov     r14, #S3C24XX_PA_GPIO
+       ldr     r12, [ r14, #0x54 ]
+       bic     r12, r12, #3<<4
+       orr     r12, r12, #1<<7
+       str     r12, [ r14, #0x54 ]
+#endif
+
+#ifdef S3C24XX_DEBUG_RESUME
+       mov     r3, #'L'
+       strb    r3, [ r2, #S3C2410_UTXH ]
+1001:
+       ldrb    r14, [ r3, #S3C2410_UTRSTAT ]
+       tst     r14, #S3C2410_UTRSTAT_TXE
+       beq     1001b
+#endif /* S3C24XX_DEBUG_RESUME */
+
+       b       cpu_resume
diff --git a/arch/arm/mach-s3c/sleep-s3c64xx.S b/arch/arm/mach-s3c/sleep-s3c64xx.S
new file mode 100644 (file)
index 0000000..739e53f
--- /dev/null
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* linux/arch/arm/plat-s3c64xx/sleep.S
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * S3C64XX CPU sleep code
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include "map.h"
+
+#undef S3C64XX_VA_GPIO
+#define S3C64XX_VA_GPIO (0x0)
+
+#include "regs-gpio.h"
+
+#define LL_UART (S3C_PA_UART + (0x400 * CONFIG_S3C_LOWLEVEL_UART_PORT))
+
+       .text
+
+       /* Sleep magic, the word before the resume entry point so that the
+        * bootloader can check for a resumeable image. */
+
+       .word   0x2bedf00d
+
+       /* s3c_cpu_reusme
+        *
+        * This is the entry point, stored by whatever method the bootloader
+        * requires to get the kernel runnign again. This code expects to be
+        * entered with no caches live and the MMU disabled. It will then
+        * restore the MMU and other basic CP registers saved and restart
+        * the kernel C code to finish the resume code.
+       */
+
+ENTRY(s3c_cpu_resume)
+       msr     cpsr_c, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
+       ldr     r2, =LL_UART            /* for debug */
+
+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
+
+#define S3C64XX_GPNCON                 (S3C64XX_GPN_BASE + 0x00)
+#define S3C64XX_GPNDAT                 (S3C64XX_GPN_BASE + 0x04)
+
+#define S3C64XX_GPN_CONMASK(__gpio)    (0x3 << ((__gpio) * 2))
+#define S3C64XX_GPN_OUTPUT(__gpio)     (0x1 << ((__gpio) * 2))
+
+       /* Initialise the GPIO state if we are debugging via the SMDK LEDs,
+        * as the uboot version supplied resets these to inputs during the
+        * resume checks.
+       */
+
+       ldr     r3, =S3C64XX_PA_GPIO
+       ldr     r0, [ r3, #S3C64XX_GPNCON ]
+       bic     r0, r0, #(S3C64XX_GPN_CONMASK(12) | S3C64XX_GPN_CONMASK(13) | \
+                         S3C64XX_GPN_CONMASK(14) | S3C64XX_GPN_CONMASK(15))
+       orr     r0, r0, #(S3C64XX_GPN_OUTPUT(12) | S3C64XX_GPN_OUTPUT(13) | \
+                         S3C64XX_GPN_OUTPUT(14) | S3C64XX_GPN_OUTPUT(15))
+       str     r0, [ r3, #S3C64XX_GPNCON ]
+
+       ldr     r0, [ r3, #S3C64XX_GPNDAT ]
+       bic     r0, r0, #0xf << 12                      @ GPN12..15
+       orr     r0, r0, #1 << 15                        @ GPN15
+       str     r0, [ r3, #S3C64XX_GPNDAT ]
+#endif
+       b       cpu_resume
diff --git a/arch/arm/mach-s3c/spi-core-s3c24xx.h b/arch/arm/mach-s3c/spi-core-s3c24xx.h
new file mode 100644 (file)
index 0000000..0576674
--- /dev/null
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
+ */
+
+#ifndef __PLAT_S3C_SPI_CORE_S3C24XX_H
+#define __PLAT_S3C_SPI_CORE_S3C24XX_H
+
+/* These functions are only for use with the core support code, such as
+ * the cpu specific initialisation code
+ */
+
+/* re-define device name depending on support. */
+static inline void s3c24xx_spi_setname(char *name)
+{
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+       s3c64xx_device_spi0.name = name;
+#endif
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+       s3c64xx_device_spi1.name = name;
+#endif
+#ifdef CONFIG_S3C64XX_DEV_SPI2
+       s3c64xx_device_spi2.name = name;
+#endif
+}
+
+#endif /* __PLAT_S3C_SPI_CORE_S3C24XX_H */
diff --git a/arch/arm/mach-s3c/usb-phy.h b/arch/arm/mach-s3c/usb-phy.h
new file mode 100644 (file)
index 0000000..759d66a
--- /dev/null
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@samsung.com>
+ */
+
+#ifndef __PLAT_SAMSUNG_USB_PHY_H
+#define __PLAT_SAMSUNG_USB_PHY_H __FILE__
+
+extern int s3c_usb_phy_init(struct platform_device *pdev, int type);
+extern int s3c_usb_phy_exit(struct platform_device *pdev, int type);
+
+#endif /* __PLAT_SAMSUNG_USB_PHY_H */
diff --git a/arch/arm/mach-s3c/vr1000.h b/arch/arm/mach-s3c/vr1000.h
new file mode 100644 (file)
index 0000000..3cfa296
--- /dev/null
@@ -0,0 +1,113 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * VR1000 - CPLD control constants
+ * Machine VR1000 - IRQ Number definitions
+ * Machine VR1000 - Memory map definitions
+ */
+
+#ifndef __MACH_S3C24XX_VR1000_H
+#define __MACH_S3C24XX_VR1000_H __FILE__
+
+#define VR1000_CPLD_CTRL2_RAMWEN       (0x04)  /* SRAM Write Enable */
+
+/* irq numbers to onboard peripherals */
+
+#define VR1000_IRQ_USBOC               IRQ_EINT19
+#define VR1000_IRQ_IDE0                        IRQ_EINT16
+#define VR1000_IRQ_IDE1                        IRQ_EINT17
+#define VR1000_IRQ_SERIAL              IRQ_EINT12
+#define VR1000_IRQ_DM9000A             IRQ_EINT10
+#define VR1000_IRQ_DM9000N             IRQ_EINT9
+#define VR1000_IRQ_SMALERT             IRQ_EINT8
+
+/* map */
+
+#define VR1000_IOADDR(x)               (S3C2410_ADDR((x) + 0x01300000))
+
+/* we put the CPLD registers next, to get them out of the way */
+
+#define VR1000_VA_CTRL1                        VR1000_IOADDR(0x00000000) /* 0x01300000 */
+#define VR1000_PA_CTRL1                        (S3C2410_CS5 | 0x7800000)
+
+#define VR1000_VA_CTRL2                        VR1000_IOADDR(0x00100000) /* 0x01400000 */
+#define VR1000_PA_CTRL2                        (S3C2410_CS1 | 0x6000000)
+
+#define VR1000_VA_CTRL3                        VR1000_IOADDR(0x00200000) /* 0x01500000 */
+#define VR1000_PA_CTRL3                        (S3C2410_CS1 | 0x6800000)
+
+#define VR1000_VA_CTRL4                        VR1000_IOADDR(0x00300000) /* 0x01600000 */
+#define VR1000_PA_CTRL4                        (S3C2410_CS1 | 0x7000000)
+
+/* next, we have the PC104 ISA interrupt registers */
+
+#define VR1000_PA_PC104_IRQREQ         (S3C2410_CS5 | 0x6000000) /* 0x01700000 */
+#define VR1000_VA_PC104_IRQREQ         VR1000_IOADDR(0x00400000)
+
+#define VR1000_PA_PC104_IRQRAW         (S3C2410_CS5 | 0x6800000) /* 0x01800000 */
+#define VR1000_VA_PC104_IRQRAW         VR1000_IOADDR(0x00500000)
+
+#define VR1000_PA_PC104_IRQMASK                (S3C2410_CS5 | 0x7000000) /* 0x01900000 */
+#define VR1000_VA_PC104_IRQMASK                VR1000_IOADDR(0x00600000)
+
+/*
+ * 0xE0000000 contains the IO space that is split by speed and
+ * whether the access is for 8 or 16bit IO... this ensures that
+ * the correct access is made
+ *
+ * 0x10000000 of space, partitioned as so:
+ *
+ * 0x00000000 to 0x04000000  8bit,  slow
+ * 0x04000000 to 0x08000000  16bit, slow
+ * 0x08000000 to 0x0C000000  16bit, net
+ * 0x0C000000 to 0x10000000  16bit, fast
+ *
+ * each of these spaces has the following in:
+ *
+ * 0x02000000 to 0x02100000 1MB  IDE primary channel
+ * 0x02100000 to 0x02200000 1MB  IDE primary channel aux
+ * 0x02200000 to 0x02400000 1MB  IDE secondary channel
+ * 0x02300000 to 0x02400000 1MB  IDE secondary channel aux
+ * 0x02500000 to 0x02600000 1MB  Davicom DM9000 ethernet controllers
+ * 0x02600000 to 0x02700000 1MB
+ *
+ * the phyiscal layout of the zones are:
+ *  nGCS2 - 8bit, slow
+ *  nGCS3 - 16bit, slow
+ *  nGCS4 - 16bit, net
+ *  nGCS5 - 16bit, fast
+ */
+
+#define VR1000_VA_MULTISPACE   (0xE0000000)
+
+#define VR1000_VA_ISAIO                (VR1000_VA_MULTISPACE + 0x00000000)
+#define VR1000_VA_ISAMEM       (VR1000_VA_MULTISPACE + 0x01000000)
+#define VR1000_VA_IDEPRI       (VR1000_VA_MULTISPACE + 0x02000000)
+#define VR1000_VA_IDEPRIAUX    (VR1000_VA_MULTISPACE + 0x02100000)
+#define VR1000_VA_IDESEC       (VR1000_VA_MULTISPACE + 0x02200000)
+#define VR1000_VA_IDESECAUX    (VR1000_VA_MULTISPACE + 0x02300000)
+#define VR1000_VA_ASIXNET      (VR1000_VA_MULTISPACE + 0x02400000)
+#define VR1000_VA_DM9000       (VR1000_VA_MULTISPACE + 0x02500000)
+#define VR1000_VA_SUPERIO      (VR1000_VA_MULTISPACE + 0x02600000)
+
+/* physical offset addresses for the peripherals */
+
+#define VR1000_PA_IDEPRI       (0x02000000)
+#define VR1000_PA_IDEPRIAUX    (0x02800000)
+#define VR1000_PA_IDESEC       (0x03000000)
+#define VR1000_PA_IDESECAUX    (0x03800000)
+#define VR1000_PA_DM9000       (0x05000000)
+
+#define VR1000_PA_SERIAL       (0x11800000)
+#define VR1000_VA_SERIAL       (VR1000_IOADDR(0x00700000))
+
+/* VR1000 ram is in CS1, with A26..A24 = 2_101 */
+#define VR1000_PA_SRAM         (S3C2410_CS1 | 0x05000000)
+
+/* some configurations for the peripherals */
+
+#define VR1000_DM9000_CS       VR1000_VAM_CS4
+
+#endif /* __MACH_S3C24XX_VR1000_H */
diff --git a/arch/arm/mach-s3c/wakeup-mask.c b/arch/arm/mach-s3c/wakeup-mask.c
new file mode 100644 (file)
index 0000000..b490e75
--- /dev/null
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright 2010 Ben Dooks <ben-linux@fluff.org>
+//
+// Support for wakeup mask interrupts on newer SoCs
+
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/device.h>
+#include <linux/types.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+
+#include "wakeup-mask.h"
+#include "pm.h"
+
+void samsung_sync_wakemask(void __iomem *reg,
+                          const struct samsung_wakeup_mask *mask, int nr_mask)
+{
+       struct irq_data *data;
+       u32 val;
+
+       val = __raw_readl(reg);
+
+       for (; nr_mask > 0; nr_mask--, mask++) {
+               if (mask->irq == NO_WAKEUP_IRQ) {
+                       val |= mask->bit;
+                       continue;
+               }
+
+               data = irq_get_irq_data(mask->irq);
+
+               /* bit of a liberty to read this directly from irq_data. */
+               if (irqd_is_wakeup_set(data))
+                       val &= ~mask->bit;
+               else
+                       val |= mask->bit;
+       }
+
+       printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
+       __raw_writel(val, reg);
+}
diff --git a/arch/arm/mach-s3c/wakeup-mask.h b/arch/arm/mach-s3c/wakeup-mask.h
new file mode 100644 (file)
index 0000000..630909e
--- /dev/null
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
+ *
+ * Support for wakeup mask interrupts on newer SoCs
+ */
+
+#ifndef __PLAT_WAKEUP_MASK_H
+#define __PLAT_WAKEUP_MASK_H __file__
+
+/* if no irq yet defined, but still want to mask */
+#define NO_WAKEUP_IRQ (0x90000000)
+
+/**
+ * struct samsung_wakeup_mask - wakeup mask information
+ * @irq: The interrupt associated with this wakeup.
+ * @bit: The bit, as a (1 << bitno) controlling this source.
+ */ 
+struct samsung_wakeup_mask {
+       unsigned int    irq;
+       u32             bit;
+};
+
+/**
+ * samsung_sync_wakemask - sync wakeup mask information for pm
+ * @reg: The register that is used.
+ * @masks: The list of masks to use.
+ * @nr_masks: The number of entries pointed to buy @masks.
+ *
+ * Synchronise the wakeup mask information at suspend time from the list
+ * of interrupts and control bits in @masks. We do this at suspend time
+ * as overriding the relevant irq chips is harder and the register is only
+ * required to be correct before we enter sleep.
+ */
+extern void samsung_sync_wakemask(void __iomem *reg,
+                                 const struct samsung_wakeup_mask *masks,
+                                 int nr_masks);
+
+#endif /* __PLAT_WAKEUP_MASK_H */
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
deleted file mode 100644 (file)
index 7673dde..0000000
+++ /dev/null
@@ -1,596 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (c) 2012 Samsung Electronics Co., Ltd.
-#              http://www.samsung.com/
-#
-# Copyright 2007 Simtec Electronics
-
-if ARCH_S3C24XX
-
-config PLAT_S3C24XX
-       def_bool y
-       select GPIOLIB
-       select NO_IOPORT_MAP
-       select S3C_DEV_NAND
-       select IRQ_DOMAIN
-       select COMMON_CLK
-       help
-         Base platform code for any Samsung S3C24XX device
-
-
-
-menu "Samsung S3C24XX SoCs Support"
-
-comment "S3C24XX SoCs"
-
-config CPU_S3C2410
-       bool "Samsung S3C2410"
-       default y
-       select CPU_ARM920T
-       select S3C2410_COMMON_CLK
-       select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
-       select S3C2410_PM if PM
-       help
-         Support for S3C2410 and S3C2410A family from the S3C24XX line
-         of Samsung Mobile CPUs.
-
-config CPU_S3C2412
-       bool "Samsung S3C2412"
-       select CPU_ARM926T
-       select S3C2412_COMMON_CLK
-       select S3C2412_PM if PM_SLEEP
-       help
-         Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
-
-config CPU_S3C2416
-       bool "Samsung S3C2416/S3C2450"
-       select CPU_ARM926T
-       select S3C2416_PM if PM_SLEEP
-       select S3C2443_COMMON_CLK
-       help
-         Support for the S3C2416 SoC from the S3C24XX line
-
-config CPU_S3C2440
-       bool "Samsung S3C2440"
-       select CPU_ARM920T
-       select S3C2410_COMMON_CLK
-       select S3C2410_PM if PM_SLEEP
-       help
-         Support for S3C2440 Samsung Mobile CPU based systems.
-
-config CPU_S3C2442
-       bool "Samsung S3C2442"
-       select CPU_ARM920T
-       select S3C2410_COMMON_CLK
-       select S3C2410_PM if PM_SLEEP
-       help
-         Support for S3C2442 Samsung Mobile CPU based systems.
-
-config CPU_S3C244X
-       def_bool y
-       depends on CPU_S3C2440 || CPU_S3C2442
-
-config CPU_S3C2443
-       bool "Samsung S3C2443"
-       select CPU_ARM920T
-       select S3C2443_COMMON_CLK
-       help
-         Support for the S3C2443 SoC from the S3C24XX line
-
-# common code
-
-config S3C24XX_SMDK
-       bool
-       help
-         Common machine code for SMDK2410 and SMDK2440
-
-config S3C24XX_SIMTEC_AUDIO
-       bool
-       depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS)
-       default y
-       help
-         Add audio devices for common Simtec S3C24XX boards
-
-config S3C24XX_SIMTEC_PM
-       bool
-       help
-         Common power management code for systems that are
-         compatible with the Simtec style of power management
-
-config S3C24XX_SIMTEC_USB
-       bool
-       help
-         USB management code for common Simtec S3C24XX boards
-
-config S3C24XX_SETUP_TS
-       bool
-       help
-         Compile in platform device definition for Samsung TouchScreen.
-
-config S3C2410_PM
-       bool
-       help
-         Power Management code common to S3C2410 and better
-
-config S3C24XX_PLL
-       bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
-       depends on ARM_S3C24XX_CPUFREQ
-       help
-         Compile in support for changing the PLL frequency from the
-         S3C24XX series CPUfreq driver. The PLL takes time to settle
-         after a frequency change, so by default it is not enabled.
-
-         This also means that the PLL tables for the selected CPU(s) will
-         be built which may increase the size of the kernel image.
-
-config S3C_SETUP_CAMIF
-       bool
-       help
-         Compile in common setup code for S3C CAMIF devices
-
-# cpu frequency items common between s3c2410 and s3c2440/s3c2442
-
-config S3C2410_IOTIMING
-       bool
-       depends on ARM_S3C24XX_CPUFREQ
-       help
-         Internal node to select io timing code that is common to the s3c2410
-         and s3c2440/s3c2442 cpu frequency support.
-
-config S3C2410_CPUFREQ_UTILS
-       bool
-       depends on ARM_S3C24XX_CPUFREQ
-       help
-         Internal node to select timing code that is common to the s3c2410
-         and s3c2440/s3c244 cpu frequency support.
-
-# cpu frequency support common to s3c2412, s3c2413 and s3c2442
-
-config S3C2412_IOTIMING
-       bool
-       depends on ARM_S3C24XX_CPUFREQ && (CPU_S3C2412 || CPU_S3C2443)
-       help
-         Intel node to select io timing code that is common to the s3c2412
-         and the s3c2443.
-
-# cpu-specific sections
-
-if CPU_S3C2410
-
-config S3C2410_PLL
-       bool
-       depends on ARM_S3C2410_CPUFREQ && S3C24XX_PLL
-       default y
-       help
-         Select the PLL table for the S3C2410
-
-config S3C24XX_SIMTEC_NOR
-       bool
-       help
-         Internal node to specify machine has simtec NOR mapping
-
-config MACH_BAST_IDE
-       bool
-       select HAVE_PATA_PLATFORM
-       help
-         Internal node for machines with an BAST style IDE
-         interface
-
-comment "S3C2410 Boards"
-
-#
-# The "S3C2410 Boards" list is ordered alphabetically by option text.
-# (without ARCH_ or MACH_)
-#
-
-config MACH_AML_M5900
-       bool "AML M5900 Series"
-       select S3C24XX_SIMTEC_PM if PM
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the American Microsystems M5900 Series
-         <http://www.amltd.com>
-
-config ARCH_BAST
-       bool "Simtec Electronics BAST (EB2410ITX)"
-       select ISA
-       select MACH_BAST_IDE
-       select S3C2410_COMMON_DCLK
-       select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ
-       select S3C24XX_SIMTEC_NOR
-       select S3C24XX_SIMTEC_PM if PM
-       select S3C24XX_SIMTEC_USB
-       select S3C_DEV_HWMON
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Simtec Electronics EB2410ITX
-         development board (also known as BAST)
-
-config BAST_PC104_IRQ
-       bool "BAST PC104 IRQ support"
-       depends on ARCH_BAST
-       default y
-       help
-         Say Y here to enable the PC104 IRQ routing on the
-         Simtec BAST (EB2410ITX)
-
-config ARCH_H1940
-       bool "IPAQ H1940"
-       select PM_H1940 if PM
-       select S3C24XX_SETUP_TS
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the HP IPAQ H1940
-
-config H1940BT
-       tristate "Control the state of H1940 bluetooth chip"
-       depends on ARCH_H1940
-       depends on RFKILL
-       help
-         This is a simple driver that is able to control
-         the state of built in bluetooth chip on h1940.
-
-config MACH_N30
-       bool "Acer N30 family"
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you want suppt for the Acer N30, Acer N35,
-         Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
-
-config MACH_OTOM
-       bool "NexVision OTOM Board"
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Nex Vision OTOM board
-
-config MACH_QT2410
-       bool "QT2410"
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Armzone QT2410
-
-config ARCH_SMDK2410
-       bool "SMDK2410/A9M2410"
-       select S3C24XX_SMDK
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the SMDK2410 or the derived module A9M2410
-         <http://www.fsforth.de>
-
-config MACH_TCT_HAMMER
-       bool "TCT Hammer Board"
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the TinCanTools Hammer Board
-         <https://www.tincantools.com>
-
-config MACH_VR1000
-       bool "Thorcom VR1000"
-       select MACH_BAST_IDE
-       select S3C2410_COMMON_DCLK
-       select S3C24XX_SIMTEC_NOR
-       select S3C24XX_SIMTEC_PM if PM
-       select S3C24XX_SIMTEC_USB
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Thorcom VR1000 board.
-
-endif  # CPU_S3C2410
-
-config S3C2412_PM_SLEEP
-       bool
-       help
-         Internal config node to apply sleep for S3C2412 power management.
-         Can be selected by another SoCs such as S3C2416 with similar
-         sleep procedure.
-
-if CPU_S3C2412
-
-config CPU_S3C2412_ONLY
-       bool
-       depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \
-                  !CPU_S3C2442 && !CPU_S3C2443
-       default y
-
-config S3C2412_PM
-       bool
-       select S3C2412_PM_SLEEP
-       select SAMSUNG_WAKEMASK
-       help
-         Internal config node to apply S3C2412 power management
-
-comment "S3C2412 Boards"
-
-#
-# The "S3C2412 Boards" list is ordered alphabetically by option text.
-# (without ARCH_ or MACH_)
-#
-
-config MACH_JIVE
-       bool "Logitech Jive"
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Logitech Jive.
-
-config MACH_JIVE_SHOW_BOOTLOADER
-       bool "Allow access to bootloader partitions in MTD"
-       depends on MACH_JIVE
-
-config MACH_S3C2413
-       bool
-       help
-         Internal node for S3C2413 version of SMDK2413, so that
-         machine_is_s3c2413() will work when MACH_SMDK2413 is
-         selected
-
-config MACH_SMDK2412
-       bool "SMDK2412"
-       select MACH_SMDK2413
-       help
-         Say Y here if you are using an SMDK2412
-
-         Note, this shares support with SMDK2413, so will automatically
-         select MACH_SMDK2413.
-
-config MACH_SMDK2413
-       bool "SMDK2413"
-       select MACH_S3C2413
-       select S3C24XX_SMDK
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using an SMDK2413
-
-config MACH_VSTMS
-       bool "VMSTMS"
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using an VSTMS board
-
-endif  # CPU_S3C2412
-
-if CPU_S3C2416
-
-config S3C2416_PM
-       bool
-       select S3C2412_PM_SLEEP
-       select SAMSUNG_WAKEMASK
-       help
-         Internal config node to apply S3C2416 power management
-
-config S3C2416_SETUP_SDHCI
-       bool
-       select S3C2416_SETUP_SDHCI_GPIO
-       help
-         Internal helper functions for S3C2416 based SDHCI systems
-
-config S3C2416_SETUP_SDHCI_GPIO
-       bool
-       help
-         Common setup code for SDHCI gpio.
-
-comment "S3C2416 Boards"
-
-config MACH_SMDK2416
-       bool "SMDK2416"
-       select S3C2416_SETUP_SDHCI
-       select S3C24XX_SMDK
-       select S3C_DEV_FB
-       select S3C_DEV_HSMMC
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using an SMDK2416
-
-config MACH_S3C2416_DT
-       bool "Samsung S3C2416 machine using devicetree"
-       select TIMER_OF
-       select USE_OF
-       select PINCTRL
-       select PINCTRL_S3C24XX
-       help
-         Machine support for Samsung S3C2416 machines with device tree enabled.
-         Select this if a fdt blob is available for the S3C2416 SoC based board.
-         Note: This is under development and not all peripherals can be supported
-         with this machine file.
-
-endif  # CPU_S3C2416
-
-if CPU_S3C2440 || CPU_S3C2442
-
-config S3C2440_XTAL_12000000
-       bool
-       help
-         Indicate that the build needs to support 12MHz system
-         crystal.
-
-config S3C2440_XTAL_16934400
-       bool
-       help
-         Indicate that the build needs to support 16.9344MHz system
-         crystal.
-
-config S3C2440_PLL_12000000
-       bool
-       depends on ARM_S3C2440_CPUFREQ && S3C2440_XTAL_12000000
-       default y if S3C24XX_PLL
-       help
-         PLL tables for S3C2440 or S3C2442 CPUs with 12MHz crystals.
-
-config S3C2440_PLL_16934400
-       bool
-       depends on ARM_S3C2440_CPUFREQ && S3C2440_XTAL_16934400
-       default y if S3C24XX_PLL
-       help
-         PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals.
-endif
-
-if CPU_S3C2440
-
-comment "S3C2440 Boards"
-
-#
-# The "S3C2440 Boards" list is ordered alphabetically by option text.
-# (without ARCH_ or MACH_)
-#
-
-config MACH_ANUBIS
-       bool "Simtec Electronics ANUBIS"
-       select HAVE_PATA_PLATFORM
-       select S3C2410_COMMON_DCLK
-       select S3C2440_XTAL_12000000
-       select S3C24XX_SIMTEC_PM if PM
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Simtec Electronics ANUBIS
-         development system
-
-config MACH_AT2440EVB
-       bool "Avantech AT2440EVB development board"
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the AT2440EVB development board
-
-config MACH_MINI2440
-       bool "MINI2440 development board"
-       select LEDS_CLASS
-       select LEDS_TRIGGERS
-       select LEDS_TRIGGER_BACKLIGHT
-       select NEW_LEDS
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       select S3C_SETUP_CAMIF
-       help
-         Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
-         available via various sources. It can come with a 3.5" or 7" touch LCD.
-
-config MACH_NEXCODER_2440
-       bool "NexVision NEXCODER 2440 Light Board"
-       select S3C2440_XTAL_12000000
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board
-
-config MACH_OSIRIS
-       bool "Simtec IM2440D20 (OSIRIS) module"
-       select S3C2410_COMMON_DCLK
-       select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
-       select S3C2440_XTAL_12000000
-       select S3C24XX_SIMTEC_PM if PM
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the Simtec IM2440D20 module, also
-         known as the Osiris.
-
-config MACH_OSIRIS_DVS
-       tristate "Simtec IM2440D20 (OSIRIS) Dynamic Voltage Scaling driver"
-       depends on MACH_OSIRIS
-       depends on TPS65010
-       help
-         Say Y/M here if you want to have dynamic voltage scaling support
-         on the Simtec IM2440D20 (OSIRIS) module via the TPS65011.
-
-         The DVS driver alters the voltage supplied to the ARM core
-         depending on the frequency it is running at. The driver itself
-         does not do any of the frequency alteration, which is left up
-         to the cpufreq driver.
-
-config MACH_RX3715
-       bool "HP iPAQ rx3715"
-       select PM_H1940 if PM
-       select S3C2440_XTAL_16934400
-       select S3C_DEV_NAND
-       help
-         Say Y here if you are using the HP iPAQ rx3715.
-
-config ARCH_S3C2440
-       bool "SMDK2440"
-       select S3C2440_XTAL_16934400
-       select S3C24XX_SMDK
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       help
-         Say Y here if you are using the SMDK2440.
-
-config SMDK2440_CPU2440
-       bool "SMDK2440 with S3C2440 CPU module"
-       default y if ARCH_S3C2440
-       select S3C2440_XTAL_16934400
-
-endif  # CPU_S3C2440
-
-if CPU_S3C2442
-
-comment "S3C2442 Boards"
-
-#
-# The "S3C2442 Boards" list is ordered alphabetically by option text.
-# (without ARCH_ or MACH_)
-#
-
-config MACH_NEO1973_GTA02
-       bool "Openmoko GTA02 / Freerunner phone"
-       select I2C
-       select MFD_PCF50633
-       select PCF50633_GPIO
-       select POWER_SUPPLY
-       select S3C24XX_PWM
-       select S3C_DEV_USB_HOST
-       help
-          Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone
-
-config MACH_RX1950
-       bool "HP iPAQ rx1950"
-       select I2C
-       select PM_H1940 if PM
-       select S3C2410_COMMON_DCLK
-       select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
-       select S3C2440_XTAL_16934400
-       select S3C24XX_PWM
-       select S3C_DEV_NAND
-       help
-          Say Y here if you're using HP iPAQ rx1950
-
-endif  # CPU_S3C2442
-
-if CPU_S3C2443 || CPU_S3C2416
-
-config S3C2443_SETUP_SPI
-       bool
-       help
-         Common setup code for SPI GPIO configurations
-
-endif  # CPU_S3C2443 || CPU_S3C2416
-
-if CPU_S3C2443
-
-comment "S3C2443 Boards"
-
-config MACH_SMDK2443
-       bool "SMDK2443"
-       select S3C24XX_SMDK
-       select S3C_DEV_HSMMC1
-       help
-         Say Y here if you are using an SMDK2443
-
-endif  # CPU_S3C2443
-
-config PM_H1940
-       bool
-       help
-         Internal node for H1940 and related PM
-
-endmenu        # Samsung S3C24XX SoCs Support
-
-endif  # ARCH_S3C24XX
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
deleted file mode 100644 (file)
index 6692f2d..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (c) 2012 Samsung Electronics Co., Ltd.
-#              http://www.samsung.com/
-#
-# Copyright 2007 Simtec Electronics
-
-# core
-
-obj-y                          += common.o
-
-obj-$(CONFIG_CPU_S3C2410)      += s3c2410.o
-obj-$(CONFIG_S3C2410_PLL)      += pll-s3c2410.o
-obj-$(CONFIG_S3C2410_PM)       += pm-s3c2410.o sleep-s3c2410.o
-
-obj-$(CONFIG_CPU_S3C2412)      += s3c2412.o
-obj-$(CONFIG_S3C2412_PM)       += pm-s3c2412.o
-obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
-
-obj-$(CONFIG_CPU_S3C2416)      += s3c2416.o
-obj-$(CONFIG_S3C2416_PM)       += pm-s3c2416.o
-
-obj-$(CONFIG_CPU_S3C2440)      += s3c2440.o
-obj-$(CONFIG_CPU_S3C2442)      += s3c2442.o
-obj-$(CONFIG_CPU_S3C244X)      += s3c244x.o
-obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
-obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o
-
-obj-$(CONFIG_CPU_S3C2443)      += s3c2443.o
-
-# PM
-
-obj-$(CONFIG_PM)               += pm.o
-obj-$(CONFIG_PM_SLEEP)         += irq-pm.o sleep.o
-
-# common code
-
-obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o
-
-obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o
-obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
-
-#
-# machine support
-# following is ordered alphabetically by option text.
-#
-
-obj-$(CONFIG_MACH_AML_M5900)           += mach-amlm5900.o
-obj-$(CONFIG_ARCH_BAST)                        += mach-bast.o
-obj-$(CONFIG_BAST_PC104_IRQ)           += bast-irq.o
-obj-$(CONFIG_ARCH_H1940)               += mach-h1940.o
-obj-$(CONFIG_H1940BT)                  += h1940-bluetooth.o
-obj-$(CONFIG_PM_H1940)                 += pm-h1940.o
-obj-$(CONFIG_MACH_N30)                 += mach-n30.o
-obj-$(CONFIG_MACH_OTOM)                        += mach-otom.o
-obj-$(CONFIG_MACH_QT2410)              += mach-qt2410.o
-obj-$(CONFIG_ARCH_SMDK2410)            += mach-smdk2410.o
-obj-$(CONFIG_MACH_TCT_HAMMER)          += mach-tct_hammer.o
-obj-$(CONFIG_MACH_VR1000)              += mach-vr1000.o
-
-obj-$(CONFIG_MACH_JIVE)                        += mach-jive.o
-obj-$(CONFIG_MACH_SMDK2413)            += mach-smdk2413.o
-obj-$(CONFIG_MACH_VSTMS)               += mach-vstms.o
-
-obj-$(CONFIG_MACH_SMDK2416)            += mach-smdk2416.o
-obj-$(CONFIG_MACH_S3C2416_DT)          += mach-s3c2416-dt.o
-
-obj-$(CONFIG_MACH_ANUBIS)              += mach-anubis.o
-obj-$(CONFIG_MACH_AT2440EVB)           += mach-at2440evb.o
-obj-$(CONFIG_MACH_MINI2440)            += mach-mini2440.o
-obj-$(CONFIG_MACH_NEXCODER_2440)       += mach-nexcoder.o
-obj-$(CONFIG_MACH_OSIRIS)              += mach-osiris.o
-obj-$(CONFIG_MACH_RX3715)              += mach-rx3715.o
-obj-$(CONFIG_ARCH_S3C2440)             += mach-smdk2440.o
-
-obj-$(CONFIG_MACH_NEO1973_GTA02)       += mach-gta02.o
-obj-$(CONFIG_MACH_RX1950)              += mach-rx1950.o
-
-obj-$(CONFIG_MACH_SMDK2443)            += mach-smdk2443.o
-
-# common bits of machine support
-
-obj-$(CONFIG_S3C24XX_SMDK)             += common-smdk.o
-obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO)     += simtec-audio.o
-obj-$(CONFIG_S3C24XX_SIMTEC_NOR)       += simtec-nor.o
-obj-$(CONFIG_S3C24XX_SIMTEC_PM)                += simtec-pm.o
-obj-$(CONFIG_S3C24XX_SIMTEC_USB)       += simtec-usb.o
-
-# machine additions
-
-obj-$(CONFIG_MACH_BAST_IDE)            += bast-ide.o
-obj-$(CONFIG_MACH_OSIRIS_DVS)          += mach-osiris-dvs.o
-
-# device setup
-
-obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
-obj-$(CONFIG_S3C2443_SETUP_SPI)                += setup-spi.o
-obj-$(CONFIG_ARCH_S3C24XX)             += setup-i2c.o
-obj-$(CONFIG_S3C24XX_SETUP_TS)         += setup-ts.o
-obj-$(CONFIG_S3C_SETUP_CAMIF)          += setup-camif.o
diff --git a/arch/arm/mach-s3c24xx/Makefile.boot b/arch/arm/mach-s3c24xx/Makefile.boot
deleted file mode 100644 (file)
index 7f19e22..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-
-ifeq ($(CONFIG_PM_H1940),y)
-       zreladdr-y      += 0x30108000
-       params_phys-y   := 0x30100100
-else
-       zreladdr-y      += 0x30008000
-       params_phys-y   := 0x30000100
-endif
diff --git a/arch/arm/mach-s3c24xx/anubis.h b/arch/arm/mach-s3c24xx/anubis.h
deleted file mode 100644 (file)
index 1384729..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2005 Simtec Electronics
- *     http://www.simtec.co.uk/products/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * ANUBIS - CPLD control constants
- * ANUBIS - IRQ Number definitions
- * ANUBIS - Memory map definitions
- */
-
-#ifndef __MACH_S3C24XX_ANUBIS_H
-#define __MACH_S3C24XX_ANUBIS_H __FILE__
-
-/* CTRL2 - NAND WP control, IDE Reset assert/check */
-
-#define ANUBIS_CTRL1_NANDSEL           (0x3)
-
-/* IDREG - revision */
-
-#define ANUBIS_IDREG_REVMASK           (0x7)
-
-/* irq */
-
-#define ANUBIS_IRQ_IDE0                        IRQ_EINT2
-#define ANUBIS_IRQ_IDE1                        IRQ_EINT3
-#define ANUBIS_IRQ_ASIX                        IRQ_EINT1
-
-/* map */
-
-/* start peripherals off after the S3C2410 */
-
-#define ANUBIS_IOADDR(x)               (S3C2410_ADDR((x) + 0x01800000))
-
-#define ANUBIS_PA_CPLD                 (S3C2410_CS1 | (1<<26))
-
-/* we put the CPLD registers next, to get them out of the way */
-
-#define ANUBIS_VA_CTRL1                        ANUBIS_IOADDR(0x00000000)
-#define ANUBIS_PA_CTRL1                        ANUBIS_PA_CPLD
-
-#define ANUBIS_VA_IDREG                        ANUBIS_IOADDR(0x00300000)
-#define ANUBIS_PA_IDREG                        (ANUBIS_PA_CPLD + (3 << 23))
-
-#define ANUBIS_IDEPRI                  ANUBIS_IOADDR(0x01000000)
-#define ANUBIS_IDEPRIAUX               ANUBIS_IOADDR(0x01100000)
-#define ANUBIS_IDESEC                  ANUBIS_IOADDR(0x01200000)
-#define ANUBIS_IDESECAUX               ANUBIS_IOADDR(0x01300000)
-
-#endif /* __MACH_S3C24XX_ANUBIS_H */
diff --git a/arch/arm/mach-s3c24xx/bast-ide.c b/arch/arm/mach-s3c24xx/bast-ide.c
deleted file mode 100644 (file)
index 0679443..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2007 Simtec Electronics
-//     http://www.simtec.co.uk/products/EB2410ITX/
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-
-#include <linux/platform_device.h>
-#include <linux/ata_platform.h>
-
-#include <asm/mach-types.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/map.h>
-
-#include "bast.h"
-
-/* IDE ports */
-
-static struct pata_platform_info bast_ide_platdata = {
-       .ioport_shift   = 5,
-};
-
-static struct resource bast_ide0_resource[] = {
-       [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20),
-       [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20),
-       [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0),
-};
-
-static struct platform_device bast_device_ide0 = {
-       .name           = "pata_platform",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(bast_ide0_resource),
-       .resource       = bast_ide0_resource,
-       .dev            = {
-               .platform_data = &bast_ide_platdata,
-               .coherent_dma_mask = ~0,
-       }
-
-};
-
-static struct resource bast_ide1_resource[] = {
-       [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20),
-       [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20),
-       [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1),
-};
-
-static struct platform_device bast_device_ide1 = {
-       .name           = "pata_platform",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(bast_ide1_resource),
-       .resource       = bast_ide1_resource,
-       .dev            = {
-               .platform_data = &bast_ide_platdata,
-               .coherent_dma_mask = ~0,
-       }
-};
-
-static struct platform_device *bast_ide_devices[] __initdata = {
-       &bast_device_ide0,
-       &bast_device_ide1,
-};
-
-static __init int bast_ide_init(void)
-{
-       if (machine_is_bast() || machine_is_vr1000())
-               return platform_add_devices(bast_ide_devices,
-                                           ARRAY_SIZE(bast_ide_devices));
-
-       return 0;
-}
-
-fs_initcall(bast_ide_init);
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c
deleted file mode 100644 (file)
index 0372805..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright 2003-2005 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// http://www.simtec.co.uk/products/EB2410ITX/
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/ioport.h>
-#include <linux/device.h>
-#include <linux/io.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-irq.h>
-
-#include "bast.h"
-
-#define irqdbf(x...)
-#define irqdbf2(x...)
-
-/* handle PC104 ISA interrupts from the system CPLD */
-
-/* table of ISA irq nos to the relevant mask... zero means
- * the irq is not implemented
-*/
-static const unsigned char bast_pc104_irqmasks[] = {
-       0,   /* 0 */
-       0,   /* 1 */
-       0,   /* 2 */
-       1,   /* 3 */
-       0,   /* 4 */
-       2,   /* 5 */
-       0,   /* 6 */
-       4,   /* 7 */
-       0,   /* 8 */
-       0,   /* 9 */
-       8,   /* 10 */
-       0,   /* 11 */
-       0,   /* 12 */
-       0,   /* 13 */
-       0,   /* 14 */
-       0,   /* 15 */
-};
-
-static const unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 };
-
-static void
-bast_pc104_mask(struct irq_data *data)
-{
-       unsigned long temp;
-
-       temp = __raw_readb(BAST_VA_PC104_IRQMASK);
-       temp &= ~bast_pc104_irqmasks[data->irq];
-       __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
-}
-
-static void
-bast_pc104_maskack(struct irq_data *data)
-{
-       struct irq_desc *desc = irq_desc + BAST_IRQ_ISA;
-
-       bast_pc104_mask(data);
-       desc->irq_data.chip->irq_ack(&desc->irq_data);
-}
-
-static void
-bast_pc104_unmask(struct irq_data *data)
-{
-       unsigned long temp;
-
-       temp = __raw_readb(BAST_VA_PC104_IRQMASK);
-       temp |= bast_pc104_irqmasks[data->irq];
-       __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
-}
-
-static struct irq_chip  bast_pc104_chip = {
-       .irq_mask       = bast_pc104_mask,
-       .irq_unmask     = bast_pc104_unmask,
-       .irq_ack        = bast_pc104_maskack
-};
-
-static void bast_irq_pc104_demux(struct irq_desc *desc)
-{
-       unsigned int stat;
-       unsigned int irqno;
-       int i;
-
-       stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf;
-
-       if (unlikely(stat == 0)) {
-               /* ack if we get an irq with nothing (ie, startup) */
-
-               desc = irq_desc + BAST_IRQ_ISA;
-               desc->irq_data.chip->irq_ack(&desc->irq_data);
-       } else {
-               /* handle the IRQ */
-
-               for (i = 0; stat != 0; i++, stat >>= 1) {
-                       if (stat & 1) {
-                               irqno = bast_pc104_irqs[i];
-                               generic_handle_irq(irqno);
-                       }
-               }
-       }
-}
-
-static __init int bast_irq_init(void)
-{
-       unsigned int i;
-
-       if (machine_is_bast()) {
-               printk(KERN_INFO "BAST PC104 IRQ routing, Copyright 2005 Simtec Electronics\n");
-
-               /* zap all the IRQs */
-
-               __raw_writeb(0x0, BAST_VA_PC104_IRQMASK);
-
-               irq_set_chained_handler(BAST_IRQ_ISA, bast_irq_pc104_demux);
-
-               /* register our IRQs */
-
-               for (i = 0; i < 4; i++) {
-                       unsigned int irqno = bast_pc104_irqs[i];
-
-                       irq_set_chip_and_handler(irqno, &bast_pc104_chip,
-                                                handle_level_irq);
-                       irq_clear_status_flags(irqno, IRQ_NOREQUEST);
-               }
-       }
-
-       return 0;
-}
-
-arch_initcall(bast_irq_init);
diff --git a/arch/arm/mach-s3c24xx/bast.h b/arch/arm/mach-s3c24xx/bast.h
deleted file mode 100644 (file)
index a7726f9..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003-2004 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * BAST - CPLD control constants
- * BAST - IRQ Number definitions
- * BAST - Memory map definitions
- */
-
-#ifndef __MACH_S3C24XX_BAST_H
-#define __MACH_S3C24XX_BAST_H __FILE__
-
-/* CTRL1 - Audio LR routing */
-
-#define BAST_CPLD_CTRL1_LRCOFF         (0x00)
-#define BAST_CPLD_CTRL1_LRCADC         (0x01)
-#define BAST_CPLD_CTRL1_LRCDAC         (0x02)
-#define BAST_CPLD_CTRL1_LRCARM         (0x03)
-#define BAST_CPLD_CTRL1_LRMASK         (0x03)
-
-/* CTRL2 - NAND WP control, IDE Reset assert/check */
-
-#define BAST_CPLD_CTRL2_WNAND          (0x04)
-#define BAST_CPLD_CTLR2_IDERST         (0x08)
-
-/* CTRL3 - rom write control, CPLD identity */
-
-#define BAST_CPLD_CTRL3_IDMASK         (0x0e)
-#define BAST_CPLD_CTRL3_ROMWEN         (0x01)
-
-/* CTRL4 - 8bit LCD interface control/status */
-
-#define BAST_CPLD_CTRL4_LLAT           (0x01)
-#define BAST_CPLD_CTRL4_LCDRW          (0x02)
-#define BAST_CPLD_CTRL4_LCDCMD         (0x04)
-#define BAST_CPLD_CTRL4_LCDE2          (0x01)
-
-/* CTRL5 - DMA routing */
-
-#define BAST_CPLD_DMA0_PRIIDE          (0)
-#define BAST_CPLD_DMA0_SECIDE          (1)
-#define BAST_CPLD_DMA0_ISA15           (2)
-#define BAST_CPLD_DMA0_ISA36           (3)
-
-#define BAST_CPLD_DMA1_PRIIDE          (0 << 2)
-#define BAST_CPLD_DMA1_SECIDE          (1 << 2)
-#define BAST_CPLD_DMA1_ISA15           (2 << 2)
-#define BAST_CPLD_DMA1_ISA36           (3 << 2)
-
-/* irq numbers to onboard peripherals */
-
-#define BAST_IRQ_USBOC                 IRQ_EINT18
-#define BAST_IRQ_IDE0                  IRQ_EINT16
-#define BAST_IRQ_IDE1                  IRQ_EINT17
-#define BAST_IRQ_PCSERIAL1             IRQ_EINT15
-#define BAST_IRQ_PCSERIAL2             IRQ_EINT14
-#define BAST_IRQ_PCPARALLEL            IRQ_EINT13
-#define BAST_IRQ_ASIX                  IRQ_EINT11
-#define BAST_IRQ_DM9000                        IRQ_EINT10
-#define BAST_IRQ_ISA                   IRQ_EINT9
-#define BAST_IRQ_SMALERT               IRQ_EINT8
-
-/* map */
-
-/*
- * ok, we've used up to 0x13000000, now we need to find space for the
- * peripherals that live in the nGCS[x] areas, which are quite numerous
- * in their space. We also have the board's CPLD to find register space
- * for.
- */
-
-#define BAST_IOADDR(x)                 (S3C2410_ADDR((x) + 0x01300000))
-
-/* we put the CPLD registers next, to get them out of the way */
-
-#define BAST_VA_CTRL1                  BAST_IOADDR(0x00000000)
-#define BAST_PA_CTRL1                  (S3C2410_CS5 | 0x7800000)
-
-#define BAST_VA_CTRL2                  BAST_IOADDR(0x00100000)
-#define BAST_PA_CTRL2                  (S3C2410_CS1 | 0x6000000)
-
-#define BAST_VA_CTRL3                  BAST_IOADDR(0x00200000)
-#define BAST_PA_CTRL3                  (S3C2410_CS1 | 0x6800000)
-
-#define BAST_VA_CTRL4                  BAST_IOADDR(0x00300000)
-#define BAST_PA_CTRL4                  (S3C2410_CS1 | 0x7000000)
-
-/* next, we have the PC104 ISA interrupt registers */
-
-#define BAST_PA_PC104_IRQREQ           (S3C2410_CS5 | 0x6000000)
-#define BAST_VA_PC104_IRQREQ           BAST_IOADDR(0x00400000)
-
-#define BAST_PA_PC104_IRQRAW           (S3C2410_CS5 | 0x6800000)
-#define BAST_VA_PC104_IRQRAW           BAST_IOADDR(0x00500000)
-
-#define BAST_PA_PC104_IRQMASK          (S3C2410_CS5 | 0x7000000)
-#define BAST_VA_PC104_IRQMASK          BAST_IOADDR(0x00600000)
-
-#define BAST_PA_LCD_RCMD1              (0x8800000)
-#define BAST_VA_LCD_RCMD1              BAST_IOADDR(0x00700000)
-
-#define BAST_PA_LCD_WCMD1              (0x8000000)
-#define BAST_VA_LCD_WCMD1              BAST_IOADDR(0x00800000)
-
-#define BAST_PA_LCD_RDATA1             (0x9800000)
-#define BAST_VA_LCD_RDATA1             BAST_IOADDR(0x00900000)
-
-#define BAST_PA_LCD_WDATA1             (0x9000000)
-#define BAST_VA_LCD_WDATA1             BAST_IOADDR(0x00A00000)
-
-#define BAST_PA_LCD_RCMD2              (0xA800000)
-#define BAST_VA_LCD_RCMD2              BAST_IOADDR(0x00B00000)
-
-#define BAST_PA_LCD_WCMD2              (0xA000000)
-#define BAST_VA_LCD_WCMD2              BAST_IOADDR(0x00C00000)
-
-#define BAST_PA_LCD_RDATA2             (0xB800000)
-#define BAST_VA_LCD_RDATA2             BAST_IOADDR(0x00D00000)
-
-#define BAST_PA_LCD_WDATA2             (0xB000000)
-#define BAST_VA_LCD_WDATA2             BAST_IOADDR(0x00E00000)
-
-
-/*
- * 0xE0000000 contains the IO space that is split by speed and
- * whether the access is for 8 or 16bit IO... this ensures that
- * the correct access is made
- *
- * 0x10000000 of space, partitioned as so:
- *
- * 0x00000000 to 0x04000000  8bit,  slow
- * 0x04000000 to 0x08000000  16bit, slow
- * 0x08000000 to 0x0C000000  16bit, net
- * 0x0C000000 to 0x10000000  16bit, fast
- *
- * each of these spaces has the following in:
- *
- * 0x00000000 to 0x01000000 16MB ISA IO space
- * 0x01000000 to 0x02000000 16MB ISA memory space
- * 0x02000000 to 0x02100000 1MB  IDE primary channel
- * 0x02100000 to 0x02200000 1MB  IDE primary channel aux
- * 0x02200000 to 0x02400000 1MB  IDE secondary channel
- * 0x02300000 to 0x02400000 1MB  IDE secondary channel aux
- * 0x02400000 to 0x02500000 1MB  ASIX ethernet controller
- * 0x02500000 to 0x02600000 1MB  Davicom DM9000 ethernet controller
- * 0x02600000 to 0x02700000 1MB  PC SuperIO controller
- *
- * the phyiscal layout of the zones are:
- *  nGCS2 - 8bit, slow
- *  nGCS3 - 16bit, slow
- *  nGCS4 - 16bit, net
- *  nGCS5 - 16bit, fast
- */
-
-#define BAST_VA_MULTISPACE             (0xE0000000)
-
-#define BAST_VA_ISAIO                  (BAST_VA_MULTISPACE + 0x00000000)
-#define BAST_VA_ISAMEM                 (BAST_VA_MULTISPACE + 0x01000000)
-#define BAST_VA_IDEPRI                 (BAST_VA_MULTISPACE + 0x02000000)
-#define BAST_VA_IDEPRIAUX              (BAST_VA_MULTISPACE + 0x02100000)
-#define BAST_VA_IDESEC                 (BAST_VA_MULTISPACE + 0x02200000)
-#define BAST_VA_IDESECAUX              (BAST_VA_MULTISPACE + 0x02300000)
-#define BAST_VA_ASIXNET                        (BAST_VA_MULTISPACE + 0x02400000)
-#define BAST_VA_DM9000                 (BAST_VA_MULTISPACE + 0x02500000)
-#define BAST_VA_SUPERIO                        (BAST_VA_MULTISPACE + 0x02600000)
-
-#define BAST_VAM_CS2                   (0x00000000)
-#define BAST_VAM_CS3                   (0x04000000)
-#define BAST_VAM_CS4                   (0x08000000)
-#define BAST_VAM_CS5                   (0x0C000000)
-
-/* physical offset addresses for the peripherals */
-
-#define BAST_PA_ISAIO                  (0x00000000)
-#define BAST_PA_ASIXNET                        (0x01000000)
-#define BAST_PA_SUPERIO                        (0x01800000)
-#define BAST_PA_IDEPRI                 (0x02000000)
-#define BAST_PA_IDEPRIAUX              (0x02800000)
-#define BAST_PA_IDESEC                 (0x03000000)
-#define BAST_PA_IDESECAUX              (0x03800000)
-#define BAST_PA_ISAMEM                 (0x04000000)
-#define BAST_PA_DM9000                 (0x05000000)
-
-/* some configurations for the peripherals */
-
-#define BAST_PCSIO                     (BAST_VA_SUPERIO + BAST_VAM_CS2)
-
-#define BAST_ASIXNET_CS                        BAST_VAM_CS5
-#define BAST_DM9000_CS                 BAST_VAM_CS4
-
-#define BAST_IDE_CS    S3C2410_CS5
-
-#endif /* __MACH_S3C24XX_BAST_H */
diff --git a/arch/arm/mach-s3c24xx/common-smdk.c b/arch/arm/mach-s3c24xx/common-smdk.c
deleted file mode 100644 (file)
index 75064df..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Common code for SMDK2410 and SMDK2440 boards
-//
-// http://www.fluff.org/ben/smdk2440/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <asm/irq.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/leds-s3c24xx.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-
-#include "common-smdk.h"
-
-/* LED devices */
-
-static struct gpiod_lookup_table smdk_led4_gpio_table = {
-       .dev_id = "s3c24xx_led.0",
-       .table = {
-               GPIO_LOOKUP("GPF", 4, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table smdk_led5_gpio_table = {
-       .dev_id = "s3c24xx_led.1",
-       .table = {
-               GPIO_LOOKUP("GPF", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table smdk_led6_gpio_table = {
-       .dev_id = "s3c24xx_led.2",
-       .table = {
-               GPIO_LOOKUP("GPF", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table smdk_led7_gpio_table = {
-       .dev_id = "s3c24xx_led.3",
-       .table = {
-               GPIO_LOOKUP("GPF", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata smdk_pdata_led4 = {
-       .name           = "led4",
-       .def_trigger    = "timer",
-};
-
-static struct s3c24xx_led_platdata smdk_pdata_led5 = {
-       .name           = "led5",
-       .def_trigger    = "nand-disk",
-};
-
-static struct s3c24xx_led_platdata smdk_pdata_led6 = {
-       .name           = "led6",
-};
-
-static struct s3c24xx_led_platdata smdk_pdata_led7 = {
-       .name           = "led7",
-};
-
-static struct platform_device smdk_led4 = {
-       .name           = "s3c24xx_led",
-       .id             = 0,
-       .dev            = {
-               .platform_data = &smdk_pdata_led4,
-       },
-};
-
-static struct platform_device smdk_led5 = {
-       .name           = "s3c24xx_led",
-       .id             = 1,
-       .dev            = {
-               .platform_data = &smdk_pdata_led5,
-       },
-};
-
-static struct platform_device smdk_led6 = {
-       .name           = "s3c24xx_led",
-       .id             = 2,
-       .dev            = {
-               .platform_data = &smdk_pdata_led6,
-       },
-};
-
-static struct platform_device smdk_led7 = {
-       .name           = "s3c24xx_led",
-       .id             = 3,
-       .dev            = {
-               .platform_data = &smdk_pdata_led7,
-       },
-};
-
-/* NAND parititon from 2.4.18-swl5 */
-
-static struct mtd_partition smdk_default_nand_part[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_16K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "S3C2410 flash partition 1",
-               .offset = 0,
-               .size   = SZ_2M,
-       },
-       [2] = {
-               .name   = "S3C2410 flash partition 2",
-               .offset = SZ_4M,
-               .size   = SZ_4M,
-       },
-       [3] = {
-               .name   = "S3C2410 flash partition 3",
-               .offset = SZ_8M,
-               .size   = SZ_2M,
-       },
-       [4] = {
-               .name   = "S3C2410 flash partition 4",
-               .offset = SZ_1M * 10,
-               .size   = SZ_4M,
-       },
-       [5] = {
-               .name   = "S3C2410 flash partition 5",
-               .offset = SZ_1M * 14,
-               .size   = SZ_1M * 10,
-       },
-       [6] = {
-               .name   = "S3C2410 flash partition 6",
-               .offset = SZ_1M * 24,
-               .size   = SZ_1M * 24,
-       },
-       [7] = {
-               .name   = "S3C2410 flash partition 7",
-               .offset = SZ_1M * 48,
-               .size   = MTDPART_SIZ_FULL,
-       }
-};
-
-static struct s3c2410_nand_set smdk_nand_sets[] = {
-       [0] = {
-               .name           = "NAND",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(smdk_default_nand_part),
-               .partitions     = smdk_default_nand_part,
-       },
-};
-
-/* choose a set of timings which should suit most 512Mbit
- * chips and beyond.
-*/
-
-static struct s3c2410_platform_nand smdk_nand_info = {
-       .tacls          = 20,
-       .twrph0         = 60,
-       .twrph1         = 20,
-       .nr_sets        = ARRAY_SIZE(smdk_nand_sets),
-       .sets           = smdk_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-/* devices we initialise */
-
-static struct platform_device __initdata *smdk_devs[] = {
-       &s3c_device_nand,
-       &smdk_led4,
-       &smdk_led5,
-       &smdk_led6,
-       &smdk_led7,
-};
-
-void __init smdk_machine_init(void)
-{
-       if (machine_is_smdk2443())
-               smdk_nand_info.twrph0 = 50;
-
-       s3c_nand_set_platdata(&smdk_nand_info);
-
-       /* Disable pull-up on the LED lines */
-       s3c_gpio_setpull(S3C2410_GPF(4), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPF(5), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPF(6), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPF(7), S3C_GPIO_PULL_NONE);
-
-       /* Add lookups for the lines */
-       gpiod_add_lookup_table(&smdk_led4_gpio_table);
-       gpiod_add_lookup_table(&smdk_led5_gpio_table);
-       gpiod_add_lookup_table(&smdk_led6_gpio_table);
-       gpiod_add_lookup_table(&smdk_led7_gpio_table);
-
-       platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
-
-       s3c_pm_init();
-}
diff --git a/arch/arm/mach-s3c24xx/common-smdk.h b/arch/arm/mach-s3c24xx/common-smdk.h
deleted file mode 100644 (file)
index c0352b0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2006 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * Common code for SMDK2410 and SMDK2440 boards
- *
- * http://www.fluff.org/ben/smdk2440/
- */
-
-extern void smdk_machine_init(void);
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
deleted file mode 100644 (file)
index 1ec8fe2..0000000
+++ /dev/null
@@ -1,671 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2004-2005 Simtec Electronics
-//     http://www.simtec.co.uk/products/SWLINUX/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Common code for S3C24XX machines
-
-#include <linux/dma-mapping.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <clocksource/samsung_pwm.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/platform_data/dma-s3c24xx.h>
-#include <linux/dmaengine.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
-#include <asm/irq.h>
-#include <asm/cacheflush.h>
-#include <asm/system_info.h>
-#include <asm/system_misc.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/dma.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/cpu-freq.h>
-#include <plat/pwm-core.h>
-
-#include "common.h"
-
-/* table of supported CPUs */
-
-static const char name_s3c2410[]  = "S3C2410";
-static const char name_s3c2412[]  = "S3C2412";
-static const char name_s3c2416[]  = "S3C2416/S3C2450";
-static const char name_s3c2440[]  = "S3C2440";
-static const char name_s3c2442[]  = "S3C2442";
-static const char name_s3c2442b[]  = "S3C2442B";
-static const char name_s3c2443[]  = "S3C2443";
-static const char name_s3c2410a[] = "S3C2410A";
-static const char name_s3c2440a[] = "S3C2440A";
-
-static struct cpu_table cpu_ids[] __initdata = {
-       {
-               .idcode         = 0x32410000,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2410_map_io,
-               .init_uarts     = s3c2410_init_uarts,
-               .init           = s3c2410_init,
-               .name           = name_s3c2410
-       },
-       {
-               .idcode         = 0x32410002,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2410_map_io,
-               .init_uarts     = s3c2410_init_uarts,
-               .init           = s3c2410a_init,
-               .name           = name_s3c2410a
-       },
-       {
-               .idcode         = 0x32440000,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2440_map_io,
-               .init_uarts     = s3c244x_init_uarts,
-               .init           = s3c2440_init,
-               .name           = name_s3c2440
-       },
-       {
-               .idcode         = 0x32440001,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2440_map_io,
-               .init_uarts     = s3c244x_init_uarts,
-               .init           = s3c2440_init,
-               .name           = name_s3c2440a
-       },
-       {
-               .idcode         = 0x32440aaa,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2442_map_io,
-               .init_uarts     = s3c244x_init_uarts,
-               .init           = s3c2442_init,
-               .name           = name_s3c2442
-       },
-       {
-               .idcode         = 0x32440aab,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2442_map_io,
-               .init_uarts     = s3c244x_init_uarts,
-               .init           = s3c2442_init,
-               .name           = name_s3c2442b
-       },
-       {
-               .idcode         = 0x32412001,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2412_map_io,
-               .init_uarts     = s3c2412_init_uarts,
-               .init           = s3c2412_init,
-               .name           = name_s3c2412,
-       },
-       {                       /* a newer version of the s3c2412 */
-               .idcode         = 0x32412003,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2412_map_io,
-               .init_uarts     = s3c2412_init_uarts,
-               .init           = s3c2412_init,
-               .name           = name_s3c2412,
-       },
-       {                       /* a strange version of the s3c2416 */
-               .idcode         = 0x32450003,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2416_map_io,
-               .init_uarts     = s3c2416_init_uarts,
-               .init           = s3c2416_init,
-               .name           = name_s3c2416,
-       },
-       {
-               .idcode         = 0x32443001,
-               .idmask         = 0xffffffff,
-               .map_io         = s3c2443_map_io,
-               .init_uarts     = s3c2443_init_uarts,
-               .init           = s3c2443_init,
-               .name           = name_s3c2443,
-       },
-};
-
-/* minimal IO mapping */
-
-static struct map_desc s3c_iodesc[] __initdata __maybe_unused = {
-       IODESC_ENT(GPIO),
-       IODESC_ENT(IRQ),
-       IODESC_ENT(MEMCTRL),
-       IODESC_ENT(UART)
-};
-
-/* read cpu identificaiton code */
-
-static unsigned long s3c24xx_read_idcode_v5(void)
-{
-#if defined(CONFIG_CPU_S3C2416)
-       /* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */
-
-       u32 gs = __raw_readl(S3C24XX_GSTATUS1);
-
-       /* test for s3c2416 or similar device */
-       if ((gs >> 16) == 0x3245)
-               return gs;
-#endif
-
-#if defined(CONFIG_CPU_S3C2412)
-       return __raw_readl(S3C2412_GSTATUS1);
-#else
-       return 1UL;     /* don't look like an 2400 */
-#endif
-}
-
-static unsigned long s3c24xx_read_idcode_v4(void)
-{
-       return __raw_readl(S3C2410_GSTATUS1);
-}
-
-static void s3c24xx_default_idle(void)
-{
-       unsigned long tmp = 0;
-       int i;
-
-       /* idle the system by using the idle mode which will wait for an
-        * interrupt to happen before restarting the system.
-        */
-
-       /* Warning: going into idle state upsets jtag scanning */
-
-       __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
-                    S3C2410_CLKCON);
-
-       /* the samsung port seems to do a loop and then unset idle.. */
-       for (i = 0; i < 50; i++)
-               tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
-
-       /* this bit is not cleared on re-start... */
-
-       __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
-                    S3C2410_CLKCON);
-}
-
-static struct samsung_pwm_variant s3c24xx_pwm_variant = {
-       .bits           = 16,
-       .div_base       = 1,
-       .has_tint_cstat = false,
-       .tclk_mask      = (1 << 4),
-};
-
-void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
-{
-       arm_pm_idle = s3c24xx_default_idle;
-
-       /* initialise the io descriptors we need for initialisation */
-       iotable_init(mach_desc, size);
-       iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
-
-       if (cpu_architecture() >= CPU_ARCH_ARMv5) {
-               samsung_cpu_id = s3c24xx_read_idcode_v5();
-       } else {
-               samsung_cpu_id = s3c24xx_read_idcode_v4();
-       }
-
-       s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
-
-       samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
-}
-
-void __init samsung_set_timer_source(unsigned int event, unsigned int source)
-{
-       s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
-       s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
-}
-
-void __init samsung_timer_init(void)
-{
-       unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
-               IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
-       };
-
-       samsung_pwm_clocksource_init(S3C_VA_TIMER,
-                                       timer_irqs, &s3c24xx_pwm_variant);
-}
-
-/* Serial port registrations */
-
-#define S3C2410_PA_UART0      (S3C24XX_PA_UART)
-#define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
-#define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
-#define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )
-
-static struct resource s3c2410_uart0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
-       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
-                       IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
-                       NULL, IORESOURCE_IRQ)
-};
-
-static struct resource s3c2410_uart1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
-       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
-                       IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
-                       NULL, IORESOURCE_IRQ)
-};
-
-static struct resource s3c2410_uart2_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
-       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
-                       IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
-                       NULL, IORESOURCE_IRQ)
-};
-
-static struct resource s3c2410_uart3_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
-       [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
-                       IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
-                       NULL, IORESOURCE_IRQ)
-};
-
-struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
-       [0] = {
-               .resources      = s3c2410_uart0_resource,
-               .nr_resources   = ARRAY_SIZE(s3c2410_uart0_resource),
-       },
-       [1] = {
-               .resources      = s3c2410_uart1_resource,
-               .nr_resources   = ARRAY_SIZE(s3c2410_uart1_resource),
-       },
-       [2] = {
-               .resources      = s3c2410_uart2_resource,
-               .nr_resources   = ARRAY_SIZE(s3c2410_uart2_resource),
-       },
-       [3] = {
-               .resources      = s3c2410_uart3_resource,
-               .nr_resources   = ARRAY_SIZE(s3c2410_uart3_resource),
-       },
-};
-
-#define s3c24xx_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
-
-#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
-       defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
-static struct resource s3c2410_dma_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
-       [1] = DEFINE_RES_IRQ(IRQ_DMA0),
-       [2] = DEFINE_RES_IRQ(IRQ_DMA1),
-       [3] = DEFINE_RES_IRQ(IRQ_DMA2),
-       [4] = DEFINE_RES_IRQ(IRQ_DMA3),
-};
-#endif
-
-#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
-static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
-       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
-       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
-       [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
-                                               S3C24XX_DMA_CHANREQ(2, 2) |
-                                               S3C24XX_DMA_CHANREQ(1, 3),
-       },
-       [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
-       [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
-       [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
-       [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
-       [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
-       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
-                                                S3C24XX_DMA_CHANREQ(3, 2) |
-                                                S3C24XX_DMA_CHANREQ(3, 3),
-       },
-       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
-                                                 S3C24XX_DMA_CHANREQ(1, 2),
-       },
-       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
-       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
-       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
-       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
-       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
-};
-
-static const struct dma_slave_map s3c2410_dma_slave_map[] = {
-       { "s3c2410-sdi", "rx-tx", (void *)DMACH_SDI },
-       { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0_RX },
-       { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0_TX },
-       { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1_RX },
-       { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1_TX },
-       /*
-        * The DMA request source[1] (DMACH_UARTx_SRC2) are
-        * not used in the UART driver.
-        */
-       { "s3c2410-uart.0", "rx", (void *)DMACH_UART0 },
-       { "s3c2410-uart.0", "tx", (void *)DMACH_UART0 },
-       { "s3c2410-uart.1", "rx", (void *)DMACH_UART1 },
-       { "s3c2410-uart.1", "tx", (void *)DMACH_UART1 },
-       { "s3c2410-uart.2", "rx", (void *)DMACH_UART2 },
-       { "s3c2410-uart.2", "tx", (void *)DMACH_UART2 },
-       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
-       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
-       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
-       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
-       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
-       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
-       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
-       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
-       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
-       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
-};
-
-static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
-       .num_phy_channels = 4,
-       .channels = s3c2410_dma_channels,
-       .num_channels = DMACH_MAX,
-       .slave_map = s3c2410_dma_slave_map,
-       .slavecnt = ARRAY_SIZE(s3c2410_dma_slave_map),
-};
-
-struct platform_device s3c2410_device_dma = {
-       .name           = "s3c2410-dma",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
-       .resource       = s3c2410_dma_resource,
-       .dev    = {
-               .dma_mask = &s3c24xx_device_dma_mask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &s3c2410_dma_platdata,
-       },
-};
-#endif
-
-#ifdef CONFIG_CPU_S3C2412
-static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
-       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
-       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
-       [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
-       [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
-       [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
-       [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
-       [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
-       [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
-       [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
-       [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
-       [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
-       [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
-       [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
-       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
-       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
-       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
-       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
-       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
-       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
-       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
-};
-
-static const struct dma_slave_map s3c2412_dma_slave_map[] = {
-       { "s3c2412-sdi", "rx-tx", (void *)DMACH_SDI },
-       { "s3c2412-spi.0", "rx", (void *)DMACH_SPI0_RX },
-       { "s3c2412-spi.0", "tx", (void *)DMACH_SPI0_TX },
-       { "s3c2412-spi.1", "rx", (void *)DMACH_SPI1_RX },
-       { "s3c2412-spi.1", "tx", (void *)DMACH_SPI1_TX },
-       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
-       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
-       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
-       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
-       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
-       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
-       { "s3c2412-iis", "rx", (void *)DMACH_I2S_IN },
-       { "s3c2412-iis", "tx", (void *)DMACH_I2S_OUT },
-       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
-       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
-       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
-       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
-       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
-       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
-       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
-       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
-};
-
-static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
-       .num_phy_channels = 4,
-       .channels = s3c2412_dma_channels,
-       .num_channels = DMACH_MAX,
-       .slave_map = s3c2412_dma_slave_map,
-       .slavecnt = ARRAY_SIZE(s3c2412_dma_slave_map),
-};
-
-struct platform_device s3c2412_device_dma = {
-       .name           = "s3c2412-dma",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
-       .resource       = s3c2410_dma_resource,
-       .dev    = {
-               .dma_mask = &s3c24xx_device_dma_mask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &s3c2412_dma_platdata,
-       },
-};
-#endif
-
-#if defined(CONFIG_CPU_S3C2440)
-static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
-       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
-       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
-       [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
-                                               S3C24XX_DMA_CHANREQ(6, 1) |
-                                               S3C24XX_DMA_CHANREQ(2, 2) |
-                                               S3C24XX_DMA_CHANREQ(1, 3),
-       },
-       [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
-       [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
-       [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
-       [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
-       [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
-       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
-                                                S3C24XX_DMA_CHANREQ(3, 2) |
-                                                S3C24XX_DMA_CHANREQ(3, 3),
-       },
-       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
-                                                 S3C24XX_DMA_CHANREQ(1, 2),
-       },
-       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
-                                                  S3C24XX_DMA_CHANREQ(0, 2),
-       },
-       [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
-                                                 S3C24XX_DMA_CHANREQ(5, 2),
-       },
-       [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
-                                                 S3C24XX_DMA_CHANREQ(6, 3),
-       },
-       [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
-                                                 S3C24XX_DMA_CHANREQ(5, 3),
-       },
-       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
-       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
-       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
-       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
-};
-
-static const struct dma_slave_map s3c2440_dma_slave_map[] = {
-       /* TODO: DMACH_XD0 */
-       /* TODO: DMACH_XD1 */
-       { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
-       { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0 },
-       { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0 },
-       { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1 },
-       { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1 },
-       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
-       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
-       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
-       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
-       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
-       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
-       { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
-       { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
-       /* TODO: DMACH_TIMER */
-       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
-       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
-       { "samsung-ac97", "rx", (void *)DMACH_PCM_IN },
-       { "samsung-ac97", "tx", (void *)DMACH_PCM_OUT },
-       { "samsung-ac97", "rx", (void *)DMACH_MIC_IN },
-       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
-       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
-       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
-       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
-       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
-       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
-       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
-       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
-};
-
-static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
-       .num_phy_channels = 4,
-       .channels = s3c2440_dma_channels,
-       .num_channels = DMACH_MAX,
-       .slave_map = s3c2440_dma_slave_map,
-       .slavecnt = ARRAY_SIZE(s3c2440_dma_slave_map),
-};
-
-struct platform_device s3c2440_device_dma = {
-       .name           = "s3c2410-dma",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
-       .resource       = s3c2410_dma_resource,
-       .dev    = {
-               .dma_mask = &s3c24xx_device_dma_mask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &s3c2440_dma_platdata,
-       },
-};
-#endif
-
-#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
-static struct resource s3c2443_dma_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
-       [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
-       [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
-       [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
-       [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
-       [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
-       [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
-};
-
-static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
-       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
-       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
-       [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
-       [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
-       [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
-       [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
-       [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
-       [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
-       [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
-       [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
-       [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
-       [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
-       [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
-       [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
-       [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
-       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
-       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
-       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
-       [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
-       [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
-       [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
-};
-
-static const struct dma_slave_map s3c2443_dma_slave_map[] = {
-       { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
-       { "s3c2443-spi.0", "rx", (void *)DMACH_SPI0_RX },
-       { "s3c2443-spi.0", "tx", (void *)DMACH_SPI0_TX },
-       { "s3c2443-spi.1", "rx", (void *)DMACH_SPI1_RX },
-       { "s3c2443-spi.1", "tx", (void *)DMACH_SPI1_TX },
-       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
-       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
-       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
-       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
-       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
-       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
-       { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
-       { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
-       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
-       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
-};
-
-static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
-       .num_phy_channels = 6,
-       .channels = s3c2443_dma_channels,
-       .num_channels = DMACH_MAX,
-       .slave_map = s3c2443_dma_slave_map,
-       .slavecnt = ARRAY_SIZE(s3c2443_dma_slave_map),
-};
-
-struct platform_device s3c2443_device_dma = {
-       .name           = "s3c2443-dma",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c2443_dma_resource),
-       .resource       = s3c2443_dma_resource,
-       .dev    = {
-               .dma_mask = &s3c24xx_device_dma_mask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &s3c2443_dma_platdata,
-       },
-};
-#endif
-
-#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
-void __init s3c2410_init_clocks(int xtal)
-{
-       s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2412
-void __init s3c2412_init_clocks(int xtal)
-{
-       s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2416
-void __init s3c2416_init_clocks(int xtal)
-{
-       s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
-}
-#endif
-
-#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
-void __init s3c2440_init_clocks(int xtal)
-{
-       s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
-}
-#endif
-
-#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
-void __init s3c2442_init_clocks(int xtal)
-{
-       s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2443
-void __init s3c2443_init_clocks(int xtal)
-{
-       s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
-}
-#endif
-
-#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
-       defined(CONFIG_CPU_S3C2442)
-static struct resource s3c2410_dclk_resource[] = {
-       [0] = DEFINE_RES_MEM(0x56000084, 0x4),
-};
-
-struct platform_device s3c2410_device_dclk = {
-       .name           = "s3c2410-dclk",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c2410_dclk_resource),
-       .resource       = s3c2410_dclk_resource,
-};
-#endif
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
deleted file mode 100644 (file)
index d087b20..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * Common Header for S3C24XX SoCs
- */
-
-#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H
-#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__
-
-#include <linux/reboot.h>
-
-struct s3c2410_uartcfg;
-
-#ifdef CONFIG_CPU_S3C2410
-extern  int s3c2410_init(void);
-extern  int s3c2410a_init(void);
-extern void s3c2410_map_io(void);
-extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
-extern void s3c2410_init_clocks(int xtal);
-extern void s3c2410_init_irq(void);
-#else
-#define s3c2410_init_clocks NULL
-#define s3c2410_init_uarts NULL
-#define s3c2410_map_io NULL
-#define s3c2410_init NULL
-#define s3c2410a_init NULL
-#endif
-
-#ifdef CONFIG_CPU_S3C2412
-extern  int s3c2412_init(void);
-extern void s3c2412_map_io(void);
-extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
-extern void s3c2412_init_clocks(int xtal);
-extern  int s3c2412_baseclk_add(void);
-extern void s3c2412_init_irq(void);
-#else
-#define s3c2412_init_clocks NULL
-#define s3c2412_init_uarts NULL
-#define s3c2412_map_io NULL
-#define s3c2412_init NULL
-#endif
-
-#ifdef CONFIG_CPU_S3C2416
-extern  int s3c2416_init(void);
-extern void s3c2416_map_io(void);
-extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no);
-extern void s3c2416_init_clocks(int xtal);
-extern  int s3c2416_baseclk_add(void);
-extern void s3c2416_init_irq(void);
-
-extern struct syscore_ops s3c2416_irq_syscore_ops;
-#else
-#define s3c2416_init_clocks NULL
-#define s3c2416_init_uarts NULL
-#define s3c2416_map_io NULL
-#define s3c2416_init NULL
-#endif
-
-#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
-extern void s3c244x_map_io(void);
-extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
-#else
-#define s3c244x_init_uarts NULL
-#endif
-
-#ifdef CONFIG_CPU_S3C2440
-extern  int s3c2440_init(void);
-extern void s3c2440_map_io(void);
-extern void s3c2440_init_clocks(int xtal);
-extern void s3c2440_init_irq(void);
-#else
-#define s3c2440_init NULL
-#define s3c2440_map_io NULL
-#endif
-
-#ifdef CONFIG_CPU_S3C2442
-extern  int s3c2442_init(void);
-extern void s3c2442_map_io(void);
-extern void s3c2442_init_clocks(int xtal);
-extern void s3c2442_init_irq(void);
-#else
-#define s3c2442_init NULL
-#define s3c2442_map_io NULL
-#endif
-
-#ifdef CONFIG_CPU_S3C2443
-extern  int s3c2443_init(void);
-extern void s3c2443_map_io(void);
-extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
-extern void s3c2443_init_clocks(int xtal);
-extern  int s3c2443_baseclk_add(void);
-extern void s3c2443_init_irq(void);
-#else
-#define s3c2443_init_clocks NULL
-#define s3c2443_init_uarts NULL
-#define s3c2443_map_io NULL
-#define s3c2443_init NULL
-#endif
-
-extern struct syscore_ops s3c24xx_irq_syscore_ops;
-
-extern struct platform_device s3c2410_device_dma;
-extern struct platform_device s3c2412_device_dma;
-extern struct platform_device s3c2440_device_dma;
-extern struct platform_device s3c2443_device_dma;
-
-extern struct platform_device s3c2410_device_dclk;
-
-#ifdef CONFIG_S3C2410_COMMON_CLK
-void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
-                                   int current_soc,
-                                   void __iomem *reg_base);
-#endif
-#ifdef CONFIG_S3C2412_COMMON_CLK
-void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
-                               unsigned long ext_f, void __iomem *reg_base);
-#endif
-#ifdef CONFIG_S3C2443_COMMON_CLK
-void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
-                                   int current_soc,
-                                   void __iomem *reg_base);
-#endif
-
-#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c
deleted file mode 100644 (file)
index 1a7f38d..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2009 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C24XX CPU Frequency scaling - utils for S3C2410/S3C2440/S3C2442
-
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/cpufreq.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-
-#include <plat/cpu-freq-core.h>
-
-#include "regs-mem.h"
-
-/**
- * s3c2410_cpufreq_setrefresh - set SDRAM refresh value
- * @cfg: The frequency configuration
- *
- * Set the SDRAM refresh value appropriately for the configured
- * frequency.
- */
-void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
-{
-       struct s3c_cpufreq_board *board = cfg->board;
-       unsigned long refresh;
-       unsigned long refval;
-
-       /* Reduce both the refresh time (in ns) and the frequency (in MHz)
-        * down to ensure that we do not overflow 32 bit numbers.
-        *
-        * This should work for HCLK up to 133MHz and refresh period up
-        * to 30usec.
-        */
-
-       refresh = (cfg->freq.hclk / 100) * (board->refresh / 10);
-       refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale  */
-       refresh = (1 << 11) + 1 - refresh;
-
-       s3c_freq_dbg("%s: refresh value %lu\n", __func__, refresh);
-
-       refval = __raw_readl(S3C2410_REFRESH);
-       refval &= ~((1 << 12) - 1);
-       refval |= refresh;
-       __raw_writel(refval, S3C2410_REFRESH);
-}
-
-/**
- * s3c2410_set_fvco - set the PLL value
- * @cfg: The frequency configuration
- */
-void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
-{
-       if (!IS_ERR(cfg->mpll))
-               clk_set_rate(cfg->mpll, cfg->pll.frequency);
-}
diff --git a/arch/arm/mach-s3c24xx/fb-core.h b/arch/arm/mach-s3c24xx/fb-core.h
deleted file mode 100644 (file)
index 1821e82..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2010 Samsung Electronics Co., Ltd.
- *     Pawel Osciak <p.osciak@samsung.com>
- *
- * Samsung framebuffer driver core functions
- */
-#ifndef __ASM_PLAT_FB_CORE_H
-#define __ASM_PLAT_FB_CORE_H __FILE__
-
-/*
- * These functions are only for use with the core support code, such as
- * the CPU-specific initialization code.
- */
-
-/* Re-define device name depending on support. */
-static inline void s3c_fb_setname(char *name)
-{
-#ifdef CONFIG_S3C_DEV_FB
-       s3c_device_fb.name = name;
-#endif
-}
-
-#endif /* __ASM_PLAT_FB_CORE_H */
diff --git a/arch/arm/mach-s3c24xx/gta02.h b/arch/arm/mach-s3c24xx/gta02.h
deleted file mode 100644 (file)
index d5610ba..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * GTA02 header
- */
-
-#ifndef __MACH_S3C24XX_GTA02_H
-#define __MACH_S3C24XX_GTA02_H __FILE__
-
-#include <mach/regs-gpio.h>
-
-#define GTA02_GPIO_AUX_LED     S3C2410_GPB(2)
-#define GTA02_GPIO_USB_PULLUP  S3C2410_GPB(9)
-#define GTA02_GPIO_AUX_KEY     S3C2410_GPF(6)
-#define GTA02_GPIO_HOLD_KEY    S3C2410_GPF(7)
-#define GTA02_GPIO_AMP_SHUT    S3C2410_GPJ(1)  /* v2 + v3 + v4 only */
-#define GTA02_GPIO_HP_IN       S3C2410_GPJ(2)  /* v2 + v3 + v4 only */
-
-#define GTA02_IRQ_PCF50633     IRQ_EINT9
-
-#endif /* __MACH_S3C24XX_GTA02_H */
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
deleted file mode 100644 (file)
index 186b532..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-// SPDX-License-Identifier: GPL-1.0+
-//
-// Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org>
-//
-//         S3C2410 bluetooth "driver"
-
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/string.h>
-#include <linux/ctype.h>
-#include <linux/leds.h>
-#include <linux/gpio.h>
-#include <linux/rfkill.h>
-
-#include <plat/gpio-cfg.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include "h1940.h"
-
-#define DRV_NAME "h1940-bt"
-
-/* Bluetooth control */
-static void h1940bt_enable(int on)
-{
-       if (on) {
-               /* Power on the chip */
-               gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1);
-               /* Reset the chip */
-               mdelay(10);
-
-               gpio_set_value(S3C2410_GPH(1), 1);
-               mdelay(10);
-               gpio_set_value(S3C2410_GPH(1), 0);
-
-               h1940_led_blink_set(NULL, GPIO_LED_BLINK, NULL, NULL);
-       }
-       else {
-               gpio_set_value(S3C2410_GPH(1), 1);
-               mdelay(10);
-               gpio_set_value(S3C2410_GPH(1), 0);
-               mdelay(10);
-               gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
-
-               h1940_led_blink_set(NULL, GPIO_LED_NO_BLINK_LOW, NULL, NULL);
-       }
-}
-
-static int h1940bt_set_block(void *data, bool blocked)
-{
-       h1940bt_enable(!blocked);
-       return 0;
-}
-
-static const struct rfkill_ops h1940bt_rfkill_ops = {
-       .set_block = h1940bt_set_block,
-};
-
-static int h1940bt_probe(struct platform_device *pdev)
-{
-       struct rfkill *rfk;
-       int ret = 0;
-
-       ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev));
-       if (ret) {
-               dev_err(&pdev->dev, "could not get GPH1\n");
-               return ret;
-       }
-
-       ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(&pdev->dev));
-       if (ret) {
-               gpio_free(S3C2410_GPH(1));
-               dev_err(&pdev->dev, "could not get BT_POWER\n");
-               return ret;
-       }
-
-       /* Configures BT serial port GPIOs */
-       s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
-       s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
-       s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
-       s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
-       s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
-       s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
-       s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
-       s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
-
-       rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
-                       &h1940bt_rfkill_ops, NULL);
-       if (!rfk) {
-               ret = -ENOMEM;
-               goto err_rfk_alloc;
-       }
-
-       ret = rfkill_register(rfk);
-       if (ret)
-               goto err_rfkill;
-
-       platform_set_drvdata(pdev, rfk);
-
-       return 0;
-
-err_rfkill:
-       rfkill_destroy(rfk);
-err_rfk_alloc:
-       return ret;
-}
-
-static int h1940bt_remove(struct platform_device *pdev)
-{
-       struct rfkill *rfk = platform_get_drvdata(pdev);
-
-       platform_set_drvdata(pdev, NULL);
-       gpio_free(S3C2410_GPH(1));
-
-       if (rfk) {
-               rfkill_unregister(rfk);
-               rfkill_destroy(rfk);
-       }
-       rfk = NULL;
-
-       h1940bt_enable(0);
-
-       return 0;
-}
-
-
-static struct platform_driver h1940bt_driver = {
-       .driver         = {
-               .name   = DRV_NAME,
-       },
-       .probe          = h1940bt_probe,
-       .remove         = h1940bt_remove,
-};
-
-module_platform_driver(h1940bt_driver);
-
-MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
-MODULE_DESCRIPTION("Driver for the iPAQ H1940 bluetooth chip");
-MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-s3c24xx/h1940.h b/arch/arm/mach-s3c24xx/h1940.h
deleted file mode 100644 (file)
index 5dfe9d1..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2006 Ben Dooks <ben-linux@fluff.org>
- *
- * Copyright (c) 2005 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * iPAQ H1940 series definitions
- */
-
-#ifndef __MACH_S3C24XX_H1940_H
-#define __MACH_S3C24XX_H1940_H __FILE__
-
-#define H1940_SUSPEND_CHECKSUM         (0x30003ff8)
-#define H1940_SUSPEND_RESUMEAT         (0x30081000)
-#define H1940_SUSPEND_CHECK            (0x30080000)
-
-struct gpio_desc;
-
-extern void h1940_pm_return(void);
-extern int h1940_led_blink_set(struct gpio_desc *desc, int state,
-                              unsigned long *delay_on,
-                              unsigned long *delay_off);
-
-#include <linux/gpio.h>
-
-#define H1940_LATCH_GPIO(x)            (S3C_GPIO_END + (x))
-
-/* SD layer latch */
-
-#define H1940_LATCH_LCD_P0             H1940_LATCH_GPIO(0)
-#define H1940_LATCH_LCD_P1             H1940_LATCH_GPIO(1)
-#define H1940_LATCH_LCD_P2             H1940_LATCH_GPIO(2)
-#define H1940_LATCH_LCD_P3             H1940_LATCH_GPIO(3)
-#define H1940_LATCH_MAX1698_nSHUTDOWN  H1940_LATCH_GPIO(4)
-#define H1940_LATCH_LED_RED            H1940_LATCH_GPIO(5)
-#define H1940_LATCH_SDQ7               H1940_LATCH_GPIO(6)
-#define H1940_LATCH_USB_DP             H1940_LATCH_GPIO(7)
-
-/* CPU layer latch */
-
-#define H1940_LATCH_UDA_POWER          H1940_LATCH_GPIO(8)
-#define H1940_LATCH_AUDIO_POWER                H1940_LATCH_GPIO(9)
-#define H1940_LATCH_SM803_ENABLE       H1940_LATCH_GPIO(10)
-#define H1940_LATCH_LCD_P4             H1940_LATCH_GPIO(11)
-#define H1940_LATCH_SD_POWER           H1940_LATCH_GPIO(12)
-#define H1940_LATCH_BLUETOOTH_POWER    H1940_LATCH_GPIO(13)
-#define H1940_LATCH_LED_GREEN          H1940_LATCH_GPIO(14)
-#define H1940_LATCH_LED_FLASH          H1940_LATCH_GPIO(15)
-
-#endif /* __MACH_S3C24XX_H1940_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/dma.h b/arch/arm/mach-s3c24xx/include/mach/dma.h
deleted file mode 100644 (file)
index 25fc9c2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2003-2006 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * Samsung S3C24XX DMA support
- */
-
-#ifndef __ASM_ARCH_DMA_H
-#define __ASM_ARCH_DMA_H __FILE__
-
-#include <linux/device.h>
-
-/* We use `virtual` dma channels to hide the fact we have only a limited
- * number of DMA channels, and not of all of them (dependent on the device)
- * can be attached to any DMA source. We therefore let the DMA core handle
- * the allocation of hardware channels to clients.
-*/
-
-enum dma_ch {
-       DMACH_XD0 = 0,
-       DMACH_XD1,
-       DMACH_SDI,
-       DMACH_SPI0,
-       DMACH_SPI1,
-       DMACH_UART0,
-       DMACH_UART1,
-       DMACH_UART2,
-       DMACH_TIMER,
-       DMACH_I2S_IN,
-       DMACH_I2S_OUT,
-       DMACH_PCM_IN,
-       DMACH_PCM_OUT,
-       DMACH_MIC_IN,
-       DMACH_USB_EP1,
-       DMACH_USB_EP2,
-       DMACH_USB_EP3,
-       DMACH_USB_EP4,
-       DMACH_UART0_SRC2,       /* s3c2412 second uart sources */
-       DMACH_UART1_SRC2,
-       DMACH_UART2_SRC2,
-       DMACH_UART3,            /* s3c2443 has extra uart */
-       DMACH_UART3_SRC2,
-       DMACH_SPI0_TX,          /* s3c2443/2416/2450 hsspi0 */
-       DMACH_SPI0_RX,          /* s3c2443/2416/2450 hsspi0 */
-       DMACH_SPI1_TX,          /* s3c2443/2450 hsspi1 */
-       DMACH_SPI1_RX,          /* s3c2443/2450 hsspi1 */
-       DMACH_MAX,              /* the end entry */
-};
-
-#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/fb.h b/arch/arm/mach-s3c24xx/include/mach/fb.h
deleted file mode 100644 (file)
index 4e539cb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <plat/fb-s3c2410.h>
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h b/arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h
deleted file mode 100644 (file)
index 2ad22b2..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - GPIO lib support
- */
-
-/* some boards require extra gpio capacity to support external
- * devices that need GPIO.
- */
-
-#ifndef GPIO_SAMSUNG_S3C24XX_H
-#define GPIO_SAMSUNG_S3C24XX_H
-
-/*
- * GPIO sizes for various SoCs:
- *
- *   2410 2412 2440 2443 2416
- *             2442
- *   ---- ---- ---- ---- ----
- * A  23   22   25   16   27
- * B  11   11   11   11   11
- * C  16   16   16   16   16
- * D  16   16   16   16   16
- * E  16   16   16   16   16
- * F  8    8    8    8    8
- * G  16   16   16   16   8
- * H  11   11   11   15   15
- * J  --   --   13   16   --
- * K  --   --   --   --   16
- * L  --   --   --   15   14
- * M  --   --   --   2    2
- */
-
-/* GPIO bank sizes */
-
-#define S3C2410_GPIO_A_NR      (32)
-#define S3C2410_GPIO_B_NR      (32)
-#define S3C2410_GPIO_C_NR      (32)
-#define S3C2410_GPIO_D_NR      (32)
-#define S3C2410_GPIO_E_NR      (32)
-#define S3C2410_GPIO_F_NR      (32)
-#define S3C2410_GPIO_G_NR      (32)
-#define S3C2410_GPIO_H_NR      (32)
-#define S3C2410_GPIO_J_NR      (32)    /* technically 16. */
-#define S3C2410_GPIO_K_NR      (32)    /* technically 16. */
-#define S3C2410_GPIO_L_NR      (32)    /* technically 15. */
-#define S3C2410_GPIO_M_NR      (32)    /* technically 2. */
-
-#if CONFIG_S3C_GPIO_SPACE != 0
-#error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
-#endif
-
-#define S3C2410_GPIO_NEXT(__gpio) \
-       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0)
-
-#ifndef __ASSEMBLY__
-
-enum s3c_gpio_number {
-       S3C2410_GPIO_A_START = 0,
-       S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A),
-       S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B),
-       S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C),
-       S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D),
-       S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
-       S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
-       S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
-       S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
-       S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J),
-       S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K),
-       S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L),
-};
-
-#endif /* __ASSEMBLY__ */
-
-/* S3C2410 GPIO number definitions. */
-
-#define S3C2410_GPA(_nr)       (S3C2410_GPIO_A_START + (_nr))
-#define S3C2410_GPB(_nr)       (S3C2410_GPIO_B_START + (_nr))
-#define S3C2410_GPC(_nr)       (S3C2410_GPIO_C_START + (_nr))
-#define S3C2410_GPD(_nr)       (S3C2410_GPIO_D_START + (_nr))
-#define S3C2410_GPE(_nr)       (S3C2410_GPIO_E_START + (_nr))
-#define S3C2410_GPF(_nr)       (S3C2410_GPIO_F_START + (_nr))
-#define S3C2410_GPG(_nr)       (S3C2410_GPIO_G_START + (_nr))
-#define S3C2410_GPH(_nr)       (S3C2410_GPIO_H_START + (_nr))
-#define S3C2410_GPJ(_nr)       (S3C2410_GPIO_J_START + (_nr))
-#define S3C2410_GPK(_nr)       (S3C2410_GPIO_K_START + (_nr))
-#define S3C2410_GPL(_nr)       (S3C2410_GPIO_L_START + (_nr))
-#define S3C2410_GPM(_nr)       (S3C2410_GPIO_M_START + (_nr))
-
-#ifdef CONFIG_CPU_S3C244X
-#define S3C_GPIO_END   (S3C2410_GPJ(0) + 32)
-#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
-#define S3C_GPIO_END   (S3C2410_GPM(0) + 32)
-#else
-#define S3C_GPIO_END   (S3C2410_GPH(0) + 32)
-#endif
-
-#endif /* GPIO_SAMSUNG_S3C24XX_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/hardware.h b/arch/arm/mach-s3c24xx/include/mach/hardware.h
deleted file mode 100644 (file)
index f28ac6c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - hardware
- */
-
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
-
-#ifndef __ASSEMBLY__
-
-extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
-
-#endif /* __ASSEMBLY__ */
-
-#include <linux/sizes.h>
-#include <mach/map.h>
-
-#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h
deleted file mode 100644 (file)
index f960e6d..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * arch/arm/mach-s3c2410/include/mach/io.h
- *  from arch/arm/mach-rpc/include/mach/io.h
- *
- * Copyright (C) 1997 Russell King
- *          (C) 2003 Simtec Electronics
-*/
-
-#ifndef __ASM_ARM_ARCH_IO_H
-#define __ASM_ARM_ARCH_IO_H
-
-#include <mach/hardware.h>
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-/*
- * We use two different types of addressing - PC style addresses, and ARM
- * addresses.  PC style accesses the PC hardware with the normal PC IO
- * addresses, eg 0x3f8 for serial#1.  ARM addresses are above A28
- * and are translated to the start of IO.  Note that all addresses are
- * not shifted left!
- */
-
-#define __PORT_PCIO(x) ((x) < (1<<28))
-
-#define PCIO_BASE       (S3C24XX_VA_ISA_WORD)
-#define PCIO_BASE_b     (S3C24XX_VA_ISA_BYTE)
-#define PCIO_BASE_w     (S3C24XX_VA_ISA_WORD)
-#define PCIO_BASE_l     (S3C24XX_VA_ISA_WORD)
-/*
- * Dynamic IO functions - let the compiler
- * optimize the expressions
- */
-
-#define DECLARE_DYN_OUT(sz,fnsuffix,instr) \
-static inline void __out##fnsuffix (unsigned int val, unsigned int port) \
-{ \
-       unsigned long temp;                                   \
-       __asm__ __volatile__(                                 \
-       "cmp    %2, #(1<<28)\n\t"                             \
-       "mov    %0, %2\n\t"                                   \
-       "addcc  %0, %0, %3\n\t"                               \
-       "str" instr " %1, [%0, #0 ]     @ out" #fnsuffix      \
-       : "=&r" (temp)                                        \
-       : "r" (val), "r" (port), "Ir" (PCIO_BASE_##fnsuffix)  \
-       : "cc");                                              \
-}
-
-
-#define DECLARE_DYN_IN(sz,fnsuffix,instr)                              \
-static inline unsigned sz __in##fnsuffix (unsigned int port)           \
-{                                                                      \
-       unsigned long temp, value;                                      \
-       __asm__ __volatile__(                                           \
-       "cmp    %2, #(1<<28)\n\t"                                       \
-       "mov    %0, %2\n\t"                                             \
-       "addcc  %0, %0, %3\n\t"                                         \
-       "ldr" instr "   %1, [%0, #0 ]   @ in" #fnsuffix         \
-       : "=&r" (temp), "=r" (value)                                    \
-       : "r" (port), "Ir" (PCIO_BASE_##fnsuffix)       \
-       : "cc");                                                        \
-       return (unsigned sz)value;                                      \
-}
-
-static inline void __iomem *__ioaddr (unsigned long port)
-{
-       return __PORT_PCIO(port) ? (PCIO_BASE + port) : (void __iomem *)port;
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr)  \
-       DECLARE_DYN_IN(sz,fnsuffix,instr) \
-       DECLARE_DYN_OUT(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"h")
-DECLARE_IO(int,l,"")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_IN
-
-/*
- * Constant address IO functions
- *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
- */
-#define __outbc(value,port)                                            \
-({                                                                     \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "strb   %0, [%1, %2]    @ outbc"                        \
-               : : "r" (value), "r" (PCIO_BASE), "Jr" ((port)));       \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "strb   %0, [%1, #0]    @ outbc"                        \
-               : : "r" (value), "r" ((port)));                         \
-})
-
-#define __inbc(port)                                                   \
-({                                                                     \
-       unsigned char result;                                           \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "ldrb   %0, [%1, %2]    @ inbc"                         \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port)));      \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "ldrb   %0, [%1, #0]    @ inbc"                         \
-               : "=r" (result) : "r" ((port)));                        \
-       result;                                                         \
-})
-
-#define __outwc(value,port)                                            \
-({                                                                     \
-       unsigned long v = value;                                        \
-       if (__PORT_PCIO((port))) {                                      \
-               if ((port) < 256 && (port) > -256)                      \
-                       __asm__ __volatile__(                           \
-                       "strh   %0, [%1, %2]    @ outwc"                \
-                       : : "r" (v), "r" (PCIO_BASE), "Jr" ((port)));   \
-               else if ((port) > 0)                                    \
-                       __asm__ __volatile__(                           \
-                       "strh   %0, [%1, %2]    @ outwc"                \
-                       : : "r" (v),                                    \
-                           "r" (PCIO_BASE + ((port) & ~0xff)),         \
-                            "Jr" (((port) & 0xff)));                   \
-               else                                                    \
-                       __asm__ __volatile__(                           \
-                       "strh   %0, [%1, #0]    @ outwc"                \
-                       : : "r" (v),                                    \
-                           "r" (PCIO_BASE + (port)));                  \
-       } else                                                          \
-               __asm__ __volatile__(                                   \
-               "strh   %0, [%1, #0]    @ outwc"                        \
-               : : "r" (v), "r" ((port)));                             \
-})
-
-#define __inwc(port)                                                   \
-({                                                                     \
-       unsigned short result;                                          \
-       if (__PORT_PCIO((port))) {                                      \
-               if ((port) < 256 && (port) > -256 )                     \
-                       __asm__ __volatile__(                           \
-                       "ldrh   %0, [%1, %2]    @ inwc"                 \
-                       : "=r" (result)                                 \
-                       : "r" (PCIO_BASE),                              \
-                         "Jr" ((port)));                               \
-               else if ((port) > 0)                                    \
-                       __asm__ __volatile__(                           \
-                       "ldrh   %0, [%1, %2]    @ inwc"                 \
-                       : "=r" (result)                                 \
-                       : "r" (PCIO_BASE + ((port) & ~0xff)),           \
-                         "Jr" (((port) & 0xff)));                      \
-               else                                                    \
-                       __asm__ __volatile__(                           \
-                       "ldrh   %0, [%1, #0]    @ inwc"                 \
-                       : "=r" (result)                                 \
-                       : "r" (PCIO_BASE + ((port))));                  \
-       } else                                                          \
-               __asm__ __volatile__(                                   \
-               "ldrh   %0, [%1, #0]    @ inwc"                         \
-               : "=r" (result) : "r" ((port)));                        \
-       result;                                                         \
-})
-
-#define __outlc(value,port)                                            \
-({                                                                     \
-       unsigned long v = value;                                        \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "str    %0, [%1, %2]    @ outlc"                        \
-               : : "r" (v), "r" (PCIO_BASE), "Jr" ((port)));   \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "str    %0, [%1, #0]    @ outlc"                        \
-               : : "r" (v), "r" ((port)));             \
-})
-
-#define __inlc(port)                                                   \
-({                                                                     \
-       unsigned long result;                                           \
-       if (__PORT_PCIO((port)))                                        \
-               __asm__ __volatile__(                                   \
-               "ldr    %0, [%1, %2]    @ inlc"                         \
-               : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port)));      \
-       else                                                            \
-               __asm__ __volatile__(                                   \
-               "ldr    %0, [%1, #0]    @ inlc"                         \
-               : "=r" (result) : "r" ((port)));                \
-       result;                                                         \
-})
-
-#define __ioaddrc(port)        ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port)))
-
-#define inb(p)         (__builtin_constant_p((p)) ? __inbc(p)     : __inb(p))
-#define inw(p)         (__builtin_constant_p((p)) ? __inwc(p)     : __inw(p))
-#define inl(p)         (__builtin_constant_p((p)) ? __inlc(p)     : __inl(p))
-#define outb(v,p)      (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
-#define outw(v,p)      (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
-#define outl(v,p)      (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
-#define __ioaddr(p)    (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
-
-#define insb(p,d,l)    __raw_readsb(__ioaddr(p),d,l)
-#define insw(p,d,l)    __raw_readsw(__ioaddr(p),d,l)
-#define insl(p,d,l)    __raw_readsl(__ioaddr(p),d,l)
-
-#define outsb(p,d,l)   __raw_writesb(__ioaddr(p),d,l)
-#define outsw(p,d,l)   __raw_writesw(__ioaddr(p),d,l)
-#define outsl(p,d,l)   __raw_writesl(__ioaddr(p),d,l)
-
-#endif
diff --git a/arch/arm/mach-s3c24xx/include/mach/irqs.h b/arch/arm/mach-s3c24xx/include/mach/irqs.h
deleted file mode 100644 (file)
index aaf3bae..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003-2005 Simtec Electronics
- *   Ben Dooks <ben@simtec.co.uk>
- */
-
-
-#ifndef __ASM_ARCH_IRQS_H
-#define __ASM_ARCH_IRQS_H __FILE__
-
-/* we keep the first set of CPU IRQs out of the range of
- * the ISA space, so that the PC104 has them to itself
- * and we don't end up having to do horrible things to the
- * standard ISA drivers....
- */
-
-#define S3C2410_CPUIRQ_OFFSET   (16)
-
-#define S3C2410_IRQ(x) ((x) + S3C2410_CPUIRQ_OFFSET)
-
-/* main cpu interrupts */
-#define IRQ_EINT0      S3C2410_IRQ(0)      /* 16 */
-#define IRQ_EINT1      S3C2410_IRQ(1)
-#define IRQ_EINT2      S3C2410_IRQ(2)
-#define IRQ_EINT3      S3C2410_IRQ(3)
-#define IRQ_EINT4t7    S3C2410_IRQ(4)      /* 20 */
-#define IRQ_EINT8t23   S3C2410_IRQ(5)
-#define IRQ_RESERVED6  S3C2410_IRQ(6)      /* for s3c2410 */
-#define IRQ_CAM        S3C2410_IRQ(6)      /* for s3c2440,s3c2443 */
-#define IRQ_BATT_FLT   S3C2410_IRQ(7)
-#define IRQ_TICK       S3C2410_IRQ(8)      /* 24 */
-#define IRQ_WDT               S3C2410_IRQ(9)       /* WDT/AC97 for s3c2443 */
-#define IRQ_TIMER0     S3C2410_IRQ(10)
-#define IRQ_TIMER1     S3C2410_IRQ(11)
-#define IRQ_TIMER2     S3C2410_IRQ(12)
-#define IRQ_TIMER3     S3C2410_IRQ(13)
-#define IRQ_TIMER4     S3C2410_IRQ(14)
-#define IRQ_UART2      S3C2410_IRQ(15)
-#define IRQ_LCD               S3C2410_IRQ(16)      /* 32 */
-#define IRQ_DMA0       S3C2410_IRQ(17)     /* IRQ_DMA for s3c2443 */
-#define IRQ_DMA1       S3C2410_IRQ(18)
-#define IRQ_DMA2       S3C2410_IRQ(19)
-#define IRQ_DMA3       S3C2410_IRQ(20)
-#define IRQ_SDI               S3C2410_IRQ(21)
-#define IRQ_SPI0       S3C2410_IRQ(22)
-#define IRQ_UART1      S3C2410_IRQ(23)
-#define IRQ_RESERVED24 S3C2410_IRQ(24)     /* 40 */
-#define IRQ_NFCON      S3C2410_IRQ(24)     /* for s3c2440 */
-#define IRQ_USBD       S3C2410_IRQ(25)
-#define IRQ_USBH       S3C2410_IRQ(26)
-#define IRQ_IIC               S3C2410_IRQ(27)
-#define IRQ_UART0      S3C2410_IRQ(28)     /* 44 */
-#define IRQ_SPI1       S3C2410_IRQ(29)
-#define IRQ_RTC               S3C2410_IRQ(30)
-#define IRQ_ADCPARENT  S3C2410_IRQ(31)
-
-/* interrupts generated from the external interrupts sources */
-#define IRQ_EINT0_2412 S3C2410_IRQ(32)
-#define IRQ_EINT1_2412 S3C2410_IRQ(33)
-#define IRQ_EINT2_2412 S3C2410_IRQ(34)
-#define IRQ_EINT3_2412 S3C2410_IRQ(35)
-#define IRQ_EINT4      S3C2410_IRQ(36)    /* 52 */
-#define IRQ_EINT5      S3C2410_IRQ(37)
-#define IRQ_EINT6      S3C2410_IRQ(38)
-#define IRQ_EINT7      S3C2410_IRQ(39)
-#define IRQ_EINT8      S3C2410_IRQ(40)
-#define IRQ_EINT9      S3C2410_IRQ(41)
-#define IRQ_EINT10     S3C2410_IRQ(42)
-#define IRQ_EINT11     S3C2410_IRQ(43)
-#define IRQ_EINT12     S3C2410_IRQ(44)
-#define IRQ_EINT13     S3C2410_IRQ(45)
-#define IRQ_EINT14     S3C2410_IRQ(46)
-#define IRQ_EINT15     S3C2410_IRQ(47)
-#define IRQ_EINT16     S3C2410_IRQ(48)
-#define IRQ_EINT17     S3C2410_IRQ(49)
-#define IRQ_EINT18     S3C2410_IRQ(50)
-#define IRQ_EINT19     S3C2410_IRQ(51)
-#define IRQ_EINT20     S3C2410_IRQ(52)    /* 68 */
-#define IRQ_EINT21     S3C2410_IRQ(53)
-#define IRQ_EINT22     S3C2410_IRQ(54)
-#define IRQ_EINT23     S3C2410_IRQ(55)
-
-#define IRQ_EINT_BIT(x)        ((x) - IRQ_EINT4 + 4)
-#define IRQ_EINT(x)    (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x)))
-
-#define IRQ_LCD_FIFO   S3C2410_IRQ(56)
-#define IRQ_LCD_FRAME  S3C2410_IRQ(57)
-
-/* IRQs for the interal UARTs, and ADC
- * these need to be ordered in number of appearance in the
- * SUBSRC mask register
-*/
-
-#define S3C2410_IRQSUB(x)      S3C2410_IRQ((x)+58)
-
-#define IRQ_S3CUART_RX0                S3C2410_IRQSUB(0)       /* 74 */
-#define IRQ_S3CUART_TX0                S3C2410_IRQSUB(1)
-#define IRQ_S3CUART_ERR0       S3C2410_IRQSUB(2)
-
-#define IRQ_S3CUART_RX1                S3C2410_IRQSUB(3)       /* 77 */
-#define IRQ_S3CUART_TX1                S3C2410_IRQSUB(4)
-#define IRQ_S3CUART_ERR1       S3C2410_IRQSUB(5)
-
-#define IRQ_S3CUART_RX2                S3C2410_IRQSUB(6)       /* 80 */
-#define IRQ_S3CUART_TX2                S3C2410_IRQSUB(7)
-#define IRQ_S3CUART_ERR2       S3C2410_IRQSUB(8)
-
-#define IRQ_TC                 S3C2410_IRQSUB(9)
-#define IRQ_ADC                        S3C2410_IRQSUB(10)
-
-/* extra irqs for s3c2412 */
-
-#define IRQ_S3C2412_CFSDI      S3C2410_IRQ(21)
-
-#define IRQ_S3C2412_SDI                S3C2410_IRQSUB(13)
-#define IRQ_S3C2412_CF         S3C2410_IRQSUB(14)
-
-
-#define IRQ_S3C2416_EINT8t15   S3C2410_IRQ(5)
-#define IRQ_S3C2416_DMA                S3C2410_IRQ(17)
-#define IRQ_S3C2416_UART3      S3C2410_IRQ(18)
-#define IRQ_S3C2416_SDI1       S3C2410_IRQ(20)
-#define IRQ_S3C2416_SDI0       S3C2410_IRQ(21)
-
-#define IRQ_S3C2416_LCD2       S3C2410_IRQSUB(15)
-#define IRQ_S3C2416_LCD3       S3C2410_IRQSUB(16)
-#define IRQ_S3C2416_LCD4       S3C2410_IRQSUB(17)
-#define IRQ_S3C2416_DMA0       S3C2410_IRQSUB(18)
-#define IRQ_S3C2416_DMA1       S3C2410_IRQSUB(19)
-#define IRQ_S3C2416_DMA2       S3C2410_IRQSUB(20)
-#define IRQ_S3C2416_DMA3       S3C2410_IRQSUB(21)
-#define IRQ_S3C2416_DMA4       S3C2410_IRQSUB(22)
-#define IRQ_S3C2416_DMA5       S3C2410_IRQSUB(23)
-#define IRQ_S32416_WDT         S3C2410_IRQSUB(27)
-#define IRQ_S32416_AC97                S3C2410_IRQSUB(28)
-
-/* second interrupt-register of s3c2416/s3c2450 */
-
-#define S3C2416_IRQ(x)         S3C2410_IRQ((x) + 58 + 29)
-#define IRQ_S3C2416_2D         S3C2416_IRQ(0)
-#define IRQ_S3C2416_IIC1       S3C2416_IRQ(1)
-#define IRQ_S3C2416_RESERVED2  S3C2416_IRQ(2)
-#define IRQ_S3C2416_RESERVED3  S3C2416_IRQ(3)
-#define IRQ_S3C2416_PCM0       S3C2416_IRQ(4)
-#define IRQ_S3C2416_PCM1       S3C2416_IRQ(5)
-#define IRQ_S3C2416_I2S0       S3C2416_IRQ(6)
-#define IRQ_S3C2416_I2S1       S3C2416_IRQ(7)
-
-/* extra irqs for s3c2440 */
-
-#define IRQ_S3C2440_CAM_C      S3C2410_IRQSUB(11)      /* S3C2443 too */
-#define IRQ_S3C2440_CAM_P      S3C2410_IRQSUB(12)      /* S3C2443 too */
-#define IRQ_S3C2440_WDT                S3C2410_IRQSUB(13)
-#define IRQ_S3C2440_AC97       S3C2410_IRQSUB(14)
-
-/* irqs for s3c2443 */
-
-#define IRQ_S3C2443_DMA                S3C2410_IRQ(17)         /* IRQ_DMA1 */
-#define IRQ_S3C2443_UART3      S3C2410_IRQ(18)         /* IRQ_DMA2 */
-#define IRQ_S3C2443_CFCON      S3C2410_IRQ(19)         /* IRQ_DMA3 */
-#define IRQ_S3C2443_HSMMC      S3C2410_IRQ(20)         /* IRQ_SDI */
-#define IRQ_S3C2443_NAND       S3C2410_IRQ(24)         /* reserved */
-
-#define IRQ_S3C2416_HSMMC0     S3C2410_IRQ(21)         /* S3C2416/S3C2450 */
-
-#define IRQ_HSMMC0             IRQ_S3C2416_HSMMC0
-#define IRQ_HSMMC1             IRQ_S3C2443_HSMMC
-
-#define IRQ_S3C2443_LCD1       S3C2410_IRQSUB(14)
-#define IRQ_S3C2443_LCD2       S3C2410_IRQSUB(15)
-#define IRQ_S3C2443_LCD3       S3C2410_IRQSUB(16)
-#define IRQ_S3C2443_LCD4       S3C2410_IRQSUB(17)
-
-#define IRQ_S3C2443_DMA0       S3C2410_IRQSUB(18)
-#define IRQ_S3C2443_DMA1       S3C2410_IRQSUB(19)
-#define IRQ_S3C2443_DMA2       S3C2410_IRQSUB(20)
-#define IRQ_S3C2443_DMA3       S3C2410_IRQSUB(21)
-#define IRQ_S3C2443_DMA4       S3C2410_IRQSUB(22)
-#define IRQ_S3C2443_DMA5       S3C2410_IRQSUB(23)
-
-/* UART3 */
-#define IRQ_S3C2443_RX3                S3C2410_IRQSUB(24)
-#define IRQ_S3C2443_TX3                S3C2410_IRQSUB(25)
-#define IRQ_S3C2443_ERR3       S3C2410_IRQSUB(26)
-
-#define IRQ_S3C2443_WDT                S3C2410_IRQSUB(27)
-#define IRQ_S3C2443_AC97       S3C2410_IRQSUB(28)
-
-#if defined(CONFIG_CPU_S3C2416)
-#define NR_IRQS (IRQ_S3C2416_I2S1 + 1)
-#else
-#define NR_IRQS (IRQ_S3C2443_AC97 + 1)
-#endif
-
-/* compatibility define. */
-#define IRQ_UART3              IRQ_S3C2443_UART3
-#define IRQ_S3CUART_RX3                IRQ_S3C2443_RX3
-#define IRQ_S3CUART_TX3                IRQ_S3C2443_TX3
-#define IRQ_S3CUART_ERR3       IRQ_S3C2443_ERR3
-
-#define IRQ_LCD_VSYNC          IRQ_S3C2443_LCD3
-#define IRQ_LCD_SYSTEM         IRQ_S3C2443_LCD2
-
-#ifdef CONFIG_CPU_S3C2440
-#define IRQ_S3C244X_AC97 IRQ_S3C2440_AC97
-#else
-#define IRQ_S3C244X_AC97 IRQ_S3C2443_AC97
-#endif
-
-/* Our FIQs are routable from IRQ_EINT0 to IRQ_ADCPARENT */
-#define FIQ_START              IRQ_EINT0
-
-#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/map.h b/arch/arm/mach-s3c24xx/include/mach/map.h
deleted file mode 100644 (file)
index bca9311..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - Memory map definitions
- */
-
-#ifndef __ASM_ARCH_MAP_H
-#define __ASM_ARCH_MAP_H
-
-#include <plat/map-base.h>
-#include <plat/map-s3c.h>
-
-/*
- * interrupt controller is the first thing we put in, to make
- * the assembly code for the irq detection easier
- */
-#define S3C2410_PA_IRQ         (0x4A000000)
-#define S3C24XX_SZ_IRQ         SZ_1M
-
-/* memory controller registers */
-#define S3C2410_PA_MEMCTRL     (0x48000000)
-#define S3C24XX_SZ_MEMCTRL     SZ_1M
-
-/* Timers */
-#define S3C2410_PA_TIMER       (0x51000000)
-#define S3C24XX_SZ_TIMER       SZ_1M
-
-/* Clock and Power management */
-#define S3C24XX_SZ_CLKPWR      SZ_1M
-
-/* USB Device port */
-#define S3C2410_PA_USBDEV      (0x52000000)
-#define S3C24XX_SZ_USBDEV      SZ_1M
-
-/* Watchdog */
-#define S3C2410_PA_WATCHDOG    (0x53000000)
-#define S3C24XX_SZ_WATCHDOG    SZ_1M
-
-/* Standard size definitions for peripheral blocks. */
-
-#define S3C24XX_SZ_UART                SZ_1M
-#define S3C24XX_SZ_IIS         SZ_1M
-#define S3C24XX_SZ_ADC         SZ_1M
-#define S3C24XX_SZ_SPI         SZ_1M
-#define S3C24XX_SZ_SDI         SZ_1M
-#define S3C24XX_SZ_NAND                SZ_1M
-#define S3C24XX_SZ_GPIO                SZ_1M
-
-/* USB host controller */
-#define S3C2410_PA_USBHOST (0x49000000)
-
-/* S3C2416/S3C2443/S3C2450 High-Speed USB Gadget */
-#define S3C2416_PA_HSUDC       (0x49800000)
-#define S3C2416_SZ_HSUDC       (SZ_4K)
-
-/* DMA controller */
-#define S3C2410_PA_DMA    (0x4B000000)
-#define S3C24XX_SZ_DMA    SZ_1M
-
-/* Clock and Power management */
-#define S3C2410_PA_CLKPWR  (0x4C000000)
-
-/* LCD controller */
-#define S3C2410_PA_LCD    (0x4D000000)
-#define S3C24XX_SZ_LCD    SZ_1M
-
-/* NAND flash controller */
-#define S3C2410_PA_NAND           (0x4E000000)
-
-/* IIC hardware controller */
-#define S3C2410_PA_IIC    (0x54000000)
-
-/* IIS controller */
-#define S3C2410_PA_IIS    (0x55000000)
-
-/* RTC */
-#define S3C2410_PA_RTC    (0x57000000)
-#define S3C24XX_SZ_RTC    SZ_1M
-
-/* ADC */
-#define S3C2410_PA_ADC    (0x58000000)
-
-/* SPI */
-#define S3C2410_PA_SPI    (0x59000000)
-#define S3C2443_PA_SPI0                (0x52000000)
-#define S3C2443_PA_SPI1                S3C2410_PA_SPI
-
-/* SDI */
-#define S3C2410_PA_SDI    (0x5A000000)
-
-/* CAMIF */
-#define S3C2440_PA_CAMIF   (0x4F000000)
-#define S3C2440_SZ_CAMIF   SZ_1M
-
-/* AC97 */
-
-#define S3C2440_PA_AC97           (0x5B000000)
-#define S3C2440_SZ_AC97           SZ_1M
-
-/* S3C2443/S3C2416 High-speed SD/MMC */
-#define S3C2443_PA_HSMMC   (0x4A800000)
-#define S3C2416_PA_HSMMC0  (0x4AC00000)
-
-#define        S3C2443_PA_FB   (0x4C800000)
-
-/* S3C2412 memory and IO controls */
-#define S3C2412_PA_SSMC        (0x4F000000)
-
-#define S3C2412_PA_EBI (0x48800000)
-
-/* physical addresses of all the chip-select areas */
-
-#define S3C2410_CS0 (0x00000000)
-#define S3C2410_CS1 (0x08000000)
-#define S3C2410_CS2 (0x10000000)
-#define S3C2410_CS3 (0x18000000)
-#define S3C2410_CS4 (0x20000000)
-#define S3C2410_CS5 (0x28000000)
-#define S3C2410_CS6 (0x30000000)
-#define S3C2410_CS7 (0x38000000)
-
-#define S3C2410_SDRAM_PA    (S3C2410_CS6)
-
-/* Use a single interface for common resources between S3C24XX cpus */
-
-#define S3C24XX_PA_IRQ      S3C2410_PA_IRQ
-#define S3C24XX_PA_MEMCTRL  S3C2410_PA_MEMCTRL
-#define S3C24XX_PA_DMA      S3C2410_PA_DMA
-#define S3C24XX_PA_CLKPWR   S3C2410_PA_CLKPWR
-#define S3C24XX_PA_LCD      S3C2410_PA_LCD
-#define S3C24XX_PA_TIMER    S3C2410_PA_TIMER
-#define S3C24XX_PA_USBDEV   S3C2410_PA_USBDEV
-#define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG
-#define S3C24XX_PA_IIS      S3C2410_PA_IIS
-#define S3C24XX_PA_RTC      S3C2410_PA_RTC
-#define S3C24XX_PA_ADC      S3C2410_PA_ADC
-#define S3C24XX_PA_SPI      S3C2410_PA_SPI
-#define S3C24XX_PA_SPI1                (S3C2410_PA_SPI + S3C2410_SPI1)
-#define S3C24XX_PA_SDI      S3C2410_PA_SDI
-#define S3C24XX_PA_NAND            S3C2410_PA_NAND
-
-#define S3C_PA_FB          S3C2443_PA_FB
-#define S3C_PA_IIC          S3C2410_PA_IIC
-#define S3C_PA_USBHOST S3C2410_PA_USBHOST
-#define S3C_PA_HSMMC0      S3C2416_PA_HSMMC0
-#define S3C_PA_HSMMC1      S3C2443_PA_HSMMC
-#define S3C_PA_WDT         S3C2410_PA_WATCHDOG
-#define S3C_PA_NAND        S3C24XX_PA_NAND
-
-#define S3C_PA_SPI0            S3C2443_PA_SPI0
-#define S3C_PA_SPI1            S3C2443_PA_SPI1
-
-#define SAMSUNG_PA_TIMER       S3C2410_PA_TIMER
-
-#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/pm-core.h b/arch/arm/mach-s3c24xx/include/mach/pm-core.h
deleted file mode 100644 (file)
index 5e4ce89..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C24xx - PM core support for arch/arm/plat-s3c/pm.c
- */
-
-#include <linux/delay.h>
-#include <linux/io.h>
-
-#include "regs-clock.h"
-#include "regs-irq.h"
-
-static inline void s3c_pm_debug_init_uart(void)
-{
-       unsigned long tmp = __raw_readl(S3C2410_CLKCON);
-
-       /* re-start uart clocks */
-       tmp |= S3C2410_CLKCON_UART0;
-       tmp |= S3C2410_CLKCON_UART1;
-       tmp |= S3C2410_CLKCON_UART2;
-
-       __raw_writel(tmp, S3C2410_CLKCON);
-       udelay(10);
-}
-
-static inline void s3c_pm_arch_prepare_irqs(void)
-{
-       __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
-       __raw_writel(s3c_irqwake_eintmask, S3C2410_EINTMASK);
-
-       /* ack any outstanding external interrupts before we go to sleep */
-
-       __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
-       __raw_writel(__raw_readl(S3C2410_INTPND), S3C2410_INTPND);
-       __raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND);
-
-}
-
-static inline void s3c_pm_arch_stop_clocks(void)
-{
-       __raw_writel(0x00, S3C2410_CLKCON);  /* turn off clocks over sleep */
-}
-
-/* s3c2410_pm_show_resume_irqs
- *
- * print any IRQs asserted at resume time (ie, we woke from)
-*/
-static inline void s3c_pm_show_resume_irqs(int start, unsigned long which,
-                                          unsigned long mask)
-{
-       int i;
-
-       which &= ~mask;
-
-       for (i = 0; i <= 31; i++) {
-               if (which & (1L<<i)) {
-                       S3C_PMDBG("IRQ %d asserted at resume\n", start+i);
-               }
-       }
-}
-
-static inline void s3c_pm_arch_show_resume_irqs(void)
-{
-       S3C_PMDBG("post sleep: IRQs 0x%08x, 0x%08x\n",
-                 __raw_readl(S3C2410_SRCPND),
-                 __raw_readl(S3C2410_EINTPEND));
-
-       s3c_pm_show_resume_irqs(IRQ_EINT0, __raw_readl(S3C2410_SRCPND),
-                               s3c_irqwake_intmask);
-
-       s3c_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
-                               s3c_irqwake_eintmask);
-}
-
-static inline void s3c_pm_arch_update_uart(void __iomem *regs,
-                                          struct pm_uart_save *save)
-{
-}
-
-static inline void s3c_pm_restored_gpios(void) { }
-static inline void samsung_pm_saved_gpios(void) { }
-
-/* state for IRQs over sleep */
-
-/* default is to allow for EINT0..EINT15, and IRQ_RTC as wakeup sources
- *
- * set bit to 1 in allow bitfield to enable the wakeup settings on it
-*/
-#ifdef CONFIG_PM_SLEEP
-#define s3c_irqwake_intallow   (1L << 30 | 0xfL)
-#define s3c_irqwake_eintallow  (0x0000fff0L)
-#else
-#define s3c_irqwake_eintallow 0
-#define s3c_irqwake_intallow  0
-#endif
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
deleted file mode 100644 (file)
index 7ca3dd4..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * S3C2410 clock register definitions
- */
-
-#ifndef __ASM_ARM_REGS_CLOCK
-#define __ASM_ARM_REGS_CLOCK
-
-#define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
-
-#define S3C2410_PLLVAL(_m,_p,_s) ((_m) << 12 | ((_p) << 4) | ((_s)))
-
-#define S3C2410_LOCKTIME    S3C2410_CLKREG(0x00)
-#define S3C2410_MPLLCON            S3C2410_CLKREG(0x04)
-#define S3C2410_UPLLCON            S3C2410_CLKREG(0x08)
-#define S3C2410_CLKCON     S3C2410_CLKREG(0x0C)
-#define S3C2410_CLKSLOW            S3C2410_CLKREG(0x10)
-#define S3C2410_CLKDIVN            S3C2410_CLKREG(0x14)
-
-#define S3C2410_CLKCON_IDLE         (1<<2)
-#define S3C2410_CLKCON_POWER        (1<<3)
-#define S3C2410_CLKCON_NAND         (1<<4)
-#define S3C2410_CLKCON_LCDC         (1<<5)
-#define S3C2410_CLKCON_USBH         (1<<6)
-#define S3C2410_CLKCON_USBD         (1<<7)
-#define S3C2410_CLKCON_PWMT         (1<<8)
-#define S3C2410_CLKCON_SDI          (1<<9)
-#define S3C2410_CLKCON_UART0        (1<<10)
-#define S3C2410_CLKCON_UART1        (1<<11)
-#define S3C2410_CLKCON_UART2        (1<<12)
-#define S3C2410_CLKCON_GPIO         (1<<13)
-#define S3C2410_CLKCON_RTC          (1<<14)
-#define S3C2410_CLKCON_ADC          (1<<15)
-#define S3C2410_CLKCON_IIC          (1<<16)
-#define S3C2410_CLKCON_IIS          (1<<17)
-#define S3C2410_CLKCON_SPI          (1<<18)
-
-#define S3C2410_CLKDIVN_PDIVN       (1<<0)
-#define S3C2410_CLKDIVN_HDIVN       (1<<1)
-
-#define S3C2410_CLKSLOW_UCLK_OFF       (1<<7)
-#define S3C2410_CLKSLOW_MPLL_OFF       (1<<5)
-#define S3C2410_CLKSLOW_SLOW           (1<<4)
-#define S3C2410_CLKSLOW_SLOWVAL(x)     (x)
-#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)
-
-#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
-
-/* extra registers */
-#define S3C2440_CAMDIVN            S3C2410_CLKREG(0x18)
-
-#define S3C2440_CLKCON_CAMERA        (1<<19)
-#define S3C2440_CLKCON_AC97          (1<<20)
-
-#define S3C2440_CLKDIVN_PDIVN       (1<<0)
-#define S3C2440_CLKDIVN_HDIVN_MASK   (3<<1)
-#define S3C2440_CLKDIVN_HDIVN_1      (0<<1)
-#define S3C2440_CLKDIVN_HDIVN_2      (1<<1)
-#define S3C2440_CLKDIVN_HDIVN_4_8    (2<<1)
-#define S3C2440_CLKDIVN_HDIVN_3_6    (3<<1)
-#define S3C2440_CLKDIVN_UCLK         (1<<3)
-
-#define S3C2440_CAMDIVN_CAMCLK_MASK  (0xf<<0)
-#define S3C2440_CAMDIVN_CAMCLK_SEL   (1<<4)
-#define S3C2440_CAMDIVN_HCLK3_HALF   (1<<8)
-#define S3C2440_CAMDIVN_HCLK4_HALF   (1<<9)
-#define S3C2440_CAMDIVN_DVSEN        (1<<12)
-
-#define S3C2442_CAMDIVN_CAMCLK_DIV3  (1<<5)
-
-#endif /* CONFIG_CPU_S3C2440 or CONFIG_CPU_S3C2442 */
-
-#if defined(CONFIG_CPU_S3C2412)
-
-#define S3C2412_OSCSET         S3C2410_CLKREG(0x18)
-#define S3C2412_CLKSRC         S3C2410_CLKREG(0x1C)
-
-#define S3C2412_PLLCON_OFF             (1<<20)
-
-#define S3C2412_CLKDIVN_PDIVN          (1<<2)
-#define S3C2412_CLKDIVN_HDIVN_MASK     (3<<0)
-#define S3C2412_CLKDIVN_ARMDIVN                (1<<3)
-#define S3C2412_CLKDIVN_DVSEN          (1<<4)
-#define S3C2412_CLKDIVN_HALFHCLK       (1<<5)
-#define S3C2412_CLKDIVN_USB48DIV       (1<<6)
-#define S3C2412_CLKDIVN_UARTDIV_MASK   (15<<8)
-#define S3C2412_CLKDIVN_UARTDIV_SHIFT  (8)
-#define S3C2412_CLKDIVN_I2SDIV_MASK    (15<<12)
-#define S3C2412_CLKDIVN_I2SDIV_SHIFT   (12)
-#define S3C2412_CLKDIVN_CAMDIV_MASK    (15<<16)
-#define S3C2412_CLKDIVN_CAMDIV_SHIFT   (16)
-
-#define S3C2412_CLKCON_WDT             (1<<28)
-#define S3C2412_CLKCON_SPI             (1<<27)
-#define S3C2412_CLKCON_IIS             (1<<26)
-#define S3C2412_CLKCON_IIC             (1<<25)
-#define S3C2412_CLKCON_ADC             (1<<24)
-#define S3C2412_CLKCON_RTC             (1<<23)
-#define S3C2412_CLKCON_GPIO            (1<<22)
-#define S3C2412_CLKCON_UART2           (1<<21)
-#define S3C2412_CLKCON_UART1           (1<<20)
-#define S3C2412_CLKCON_UART0           (1<<19)
-#define S3C2412_CLKCON_SDI             (1<<18)
-#define S3C2412_CLKCON_PWMT            (1<<17)
-#define S3C2412_CLKCON_USBD            (1<<16)
-#define S3C2412_CLKCON_CAMCLK          (1<<15)
-#define S3C2412_CLKCON_UARTCLK         (1<<14)
-/* missing 13 */
-#define S3C2412_CLKCON_USB_HOST48      (1<<12)
-#define S3C2412_CLKCON_USB_DEV48       (1<<11)
-#define S3C2412_CLKCON_HCLKdiv2                (1<<10)
-#define S3C2412_CLKCON_HCLKx2          (1<<9)
-#define S3C2412_CLKCON_SDRAM           (1<<8)
-/* missing 7 */
-#define S3C2412_CLKCON_USBH            S3C2410_CLKCON_USBH
-#define S3C2412_CLKCON_LCDC            S3C2410_CLKCON_LCDC
-#define S3C2412_CLKCON_NAND            S3C2410_CLKCON_NAND
-#define S3C2412_CLKCON_DMA3            (1<<3)
-#define S3C2412_CLKCON_DMA2            (1<<2)
-#define S3C2412_CLKCON_DMA1            (1<<1)
-#define S3C2412_CLKCON_DMA0            (1<<0)
-
-/* clock sourec controls */
-
-#define S3C2412_CLKSRC_EXTCLKDIV_MASK          (7 << 0)
-#define S3C2412_CLKSRC_EXTCLKDIV_SHIFT         (0)
-#define S3C2412_CLKSRC_MDIVCLK_EXTCLKDIV       (1<<3)
-#define S3C2412_CLKSRC_MSYSCLK_MPLL            (1<<4)
-#define S3C2412_CLKSRC_USYSCLK_UPLL            (1<<5)
-#define S3C2412_CLKSRC_UARTCLK_MPLL            (1<<8)
-#define S3C2412_CLKSRC_I2SCLK_MPLL             (1<<9)
-#define S3C2412_CLKSRC_USBCLK_HCLK             (1<<10)
-#define S3C2412_CLKSRC_CAMCLK_HCLK             (1<<11)
-#define S3C2412_CLKSRC_UREFCLK_EXTCLK  (1<<12)
-#define S3C2412_CLKSRC_EREFCLK_EXTCLK  (1<<14)
-
-#endif /* CONFIG_CPU_S3C2412 */
-
-#define S3C2416_CLKDIV2                S3C2410_CLKREG(0x28)
-
-#endif /* __ASM_ARM_REGS_CLOCK */
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
deleted file mode 100644 (file)
index 594e967..0000000
+++ /dev/null
@@ -1,606 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003-2004 Simtec Electronics <linux@simtec.co.uk>
- *     http://www.simtec.co.uk/products/SWLINUX/
- *
- * S3C2410 GPIO register definitions
- */
-
-
-#ifndef __ASM_ARCH_REGS_GPIO_H
-#define __ASM_ARCH_REGS_GPIO_H
-
-#define S3C24XX_MISCCR         S3C24XX_GPIOREG2(0x80)
-
-/* general configuration options */
-
-#define S3C2410_GPIO_LEAVE   (0xFFFFFFFF)
-#define S3C2410_GPIO_INPUT   (0xFFFFFFF0)      /* not available on A */
-#define S3C2410_GPIO_OUTPUT  (0xFFFFFFF1)
-#define S3C2410_GPIO_IRQ     (0xFFFFFFF2)      /* not available for all */
-#define S3C2410_GPIO_SFN2    (0xFFFFFFF2)      /* bank A => addr/cs/nand */
-#define S3C2410_GPIO_SFN3    (0xFFFFFFF3)      /* not available on A */
-
-/* register address for the GPIO registers.
- * S3C24XX_GPIOREG2 is for the second set of registers in the
- * GPIO which move between s3c2410 and s3c2412 type systems */
-
-#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
-#define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2)
-
-
-/* configure GPIO ports A..G */
-
-/* port A - S3C2410: 22bits, zero in bit X makes pin X output
- * 1 makes port special function, this is default
-*/
-#define S3C2410_GPACON    S3C2410_GPIOREG(0x00)
-#define S3C2410_GPADAT    S3C2410_GPIOREG(0x04)
-
-#define S3C2410_GPA0_ADDR0   (1<<0)
-#define S3C2410_GPA1_ADDR16  (1<<1)
-#define S3C2410_GPA2_ADDR17  (1<<2)
-#define S3C2410_GPA3_ADDR18  (1<<3)
-#define S3C2410_GPA4_ADDR19  (1<<4)
-#define S3C2410_GPA5_ADDR20  (1<<5)
-#define S3C2410_GPA6_ADDR21  (1<<6)
-#define S3C2410_GPA7_ADDR22  (1<<7)
-#define S3C2410_GPA8_ADDR23  (1<<8)
-#define S3C2410_GPA9_ADDR24  (1<<9)
-#define S3C2410_GPA10_ADDR25 (1<<10)
-#define S3C2410_GPA11_ADDR26 (1<<11)
-#define S3C2410_GPA12_nGCS1  (1<<12)
-#define S3C2410_GPA13_nGCS2  (1<<13)
-#define S3C2410_GPA14_nGCS3  (1<<14)
-#define S3C2410_GPA15_nGCS4  (1<<15)
-#define S3C2410_GPA16_nGCS5  (1<<16)
-#define S3C2410_GPA17_CLE    (1<<17)
-#define S3C2410_GPA18_ALE    (1<<18)
-#define S3C2410_GPA19_nFWE   (1<<19)
-#define S3C2410_GPA20_nFRE   (1<<20)
-#define S3C2410_GPA21_nRSTOUT (1<<21)
-#define S3C2410_GPA22_nFCE   (1<<22)
-
-/* 0x08 and 0x0c are reserved on S3C2410 */
-
-/* S3C2410:
- * GPB is 10 IO pins, each configured by 2 bits each in GPBCON.
- *   00 = input, 01 = output, 10=special function, 11=reserved
-
- * bit 0,1 = pin 0, 2,3= pin 1...
- *
- * CPBUP = pull up resistor control, 1=disabled, 0=enabled
-*/
-
-#define S3C2410_GPBCON    S3C2410_GPIOREG(0x10)
-#define S3C2410_GPBDAT    S3C2410_GPIOREG(0x14)
-#define S3C2410_GPBUP     S3C2410_GPIOREG(0x18)
-
-/* no i/o pin in port b can have value 3 (unless it is a s3c2443) ! */
-
-#define S3C2410_GPB0_TOUT0   (0x02 << 0)
-
-#define S3C2410_GPB1_TOUT1   (0x02 << 2)
-
-#define S3C2410_GPB2_TOUT2   (0x02 << 4)
-
-#define S3C2410_GPB3_TOUT3   (0x02 << 6)
-
-#define S3C2410_GPB4_TCLK0   (0x02 << 8)
-#define S3C2410_GPB4_MASK    (0x03 << 8)
-
-#define S3C2410_GPB5_nXBACK  (0x02 << 10)
-#define S3C2443_GPB5_XBACK   (0x03 << 10)
-
-#define S3C2410_GPB6_nXBREQ  (0x02 << 12)
-#define S3C2443_GPB6_XBREQ   (0x03 << 12)
-
-#define S3C2410_GPB7_nXDACK1 (0x02 << 14)
-#define S3C2443_GPB7_XDACK1  (0x03 << 14)
-
-#define S3C2410_GPB8_nXDREQ1 (0x02 << 16)
-
-#define S3C2410_GPB9_nXDACK0 (0x02 << 18)
-#define S3C2443_GPB9_XDACK0  (0x03 << 18)
-
-#define S3C2410_GPB10_nXDRE0 (0x02 << 20)
-#define S3C2443_GPB10_XDREQ0 (0x03 << 20)
-
-#define S3C2410_GPB_PUPDIS(x)  (1<<(x))
-
-/* Port C consits of 16 GPIO/Special function
- *
- * almost identical setup to port b, but the special functions are mostly
- * to do with the video system's sync/etc.
-*/
-
-#define S3C2410_GPCCON    S3C2410_GPIOREG(0x20)
-#define S3C2410_GPCDAT    S3C2410_GPIOREG(0x24)
-#define S3C2410_GPCUP     S3C2410_GPIOREG(0x28)
-#define S3C2410_GPC0_LEND      (0x02 << 0)
-#define S3C2410_GPC1_VCLK      (0x02 << 2)
-#define S3C2410_GPC2_VLINE     (0x02 << 4)
-#define S3C2410_GPC3_VFRAME    (0x02 << 6)
-#define S3C2410_GPC4_VM                (0x02 << 8)
-#define S3C2410_GPC5_LCDVF0    (0x02 << 10)
-#define S3C2410_GPC6_LCDVF1    (0x02 << 12)
-#define S3C2410_GPC7_LCDVF2    (0x02 << 14)
-#define S3C2410_GPC8_VD0       (0x02 << 16)
-#define S3C2410_GPC9_VD1       (0x02 << 18)
-#define S3C2410_GPC10_VD2      (0x02 << 20)
-#define S3C2410_GPC11_VD3      (0x02 << 22)
-#define S3C2410_GPC12_VD4      (0x02 << 24)
-#define S3C2410_GPC13_VD5      (0x02 << 26)
-#define S3C2410_GPC14_VD6      (0x02 << 28)
-#define S3C2410_GPC15_VD7      (0x02 << 30)
-#define S3C2410_GPC_PUPDIS(x)  (1<<(x))
-
-/*
- * S3C2410: Port D consists of 16 GPIO/Special function
- *
- * almost identical setup to port b, but the special functions are mostly
- * to do with the video system's data.
- *
- * almost identical setup to port c
-*/
-
-#define S3C2410_GPDCON    S3C2410_GPIOREG(0x30)
-#define S3C2410_GPDDAT    S3C2410_GPIOREG(0x34)
-#define S3C2410_GPDUP     S3C2410_GPIOREG(0x38)
-
-#define S3C2410_GPD0_VD8       (0x02 << 0)
-#define S3C2442_GPD0_nSPICS1   (0x03 << 0)
-
-#define S3C2410_GPD1_VD9       (0x02 << 2)
-#define S3C2442_GPD1_SPICLK1   (0x03 << 2)
-
-#define S3C2410_GPD2_VD10      (0x02 << 4)
-
-#define S3C2410_GPD3_VD11      (0x02 << 6)
-
-#define S3C2410_GPD4_VD12      (0x02 << 8)
-
-#define S3C2410_GPD5_VD13      (0x02 << 10)
-
-#define S3C2410_GPD6_VD14      (0x02 << 12)
-
-#define S3C2410_GPD7_VD15      (0x02 << 14)
-
-#define S3C2410_GPD8_VD16      (0x02 << 16)
-#define S3C2440_GPD8_SPIMISO1  (0x03 << 16)
-
-#define S3C2410_GPD9_VD17      (0x02 << 18)
-#define S3C2440_GPD9_SPIMOSI1  (0x03 << 18)
-
-#define S3C2410_GPD10_VD18     (0x02 << 20)
-#define S3C2440_GPD10_SPICLK1  (0x03 << 20)
-
-#define S3C2410_GPD11_VD19     (0x02 << 22)
-
-#define S3C2410_GPD12_VD20     (0x02 << 24)
-
-#define S3C2410_GPD13_VD21     (0x02 << 26)
-
-#define S3C2410_GPD14_VD22     (0x02 << 28)
-#define S3C2410_GPD14_nSS1     (0x03 << 28)
-
-#define S3C2410_GPD15_VD23     (0x02 << 30)
-#define S3C2410_GPD15_nSS0     (0x03 << 30)
-
-#define S3C2410_GPD_PUPDIS(x)  (1<<(x))
-
-/* S3C2410:
- * Port E consists of 16 GPIO/Special function
- *
- * again, the same as port B, but dealing with I2S, SDI, and
- * more miscellaneous functions
- *
- * GPIO / interrupt inputs
-*/
-
-#define S3C2410_GPECON    S3C2410_GPIOREG(0x40)
-#define S3C2410_GPEDAT    S3C2410_GPIOREG(0x44)
-#define S3C2410_GPEUP     S3C2410_GPIOREG(0x48)
-
-#define S3C2410_GPE0_I2SLRCK   (0x02 << 0)
-#define S3C2443_GPE0_AC_nRESET (0x03 << 0)
-#define S3C2410_GPE0_MASK      (0x03 << 0)
-
-#define S3C2410_GPE1_I2SSCLK   (0x02 << 2)
-#define S3C2443_GPE1_AC_SYNC   (0x03 << 2)
-#define S3C2410_GPE1_MASK      (0x03 << 2)
-
-#define S3C2410_GPE2_CDCLK     (0x02 << 4)
-#define S3C2443_GPE2_AC_BITCLK (0x03 << 4)
-
-#define S3C2410_GPE3_I2SSDI    (0x02 << 6)
-#define S3C2443_GPE3_AC_SDI    (0x03 << 6)
-#define S3C2410_GPE3_nSS0      (0x03 << 6)
-#define S3C2410_GPE3_MASK      (0x03 << 6)
-
-#define S3C2410_GPE4_I2SSDO    (0x02 << 8)
-#define S3C2443_GPE4_AC_SDO    (0x03 << 8)
-#define S3C2410_GPE4_I2SSDI    (0x03 << 8)
-#define S3C2410_GPE4_MASK      (0x03 << 8)
-
-#define S3C2410_GPE5_SDCLK     (0x02 << 10)
-#define S3C2443_GPE5_SD1_CLK   (0x02 << 10)
-#define S3C2443_GPE5_AC_BITCLK (0x03 << 10)
-
-#define S3C2410_GPE6_SDCMD     (0x02 << 12)
-#define S3C2443_GPE6_SD1_CMD   (0x02 << 12)
-#define S3C2443_GPE6_AC_SDI    (0x03 << 12)
-
-#define S3C2410_GPE7_SDDAT0    (0x02 << 14)
-#define S3C2443_GPE5_SD1_DAT0  (0x02 << 14)
-#define S3C2443_GPE7_AC_SDO    (0x03 << 14)
-
-#define S3C2410_GPE8_SDDAT1    (0x02 << 16)
-#define S3C2443_GPE8_SD1_DAT1  (0x02 << 16)
-#define S3C2443_GPE8_AC_SYNC   (0x03 << 16)
-
-#define S3C2410_GPE9_SDDAT2    (0x02 << 18)
-#define S3C2443_GPE9_SD1_DAT2  (0x02 << 18)
-#define S3C2443_GPE9_AC_nRESET (0x03 << 18)
-
-#define S3C2410_GPE10_SDDAT3   (0x02 << 20)
-#define S3C2443_GPE10_SD1_DAT3 (0x02 << 20)
-
-#define S3C2410_GPE11_SPIMISO0 (0x02 << 22)
-
-#define S3C2410_GPE12_SPIMOSI0 (0x02 << 24)
-
-#define S3C2410_GPE13_SPICLK0  (0x02 << 26)
-
-#define S3C2410_GPE14_IICSCL   (0x02 << 28)
-#define S3C2410_GPE14_MASK     (0x03 << 28)
-
-#define S3C2410_GPE15_IICSDA   (0x02 << 30)
-#define S3C2410_GPE15_MASK     (0x03 << 30)
-
-#define S3C2440_GPE0_ACSYNC    (0x03 << 0)
-#define S3C2440_GPE1_ACBITCLK  (0x03 << 2)
-#define S3C2440_GPE2_ACRESET   (0x03 << 4)
-#define S3C2440_GPE3_ACIN      (0x03 << 6)
-#define S3C2440_GPE4_ACOUT     (0x03 << 8)
-
-#define S3C2410_GPE_PUPDIS(x)  (1<<(x))
-
-/* S3C2410:
- * Port F consists of 8 GPIO/Special function
- *
- * GPIO / interrupt inputs
- *
- * GPFCON has 2 bits for each of the input pins on port F
- *   00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined
- *
- * pull up works like all other ports.
- *
- * GPIO/serial/misc pins
-*/
-
-#define S3C2410_GPFCON    S3C2410_GPIOREG(0x50)
-#define S3C2410_GPFDAT    S3C2410_GPIOREG(0x54)
-#define S3C2410_GPFUP     S3C2410_GPIOREG(0x58)
-
-#define S3C2410_GPF0_EINT0  (0x02 << 0)
-#define S3C2410_GPF1_EINT1  (0x02 << 2)
-#define S3C2410_GPF2_EINT2  (0x02 << 4)
-#define S3C2410_GPF3_EINT3  (0x02 << 6)
-#define S3C2410_GPF4_EINT4  (0x02 << 8)
-#define S3C2410_GPF5_EINT5  (0x02 << 10)
-#define S3C2410_GPF6_EINT6  (0x02 << 12)
-#define S3C2410_GPF7_EINT7  (0x02 << 14)
-#define S3C2410_GPF_PUPDIS(x)  (1<<(x))
-
-/* S3C2410:
- * Port G consists of 8 GPIO/IRQ/Special function
- *
- * GPGCON has 2 bits for each of the input pins on port G
- *   00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
- *
- * pull up works like all other ports.
-*/
-
-#define S3C2410_GPGCON    S3C2410_GPIOREG(0x60)
-#define S3C2410_GPGDAT    S3C2410_GPIOREG(0x64)
-#define S3C2410_GPGUP     S3C2410_GPIOREG(0x68)
-
-#define S3C2410_GPG0_EINT8    (0x02 << 0)
-
-#define S3C2410_GPG1_EINT9    (0x02 << 2)
-
-#define S3C2410_GPG2_EINT10   (0x02 << 4)
-#define S3C2410_GPG2_nSS0     (0x03 << 4)
-
-#define S3C2410_GPG3_EINT11   (0x02 << 6)
-#define S3C2410_GPG3_nSS1     (0x03 << 6)
-
-#define S3C2410_GPG4_EINT12   (0x02 << 8)
-#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
-#define S3C2443_GPG4_LCDPWRDN (0x03 << 8)
-
-#define S3C2410_GPG5_EINT13   (0x02 << 10)
-#define S3C2410_GPG5_SPIMISO1 (0x03 << 10)     /* not s3c2443 */
-
-#define S3C2410_GPG6_EINT14   (0x02 << 12)
-#define S3C2410_GPG6_SPIMOSI1 (0x03 << 12)
-
-#define S3C2410_GPG7_EINT15   (0x02 << 14)
-#define S3C2410_GPG7_SPICLK1  (0x03 << 14)
-
-#define S3C2410_GPG8_EINT16   (0x02 << 16)
-
-#define S3C2410_GPG9_EINT17   (0x02 << 18)
-
-#define S3C2410_GPG10_EINT18  (0x02 << 20)
-
-#define S3C2410_GPG11_EINT19  (0x02 << 22)
-#define S3C2410_GPG11_TCLK1   (0x03 << 22)
-#define S3C2443_GPG11_CF_nIREQ (0x03 << 22)
-
-#define S3C2410_GPG12_EINT20  (0x02 << 24)
-#define S3C2410_GPG12_XMON    (0x03 << 24)
-#define S3C2442_GPG12_nSPICS0 (0x03 << 24)
-#define S3C2443_GPG12_nINPACK (0x03 << 24)
-
-#define S3C2410_GPG13_EINT21  (0x02 << 26)
-#define S3C2410_GPG13_nXPON   (0x03 << 26)
-#define S3C2443_GPG13_CF_nREG (0x03 << 26)
-
-#define S3C2410_GPG14_EINT22  (0x02 << 28)
-#define S3C2410_GPG14_YMON    (0x03 << 28)
-#define S3C2443_GPG14_CF_RESET (0x03 << 28)
-
-#define S3C2410_GPG15_EINT23  (0x02 << 30)
-#define S3C2410_GPG15_nYPON   (0x03 << 30)
-#define S3C2443_GPG15_CF_PWR  (0x03 << 30)
-
-#define S3C2410_GPG_PUPDIS(x)  (1<<(x))
-
-/* Port H consists of11 GPIO/serial/Misc pins
- *
- * GPHCON has 2 bits for each of the input pins on port H
- *   00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
- *
- * pull up works like all other ports.
-*/
-
-#define S3C2410_GPHCON    S3C2410_GPIOREG(0x70)
-#define S3C2410_GPHDAT    S3C2410_GPIOREG(0x74)
-#define S3C2410_GPHUP     S3C2410_GPIOREG(0x78)
-
-#define S3C2410_GPH0_nCTS0  (0x02 << 0)
-#define S3C2416_GPH0_TXD0  (0x02 << 0)
-
-#define S3C2410_GPH1_nRTS0  (0x02 << 2)
-#define S3C2416_GPH1_RXD0  (0x02 << 2)
-
-#define S3C2410_GPH2_TXD0   (0x02 << 4)
-#define S3C2416_GPH2_TXD1   (0x02 << 4)
-
-#define S3C2410_GPH3_RXD0   (0x02 << 6)
-#define S3C2416_GPH3_RXD1   (0x02 << 6)
-
-#define S3C2410_GPH4_TXD1   (0x02 << 8)
-#define S3C2416_GPH4_TXD2   (0x02 << 8)
-
-#define S3C2410_GPH5_RXD1   (0x02 << 10)
-#define S3C2416_GPH5_RXD2   (0x02 << 10)
-
-#define S3C2410_GPH6_TXD2   (0x02 << 12)
-#define S3C2416_GPH6_TXD3   (0x02 << 12)
-#define S3C2410_GPH6_nRTS1  (0x03 << 12)
-#define S3C2416_GPH6_nRTS2  (0x03 << 12)
-
-#define S3C2410_GPH7_RXD2   (0x02 << 14)
-#define S3C2416_GPH7_RXD3   (0x02 << 14)
-#define S3C2410_GPH7_nCTS1  (0x03 << 14)
-#define S3C2416_GPH7_nCTS2  (0x03 << 14)
-
-#define S3C2410_GPH8_UCLK   (0x02 << 16)
-#define S3C2416_GPH8_nCTS0  (0x02 << 16)
-
-#define S3C2410_GPH9_CLKOUT0  (0x02 << 18)
-#define S3C2442_GPH9_nSPICS0  (0x03 << 18)
-#define S3C2416_GPH9_nRTS0    (0x02 << 18)
-
-#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
-#define S3C2416_GPH10_nCTS1   (0x02 << 20)
-
-#define S3C2416_GPH11_nRTS1   (0x02 << 22)
-
-#define S3C2416_GPH12_EXTUARTCLK (0x02 << 24)
-
-#define S3C2416_GPH13_CLKOUT0 (0x02 << 26)
-
-#define S3C2416_GPH14_CLKOUT1 (0x02 << 28)
-
-/* The S3C2412 and S3C2413 move the GPJ register set to after
- * GPH, which means all registers after 0x80 are now offset by 0x10
- * for the 2412/2413 from the 2410/2440/2442
-*/
-
-/*
- * Port J consists of 13 GPIO/Camera pins. GPJCON has 2 bits
- * for each of the pins on port J.
- *   00 - input, 01 output, 10 - camera
- *
- * Pull up works like all other ports.
- */
-
-#define S3C2413_GPJCON    S3C2410_GPIOREG(0x80)
-#define S3C2413_GPJDAT    S3C2410_GPIOREG(0x84)
-#define S3C2413_GPJUP     S3C2410_GPIOREG(0x88)
-#define S3C2413_GPJSLPCON  S3C2410_GPIOREG(0x8C)
-
-/* S3C2443 and above */
-#define S3C2440_GPJCON    S3C2410_GPIOREG(0xD0)
-#define S3C2440_GPJDAT    S3C2410_GPIOREG(0xD4)
-#define S3C2440_GPJUP     S3C2410_GPIOREG(0xD8)
-
-#define S3C2443_GPKCON    S3C2410_GPIOREG(0xE0)
-#define S3C2443_GPKDAT    S3C2410_GPIOREG(0xE4)
-#define S3C2443_GPKUP     S3C2410_GPIOREG(0xE8)
-
-#define S3C2443_GPLCON    S3C2410_GPIOREG(0xF0)
-#define S3C2443_GPLDAT    S3C2410_GPIOREG(0xF4)
-#define S3C2443_GPLUP     S3C2410_GPIOREG(0xF8)
-
-#define S3C2443_GPMCON    S3C2410_GPIOREG(0x100)
-#define S3C2443_GPMDAT    S3C2410_GPIOREG(0x104)
-#define S3C2443_GPMUP     S3C2410_GPIOREG(0x108)
-
-/* miscellaneous control */
-#define S3C2410_MISCCR    S3C2410_GPIOREG(0x80)
-
-/* see clock.h for dclk definitions */
-
-/* pullup control on databus */
-#define S3C2410_MISCCR_SPUCR_HEN    (0<<0)
-#define S3C2410_MISCCR_SPUCR_HDIS   (1<<0)
-#define S3C2410_MISCCR_SPUCR_LEN    (0<<1)
-#define S3C2410_MISCCR_SPUCR_LDIS   (1<<1)
-
-#define S3C2410_MISCCR_USBDEV      (0<<3)
-#define S3C2410_MISCCR_USBHOST     (1<<3)
-
-#define S3C2410_MISCCR_CLK0_MPLL    (0<<4)
-#define S3C2410_MISCCR_CLK0_UPLL    (1<<4)
-#define S3C2410_MISCCR_CLK0_FCLK    (2<<4)
-#define S3C2410_MISCCR_CLK0_HCLK    (3<<4)
-#define S3C2410_MISCCR_CLK0_PCLK    (4<<4)
-#define S3C2410_MISCCR_CLK0_DCLK0   (5<<4)
-#define S3C2410_MISCCR_CLK0_MASK    (7<<4)
-
-#define S3C2412_MISCCR_CLK0_RTC            (2<<4)
-
-#define S3C2410_MISCCR_CLK1_MPLL    (0<<8)
-#define S3C2410_MISCCR_CLK1_UPLL    (1<<8)
-#define S3C2410_MISCCR_CLK1_FCLK    (2<<8)
-#define S3C2410_MISCCR_CLK1_HCLK    (3<<8)
-#define S3C2410_MISCCR_CLK1_PCLK    (4<<8)
-#define S3C2410_MISCCR_CLK1_DCLK1   (5<<8)
-#define S3C2410_MISCCR_CLK1_MASK    (7<<8)
-
-#define S3C2412_MISCCR_CLK1_CLKsrc  (0<<8)
-
-#define S3C2410_MISCCR_USBSUSPND0   (1<<12)
-#define S3C2416_MISCCR_SEL_SUSPND   (1<<12)
-#define S3C2410_MISCCR_USBSUSPND1   (1<<13)
-
-#define S3C2410_MISCCR_nRSTCON     (1<<16)
-
-#define S3C2410_MISCCR_nEN_SCLK0    (1<<17)
-#define S3C2410_MISCCR_nEN_SCLK1    (1<<18)
-#define S3C2410_MISCCR_nEN_SCLKE    (1<<19)    /* not 2412 */
-#define S3C2410_MISCCR_SDSLEEP     (7<<17)
-
-#define S3C2416_MISCCR_FLT_I2C      (1<<24)
-#define S3C2416_MISCCR_HSSPI_EN2    (1<<31)
-
-/* external interrupt control... */
-/* S3C2410_EXTINT0 -> irq sense control for EINT0..EINT7
- * S3C2410_EXTINT1 -> irq sense control for EINT8..EINT15
- * S3C2410_EXTINT2 -> irq sense control for EINT16..EINT23
- *
- * note S3C2410_EXTINT2 has filtering options for EINT16..EINT23
- *
- * Samsung datasheet p9-25
-*/
-#define S3C2410_EXTINT0           S3C2410_GPIOREG(0x88)
-#define S3C2410_EXTINT1           S3C2410_GPIOREG(0x8C)
-#define S3C2410_EXTINT2           S3C2410_GPIOREG(0x90)
-
-#define S3C24XX_EXTINT0           S3C24XX_GPIOREG2(0x88)
-#define S3C24XX_EXTINT1           S3C24XX_GPIOREG2(0x8C)
-#define S3C24XX_EXTINT2           S3C24XX_GPIOREG2(0x90)
-
-/* interrupt filtering control for EINT16..EINT23 */
-#define S3C2410_EINFLT0           S3C2410_GPIOREG(0x94)
-#define S3C2410_EINFLT1           S3C2410_GPIOREG(0x98)
-#define S3C2410_EINFLT2           S3C2410_GPIOREG(0x9C)
-#define S3C2410_EINFLT3           S3C2410_GPIOREG(0xA0)
-
-#define S3C24XX_EINFLT0           S3C24XX_GPIOREG2(0x94)
-#define S3C24XX_EINFLT1           S3C24XX_GPIOREG2(0x98)
-#define S3C24XX_EINFLT2           S3C24XX_GPIOREG2(0x9C)
-#define S3C24XX_EINFLT3           S3C24XX_GPIOREG2(0xA0)
-
-/* values for interrupt filtering */
-#define S3C2410_EINTFLT_PCLK           (0x00)
-#define S3C2410_EINTFLT_EXTCLK         (1<<7)
-#define S3C2410_EINTFLT_WIDTHMSK(x)    ((x) & 0x3f)
-
-/* removed EINTxxxx defs from here, not meant for this */
-
-/* GSTATUS have miscellaneous information in them
- *
- * These move between s3c2410 and s3c2412 style systems.
- */
-
-#define S3C2410_GSTATUS0   S3C2410_GPIOREG(0x0AC)
-#define S3C2410_GSTATUS1   S3C2410_GPIOREG(0x0B0)
-#define S3C2410_GSTATUS2   S3C2410_GPIOREG(0x0B4)
-#define S3C2410_GSTATUS3   S3C2410_GPIOREG(0x0B8)
-#define S3C2410_GSTATUS4   S3C2410_GPIOREG(0x0BC)
-
-#define S3C2412_GSTATUS0   S3C2410_GPIOREG(0x0BC)
-#define S3C2412_GSTATUS1   S3C2410_GPIOREG(0x0C0)
-#define S3C2412_GSTATUS2   S3C2410_GPIOREG(0x0C4)
-#define S3C2412_GSTATUS3   S3C2410_GPIOREG(0x0C8)
-#define S3C2412_GSTATUS4   S3C2410_GPIOREG(0x0CC)
-
-#define S3C24XX_GSTATUS0   S3C24XX_GPIOREG2(0x0AC)
-#define S3C24XX_GSTATUS1   S3C24XX_GPIOREG2(0x0B0)
-#define S3C24XX_GSTATUS2   S3C24XX_GPIOREG2(0x0B4)
-#define S3C24XX_GSTATUS3   S3C24XX_GPIOREG2(0x0B8)
-#define S3C24XX_GSTATUS4   S3C24XX_GPIOREG2(0x0BC)
-
-#define S3C2410_GSTATUS0_nWAIT    (1<<3)
-#define S3C2410_GSTATUS0_NCON     (1<<2)
-#define S3C2410_GSTATUS0_RnB      (1<<1)
-#define S3C2410_GSTATUS0_nBATTFLT  (1<<0)
-
-#define S3C2410_GSTATUS1_IDMASK           (0xffff0000)
-#define S3C2410_GSTATUS1_2410     (0x32410000)
-#define S3C2410_GSTATUS1_2412     (0x32412001)
-#define S3C2410_GSTATUS1_2416     (0x32416003)
-#define S3C2410_GSTATUS1_2440     (0x32440000)
-#define S3C2410_GSTATUS1_2442     (0x32440aaa)
-/* some 2416 CPUs report this value also */
-#define S3C2410_GSTATUS1_2450     (0x32450003)
-
-#define S3C2410_GSTATUS2_WTRESET   (1<<2)
-#define S3C2410_GSTATUS2_OFFRESET  (1<<1)
-#define S3C2410_GSTATUS2_PONRESET  (1<<0)
-
-/* 2412/2413 sleep configuration registers */
-
-#define S3C2412_GPBSLPCON      S3C2410_GPIOREG(0x1C)
-#define S3C2412_GPCSLPCON      S3C2410_GPIOREG(0x2C)
-#define S3C2412_GPDSLPCON      S3C2410_GPIOREG(0x3C)
-#define S3C2412_GPFSLPCON      S3C2410_GPIOREG(0x5C)
-#define S3C2412_GPGSLPCON      S3C2410_GPIOREG(0x6C)
-#define S3C2412_GPHSLPCON      S3C2410_GPIOREG(0x7C)
-
-/* definitions for each pin bit */
-#define S3C2412_GPIO_SLPCON_LOW         ( 0x00 )
-#define S3C2412_GPIO_SLPCON_HIGH ( 0x01 )
-#define S3C2412_GPIO_SLPCON_IN   ( 0x02 )
-#define S3C2412_GPIO_SLPCON_PULL ( 0x03 )
-
-#define S3C2412_SLPCON_LOW(x)  ( 0x00 << ((x) * 2))
-#define S3C2412_SLPCON_HIGH(x) ( 0x01 << ((x) * 2))
-#define S3C2412_SLPCON_IN(x)   ( 0x02 << ((x) * 2))
-#define S3C2412_SLPCON_PULL(x) ( 0x03 << ((x) * 2))
-#define S3C2412_SLPCON_EINT(x) ( 0x02 << ((x) * 2))  /* only IRQ pins */
-#define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2))
-
-#define S3C2412_SLPCON_ALL_LOW (0x0)
-#define S3C2412_SLPCON_ALL_HIGH        (0x11111111 | 0x44444444)
-#define S3C2412_SLPCON_ALL_IN          (0x22222222 | 0x88888888)
-#define S3C2412_SLPCON_ALL_PULL        (0x33333333)
-
-#endif /* __ASM_ARCH_REGS_GPIO_H */
-
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-irq.h b/arch/arm/mach-s3c24xx/include/mach/regs-irq.h
deleted file mode 100644 (file)
index 8d8e669..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
- *                   http://www.simtec.co.uk/products/SWLINUX/
- */
-
-
-#ifndef ___ASM_ARCH_REGS_IRQ_H
-#define ___ASM_ARCH_REGS_IRQ_H
-
-/* interrupt controller */
-
-#define S3C2410_IRQREG(x)   ((x) + S3C24XX_VA_IRQ)
-#define S3C2410_EINTREG(x)  ((x) + S3C24XX_VA_GPIO)
-#define S3C24XX_EINTREG(x)  ((x) + S3C24XX_VA_GPIO2)
-
-#define S3C2410_SRCPND        S3C2410_IRQREG(0x000)
-#define S3C2410_INTMOD        S3C2410_IRQREG(0x004)
-#define S3C2410_INTMSK        S3C2410_IRQREG(0x008)
-#define S3C2410_PRIORITY       S3C2410_IRQREG(0x00C)
-#define S3C2410_INTPND        S3C2410_IRQREG(0x010)
-#define S3C2410_INTOFFSET      S3C2410_IRQREG(0x014)
-#define S3C2410_SUBSRCPND      S3C2410_IRQREG(0x018)
-#define S3C2410_INTSUBMSK      S3C2410_IRQREG(0x01C)
-
-#define S3C2416_PRIORITY_MODE1         S3C2410_IRQREG(0x030)
-#define S3C2416_PRIORITY_UPDATE1       S3C2410_IRQREG(0x034)
-#define S3C2416_SRCPND2                        S3C2410_IRQREG(0x040)
-#define S3C2416_INTMOD2                        S3C2410_IRQREG(0x044)
-#define S3C2416_INTMSK2                        S3C2410_IRQREG(0x048)
-#define S3C2416_INTPND2                        S3C2410_IRQREG(0x050)
-#define S3C2416_INTOFFSET2             S3C2410_IRQREG(0x054)
-#define S3C2416_PRIORITY_MODE2         S3C2410_IRQREG(0x070)
-#define S3C2416_PRIORITY_UPDATE2       S3C2410_IRQREG(0x074)
-
-/* mask: 0=enable, 1=disable
- * 1 bit EINT, 4=EINT4, 23=EINT23
- * EINT0,1,2,3 are not handled here.
-*/
-
-#define S3C2410_EINTMASK       S3C2410_EINTREG(0x0A4)
-#define S3C2410_EINTPEND       S3C2410_EINTREG(0X0A8)
-#define S3C2412_EINTMASK       S3C2410_EINTREG(0x0B4)
-#define S3C2412_EINTPEND       S3C2410_EINTREG(0X0B8)
-
-#define S3C24XX_EINTMASK       S3C24XX_EINTREG(0x0A4)
-#define S3C24XX_EINTPEND       S3C24XX_EINTREG(0X0A8)
-
-#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h b/arch/arm/mach-s3c24xx/include/mach/regs-lcd.h
deleted file mode 100644 (file)
index 4c3434f..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
- *                   http://www.simtec.co.uk/products/SWLINUX/
- */
-
-#ifndef ___ASM_ARCH_REGS_LCD_H
-#define ___ASM_ARCH_REGS_LCD_H
-
-#define S3C2410_LCDREG(x)      (x)
-
-/* LCD control registers */
-#define S3C2410_LCDCON1            S3C2410_LCDREG(0x00)
-#define S3C2410_LCDCON2            S3C2410_LCDREG(0x04)
-#define S3C2410_LCDCON3            S3C2410_LCDREG(0x08)
-#define S3C2410_LCDCON4            S3C2410_LCDREG(0x0C)
-#define S3C2410_LCDCON5            S3C2410_LCDREG(0x10)
-
-#define S3C2410_LCDCON1_CLKVAL(x)  ((x) << 8)
-#define S3C2410_LCDCON1_MMODE     (1<<7)
-#define S3C2410_LCDCON1_DSCAN4    (0<<5)
-#define S3C2410_LCDCON1_STN4      (1<<5)
-#define S3C2410_LCDCON1_STN8      (2<<5)
-#define S3C2410_LCDCON1_TFT       (3<<5)
-
-#define S3C2410_LCDCON1_STN1BPP           (0<<1)
-#define S3C2410_LCDCON1_STN2GREY   (1<<1)
-#define S3C2410_LCDCON1_STN4GREY   (2<<1)
-#define S3C2410_LCDCON1_STN8BPP           (3<<1)
-#define S3C2410_LCDCON1_STN12BPP   (4<<1)
-
-#define S3C2410_LCDCON1_TFT1BPP           (8<<1)
-#define S3C2410_LCDCON1_TFT2BPP           (9<<1)
-#define S3C2410_LCDCON1_TFT4BPP           (10<<1)
-#define S3C2410_LCDCON1_TFT8BPP           (11<<1)
-#define S3C2410_LCDCON1_TFT16BPP   (12<<1)
-#define S3C2410_LCDCON1_TFT24BPP   (13<<1)
-
-#define S3C2410_LCDCON1_ENVID     (1)
-
-#define S3C2410_LCDCON1_MODEMASK    0x1E
-
-#define S3C2410_LCDCON2_VBPD(x)            ((x) << 24)
-#define S3C2410_LCDCON2_LINEVAL(x)  ((x) << 14)
-#define S3C2410_LCDCON2_VFPD(x)            ((x) << 6)
-#define S3C2410_LCDCON2_VSPW(x)            ((x) << 0)
-
-#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
-#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >>  6) & 0xFF)
-#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >>  0) & 0x3F)
-
-#define S3C2410_LCDCON3_HBPD(x)            ((x) << 19)
-#define S3C2410_LCDCON3_WDLY(x)            ((x) << 19)
-#define S3C2410_LCDCON3_HOZVAL(x)   ((x) << 8)
-#define S3C2410_LCDCON3_HFPD(x)            ((x) << 0)
-#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
-
-#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
-#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >>  0) & 0xFF)
-
-/* LDCCON4 changes for STN mode on the S3C2412 */
-
-#define S3C2410_LCDCON4_MVAL(x)            ((x) << 8)
-#define S3C2410_LCDCON4_HSPW(x)            ((x) << 0)
-#define S3C2410_LCDCON4_WLH(x)     ((x) << 0)
-
-#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >>  0) & 0xFF)
-
-#define S3C2410_LCDCON5_BPP24BL            (1<<12)
-#define S3C2410_LCDCON5_FRM565     (1<<11)
-#define S3C2410_LCDCON5_INVVCLK            (1<<10)
-#define S3C2410_LCDCON5_INVVLINE    (1<<9)
-#define S3C2410_LCDCON5_INVVFRAME   (1<<8)
-#define S3C2410_LCDCON5_INVVD      (1<<7)
-#define S3C2410_LCDCON5_INVVDEN            (1<<6)
-#define S3C2410_LCDCON5_INVPWREN    (1<<5)
-#define S3C2410_LCDCON5_INVLEND            (1<<4)
-#define S3C2410_LCDCON5_PWREN      (1<<3)
-#define S3C2410_LCDCON5_ENLEND     (1<<2)
-#define S3C2410_LCDCON5_BSWP       (1<<1)
-#define S3C2410_LCDCON5_HWSWP      (1<<0)
-
-/* framebuffer start addressed */
-#define S3C2410_LCDSADDR1   S3C2410_LCDREG(0x14)
-#define S3C2410_LCDSADDR2   S3C2410_LCDREG(0x18)
-#define S3C2410_LCDSADDR3   S3C2410_LCDREG(0x1C)
-
-#define S3C2410_LCDBANK(x)     ((x) << 21)
-#define S3C2410_LCDBASEU(x)    (x)
-
-#define S3C2410_OFFSIZE(x)     ((x) << 11)
-#define S3C2410_PAGEWIDTH(x)   (x)
-
-/* colour lookup and miscellaneous controls */
-
-#define S3C2410_REDLUT    S3C2410_LCDREG(0x20)
-#define S3C2410_GREENLUT   S3C2410_LCDREG(0x24)
-#define S3C2410_BLUELUT           S3C2410_LCDREG(0x28)
-
-#define S3C2410_DITHMODE   S3C2410_LCDREG(0x4C)
-#define S3C2410_TPAL      S3C2410_LCDREG(0x50)
-
-#define S3C2410_TPAL_EN                (1<<24)
-
-/* interrupt info */
-#define S3C2410_LCDINTPND  S3C2410_LCDREG(0x54)
-#define S3C2410_LCDSRCPND  S3C2410_LCDREG(0x58)
-#define S3C2410_LCDINTMSK  S3C2410_LCDREG(0x5C)
-#define S3C2410_LCDINT_FIWSEL  (1<<2)
-#define        S3C2410_LCDINT_FRSYNC   (1<<1)
-#define S3C2410_LCDINT_FICNT   (1<<0)
-
-/* s3c2442 extra stn registers */
-
-#define S3C2442_REDLUT         S3C2410_LCDREG(0x20)
-#define S3C2442_GREENLUT       S3C2410_LCDREG(0x24)
-#define S3C2442_BLUELUT                S3C2410_LCDREG(0x28)
-#define S3C2442_DITHMODE       S3C2410_LCDREG(0x20)
-
-#define S3C2410_LPCSEL    S3C2410_LCDREG(0x60)
-
-#define S3C2410_TFTPAL(x)  S3C2410_LCDREG((0x400 + (x)*4))
-
-/* S3C2412 registers */
-
-#define S3C2412_TPAL           S3C2410_LCDREG(0x20)
-
-#define S3C2412_LCDINTPND      S3C2410_LCDREG(0x24)
-#define S3C2412_LCDSRCPND      S3C2410_LCDREG(0x28)
-#define S3C2412_LCDINTMSK      S3C2410_LCDREG(0x2C)
-
-#define S3C2412_TCONSEL                S3C2410_LCDREG(0x30)
-
-#define S3C2412_LCDCON6                S3C2410_LCDREG(0x34)
-#define S3C2412_LCDCON7                S3C2410_LCDREG(0x38)
-#define S3C2412_LCDCON8                S3C2410_LCDREG(0x3C)
-#define S3C2412_LCDCON9                S3C2410_LCDREG(0x40)
-
-#define S3C2412_REDLUT(x)      S3C2410_LCDREG(0x44 + ((x)*4))
-#define S3C2412_GREENLUT(x)    S3C2410_LCDREG(0x60 + ((x)*4))
-#define S3C2412_BLUELUT(x)     S3C2410_LCDREG(0x98 + ((x)*4))
-
-#define S3C2412_FRCPAT(x)      S3C2410_LCDREG(0xB4 + ((x)*4))
-
-/* general registers */
-
-/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
- * are available. */
-
-#define S3C2410_LCDINTBASE     S3C2410_LCDREG(0x54)
-#define S3C2412_LCDINTBASE     S3C2410_LCDREG(0x24)
-
-#define S3C24XX_LCDINTPND      (0x00)
-#define S3C24XX_LCDSRCPND      (0x04)
-#define S3C24XX_LCDINTMSK      (0x08)
-
-#endif /* ___ASM_ARCH_REGS_LCD_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h
deleted file mode 100644 (file)
index 6bf9246..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2007 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * S3C2443 clock register definitions
- */
-
-#ifndef __ASM_ARM_REGS_S3C2443_CLOCK
-#define __ASM_ARM_REGS_S3C2443_CLOCK
-
-#define S3C2443_CLKREG(x)              ((x) + S3C24XX_VA_CLKPWR)
-
-#define S3C2443_PLLCON_MDIVSHIFT       16
-#define S3C2443_PLLCON_PDIVSHIFT       8
-#define S3C2443_PLLCON_SDIVSHIFT       0
-#define S3C2443_PLLCON_MDIVMASK                ((1<<(1+(23-16)))-1)
-#define S3C2443_PLLCON_PDIVMASK                ((1<<(1+(9-8)))-1)
-#define S3C2443_PLLCON_SDIVMASK                (3)
-
-#define S3C2443_MPLLCON                        S3C2443_CLKREG(0x10)
-#define S3C2443_EPLLCON                        S3C2443_CLKREG(0x18)
-#define S3C2443_CLKSRC                 S3C2443_CLKREG(0x20)
-#define S3C2443_CLKDIV0                        S3C2443_CLKREG(0x24)
-#define S3C2443_CLKDIV1                        S3C2443_CLKREG(0x28)
-#define S3C2443_HCLKCON                        S3C2443_CLKREG(0x30)
-#define S3C2443_PCLKCON                        S3C2443_CLKREG(0x34)
-#define S3C2443_SCLKCON                        S3C2443_CLKREG(0x38)
-#define S3C2443_PWRMODE                        S3C2443_CLKREG(0x40)
-#define S3C2443_SWRST                  S3C2443_CLKREG(0x44)
-#define S3C2443_BUSPRI0                        S3C2443_CLKREG(0x50)
-#define S3C2443_SYSID                  S3C2443_CLKREG(0x5C)
-#define S3C2443_PWRCFG                 S3C2443_CLKREG(0x60)
-#define S3C2443_RSTCON                 S3C2443_CLKREG(0x64)
-#define S3C2443_PHYCTRL                        S3C2443_CLKREG(0x80)
-#define S3C2443_PHYPWR                 S3C2443_CLKREG(0x84)
-#define S3C2443_URSTCON                        S3C2443_CLKREG(0x88)
-#define S3C2443_UCLKCON                        S3C2443_CLKREG(0x8C)
-
-#define S3C2443_PLLCON_OFF             (1<<24)
-
-#define S3C2443_CLKSRC_EPLLREF_XTAL    (2<<7)
-#define S3C2443_CLKSRC_EPLLREF_EXTCLK  (3<<7)
-#define S3C2443_CLKSRC_EPLLREF_MPLLREF (0<<7)
-#define S3C2443_CLKSRC_EPLLREF_MPLLREF2        (1<<7)
-#define S3C2443_CLKSRC_EPLLREF_MASK    (3<<7)
-
-#define S3C2443_CLKSRC_EXTCLK_DIV      (1<<3)
-
-#define S3C2443_CLKDIV0_HALF_HCLK      (1<<3)
-#define S3C2443_CLKDIV0_HALF_PCLK      (1<<2)
-
-#define S3C2443_CLKDIV0_HCLKDIV_MASK   (3<<0)
-
-#define S3C2443_CLKDIV0_EXTDIV_MASK    (3<<6)
-#define S3C2443_CLKDIV0_EXTDIV_SHIFT   (6)
-
-#define S3C2443_CLKDIV0_PREDIV_MASK    (3<<4)
-#define S3C2443_CLKDIV0_PREDIV_SHIFT   (4)
-
-#define S3C2416_CLKDIV0_ARMDIV_MASK    (7 << 9)
-#define S3C2443_CLKDIV0_ARMDIV_MASK    (15<<9)
-#define S3C2443_CLKDIV0_ARMDIV_SHIFT   (9)
-#define S3C2443_CLKDIV0_ARMDIV_1       (0<<9)
-#define S3C2443_CLKDIV0_ARMDIV_2       (8<<9)
-#define S3C2443_CLKDIV0_ARMDIV_3       (2<<9)
-#define S3C2443_CLKDIV0_ARMDIV_4       (9<<9)
-#define S3C2443_CLKDIV0_ARMDIV_6       (10<<9)
-#define S3C2443_CLKDIV0_ARMDIV_8       (11<<9)
-#define S3C2443_CLKDIV0_ARMDIV_12      (13<<9)
-#define S3C2443_CLKDIV0_ARMDIV_16      (15<<9)
-
-/* S3C2443_CLKDIV1 removed, only used in clock.c code */
-
-#define S3C2443_CLKCON_NAND
-
-#define S3C2443_HCLKCON_DMA0           (1<<0)
-#define S3C2443_HCLKCON_DMA1           (1<<1)
-#define S3C2443_HCLKCON_DMA2           (1<<2)
-#define S3C2443_HCLKCON_DMA3           (1<<3)
-#define S3C2443_HCLKCON_DMA4           (1<<4)
-#define S3C2443_HCLKCON_DMA5           (1<<5)
-#define S3C2443_HCLKCON_CAMIF          (1<<8)
-#define S3C2443_HCLKCON_LCDC           (1<<9)
-#define S3C2443_HCLKCON_USBH           (1<<11)
-#define S3C2443_HCLKCON_USBD           (1<<12)
-#define S3C2416_HCLKCON_HSMMC0         (1<<15)
-#define S3C2443_HCLKCON_HSMMC          (1<<16)
-#define S3C2443_HCLKCON_CFC            (1<<17)
-#define S3C2443_HCLKCON_SSMC           (1<<18)
-#define S3C2443_HCLKCON_DRAMC          (1<<19)
-
-#define S3C2443_PCLKCON_UART0          (1<<0)
-#define S3C2443_PCLKCON_UART1          (1<<1)
-#define S3C2443_PCLKCON_UART2          (1<<2)
-#define S3C2443_PCLKCON_UART3          (1<<3)
-#define S3C2443_PCLKCON_IIC            (1<<4)
-#define S3C2443_PCLKCON_SDI            (1<<5)
-#define S3C2443_PCLKCON_HSSPI          (1<<6)
-#define S3C2443_PCLKCON_ADC            (1<<7)
-#define S3C2443_PCLKCON_AC97           (1<<8)
-#define S3C2443_PCLKCON_IIS            (1<<9)
-#define S3C2443_PCLKCON_PWMT           (1<<10)
-#define S3C2443_PCLKCON_WDT            (1<<11)
-#define S3C2443_PCLKCON_RTC            (1<<12)
-#define S3C2443_PCLKCON_GPIO           (1<<13)
-#define S3C2443_PCLKCON_SPI0           (1<<14)
-#define S3C2443_PCLKCON_SPI1           (1<<15)
-
-#define S3C2443_SCLKCON_DDRCLK         (1<<16)
-#define S3C2443_SCLKCON_SSMCCLK                (1<<15)
-#define S3C2443_SCLKCON_HSSPICLK       (1<<14)
-#define S3C2443_SCLKCON_HSMMCCLK_EXT   (1<<13)
-#define S3C2443_SCLKCON_HSMMCCLK_EPLL  (1<<12)
-#define S3C2443_SCLKCON_CAMCLK         (1<<11)
-#define S3C2443_SCLKCON_DISPCLK                (1<<10)
-#define S3C2443_SCLKCON_I2SCLK         (1<<9)
-#define S3C2443_SCLKCON_UARTCLK                (1<<8)
-#define S3C2443_SCLKCON_USBHOST                (1<<1)
-
-#define S3C2443_PWRCFG_SLEEP           (1<<15)
-
-#define S3C2443_PWRCFG_USBPHY          (1 << 4)
-
-#define S3C2443_URSTCON_FUNCRST                (1 << 2)
-#define S3C2443_URSTCON_PHYRST         (1 << 0)
-
-#define S3C2443_PHYCTRL_CLKSEL         (1 << 3)
-#define S3C2443_PHYCTRL_EXTCLK         (1 << 2)
-#define S3C2443_PHYCTRL_PLLSEL         (1 << 1)
-#define S3C2443_PHYCTRL_DSPORT         (1 << 0)
-
-#define S3C2443_PHYPWR_COMMON_ON       (1 << 31)
-#define S3C2443_PHYPWR_ANALOG_PD       (1 << 4)
-#define S3C2443_PHYPWR_PLL_REFCLK      (1 << 3)
-#define S3C2443_PHYPWR_XO_ON           (1 << 2)
-#define S3C2443_PHYPWR_PLL_PWRDN       (1 << 1)
-#define S3C2443_PHYPWR_FSUSPEND                (1 << 0)
-
-#define S3C2443_UCLKCON_DETECT_VBUS    (1 << 31)
-#define S3C2443_UCLKCON_FUNC_CLKEN     (1 << 2)
-#define S3C2443_UCLKCON_TCLKEN         (1 << 0)
-
-#include <asm/div64.h>
-
-static inline unsigned int
-s3c2443_get_mpll(unsigned int pllval, unsigned int baseclk)
-{
-       unsigned int mdiv, pdiv, sdiv;
-       uint64_t fvco;
-
-       mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
-       pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
-       sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
-
-       mdiv &= S3C2443_PLLCON_MDIVMASK;
-       pdiv &= S3C2443_PLLCON_PDIVMASK;
-       sdiv &= S3C2443_PLLCON_SDIVMASK;
-
-       fvco = (uint64_t)baseclk * (2 * (mdiv + 8));
-       do_div(fvco, pdiv << sdiv);
-
-       return (unsigned int)fvco;
-}
-
-static inline unsigned int
-s3c2443_get_epll(unsigned int pllval, unsigned int baseclk)
-{
-       unsigned int mdiv, pdiv, sdiv;
-       uint64_t fvco;
-
-       mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
-       pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
-       sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
-
-       mdiv &= S3C2443_PLLCON_MDIVMASK;
-       pdiv &= S3C2443_PLLCON_PDIVMASK;
-       sdiv &= S3C2443_PLLCON_SDIVMASK;
-
-       fvco = (uint64_t)baseclk * (mdiv + 8);
-       do_div(fvco, (pdiv + 2) << sdiv);
-
-       return (unsigned int)fvco;
-}
-
-#endif /*  __ASM_ARM_REGS_S3C2443_CLOCK */
-
diff --git a/arch/arm/mach-s3c24xx/include/mach/rtc-core.h b/arch/arm/mach-s3c24xx/include/mach/rtc-core.h
deleted file mode 100644 (file)
index 8851033..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
- *
- * Samsung RTC Controller core functions
- */
-
-#ifndef __RTC_CORE_H
-#define __RTC_CORE_H __FILE__
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
- */
-
-extern struct platform_device s3c_device_rtc;
-
-/* re-define device name depending on support. */
-static inline void s3c_rtc_setname(char *name)
-{
-       s3c_device_rtc.name = name;
-}
-
-#endif /* __RTC_CORE_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/s3c2412.h b/arch/arm/mach-s3c24xx/include/mach/s3c2412.h
deleted file mode 100644 (file)
index 4ff83f9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- */
-
-#ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_H
-#define __ARCH_ARM_MACH_S3C24XX_S3C2412_H __FILE__
-
-#define S3C2412_MEMREG(x)              (S3C24XX_VA_MEMCTRL + (x))
-#define S3C2412_EBIREG(x)              (S3C2412_VA_EBI + (x))
-
-#define S3C2412_SSMCREG(x)             (S3C2412_VA_SSMC + (x))
-#define S3C2412_SSMC(x, o)             (S3C2412_SSMCREG((x * 0x20) + (o)))
-
-#define S3C2412_REFRESH                        S3C2412_MEMREG(0x10)
-
-#define S3C2412_EBI_BANKCFG            S3C2412_EBIREG(0x4)
-
-#define S3C2412_SSMC_BANK(x)           S3C2412_SSMC(x, 0x0)
-
-#endif /* __ARCH_ARM_MACH_S3C24XX_S3C2412_H */
diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2410.c b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c
deleted file mode 100644 (file)
index 9f90aaf..0000000
+++ /dev/null
@@ -1,472 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006-2009 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C24XX CPU Frequency scaling - IO timing for S3C2410/S3C2440/S3C2442
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/cpufreq.h>
-#include <linux/seq_file.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-
-#include <plat/cpu-freq-core.h>
-
-#include "regs-mem.h"
-
-#define print_ns(x) ((x) / 10), ((x) % 10)
-
-/**
- * s3c2410_print_timing - print bank timing data for debug purposes
- * @pfx: The prefix to put on the output
- * @timings: The timing inforamtion to print.
-*/
-static void s3c2410_print_timing(const char *pfx,
-                                struct s3c_iotimings *timings)
-{
-       struct s3c2410_iobank_timing *bt;
-       int bank;
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bt = timings->bank[bank].io_2410;
-               if (!bt)
-                       continue;
-
-               printk(KERN_DEBUG "%s %d: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, "
-                      "Tcoh=%d.%d, Tcah=%d.%d\n", pfx, bank,
-                      print_ns(bt->tacs),
-                      print_ns(bt->tcos),
-                      print_ns(bt->tacc),
-                      print_ns(bt->tcoh),
-                      print_ns(bt->tcah));
-       }
-}
-
-/**
- * bank_reg - convert bank number to pointer to the control register.
- * @bank: The IO bank number.
- */
-static inline void __iomem *bank_reg(unsigned int bank)
-{
-       return S3C2410_BANKCON0 + (bank << 2);
-}
-
-/**
- * bank_is_io - test whether bank is used for IO
- * @bankcon: The bank control register.
- *
- * This is a simplistic test to see if any BANKCON[x] is not an IO
- * bank. It currently does not take into account whether BWSCON has
- * an illegal width-setting in it, or if the pin connected to nCS[x]
- * is actually being handled as a chip-select.
- */
-static inline int bank_is_io(unsigned long bankcon)
-{
-       return !(bankcon & S3C2410_BANKCON_SDRAM);
-}
-
-/**
- * to_div - convert cycle time to divisor
- * @cyc: The cycle time, in 10ths of nanoseconds.
- * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
- *
- * Convert the given cycle time into the divisor to use to obtain it from
- * HCLK.
-*/
-static inline unsigned int to_div(unsigned int cyc, unsigned int hclk_tns)
-{
-       if (cyc == 0)
-               return 0;
-
-       return DIV_ROUND_UP(cyc, hclk_tns);
-}
-
-/**
- * calc_0124 - calculate divisor control for divisors that do /0, /1. /2 and /4
- * @cyc: The cycle time, in 10ths of nanoseconds.
- * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
- * @v: Pointer to register to alter.
- * @shift: The shift to get to the control bits.
- *
- * Calculate the divisor, and turn it into the correct control bits to
- * set in the result, @v.
- */
-static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns,
-                             unsigned long *v, int shift)
-{
-       unsigned int div = to_div(cyc, hclk_tns);
-       unsigned long val;
-
-       s3c_freq_iodbg("%s: cyc=%d, hclk=%lu, shift=%d => div %d\n",
-                      __func__, cyc, hclk_tns, shift, div);
-
-       switch (div) {
-       case 0:
-               val = 0;
-               break;
-       case 1:
-               val = 1;
-               break;
-       case 2:
-               val = 2;
-               break;
-       case 3:
-       case 4:
-               val = 3;
-               break;
-       default:
-               return -1;
-       }
-
-       *v |= val << shift;
-       return 0;
-}
-
-int calc_tacp(unsigned int cyc, unsigned long hclk, unsigned long *v)
-{
-       /* Currently no support for Tacp calculations. */
-       return 0;
-}
-
-/**
- * calc_tacc - calculate divisor control for tacc.
- * @cyc: The cycle time, in 10ths of nanoseconds.
- * @nwait_en: IS nWAIT enabled for this bank.
- * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
- * @v: Pointer to register to alter.
- *
- * Calculate the divisor control for tACC, taking into account whether
- * the bank has nWAIT enabled. The result is used to modify the value
- * pointed to by @v.
-*/
-static int calc_tacc(unsigned int cyc, int nwait_en,
-                    unsigned long hclk_tns, unsigned long *v)
-{
-       unsigned int div = to_div(cyc, hclk_tns);
-       unsigned long val;
-
-       s3c_freq_iodbg("%s: cyc=%u, nwait=%d, hclk=%lu => div=%u\n",
-                      __func__, cyc, nwait_en, hclk_tns, div);
-
-       /* if nWait enabled on an bank, Tacc must be at-least 4 cycles. */
-       if (nwait_en && div < 4)
-               div = 4;
-
-       switch (div) {
-       case 0:
-               val = 0;
-               break;
-
-       case 1:
-       case 2:
-       case 3:
-       case 4:
-               val = div - 1;
-               break;
-
-       case 5:
-       case 6:
-               val = 4;
-               break;
-
-       case 7:
-       case 8:
-               val = 5;
-               break;
-
-       case 9:
-       case 10:
-               val = 6;
-               break;
-
-       case 11:
-       case 12:
-       case 13:
-       case 14:
-               val = 7;
-               break;
-
-       default:
-               return -1;
-       }
-
-       *v |= val << 8;
-       return 0;
-}
-
-/**
- * s3c2410_calc_bank - calculate bank timing information
- * @cfg: The configuration we need to calculate for.
- * @bt: The bank timing information.
- *
- * Given the cycle timine for a bank @bt, calculate the new BANKCON
- * setting for the @cfg timing. This updates the timing information
- * ready for the cpu frequency change.
- */
-static int s3c2410_calc_bank(struct s3c_cpufreq_config *cfg,
-                            struct s3c2410_iobank_timing *bt)
-{
-       unsigned long hclk = cfg->freq.hclk_tns;
-       unsigned long res;
-       int ret;
-
-       res  = bt->bankcon;
-       res &= (S3C2410_BANKCON_SDRAM | S3C2410_BANKCON_PMC16);
-
-       /* tacp: 2,3,4,5 */
-       /* tcah: 0,1,2,4 */
-       /* tcoh: 0,1,2,4 */
-       /* tacc: 1,2,3,4,6,7,10,14 (>4 for nwait) */
-       /* tcos: 0,1,2,4 */
-       /* tacs: 0,1,2,4 */
-
-       ret  = calc_0124(bt->tacs, hclk, &res, S3C2410_BANKCON_Tacs_SHIFT);
-       ret |= calc_0124(bt->tcos, hclk, &res, S3C2410_BANKCON_Tcos_SHIFT);
-       ret |= calc_0124(bt->tcah, hclk, &res, S3C2410_BANKCON_Tcah_SHIFT);
-       ret |= calc_0124(bt->tcoh, hclk, &res, S3C2410_BANKCON_Tcoh_SHIFT);
-
-       if (ret)
-               return -EINVAL;
-
-       ret |= calc_tacp(bt->tacp, hclk, &res);
-       ret |= calc_tacc(bt->tacc, bt->nwait_en, hclk, &res);
-
-       if (ret)
-               return -EINVAL;
-
-       bt->bankcon = res;
-       return 0;
-}
-
-static const unsigned int tacc_tab[] = {
-       [0]     = 1,
-       [1]     = 2,
-       [2]     = 3,
-       [3]     = 4,
-       [4]     = 6,
-       [5]     = 9,
-       [6]     = 10,
-       [7]     = 14,
-};
-
-/**
- * get_tacc - turn tACC value into cycle time
- * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
- * @val: The bank timing register value, shifed down.
- */
-static unsigned int get_tacc(unsigned long hclk_tns,
-                            unsigned long val)
-{
-       val &= 7;
-       return hclk_tns * tacc_tab[val];
-}
-
-/**
- * get_0124 - turn 0/1/2/4 divider into cycle time
- * @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds.
- * @val: The bank timing register value, shifed down.
- */
-static unsigned int get_0124(unsigned long hclk_tns,
-                            unsigned long val)
-{
-       val &= 3;
-       return hclk_tns * ((val == 3) ? 4 : val);
-}
-
-/**
- * s3c2410_iotiming_getbank - turn BANKCON into cycle time information
- * @cfg: The frequency configuration
- * @bt: The bank timing to fill in (uses cached BANKCON)
- *
- * Given the BANKCON setting in @bt and the current frequency settings
- * in @cfg, update the cycle timing information.
- */
-void s3c2410_iotiming_getbank(struct s3c_cpufreq_config *cfg,
-                             struct s3c2410_iobank_timing *bt)
-{
-       unsigned long bankcon = bt->bankcon;
-       unsigned long hclk = cfg->freq.hclk_tns;
-
-       bt->tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT);
-       bt->tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT);
-       bt->tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT);
-       bt->tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT);
-       bt->tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT);
-}
-
-/**
- * s3c2410_iotiming_debugfs - debugfs show io bank timing information
- * @seq: The seq_file to write output to using seq_printf().
- * @cfg: The current configuration.
- * @iob: The IO bank information to decode.
- */
-void s3c2410_iotiming_debugfs(struct seq_file *seq,
-                             struct s3c_cpufreq_config *cfg,
-                             union s3c_iobank *iob)
-{
-       struct s3c2410_iobank_timing *bt = iob->io_2410;
-       unsigned long bankcon = bt->bankcon;
-       unsigned long hclk = cfg->freq.hclk_tns;
-       unsigned int tacs;
-       unsigned int tcos;
-       unsigned int tacc;
-       unsigned int tcoh;
-       unsigned int tcah;
-
-       seq_printf(seq, "BANKCON=0x%08lx\n", bankcon);
-
-       tcah = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcah_SHIFT);
-       tcoh = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcoh_SHIFT);
-       tcos = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tcos_SHIFT);
-       tacs = get_0124(hclk, bankcon >> S3C2410_BANKCON_Tacs_SHIFT);
-       tacc = get_tacc(hclk, bankcon >> S3C2410_BANKCON_Tacc_SHIFT);
-
-       seq_printf(seq,
-                  "\tRead: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
-                  print_ns(bt->tacs),
-                  print_ns(bt->tcos),
-                  print_ns(bt->tacc),
-                  print_ns(bt->tcoh),
-                  print_ns(bt->tcah));
-
-       seq_printf(seq,
-                  "\t Set: Tacs=%d.%d, Tcos=%d.%d, Tacc=%d.%d, Tcoh=%d.%d, Tcah=%d.%d\n",
-                  print_ns(tacs),
-                  print_ns(tcos),
-                  print_ns(tacc),
-                  print_ns(tcoh),
-                  print_ns(tcah));
-}
-
-/**
- * s3c2410_iotiming_calc - Calculate bank timing for frequency change.
- * @cfg: The frequency configuration
- * @iot: The IO timing information to fill out.
- *
- * Calculate the new values for the banks in @iot based on the new
- * frequency information in @cfg. This is then used by s3c2410_iotiming_set()
- * to update the timing when necessary.
- */
-int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
-                         struct s3c_iotimings *iot)
-{
-       struct s3c2410_iobank_timing *bt;
-       unsigned long bankcon;
-       int bank;
-       int ret;
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bankcon = __raw_readl(bank_reg(bank));
-               bt = iot->bank[bank].io_2410;
-
-               if (!bt)
-                       continue;
-
-               bt->bankcon = bankcon;
-
-               ret = s3c2410_calc_bank(cfg, bt);
-               if (ret) {
-                       printk(KERN_ERR "%s: cannot calculate bank %d io\n",
-                              __func__, bank);
-                       goto err;
-               }
-
-               s3c_freq_iodbg("%s: bank %d: con=%08lx\n",
-                              __func__, bank, bt->bankcon);
-       }
-
-       return 0;
- err:
-       return ret;
-}
-
-/**
- * s3c2410_iotiming_set - set the IO timings from the given setup.
- * @cfg: The frequency configuration
- * @iot: The IO timing information to use.
- *
- * Set all the currently used IO bank timing information generated
- * by s3c2410_iotiming_calc() once the core has validated that all
- * the new values are within permitted bounds.
- */
-void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
-                         struct s3c_iotimings *iot)
-{
-       struct s3c2410_iobank_timing *bt;
-       int bank;
-
-       /* set the io timings from the specifier */
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bt = iot->bank[bank].io_2410;
-               if (!bt)
-                       continue;
-
-               __raw_writel(bt->bankcon, bank_reg(bank));
-       }
-}
-
-/**
- * s3c2410_iotiming_get - Get the timing information from current registers.
- * @cfg: The frequency configuration
- * @timings: The IO timing information to fill out.
- *
- * Calculate the @timings timing information from the current frequency
- * information in @cfg, and the new frequency configuration
- * through all the IO banks, reading the state and then updating @iot
- * as necessary.
- *
- * This is used at the moment on initialisation to get the current
- * configuration so that boards do not have to carry their own setup
- * if the timings are correct on initialisation.
- */
-
-int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
-                        struct s3c_iotimings *timings)
-{
-       struct s3c2410_iobank_timing *bt;
-       unsigned long bankcon;
-       unsigned long bwscon;
-       int bank;
-
-       bwscon = __raw_readl(S3C2410_BWSCON);
-
-       /* look through all banks to see what is currently set. */
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bankcon = __raw_readl(bank_reg(bank));
-
-               if (!bank_is_io(bankcon))
-                       continue;
-
-               s3c_freq_iodbg("%s: bank %d: con %08lx\n",
-                              __func__, bank, bankcon);
-
-               bt = kzalloc(sizeof(*bt), GFP_KERNEL);
-               if (!bt)
-                       return -ENOMEM;
-
-               /* find out in nWait is enabled for bank. */
-
-               if (bank != 0) {
-                       unsigned long tmp  = S3C2410_BWSCON_GET(bwscon, bank);
-                       if (tmp & S3C2410_BWSCON_WS)
-                               bt->nwait_en = 1;
-               }
-
-               timings->bank[bank].io_2410 = bt;
-               bt->bankcon = bankcon;
-
-               s3c2410_iotiming_getbank(cfg, bt);
-       }
-
-       s3c2410_print_timing("get", timings);
-       return 0;
-}
diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2412.c b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
deleted file mode 100644 (file)
index 59356d1..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006-2008 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C2412/S3C2443 (PL093 based) IO timing support
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/cpufreq.h>
-#include <linux/seq_file.h>
-#include <linux/device.h>
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-
-#include <linux/amba/pl093.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
-
-#include <mach/s3c2412.h>
-
-#define print_ns(x) ((x) / 10), ((x) % 10)
-
-/**
- * s3c2412_print_timing - print timing information via printk.
- * @pfx: The prefix to print each line with.
- * @iot: The IO timing information
- */
-static void s3c2412_print_timing(const char *pfx, struct s3c_iotimings *iot)
-{
-       struct s3c2412_iobank_timing *bt;
-       unsigned int bank;
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bt = iot->bank[bank].io_2412;
-               if (!bt)
-                       continue;
-
-               printk(KERN_DEBUG "%s: %d: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
-                      "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n", pfx, bank,
-                      print_ns(bt->idcy),
-                      print_ns(bt->wstrd),
-                      print_ns(bt->wstwr),
-                      print_ns(bt->wstoen),
-                      print_ns(bt->wstwen),
-                      print_ns(bt->wstbrd));
-       }
-}
-
-/**
- * to_div - turn a cycle length into a divisor setting.
- * @cyc_tns: The cycle time in 10ths of nanoseconds.
- * @clk_tns: The clock period in 10ths of nanoseconds.
- */
-static inline unsigned int to_div(unsigned int cyc_tns, unsigned int clk_tns)
-{
-       return cyc_tns ? DIV_ROUND_UP(cyc_tns, clk_tns) : 0;
-}
-
-/**
- * calc_timing - calculate timing divisor value and check in range.
- * @hwtm: The hardware timing in 10ths of nanoseconds.
- * @clk_tns: The clock period in 10ths of nanoseconds.
- * @err: Pointer to err variable to update in event of failure.
- */
-static unsigned int calc_timing(unsigned int hwtm, unsigned int clk_tns,
-                               unsigned int *err)
-{
-       unsigned int ret = to_div(hwtm, clk_tns);
-
-       if (ret > 0xf)
-               *err = -EINVAL;
-
-       return ret;
-}
-
-/**
- * s3c2412_calc_bank - calculate the bank divisor settings.
- * @cfg: The current frequency configuration.
- * @bt: The bank timing.
- */
-static int s3c2412_calc_bank(struct s3c_cpufreq_config *cfg,
-                            struct s3c2412_iobank_timing *bt)
-{
-       unsigned int hclk = cfg->freq.hclk_tns;
-       int err = 0;
-
-       bt->smbidcyr = calc_timing(bt->idcy, hclk, &err);
-       bt->smbwstrd = calc_timing(bt->wstrd, hclk, &err);
-       bt->smbwstwr = calc_timing(bt->wstwr, hclk, &err);
-       bt->smbwstoen = calc_timing(bt->wstoen, hclk, &err);
-       bt->smbwstwen = calc_timing(bt->wstwen, hclk, &err);
-       bt->smbwstbrd = calc_timing(bt->wstbrd, hclk, &err);
-
-       return err;
-}
-
-/**
- * s3c2412_iotiming_debugfs - debugfs show io bank timing information
- * @seq: The seq_file to write output to using seq_printf().
- * @cfg: The current configuration.
- * @iob: The IO bank information to decode.
-*/
-void s3c2412_iotiming_debugfs(struct seq_file *seq,
-                             struct s3c_cpufreq_config *cfg,
-                             union s3c_iobank *iob)
-{
-       struct s3c2412_iobank_timing *bt = iob->io_2412;
-
-       seq_printf(seq,
-                  "\tRead: idcy=%d.%d wstrd=%d.%d wstwr=%d,%d"
-                  "wstoen=%d.%d wstwen=%d.%d wstbrd=%d.%d\n",
-                  print_ns(bt->idcy),
-                  print_ns(bt->wstrd),
-                  print_ns(bt->wstwr),
-                  print_ns(bt->wstoen),
-                  print_ns(bt->wstwen),
-                  print_ns(bt->wstbrd));
-}
-
-/**
- * s3c2412_iotiming_calc - calculate all the bank divisor settings.
- * @cfg: The current frequency configuration.
- * @iot: The bank timing information.
- *
- * Calculate the timing information for all the banks that are
- * configured as IO, using s3c2412_calc_bank().
- */
-int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
-                         struct s3c_iotimings *iot)
-{
-       struct s3c2412_iobank_timing *bt;
-       int bank;
-       int ret;
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bt = iot->bank[bank].io_2412;
-               if (!bt)
-                       continue;
-
-               ret = s3c2412_calc_bank(cfg, bt);
-               if (ret) {
-                       printk(KERN_ERR "%s: cannot calculate bank %d io\n",
-                              __func__, bank);
-                       goto err;
-               }
-       }
-
-       return 0;
- err:
-       return ret;
-}
-
-/**
- * s3c2412_iotiming_set - set the timing information
- * @cfg: The current frequency configuration.
- * @iot: The bank timing information.
- *
- * Set the IO bank information from the details calculated earlier from
- * calling s3c2412_iotiming_calc().
- */
-void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
-                         struct s3c_iotimings *iot)
-{
-       struct s3c2412_iobank_timing *bt;
-       void __iomem *regs;
-       int bank;
-
-       /* set the io timings from the specifier */
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               bt = iot->bank[bank].io_2412;
-               if (!bt)
-                       continue;
-
-               regs = S3C2412_SSMC_BANK(bank);
-
-               __raw_writel(bt->smbidcyr, regs + SMBIDCYR);
-               __raw_writel(bt->smbwstrd, regs + SMBWSTRDR);
-               __raw_writel(bt->smbwstwr, regs + SMBWSTWRR);
-               __raw_writel(bt->smbwstoen, regs + SMBWSTOENR);
-               __raw_writel(bt->smbwstwen, regs + SMBWSTWENR);
-               __raw_writel(bt->smbwstbrd, regs + SMBWSTBRDR);
-       }
-}
-
-static inline unsigned int s3c2412_decode_timing(unsigned int clock, u32 reg)
-{
-       return (reg & 0xf) * clock;
-}
-
-static void s3c2412_iotiming_getbank(struct s3c_cpufreq_config *cfg,
-                                    struct s3c2412_iobank_timing *bt,
-                                    unsigned int bank)
-{
-       unsigned long clk = cfg->freq.hclk_tns;  /* ssmc clock??? */
-       void __iomem *regs = S3C2412_SSMC_BANK(bank);
-
-       bt->idcy = s3c2412_decode_timing(clk, __raw_readl(regs + SMBIDCYR));
-       bt->wstrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTRDR));
-       bt->wstoen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTOENR));
-       bt->wstwen = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTWENR));
-       bt->wstbrd = s3c2412_decode_timing(clk, __raw_readl(regs + SMBWSTBRDR));
-}
-
-/**
- * bank_is_io - return true if bank is (possibly) IO.
- * @bank: The bank number.
- * @bankcfg: The value of S3C2412_EBI_BANKCFG.
- */
-static inline bool bank_is_io(unsigned int bank, u32 bankcfg)
-{
-       if (bank < 2)
-               return true;
-
-       return !(bankcfg & (1 << bank));
-}
-
-int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
-                        struct s3c_iotimings *timings)
-{
-       struct s3c2412_iobank_timing *bt;
-       u32 bankcfg = __raw_readl(S3C2412_EBI_BANKCFG);
-       unsigned int bank;
-
-       /* look through all banks to see what is currently set. */
-
-       for (bank = 0; bank < MAX_BANKS; bank++) {
-               if (!bank_is_io(bank, bankcfg))
-                       continue;
-
-               bt = kzalloc(sizeof(*bt), GFP_KERNEL);
-               if (!bt)
-                       return -ENOMEM;
-
-               timings->bank[bank].io_2412 = bt;
-               s3c2412_iotiming_getbank(cfg, bt, bank);
-       }
-
-       s3c2412_print_timing("get", timings);
-       return 0;
-}
-
-/* this is in here as it is so small, it doesn't currently warrant a file
- * to itself. We expect that any s3c24xx needing this is going to also
- * need the iotiming support.
- */
-void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
-{
-       struct s3c_cpufreq_board *board = cfg->board;
-       u32 refresh;
-
-       WARN_ON(board == NULL);
-
-       /* Reduce both the refresh time (in ns) and the frequency (in MHz)
-        * down to ensure that we do not overflow 32 bit numbers.
-        *
-        * This should work for HCLK up to 133MHz and refresh period up
-        * to 30usec.
-        */
-
-       refresh = (cfg->freq.hclk / 100) * (board->refresh / 10);
-       refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); /* apply scale  */
-       refresh &= ((1 << 16) - 1);
-
-       s3c_freq_dbg("%s: refresh value %u\n", __func__, (unsigned int)refresh);
-
-       __raw_writel(refresh, S3C2412_REFRESH);
-}
diff --git a/arch/arm/mach-s3c24xx/irq-pm.c b/arch/arm/mach-s3c24xx/irq-pm.c
deleted file mode 100644 (file)
index e0131b1..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2003-2004 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// S3C24XX - IRQ PM code
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/syscore_ops.h>
-#include <linux/io.h>
-
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <plat/map-base.h>
-#include <plat/map-s3c.h>
-
-#include <mach/regs-irq.h>
-#include <mach/regs-gpio.h>
-#include <mach/pm-core.h>
-
-#include <asm/irq.h>
-
-int s3c_irq_wake(struct irq_data *data, unsigned int state)
-{
-       unsigned long irqbit = 1 << data->hwirq;
-
-       if (!(s3c_irqwake_intallow & irqbit))
-               return -ENOENT;
-
-       pr_info("wake %s for hwirq %lu\n",
-               state ? "enabled" : "disabled", data->hwirq);
-
-       if (!state)
-               s3c_irqwake_intmask |= irqbit;
-       else
-               s3c_irqwake_intmask &= ~irqbit;
-
-       return 0;
-}
-
-static struct sleep_save irq_save[] = {
-       SAVE_ITEM(S3C2410_INTMSK),
-       SAVE_ITEM(S3C2410_INTSUBMSK),
-};
-
-/* the extint values move between the s3c2410/s3c2440 and the s3c2412
- * so we use an array to hold them, and to calculate the address of
- * the register at run-time
-*/
-
-static unsigned long save_extint[3];
-static unsigned long save_eintflt[4];
-static unsigned long save_eintmask;
-
-static int s3c24xx_irq_suspend(void)
-{
-       unsigned int i;
-
-       for (i = 0; i < ARRAY_SIZE(save_extint); i++)
-               save_extint[i] = __raw_readl(S3C24XX_EXTINT0 + (i*4));
-
-       for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
-               save_eintflt[i] = __raw_readl(S3C24XX_EINFLT0 + (i*4));
-
-       s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
-       save_eintmask = __raw_readl(S3C24XX_EINTMASK);
-
-       return 0;
-}
-
-static void s3c24xx_irq_resume(void)
-{
-       unsigned int i;
-
-       for (i = 0; i < ARRAY_SIZE(save_extint); i++)
-               __raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
-
-       for (i = 0; i < ARRAY_SIZE(save_eintflt); i++)
-               __raw_writel(save_eintflt[i], S3C24XX_EINFLT0 + (i*4));
-
-       s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
-       __raw_writel(save_eintmask, S3C24XX_EINTMASK);
-}
-
-struct syscore_ops s3c24xx_irq_syscore_ops = {
-       .suspend        = s3c24xx_irq_suspend,
-       .resume         = s3c24xx_irq_resume,
-};
-
-#ifdef CONFIG_CPU_S3C2416
-static struct sleep_save s3c2416_irq_save[] = {
-       SAVE_ITEM(S3C2416_INTMSK2),
-};
-
-static int s3c2416_irq_suspend(void)
-{
-       s3c_pm_do_save(s3c2416_irq_save, ARRAY_SIZE(s3c2416_irq_save));
-
-       return 0;
-}
-
-static void s3c2416_irq_resume(void)
-{
-       s3c_pm_do_restore(s3c2416_irq_save, ARRAY_SIZE(s3c2416_irq_save));
-}
-
-struct syscore_ops s3c2416_irq_syscore_ops = {
-       .suspend        = s3c2416_irq_suspend,
-       .resume         = s3c2416_irq_resume,
-};
-#endif
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
deleted file mode 100644 (file)
index 9a9daf5..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2006 American Microsystems Limited
-//     David Anders <danders@amltd.com>
-//
-// @History:
-// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
-// Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/proc_fs.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-#include <asm/mach/flash.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <mach/fb.h>
-
-#include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/gpio-cfg.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/physmap.h>
-
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-static struct resource amlm5900_nor_resource =
-                       DEFINE_RES_MEM(0x00000000, SZ_16M);
-
-static struct mtd_partition amlm5900_mtd_partitions[] = {
-       {
-               .name           = "System",
-               .size           = 0x240000,
-               .offset         = 0,
-               .mask_flags     = MTD_WRITEABLE,  /* force read-only */
-       }, {
-               .name           = "Kernel",
-               .size           = 0x100000,
-               .offset         = MTDPART_OFS_APPEND,
-       }, {
-               .name           = "Ramdisk",
-               .size           = 0x300000,
-               .offset         = MTDPART_OFS_APPEND,
-       }, {
-               .name           = "JFFS2",
-               .size           = 0x9A0000,
-               .offset         = MTDPART_OFS_APPEND,
-       }, {
-               .name           = "Settings",
-               .size           = MTDPART_SIZ_FULL,
-               .offset         = MTDPART_OFS_APPEND,
-       }
-};
-
-static struct physmap_flash_data amlm5900_flash_data = {
-       .width          = 2,
-       .parts          = amlm5900_mtd_partitions,
-       .nr_parts       = ARRAY_SIZE(amlm5900_mtd_partitions),
-};
-
-static struct platform_device amlm5900_device_nor = {
-       .name           = "physmap-flash",
-       .id             = 0,
-       .dev = {
-                       .platform_data = &amlm5900_flash_data,
-               },
-       .num_resources  = 1,
-       .resource       = &amlm5900_nor_resource,
-};
-
-static struct map_desc amlm5900_iodesc[] __initdata = {
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-
-static struct platform_device *amlm5900_devices[] __initdata = {
-#ifdef CONFIG_FB_S3C2410
-       &s3c_device_lcd,
-#endif
-       &s3c_device_adc,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_ohci,
-       &s3c_device_rtc,
-       &s3c_device_usbgadget,
-        &s3c_device_sdi,
-       &amlm5900_device_nor,
-};
-
-static void __init amlm5900_map_io(void)
-{
-       s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
-       s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init amlm5900_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-#ifdef CONFIG_FB_S3C2410
-static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
-       .width          = 160,
-       .height         = 160,
-
-       .type           = S3C2410_LCDCON1_STN4,
-
-       .pixclock       = 680000, /* HCLK = 100MHz */
-       .xres           = 160,
-       .yres           = 160,
-       .bpp            = 4,
-       .left_margin    = 1 << (4 + 3),
-       .right_margin   = 8 << 3,
-       .hsync_len      = 48,
-       .upper_margin   = 0,
-       .lower_margin   = 0,
-
-       .lcdcon5        = 0x00000001,
-};
-
-static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
-
-       .displays = &amlm5900_lcd_info,
-       .num_displays = 1,
-       .default_display = 0,
-
-       .gpccon =       0xaaaaaaaa,
-       .gpccon_mask =  0xffffffff,
-       .gpcup =        0x0000ffff,
-       .gpcup_mask =   0xffffffff,
-
-       .gpdcon =       0xaaaaaaaa,
-       .gpdcon_mask =  0xffffffff,
-       .gpdup =        0x0000ffff,
-       .gpdup_mask =   0xffffffff,
-};
-#endif
-
-static irqreturn_t
-amlm5900_wake_interrupt(int irq, void *ignored)
-{
-       return IRQ_HANDLED;
-}
-
-static void amlm5900_init_pm(void)
-{
-       int ret = 0;
-
-       ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
-                               IRQF_TRIGGER_RISING | IRQF_SHARED,
-                               "amlm5900_wakeup", &amlm5900_wake_interrupt);
-       if (ret != 0) {
-               printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
-       } else {
-               enable_irq_wake(IRQ_EINT9);
-               /* configure the suspend/resume status pin */
-               s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
-               s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
-       }
-}
-static void __init amlm5900_init(void)
-{
-       amlm5900_init_pm();
-#ifdef CONFIG_FB_S3C2410
-       s3c24xx_fb_set_platdata(&amlm5900_fb_info);
-#endif
-       s3c_i2c0_set_platdata(NULL);
-       platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
-}
-
-MACHINE_START(AML_M5900, "AML_M5900")
-       .atag_offset    = 0x100,
-       .map_io         = amlm5900_map_io,
-       .init_irq       = s3c2410_init_irq,
-       .init_machine   = amlm5900_init,
-       .init_time      = amlm5900_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
deleted file mode 100644 (file)
index 072966d..0000000
+++ /dev/null
@@ -1,429 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2003-2009 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/ata_platform.h>
-#include <linux/i2c.h>
-#include <linux/io.h>
-#include <linux/sm501.h>
-#include <linux/sm501-regs.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <net/ax88796.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <plat/samsung-time.h>
-
-#include "anubis.h"
-#include "common.h"
-#include "simtec.h"
-
-#define COPYRIGHT ", Copyright 2005-2009 Simtec Electronics"
-
-static struct map_desc anubis_iodesc[] __initdata = {
-  /* ISA IO areas */
-
-  {
-       .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
-       .pfn            = __phys_to_pfn(0x0),
-       .length         = SZ_4M,
-       .type           = MT_DEVICE,
-  }, {
-       .virtual        = (u32)S3C24XX_VA_ISA_WORD,
-       .pfn            = __phys_to_pfn(0x0),
-       .length         = SZ_4M,
-       .type           = MT_DEVICE,
-  },
-
-  /* we could possibly compress the next set down into a set of smaller tables
-   * pagetables, but that would mean using an L2 section, and it still means
-   * we cannot actually feed the same register to an LDR due to 16K spacing
-   */
-
-  /* CPLD control registers */
-
-  {
-       .virtual        = (u32)ANUBIS_VA_CTRL1,
-       .pfn            = __phys_to_pfn(ANUBIS_PA_CTRL1),
-       .length         = SZ_4K,
-       .type           = MT_DEVICE,
-  }, {
-       .virtual        = (u32)ANUBIS_VA_IDREG,
-       .pfn            = __phys_to_pfn(ANUBIS_PA_IDREG),
-       .length         = SZ_4K,
-       .type           = MT_DEVICE,
-  },
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       },
-       [1] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       },
-};
-
-/* NAND Flash on Anubis board */
-
-static int external_map[]   = { 2 };
-static int chip0_map[]      = { 0 };
-static int chip1_map[]      = { 1 };
-
-static struct mtd_partition __initdata anubis_default_nand_part[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_16K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "/boot",
-               .size   = SZ_4M - SZ_16K,
-               .offset = SZ_16K,
-       },
-       [2] = {
-               .name   = "user1",
-               .offset = SZ_4M,
-               .size   = SZ_32M - SZ_4M,
-       },
-       [3] = {
-               .name   = "user2",
-               .offset = SZ_32M,
-               .size   = MTDPART_SIZ_FULL,
-       }
-};
-
-static struct mtd_partition __initdata anubis_default_nand_part_large[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_128K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "/boot",
-               .size   = SZ_4M - SZ_128K,
-               .offset = SZ_128K,
-       },
-       [2] = {
-               .name   = "user1",
-               .offset = SZ_4M,
-               .size   = SZ_32M - SZ_4M,
-       },
-       [3] = {
-               .name   = "user2",
-               .offset = SZ_32M,
-               .size   = MTDPART_SIZ_FULL,
-       }
-};
-
-/* the Anubis has 3 selectable slots for nand-flash, the two
- * on-board chip areas, as well as the external slot.
- *
- * Note, there is no current hot-plug support for the External
- * socket.
-*/
-
-static struct s3c2410_nand_set __initdata anubis_nand_sets[] = {
-       [1] = {
-               .name           = "External",
-               .nr_chips       = 1,
-               .nr_map         = external_map,
-               .nr_partitions  = ARRAY_SIZE(anubis_default_nand_part),
-               .partitions     = anubis_default_nand_part,
-       },
-       [0] = {
-               .name           = "chip0",
-               .nr_chips       = 1,
-               .nr_map         = chip0_map,
-               .nr_partitions  = ARRAY_SIZE(anubis_default_nand_part),
-               .partitions     = anubis_default_nand_part,
-       },
-       [2] = {
-               .name           = "chip1",
-               .nr_chips       = 1,
-               .nr_map         = chip1_map,
-               .nr_partitions  = ARRAY_SIZE(anubis_default_nand_part),
-               .partitions     = anubis_default_nand_part,
-       },
-};
-
-static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
-{
-       unsigned int tmp;
-
-       slot = set->nr_map[slot] & 3;
-
-       pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
-                slot, set, set->nr_map);
-
-       tmp = __raw_readb(ANUBIS_VA_CTRL1);
-       tmp &= ~ANUBIS_CTRL1_NANDSEL;
-       tmp |= slot;
-
-       pr_debug("anubis_nand: ctrl1 now %02x\n", tmp);
-
-       __raw_writeb(tmp, ANUBIS_VA_CTRL1);
-}
-
-static struct s3c2410_platform_nand __initdata anubis_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 55,
-       .twrph1         = 40,
-       .nr_sets        = ARRAY_SIZE(anubis_nand_sets),
-       .sets           = anubis_nand_sets,
-       .select_chip    = anubis_nand_select,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-/* IDE channels */
-
-static struct pata_platform_info anubis_ide_platdata = {
-       .ioport_shift   = 5,
-};
-
-static struct resource anubis_ide0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS3, 8 * 32),
-       [2] = DEFINE_RES_MEM(S3C2410_CS3 + (1 << 26) + (6 * 32), 32),
-       [3] = DEFINE_RES_IRQ(ANUBIS_IRQ_IDE0),
-};
-
-static struct platform_device anubis_device_ide0 = {
-       .name           = "pata_platform",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(anubis_ide0_resource),
-       .resource       = anubis_ide0_resource,
-       .dev    = {
-               .platform_data = &anubis_ide_platdata,
-               .coherent_dma_mask = ~0,
-       },
-};
-
-static struct resource anubis_ide1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS4, 8 * 32),
-       [1] = DEFINE_RES_MEM(S3C2410_CS4 + (1 << 26) + (6 * 32), 32),
-       [2] = DEFINE_RES_IRQ(ANUBIS_IRQ_IDE0),
-};
-
-static struct platform_device anubis_device_ide1 = {
-       .name           = "pata_platform",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(anubis_ide1_resource),
-       .resource       = anubis_ide1_resource,
-       .dev    = {
-               .platform_data = &anubis_ide_platdata,
-               .coherent_dma_mask = ~0,
-       },
-};
-
-/* Asix AX88796 10/100 ethernet controller */
-
-static struct ax_plat_data anubis_asix_platdata = {
-       .flags          = AXFLG_MAC_FROMDEV,
-       .wordlength     = 2,
-       .dcr_val        = 0x48,
-       .rcr_val        = 0x40,
-};
-
-static struct resource anubis_asix_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS5, 0x20 * 0x20),
-       [1] = DEFINE_RES_IRQ(ANUBIS_IRQ_ASIX),
-};
-
-static struct platform_device anubis_device_asix = {
-       .name           = "ax88796",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(anubis_asix_resource),
-       .resource       = anubis_asix_resource,
-       .dev            = {
-               .platform_data = &anubis_asix_platdata,
-       }
-};
-
-/* SM501 */
-
-static struct resource anubis_sm501_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS2, SZ_8M),
-       [1] = DEFINE_RES_MEM(S3C2410_CS2 + SZ_64M - SZ_2M, SZ_2M),
-       [2] = DEFINE_RES_IRQ(IRQ_EINT0),
-};
-
-static struct sm501_initdata anubis_sm501_initdata = {
-       .gpio_high      = {
-               .set    = 0x3F000000,           /* 24bit panel */
-               .mask   = 0x0,
-       },
-       .misc_timing    = {
-               .set    = 0x010100,             /* SDRAM timing */
-               .mask   = 0x1F1F00,
-       },
-       .misc_control   = {
-               .set    = SM501_MISC_PNL_24BIT,
-               .mask   = 0,
-       },
-
-       .devices        = SM501_USE_GPIO,
-
-       /* set the SDRAM and bus clocks */
-       .mclk           = 72 * MHZ,
-       .m1xclk         = 144 * MHZ,
-};
-
-static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = {
-       [0] = {
-               .bus_num        = 1,
-               .pin_scl        = 44,
-               .pin_sda        = 45,
-       },
-       [1] = {
-               .bus_num        = 2,
-               .pin_scl        = 40,
-               .pin_sda        = 41,
-       },
-};
-
-static struct sm501_platdata anubis_sm501_platdata = {
-       .init           = &anubis_sm501_initdata,
-       .gpio_base      = -1,
-       .gpio_i2c       = anubis_sm501_gpio_i2c,
-       .gpio_i2c_nr    = ARRAY_SIZE(anubis_sm501_gpio_i2c),
-};
-
-static struct platform_device anubis_device_sm501 = {
-       .name           = "sm501",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(anubis_sm501_resource),
-       .resource       = anubis_sm501_resource,
-       .dev            = {
-               .platform_data = &anubis_sm501_platdata,
-       },
-};
-
-/* Standard Anubis devices */
-
-static struct platform_device *anubis_devices[] __initdata = {
-       &s3c2410_device_dclk,
-       &s3c_device_ohci,
-       &s3c_device_wdt,
-       &s3c_device_adc,
-       &s3c_device_i2c0,
-       &s3c_device_rtc,
-       &s3c_device_nand,
-       &anubis_device_ide0,
-       &anubis_device_ide1,
-       &anubis_device_asix,
-       &anubis_device_sm501,
-};
-
-/* I2C devices. */
-
-static struct i2c_board_info anubis_i2c_devs[] __initdata = {
-       {
-               I2C_BOARD_INFO("tps65011", 0x48),
-               .irq    = IRQ_EINT20,
-       }
-};
-
-/* Audio setup */
-static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = {
-       .have_mic       = 1,
-       .have_lout      = 1,
-       .output_cdclk   = 1,
-       .use_mpllin     = 1,
-       .amp_gpio       = S3C2410_GPB(2),
-       .amp_gain[0]    = S3C2410_GPD(10),
-       .amp_gain[1]    = S3C2410_GPD(11),
-};
-
-static void __init anubis_map_io(void)
-{
-       s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
-       s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* check for the newer revision boards with large page nand */
-
-       if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) {
-               printk(KERN_INFO "ANUBIS-B detected (revision %d)\n",
-                      __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK);
-               anubis_nand_sets[0].partitions = anubis_default_nand_part_large;
-               anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large);
-       } else {
-               /* ensure that the GPIO is setup */
-               gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL);
-               gpio_free(S3C2410_GPA(0));
-       }
-}
-
-static void __init anubis_init_time(void)
-{
-       s3c2440_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init anubis_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       s3c_nand_set_platdata(&anubis_nand_info);
-       simtec_audio_add(NULL, false, &anubis_audio);
-
-       platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
-
-       i2c_register_board_info(0, anubis_i2c_devs,
-                               ARRAY_SIZE(anubis_i2c_devs));
-}
-
-
-MACHINE_START(ANUBIS, "Simtec-Anubis")
-       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
-       .atag_offset    = 0x100,
-       .map_io         = anubis_map_io,
-       .init_machine   = anubis_init,
-       .init_irq       = s3c2440_init_irq,
-       .init_time      = anubis_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
deleted file mode 100644 (file)
index 58c5ef3..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
-//      Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
-//      and modifications by SBZ <sbz@spgui.org> and
-//      Weibing <http://weibing.blogbus.com>
-//
-// For product information, visit http://www.arm.com/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/gpio/machine.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/dm9000.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/fb.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <linux/platform_data/mmc-s3cmci.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-static struct map_desc at2440evb_iodesc[] __initdata = {
-       /* Nothing here */
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       },
-};
-
-/* NAND Flash on AT2440EVB board */
-
-static struct mtd_partition __initdata at2440evb_default_nand_part[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_256K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "Kernel",
-               .size   = SZ_2M,
-               .offset = SZ_256K,
-       },
-       [2] = {
-               .name   = "Root",
-               .offset = SZ_256K + SZ_2M,
-               .size   = MTDPART_SIZ_FULL,
-       },
-};
-
-static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = {
-       [0] = {
-               .name           = "nand",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(at2440evb_default_nand_part),
-               .partitions     = at2440evb_default_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 55,
-       .twrph1         = 40,
-       .nr_sets        = ARRAY_SIZE(at2440evb_nand_sets),
-       .sets           = at2440evb_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-/* DM9000AEP 10/100 ethernet controller */
-
-static struct resource at2440evb_dm9k_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS3, 4),
-       [1] = DEFINE_RES_MEM(S3C2410_CS3 + 4, 4),
-       [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \
-                                       | IORESOURCE_IRQ_HIGHEDGE),
-};
-
-static struct dm9000_plat_data at2440evb_dm9k_pdata = {
-       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
-};
-
-static struct platform_device at2440evb_device_eth = {
-       .name           = "dm9000",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(at2440evb_dm9k_resource),
-       .resource       = at2440evb_dm9k_resource,
-       .dev            = {
-               .platform_data  = &at2440evb_dm9k_pdata,
-       },
-};
-
-static struct s3c24xx_mci_pdata at2440evb_mci_pdata __initdata = {
-       /* Intentionally left blank */
-};
-
-static struct gpiod_lookup_table at2440evb_mci_gpio_table = {
-       .dev_id = "s3c2410-sdi",
-       .table = {
-               /* Card detect S3C2410_GPG(10) */
-               GPIO_LOOKUP("GPG", 10, "cd", GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-/* 7" LCD panel */
-
-static struct s3c2410fb_display at2440evb_lcd_cfg __initdata = {
-
-       .lcdcon5        = S3C2410_LCDCON5_FRM565 |
-                         S3C2410_LCDCON5_INVVLINE |
-                         S3C2410_LCDCON5_INVVFRAME |
-                         S3C2410_LCDCON5_PWREN |
-                         S3C2410_LCDCON5_HWSWP,
-
-       .type           = S3C2410_LCDCON1_TFT,
-
-       .width          = 800,
-       .height         = 480,
-
-       .pixclock       = 33333, /* HCLK 60 MHz, divisor 2 */
-       .xres           = 800,
-       .yres           = 480,
-       .bpp            = 16,
-       .left_margin    = 88,
-       .right_margin   = 40,
-       .hsync_len      = 128,
-       .upper_margin   = 32,
-       .lower_margin   = 11,
-       .vsync_len      = 2,
-};
-
-static struct s3c2410fb_mach_info at2440evb_fb_info __initdata = {
-       .displays       = &at2440evb_lcd_cfg,
-       .num_displays   = 1,
-       .default_display = 0,
-};
-
-static struct platform_device *at2440evb_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_wdt,
-       &s3c_device_adc,
-       &s3c_device_i2c0,
-       &s3c_device_rtc,
-       &s3c_device_nand,
-       &s3c_device_sdi,
-       &s3c_device_lcd,
-       &at2440evb_device_eth,
-};
-
-static void __init at2440evb_map_io(void)
-{
-       s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
-       s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init at2440evb_init_time(void)
-{
-       s3c2440_init_clocks(16934400);
-       samsung_timer_init();
-}
-
-static void __init at2440evb_init(void)
-{
-       s3c24xx_fb_set_platdata(&at2440evb_fb_info);
-       gpiod_add_lookup_table(&at2440evb_mci_gpio_table);
-       s3c24xx_mci_set_platdata(&at2440evb_mci_pdata);
-       s3c_nand_set_platdata(&at2440evb_nand_info);
-       s3c_i2c0_set_platdata(NULL);
-
-       platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
-}
-
-
-MACHINE_START(AT2440EVB, "AT2440EVB")
-       .atag_offset    = 0x100,
-       .map_io         = at2440evb_map_io,
-       .init_machine   = at2440evb_init,
-       .init_irq       = s3c2440_init_irq,
-       .init_time      = at2440evb_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
deleted file mode 100644 (file)
index a7c3955..0000000
+++ /dev/null
@@ -1,590 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2003-2008 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// http://www.simtec.co.uk/products/EB2410ITX/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/syscore_ops.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/dm9000.h>
-#include <linux/ata_platform.h>
-#include <linux/i2c.h>
-#include <linux/io.h>
-#include <linux/serial_8250.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <linux/platform_data/hwmon-s3c.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-
-#include <net/ax88796.h>
-
-#include <asm/irq.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
-
-#include "bast.h"
-#include "common.h"
-#include "simtec.h"
-
-#define COPYRIGHT ", Copyright 2004-2008 Simtec Electronics"
-
-/* macros for virtual address mods for the io space entries */
-#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
-#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
-#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
-#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
-
-/* macros to modify the physical addresses for io space */
-
-#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
-#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
-#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
-#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
-
-static struct map_desc bast_iodesc[] __initdata = {
-  /* ISA IO areas */
-  {
-         .virtual      = (u32)S3C24XX_VA_ISA_BYTE,
-         .pfn          = PA_CS2(BAST_PA_ISAIO),
-         .length       = SZ_16M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)S3C24XX_VA_ISA_WORD,
-         .pfn          = PA_CS3(BAST_PA_ISAIO),
-         .length       = SZ_16M,
-         .type         = MT_DEVICE,
-  },
-  /* bast CPLD control registers, and external interrupt controls */
-  {
-         .virtual      = (u32)BAST_VA_CTRL1,
-         .pfn          = __phys_to_pfn(BAST_PA_CTRL1),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)BAST_VA_CTRL2,
-         .pfn          = __phys_to_pfn(BAST_PA_CTRL2),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)BAST_VA_CTRL3,
-         .pfn          = __phys_to_pfn(BAST_PA_CTRL3),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)BAST_VA_CTRL4,
-         .pfn          = __phys_to_pfn(BAST_PA_CTRL4),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  },
-  /* PC104 IRQ mux */
-  {
-         .virtual      = (u32)BAST_VA_PC104_IRQREQ,
-         .pfn          = __phys_to_pfn(BAST_PA_PC104_IRQREQ),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)BAST_VA_PC104_IRQRAW,
-         .pfn          = __phys_to_pfn(BAST_PA_PC104_IRQRAW),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)BAST_VA_PC104_IRQMASK,
-         .pfn          = __phys_to_pfn(BAST_PA_PC104_IRQMASK),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  },
-
-  /* peripheral space... one for each of fast/slow/byte/16bit */
-  /* note, ide is only decoded in word space, even though some registers
-   * are only 8bit */
-
-  /* slow, byte */
-  { VA_C2(BAST_VA_ISAIO),   PA_CS2(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
-  { VA_C2(BAST_VA_ISAMEM),  PA_CS2(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
-  { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
-
-  /* slow, word */
-  { VA_C3(BAST_VA_ISAIO),   PA_CS3(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
-  { VA_C3(BAST_VA_ISAMEM),  PA_CS3(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
-  { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
-
-  /* fast, byte */
-  { VA_C4(BAST_VA_ISAIO),   PA_CS4(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
-  { VA_C4(BAST_VA_ISAMEM),  PA_CS4(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
-  { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
-
-  /* fast, word */
-  { VA_C5(BAST_VA_ISAIO),   PA_CS5(BAST_PA_ISAIO),    SZ_16M, MT_DEVICE },
-  { VA_C5(BAST_VA_ISAMEM),  PA_CS5(BAST_PA_ISAMEM),   SZ_16M, MT_DEVICE },
-  { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO),  SZ_1M,  MT_DEVICE },
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       /* port 2 is not actually used */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-/* NAND Flash on BAST board */
-
-#ifdef CONFIG_PM
-static int bast_pm_suspend(void)
-{
-       /* ensure that an nRESET is not generated on resume. */
-       gpio_direction_output(S3C2410_GPA(21), 1);
-       return 0;
-}
-
-static void bast_pm_resume(void)
-{
-       s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
-}
-
-#else
-#define bast_pm_suspend NULL
-#define bast_pm_resume NULL
-#endif
-
-static struct syscore_ops bast_pm_syscore_ops = {
-       .suspend        = bast_pm_suspend,
-       .resume         = bast_pm_resume,
-};
-
-static int smartmedia_map[] = { 0 };
-static int chip0_map[] = { 1 };
-static int chip1_map[] = { 2 };
-static int chip2_map[] = { 3 };
-
-static struct mtd_partition __initdata bast_default_nand_part[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_16K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "/boot",
-               .size   = SZ_4M - SZ_16K,
-               .offset = SZ_16K,
-       },
-       [2] = {
-               .name   = "user",
-               .offset = SZ_4M,
-               .size   = MTDPART_SIZ_FULL,
-       }
-};
-
-/* the bast has 4 selectable slots for nand-flash, the three
- * on-board chip areas, as well as the external SmartMedia
- * slot.
- *
- * Note, there is no current hot-plug support for the SmartMedia
- * socket.
-*/
-
-static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
-       [0] = {
-               .name           = "SmartMedia",
-               .nr_chips       = 1,
-               .nr_map         = smartmedia_map,
-               .options        = NAND_SCAN_SILENT_NODEV,
-               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
-               .partitions     = bast_default_nand_part,
-       },
-       [1] = {
-               .name           = "chip0",
-               .nr_chips       = 1,
-               .nr_map         = chip0_map,
-               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
-               .partitions     = bast_default_nand_part,
-       },
-       [2] = {
-               .name           = "chip1",
-               .nr_chips       = 1,
-               .nr_map         = chip1_map,
-               .options        = NAND_SCAN_SILENT_NODEV,
-               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
-               .partitions     = bast_default_nand_part,
-       },
-       [3] = {
-               .name           = "chip2",
-               .nr_chips       = 1,
-               .nr_map         = chip2_map,
-               .options        = NAND_SCAN_SILENT_NODEV,
-               .nr_partitions  = ARRAY_SIZE(bast_default_nand_part),
-               .partitions     = bast_default_nand_part,
-       }
-};
-
-static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
-{
-       unsigned int tmp;
-
-       slot = set->nr_map[slot] & 3;
-
-       pr_debug("bast_nand: selecting slot %d (set %p,%p)\n",
-                slot, set, set->nr_map);
-
-       tmp = __raw_readb(BAST_VA_CTRL2);
-       tmp &= BAST_CPLD_CTLR2_IDERST;
-       tmp |= slot;
-       tmp |= BAST_CPLD_CTRL2_WNAND;
-
-       pr_debug("bast_nand: ctrl2 now %02x\n", tmp);
-
-       __raw_writeb(tmp, BAST_VA_CTRL2);
-}
-
-static struct s3c2410_platform_nand __initdata bast_nand_info = {
-       .tacls          = 30,
-       .twrph0         = 60,
-       .twrph1         = 60,
-       .nr_sets        = ARRAY_SIZE(bast_nand_sets),
-       .sets           = bast_nand_sets,
-       .select_chip    = bast_nand_select,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-/* DM9000 */
-
-static struct resource bast_dm9k_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000, 4),
-       [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000 + 0x40, 0x40),
-       [2] = DEFINE_RES_NAMED(BAST_IRQ_DM9000 , 1, NULL, IORESOURCE_IRQ \
-                                       | IORESOURCE_IRQ_HIGHLEVEL),
-};
-
-/* for the moment we limit ourselves to 16bit IO until some
- * better IO routines can be written and tested
-*/
-
-static struct dm9000_plat_data bast_dm9k_platdata = {
-       .flags          = DM9000_PLATF_16BITONLY,
-};
-
-static struct platform_device bast_device_dm9k = {
-       .name           = "dm9000",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(bast_dm9k_resource),
-       .resource       = bast_dm9k_resource,
-       .dev            = {
-               .platform_data = &bast_dm9k_platdata,
-       }
-};
-
-/* serial devices */
-
-#define SERIAL_BASE  (S3C2410_CS2 + BAST_PA_SUPERIO)
-#define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ)
-#define SERIAL_CLK   (1843200)
-
-static struct plat_serial8250_port bast_sio_data[] = {
-       [0] = {
-               .mapbase        = SERIAL_BASE + 0x2f8,
-               .irq            = BAST_IRQ_PCSERIAL1,
-               .flags          = SERIAL_FLAGS,
-               .iotype         = UPIO_MEM,
-               .regshift       = 0,
-               .uartclk        = SERIAL_CLK,
-       },
-       [1] = {
-               .mapbase        = SERIAL_BASE + 0x3f8,
-               .irq            = BAST_IRQ_PCSERIAL2,
-               .flags          = SERIAL_FLAGS,
-               .iotype         = UPIO_MEM,
-               .regshift       = 0,
-               .uartclk        = SERIAL_CLK,
-       },
-       { }
-};
-
-static struct platform_device bast_sio = {
-       .name                   = "serial8250",
-       .id                     = PLAT8250_DEV_PLATFORM,
-       .dev                    = {
-               .platform_data  = &bast_sio_data,
-       },
-};
-
-/* we have devices on the bus which cannot work much over the
- * standard 100KHz i2c bus frequency
-*/
-
-static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
-       .flags          = 0,
-       .slave_addr     = 0x10,
-       .frequency      = 100*1000,
-};
-
-/* Asix AX88796 10/100 ethernet controller */
-
-static struct ax_plat_data bast_asix_platdata = {
-       .flags          = AXFLG_MAC_FROMDEV,
-       .wordlength     = 2,
-       .dcr_val        = 0x48,
-       .rcr_val        = 0x40,
-};
-
-static struct resource bast_asix_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET, 0x18 * 0x20),
-       [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 1),
-       [2] = DEFINE_RES_IRQ(BAST_IRQ_ASIX),
-};
-
-static struct platform_device bast_device_asix = {
-       .name           = "ax88796",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(bast_asix_resource),
-       .resource       = bast_asix_resource,
-       .dev            = {
-               .platform_data = &bast_asix_platdata
-       }
-};
-
-/* Asix AX88796 10/100 ethernet controller parallel port */
-
-static struct resource bast_asixpp_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), \
-                                       0x30 * 0x20),
-};
-
-static struct platform_device bast_device_axpp = {
-       .name           = "ax88796-pp",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(bast_asixpp_resource),
-       .resource       = bast_asixpp_resource,
-};
-
-/* LCD/VGA controller */
-
-static struct s3c2410fb_display __initdata bast_lcd_info[] = {
-       {
-               .type           = S3C2410_LCDCON1_TFT,
-               .width          = 640,
-               .height         = 480,
-
-               .pixclock       = 33333,
-               .xres           = 640,
-               .yres           = 480,
-               .bpp            = 4,
-               .left_margin    = 40,
-               .right_margin   = 20,
-               .hsync_len      = 88,
-               .upper_margin   = 30,
-               .lower_margin   = 32,
-               .vsync_len      = 3,
-
-               .lcdcon5        = 0x00014b02,
-       },
-       {
-               .type           = S3C2410_LCDCON1_TFT,
-               .width          = 640,
-               .height         = 480,
-
-               .pixclock       = 33333,
-               .xres           = 640,
-               .yres           = 480,
-               .bpp            = 8,
-               .left_margin    = 40,
-               .right_margin   = 20,
-               .hsync_len      = 88,
-               .upper_margin   = 30,
-               .lower_margin   = 32,
-               .vsync_len      = 3,
-
-               .lcdcon5        = 0x00014b02,
-       },
-       {
-               .type           = S3C2410_LCDCON1_TFT,
-               .width          = 640,
-               .height         = 480,
-
-               .pixclock       = 33333,
-               .xres           = 640,
-               .yres           = 480,
-               .bpp            = 16,
-               .left_margin    = 40,
-               .right_margin   = 20,
-               .hsync_len      = 88,
-               .upper_margin   = 30,
-               .lower_margin   = 32,
-               .vsync_len      = 3,
-
-               .lcdcon5        = 0x00014b02,
-       },
-};
-
-/* LCD/VGA controller */
-
-static struct s3c2410fb_mach_info __initdata bast_fb_info = {
-
-       .displays = bast_lcd_info,
-       .num_displays = ARRAY_SIZE(bast_lcd_info),
-       .default_display = 1,
-};
-
-/* I2C devices fitted. */
-
-static struct i2c_board_info bast_i2c_devs[] __initdata = {
-       {
-               I2C_BOARD_INFO("tlv320aic23", 0x1a),
-       }, {
-               I2C_BOARD_INFO("simtec-pmu", 0x6b),
-       }, {
-               I2C_BOARD_INFO("ch7013", 0x75),
-       },
-};
-
-static struct s3c_hwmon_pdata bast_hwmon_info = {
-       /* LCD contrast (0-6.6V) */
-       .in[0] = &(struct s3c_hwmon_chcfg) {
-               .name           = "lcd-contrast",
-               .mult           = 3300,
-               .div            = 512,
-       },
-       /* LED current feedback */
-       .in[1] = &(struct s3c_hwmon_chcfg) {
-               .name           = "led-feedback",
-               .mult           = 3300,
-               .div            = 1024,
-       },
-       /* LCD feedback (0-6.6V) */
-       .in[2] = &(struct s3c_hwmon_chcfg) {
-               .name           = "lcd-feedback",
-               .mult           = 3300,
-               .div            = 512,
-       },
-       /* Vcore (1.8-2.0V), Vref 3.3V  */
-       .in[3] = &(struct s3c_hwmon_chcfg) {
-               .name           = "vcore",
-               .mult           = 3300,
-               .div            = 1024,
-       },
-};
-
-/* Standard BAST devices */
-// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
-
-static struct platform_device *bast_devices[] __initdata = {
-       &s3c2410_device_dclk,
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_rtc,
-       &s3c_device_nand,
-       &s3c_device_adc,
-       &s3c_device_hwmon,
-       &bast_device_dm9k,
-       &bast_device_asix,
-       &bast_device_axpp,
-       &bast_sio,
-};
-
-static struct s3c_cpufreq_board __initdata bast_cpufreq = {
-       .refresh        = 7800, /* 7.8usec */
-       .auto_io        = 1,
-       .need_io        = 1,
-};
-
-static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
-       .have_mic       = 1,
-       .have_lout      = 1,
-};
-
-static void __init bast_map_io(void)
-{
-       s3c_hwmon_set_platdata(&bast_hwmon_info);
-
-       s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
-       s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init bast_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init bast_init(void)
-{
-       register_syscore_ops(&bast_pm_syscore_ops);
-
-       s3c_i2c0_set_platdata(&bast_i2c_info);
-       s3c_nand_set_platdata(&bast_nand_info);
-       s3c24xx_fb_set_platdata(&bast_fb_info);
-       platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
-
-       i2c_register_board_info(0, bast_i2c_devs,
-                               ARRAY_SIZE(bast_i2c_devs));
-
-       usb_simtec_init();
-       nor_simtec_init();
-       simtec_audio_add(NULL, true, &bast_audio);
-
-       WARN_ON(gpio_request(S3C2410_GPA(21), "bast nreset"));
-       
-       s3c_cpufreq_setboard(&bast_cpufreq);
-}
-
-MACHINE_START(BAST, "Simtec-BAST")
-       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
-       .atag_offset    = 0x100,
-       .map_io         = bast_map_io,
-       .init_irq       = s3c2410_init_irq,
-       .init_machine   = bast_init,
-       .init_time      = bast_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
deleted file mode 100644 (file)
index 594901f..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// S3C2442 Machine Support for Openmoko GTA02 / FreeRunner.
-//
-// Copyright (C) 2006-2009 by Openmoko, Inc.
-// Authors: Harald Welte <laforge@openmoko.org>
-//          Andy Green <andy@openmoko.org>
-//          Werner Almesberger <werner@openmoko.org>
-// All rights reserved.
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio_keys.h>
-#include <linux/workqueue.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/input.h>
-#include <linux/io.h>
-#include <linux/i2c.h>
-
-#include <linux/mmc/host.h>
-
-#include <linux/mfd/pcf50633/adc.h>
-#include <linux/mfd/pcf50633/backlight.h>
-#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/gpio.h>
-#include <linux/mfd/pcf50633/mbc.h>
-#include <linux/mfd/pcf50633/pmic.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
-
-#include <linux/regulator/machine.h>
-
-#include <linux/spi/spi.h>
-#include <linux/spi/s3c24xx.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-#include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-irq.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "gta02.h"
-
-static struct pcf50633 *gta02_pcf;
-
-/*
- * This gets called frequently when we paniced.
- */
-
-static long gta02_panic_blink(int state)
-{
-       long delay = 0;
-       char led;
-
-       led = (state) ? 1 : 0;
-       gpio_direction_output(GTA02_GPIO_AUX_LED, led);
-
-       return delay;
-}
-
-
-static struct map_desc gta02_iodesc[] __initdata = {
-       {
-               .virtual        = 0xe0000000,
-               .pfn            = __phys_to_pfn(S3C2410_CS3 + 0x01000000),
-               .length         = SZ_1M,
-               .type           = MT_DEVICE
-       },
-};
-
-#define UCON (S3C2410_UCON_DEFAULT | S3C2443_UCON_RXERR_IRQEN)
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg gta02_uartcfgs[] = {
-       [0] = {
-               .hwport         = 0,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [1] = {
-               .hwport         = 1,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [2] = {
-               .hwport         = 2,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-};
-
-#ifdef CONFIG_CHARGER_PCF50633
-/*
- * On GTA02 the 1A charger features a 48K resistor to 0V on the ID pin.
- * We use this to recognize that we can pull 1A from the USB socket.
- *
- * These constants are the measured pcf50633 ADC levels with the 1A
- * charger / 48K resistor, and with no pulldown resistor.
- */
-
-#define ADC_NOM_CHG_DETECT_1A 6
-#define ADC_NOM_CHG_DETECT_USB 43
-
-#ifdef CONFIG_PCF50633_ADC
-static void
-gta02_configure_pmu_for_charger(struct pcf50633 *pcf, void *unused, int res)
-{
-       int  ma;
-
-       /* Interpret charger type */
-       if (res < ((ADC_NOM_CHG_DETECT_USB + ADC_NOM_CHG_DETECT_1A) / 2)) {
-
-               /*
-                * Sanity - stop GPO driving out now that we have a 1A charger
-                * GPO controls USB Host power generation on GTA02
-                */
-               pcf50633_gpio_set(pcf, PCF50633_GPO, 0);
-
-               ma = 1000;
-       } else
-               ma = 100;
-
-       pcf50633_mbc_usb_curlim_set(pcf, ma);
-}
-#endif
-
-static struct delayed_work gta02_charger_work;
-static int gta02_usb_vbus_draw;
-
-static void gta02_charger_worker(struct work_struct *work)
-{
-       if (gta02_usb_vbus_draw) {
-               pcf50633_mbc_usb_curlim_set(gta02_pcf, gta02_usb_vbus_draw);
-               return;
-       }
-
-#ifdef CONFIG_PCF50633_ADC
-       pcf50633_adc_async_read(gta02_pcf,
-                               PCF50633_ADCC1_MUX_ADCIN1,
-                               PCF50633_ADCC1_AVERAGE_16,
-                               gta02_configure_pmu_for_charger,
-                               NULL);
-#else
-       /*
-        * If the PCF50633 ADC is disabled we fallback to a
-        * 100mA limit for safety.
-        */
-       pcf50633_mbc_usb_curlim_set(gta02_pcf, 100);
-#endif
-}
-
-#define GTA02_CHARGER_CONFIGURE_TIMEOUT ((3000 * HZ) / 1000)
-
-static void gta02_pmu_event_callback(struct pcf50633 *pcf, int irq)
-{
-       if (irq == PCF50633_IRQ_USBINS) {
-               schedule_delayed_work(&gta02_charger_work,
-                                     GTA02_CHARGER_CONFIGURE_TIMEOUT);
-
-               return;
-       }
-
-       if (irq == PCF50633_IRQ_USBREM) {
-               cancel_delayed_work_sync(&gta02_charger_work);
-               gta02_usb_vbus_draw = 0;
-       }
-}
-
-static void gta02_udc_vbus_draw(unsigned int ma)
-{
-       if (!gta02_pcf)
-               return;
-
-       gta02_usb_vbus_draw = ma;
-
-       schedule_delayed_work(&gta02_charger_work,
-                             GTA02_CHARGER_CONFIGURE_TIMEOUT);
-}
-#else /* !CONFIG_CHARGER_PCF50633 */
-#define gta02_pmu_event_callback       NULL
-#define gta02_udc_vbus_draw            NULL
-#endif
-
-static char *gta02_batteries[] = {
-       "battery",
-};
-
-static struct pcf50633_bl_platform_data gta02_backlight_data = {
-       .default_brightness = 0x3f,
-       .default_brightness_limit = 0,
-       .ramp_time = 5,
-};
-
-static struct pcf50633_platform_data gta02_pcf_pdata = {
-       .resumers = {
-               [0] =   PCF50633_INT1_USBINS |
-                       PCF50633_INT1_USBREM |
-                       PCF50633_INT1_ALARM,
-               [1] =   PCF50633_INT2_ONKEYF,
-               [2] =   PCF50633_INT3_ONKEY1S,
-               [3] =   PCF50633_INT4_LOWSYS |
-                       PCF50633_INT4_LOWBAT |
-                       PCF50633_INT4_HIGHTMP,
-       },
-
-       .batteries = gta02_batteries,
-       .num_batteries = ARRAY_SIZE(gta02_batteries),
-
-       .charger_reference_current_ma = 1000,
-
-       .backlight_data = &gta02_backlight_data,
-
-       .reg_init_data = {
-               [PCF50633_REGULATOR_AUTO] = {
-                       .constraints = {
-                               .min_uV = 3300000,
-                               .max_uV = 3300000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .always_on = 1,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_DOWN1] = {
-                       .constraints = {
-                               .min_uV = 1300000,
-                               .max_uV = 1600000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .always_on = 1,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_DOWN2] = {
-                       .constraints = {
-                               .min_uV = 1800000,
-                               .max_uV = 1800000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .apply_uV = 1,
-                               .always_on = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_HCLDO] = {
-                       .constraints = {
-                               .min_uV = 2000000,
-                               .max_uV = 3300000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-                                               REGULATOR_CHANGE_STATUS,
-                       },
-               },
-               [PCF50633_REGULATOR_LDO1] = {
-                       .constraints = {
-                               .min_uV = 3300000,
-                               .max_uV = 3300000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_LDO2] = {
-                       .constraints = {
-                               .min_uV = 3300000,
-                               .max_uV = 3300000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_LDO3] = {
-                       .constraints = {
-                               .min_uV = 3000000,
-                               .max_uV = 3000000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_LDO4] = {
-                       .constraints = {
-                               .min_uV = 3200000,
-                               .max_uV = 3200000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_LDO5] = {
-                       .constraints = {
-                               .min_uV = 3000000,
-                               .max_uV = 3000000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-                               .apply_uV = 1,
-                       },
-               },
-               [PCF50633_REGULATOR_LDO6] = {
-                       .constraints = {
-                               .min_uV = 3000000,
-                               .max_uV = 3000000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                       },
-               },
-               [PCF50633_REGULATOR_MEMLDO] = {
-                       .constraints = {
-                               .min_uV = 1800000,
-                               .max_uV = 1800000,
-                               .valid_modes_mask = REGULATOR_MODE_NORMAL,
-                       },
-               },
-
-       },
-       .mbc_event_callback = gta02_pmu_event_callback,
-};
-
-
-/* NOR Flash. */
-
-#define GTA02_FLASH_BASE       0x18000000 /* GCS3 */
-#define GTA02_FLASH_SIZE       0x200000 /* 2MBytes */
-
-static struct physmap_flash_data gta02_nor_flash_data = {
-       .width          = 2,
-};
-
-static struct resource gta02_nor_flash_resource =
-       DEFINE_RES_MEM(GTA02_FLASH_BASE, GTA02_FLASH_SIZE);
-
-static struct platform_device gta02_nor_flash = {
-       .name           = "physmap-flash",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &gta02_nor_flash_data,
-       },
-       .resource       = &gta02_nor_flash_resource,
-       .num_resources  = 1,
-};
-
-
-static struct platform_device s3c24xx_pwm_device = {
-       .name           = "s3c24xx_pwm",
-       .num_resources  = 0,
-};
-
-static struct platform_device gta02_dfbmcs320_device = {
-       .name = "dfbmcs320",
-};
-
-static struct i2c_board_info gta02_i2c_devs[] __initdata = {
-       {
-               I2C_BOARD_INFO("pcf50633", 0x73),
-               .irq = GTA02_IRQ_PCF50633,
-               .platform_data = &gta02_pcf_pdata,
-       },
-       {
-               I2C_BOARD_INFO("wm8753", 0x1a),
-       },
-};
-
-static struct s3c2410_nand_set __initdata gta02_nand_sets[] = {
-       [0] = {
-               /*
-                * This name is also hard-coded in the boot loaders, so
-                * changing it would would require all users to upgrade
-                * their boot loaders, some of which are stored in a NOR
-                * that is considered to be immutable.
-                */
-               .name           = "neo1973-nand",
-               .nr_chips       = 1,
-               .flash_bbt      = 1,
-       },
-};
-
-/*
- * Choose a set of timings derived from S3C@2442B MCP54
- * data sheet (K5D2G13ACM-D075 MCP Memory).
- */
-
-static struct s3c2410_platform_nand __initdata gta02_nand_info = {
-       .tacls          = 0,
-       .twrph0         = 25,
-       .twrph1         = 15,
-       .nr_sets        = ARRAY_SIZE(gta02_nand_sets),
-       .sets           = gta02_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-
-/* Get PMU to set USB current limit accordingly. */
-static struct s3c2410_udc_mach_info gta02_udc_cfg __initdata = {
-       .vbus_draw      = gta02_udc_vbus_draw,
-       .pullup_pin = GTA02_GPIO_USB_PULLUP,
-};
-
-/* USB */
-static struct s3c2410_hcd_info gta02_usb_info __initdata = {
-       .port[0]        = {
-               .flags  = S3C_HCDFLG_USED,
-       },
-       .port[1]        = {
-               .flags  = 0,
-       },
-};
-
-/* Touchscreen */
-static struct s3c2410_ts_mach_info gta02_ts_info = {
-       .delay                  = 10000,
-       .presc                  = 0xff, /* slow as we can go */
-       .oversampling_shift     = 2,
-};
-
-/* Buttons */
-static struct gpio_keys_button gta02_buttons[] = {
-       {
-               .gpio = GTA02_GPIO_AUX_KEY,
-               .code = KEY_PHONE,
-               .desc = "Aux",
-               .type = EV_KEY,
-               .debounce_interval = 100,
-       },
-       {
-               .gpio = GTA02_GPIO_HOLD_KEY,
-               .code = KEY_PAUSE,
-               .desc = "Hold",
-               .type = EV_KEY,
-               .debounce_interval = 100,
-       },
-};
-
-static struct gpio_keys_platform_data gta02_buttons_pdata = {
-       .buttons = gta02_buttons,
-       .nbuttons = ARRAY_SIZE(gta02_buttons),
-};
-
-static struct platform_device gta02_buttons_device = {
-       .name = "gpio-keys",
-       .id = -1,
-       .dev = {
-               .platform_data = &gta02_buttons_pdata,
-       },
-};
-
-static void __init gta02_map_io(void)
-{
-       s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
-       s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-
-/* These are the guys that don't need to be children of PMU. */
-
-static struct platform_device *gta02_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_wdt,
-       &s3c_device_sdi,
-       &s3c_device_usbgadget,
-       &s3c_device_nand,
-       &gta02_nor_flash,
-       &s3c24xx_pwm_device,
-       &s3c_device_iis,
-       &s3c_device_i2c0,
-       &gta02_dfbmcs320_device,
-       &gta02_buttons_device,
-       &s3c_device_adc,
-       &s3c_device_ts,
-};
-
-static void gta02_poweroff(void)
-{
-       pcf50633_reg_set_bit_mask(gta02_pcf, PCF50633_REG_OOCSHDWN, 1, 1);
-}
-
-static void __init gta02_machine_init(void)
-{
-       /* Set the panic callback to turn AUX LED on or off. */
-       panic_blink = gta02_panic_blink;
-
-       s3c_pm_init();
-
-#ifdef CONFIG_CHARGER_PCF50633
-       INIT_DELAYED_WORK(&gta02_charger_work, gta02_charger_worker);
-#endif
-
-       s3c24xx_udc_set_platdata(&gta02_udc_cfg);
-       s3c24xx_ts_set_platdata(&gta02_ts_info);
-       s3c_ohci_set_platdata(&gta02_usb_info);
-       s3c_nand_set_platdata(&gta02_nand_info);
-       s3c_i2c0_set_platdata(NULL);
-
-       i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
-
-       platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-       pm_power_off = gta02_poweroff;
-
-       regulator_has_full_constraints();
-}
-
-static void __init gta02_init_time(void)
-{
-       s3c2442_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-MACHINE_START(NEO1973_GTA02, "GTA02")
-       /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */
-       .atag_offset    = 0x100,
-       .map_io         = gta02_map_io,
-       .init_irq       = s3c2442_init_irq,
-       .init_machine   = gta02_machine_init,
-       .init_time      = gta02_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
deleted file mode 100644 (file)
index f471005..0000000
+++ /dev/null
@@ -1,760 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2003-2005 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// https://www.handhelds.org/projects/h1940.html
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/memblock.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/input.h>
-#include <linux/gpio_keys.h>
-#include <linux/pwm.h>
-#include <linux/pwm_backlight.h>
-#include <linux/i2c.h>
-#include <linux/leds.h>
-#include <linux/pda_power.h>
-#include <linux/s3c_adc_battery.h>
-#include <linux/delay.h>
-
-#include <video/platform_lcd.h>
-
-#include <linux/mmc/host.h>
-#include <linux/export.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/mmc-s3cmci.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-
-#include <sound/uda1380.h>
-
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "h1940.h"
-
-#define H1940_LATCH            ((void __force __iomem *)0xF8000000)
-
-#define H1940_PA_LATCH         S3C2410_CS2
-
-#define H1940_LATCH_BIT(x)     (1 << ((x) + 16 - S3C_GPIO_END))
-
-#define S3C24XX_PLL_MDIV_SHIFT         (12)
-#define S3C24XX_PLL_PDIV_SHIFT         (4)
-#define S3C24XX_PLL_SDIV_SHIFT         (0)
-
-static struct map_desc h1940_iodesc[] __initdata = {
-       [0] = {
-               .virtual        = (unsigned long)H1940_LATCH,
-               .pfn            = __phys_to_pfn(H1940_PA_LATCH),
-               .length         = SZ_16K,
-               .type           = MT_DEVICE
-       },
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x245,
-               .ulcon       = 0x03,
-               .ufcon       = 0x00,
-       },
-       /* IR port */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .uart_flags  = UPF_CONS_FLOW,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x43,
-               .ufcon       = 0x51,
-       }
-};
-
-/* Board control latch control */
-
-static unsigned int latch_state;
-
-static void h1940_latch_control(unsigned int clear, unsigned int set)
-{
-       unsigned long flags;
-
-       local_irq_save(flags);
-
-       latch_state &= ~clear;
-       latch_state |= set;
-
-       __raw_writel(latch_state, H1940_LATCH);
-
-       local_irq_restore(flags);
-}
-
-static inline int h1940_gpiolib_to_latch(int offset)
-{
-       return 1 << (offset + 16);
-}
-
-static void h1940_gpiolib_latch_set(struct gpio_chip *chip,
-                                       unsigned offset, int value)
-{
-       int latch_bit = h1940_gpiolib_to_latch(offset);
-
-       h1940_latch_control(value ? 0 : latch_bit,
-               value ? latch_bit : 0);
-}
-
-static int h1940_gpiolib_latch_output(struct gpio_chip *chip,
-                                       unsigned offset, int value)
-{
-       h1940_gpiolib_latch_set(chip, offset, value);
-       return 0;
-}
-
-static int h1940_gpiolib_latch_get(struct gpio_chip *chip,
-                                       unsigned offset)
-{
-       return (latch_state >> (offset + 16)) & 1;
-}
-
-static struct gpio_chip h1940_latch_gpiochip = {
-       .base                   = H1940_LATCH_GPIO(0),
-       .owner                  = THIS_MODULE,
-       .label                  = "H1940_LATCH",
-       .ngpio                  = 16,
-       .direction_output       = h1940_gpiolib_latch_output,
-       .set                    = h1940_gpiolib_latch_set,
-       .get                    = h1940_gpiolib_latch_get,
-};
-
-static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
-       .vbus_pin               = S3C2410_GPG(5),
-       .vbus_pin_inverted      = 1,
-       .pullup_pin             = H1940_LATCH_USB_DP,
-};
-
-static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
-               .delay = 10000,
-               .presc = 49,
-               .oversampling_shift = 2,
-               .cfg_gpio = s3c24xx_ts_cfg_gpio,
-};
-
-/**
- * Set lcd on or off
- **/
-static struct s3c2410fb_display h1940_lcd __initdata = {
-       .lcdcon5=       S3C2410_LCDCON5_FRM565 | \
-                       S3C2410_LCDCON5_INVVLINE | \
-                       S3C2410_LCDCON5_HWSWP,
-
-       .type =         S3C2410_LCDCON1_TFT,
-       .width =        240,
-       .height =       320,
-       .pixclock =     260000,
-       .xres =         240,
-       .yres =         320,
-       .bpp =          16,
-       .left_margin =  8,
-       .right_margin = 20,
-       .hsync_len =    4,
-       .upper_margin = 8,
-       .lower_margin = 7,
-       .vsync_len =    1,
-};
-
-static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
-       .displays = &h1940_lcd,
-       .num_displays = 1,
-       .default_display = 0,
-
-       .lpcsel =       0x02,
-       .gpccon =       0xaa940659,
-       .gpccon_mask =  0xffffc0f0,
-       .gpcup =        0x0000ffff,
-       .gpcup_mask =   0xffffffff,
-       .gpdcon =       0xaa84aaa0,
-       .gpdcon_mask =  0xffffffff,
-       .gpdup =        0x0000faff,
-       .gpdup_mask =   0xffffffff,
-};
-
-static int power_supply_init(struct device *dev)
-{
-       return gpio_request(S3C2410_GPF(2), "cable plugged");
-}
-
-static int h1940_is_ac_online(void)
-{
-       return !gpio_get_value(S3C2410_GPF(2));
-}
-
-static void power_supply_exit(struct device *dev)
-{
-       gpio_free(S3C2410_GPF(2));
-}
-
-static char *h1940_supplicants[] = {
-       "main-battery",
-       "backup-battery",
-};
-
-static struct pda_power_pdata power_supply_info = {
-       .init                   = power_supply_init,
-       .is_ac_online           = h1940_is_ac_online,
-       .exit                   = power_supply_exit,
-       .supplied_to            = h1940_supplicants,
-       .num_supplicants        = ARRAY_SIZE(h1940_supplicants),
-};
-
-static struct resource power_supply_resources[] = {
-       [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
-                       | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
-};
-
-static struct platform_device power_supply = {
-       .name           = "pda-power",
-       .id             = -1,
-       .dev            = {
-                               .platform_data =
-                                       &power_supply_info,
-       },
-       .resource       = power_supply_resources,
-       .num_resources  = ARRAY_SIZE(power_supply_resources),
-};
-
-static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
-       { .volt = 4070, .cur = 162, .level = 100},
-       { .volt = 4040, .cur = 165, .level = 95},
-       { .volt = 4016, .cur = 164, .level = 90},
-       { .volt = 3996, .cur = 166, .level = 85},
-       { .volt = 3971, .cur = 168, .level = 80},
-       { .volt = 3951, .cur = 168, .level = 75},
-       { .volt = 3931, .cur = 170, .level = 70},
-       { .volt = 3903, .cur = 172, .level = 65},
-       { .volt = 3886, .cur = 172, .level = 60},
-       { .volt = 3858, .cur = 176, .level = 55},
-       { .volt = 3842, .cur = 176, .level = 50},
-       { .volt = 3818, .cur = 176, .level = 45},
-       { .volt = 3789, .cur = 180, .level = 40},
-       { .volt = 3769, .cur = 180, .level = 35},
-       { .volt = 3749, .cur = 184, .level = 30},
-       { .volt = 3732, .cur = 184, .level = 25},
-       { .volt = 3716, .cur = 184, .level = 20},
-       { .volt = 3708, .cur = 184, .level = 15},
-       { .volt = 3716, .cur = 96, .level = 10},
-       { .volt = 3700, .cur = 96, .level = 5},
-       { .volt = 3684, .cur = 96, .level = 0},
-};
-
-static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
-       { .volt = 4130, .cur = 0, .level = 100},
-       { .volt = 3982, .cur = 0, .level = 50},
-       { .volt = 3854, .cur = 0, .level = 10},
-       { .volt = 3841, .cur = 0, .level = 0},
-};
-
-static int h1940_bat_init(void)
-{
-       int ret;
-
-       ret = gpio_request(H1940_LATCH_SM803_ENABLE, "h1940-charger-enable");
-       if (ret)
-               return ret;
-       gpio_direction_output(H1940_LATCH_SM803_ENABLE, 0);
-
-       return 0;
-
-}
-
-static void h1940_bat_exit(void)
-{
-       gpio_free(H1940_LATCH_SM803_ENABLE);
-}
-
-static void h1940_enable_charger(void)
-{
-       gpio_set_value(H1940_LATCH_SM803_ENABLE, 1);
-}
-
-static void h1940_disable_charger(void)
-{
-       gpio_set_value(H1940_LATCH_SM803_ENABLE, 0);
-}
-
-static struct s3c_adc_bat_pdata h1940_bat_cfg = {
-       .init = h1940_bat_init,
-       .exit = h1940_bat_exit,
-       .enable_charger = h1940_enable_charger,
-       .disable_charger = h1940_disable_charger,
-       .gpio_charge_finished = S3C2410_GPF(3),
-       .gpio_inverted = 1,
-       .lut_noac = bat_lut_noac,
-       .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
-       .lut_acin = bat_lut_acin,
-       .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
-       .volt_channel = 0,
-       .current_channel = 1,
-       .volt_mult = 4056,
-       .current_mult = 1893,
-       .internal_impedance = 200,
-       .backup_volt_channel = 3,
-       /* TODO Check backup volt multiplier */
-       .backup_volt_mult = 4056,
-       .backup_volt_min = 0,
-       .backup_volt_max = 4149288
-};
-
-static struct platform_device h1940_battery = {
-       .name             = "s3c-adc-battery",
-       .id               = -1,
-       .dev = {
-               .parent = &s3c_device_adc.dev,
-               .platform_data = &h1940_bat_cfg,
-       },
-};
-
-static DEFINE_SPINLOCK(h1940_blink_spin);
-
-int h1940_led_blink_set(struct gpio_desc *desc, int state,
-       unsigned long *delay_on, unsigned long *delay_off)
-{
-       int blink_gpio, check_gpio1, check_gpio2;
-       int gpio = desc ? desc_to_gpio(desc) : -EINVAL;
-
-       switch (gpio) {
-       case H1940_LATCH_LED_GREEN:
-               blink_gpio = S3C2410_GPA(7);
-               check_gpio1 = S3C2410_GPA(1);
-               check_gpio2 = S3C2410_GPA(3);
-               break;
-       case H1940_LATCH_LED_RED:
-               blink_gpio = S3C2410_GPA(1);
-               check_gpio1 = S3C2410_GPA(7);
-               check_gpio2 = S3C2410_GPA(3);
-               break;
-       default:
-               blink_gpio = S3C2410_GPA(3);
-               check_gpio1 = S3C2410_GPA(1);
-               check_gpio2 = S3C2410_GPA(7);
-               break;
-       }
-
-       if (delay_on && delay_off && !*delay_on && !*delay_off)
-               *delay_on = *delay_off = 500;
-
-       spin_lock(&h1940_blink_spin);
-
-       switch (state) {
-       case GPIO_LED_NO_BLINK_LOW:
-       case GPIO_LED_NO_BLINK_HIGH:
-               if (!gpio_get_value(check_gpio1) &&
-                   !gpio_get_value(check_gpio2))
-                       gpio_set_value(H1940_LATCH_LED_FLASH, 0);
-               gpio_set_value(blink_gpio, 0);
-               if (gpio_is_valid(gpio))
-                       gpio_set_value(gpio, state);
-               break;
-       case GPIO_LED_BLINK:
-               if (gpio_is_valid(gpio))
-                       gpio_set_value(gpio, 0);
-               gpio_set_value(H1940_LATCH_LED_FLASH, 1);
-               gpio_set_value(blink_gpio, 1);
-               break;
-       }
-
-       spin_unlock(&h1940_blink_spin);
-
-       return 0;
-}
-EXPORT_SYMBOL(h1940_led_blink_set);
-
-static struct gpio_led h1940_leds_desc[] = {
-       {
-               .name                   = "Green",
-               .default_trigger        = "main-battery-full",
-               .gpio                   = H1940_LATCH_LED_GREEN,
-               .retain_state_suspended = 1,
-       },
-       {
-               .name                   = "Red",
-               .default_trigger
-                       = "main-battery-charging-blink-full-solid",
-               .gpio                   = H1940_LATCH_LED_RED,
-               .retain_state_suspended = 1,
-       },
-};
-
-static struct gpio_led_platform_data h1940_leds_pdata = {
-       .num_leds       = ARRAY_SIZE(h1940_leds_desc),
-       .leds           = h1940_leds_desc,
-       .gpio_blink_set = h1940_led_blink_set,
-};
-
-static struct platform_device h1940_device_leds = {
-       .name   = "leds-gpio",
-       .id     = -1,
-       .dev    = {
-                       .platform_data = &h1940_leds_pdata,
-       },
-};
-
-static struct platform_device h1940_device_bluetooth = {
-       .name             = "h1940-bt",
-       .id               = -1,
-};
-
-static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
-{
-       switch (power_mode) {
-       case MMC_POWER_OFF:
-               gpio_set_value(H1940_LATCH_SD_POWER, 0);
-               break;
-       case MMC_POWER_UP:
-       case MMC_POWER_ON:
-               gpio_set_value(H1940_LATCH_SD_POWER, 1);
-               break;
-       default:
-               break;
-       }
-}
-
-static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
-       .set_power     = h1940_set_mmc_power,
-       .ocr_avail     = MMC_VDD_32_33,
-};
-
-static struct gpiod_lookup_table h1940_mmc_gpio_table = {
-       .dev_id = "s3c2410-sdi",
-       .table = {
-               /* Card detect S3C2410_GPF(5) */
-               GPIO_LOOKUP("GPF", 5, "cd", GPIO_ACTIVE_LOW),
-               /* Write protect S3C2410_GPH(8) */
-               GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct pwm_lookup h1940_pwm_lookup[] = {
-       PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 36296,
-                  PWM_POLARITY_NORMAL),
-};
-
-static int h1940_backlight_init(struct device *dev)
-{
-       gpio_request(S3C2410_GPB(0), "Backlight");
-
-       gpio_direction_output(S3C2410_GPB(0), 0);
-       s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
-       s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
-       gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
-
-       return 0;
-}
-
-static int h1940_backlight_notify(struct device *dev, int brightness)
-{
-       if (!brightness) {
-               gpio_direction_output(S3C2410_GPB(0), 1);
-               gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
-       } else {
-               gpio_direction_output(S3C2410_GPB(0), 0);
-               s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
-               s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
-               gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
-       }
-       return brightness;
-}
-
-static void h1940_backlight_exit(struct device *dev)
-{
-       gpio_direction_output(S3C2410_GPB(0), 1);
-       gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
-}
-
-
-static struct platform_pwm_backlight_data backlight_data = {
-       .max_brightness = 100,
-       .dft_brightness = 50,
-       .init           = h1940_backlight_init,
-       .notify         = h1940_backlight_notify,
-       .exit           = h1940_backlight_exit,
-};
-
-static struct platform_device h1940_backlight = {
-       .name = "pwm-backlight",
-       .dev  = {
-               .parent = &samsung_device_pwm.dev,
-               .platform_data = &backlight_data,
-       },
-       .id   = -1,
-};
-
-static void h1940_lcd_power_set(struct plat_lcd_data *pd,
-                                       unsigned int power)
-{
-       int value, retries = 100;
-
-       if (!power) {
-               gpio_set_value(S3C2410_GPC(0), 0);
-               /* wait for 3ac */
-               do {
-                       value = gpio_get_value(S3C2410_GPC(6));
-               } while (value && retries--);
-
-               gpio_set_value(H1940_LATCH_LCD_P2, 0);
-               gpio_set_value(H1940_LATCH_LCD_P3, 0);
-               gpio_set_value(H1940_LATCH_LCD_P4, 0);
-
-               gpio_direction_output(S3C2410_GPC(1), 0);
-               gpio_direction_output(S3C2410_GPC(4), 0);
-
-               gpio_set_value(H1940_LATCH_LCD_P1, 0);
-               gpio_set_value(H1940_LATCH_LCD_P0, 0);
-
-               gpio_set_value(S3C2410_GPC(5), 0);
-
-       } else {
-               gpio_set_value(H1940_LATCH_LCD_P0, 1);
-               gpio_set_value(H1940_LATCH_LCD_P1, 1);
-
-               gpio_direction_input(S3C2410_GPC(1));
-               gpio_direction_input(S3C2410_GPC(4));
-               mdelay(10);
-               s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
-               s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
-
-               gpio_set_value(S3C2410_GPC(5), 1);
-               gpio_set_value(S3C2410_GPC(0), 1);
-
-               gpio_set_value(H1940_LATCH_LCD_P3, 1);
-               gpio_set_value(H1940_LATCH_LCD_P2, 1);
-               gpio_set_value(H1940_LATCH_LCD_P4, 1);
-       }
-}
-
-static struct plat_lcd_data h1940_lcd_power_data = {
-       .set_power      = h1940_lcd_power_set,
-};
-
-static struct platform_device h1940_lcd_powerdev = {
-       .name                   = "platform-lcd",
-       .dev.parent             = &s3c_device_lcd.dev,
-       .dev.platform_data      = &h1940_lcd_power_data,
-};
-
-static struct uda1380_platform_data uda1380_info = {
-       .gpio_power     = H1940_LATCH_UDA_POWER,
-       .gpio_reset     = S3C2410_GPA(12),
-       .dac_clk        = UDA1380_DAC_CLK_SYSCLK,
-};
-
-static struct i2c_board_info h1940_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("uda1380", 0x1a),
-               .platform_data = &uda1380_info,
-       },
-};
-
-#define DECLARE_BUTTON(p, k, n, w)     \
-       {                               \
-               .gpio           = p,    \
-               .code           = k,    \
-               .desc           = n,    \
-               .wakeup         = w,    \
-               .active_low     = 1,    \
-       }
-
-static struct gpio_keys_button h1940_buttons[] = {
-       DECLARE_BUTTON(S3C2410_GPF(0),       KEY_POWER,          "Power", 1),
-       DECLARE_BUTTON(S3C2410_GPF(6),       KEY_ENTER,         "Select", 1),
-       DECLARE_BUTTON(S3C2410_GPF(7),      KEY_RECORD,         "Record", 0),
-       DECLARE_BUTTON(S3C2410_GPG(0),         KEY_F11,       "Calendar", 0),
-       DECLARE_BUTTON(S3C2410_GPG(2),         KEY_F12,       "Contacts", 0),
-       DECLARE_BUTTON(S3C2410_GPG(3),        KEY_MAIL,           "Mail", 0),
-       DECLARE_BUTTON(S3C2410_GPG(6),        KEY_LEFT,     "Left_arrow", 0),
-       DECLARE_BUTTON(S3C2410_GPG(7),    KEY_HOMEPAGE,           "Home", 0),
-       DECLARE_BUTTON(S3C2410_GPG(8),       KEY_RIGHT,    "Right_arrow", 0),
-       DECLARE_BUTTON(S3C2410_GPG(9),          KEY_UP,       "Up_arrow", 0),
-       DECLARE_BUTTON(S3C2410_GPG(10),       KEY_DOWN,     "Down_arrow", 0),
-};
-
-static struct gpio_keys_platform_data h1940_buttons_data = {
-       .buttons        = h1940_buttons,
-       .nbuttons       = ARRAY_SIZE(h1940_buttons),
-};
-
-static struct platform_device h1940_dev_buttons = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &h1940_buttons_data,
-       }
-};
-
-static struct platform_device *h1940_devices[] __initdata = {
-       &h1940_dev_buttons,
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_usbgadget,
-       &h1940_device_leds,
-       &h1940_device_bluetooth,
-       &s3c_device_sdi,
-       &s3c_device_rtc,
-       &samsung_device_pwm,
-       &h1940_backlight,
-       &h1940_lcd_powerdev,
-       &s3c_device_adc,
-       &s3c_device_ts,
-       &power_supply,
-       &h1940_battery,
-};
-
-static void __init h1940_map_io(void)
-{
-       s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
-       s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* setup PM */
-
-#ifdef CONFIG_PM_H1940
-       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
-#endif
-       s3c_pm_init();
-
-       /* Add latch gpio chip, set latch initial value */
-       h1940_latch_control(0, 0);
-       WARN_ON(gpiochip_add_data(&h1940_latch_gpiochip, NULL));
-}
-
-static void __init h1940_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-/* H1940 and RX3715 need to reserve this for suspend */
-static void __init h1940_reserve(void)
-{
-       memblock_reserve(0x30003000, 0x1000);
-       memblock_reserve(0x30081000, 0x1000);
-}
-
-static void __init h1940_init(void)
-{
-       u32 tmp;
-
-       s3c24xx_fb_set_platdata(&h1940_fb_info);
-       gpiod_add_lookup_table(&h1940_mmc_gpio_table);
-       s3c24xx_mci_set_platdata(&h1940_mmc_cfg);
-       s3c24xx_udc_set_platdata(&h1940_udc_cfg);
-       s3c24xx_ts_set_platdata(&h1940_ts_cfg);
-       s3c_i2c0_set_platdata(NULL);
-
-       /* Turn off suspend on both USB ports, and switch the
-        * selectable USB port to USB device mode. */
-
-       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                             S3C2410_MISCCR_USBSUSPND0 |
-                             S3C2410_MISCCR_USBSUSPND1, 0x0);
-
-       tmp =   (0x78 << S3C24XX_PLL_MDIV_SHIFT)
-             | (0x02 << S3C24XX_PLL_PDIV_SHIFT)
-             | (0x03 << S3C24XX_PLL_SDIV_SHIFT);
-       writel(tmp, S3C2410_UPLLCON);
-
-       gpio_request(S3C2410_GPC(0), "LCD power");
-       gpio_request(S3C2410_GPC(1), "LCD power");
-       gpio_request(S3C2410_GPC(4), "LCD power");
-       gpio_request(S3C2410_GPC(5), "LCD power");
-       gpio_request(S3C2410_GPC(6), "LCD power");
-       gpio_request(H1940_LATCH_LCD_P0, "LCD power");
-       gpio_request(H1940_LATCH_LCD_P1, "LCD power");
-       gpio_request(H1940_LATCH_LCD_P2, "LCD power");
-       gpio_request(H1940_LATCH_LCD_P3, "LCD power");
-       gpio_request(H1940_LATCH_LCD_P4, "LCD power");
-       gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
-       gpio_direction_output(S3C2410_GPC(0), 0);
-       gpio_direction_output(S3C2410_GPC(1), 0);
-       gpio_direction_output(S3C2410_GPC(4), 0);
-       gpio_direction_output(S3C2410_GPC(5), 0);
-       gpio_direction_input(S3C2410_GPC(6));
-       gpio_direction_output(H1940_LATCH_LCD_P0, 0);
-       gpio_direction_output(H1940_LATCH_LCD_P1, 0);
-       gpio_direction_output(H1940_LATCH_LCD_P2, 0);
-       gpio_direction_output(H1940_LATCH_LCD_P3, 0);
-       gpio_direction_output(H1940_LATCH_LCD_P4, 0);
-       gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
-
-       gpio_request(H1940_LATCH_SD_POWER, "SD power");
-       gpio_direction_output(H1940_LATCH_SD_POWER, 0);
-
-       pwm_add_table(h1940_pwm_lookup, ARRAY_SIZE(h1940_pwm_lookup));
-       platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
-
-       gpio_request(S3C2410_GPA(1), "Red LED blink");
-       gpio_request(S3C2410_GPA(3), "Blue LED blink");
-       gpio_request(S3C2410_GPA(7), "Green LED blink");
-       gpio_request(H1940_LATCH_LED_FLASH, "LED blink");
-       gpio_direction_output(S3C2410_GPA(1), 0);
-       gpio_direction_output(S3C2410_GPA(3), 0);
-       gpio_direction_output(S3C2410_GPA(7), 0);
-       gpio_direction_output(H1940_LATCH_LED_FLASH, 0);
-
-       i2c_register_board_info(0, h1940_i2c_devices,
-               ARRAY_SIZE(h1940_i2c_devices));
-}
-
-MACHINE_START(H1940, "IPAQ-H1940")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-       .map_io         = h1940_map_io,
-       .reserve        = h1940_reserve,
-       .init_irq       = s3c2410_init_irq,
-       .init_machine   = h1940_init,
-       .init_time      = h1940_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
deleted file mode 100644 (file)
index 885e8f1..0000000
+++ /dev/null
@@ -1,678 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2007 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://armlinux.simtec.co.uk/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/syscore_ops.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/i2c.h>
-
-#include <video/ili9320.h>
-
-#include <linux/spi/spi.h>
-#include <linux/spi/spi_gpio.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/fb.h>
-#include <mach/gpio-samsung.h>
-
-#include <asm/mach-types.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "s3c2412-power.h"
-
-static struct map_desc jive_iodesc[] __initdata = {
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg jive_uartcfgs[] = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-/* Jive flash assignment
- *
- * 0x00000000-0x00028000 : uboot
- * 0x00028000-0x0002c000 : uboot env
- * 0x0002c000-0x00030000 : spare
- * 0x00030000-0x00200000 : zimage A
- * 0x00200000-0x01600000 : cramfs A
- * 0x01600000-0x017d0000 : zimage B
- * 0x017d0000-0x02bd0000 : cramfs B
- * 0x02bd0000-0x03fd0000 : yaffs
- */
-static struct mtd_partition __initdata jive_imageA_nand_part[] = {
-
-#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
-       /* Don't allow access to the bootloader from linux */
-       {
-               .name           = "uboot",
-               .offset         = 0,
-               .size           = (160 * SZ_1K),
-               .mask_flags     = MTD_WRITEABLE, /* force read-only */
-       },
-
-       /* spare */
-        {
-                .name           = "spare",
-                .offset         = (176 * SZ_1K),
-                .size           = (16 * SZ_1K),
-        },
-#endif
-
-       /* booted images */
-        {
-               .name           = "kernel (ro)",
-               .offset         = (192 * SZ_1K),
-               .size           = (SZ_2M) - (192 * SZ_1K),
-               .mask_flags     = MTD_WRITEABLE, /* force read-only */
-        }, {
-                .name           = "root (ro)",
-                .offset         = (SZ_2M),
-                .size           = (20 * SZ_1M),
-               .mask_flags     = MTD_WRITEABLE, /* force read-only */
-        },
-
-       /* yaffs */
-       {
-               .name           = "yaffs",
-               .offset         = (44 * SZ_1M),
-               .size           = (20 * SZ_1M),
-       },
-
-       /* bootloader environment */
-       {
-                .name          = "env",
-               .offset         = (160 * SZ_1K),
-               .size           = (16 * SZ_1K),
-       },
-
-       /* upgrade images */
-        {
-               .name           = "zimage",
-               .offset         = (22 * SZ_1M),
-               .size           = (2 * SZ_1M) - (192 * SZ_1K),
-        }, {
-               .name           = "cramfs",
-               .offset         = (24 * SZ_1M) - (192*SZ_1K),
-               .size           = (20 * SZ_1M),
-        },
-};
-
-static struct mtd_partition __initdata jive_imageB_nand_part[] = {
-
-#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
-       /* Don't allow access to the bootloader from linux */
-       {
-               .name           = "uboot",
-               .offset         = 0,
-               .size           = (160 * SZ_1K),
-               .mask_flags     = MTD_WRITEABLE, /* force read-only */
-       },
-
-       /* spare */
-        {
-                .name           = "spare",
-                .offset         = (176 * SZ_1K),
-                .size           = (16 * SZ_1K),
-        },
-#endif
-
-       /* booted images */
-        {
-               .name           = "kernel (ro)",
-               .offset         = (22 * SZ_1M),
-               .size           = (2 * SZ_1M) - (192 * SZ_1K),
-               .mask_flags     = MTD_WRITEABLE, /* force read-only */
-        },
-       {
-               .name           = "root (ro)",
-               .offset         = (24 * SZ_1M) - (192 * SZ_1K),
-                .size          = (20 * SZ_1M),
-               .mask_flags     = MTD_WRITEABLE, /* force read-only */
-       },
-
-       /* yaffs */
-       {
-               .name           = "yaffs",
-               .offset         = (44 * SZ_1M),
-               .size           = (20 * SZ_1M),
-        },
-
-       /* bootloader environment */
-       {
-               .name           = "env",
-               .offset         = (160 * SZ_1K),
-               .size           = (16 * SZ_1K),
-       },
-
-       /* upgrade images */
-       {
-               .name           = "zimage",
-               .offset         = (192 * SZ_1K),
-               .size           = (2 * SZ_1M) - (192 * SZ_1K),
-        }, {
-               .name           = "cramfs",
-               .offset         = (2 * SZ_1M),
-               .size           = (20 * SZ_1M),
-        },
-};
-
-static struct s3c2410_nand_set __initdata jive_nand_sets[] = {
-       [0] = {
-               .name           = "flash",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(jive_imageA_nand_part),
-               .partitions     = jive_imageA_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand __initdata jive_nand_info = {
-       /* set taken from osiris nand timings, possibly still conservative */
-       .tacls          = 30,
-       .twrph0         = 55,
-       .twrph1         = 40,
-       .sets           = jive_nand_sets,
-       .nr_sets        = ARRAY_SIZE(jive_nand_sets),
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-static int __init jive_mtdset(char *options)
-{
-       struct s3c2410_nand_set *nand = &jive_nand_sets[0];
-       unsigned long set;
-
-       if (options == NULL || options[0] == '\0')
-               return 0;
-
-       if (kstrtoul(options, 10, &set)) {
-               printk(KERN_ERR "failed to parse mtdset=%s\n", options);
-               return 0;
-       }
-
-       switch (set) {
-       case 1:
-               nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part);
-               nand->partitions = jive_imageB_nand_part;
-       case 0:
-               /* this is already setup in the nand info */
-               break;
-       default:
-               printk(KERN_ERR "Unknown mtd set %ld specified,"
-                      "using default.", set);
-       }
-
-       return 0;
-}
-
-/* parse the mtdset= option given to the kernel command line */
-__setup("mtdset=", jive_mtdset);
-
-/* LCD timing and setup */
-
-#define LCD_XRES        (240)
-#define LCD_YRES        (320)
-#define LCD_LEFT_MARGIN  (12)
-#define LCD_RIGHT_MARGIN (12)
-#define LCD_LOWER_MARGIN (12)
-#define LCD_UPPER_MARGIN (12)
-#define LCD_VSYNC       (2)
-#define LCD_HSYNC       (2)
-
-#define LCD_REFRESH     (60)
-
-#define LCD_HTOT (LCD_HSYNC + LCD_LEFT_MARGIN + LCD_XRES + LCD_RIGHT_MARGIN)
-#define LCD_VTOT (LCD_VSYNC + LCD_LOWER_MARGIN + LCD_YRES + LCD_UPPER_MARGIN)
-
-static struct s3c2410fb_display jive_vgg2432a4_display[] = {
-       [0] = {
-               .width          = LCD_XRES,
-               .height         = LCD_YRES,
-               .xres           = LCD_XRES,
-               .yres           = LCD_YRES,
-               .left_margin    = LCD_LEFT_MARGIN,
-               .right_margin   = LCD_RIGHT_MARGIN,
-               .upper_margin   = LCD_UPPER_MARGIN,
-               .lower_margin   = LCD_LOWER_MARGIN,
-               .hsync_len      = LCD_HSYNC,
-               .vsync_len      = LCD_VSYNC,
-
-               .pixclock       = (1000000000000LL /
-                                  (LCD_REFRESH * LCD_HTOT * LCD_VTOT)),
-
-               .bpp            = 16,
-               .type           = (S3C2410_LCDCON1_TFT16BPP |
-                                  S3C2410_LCDCON1_TFT),
-
-               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
-                                  S3C2410_LCDCON5_INVVLINE |
-                                  S3C2410_LCDCON5_INVVFRAME |
-                                  S3C2410_LCDCON5_INVVDEN |
-                                  S3C2410_LCDCON5_PWREN),
-       },
-};
-
-/* todo - put into gpio header */
-
-#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
-#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
-
-static struct s3c2410fb_mach_info jive_lcd_config = {
-       .displays        = jive_vgg2432a4_display,
-       .num_displays    = ARRAY_SIZE(jive_vgg2432a4_display),
-       .default_display = 0,
-
-       /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
-        * and disable the pull down resistors on pins we are using for LCD
-        * data. */
-
-       .gpcup          = (0xf << 1) | (0x3f << 10),
-
-       .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
-                          S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
-                          S3C2410_GPC10_VD2   | S3C2410_GPC11_VD3 |
-                          S3C2410_GPC12_VD4   | S3C2410_GPC13_VD5 |
-                          S3C2410_GPC14_VD6   | S3C2410_GPC15_VD7),
-
-       .gpccon_mask    = (S3C2410_GPCCON_MASK(1)  | S3C2410_GPCCON_MASK(2)  |
-                          S3C2410_GPCCON_MASK(3)  | S3C2410_GPCCON_MASK(4)  |
-                          S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
-                          S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
-                          S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
-
-       .gpdup          = (0x3f << 2) | (0x3f << 10),
-
-       .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
-                          S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
-                          S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
-                          S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
-                          S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
-                          S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
-
-       .gpdcon_mask    = (S3C2410_GPDCON_MASK(2)  | S3C2410_GPDCON_MASK(3) |
-                          S3C2410_GPDCON_MASK(4)  | S3C2410_GPDCON_MASK(5) |
-                          S3C2410_GPDCON_MASK(6)  | S3C2410_GPDCON_MASK(7) |
-                          S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
-                          S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
-                          S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
-};
-
-/* ILI9320 support. */
-
-static void jive_lcm_reset(unsigned int set)
-{
-       printk(KERN_DEBUG "%s(%d)\n", __func__, set);
-
-       gpio_set_value(S3C2410_GPG(13), set);
-}
-
-#undef LCD_UPPER_MARGIN
-#define LCD_UPPER_MARGIN 2
-
-static struct ili9320_platdata jive_lcm_config = {
-       .hsize          = LCD_XRES,
-       .vsize          = LCD_YRES,
-
-       .reset          = jive_lcm_reset,
-       .suspend        = ILI9320_SUSPEND_DEEP,
-
-       .entry_mode     = ILI9320_ENTRYMODE_ID(3) | ILI9320_ENTRYMODE_BGR,
-       .display2       = (ILI9320_DISPLAY2_FP(LCD_UPPER_MARGIN) |
-                          ILI9320_DISPLAY2_BP(LCD_LOWER_MARGIN)),
-       .display3       = 0x0,
-       .display4       = 0x0,
-       .rgb_if1        = (ILI9320_RGBIF1_RIM_RGB18 |
-                          ILI9320_RGBIF1_RM | ILI9320_RGBIF1_CLK_RGBIF),
-       .rgb_if2        = ILI9320_RGBIF2_DPL,
-       .interface2     = 0x0,
-       .interface3     = 0x3,
-       .interface4     = (ILI9320_INTERFACE4_RTNE(16) |
-                          ILI9320_INTERFACE4_DIVE(1)),
-       .interface5     = 0x0,
-       .interface6     = 0x0,
-};
-
-/* LCD SPI support */
-
-static struct spi_gpio_platform_data jive_lcd_spi = {
-       .num_chipselect = 1,
-};
-
-static struct platform_device jive_device_lcdspi = {
-       .name           = "spi_gpio",
-       .id             = 1,
-       .dev.platform_data = &jive_lcd_spi,
-};
-
-static struct gpiod_lookup_table jive_lcdspi_gpiod_table = {
-       .dev_id         = "spi_gpio",
-       .table          = {
-               GPIO_LOOKUP("GPIOG", 8,
-                           "sck", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOB", 8,
-                           "mosi", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOB", 7,
-                           "cs", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-/* WM8750 audio code SPI definition */
-
-static struct spi_gpio_platform_data jive_wm8750_spi = {
-       .num_chipselect = 1,
-};
-
-static struct platform_device jive_device_wm8750 = {
-       .name           = "spi_gpio",
-       .id             = 2,
-       .dev.platform_data = &jive_wm8750_spi,
-};
-
-static struct gpiod_lookup_table jive_wm8750_gpiod_table = {
-       .dev_id         = "spi_gpio",
-       .table          = {
-               GPIO_LOOKUP("GPIOB", 4,
-                           "sck", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOB", 9,
-                           "mosi", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOH", 10,
-                           "cs", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-/* JIVE SPI devices. */
-
-static struct spi_board_info __initdata jive_spi_devs[] = {
-       [0] = {
-               .modalias       = "VGG2432A4",
-               .bus_num        = 1,
-               .chip_select    = 0,
-               .mode           = SPI_MODE_3,   /* CPOL=1, CPHA=1 */
-               .max_speed_hz   = 100000,
-               .platform_data  = &jive_lcm_config,
-       }, {
-               .modalias       = "WM8750",
-               .bus_num        = 2,
-               .chip_select    = 0,
-               .mode           = SPI_MODE_0,   /* CPOL=0, CPHA=0 */
-               .max_speed_hz   = 100000,
-       },
-};
-
-/* I2C bus and device configuration. */
-
-static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
-       .frequency      = 80 * 1000,
-       .flags          = S3C_IICFLG_FILTER,
-       .sda_delay      = 2,
-};
-
-static struct i2c_board_info jive_i2c_devs[] __initdata = {
-       [0] = {
-               I2C_BOARD_INFO("lis302dl", 0x1c),
-               .irq    = IRQ_EINT14,
-       },
-};
-
-/* The platform devices being used. */
-
-static struct platform_device *jive_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_rtc,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_lcd,
-       &jive_device_lcdspi,
-       &jive_device_wm8750,
-       &s3c_device_nand,
-       &s3c_device_usbgadget,
-       &s3c2412_device_dma,
-};
-
-static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
-       .vbus_pin       = S3C2410_GPG(1),               /* detect is on GPG1 */
-};
-
-/* Jive power management device */
-
-#ifdef CONFIG_PM
-static int jive_pm_suspend(void)
-{
-       /* Write the magic value u-boot uses to check for resume into
-        * the INFORM0 register, and ensure INFORM1 is set to the
-        * correct address to resume from. */
-
-       __raw_writel(0x2BED, S3C2412_INFORM0);
-       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
-
-       return 0;
-}
-
-static void jive_pm_resume(void)
-{
-       __raw_writel(0x0, S3C2412_INFORM0);
-}
-
-#else
-#define jive_pm_suspend NULL
-#define jive_pm_resume NULL
-#endif
-
-static struct syscore_ops jive_pm_syscore_ops = {
-       .suspend        = jive_pm_suspend,
-       .resume         = jive_pm_resume,
-};
-
-static void __init jive_map_io(void)
-{
-       s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
-       s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init jive_init_time(void)
-{
-       s3c2412_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void jive_power_off(void)
-{
-       printk(KERN_INFO "powering system down...\n");
-
-       gpio_request_one(S3C2410_GPC(5), GPIOF_OUT_INIT_HIGH, NULL);
-       gpio_free(S3C2410_GPC(5));
-}
-
-static void __init jive_machine_init(void)
-{
-       /* register system core operations for managing low level suspend */
-
-       register_syscore_ops(&jive_pm_syscore_ops);
-
-       /* write our sleep configurations for the IO. Pull down all unused
-        * IO, ensure that we have turned off all peripherals we do not
-        * need, and configure the ones we do need. */
-
-       /* Port B sleep */
-
-       __raw_writel(S3C2412_SLPCON_IN(0)   |
-                    S3C2412_SLPCON_PULL(1) |
-                    S3C2412_SLPCON_HIGH(2) |
-                    S3C2412_SLPCON_PULL(3) |
-                    S3C2412_SLPCON_PULL(4) |
-                    S3C2412_SLPCON_PULL(5) |
-                    S3C2412_SLPCON_PULL(6) |
-                    S3C2412_SLPCON_HIGH(7) |
-                    S3C2412_SLPCON_PULL(8) |
-                    S3C2412_SLPCON_PULL(9) |
-                    S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON);
-
-       /* Port C sleep */
-
-       __raw_writel(S3C2412_SLPCON_PULL(0) |
-                    S3C2412_SLPCON_PULL(1) |
-                    S3C2412_SLPCON_PULL(2) |
-                    S3C2412_SLPCON_PULL(3) |
-                    S3C2412_SLPCON_PULL(4) |
-                    S3C2412_SLPCON_PULL(5) |
-                    S3C2412_SLPCON_LOW(6)  |
-                    S3C2412_SLPCON_PULL(6) |
-                    S3C2412_SLPCON_PULL(7) |
-                    S3C2412_SLPCON_PULL(8) |
-                    S3C2412_SLPCON_PULL(9) |
-                    S3C2412_SLPCON_PULL(10) |
-                    S3C2412_SLPCON_PULL(11) |
-                    S3C2412_SLPCON_PULL(12) |
-                    S3C2412_SLPCON_PULL(13) |
-                    S3C2412_SLPCON_PULL(14) |
-                    S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON);
-
-       /* Port D sleep */
-
-       __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON);
-
-       /* Port F sleep */
-
-       __raw_writel(S3C2412_SLPCON_LOW(0)  |
-                    S3C2412_SLPCON_LOW(1)  |
-                    S3C2412_SLPCON_LOW(2)  |
-                    S3C2412_SLPCON_EINT(3) |
-                    S3C2412_SLPCON_EINT(4) |
-                    S3C2412_SLPCON_EINT(5) |
-                    S3C2412_SLPCON_EINT(6) |
-                    S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON);
-
-       /* Port G sleep */
-
-       __raw_writel(S3C2412_SLPCON_IN(0)    |
-                    S3C2412_SLPCON_IN(1)    |
-                    S3C2412_SLPCON_IN(2)    |
-                    S3C2412_SLPCON_IN(3)    |
-                    S3C2412_SLPCON_IN(4)    |
-                    S3C2412_SLPCON_IN(5)    |
-                    S3C2412_SLPCON_IN(6)    |
-                    S3C2412_SLPCON_IN(7)    |
-                    S3C2412_SLPCON_PULL(8)  |
-                    S3C2412_SLPCON_PULL(9)  |
-                    S3C2412_SLPCON_IN(10)   |
-                    S3C2412_SLPCON_PULL(11) |
-                    S3C2412_SLPCON_PULL(12) |
-                    S3C2412_SLPCON_PULL(13) |
-                    S3C2412_SLPCON_IN(14)   |
-                    S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON);
-
-       /* Port H sleep */
-
-       __raw_writel(S3C2412_SLPCON_PULL(0) |
-                    S3C2412_SLPCON_PULL(1) |
-                    S3C2412_SLPCON_PULL(2) |
-                    S3C2412_SLPCON_PULL(3) |
-                    S3C2412_SLPCON_PULL(4) |
-                    S3C2412_SLPCON_PULL(5) |
-                    S3C2412_SLPCON_PULL(6) |
-                    S3C2412_SLPCON_IN(7)   |
-                    S3C2412_SLPCON_IN(8)   |
-                    S3C2412_SLPCON_PULL(9) |
-                    S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON);
-
-       /* initialise the power management now we've setup everything. */
-
-       s3c_pm_init();
-
-       /** TODO - check that this is after the cmdline option! */
-       s3c_nand_set_platdata(&jive_nand_info);
-
-       gpio_request(S3C2410_GPG(13), "lcm reset");
-       gpio_direction_output(S3C2410_GPG(13), 0);
-
-       gpio_request_one(S3C2410_GPB(6), GPIOF_OUT_INIT_LOW, NULL);
-       gpio_free(S3C2410_GPB(6));
-
-       /* Turn off suspend on both USB ports, and switch the
-        * selectable USB port to USB device mode. */
-
-       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                             S3C2410_MISCCR_USBSUSPND0 |
-                             S3C2410_MISCCR_USBSUSPND1, 0x0);
-
-       s3c24xx_udc_set_platdata(&jive_udc_cfg);
-       s3c24xx_fb_set_platdata(&jive_lcd_config);
-
-       spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
-
-       s3c_i2c0_set_platdata(&jive_i2c_cfg);
-       i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
-
-       pm_power_off = jive_power_off;
-
-       gpiod_add_lookup_table(&jive_lcdspi_gpiod_table);
-       gpiod_add_lookup_table(&jive_wm8750_gpiod_table);
-       platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
-}
-
-MACHINE_START(JIVE, "JIVE")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-
-       .init_irq       = s3c2412_init_irq,
-       .map_io         = jive_map_io,
-       .init_machine   = jive_machine_init,
-       .init_time      = jive_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
deleted file mode 100644 (file)
index 2357494..0000000
+++ /dev/null
@@ -1,777 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
-//      Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
-//      and modifications by SBZ <sbz@spgui.org> and
-//      Weibing <http://weibing.blogbus.com> and
-//      Michel Pollet <buserror@gmail.com>
-//
-// For product information, visit https://code.google.com/p/mini2440/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/input.h>
-#include <linux/io.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/dm9000.h>
-#include <linux/property.h>
-#include <linux/platform_device.h>
-#include <linux/gpio_keys.h>
-#include <linux/i2c.h>
-#include <linux/mmc/host.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <mach/hardware.h>
-#include <mach/fb.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-lcd.h>
-#include <mach/irqs.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/mmc-s3cmci.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include <sound/s3c24xx_uda134x.h>
-
-#include "common.h"
-
-#define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
-
-static struct map_desc mini2440_iodesc[] __initdata = {
-       /* nothing to declare, move along */
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-
-static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport         = 0,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [1] = {
-               .hwport         = 1,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [2] = {
-               .hwport         = 2,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-};
-
-/* USB device UDC support */
-
-static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
-       .pullup_pin = S3C2410_GPC(5),
-};
-
-
-/* LCD timing and setup */
-
-/*
- * This macro simplifies the table bellow
- */
-#define _LCD_DECLARE(_clock, _xres, margin_left, margin_right, hsync, \
-                       _yres, margin_top, margin_bottom, vsync, refresh) \
-       .width = _xres, \
-       .xres = _xres, \
-       .height = _yres, \
-       .yres = _yres, \
-       .left_margin    = margin_left,  \
-       .right_margin   = margin_right, \
-       .upper_margin   = margin_top,   \
-       .lower_margin   = margin_bottom,        \
-       .hsync_len      = hsync,        \
-       .vsync_len      = vsync,        \
-       .pixclock       = ((_clock*100000000000LL) /    \
-                          ((refresh) * \
-                          (hsync + margin_left + _xres + margin_right) * \
-                          (vsync + margin_top + _yres + margin_bottom))), \
-       .bpp            = 16,\
-       .type           = (S3C2410_LCDCON1_TFT16BPP |\
-                          S3C2410_LCDCON1_TFT)
-
-static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
-       [0] = { /* mini2440 + 3.5" TFT + touchscreen */
-               _LCD_DECLARE(
-                       7,                      /* The 3.5 is quite fast */
-                       240, 21, 38, 6,         /* x timing */
-                       320, 4, 4, 2,           /* y timing */
-                       60),                    /* refresh rate */
-               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
-                                  S3C2410_LCDCON5_INVVLINE |
-                                  S3C2410_LCDCON5_INVVFRAME |
-                                  S3C2410_LCDCON5_INVVDEN |
-                                  S3C2410_LCDCON5_PWREN),
-       },
-       [1] = { /* mini2440 + 7" TFT + touchscreen */
-               _LCD_DECLARE(
-                       10,                     /* the 7" runs slower */
-                       800, 40, 40, 48,        /* x timing */
-                       480, 29, 3, 3,          /* y timing */
-                       50),                    /* refresh rate */
-               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
-                                  S3C2410_LCDCON5_INVVLINE |
-                                  S3C2410_LCDCON5_INVVFRAME |
-                                  S3C2410_LCDCON5_PWREN),
-       },
-       /* The VGA shield can outout at several resolutions. All share
-        * the same timings, however, anything smaller than 1024x768
-        * will only be displayed in the top left corner of a 1024x768
-        * XGA output unless you add optional dip switches to the shield.
-        * Therefore timings for other resolutions have been omitted here.
-        */
-       [2] = {
-               _LCD_DECLARE(
-                       10,
-                       1024, 1, 2, 2,          /* y timing */
-                       768, 200, 16, 16,       /* x timing */
-                       24),    /* refresh rate, maximum stable,
-                                * tested with the FPGA shield
-                                */
-               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
-                                  S3C2410_LCDCON5_HWSWP),
-       },
-       /* mini2440 + 3.5" TFT (LCD-W35i, LQ035Q1DG06 type) + touchscreen*/
-       [3] = {
-               _LCD_DECLARE(
-                       /* clock */
-                       7,
-                       /* xres, margin_right, margin_left, hsync */
-                       320, 68, 66, 4,
-                       /* yres, margin_top, margin_bottom, vsync */
-                       240, 4, 4, 9,
-                       /* refresh rate */
-                       60),
-               .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
-                                  S3C2410_LCDCON5_INVVDEN |
-                                  S3C2410_LCDCON5_INVVFRAME |
-                                  S3C2410_LCDCON5_INVVLINE |
-                                  S3C2410_LCDCON5_INVVCLK |
-                                  S3C2410_LCDCON5_HWSWP),
-       },
-};
-
-/* todo - put into gpio header */
-
-#define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
-#define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
-
-static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
-       .displays        = &mini2440_lcd_cfg[0], /* not constant! see init */
-       .num_displays    = 1,
-       .default_display = 0,
-
-       /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
-        * and disable the pull down resistors on pins we are using for LCD
-        * data.
-        */
-
-       .gpcup          = (0xf << 1) | (0x3f << 10),
-
-       .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
-                          S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
-                          S3C2410_GPC10_VD2   | S3C2410_GPC11_VD3 |
-                          S3C2410_GPC12_VD4   | S3C2410_GPC13_VD5 |
-                          S3C2410_GPC14_VD6   | S3C2410_GPC15_VD7),
-
-       .gpccon_mask    = (S3C2410_GPCCON_MASK(1)  | S3C2410_GPCCON_MASK(2)  |
-                          S3C2410_GPCCON_MASK(3)  | S3C2410_GPCCON_MASK(4)  |
-                          S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
-                          S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
-                          S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
-
-       .gpdup          = (0x3f << 2) | (0x3f << 10),
-
-       .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
-                          S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
-                          S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
-                          S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
-                          S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
-                          S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
-
-       .gpdcon_mask    = (S3C2410_GPDCON_MASK(2)  | S3C2410_GPDCON_MASK(3) |
-                          S3C2410_GPDCON_MASK(4)  | S3C2410_GPDCON_MASK(5) |
-                          S3C2410_GPDCON_MASK(6)  | S3C2410_GPDCON_MASK(7) |
-                          S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
-                          S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
-                          S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
-};
-
-/* MMC/SD  */
-
-static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
-       .wprotect_invert        = 1,
-       .set_power              = NULL,
-       .ocr_avail              = MMC_VDD_32_33|MMC_VDD_33_34,
-};
-
-static struct gpiod_lookup_table mini2440_mmc_gpio_table = {
-       .dev_id = "s3c2410-sdi",
-       .table = {
-               /* Card detect S3C2410_GPG(8) */
-               GPIO_LOOKUP("GPG", 8, "cd", GPIO_ACTIVE_LOW),
-               /* Write protect S3C2410_GPH(8) */
-               GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-/* NAND Flash on MINI2440 board */
-
-static struct mtd_partition mini2440_default_nand_part[] __initdata = {
-       [0] = {
-               .name   = "u-boot",
-               .size   = SZ_256K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "u-boot-env",
-               .size   = SZ_128K,
-               .offset = SZ_256K,
-       },
-       [2] = {
-               .name   = "kernel",
-               /* 5 megabytes, for a kernel with no modules
-                * or a uImage with a ramdisk attached
-                */
-               .size   = 0x00500000,
-               .offset = SZ_256K + SZ_128K,
-       },
-       [3] = {
-               .name   = "root",
-               .offset = SZ_256K + SZ_128K + 0x00500000,
-               .size   = MTDPART_SIZ_FULL,
-       },
-};
-
-static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
-       [0] = {
-               .name           = "nand",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(mini2440_default_nand_part),
-               .partitions     = mini2440_default_nand_part,
-               .flash_bbt      = 1, /* we use u-boot to create a BBT */
-       },
-};
-
-static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
-       .tacls          = 0,
-       .twrph0         = 25,
-       .twrph1         = 15,
-       .nr_sets        = ARRAY_SIZE(mini2440_nand_sets),
-       .sets           = mini2440_nand_sets,
-       .ignore_unset_ecc = 1,
-       .ecc_mode       = NAND_ECC_HW,
-};
-
-/* DM9000AEP 10/100 ethernet controller */
-
-static struct resource mini2440_dm9k_resource[] = {
-       [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
-       [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
-       [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ
-                                               | IORESOURCE_IRQ_HIGHEDGE),
-};
-
-/*
- * The DM9000 has no eeprom, and it's MAC address is set by
- * the bootloader before starting the kernel.
- */
-static struct dm9000_plat_data mini2440_dm9k_pdata = {
-       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
-};
-
-static struct platform_device mini2440_device_eth = {
-       .name           = "dm9000",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(mini2440_dm9k_resource),
-       .resource       = mini2440_dm9k_resource,
-       .dev            = {
-               .platform_data  = &mini2440_dm9k_pdata,
-       },
-};
-
-/*  CON5
- *     +--+     /-----\
- *     |  |    |       |
- *     |  |    |  BAT  |
- *     |  |     \_____/
- *     |  |
- *     |  |  +----+  +----+
- *     |  |  | K5 |  | K1 |
- *     |  |  +----+  +----+
- *     |  |  +----+  +----+
- *     |  |  | K4 |  | K2 |
- *     |  |  +----+  +----+
- *     |  |  +----+  +----+
- *     |  |  | K6 |  | K3 |
- *     |  |  +----+  +----+
- *       .....
- */
-static struct gpio_keys_button mini2440_buttons[] = {
-       {
-               .gpio           = S3C2410_GPG(0),               /* K1 */
-               .code           = KEY_F1,
-               .desc           = "Button 1",
-               .active_low     = 1,
-       },
-       {
-               .gpio           = S3C2410_GPG(3),               /* K2 */
-               .code           = KEY_F2,
-               .desc           = "Button 2",
-               .active_low     = 1,
-       },
-       {
-               .gpio           = S3C2410_GPG(5),               /* K3 */
-               .code           = KEY_F3,
-               .desc           = "Button 3",
-               .active_low     = 1,
-       },
-       {
-               .gpio           = S3C2410_GPG(6),               /* K4 */
-               .code           = KEY_POWER,
-               .desc           = "Power",
-               .active_low     = 1,
-       },
-       {
-               .gpio           = S3C2410_GPG(7),               /* K5 */
-               .code           = KEY_F5,
-               .desc           = "Button 5",
-               .active_low     = 1,
-       },
-#if 0
-       /* this pin is also known as TCLK1 and seems to already
-        * marked as "in use" somehow in the kernel -- possibly wrongly
-        */
-       {
-               .gpio           = S3C2410_GPG(11),      /* K6 */
-               .code           = KEY_F6,
-               .desc           = "Button 6",
-               .active_low     = 1,
-       },
-#endif
-};
-
-static struct gpio_keys_platform_data mini2440_button_data = {
-       .buttons        = mini2440_buttons,
-       .nbuttons       = ARRAY_SIZE(mini2440_buttons),
-};
-
-static struct platform_device mini2440_button_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &mini2440_button_data,
-       }
-};
-
-/* LEDS */
-
-static struct gpiod_lookup_table mini2440_led1_gpio_table = {
-       .dev_id = "s3c24xx_led.1",
-       .table = {
-               GPIO_LOOKUP("GPB", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table mini2440_led2_gpio_table = {
-       .dev_id = "s3c24xx_led.2",
-       .table = {
-               GPIO_LOOKUP("GPB", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table mini2440_led3_gpio_table = {
-       .dev_id = "s3c24xx_led.3",
-       .table = {
-               GPIO_LOOKUP("GPB", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table mini2440_led4_gpio_table = {
-       .dev_id = "s3c24xx_led.4",
-       .table = {
-               GPIO_LOOKUP("GPB", 8, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table mini2440_backlight_gpio_table = {
-       .dev_id = "s3c24xx_led.5",
-       .table = {
-               GPIO_LOOKUP("GPG", 4, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata mini2440_led1_pdata = {
-       .name           = "led1",
-       .def_trigger    = "heartbeat",
-};
-
-static struct s3c24xx_led_platdata mini2440_led2_pdata = {
-       .name           = "led2",
-       .def_trigger    = "nand-disk",
-};
-
-static struct s3c24xx_led_platdata mini2440_led3_pdata = {
-       .name           = "led3",
-       .def_trigger    = "mmc0",
-};
-
-static struct s3c24xx_led_platdata mini2440_led4_pdata = {
-       .name           = "led4",
-       .def_trigger    = "",
-};
-
-static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
-       .name           = "backlight",
-       .def_trigger    = "backlight",
-};
-
-static struct platform_device mini2440_led1 = {
-       .name           = "s3c24xx_led",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &mini2440_led1_pdata,
-       },
-};
-
-static struct platform_device mini2440_led2 = {
-       .name           = "s3c24xx_led",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &mini2440_led2_pdata,
-       },
-};
-
-static struct platform_device mini2440_led3 = {
-       .name           = "s3c24xx_led",
-       .id             = 3,
-       .dev            = {
-               .platform_data  = &mini2440_led3_pdata,
-       },
-};
-
-static struct platform_device mini2440_led4 = {
-       .name           = "s3c24xx_led",
-       .id             = 4,
-       .dev            = {
-               .platform_data  = &mini2440_led4_pdata,
-       },
-};
-
-static struct platform_device mini2440_led_backlight = {
-       .name           = "s3c24xx_led",
-       .id             = 5,
-       .dev            = {
-               .platform_data  = &mini2440_led_backlight_pdata,
-       },
-};
-
-/* AUDIO */
-
-static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
-       .l3_clk = S3C2410_GPB(4),
-       .l3_mode = S3C2410_GPB(2),
-       .l3_data = S3C2410_GPB(3),
-       .model = UDA134X_UDA1341
-};
-
-static struct platform_device mini2440_audio = {
-       .name           = "s3c24xx_uda134x",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &mini2440_audio_pins,
-       },
-};
-
-/*
- * I2C devices
- */
-static const struct property_entry mini2440_at24_properties[] = {
-       PROPERTY_ENTRY_U32("pagesize", 16),
-       { }
-};
-
-static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
-       {
-               I2C_BOARD_INFO("24c08", 0x50),
-               .properties = mini2440_at24_properties,
-       },
-};
-
-static struct uda134x_platform_data s3c24xx_uda134x = {
-       .l3 = {
-               .gpio_clk = S3C2410_GPB(4),
-               .gpio_data = S3C2410_GPB(3),
-               .gpio_mode = S3C2410_GPB(2),
-               .use_gpios = 1,
-               .data_hold = 1,
-               .data_setup = 1,
-               .clock_high = 1,
-               .mode_hold = 1,
-               .mode = 1,
-               .mode_setup = 1,
-       },
-       .model = UDA134X_UDA1341,
-};
-
-static struct platform_device uda1340_codec = {
-               .name = "uda134x-codec",
-               .id = -1,
-               .dev = {
-                       .platform_data  = &s3c24xx_uda134x,
-               },
-};
-
-static struct platform_device *mini2440_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_rtc,
-       &s3c_device_usbgadget,
-       &mini2440_device_eth,
-       &mini2440_led1,
-       &mini2440_led2,
-       &mini2440_led3,
-       &mini2440_led4,
-       &mini2440_button_device,
-       &s3c_device_nand,
-       &s3c_device_sdi,
-       &s3c2440_device_dma,
-       &s3c_device_iis,
-       &uda1340_codec,
-       &mini2440_audio,
-};
-
-static void __init mini2440_map_io(void)
-{
-       s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
-       s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init mini2440_init_time(void)
-{
-       s3c2440_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-/*
- * mini2440_features string
- *
- * t = Touchscreen present
- * b = backlight control
- * c = camera [TODO]
- * 0-9 LCD configuration
- *
- */
-static char mini2440_features_str[12] __initdata = "0tb";
-
-static int __init mini2440_features_setup(char *str)
-{
-       if (str)
-               strlcpy(mini2440_features_str, str,
-                       sizeof(mini2440_features_str));
-       return 1;
-}
-
-__setup("mini2440=", mini2440_features_setup);
-
-#define FEATURE_SCREEN (1 << 0)
-#define FEATURE_BACKLIGHT (1 << 1)
-#define FEATURE_TOUCH (1 << 2)
-#define FEATURE_CAMERA (1 << 3)
-
-struct mini2440_features_t {
-       int count;
-       int done;
-       int lcd_index;
-       struct platform_device *optional[8];
-};
-
-static void __init mini2440_parse_features(
-               struct mini2440_features_t *features,
-               const char *features_str)
-{
-       const char *fp = features_str;
-
-       features->count = 0;
-       features->done = 0;
-       features->lcd_index = -1;
-
-       while (*fp) {
-               char f = *fp++;
-
-               switch (f) {
-               case '0'...'9': /* tft screen */
-                       if (features->done & FEATURE_SCREEN) {
-                               pr_info("MINI2440: '%c' ignored, screen type already set\n",
-                                       f);
-                       } else {
-                               int li = f - '0';
-
-                               if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
-                                       pr_info("MINI2440: '%c' out of range LCD mode\n",
-                                               f);
-                               else {
-                                       features->optional[features->count++] =
-                                                       &s3c_device_lcd;
-                                       features->lcd_index = li;
-                               }
-                       }
-                       features->done |= FEATURE_SCREEN;
-                       break;
-               case 'b':
-                       if (features->done & FEATURE_BACKLIGHT)
-                               pr_info("MINI2440: '%c' ignored, backlight already set\n",
-                                       f);
-                       else {
-                               features->optional[features->count++] =
-                                               &mini2440_led_backlight;
-                       }
-                       features->done |= FEATURE_BACKLIGHT;
-                       break;
-               case 't':
-                       pr_info("MINI2440: '%c' ignored, touchscreen not compiled in\n",
-                               f);
-                       break;
-               case 'c':
-                       if (features->done & FEATURE_CAMERA)
-                               pr_info("MINI2440: '%c' ignored, camera already registered\n",
-                                       f);
-                       else
-                               features->optional[features->count++] =
-                                       &s3c_device_camif;
-                       features->done |= FEATURE_CAMERA;
-                       break;
-               }
-       }
-}
-
-static void __init mini2440_init(void)
-{
-       struct mini2440_features_t features = { 0 };
-       int i;
-
-       pr_info("MINI2440: Option string mini2440=%s\n",
-                       mini2440_features_str);
-
-       /* Parse the feature string */
-       mini2440_parse_features(&features, mini2440_features_str);
-
-       /* turn LCD on */
-       s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
-
-       /* Turn the backlight early on */
-       WARN_ON(gpio_request_one(S3C2410_GPG(4), GPIOF_OUT_INIT_HIGH, NULL));
-       gpio_free(S3C2410_GPG(4));
-
-       /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
-       gpio_request_one(S3C2410_GPB(1), GPIOF_IN, NULL);
-       s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
-       gpio_free(S3C2410_GPB(1));
-
-       /* mark the key as input, without pullups (there is one on the board) */
-       for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
-               s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
-               s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT);
-       }
-       if (features.lcd_index != -1) {
-               int li;
-
-               mini2440_fb_info.displays =
-                       &mini2440_lcd_cfg[features.lcd_index];
-
-               pr_info("MINI2440: LCD");
-               for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
-                       if (li == features.lcd_index)
-                               pr_cont(" [%d:%dx%d]", li,
-                                       mini2440_lcd_cfg[li].width,
-                                       mini2440_lcd_cfg[li].height);
-                       else
-                               pr_cont(" %d:%dx%d", li,
-                                       mini2440_lcd_cfg[li].width,
-                                       mini2440_lcd_cfg[li].height);
-               pr_cont("\n");
-               s3c24xx_fb_set_platdata(&mini2440_fb_info);
-       }
-
-       s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
-       gpiod_add_lookup_table(&mini2440_mmc_gpio_table);
-       s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
-       s3c_nand_set_platdata(&mini2440_nand_info);
-       s3c_i2c0_set_platdata(NULL);
-
-       i2c_register_board_info(0, mini2440_i2c_devs,
-                               ARRAY_SIZE(mini2440_i2c_devs));
-
-       /* Disable pull-up on the LED lines */
-       s3c_gpio_setpull(S3C2410_GPB(5), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPB(6), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPB(7), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPB(8), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPG(4), S3C_GPIO_PULL_NONE);
-
-       /* Add lookups for the lines */
-       gpiod_add_lookup_table(&mini2440_led1_gpio_table);
-       gpiod_add_lookup_table(&mini2440_led2_gpio_table);
-       gpiod_add_lookup_table(&mini2440_led3_gpio_table);
-       gpiod_add_lookup_table(&mini2440_led4_gpio_table);
-       gpiod_add_lookup_table(&mini2440_backlight_gpio_table);
-
-       platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
-
-       if (features.count)     /* the optional features */
-               platform_add_devices(features.optional, features.count);
-
-}
-
-
-MACHINE_START(MINI2440, "MINI2440")
-       /* Maintainer: Michel Pollet <buserror@gmail.com> */
-       .atag_offset    = 0x100,
-       .map_io         = mini2440_map_io,
-       .init_machine   = mini2440_init,
-       .init_irq       = s3c2440_init_irq,
-       .init_time      = mini2440_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
deleted file mode 100644 (file)
index 998ccff..0000000
+++ /dev/null
@@ -1,662 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
-// Yakumo AlphaX and Airis NC05 PDAs.
-//
-// Copyright (c) 2003-2005 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
-//
-// There is a wiki with more information about the n30 port at
-// https://handhelds.org/moin/moin.cgi/AcerN30Documentation .
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-
-#include <linux/gpio_keys.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/timer.h>
-#include <linux/io.h>
-#include <linux/mmc/host.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/fb.h>
-#include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/irq.h>
-#include <asm/mach/map.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <linux/platform_data/mmc-s3cmci.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-static struct map_desc n30_iodesc[] __initdata = {
-       /* nothing here yet */
-};
-
-static struct s3c2410_uartcfg n30_uartcfgs[] = {
-       /* Normal serial port */
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x2c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       /* IR port */
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .uart_flags  = UPF_CONS_FLOW,
-               .ucon        = 0x2c5,
-               .ulcon       = 0x43,
-               .ufcon       = 0x51,
-       },
-       /* On the N30 the bluetooth controller is connected here.
-        * On the N35 and variants the GPS receiver is connected here. */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = 0x2c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-};
-
-static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
-       .vbus_pin               = S3C2410_GPG(1),
-       .vbus_pin_inverted      = 0,
-       .pullup_pin             = S3C2410_GPB(3),
-};
-
-static struct gpio_keys_button n30_buttons[] = {
-       {
-               .gpio           = S3C2410_GPF(0),
-               .code           = KEY_POWER,
-               .desc           = "Power",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(9),
-               .code           = KEY_UP,
-               .desc           = "Thumbwheel Up",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(8),
-               .code           = KEY_DOWN,
-               .desc           = "Thumbwheel Down",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(7),
-               .code           = KEY_ENTER,
-               .desc           = "Thumbwheel Press",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(7),
-               .code           = KEY_HOMEPAGE,
-               .desc           = "Home",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(6),
-               .code           = KEY_CALENDAR,
-               .desc           = "Calendar",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(5),
-               .code           = KEY_ADDRESSBOOK,
-               .desc           = "Contacts",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(4),
-               .code           = KEY_MAIL,
-               .desc           = "Mail",
-               .active_low     = 0,
-       },
-};
-
-static struct gpio_keys_platform_data n30_button_data = {
-       .buttons        = n30_buttons,
-       .nbuttons       = ARRAY_SIZE(n30_buttons),
-};
-
-static struct platform_device n30_button_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = &n30_button_data,
-       }
-};
-
-static struct gpio_keys_button n35_buttons[] = {
-       {
-               .gpio           = S3C2410_GPF(0),
-               .code           = KEY_POWER,
-               .type           = EV_PWR,
-               .desc           = "Power",
-               .active_low     = 0,
-               .wakeup         = 1,
-       },
-       {
-               .gpio           = S3C2410_GPG(9),
-               .code           = KEY_UP,
-               .desc           = "Joystick Up",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(8),
-               .code           = KEY_DOWN,
-               .desc           = "Joystick Down",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(6),
-               .code           = KEY_DOWN,
-               .desc           = "Joystick Left",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(5),
-               .code           = KEY_DOWN,
-               .desc           = "Joystick Right",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(7),
-               .code           = KEY_ENTER,
-               .desc           = "Joystick Press",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(7),
-               .code           = KEY_HOMEPAGE,
-               .desc           = "Home",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(6),
-               .code           = KEY_CALENDAR,
-               .desc           = "Calendar",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(5),
-               .code           = KEY_ADDRESSBOOK,
-               .desc           = "Contacts",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(4),
-               .code           = KEY_MAIL,
-               .desc           = "Mail",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPF(3),
-               .code           = SW_RADIO,
-               .desc           = "GPS Antenna",
-               .active_low     = 0,
-       },
-       {
-               .gpio           = S3C2410_GPG(2),
-               .code           = SW_HEADPHONE_INSERT,
-               .desc           = "Headphone",
-               .active_low     = 0,
-       },
-};
-
-static struct gpio_keys_platform_data n35_button_data = {
-       .buttons        = n35_buttons,
-       .nbuttons       = ARRAY_SIZE(n35_buttons),
-};
-
-static struct platform_device n35_button_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .num_resources  = 0,
-       .dev            = {
-               .platform_data  = &n35_button_data,
-       }
-};
-
-/* This is the bluetooth LED on the device. */
-
-static struct gpiod_lookup_table n30_blue_led_gpio_table = {
-       .dev_id = "s3c24xx_led.1",
-       .table = {
-               GPIO_LOOKUP("GPG", 6, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata n30_blue_led_pdata = {
-       .name           = "blue_led",
-       .def_trigger    = "",
-};
-
-/* This is the blue LED on the device. Originally used to indicate GPS activity
- * by flashing. */
-
-static struct gpiod_lookup_table n35_blue_led_gpio_table = {
-       .dev_id = "s3c24xx_led.1",
-       .table = {
-               GPIO_LOOKUP("GPD", 8, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata n35_blue_led_pdata = {
-       .name           = "blue_led",
-       .def_trigger    = "",
-};
-
-/* This LED is driven by the battery microcontroller, and is blinking
- * red, blinking green or solid green when the battery is low,
- * charging or full respectively.  By driving GPD9 low, it's possible
- * to force the LED to blink red, so call that warning LED.  */
-
-static struct gpiod_lookup_table n30_warning_led_gpio_table = {
-       .dev_id = "s3c24xx_led.2",
-       .table = {
-               GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata n30_warning_led_pdata = {
-       .name           = "warning_led",
-       .def_trigger    = "",
-};
-
-static struct gpiod_lookup_table n35_warning_led_gpio_table = {
-       .dev_id = "s3c24xx_led.2",
-       .table = {
-               GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata n35_warning_led_pdata = {
-       .name           = "warning_led",
-       .def_trigger    = "",
-};
-
-static struct platform_device n30_blue_led = {
-       .name           = "s3c24xx_led",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &n30_blue_led_pdata,
-       },
-};
-
-static struct platform_device n35_blue_led = {
-       .name           = "s3c24xx_led",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &n35_blue_led_pdata,
-       },
-};
-
-static struct platform_device n30_warning_led = {
-       .name           = "s3c24xx_led",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &n30_warning_led_pdata,
-       },
-};
-
-static struct platform_device n35_warning_led = {
-       .name           = "s3c24xx_led",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &n35_warning_led_pdata,
-       },
-};
-
-static struct s3c2410fb_display n30_display __initdata = {
-       .type           = S3C2410_LCDCON1_TFT,
-       .width          = 240,
-       .height         = 320,
-       .pixclock       = 170000,
-
-       .xres           = 240,
-       .yres           = 320,
-       .bpp            = 16,
-       .left_margin    = 3,
-       .right_margin   = 40,
-       .hsync_len      = 40,
-       .upper_margin   = 2,
-       .lower_margin   = 3,
-       .vsync_len      = 2,
-
-       .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
-};
-
-static struct s3c2410fb_mach_info n30_fb_info __initdata = {
-       .displays       = &n30_display,
-       .num_displays   = 1,
-       .default_display = 0,
-       .lpcsel         = 0x06,
-};
-
-static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
-{
-       switch (power_mode) {
-       case MMC_POWER_ON:
-       case MMC_POWER_UP:
-               gpio_set_value(S3C2410_GPG(4), 1);
-               break;
-       case MMC_POWER_OFF:
-       default:
-               gpio_set_value(S3C2410_GPG(4), 0);
-               break;
-       }
-}
-
-static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = {
-       .ocr_avail      = MMC_VDD_32_33,
-       .set_power      = n30_sdi_set_power,
-};
-
-static struct gpiod_lookup_table n30_mci_gpio_table = {
-       .dev_id = "s3c2410-sdi",
-       .table = {
-               /* Card detect S3C2410_GPF(1) */
-               GPIO_LOOKUP("GPF", 1, "cd", GPIO_ACTIVE_LOW),
-               /* Write protect S3C2410_GPG(10) */
-               GPIO_LOOKUP("GPG", 10, "wp", GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct platform_device *n30_devices[] __initdata = {
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_ohci,
-       &s3c_device_rtc,
-       &s3c_device_usbgadget,
-       &s3c_device_sdi,
-       &n30_button_device,
-       &n30_blue_led,
-       &n30_warning_led,
-};
-
-static struct platform_device *n35_devices[] __initdata = {
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_rtc,
-       &s3c_device_usbgadget,
-       &s3c_device_sdi,
-       &n35_button_device,
-       &n35_blue_led,
-       &n35_warning_led,
-};
-
-static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
-       .flags          = 0,
-       .slave_addr     = 0x10,
-       .frequency      = 10*1000,
-};
-
-/* Lots of hardcoded stuff, but it sets up the hardware in a useful
- * state so that we can boot Linux directly from flash. */
-static void __init n30_hwinit(void)
-{
-       /* GPA0-11 special functions -- unknown what they do
-        * GPA12 N30 special function -- unknown what it does
-        *       N35/PiN output -- unknown what it does
-        *
-        * A12 is nGCS1 on the N30 and an output on the N35/PiN.  I
-        * don't think it does anything useful on the N30, so I ought
-        * to make it an output there too since it always driven to 0
-        * as far as I can tell. */
-       if (machine_is_n30())
-               __raw_writel(0x007fffff, S3C2410_GPACON);
-       if (machine_is_n35())
-               __raw_writel(0x007fefff, S3C2410_GPACON);
-       __raw_writel(0x00000000, S3C2410_GPADAT);
-
-       /* GPB0 TOUT0 backlight level
-        * GPB1 output 1=backlight on
-        * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
-        * GPB3 output USB D+ pull up 0=disabled, 1=enabled
-        * GPB4 N30 output -- unknown function
-        *      N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
-        * GPB5 output -- unknown function
-        * GPB6 input -- unknown function
-        * GPB7 output -- unknown function
-        * GPB8 output -- probably LCD driver enable
-        * GPB9 output -- probably LCD VSYNC driver enable
-        * GPB10 output -- probably LCD HSYNC driver enable
-        */
-       __raw_writel(0x00154556, S3C2410_GPBCON);
-       __raw_writel(0x00000750, S3C2410_GPBDAT);
-       __raw_writel(0x00000073, S3C2410_GPBUP);
-
-       /* GPC0 input RS232 DCD/DSR/RI
-        * GPC1 LCD
-        * GPC2 output RS232 DTR?
-        * GPC3 input RS232 DCD/DSR/RI
-        * GPC4 LCD
-        * GPC5 output 0=NAND write enabled, 1=NAND write protect
-        * GPC6 input -- unknown function
-        * GPC7 input charger status 0=charger connected
-        *      this input can be triggered by power on the USB device
-        *      port too, but will go back to disconnected soon after.
-        * GPC8 N30/N35 output -- unknown function, always driven to 1
-        *      PiN input -- unknown function, always read as 1
-        *      Make it an input with a pull up for all models.
-        * GPC9-15 LCD
-        */
-       __raw_writel(0xaaa80618, S3C2410_GPCCON);
-       __raw_writel(0x0000014c, S3C2410_GPCDAT);
-       __raw_writel(0x0000fef2, S3C2410_GPCUP);
-
-       /* GPD0 input -- unknown function
-        * GPD1-D7 LCD
-        * GPD8 N30 output -- unknown function
-        *      N35/PiN output 1=GPS LED on
-        * GPD9 output 0=power led blinks red, 1=normal power led function
-        * GPD10 output -- unknown function
-        * GPD11-15 LCD drivers
-        */
-       __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
-       __raw_writel(0x00000601, S3C2410_GPDDAT);
-       __raw_writel(0x0000fbfe, S3C2410_GPDUP);
-
-       /* GPE0-4 I2S audio bus
-        * GPE5-10 SD/MMC bus
-        * E11-13 outputs -- unknown function, probably power management
-        * E14-15 I2C bus connected to the battery controller
-        */
-       __raw_writel(0xa56aaaaa, S3C2410_GPECON);
-       __raw_writel(0x0000efc5, S3C2410_GPEDAT);
-       __raw_writel(0x0000f81f, S3C2410_GPEUP);
-
-       /* GPF0  input 0=power button pressed
-        * GPF1  input SD/MMC switch 0=card present
-        * GPF2  N30 1=reset button pressed (inverted compared to the rest)
-        *       N35/PiN 0=reset button pressed
-        * GPF3  N30/PiN input -- unknown function
-        *       N35 input GPS antenna position, 0=antenna closed, 1=open
-        * GPF4  input 0=button 4 pressed
-        * GPF5  input 0=button 3 pressed
-        * GPF6  input 0=button 2 pressed
-        * GPF7  input 0=button 1 pressed
-        */
-       __raw_writel(0x0000aaaa, S3C2410_GPFCON);
-       __raw_writel(0x00000000, S3C2410_GPFDAT);
-       __raw_writel(0x000000ff, S3C2410_GPFUP);
-
-       /* GPG0  input RS232 DCD/DSR/RI
-        * GPG1  input 1=USB gadget port has power from a host
-        * GPG2  N30 input -- unknown function
-        *       N35/PiN input 0=headphones plugged in, 1=not plugged in
-        * GPG3  N30 output -- unknown function
-        *       N35/PiN input with unknown function
-        * GPG4  N30 output 0=MMC enabled, 1=MMC disabled
-        * GPG5  N30 output 0=BlueTooth chip disabled, 1=enabled
-        *       N35/PiN input joystick right
-        * GPG6  N30 output 0=blue led on, 1=off
-        *       N35/PiN input joystick left
-        * GPG7  input 0=thumbwheel pressed
-        * GPG8  input 0=thumbwheel down
-        * GPG9  input 0=thumbwheel up
-        * GPG10 input SD/MMC write protect switch
-        * GPG11 N30 input -- unknown function
-        *       N35 output 0=GPS antenna powered, 1=not powered
-        *       PiN output -- unknown function
-        * GPG12-15 touch screen functions
-        *
-        * The pullups differ between the models, so enable all
-        * pullups that are enabled on any of the models.
-        */
-       if (machine_is_n30())
-               __raw_writel(0xff0a956a, S3C2410_GPGCON);
-       if (machine_is_n35())
-               __raw_writel(0xff4aa92a, S3C2410_GPGCON);
-       __raw_writel(0x0000e800, S3C2410_GPGDAT);
-       __raw_writel(0x0000f86f, S3C2410_GPGUP);
-
-       /* GPH0/1/2/3 RS232 serial port
-        * GPH4/5 IrDA serial port
-        * GPH6/7  N30 BlueTooth serial port
-        *         N35/PiN GPS receiver
-        * GPH8 input -- unknown function
-        * GPH9 CLKOUT0 HCLK -- unknown use
-        * GPH10 CLKOUT1 FCLK -- unknown use
-        *
-        * The pull ups for H6/H7 are enabled on N30 but not on the
-        * N35/PiN.  I suppose is useful for a budget model of the N30
-        * with no bluetooth.  It doesn't hurt to have the pull ups
-        * enabled on the N35, so leave them enabled for all models.
-        */
-       __raw_writel(0x0028aaaa, S3C2410_GPHCON);
-       __raw_writel(0x000005ef, S3C2410_GPHDAT);
-       __raw_writel(0x0000063f, S3C2410_GPHUP);
-}
-
-static void __init n30_map_io(void)
-{
-       s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
-       n30_hwinit();
-       s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init n30_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-/* GPB3 is the line that controls the pull-up for the USB D+ line */
-
-static void __init n30_init(void)
-{
-       WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
-
-       s3c24xx_fb_set_platdata(&n30_fb_info);
-       s3c24xx_udc_set_platdata(&n30_udc_cfg);
-       gpiod_add_lookup_table(&n30_mci_gpio_table);
-       s3c24xx_mci_set_platdata(&n30_mci_cfg);
-       s3c_i2c0_set_platdata(&n30_i2ccfg);
-
-       /* Turn off suspend on both USB ports, and switch the
-        * selectable USB port to USB device mode. */
-
-       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                             S3C2410_MISCCR_USBSUSPND0 |
-                             S3C2410_MISCCR_USBSUSPND1, 0x0);
-
-       if (machine_is_n30()) {
-               /* Turn off suspend on both USB ports, and switch the
-                * selectable USB port to USB device mode. */
-               s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                                     S3C2410_MISCCR_USBSUSPND0 |
-                                     S3C2410_MISCCR_USBSUSPND1, 0x0);
-
-               /* Disable pull-up and add GPIO tables */
-               s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
-               s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
-               gpiod_add_lookup_table(&n30_blue_led_gpio_table);
-               gpiod_add_lookup_table(&n30_warning_led_gpio_table);
-
-               platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
-       }
-
-       if (machine_is_n35()) {
-               /* Turn off suspend and switch the selectable USB port
-                * to USB device mode.  Turn on suspend for the host
-                * port since it is not connected on the N35.
-                *
-                * Actually, the host port is available at some pads
-                * on the back of the device, so it would actually be
-                * possible to add a USB device inside the N35 if you
-                * are willing to do some hardware modifications. */
-               s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                                     S3C2410_MISCCR_USBSUSPND0 |
-                                     S3C2410_MISCCR_USBSUSPND1,
-                                     S3C2410_MISCCR_USBSUSPND0);
-
-               /* Disable pull-up and add GPIO tables */
-               s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
-               s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
-               gpiod_add_lookup_table(&n35_blue_led_gpio_table);
-               gpiod_add_lookup_table(&n35_warning_led_gpio_table);
-
-               platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
-       }
-}
-
-MACHINE_START(N30, "Acer-N30")
-       /* Maintainer: Christer Weinigel <christer@weinigel.se>,
-                               Ben Dooks <ben-linux@fluff.org>
-       */
-       .atag_offset    = 0x100,
-       .init_time      = n30_init_time,
-       .init_machine   = n30_init,
-       .init_irq       = s3c2410_init_irq,
-       .map_io         = n30_map_io,
-MACHINE_END
-
-MACHINE_START(N35, "Acer-N35")
-       /* Maintainer: Christer Weinigel <christer@weinigel.se>
-       */
-       .atag_offset    = 0x100,
-       .init_time      = n30_init_time,
-       .init_machine   = n30_init,
-       .init_irq       = s3c2410_init_irq,
-       .map_io         = n30_map_io,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
deleted file mode 100644 (file)
index c2f3475..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// linux/arch/arm/mach-s3c2440/mach-nexcoder.c
-//
-// Copyright (c) 2004 Nex Vision
-//   Guillaume GOURAT <guillaume.gourat@nexvision.tv>
-//
-// Modifications:
-//     15-10-2004 GG  Created initial version
-//     12-03-2005 BJD Updated for release
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/string.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <linux/mtd/map.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <asm/setup.h>
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-//#include <asm/debug-ll.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-static struct map_desc nexcoder_iodesc[] __initdata = {
-       /* nothing here yet */
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg nexcoder_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-/* NOR Flash on NexVision NexCoder 2440 board */
-
-static struct resource nexcoder_nor_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_8M),
-};
-
-static struct map_info nexcoder_nor_map = {
-       .bankwidth = 2,
-};
-
-static struct platform_device nexcoder_device_nor = {
-       .name           = "mtd-flash",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(nexcoder_nor_resource),
-       .resource       = nexcoder_nor_resource,
-       .dev =
-       {
-               .platform_data = &nexcoder_nor_map,
-       }
-};
-
-/* Standard Nexcoder devices */
-
-static struct platform_device *nexcoder_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_rtc,
-       &s3c_device_camif,
-       &s3c_device_spi0,
-       &s3c_device_spi1,
-       &nexcoder_device_nor,
-};
-
-static void __init nexcoder_sensorboard_init(void)
-{
-       /* Initialize SCCB bus */
-       gpio_request_one(S3C2410_GPE(14), GPIOF_OUT_INIT_HIGH, NULL);
-       gpio_free(S3C2410_GPE(14)); /* IICSCL */
-       gpio_request_one(S3C2410_GPE(15), GPIOF_OUT_INIT_HIGH, NULL);
-       gpio_free(S3C2410_GPE(15)); /* IICSDA */
-
-       /* Power up the sensor board */
-       gpio_request_one(S3C2410_GPF(1), GPIOF_OUT_INIT_HIGH, NULL);
-       gpio_free(S3C2410_GPF(1)); /* CAM_GPIO7 => nLDO_PWRDN */
-       gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL);
-       gpio_free(S3C2410_GPF(2)); /* CAM_GPIO6 => CAM_PWRDN */
-}
-
-static void __init nexcoder_map_io(void)
-{
-       s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
-       s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       nexcoder_sensorboard_init();
-}
-
-static void __init nexcoder_init_time(void)
-{
-       s3c2440_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init nexcoder_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices));
-};
-
-MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
-       /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
-       .atag_offset    = 0x100,
-       .map_io         = nexcoder_map_io,
-       .init_machine   = nexcoder_init,
-       .init_irq       = s3c2440_init_irq,
-       .init_time      = nexcoder_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
deleted file mode 100644 (file)
index 5d819b6..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2009 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Simtec Osiris Dynamic Voltage Scaling support.
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/cpufreq.h>
-#include <linux/gpio.h>
-
-#include <linux/mfd/tps65010.h>
-
-#include <plat/cpu-freq.h>
-#include <mach/gpio-samsung.h>
-
-#define OSIRIS_GPIO_DVS        S3C2410_GPB(5)
-
-static bool dvs_en;
-
-static void osiris_dvs_tps_setdvs(bool on)
-{
-       unsigned vregs1 = 0, vdcdc2 = 0;
-
-       if (!on) {
-               vdcdc2 = TPS_VCORE_DISCH | TPS_LP_COREOFF;
-               vregs1 = TPS_LDO1_OFF;  /* turn off in low-power mode */
-       }
-
-       dvs_en = on;
-       vdcdc2 |= TPS_VCORE_1_3V | TPS_VCORE_LP_1_0V;
-       vregs1 |= TPS_LDO2_ENABLE | TPS_LDO1_ENABLE;
-
-       tps65010_config_vregs1(vregs1);
-       tps65010_config_vdcdc2(vdcdc2);
-}
-
-static bool is_dvs(struct s3c_freq *f)
-{
-       /* at the moment, we assume ARMCLK = HCLK => DVS */
-       return f->armclk == f->hclk;
-}
-
-/* keep track of current state */
-static bool cur_dvs = false;
-
-static int osiris_dvs_notify(struct notifier_block *nb,
-                             unsigned long val, void *data)
-{
-       struct cpufreq_freqs *cf = data;
-       struct s3c_cpufreq_freqs *freqs = to_s3c_cpufreq(cf);
-       bool old_dvs = is_dvs(&freqs->old);
-       bool new_dvs = is_dvs(&freqs->new);
-       int ret = 0;
-
-       if (!dvs_en)
-               return 0;
-
-       printk(KERN_DEBUG "%s: old %ld,%ld new %ld,%ld\n", __func__,
-              freqs->old.armclk, freqs->old.hclk,
-              freqs->new.armclk, freqs->new.hclk);
-
-       switch (val) {
-       case CPUFREQ_PRECHANGE:
-               if ((old_dvs && !new_dvs) ||
-                   (cur_dvs && !new_dvs)) {
-                       pr_debug("%s: exiting dvs\n", __func__);
-                       cur_dvs = false;
-                       gpio_set_value(OSIRIS_GPIO_DVS, 1);
-               }
-               break;
-       case CPUFREQ_POSTCHANGE:
-               if ((!old_dvs && new_dvs) ||
-                   (!cur_dvs && new_dvs)) {
-                       pr_debug("entering dvs\n");
-                       cur_dvs = true;
-                       gpio_set_value(OSIRIS_GPIO_DVS, 0);
-               }
-               break;
-       }
-
-       return ret;
-}
-
-static struct notifier_block osiris_dvs_nb = {
-       .notifier_call  = osiris_dvs_notify,
-};
-
-static int osiris_dvs_probe(struct platform_device *pdev)
-{
-       int ret;
-
-       dev_info(&pdev->dev, "initialising\n");
-
-       ret = gpio_request(OSIRIS_GPIO_DVS, "osiris-dvs");
-       if (ret) {
-               dev_err(&pdev->dev, "cannot claim gpio\n");
-               goto err_nogpio;
-       }
-
-       /* start with dvs disabled */
-       gpio_direction_output(OSIRIS_GPIO_DVS, 1);
-
-       ret = cpufreq_register_notifier(&osiris_dvs_nb,
-                                       CPUFREQ_TRANSITION_NOTIFIER);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to register with cpufreq\n");
-               goto err_nofreq;
-       }
-
-       osiris_dvs_tps_setdvs(true);
-
-       return 0;
-
-err_nofreq:
-       gpio_free(OSIRIS_GPIO_DVS);
-
-err_nogpio:
-       return ret;
-}
-
-static int osiris_dvs_remove(struct platform_device *pdev)
-{
-       dev_info(&pdev->dev, "exiting\n");
-
-       /* disable any current dvs */
-       gpio_set_value(OSIRIS_GPIO_DVS, 1);
-       osiris_dvs_tps_setdvs(false);
-
-       cpufreq_unregister_notifier(&osiris_dvs_nb,
-                                   CPUFREQ_TRANSITION_NOTIFIER);
-
-       gpio_free(OSIRIS_GPIO_DVS);
-
-       return 0;
-}
-
-/* the CONFIG_PM block is so small, it isn't worth actually compiling it
- * out if the configuration isn't set. */
-
-static int osiris_dvs_suspend(struct device *dev)
-{
-       gpio_set_value(OSIRIS_GPIO_DVS, 1);
-       osiris_dvs_tps_setdvs(false);
-       cur_dvs = false;
-
-       return 0;
-}
-
-static int osiris_dvs_resume(struct device *dev)
-{
-       osiris_dvs_tps_setdvs(true);
-       return 0;
-}
-
-static const struct dev_pm_ops osiris_dvs_pm = {
-       .suspend        = osiris_dvs_suspend,
-       .resume         = osiris_dvs_resume,
-};
-
-static struct platform_driver osiris_dvs_driver = {
-       .probe          = osiris_dvs_probe,
-       .remove         = osiris_dvs_remove,
-       .driver         = {
-               .name   = "osiris-dvs",
-               .pm     = &osiris_dvs_pm,
-       },
-};
-
-module_platform_driver(osiris_dvs_driver);
-
-MODULE_DESCRIPTION("Simtec OSIRIS DVS support");
-MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:osiris-dvs");
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
deleted file mode 100644 (file)
index ee3630c..0000000
+++ /dev/null
@@ -1,412 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2005-2008 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/clk.h>
-#include <linux/i2c.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-
-#include <linux/mfd/tps65010.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-#include <asm/irq.h>
-
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include "common.h"
-#include "osiris.h"
-#include "regs-mem.h"
-
-/* onboard perihperal map */
-
-static struct map_desc osiris_iodesc[] __initdata = {
-  /* ISA IO areas (may be over-written later) */
-
-  {
-         .virtual      = (u32)S3C24XX_VA_ISA_BYTE,
-         .pfn          = __phys_to_pfn(S3C2410_CS5),
-         .length       = SZ_16M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)S3C24XX_VA_ISA_WORD,
-         .pfn          = __phys_to_pfn(S3C2410_CS5),
-         .length       = SZ_16M,
-         .type         = MT_DEVICE,
-  },
-
-  /* CPLD control registers */
-
-  {
-         .virtual      = (u32)OSIRIS_VA_CTRL0,
-         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL0),
-         .length       = SZ_16K,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)OSIRIS_VA_CTRL1,
-         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL1),
-         .length       = SZ_16K,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)OSIRIS_VA_CTRL2,
-         .pfn          = __phys_to_pfn(OSIRIS_PA_CTRL2),
-         .length       = SZ_16K,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)OSIRIS_VA_IDREG,
-         .pfn          = __phys_to_pfn(OSIRIS_PA_IDREG),
-         .length       = SZ_16K,
-         .type         = MT_DEVICE,
-  },
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg osiris_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-               .clk_sel        = S3C2410_UCON_CLKSEL1 | S3C2410_UCON_CLKSEL2,
-       }
-};
-
-/* NAND Flash on Osiris board */
-
-static int external_map[]   = { 2 };
-static int chip0_map[]      = { 0 };
-static int chip1_map[]      = { 1 };
-
-static struct mtd_partition __initdata osiris_default_nand_part[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_16K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "/boot",
-               .size   = SZ_4M - SZ_16K,
-               .offset = SZ_16K,
-       },
-       [2] = {
-               .name   = "user1",
-               .offset = SZ_4M,
-               .size   = SZ_32M - SZ_4M,
-       },
-       [3] = {
-               .name   = "user2",
-               .offset = SZ_32M,
-               .size   = MTDPART_SIZ_FULL,
-       }
-};
-
-static struct mtd_partition __initdata osiris_default_nand_part_large[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = SZ_128K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "/boot",
-               .size   = SZ_4M - SZ_128K,
-               .offset = SZ_128K,
-       },
-       [2] = {
-               .name   = "user1",
-               .offset = SZ_4M,
-               .size   = SZ_32M - SZ_4M,
-       },
-       [3] = {
-               .name   = "user2",
-               .offset = SZ_32M,
-               .size   = MTDPART_SIZ_FULL,
-       }
-};
-
-/* the Osiris has 3 selectable slots for nand-flash, the two
- * on-board chip areas, as well as the external slot.
- *
- * Note, there is no current hot-plug support for the External
- * socket.
-*/
-
-static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
-       [1] = {
-               .name           = "External",
-               .nr_chips       = 1,
-               .nr_map         = external_map,
-               .options        = NAND_SCAN_SILENT_NODEV,
-               .nr_partitions  = ARRAY_SIZE(osiris_default_nand_part),
-               .partitions     = osiris_default_nand_part,
-       },
-       [0] = {
-               .name           = "chip0",
-               .nr_chips       = 1,
-               .nr_map         = chip0_map,
-               .nr_partitions  = ARRAY_SIZE(osiris_default_nand_part),
-               .partitions     = osiris_default_nand_part,
-       },
-       [2] = {
-               .name           = "chip1",
-               .nr_chips       = 1,
-               .nr_map         = chip1_map,
-               .options        = NAND_SCAN_SILENT_NODEV,
-               .nr_partitions  = ARRAY_SIZE(osiris_default_nand_part),
-               .partitions     = osiris_default_nand_part,
-       },
-};
-
-static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
-{
-       unsigned int tmp;
-
-       slot = set->nr_map[slot] & 3;
-
-       pr_debug("osiris_nand: selecting slot %d (set %p,%p)\n",
-                slot, set, set->nr_map);
-
-       tmp = __raw_readb(OSIRIS_VA_CTRL0);
-       tmp &= ~OSIRIS_CTRL0_NANDSEL;
-       tmp |= slot;
-
-       pr_debug("osiris_nand: ctrl0 now %02x\n", tmp);
-
-       __raw_writeb(tmp, OSIRIS_VA_CTRL0);
-}
-
-static struct s3c2410_platform_nand __initdata osiris_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 60,
-       .twrph1         = 60,
-       .nr_sets        = ARRAY_SIZE(osiris_nand_sets),
-       .sets           = osiris_nand_sets,
-       .select_chip    = osiris_nand_select,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-/* PCMCIA control and configuration */
-
-static struct resource osiris_pcmcia_resource[] = {
-       [0] = DEFINE_RES_MEM(0x0f000000, SZ_1M),
-       [1] = DEFINE_RES_MEM(0x0c000000, SZ_1M),
-};
-
-static struct platform_device osiris_pcmcia = {
-       .name           = "osiris-pcmcia",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(osiris_pcmcia_resource),
-       .resource       = osiris_pcmcia_resource,
-};
-
-/* Osiris power management device */
-
-#ifdef CONFIG_PM
-static unsigned char pm_osiris_ctrl0;
-
-static int osiris_pm_suspend(void)
-{
-       unsigned int tmp;
-
-       pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0);
-       tmp = pm_osiris_ctrl0 & ~OSIRIS_CTRL0_NANDSEL;
-
-       /* ensure correct NAND slot is selected on resume */
-       if ((pm_osiris_ctrl0 & OSIRIS_CTRL0_BOOT_INT) == 0)
-               tmp |= 2;
-
-       __raw_writeb(tmp, OSIRIS_VA_CTRL0);
-
-       /* ensure that an nRESET is not generated on resume. */
-       gpio_request_one(S3C2410_GPA(21), GPIOF_OUT_INIT_HIGH, NULL);
-       gpio_free(S3C2410_GPA(21));
-
-       return 0;
-}
-
-static void osiris_pm_resume(void)
-{
-       if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8)
-               __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1);
-
-       __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0);
-
-       s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT);
-}
-
-#else
-#define osiris_pm_suspend NULL
-#define osiris_pm_resume NULL
-#endif
-
-static struct syscore_ops osiris_pm_syscore_ops = {
-       .suspend        = osiris_pm_suspend,
-       .resume         = osiris_pm_resume,
-};
-
-/* Link for DVS driver to TPS65011 */
-
-static void osiris_tps_release(struct device *dev)
-{
-       /* static device, do not need to release anything */
-}
-
-static struct platform_device osiris_tps_device = {
-       .name   = "osiris-dvs",
-       .id     = -1,
-       .dev.release = osiris_tps_release,
-};
-
-static int osiris_tps_setup(struct i2c_client *client, void *context)
-{
-       osiris_tps_device.dev.parent = &client->dev;
-       return platform_device_register(&osiris_tps_device);
-}
-
-static int osiris_tps_remove(struct i2c_client *client, void *context)
-{
-       platform_device_unregister(&osiris_tps_device);
-       return 0;
-}
-
-static struct tps65010_board osiris_tps_board = {
-       .base           = -1,   /* GPIO can go anywhere at the moment */
-       .setup          = osiris_tps_setup,
-       .teardown       = osiris_tps_remove,
-};
-
-/* I2C devices fitted. */
-
-static struct i2c_board_info osiris_i2c_devs[] __initdata = {
-       {
-               I2C_BOARD_INFO("tps65011", 0x48),
-               .irq    = IRQ_EINT20,
-               .platform_data = &osiris_tps_board,
-       },
-};
-
-/* Standard Osiris devices */
-
-static struct platform_device *osiris_devices[] __initdata = {
-       &s3c2410_device_dclk,
-       &s3c_device_i2c0,
-       &s3c_device_wdt,
-       &s3c_device_nand,
-       &osiris_pcmcia,
-};
-
-static struct s3c_cpufreq_board __initdata osiris_cpufreq = {
-       .refresh        = 7800, /* refresh period is 7.8usec */
-       .auto_io        = 1,
-       .need_io        = 1,
-};
-
-static void __init osiris_map_io(void)
-{
-       unsigned long flags;
-
-       s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
-       s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* check for the newer revision boards with large page nand */
-
-       if ((__raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK) >= 4) {
-               printk(KERN_INFO "OSIRIS-B detected (revision %d)\n",
-                      __raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK);
-               osiris_nand_sets[0].partitions = osiris_default_nand_part_large;
-               osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large);
-       } else {
-               /* write-protect line to the NAND */
-               gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL);
-               gpio_free(S3C2410_GPA(0));
-       }
-
-       /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */
-
-       local_irq_save(flags);
-       __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON);
-       local_irq_restore(flags);
-}
-
-static void __init osiris_init_time(void)
-{
-       s3c2440_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init osiris_init(void)
-{
-       register_syscore_ops(&osiris_pm_syscore_ops);
-
-       s3c_i2c0_set_platdata(NULL);
-       s3c_nand_set_platdata(&osiris_nand_info);
-
-       s3c_cpufreq_setboard(&osiris_cpufreq);
-
-       i2c_register_board_info(0, osiris_i2c_devs,
-                               ARRAY_SIZE(osiris_i2c_devs));
-
-       platform_add_devices(osiris_devices, ARRAY_SIZE(osiris_devices));
-};
-
-MACHINE_START(OSIRIS, "Simtec-OSIRIS")
-       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
-       .atag_offset    = 0x100,
-       .map_io         = osiris_map_io,
-       .init_irq       = s3c2440_init_irq,
-       .init_machine   = osiris_init,
-       .init_time      = osiris_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
deleted file mode 100644 (file)
index 4e24d89..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2004 Nex Vision
-//   Guillaume GOURAT <guillaume.gourat@nexvision.fr>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "otom.h"
-
-static struct map_desc otom11_iodesc[] __initdata = {
-  /* Device area */
-       { (u32)OTOM_VA_CS8900A_BASE, OTOM_PA_CS8900A_BASE, SZ_16M, MT_DEVICE },
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg otom11_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       /* port 2 is not actually used */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-/* NOR Flash on NexVision OTOM board */
-
-static struct resource otom_nor_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_4M),
-};
-
-static struct platform_device otom_device_nor = {
-       .name           = "mtd-flash",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(otom_nor_resource),
-       .resource       = otom_nor_resource,
-};
-
-/* Standard OTOM devices */
-
-static struct platform_device *otom11_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_rtc,
-       &otom_device_nor,
-};
-
-static void __init otom11_map_io(void)
-{
-       s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
-       s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init otom11_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init otom11_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices));
-}
-
-MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
-       /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
-       .atag_offset    = 0x100,
-       .map_io         = otom11_map_io,
-       .init_machine   = otom11_init,
-       .init_irq       = s3c2410_init_irq,
-       .init_time      = otom11_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
deleted file mode 100644 (file)
index ff9e319..0000000
+++ /dev/null
@@ -1,359 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (C) 2006 by OpenMoko, Inc.
-// Author: Harald Welte <laforge@openmoko.org>
-// All rights reserved.
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/spi/spi.h>
-#include <linux/spi/spi_gpio.h>
-#include <linux/io.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/leds-s3c24xx.h>
-#include <mach/regs-lcd.h>
-#include <mach/fb.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "common-smdk.h"
-
-static struct map_desc qt2410_iodesc[] __initdata = {
-       { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-/* LCD driver info */
-
-static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
-       {
-               /* Configuration for 640x480 SHARP LQ080V3DG01 */
-               .lcdcon5 = S3C2410_LCDCON5_FRM565 |
-                          S3C2410_LCDCON5_INVVLINE |
-                          S3C2410_LCDCON5_INVVFRAME |
-                          S3C2410_LCDCON5_PWREN |
-                          S3C2410_LCDCON5_HWSWP,
-
-               .type           = S3C2410_LCDCON1_TFT,
-               .width          = 640,
-               .height         = 480,
-
-               .pixclock       = 40000, /* HCLK/4 */
-               .xres           = 640,
-               .yres           = 480,
-               .bpp            = 16,
-               .left_margin    = 44,
-               .right_margin   = 116,
-               .hsync_len      = 96,
-               .upper_margin   = 19,
-               .lower_margin   = 11,
-               .vsync_len      = 15,
-       },
-       {
-               /* Configuration for 480x640 toppoly TD028TTEC1 */
-               .lcdcon5 = S3C2410_LCDCON5_FRM565 |
-                          S3C2410_LCDCON5_INVVLINE |
-                          S3C2410_LCDCON5_INVVFRAME |
-                          S3C2410_LCDCON5_PWREN |
-                          S3C2410_LCDCON5_HWSWP,
-
-               .type           = S3C2410_LCDCON1_TFT,
-               .width          = 480,
-               .height         = 640,
-               .pixclock       = 40000, /* HCLK/4 */
-               .xres           = 480,
-               .yres           = 640,
-               .bpp            = 16,
-               .left_margin    = 8,
-               .right_margin   = 24,
-               .hsync_len      = 8,
-               .upper_margin   = 2,
-               .lower_margin   = 4,
-               .vsync_len      = 2,
-       },
-       {
-               /* Config for 240x320 LCD */
-               .lcdcon5 = S3C2410_LCDCON5_FRM565 |
-                          S3C2410_LCDCON5_INVVLINE |
-                          S3C2410_LCDCON5_INVVFRAME |
-                          S3C2410_LCDCON5_PWREN |
-                          S3C2410_LCDCON5_HWSWP,
-
-               .type           = S3C2410_LCDCON1_TFT,
-               .width          = 240,
-               .height         = 320,
-               .pixclock       = 100000, /* HCLK/10 */
-               .xres           = 240,
-               .yres           = 320,
-               .bpp            = 16,
-               .left_margin    = 13,
-               .right_margin   = 8,
-               .hsync_len      = 4,
-               .upper_margin   = 2,
-               .lower_margin   = 7,
-               .vsync_len      = 4,
-       },
-};
-
-
-static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
-       .displays       = qt2410_lcd_cfg,
-       .num_displays   = ARRAY_SIZE(qt2410_lcd_cfg),
-       .default_display = 0,
-
-       .lpcsel         = ((0xCE6) & ~7) | 1<<4,
-};
-
-/* CS8900 */
-
-static struct resource qt2410_cs89x0_resources[] = {
-       [0] = DEFINE_RES_MEM(0x19000000, 17),
-       [1] = DEFINE_RES_IRQ(IRQ_EINT9),
-};
-
-static struct platform_device qt2410_cs89x0 = {
-       .name           = "cirrus-cs89x0",
-       .num_resources  = ARRAY_SIZE(qt2410_cs89x0_resources),
-       .resource       = qt2410_cs89x0_resources,
-};
-
-/* LED */
-
-static struct gpiod_lookup_table qt2410_led_gpio_table = {
-       .dev_id = "s3c24xx_led.0",
-       .table = {
-               GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata qt2410_pdata_led = {
-       .name           = "led",
-       .def_trigger    = "timer",
-};
-
-static struct platform_device qt2410_led = {
-       .name           = "s3c24xx_led",
-       .id             = 0,
-       .dev            = {
-               .platform_data = &qt2410_pdata_led,
-       },
-};
-
-/* SPI */
-
-static struct spi_gpio_platform_data spi_gpio_cfg = {
-       .num_chipselect = 1,
-};
-
-static struct platform_device qt2410_spi = {
-       .name           = "spi_gpio",
-       .id             = 1,
-       .dev.platform_data = &spi_gpio_cfg,
-};
-
-static struct gpiod_lookup_table qt2410_spi_gpiod_table = {
-       .dev_id         = "spi_gpio",
-       .table          = {
-               GPIO_LOOKUP("GPIOG", 7,
-                           "sck", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOG", 6,
-                           "mosi", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOG", 5,
-                           "miso", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOB", 5,
-                           "cs", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-/* Board devices */
-
-static struct platform_device *qt2410_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_sdi,
-       &s3c_device_usbgadget,
-       &qt2410_spi,
-       &qt2410_cs89x0,
-       &qt2410_led,
-};
-
-static struct mtd_partition __initdata qt2410_nand_part[] = {
-       [0] = {
-               .name   = "U-Boot",
-               .size   = 0x30000,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "U-Boot environment",
-               .offset = 0x30000,
-               .size   = 0x4000,
-       },
-       [2] = {
-               .name   = "kernel",
-               .offset = 0x34000,
-               .size   = SZ_2M,
-       },
-       [3] = {
-               .name   = "initrd",
-               .offset = 0x234000,
-               .size   = SZ_4M,
-       },
-       [4] = {
-               .name   = "jffs2",
-               .offset = 0x634000,
-               .size   = 0x39cc000,
-       },
-};
-
-static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
-       [0] = {
-               .name           = "NAND",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(qt2410_nand_part),
-               .partitions     = qt2410_nand_part,
-       },
-};
-
-/* choose a set of timings which should suit most 512Mbit
- * chips and beyond.
- */
-
-static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
-       .tacls          = 20,
-       .twrph0         = 60,
-       .twrph1         = 20,
-       .nr_sets        = ARRAY_SIZE(qt2410_nand_sets),
-       .sets           = qt2410_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-/* UDC */
-
-static struct s3c2410_udc_mach_info qt2410_udc_cfg = {
-};
-
-static char tft_type = 's';
-
-static int __init qt2410_tft_setup(char *str)
-{
-       tft_type = str[0];
-       return 1;
-}
-
-__setup("tft=", qt2410_tft_setup);
-
-static void __init qt2410_map_io(void)
-{
-       s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
-       s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init qt2410_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init qt2410_machine_init(void)
-{
-       s3c_nand_set_platdata(&qt2410_nand_info);
-
-       switch (tft_type) {
-       case 'p': /* production */
-               qt2410_fb_info.default_display = 1;
-               break;
-       case 'b': /* big */
-               qt2410_fb_info.default_display = 0;
-               break;
-       case 's': /* small */
-       default:
-               qt2410_fb_info.default_display = 2;
-               break;
-       }
-       s3c24xx_fb_set_platdata(&qt2410_fb_info);
-
-       /* set initial state of the LED GPIO */
-       WARN_ON(gpio_request_one(S3C2410_GPB(0), GPIOF_OUT_INIT_HIGH, NULL));
-       gpio_free(S3C2410_GPB(0));
-
-       s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
-       s3c_i2c0_set_platdata(NULL);
-
-       gpiod_add_lookup_table(&qt2410_spi_gpiod_table);
-       s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
-       gpiod_add_lookup_table(&qt2410_led_gpio_table);
-       platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
-       s3c_pm_init();
-}
-
-MACHINE_START(QT2410, "QT2410")
-       .atag_offset    = 0x100,
-       .map_io         = qt2410_map_io,
-       .init_irq       = s3c2410_init_irq,
-       .init_machine   = qt2410_machine_init,
-       .init_time      = qt2410_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
deleted file mode 100644 (file)
index fde98b1..0000000
+++ /dev/null
@@ -1,837 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev,
-// Copyright (c) 2007-2010 Vasily Khoruzhick
-//
-// based on smdk2440 written by Ben Dooks
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/memblock.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/input.h>
-#include <linux/gpio_keys.h>
-#include <linux/device.h>
-#include <linux/pda_power.h>
-#include <linux/pwm_backlight.h>
-#include <linux/pwm.h>
-#include <linux/s3c_adc_battery.h>
-#include <linux/leds.h>
-#include <linux/i2c.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-
-#include <linux/mmc/host.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/mmc-s3cmci.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-
-#include <sound/uda1380.h>
-
-#include <mach/fb.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-#include <plat/gpio-cfg.h>
-
-#include "common.h"
-#include "h1940.h"
-
-#define LCD_PWM_PERIOD 192960
-#define LCD_PWM_DUTY 127353
-
-static struct map_desc rx1950_iodesc[] __initdata = {
-};
-
-static struct s3c2410_uartcfg rx1950_uartcfgs[] __initdata = {
-       [0] = {
-              .hwport = 0,
-              .flags = 0,
-              .ucon = 0x3c5,
-              .ulcon = 0x03,
-              .ufcon = 0x51,
-               .clk_sel = S3C2410_UCON_CLKSEL3,
-       },
-       [1] = {
-              .hwport = 1,
-              .flags = 0,
-              .ucon = 0x3c5,
-              .ulcon = 0x03,
-              .ufcon = 0x51,
-               .clk_sel = S3C2410_UCON_CLKSEL3,
-       },
-       /* IR port */
-       [2] = {
-              .hwport = 2,
-              .flags = 0,
-              .ucon = 0x3c5,
-              .ulcon = 0x43,
-              .ufcon = 0xf1,
-               .clk_sel = S3C2410_UCON_CLKSEL3,
-       },
-};
-
-static struct s3c2410fb_display rx1950_display = {
-       .type = S3C2410_LCDCON1_TFT,
-       .width = 240,
-       .height = 320,
-       .xres = 240,
-       .yres = 320,
-       .bpp = 16,
-
-       .pixclock = 260000,
-       .left_margin = 10,
-       .right_margin = 20,
-       .hsync_len = 10,
-       .upper_margin = 2,
-       .lower_margin = 2,
-       .vsync_len = 2,
-
-       .lcdcon5 = S3C2410_LCDCON5_FRM565 |
-                          S3C2410_LCDCON5_INVVCLK |
-                          S3C2410_LCDCON5_INVVLINE |
-                          S3C2410_LCDCON5_INVVFRAME |
-                          S3C2410_LCDCON5_HWSWP |
-                          (0x02 << 13) |
-                          (0x02 << 15),
-
-};
-
-static int power_supply_init(struct device *dev)
-{
-       return gpio_request(S3C2410_GPF(2), "cable plugged");
-}
-
-static int rx1950_is_ac_online(void)
-{
-       return !gpio_get_value(S3C2410_GPF(2));
-}
-
-static void power_supply_exit(struct device *dev)
-{
-       gpio_free(S3C2410_GPF(2));
-}
-
-static char *rx1950_supplicants[] = {
-       "main-battery"
-};
-
-static struct pda_power_pdata power_supply_info = {
-       .init                   = power_supply_init,
-       .is_ac_online           = rx1950_is_ac_online,
-       .exit                   = power_supply_exit,
-       .supplied_to            = rx1950_supplicants,
-       .num_supplicants        = ARRAY_SIZE(rx1950_supplicants),
-};
-
-static struct resource power_supply_resources[] = {
-       [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
-                       | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
-};
-
-static struct platform_device power_supply = {
-       .name                   = "pda-power",
-       .id                     = -1,
-       .dev                    = {
-                                       .platform_data =
-                                               &power_supply_info,
-       },
-       .resource               = power_supply_resources,
-       .num_resources          = ARRAY_SIZE(power_supply_resources),
-};
-
-static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
-       { .volt = 4100, .cur = 156, .level = 100},
-       { .volt = 4050, .cur = 156, .level = 95},
-       { .volt = 4025, .cur = 141, .level = 90},
-       { .volt = 3995, .cur = 144, .level = 85},
-       { .volt = 3957, .cur = 162, .level = 80},
-       { .volt = 3931, .cur = 147, .level = 75},
-       { .volt = 3902, .cur = 147, .level = 70},
-       { .volt = 3863, .cur = 153, .level = 65},
-       { .volt = 3838, .cur = 150, .level = 60},
-       { .volt = 3800, .cur = 153, .level = 55},
-       { .volt = 3765, .cur = 153, .level = 50},
-       { .volt = 3748, .cur = 172, .level = 45},
-       { .volt = 3740, .cur = 153, .level = 40},
-       { .volt = 3714, .cur = 175, .level = 35},
-       { .volt = 3710, .cur = 156, .level = 30},
-       { .volt = 3963, .cur = 156, .level = 25},
-       { .volt = 3672, .cur = 178, .level = 20},
-       { .volt = 3651, .cur = 178, .level = 15},
-       { .volt = 3629, .cur = 178, .level = 10},
-       { .volt = 3612, .cur = 162, .level = 5},
-       { .volt = 3605, .cur = 162, .level = 0},
-};
-
-static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
-       { .volt = 4200, .cur = 0, .level = 100},
-       { .volt = 4190, .cur = 0, .level = 99},
-       { .volt = 4178, .cur = 0, .level = 95},
-       { .volt = 4110, .cur = 0, .level = 70},
-       { .volt = 4076, .cur = 0, .level = 65},
-       { .volt = 4046, .cur = 0, .level = 60},
-       { .volt = 4021, .cur = 0, .level = 55},
-       { .volt = 3999, .cur = 0, .level = 50},
-       { .volt = 3982, .cur = 0, .level = 45},
-       { .volt = 3965, .cur = 0, .level = 40},
-       { .volt = 3957, .cur = 0, .level = 35},
-       { .volt = 3948, .cur = 0, .level = 30},
-       { .volt = 3936, .cur = 0, .level = 25},
-       { .volt = 3927, .cur = 0, .level = 20},
-       { .volt = 3906, .cur = 0, .level = 15},
-       { .volt = 3880, .cur = 0, .level = 10},
-       { .volt = 3829, .cur = 0, .level = 5},
-       { .volt = 3820, .cur = 0, .level = 0},
-};
-
-static int rx1950_bat_init(void)
-{
-       int ret;
-
-       ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1");
-       if (ret)
-               goto err_gpio1;
-       ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2");
-       if (ret)
-               goto err_gpio2;
-
-       return 0;
-
-err_gpio2:
-       gpio_free(S3C2410_GPJ(2));
-err_gpio1:
-       return ret;
-}
-
-static void rx1950_bat_exit(void)
-{
-       gpio_free(S3C2410_GPJ(2));
-       gpio_free(S3C2410_GPJ(3));
-}
-
-static void rx1950_enable_charger(void)
-{
-       gpio_direction_output(S3C2410_GPJ(2), 1);
-       gpio_direction_output(S3C2410_GPJ(3), 1);
-}
-
-static void rx1950_disable_charger(void)
-{
-       gpio_direction_output(S3C2410_GPJ(2), 0);
-       gpio_direction_output(S3C2410_GPJ(3), 0);
-}
-
-static DEFINE_SPINLOCK(rx1950_blink_spin);
-
-static int rx1950_led_blink_set(struct gpio_desc *desc, int state,
-       unsigned long *delay_on, unsigned long *delay_off)
-{
-       int gpio = desc_to_gpio(desc);
-       int blink_gpio, check_gpio;
-
-       switch (gpio) {
-       case S3C2410_GPA(6):
-               blink_gpio = S3C2410_GPA(4);
-               check_gpio = S3C2410_GPA(3);
-               break;
-       case S3C2410_GPA(7):
-               blink_gpio = S3C2410_GPA(3);
-               check_gpio = S3C2410_GPA(4);
-               break;
-       default:
-               return -EINVAL;
-               break;
-       }
-
-       if (delay_on && delay_off && !*delay_on && !*delay_off)
-               *delay_on = *delay_off = 500;
-
-       spin_lock(&rx1950_blink_spin);
-
-       switch (state) {
-       case GPIO_LED_NO_BLINK_LOW:
-       case GPIO_LED_NO_BLINK_HIGH:
-               if (!gpio_get_value(check_gpio))
-                       gpio_set_value(S3C2410_GPJ(6), 0);
-               gpio_set_value(blink_gpio, 0);
-               gpio_set_value(gpio, state);
-               break;
-       case GPIO_LED_BLINK:
-               gpio_set_value(gpio, 0);
-               gpio_set_value(S3C2410_GPJ(6), 1);
-               gpio_set_value(blink_gpio, 1);
-               break;
-       }
-
-       spin_unlock(&rx1950_blink_spin);
-
-       return 0;
-}
-
-static struct gpio_led rx1950_leds_desc[] = {
-       {
-               .name                   = "Green",
-               .default_trigger        = "main-battery-full",
-               .gpio                   = S3C2410_GPA(6),
-               .retain_state_suspended = 1,
-       },
-       {
-               .name                   = "Red",
-               .default_trigger
-                       = "main-battery-charging-blink-full-solid",
-               .gpio                   = S3C2410_GPA(7),
-               .retain_state_suspended = 1,
-       },
-       {
-               .name                   = "Blue",
-               .default_trigger        = "rx1950-acx-mem",
-               .gpio                   = S3C2410_GPA(11),
-               .retain_state_suspended = 1,
-       },
-};
-
-static struct gpio_led_platform_data rx1950_leds_pdata = {
-       .num_leds       = ARRAY_SIZE(rx1950_leds_desc),
-       .leds           = rx1950_leds_desc,
-       .gpio_blink_set = rx1950_led_blink_set,
-};
-
-static struct platform_device rx1950_leds = {
-       .name   = "leds-gpio",
-       .id             = -1,
-       .dev    = {
-                               .platform_data = &rx1950_leds_pdata,
-       },
-};
-
-static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
-       .init = rx1950_bat_init,
-       .exit = rx1950_bat_exit,
-       .enable_charger = rx1950_enable_charger,
-       .disable_charger = rx1950_disable_charger,
-       .gpio_charge_finished = S3C2410_GPF(3),
-       .lut_noac = bat_lut_noac,
-       .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
-       .lut_acin = bat_lut_acin,
-       .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
-       .volt_channel = 0,
-       .current_channel = 1,
-       .volt_mult = 4235,
-       .current_mult = 2900,
-       .internal_impedance = 200,
-};
-
-static struct platform_device rx1950_battery = {
-       .name             = "s3c-adc-battery",
-       .id               = -1,
-       .dev = {
-               .parent = &s3c_device_adc.dev,
-               .platform_data = &rx1950_bat_cfg,
-       },
-};
-
-static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
-       .displays = &rx1950_display,
-       .num_displays = 1,
-       .default_display = 0,
-
-       .lpcsel = 0x02,
-       .gpccon = 0xaa9556a9,
-       .gpccon_mask = 0xffc003fc,
-       .gpcup = 0x0000ffff,
-       .gpcup_mask = 0xffffffff,
-
-       .gpdcon = 0xaa90aaa1,
-       .gpdcon_mask = 0xffc0fff0,
-       .gpdup = 0x0000fcfd,
-       .gpdup_mask = 0xffffffff,
-
-};
-
-static struct pwm_lookup rx1950_pwm_lookup[] = {
-       PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
-                  PWM_POLARITY_NORMAL),
-};
-
-static struct pwm_device *lcd_pwm;
-static struct pwm_state lcd_pwm_state;
-
-static void rx1950_lcd_power(int enable)
-{
-       int i;
-       static int enabled;
-       if (enabled == enable)
-               return;
-       if (!enable) {
-
-               /* GPC11-GPC15->OUTPUT */
-               for (i = 11; i < 16; i++)
-                       gpio_direction_output(S3C2410_GPC(i), 1);
-
-               /* Wait a bit here... */
-               mdelay(100);
-
-               /* GPD2-GPD7->OUTPUT */
-               /* GPD11-GPD15->OUTPUT */
-               /* GPD2-GPD7->1, GPD11-GPD15->1 */
-               for (i = 2; i < 8; i++)
-                       gpio_direction_output(S3C2410_GPD(i), 1);
-               for (i = 11; i < 16; i++)
-                       gpio_direction_output(S3C2410_GPD(i), 1);
-
-               /* Wait a bit here...*/
-               mdelay(100);
-
-               /* GPB0->OUTPUT, GPB0->0 */
-               gpio_direction_output(S3C2410_GPB(0), 0);
-
-               /* GPC1-GPC4->OUTPUT, GPC1-4->0 */
-               for (i = 1; i < 5; i++)
-                       gpio_direction_output(S3C2410_GPC(i), 0);
-
-               /* GPC15-GPC11->0 */
-               for (i = 11; i < 16; i++)
-                       gpio_direction_output(S3C2410_GPC(i), 0);
-
-               /* GPD15-GPD11->0, GPD2->GPD7->0 */
-               for (i = 11; i < 16; i++)
-                       gpio_direction_output(S3C2410_GPD(i), 0);
-
-               for (i = 2; i < 8; i++)
-                       gpio_direction_output(S3C2410_GPD(i), 0);
-
-               /* GPC6->0, GPC7->0, GPC5->0 */
-               gpio_direction_output(S3C2410_GPC(6), 0);
-               gpio_direction_output(S3C2410_GPC(7), 0);
-               gpio_direction_output(S3C2410_GPC(5), 0);
-
-               /* GPB1->OUTPUT, GPB1->0 */
-               gpio_direction_output(S3C2410_GPB(1), 0);
-
-               lcd_pwm_state.enabled = false;
-               pwm_apply_state(lcd_pwm, &lcd_pwm_state);
-
-               /* GPC0->0, GPC10->0 */
-               gpio_direction_output(S3C2410_GPC(0), 0);
-               gpio_direction_output(S3C2410_GPC(10), 0);
-       } else {
-               lcd_pwm_state.enabled = true;
-               pwm_apply_state(lcd_pwm, &lcd_pwm_state);
-
-               gpio_direction_output(S3C2410_GPC(0), 1);
-               gpio_direction_output(S3C2410_GPC(5), 1);
-
-               s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1);
-               gpio_direction_output(S3C2410_GPC(7), 1);
-
-               for (i = 1; i < 5; i++)
-                       s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
-
-               for (i = 11; i < 16; i++)
-                       s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
-
-               for (i = 2; i < 8; i++)
-                       s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
-
-               for (i = 11; i < 16; i++)
-                       s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
-
-               gpio_direction_output(S3C2410_GPC(10), 1);
-               gpio_direction_output(S3C2410_GPC(6), 1);
-       }
-       enabled = enable;
-}
-
-static void rx1950_bl_power(int enable)
-{
-       static int enabled;
-       if (enabled == enable)
-               return;
-       if (!enable) {
-                       gpio_direction_output(S3C2410_GPB(0), 0);
-       } else {
-                       /* LED driver need a "push" to power on */
-                       gpio_direction_output(S3C2410_GPB(0), 1);
-                       /* Warm up backlight for one period of PWM.
-                        * Without this trick its almost impossible to
-                        * enable backlight with low brightness value
-                        */
-                       ndelay(48000);
-                       s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
-       }
-       enabled = enable;
-}
-
-static int rx1950_backlight_init(struct device *dev)
-{
-       WARN_ON(gpio_request(S3C2410_GPB(0), "Backlight"));
-       lcd_pwm = pwm_request(1, "RX1950 LCD");
-       if (IS_ERR(lcd_pwm)) {
-               dev_err(dev, "Unable to request PWM for LCD power!\n");
-               return PTR_ERR(lcd_pwm);
-       }
-
-       /*
-        * This is only required to initialize .polarity; all other values are
-        * fixed in this driver.
-        */
-       pwm_init_state(lcd_pwm, &lcd_pwm_state);
-
-       lcd_pwm_state.period = LCD_PWM_PERIOD;
-       lcd_pwm_state.duty_cycle = LCD_PWM_DUTY;
-
-       rx1950_lcd_power(1);
-       rx1950_bl_power(1);
-
-       return 0;
-}
-
-static void rx1950_backlight_exit(struct device *dev)
-{
-       rx1950_bl_power(0);
-       rx1950_lcd_power(0);
-
-       pwm_free(lcd_pwm);
-       gpio_free(S3C2410_GPB(0));
-}
-
-
-static int rx1950_backlight_notify(struct device *dev, int brightness)
-{
-       if (!brightness) {
-               rx1950_bl_power(0);
-               rx1950_lcd_power(0);
-       } else {
-               rx1950_lcd_power(1);
-               rx1950_bl_power(1);
-       }
-       return brightness;
-}
-
-static struct platform_pwm_backlight_data rx1950_backlight_data = {
-       .max_brightness = 24,
-       .dft_brightness = 4,
-       .init = rx1950_backlight_init,
-       .notify = rx1950_backlight_notify,
-       .exit = rx1950_backlight_exit,
-};
-
-static struct platform_device rx1950_backlight = {
-       .name = "pwm-backlight",
-       .dev = {
-               .parent = &samsung_device_pwm.dev,
-               .platform_data = &rx1950_backlight_data,
-       },
-};
-
-static void rx1950_set_mmc_power(unsigned char power_mode, unsigned short vdd)
-{
-       switch (power_mode) {
-       case MMC_POWER_OFF:
-               gpio_direction_output(S3C2410_GPJ(1), 0);
-               break;
-       case MMC_POWER_UP:
-       case MMC_POWER_ON:
-               gpio_direction_output(S3C2410_GPJ(1), 1);
-               break;
-       default:
-               break;
-       }
-}
-
-static struct s3c24xx_mci_pdata rx1950_mmc_cfg __initdata = {
-       .set_power = rx1950_set_mmc_power,
-       .ocr_avail = MMC_VDD_32_33,
-};
-
-static struct gpiod_lookup_table rx1950_mmc_gpio_table = {
-       .dev_id = "s3c2410-sdi",
-       .table = {
-               /* Card detect S3C2410_GPF(5) */
-               GPIO_LOOKUP("GPF", 5, "cd", GPIO_ACTIVE_LOW),
-               /* Write protect S3C2410_GPH(8) */
-               GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct mtd_partition rx1950_nand_part[] = {
-       [0] = {
-                       .name = "Boot0",
-                       .offset = 0,
-                       .size = 0x4000,
-                       .mask_flags = MTD_WRITEABLE,
-       },
-       [1] = {
-                       .name = "Boot1",
-                       .offset = MTDPART_OFS_APPEND,
-                       .size = 0x40000,
-                       .mask_flags = MTD_WRITEABLE,
-       },
-       [2] = {
-                       .name = "Kernel",
-                       .offset = MTDPART_OFS_APPEND,
-                       .size = 0x300000,
-                       .mask_flags = 0,
-       },
-       [3] = {
-                       .name = "Filesystem",
-                       .offset = MTDPART_OFS_APPEND,
-                       .size = MTDPART_SIZ_FULL,
-                       .mask_flags = 0,
-       },
-};
-
-static struct s3c2410_nand_set rx1950_nand_sets[] = {
-       [0] = {
-                       .name = "Internal",
-                       .nr_chips = 1,
-                       .nr_partitions = ARRAY_SIZE(rx1950_nand_part),
-                       .partitions = rx1950_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand rx1950_nand_info = {
-       .tacls = 25,
-       .twrph0 = 50,
-       .twrph1 = 15,
-       .nr_sets = ARRAY_SIZE(rx1950_nand_sets),
-       .sets = rx1950_nand_sets,
-       .ecc_mode = NAND_ECC_SOFT,
-};
-
-static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = {
-       .vbus_pin = S3C2410_GPG(5),
-       .vbus_pin_inverted = 1,
-       .pullup_pin = S3C2410_GPJ(5),
-};
-
-static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = {
-       .delay = 10000,
-       .presc = 49,
-       .oversampling_shift = 3,
-};
-
-static struct gpio_keys_button rx1950_gpio_keys_table[] = {
-       {
-               .code           = KEY_POWER,
-               .gpio           = S3C2410_GPF(0),
-               .active_low     = 1,
-               .desc           = "Power button",
-               .wakeup         = 1,
-       },
-       {
-               .code           = KEY_F5,
-               .gpio           = S3C2410_GPF(7),
-               .active_low     = 1,
-               .desc           = "Record button",
-       },
-       {
-               .code           = KEY_F1,
-               .gpio           = S3C2410_GPG(0),
-               .active_low     = 1,
-               .desc           = "Calendar button",
-       },
-       {
-               .code           = KEY_F2,
-               .gpio           = S3C2410_GPG(2),
-               .active_low     = 1,
-               .desc           = "Contacts button",
-       },
-       {
-               .code           = KEY_F3,
-               .gpio           = S3C2410_GPG(3),
-               .active_low     = 1,
-               .desc           = "Mail button",
-       },
-       {
-               .code           = KEY_F4,
-               .gpio           = S3C2410_GPG(7),
-               .active_low     = 1,
-               .desc           = "WLAN button",
-       },
-       {
-               .code           = KEY_LEFT,
-               .gpio           = S3C2410_GPG(10),
-               .active_low     = 1,
-               .desc           = "Left button",
-       },
-       {
-               .code           = KEY_RIGHT,
-               .gpio           = S3C2410_GPG(11),
-               .active_low     = 1,
-               .desc           = "Right button",
-       },
-       {
-               .code           = KEY_UP,
-               .gpio           = S3C2410_GPG(4),
-               .active_low     = 1,
-               .desc           = "Up button",
-       },
-       {
-               .code           = KEY_DOWN,
-               .gpio           = S3C2410_GPG(6),
-               .active_low     = 1,
-               .desc           = "Down button",
-       },
-       {
-               .code           = KEY_ENTER,
-               .gpio           = S3C2410_GPG(9),
-               .active_low     = 1,
-               .desc           = "Ok button"
-       },
-};
-
-static struct gpio_keys_platform_data rx1950_gpio_keys_data = {
-       .buttons = rx1950_gpio_keys_table,
-       .nbuttons = ARRAY_SIZE(rx1950_gpio_keys_table),
-};
-
-static struct platform_device rx1950_device_gpiokeys = {
-       .name = "gpio-keys",
-       .dev.platform_data = &rx1950_gpio_keys_data,
-};
-
-static struct uda1380_platform_data uda1380_info = {
-       .gpio_power     = S3C2410_GPJ(0),
-       .gpio_reset     = S3C2410_GPD(0),
-       .dac_clk        = UDA1380_DAC_CLK_SYSCLK,
-};
-
-static struct i2c_board_info rx1950_i2c_devices[] = {
-       {
-               I2C_BOARD_INFO("uda1380", 0x1a),
-               .platform_data = &uda1380_info,
-       },
-};
-
-static struct platform_device *rx1950_devices[] __initdata = {
-       &s3c2410_device_dclk,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_usbgadget,
-       &s3c_device_rtc,
-       &s3c_device_nand,
-       &s3c_device_sdi,
-       &s3c_device_adc,
-       &s3c_device_ts,
-       &samsung_device_pwm,
-       &rx1950_backlight,
-       &rx1950_device_gpiokeys,
-       &power_supply,
-       &rx1950_battery,
-       &rx1950_leds,
-};
-
-static void __init rx1950_map_io(void)
-{
-       s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
-       s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* setup PM */
-
-#ifdef CONFIG_PM_H1940
-       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 8);
-#endif
-
-       s3c_pm_init();
-}
-
-static void __init rx1950_init_time(void)
-{
-       s3c2442_init_clocks(16934000);
-       samsung_timer_init();
-}
-
-static void __init rx1950_init_machine(void)
-{
-       int i;
-
-       s3c24xx_fb_set_platdata(&rx1950_lcd_cfg);
-       s3c24xx_udc_set_platdata(&rx1950_udc_cfg);
-       s3c24xx_ts_set_platdata(&rx1950_ts_cfg);
-       gpiod_add_lookup_table(&rx1950_mmc_gpio_table);
-       s3c24xx_mci_set_platdata(&rx1950_mmc_cfg);
-       s3c_i2c0_set_platdata(NULL);
-       s3c_nand_set_platdata(&rx1950_nand_info);
-
-       /* Turn off suspend on both USB ports, and switch the
-        * selectable USB port to USB device mode. */
-       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                                               S3C2410_MISCCR_USBSUSPND0 |
-                                               S3C2410_MISCCR_USBSUSPND1, 0x0);
-
-       /* mmc power is disabled by default */
-       WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
-       gpio_direction_output(S3C2410_GPJ(1), 0);
-
-       for (i = 0; i < 8; i++)
-               WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
-
-       for (i = 10; i < 16; i++)
-               WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
-
-       for (i = 2; i < 8; i++)
-               WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
-
-       for (i = 11; i < 16; i++)
-               WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power"));
-
-       WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
-
-       WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
-       WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
-       WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
-       gpio_direction_output(S3C2410_GPA(3), 0);
-       gpio_direction_output(S3C2410_GPA(4), 0);
-       gpio_direction_output(S3C2410_GPJ(6), 0);
-
-       pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
-       platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
-
-       i2c_register_board_info(0, rx1950_i2c_devices,
-               ARRAY_SIZE(rx1950_i2c_devices));
-}
-
-/* H1940 and RX3715 need to reserve this for suspend */
-static void __init rx1950_reserve(void)
-{
-       memblock_reserve(0x30003000, 0x1000);
-       memblock_reserve(0x30081000, 0x1000);
-}
-
-MACHINE_START(RX1950, "HP iPAQ RX1950")
-    /* Maintainers: Vasily Khoruzhick */
-       .atag_offset = 0x100,
-       .map_io = rx1950_map_io,
-       .reserve        = rx1950_reserve,
-       .init_irq       = s3c2442_init_irq,
-       .init_machine = rx1950_init_machine,
-       .init_time      = rx1950_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
deleted file mode 100644 (file)
index 995f1ff..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2003-2004 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// https://www.handhelds.org/projects/rx3715.html
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/memblock.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/tty.h>
-#include <linux/console.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/serial.h>
-#include <linux/io.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/irq.h>
-#include <asm/mach/map.h>
-
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/fb.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "h1940.h"
-
-static struct map_desc rx3715_iodesc[] __initdata = {
-       /* dump ISA space somewhere unused */
-
-       {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
-               .pfn            = __phys_to_pfn(S3C2410_CS3),
-               .length         = SZ_1M,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
-               .pfn            = __phys_to_pfn(S3C2410_CS3),
-               .length         = SZ_1M,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-               .clk_sel        = S3C2410_UCON_CLKSEL3,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x00,
-               .clk_sel        = S3C2410_UCON_CLKSEL3,
-       },
-       /* IR port */
-       [2] = {
-               .hwport      = 2,
-               .uart_flags  = UPF_CONS_FLOW,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x43,
-               .ufcon       = 0x51,
-               .clk_sel        = S3C2410_UCON_CLKSEL3,
-       }
-};
-
-/* framebuffer lcd controller information */
-
-static struct s3c2410fb_display rx3715_lcdcfg __initdata = {
-       .lcdcon5 =      S3C2410_LCDCON5_INVVLINE |
-                       S3C2410_LCDCON5_FRM565 |
-                       S3C2410_LCDCON5_HWSWP,
-
-       .type           = S3C2410_LCDCON1_TFT,
-       .width          = 240,
-       .height         = 320,
-
-       .pixclock       = 260000,
-       .xres           = 240,
-       .yres           = 320,
-       .bpp            = 16,
-       .left_margin    = 36,
-       .right_margin   = 36,
-       .hsync_len      = 8,
-       .upper_margin   = 6,
-       .lower_margin   = 7,
-       .vsync_len      = 3,
-};
-
-static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
-
-       .displays =     &rx3715_lcdcfg,
-       .num_displays = 1,
-       .default_display = 0,
-
-       .lpcsel =       0xf82,
-
-       .gpccon =       0xaa955699,
-       .gpccon_mask =  0xffc003cc,
-       .gpcup =        0x0000ffff,
-       .gpcup_mask =   0xffffffff,
-
-       .gpdcon =       0xaa95aaa1,
-       .gpdcon_mask =  0xffc0fff0,
-       .gpdup =        0x0000faff,
-       .gpdup_mask =   0xffffffff,
-};
-
-static struct mtd_partition __initdata rx3715_nand_part[] = {
-       [0] = {
-               .name           = "Whole Flash",
-               .offset         = 0,
-               .size           = MTDPART_SIZ_FULL,
-               .mask_flags     = MTD_WRITEABLE,
-       }
-};
-
-static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
-       [0] = {
-               .name           = "Internal",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(rx3715_nand_part),
-               .partitions     = rx3715_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 50,
-       .twrph1         = 15,
-       .nr_sets        = ARRAY_SIZE(rx3715_nand_sets),
-       .sets           = rx3715_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-static struct platform_device *rx3715_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_nand,
-};
-
-static void __init rx3715_map_io(void)
-{
-       s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
-       s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init rx3715_init_time(void)
-{
-       s3c2440_init_clocks(16934000);
-       samsung_timer_init();
-}
-
-/* H1940 and RX3715 need to reserve this for suspend */
-static void __init rx3715_reserve(void)
-{
-       memblock_reserve(0x30003000, 0x1000);
-       memblock_reserve(0x30081000, 0x1000);
-}
-
-static void __init rx3715_init_machine(void)
-{
-#ifdef CONFIG_PM_H1940
-       memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
-#endif
-       s3c_pm_init();
-
-       s3c_nand_set_platdata(&rx3715_nand_info);
-       s3c24xx_fb_set_platdata(&rx3715_fb_info);
-       platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
-}
-
-MACHINE_START(RX3715, "IPAQ-RX3715")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-       .map_io         = rx3715_map_io,
-       .reserve        = rx3715_reserve,
-       .init_irq       = s3c2440_init_irq,
-       .init_machine   = rx3715_init_machine,
-       .init_time      = rx3715_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
deleted file mode 100644 (file)
index aa71027..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Samsung's S3C2416 flattened device tree enabled machine
-//
-// Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
-//
-// based on mach-exynos/mach-exynos4-dt.c
-//
-// Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com
-// Copyright (c) 2010-2011 Linaro Ltd.
-//             www.linaro.org
-
-#include <linux/clocksource.h>
-#include <linux/irqchip.h>
-#include <linux/serial_s3c.h>
-
-#include <asm/mach/arch.h>
-#include <mach/map.h>
-
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-#include "common.h"
-
-static void __init s3c2416_dt_map_io(void)
-{
-       s3c24xx_init_io(NULL, 0);
-}
-
-static void __init s3c2416_dt_machine_init(void)
-{
-       s3c_pm_init();
-}
-
-static const char *const s3c2416_dt_compat[] __initconst = {
-       "samsung,s3c2416",
-       "samsung,s3c2450",
-       NULL
-};
-
-DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
-       /* Maintainer: Heiko Stuebner <heiko@sntech.de> */
-       .dt_compat      = s3c2416_dt_compat,
-       .map_io         = s3c2416_dt_map_io,
-       .init_irq       = irqchip_init,
-       .init_machine   = s3c2416_dt_machine_init,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
deleted file mode 100644 (file)
index 18dfef5..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (C) 2004 by FS Forth-Systeme GmbH
-// All rights reserved.
-//
-// @Author: Jonas Dietsche
-//
-// @History:
-// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
-// Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "common-smdk.h"
-
-static struct map_desc smdk2410_iodesc[] __initdata = {
-  /* nothing here yet */
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-static struct platform_device *smdk2410_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-};
-
-static void __init smdk2410_map_io(void)
-{
-       s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
-       s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init smdk2410_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init smdk2410_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
-       smdk_machine_init();
-}
-
-MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
-                                   * to SMDK2410 */
-       /* Maintainer: Jonas Dietsche */
-       .atag_offset    = 0x100,
-       .map_io         = smdk2410_map_io,
-       .init_irq       = s3c2410_init_irq,
-       .init_machine   = smdk2410_init,
-       .init_time      = smdk2410_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
deleted file mode 100644 (file)
index ca80167..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Thanks to Dimity Andric (TomTom) and Steven Ryu (Samsung) for the
-// loans of SMDK2413 to work with.
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/memblock.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/hardware/iomd.h>
-#include <asm/setup.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-//#include <asm/debug-ll.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-
-#include <linux/platform_data/usb-s3c2410_udc.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-#include <mach/fb.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "common-smdk.h"
-
-static struct map_desc smdk2413_iodesc[] __initdata = {
-};
-
-static struct s3c2410_uartcfg smdk2413_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       /* IR port */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x43,
-               .ufcon       = 0x51,
-       }
-};
-
-
-static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = {
-       .pullup_pin = S3C2410_GPF(2),
-};
-
-
-static struct platform_device *smdk2413_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_usbgadget,
-       &s3c2412_device_dma,
-};
-
-static void __init smdk2413_fixup(struct tag *tags, char **cmdline)
-{
-       if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
-               memblock_add(0x30000000, SZ_64M);
-       }
-}
-
-static void __init smdk2413_map_io(void)
-{
-       s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
-       s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init smdk2413_init_time(void)
-{
-       s3c2412_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init smdk2413_machine_init(void)
-{      /* Turn off suspend on both USB ports, and switch the
-        * selectable USB port to USB device mode. */
-
-       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
-                             S3C2410_MISCCR_USBSUSPND0 |
-                             S3C2410_MISCCR_USBSUSPND1, 0x0);
-
-
-       s3c24xx_udc_set_platdata(&smdk2413_udc_cfg);
-       s3c_i2c0_set_platdata(NULL);
-
-       platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices));
-       smdk_machine_init();
-}
-
-MACHINE_START(S3C2413, "S3C2413")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-
-       .fixup          = smdk2413_fixup,
-       .init_irq       = s3c2412_init_irq,
-       .map_io         = smdk2413_map_io,
-       .init_machine   = smdk2413_machine_init,
-       .init_time      = samsung_timer_init,
-MACHINE_END
-
-MACHINE_START(SMDK2412, "SMDK2412")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-
-       .fixup          = smdk2413_fixup,
-       .init_irq       = s3c2412_init_irq,
-       .map_io         = smdk2413_map_io,
-       .init_machine   = smdk2413_machine_init,
-       .init_time      = samsung_timer_init,
-MACHINE_END
-
-MACHINE_START(SMDK2413, "SMDK2413")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-
-       .fixup          = smdk2413_fixup,
-       .init_irq       = s3c2412_init_irq,
-       .map_io         = smdk2413_map_io,
-       .init_machine   = smdk2413_machine_init,
-       .init_time      = smdk2413_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
deleted file mode 100644 (file)
index 61c3e45..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
-//     as part of OpenInkpot project
-// Copyright (c) 2009 Promwad Innovation Company
-//     Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/mtd/partitions.h>
-#include <linux/gpio.h>
-#include <linux/fb.h>
-#include <linux/delay.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <video/samsung_fimd.h>
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-#include <mach/regs-s3c2443-clock.h>
-#include <mach/gpio-samsung.h>
-
-#include <linux/platform_data/leds-s3c24xx.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <plat/sdhci.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-#include <linux/platform_data/s3c-hsudc.h>
-#include <plat/samsung-time.h>
-
-#include <plat/fb.h>
-
-#include "common.h"
-#include "common-smdk.h"
-
-static struct map_desc smdk2416_iodesc[] __initdata = {
-       /* ISA IO Space map (memory space selected by A24) */
-
-       {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
-               .pfn            = __phys_to_pfn(S3C2410_CS2),
-               .length         = 0x10000,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
-               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
-               .length         = SZ_4M,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
-               .pfn            = __phys_to_pfn(S3C2410_CS2),
-               .length         = 0x10000,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
-               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
-               .length         = SZ_4M,
-               .type           = MT_DEVICE,
-       }
-};
-
-#define UCON (S3C2410_UCON_DEFAULT     | \
-               S3C2440_UCON_PCLK       | \
-               S3C2443_UCON_RXERR_IRQEN)
-
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
-
-#define UFCON (S3C2410_UFCON_RXTRIG8   | \
-               S3C2410_UFCON_FIFOMODE  | \
-               S3C2440_UFCON_TXTRIG16)
-
-static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       /* IR port */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON | 0x50,
-               .ufcon       = UFCON,
-       },
-       [3] = {
-               .hwport      = 3,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-static void smdk2416_hsudc_gpio_init(void)
-{
-       s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
-       s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
-       s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
-       s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
-}
-
-static void smdk2416_hsudc_gpio_uninit(void)
-{
-       s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
-       s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
-       s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
-}
-
-static struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
-       .epnum = 9,
-       .gpio_init = smdk2416_hsudc_gpio_init,
-       .gpio_uninit = smdk2416_hsudc_gpio_uninit,
-};
-
-static struct s3c_fb_pd_win smdk2416_fb_win[] = {
-       [0] = {
-               .default_bpp    = 16,
-               .max_bpp        = 32,
-               .xres           = 800,
-               .yres           = 480,
-       },
-};
-
-static struct fb_videomode smdk2416_lcd_timing = {
-       .pixclock       = 41094,
-       .left_margin    = 8,
-       .right_margin   = 13,
-       .upper_margin   = 7,
-       .lower_margin   = 5,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static void s3c2416_fb_gpio_setup_24bpp(void)
-{
-       unsigned int gpio;
-
-       for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) {
-               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
-               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
-       }
-
-       for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) {
-               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
-               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
-       }
-
-       for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) {
-               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
-               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
-       }
-}
-
-static struct s3c_fb_platdata smdk2416_fb_platdata = {
-       .win[0]         = &smdk2416_fb_win[0],
-       .vtiming        = &smdk2416_lcd_timing,
-       .setup_gpio     = s3c2416_fb_gpio_setup_24bpp,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-};
-
-static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
-       .max_width              = 4,
-       .cd_type                = S3C_SDHCI_CD_GPIO,
-       .ext_cd_gpio            = S3C2410_GPF(1),
-       .ext_cd_gpio_invert     = 1,
-};
-
-static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
-       .max_width              = 4,
-       .cd_type                = S3C_SDHCI_CD_NONE,
-};
-
-static struct platform_device *smdk2416_devices[] __initdata = {
-       &s3c_device_fb,
-       &s3c_device_wdt,
-       &s3c_device_ohci,
-       &s3c_device_i2c0,
-       &s3c_device_hsmmc0,
-       &s3c_device_hsmmc1,
-       &s3c_device_usb_hsudc,
-       &s3c2443_device_dma,
-};
-
-static void __init smdk2416_init_time(void)
-{
-       s3c2416_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init smdk2416_map_io(void)
-{
-       s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
-       s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init smdk2416_machine_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       s3c_fb_set_platdata(&smdk2416_fb_platdata);
-
-       s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
-       s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
-
-       s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
-
-       gpio_request(S3C2410_GPB(4), "USBHost Power");
-       gpio_direction_output(S3C2410_GPB(4), 1);
-
-       gpio_request(S3C2410_GPB(3), "Display Power");
-       gpio_direction_output(S3C2410_GPB(3), 1);
-
-       gpio_request(S3C2410_GPB(1), "Display Reset");
-       gpio_direction_output(S3C2410_GPB(1), 1);
-
-       platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
-       smdk_machine_init();
-}
-
-MACHINE_START(SMDK2416, "SMDK2416")
-       /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */
-       .atag_offset    = 0x100,
-
-       .init_irq       = s3c2416_init_irq,
-       .map_io         = smdk2416_map_io,
-       .init_machine   = smdk2416_machine_init,
-       .init_time      = smdk2416_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
deleted file mode 100644 (file)
index 7bafcd8..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// linux/arch/arm/mach-s3c2440/mach-smdk2440.c
-//
-// Copyright (c) 2004-2005 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://www.fluff.org/ben/smdk2440/
-//
-// Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-
-#include <mach/fb.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "common-smdk.h"
-
-static struct map_desc smdk2440_iodesc[] __initdata = {
-       /* ISA IO Space map (memory space selected by A24) */
-
-       {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
-               .pfn            = __phys_to_pfn(S3C2410_CS2),
-               .length         = 0x10000,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
-               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
-               .length         = SZ_4M,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
-               .pfn            = __phys_to_pfn(S3C2410_CS2),
-               .length         = 0x10000,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
-               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
-               .length         = SZ_4M,
-               .type           = MT_DEVICE,
-       }
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       /* IR port */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x43,
-               .ufcon       = 0x51,
-       }
-};
-
-/* LCD driver info */
-
-static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
-
-       .lcdcon5        = S3C2410_LCDCON5_FRM565 |
-                         S3C2410_LCDCON5_INVVLINE |
-                         S3C2410_LCDCON5_INVVFRAME |
-                         S3C2410_LCDCON5_PWREN |
-                         S3C2410_LCDCON5_HWSWP,
-
-       .type           = S3C2410_LCDCON1_TFT,
-
-       .width          = 240,
-       .height         = 320,
-
-       .pixclock       = 166667, /* HCLK 60 MHz, divisor 10 */
-       .xres           = 240,
-       .yres           = 320,
-       .bpp            = 16,
-       .left_margin    = 20,
-       .right_margin   = 8,
-       .hsync_len      = 4,
-       .upper_margin   = 8,
-       .lower_margin   = 7,
-       .vsync_len      = 4,
-};
-
-static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
-       .displays       = &smdk2440_lcd_cfg,
-       .num_displays   = 1,
-       .default_display = 0,
-
-#if 0
-       /* currently setup by downloader */
-       .gpccon         = 0xaa940659,
-       .gpccon_mask    = 0xffffffff,
-       .gpcup          = 0x0000ffff,
-       .gpcup_mask     = 0xffffffff,
-       .gpdcon         = 0xaa84aaa0,
-       .gpdcon_mask    = 0xffffffff,
-       .gpdup          = 0x0000faff,
-       .gpdup_mask     = 0xffffffff,
-#endif
-
-       .lpcsel         = ((0xCE6) & ~7) | 1<<4,
-};
-
-static struct platform_device *smdk2440_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-};
-
-static void __init smdk2440_map_io(void)
-{
-       s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
-       s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init smdk2440_init_time(void)
-{
-       s3c2440_init_clocks(16934400);
-       samsung_timer_init();
-}
-
-static void __init smdk2440_machine_init(void)
-{
-       s3c24xx_fb_set_platdata(&smdk2440_fb_info);
-       s3c_i2c0_set_platdata(NULL);
-
-       platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
-       smdk_machine_init();
-}
-
-MACHINE_START(S3C2440, "SMDK2440")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-
-       .init_irq       = s3c2440_init_irq,
-       .map_io         = smdk2440_map_io,
-       .init_machine   = smdk2440_machine_init,
-       .init_time      = smdk2440_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
deleted file mode 100644 (file)
index 2358ed5..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2007 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://www.fluff.org/ben/smdk2443/
-//
-// Thanks to Samsung for the loan of an SMDK2443
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-
-#include <mach/fb.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "common-smdk.h"
-
-static struct map_desc smdk2443_iodesc[] __initdata = {
-       /* ISA IO Space map (memory space selected by A24) */
-
-       {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD,
-               .pfn            = __phys_to_pfn(S3C2410_CS2),
-               .length         = 0x10000,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
-               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
-               .length         = SZ_4M,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE,
-               .pfn            = __phys_to_pfn(S3C2410_CS2),
-               .length         = 0x10000,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
-               .pfn            = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
-               .length         = SZ_4M,
-               .type           = MT_DEVICE,
-       }
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg smdk2443_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       /* IR port */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x43,
-               .ufcon       = 0x51,
-       },
-       [3] = {
-               .hwport      = 3,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       }
-};
-
-static struct platform_device *smdk2443_devices[] __initdata = {
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_hsmmc1,
-       &s3c2443_device_dma,
-};
-
-static void __init smdk2443_map_io(void)
-{
-       s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
-       s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init smdk2443_init_time(void)
-{
-       s3c2443_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init smdk2443_machine_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       platform_add_devices(smdk2443_devices, ARRAY_SIZE(smdk2443_devices));
-       smdk_machine_init();
-}
-
-MACHINE_START(SMDK2443, "SMDK2443")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-
-       .init_irq       = s3c2443_init_irq,
-       .map_io         = smdk2443_map_io,
-       .init_machine   = smdk2443_machine_init,
-       .init_time      = smdk2443_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
deleted file mode 100644 (file)
index 8d8ddd6..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2007 TinCanTools
-//     David Anders <danders@amltd.com>
-//
-// @History:
-// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
-// Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-#include <asm/mach/flash.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/physmap.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-static struct resource tct_hammer_nor_resource =
-                       DEFINE_RES_MEM(0x00000000, SZ_16M);
-
-static struct mtd_partition tct_hammer_mtd_partitions[] = {
-       {
-               .name           = "System",
-               .size           = 0x240000,
-               .offset         = 0,
-               .mask_flags     = MTD_WRITEABLE,  /* force read-only */
-       }, {
-               .name           = "JFFS2",
-               .size           = MTDPART_SIZ_FULL,
-               .offset         = MTDPART_OFS_APPEND,
-       }
-};
-
-static struct physmap_flash_data tct_hammer_flash_data = {
-       .width          = 2,
-       .parts          = tct_hammer_mtd_partitions,
-       .nr_parts       = ARRAY_SIZE(tct_hammer_mtd_partitions),
-};
-
-static struct platform_device tct_hammer_device_nor = {
-       .name           = "physmap-flash",
-       .id             = 0,
-       .dev = {
-                       .platform_data = &tct_hammer_flash_data,
-               },
-       .num_resources  = 1,
-       .resource       = &tct_hammer_nor_resource,
-};
-
-static struct map_desc tct_hammer_iodesc[] __initdata = {
-};
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-
-static struct platform_device *tct_hammer_devices[] __initdata = {
-       &s3c_device_adc,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_ohci,
-       &s3c_device_rtc,
-       &s3c_device_usbgadget,
-       &s3c_device_sdi,
-       &tct_hammer_device_nor,
-};
-
-static void __init tct_hammer_map_io(void)
-{
-       s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
-       s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init tct_hammer_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init tct_hammer_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
-}
-
-MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
-       .atag_offset    = 0x100,
-       .map_io         = tct_hammer_map_io,
-       .init_irq       = s3c2410_init_irq,
-       .init_machine   = tct_hammer_init,
-       .init_time      = tct_hammer_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
deleted file mode 100644 (file)
index 6a3fb2b..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2003-2008 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// Machine support for Thorcom VR1000 board. Designed for Thorcom by
-// Simtec Electronics, http://www.simtec.co.uk/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/dm9000.h>
-#include <linux/i2c.h>
-
-#include <linux/serial.h>
-#include <linux/tty.h>
-#include <linux/serial_8250.h>
-#include <linux/serial_reg.h>
-#include <linux/serial_s3c.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/leds-s3c24xx.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/asoc-s3c24xx_simtec.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
-
-#include "bast.h"
-#include "common.h"
-#include "simtec.h"
-#include "vr1000.h"
-
-/* macros for virtual address mods for the io space entries */
-#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
-#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
-#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
-#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
-
-/* macros to modify the physical addresses for io space */
-
-#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
-#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
-#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
-#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
-
-static struct map_desc vr1000_iodesc[] __initdata = {
-  /* ISA IO areas */
-  {
-         .virtual      = (u32)S3C24XX_VA_ISA_BYTE,
-         .pfn          = PA_CS2(BAST_PA_ISAIO),
-         .length       = SZ_16M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)S3C24XX_VA_ISA_WORD,
-         .pfn          = PA_CS3(BAST_PA_ISAIO),
-         .length       = SZ_16M,
-         .type         = MT_DEVICE,
-  },
-
-  /*  CPLD control registers, and external interrupt controls */
-  {
-         .virtual      = (u32)VR1000_VA_CTRL1,
-         .pfn          = __phys_to_pfn(VR1000_PA_CTRL1),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)VR1000_VA_CTRL2,
-         .pfn          = __phys_to_pfn(VR1000_PA_CTRL2),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)VR1000_VA_CTRL3,
-         .pfn          = __phys_to_pfn(VR1000_PA_CTRL3),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  }, {
-         .virtual      = (u32)VR1000_VA_CTRL4,
-         .pfn          = __phys_to_pfn(VR1000_PA_CTRL4),
-         .length       = SZ_1M,
-         .type         = MT_DEVICE,
-  },
-};
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       /* port 2 is not actually used */
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       }
-};
-
-/* definitions for the vr1000 extra 16550 serial ports */
-
-#define VR1000_BAUDBASE (3692307)
-
-#define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5))
-
-static struct plat_serial8250_port serial_platform_data[] = {
-       [0] = {
-               .mapbase        = VR1000_SERIAL_MAPBASE(0),
-               .irq            = VR1000_IRQ_SERIAL + 0,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-               .iotype         = UPIO_MEM,
-               .regshift       = 0,
-               .uartclk        = VR1000_BAUDBASE,
-       },
-       [1] = {
-               .mapbase        = VR1000_SERIAL_MAPBASE(1),
-               .irq            = VR1000_IRQ_SERIAL + 1,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-               .iotype         = UPIO_MEM,
-               .regshift       = 0,
-               .uartclk        = VR1000_BAUDBASE,
-       },
-       [2] = {
-               .mapbase        = VR1000_SERIAL_MAPBASE(2),
-               .irq            = VR1000_IRQ_SERIAL + 2,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-               .iotype         = UPIO_MEM,
-               .regshift       = 0,
-               .uartclk        = VR1000_BAUDBASE,
-       },
-       [3] = {
-               .mapbase        = VR1000_SERIAL_MAPBASE(3),
-               .irq            = VR1000_IRQ_SERIAL + 3,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-               .iotype         = UPIO_MEM,
-               .regshift       = 0,
-               .uartclk        = VR1000_BAUDBASE,
-       },
-       { },
-};
-
-static struct platform_device serial_device = {
-       .name                   = "serial8250",
-       .id                     = PLAT8250_DEV_PLATFORM,
-       .dev                    = {
-               .platform_data  = serial_platform_data,
-       },
-};
-
-/* DM9000 ethernet devices */
-
-static struct resource vr1000_dm9k0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000, 4),
-       [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, 0x40),
-       [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000A, 1, NULL, IORESOURCE_IRQ \
-                                               | IORESOURCE_IRQ_HIGHLEVEL),
-};
-
-static struct resource vr1000_dm9k1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 4),
-       [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, 0x40),
-       [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000N, 1, NULL, IORESOURCE_IRQ \
-                                               | IORESOURCE_IRQ_HIGHLEVEL),
-};
-
-/* for the moment we limit ourselves to 16bit IO until some
- * better IO routines can be written and tested
-*/
-
-static struct dm9000_plat_data vr1000_dm9k_platdata = {
-       .flags          = DM9000_PLATF_16BITONLY,
-};
-
-static struct platform_device vr1000_dm9k0 = {
-       .name           = "dm9000",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(vr1000_dm9k0_resource),
-       .resource       = vr1000_dm9k0_resource,
-       .dev            = {
-               .platform_data = &vr1000_dm9k_platdata,
-       }
-};
-
-static struct platform_device vr1000_dm9k1 = {
-       .name           = "dm9000",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(vr1000_dm9k1_resource),
-       .resource       = vr1000_dm9k1_resource,
-       .dev            = {
-               .platform_data = &vr1000_dm9k_platdata,
-       }
-};
-
-/* LEDS */
-
-static struct gpiod_lookup_table vr1000_led1_gpio_table = {
-       .dev_id = "s3c24xx_led.1",
-       .table = {
-               GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table vr1000_led2_gpio_table = {
-       .dev_id = "s3c24xx_led.2",
-       .table = {
-               GPIO_LOOKUP("GPB", 1, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct gpiod_lookup_table vr1000_led3_gpio_table = {
-       .dev_id = "s3c24xx_led.3",
-       .table = {
-               GPIO_LOOKUP("GPB", 2, NULL, GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct s3c24xx_led_platdata vr1000_led1_pdata = {
-       .name           = "led1",
-       .def_trigger    = "",
-};
-
-static struct s3c24xx_led_platdata vr1000_led2_pdata = {
-       .name           = "led2",
-       .def_trigger    = "",
-};
-
-static struct s3c24xx_led_platdata vr1000_led3_pdata = {
-       .name           = "led3",
-       .def_trigger    = "",
-};
-
-static struct platform_device vr1000_led1 = {
-       .name           = "s3c24xx_led",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &vr1000_led1_pdata,
-       },
-};
-
-static struct platform_device vr1000_led2 = {
-       .name           = "s3c24xx_led",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &vr1000_led2_pdata,
-       },
-};
-
-static struct platform_device vr1000_led3 = {
-       .name           = "s3c24xx_led",
-       .id             = 3,
-       .dev            = {
-               .platform_data  = &vr1000_led3_pdata,
-       },
-};
-
-/* I2C devices. */
-
-static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
-       {
-               I2C_BOARD_INFO("tlv320aic23", 0x1a),
-       }, {
-               I2C_BOARD_INFO("tmp101", 0x48),
-       }, {
-               I2C_BOARD_INFO("m41st87", 0x68),
-       },
-};
-
-/* devices for this board */
-
-static struct platform_device *vr1000_devices[] __initdata = {
-       &s3c2410_device_dclk,
-       &s3c_device_ohci,
-       &s3c_device_lcd,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_adc,
-       &serial_device,
-       &vr1000_dm9k0,
-       &vr1000_dm9k1,
-       &vr1000_led1,
-       &vr1000_led2,
-       &vr1000_led3,
-};
-
-static void vr1000_power_off(void)
-{
-       gpio_direction_output(S3C2410_GPB(9), 1);
-}
-
-static void __init vr1000_map_io(void)
-{
-       pm_power_off = vr1000_power_off;
-
-       s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
-       s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init vr1000_init_time(void)
-{
-       s3c2410_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init vr1000_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-
-       /* Disable pull-up on LED lines and register GPIO lookups */
-       s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_NONE);
-       s3c_gpio_setpull(S3C2410_GPB(2), S3C_GPIO_PULL_NONE);
-       gpiod_add_lookup_table(&vr1000_led1_gpio_table);
-       gpiod_add_lookup_table(&vr1000_led2_gpio_table);
-       gpiod_add_lookup_table(&vr1000_led3_gpio_table);
-
-       platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
-
-       i2c_register_board_info(0, vr1000_i2c_devs,
-                               ARRAY_SIZE(vr1000_i2c_devs));
-
-       nor_simtec_init();
-       simtec_audio_add(NULL, true, NULL);
-
-       WARN_ON(gpio_request(S3C2410_GPB(9), "power off"));
-}
-
-MACHINE_START(VR1000, "Thorcom-VR1000")
-       /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
-       .atag_offset    = 0x100,
-       .map_io         = vr1000_map_io,
-       .init_machine   = vr1000_init,
-       .init_irq       = s3c2410_init_irq,
-       .init_time      = vr1000_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
deleted file mode 100644 (file)
index d76b28b..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// (C) 2006 Thomas Gleixner <tglx@linutronix.de>
-//
-// Derived from mach-smdk2413.c - (C) 2006 Simtec Electronics
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <linux/mtd/partitions.h>
-#include <linux/memblock.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/setup.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-lcd.h>
-
-#include <mach/fb.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-static struct map_desc vstms_iodesc[] __initdata = {
-};
-
-static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       }
-};
-
-static struct mtd_partition __initdata vstms_nand_part[] = {
-       [0] = {
-               .name   = "Boot Agent",
-               .size   = 0x7C000,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "UBoot Config",
-               .offset = 0x7C000,
-               .size   = 0x4000,
-       },
-       [2] = {
-               .name   = "Kernel",
-               .offset = 0x80000,
-               .size   = 0x200000,
-       },
-       [3] = {
-               .name   = "RFS",
-               .offset = 0x280000,
-               .size   = 0x3d80000,
-       },
-};
-
-static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
-       [0] = {
-               .name           = "NAND",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(vstms_nand_part),
-               .partitions     = vstms_nand_part,
-       },
-};
-
-/* choose a set of timings which should suit most 512Mbit
- * chips and beyond.
-*/
-
-static struct s3c2410_platform_nand __initdata vstms_nand_info = {
-       .tacls          = 20,
-       .twrph0         = 60,
-       .twrph1         = 20,
-       .nr_sets        = ARRAY_SIZE(vstms_nand_sets),
-       .sets           = vstms_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-static struct platform_device *vstms_devices[] __initdata = {
-       &s3c_device_ohci,
-       &s3c_device_wdt,
-       &s3c_device_i2c0,
-       &s3c_device_iis,
-       &s3c_device_rtc,
-       &s3c_device_nand,
-       &s3c2412_device_dma,
-};
-
-static void __init vstms_fixup(struct tag *tags, char **cmdline)
-{
-       if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
-               memblock_add(0x30000000, SZ_64M);
-       }
-}
-
-static void __init vstms_map_io(void)
-{
-       s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
-       s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init vstms_init_time(void)
-{
-       s3c2412_init_clocks(12000000);
-       samsung_timer_init();
-}
-
-static void __init vstms_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       s3c_nand_set_platdata(&vstms_nand_info);
-
-       platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
-}
-
-MACHINE_START(VSTMS, "VSTMS")
-       .atag_offset    = 0x100,
-
-       .fixup          = vstms_fixup,
-       .init_irq       = s3c2412_init_irq,
-       .init_machine   = vstms_init,
-       .map_io         = vstms_map_io,
-       .init_time      = vstms_init_time,
-MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/nand-core.h b/arch/arm/mach-s3c24xx/nand-core.h
deleted file mode 100644 (file)
index 8de633d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * S3C -  Nand Controller core functions
- */
-
-#ifndef __ASM_ARCH_NAND_CORE_H
-#define __ASM_ARCH_NAND_CORE_H __FILE__
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
- */
-
-/* re-define device name depending on support. */
-static inline void s3c_nand_setname(char *name)
-{
-#ifdef CONFIG_S3C_DEV_NAND
-       s3c_device_nand.name = name;
-#endif
-}
-
-#endif /* __ASM_ARCH_NAND_CORE_H */
diff --git a/arch/arm/mach-s3c24xx/osiris.h b/arch/arm/mach-s3c24xx/osiris.h
deleted file mode 100644 (file)
index b6c9c5e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2005 Simtec Electronics
- *     http://www.simtec.co.uk/products/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * OSIRIS - CPLD control constants
- * OSIRIS - Memory map definitions
- */
-
-#ifndef __MACH_S3C24XX_OSIRIS_H
-#define __MACH_S3C24XX_OSIRIS_H __FILE__
-
-/* CTRL0 - NAND WP control */
-
-#define OSIRIS_CTRL0_NANDSEL           (0x3)
-#define OSIRIS_CTRL0_BOOT_INT          (1<<3)
-#define OSIRIS_CTRL0_PCMCIA            (1<<4)
-#define OSIRIS_CTRL0_FIX8              (1<<5)
-#define OSIRIS_CTRL0_PCMCIA_nWAIT      (1<<6)
-#define OSIRIS_CTRL0_PCMCIA_nIOIS16    (1<<7)
-
-#define OSIRIS_CTRL1_FIX8              (1<<0)
-
-#define OSIRIS_ID_REVMASK              (0x7)
-
-/* start peripherals off after the S3C2410 */
-
-#define OSIRIS_IOADDR(x)       (S3C2410_ADDR((x) + 0x04000000))
-
-#define OSIRIS_PA_CPLD         (S3C2410_CS1 | (1<<26))
-
-/* we put the CPLD registers next, to get them out of the way */
-
-#define OSIRIS_VA_CTRL0                OSIRIS_IOADDR(0x00000000)
-#define OSIRIS_PA_CTRL0                (OSIRIS_PA_CPLD)
-
-#define OSIRIS_VA_CTRL1                OSIRIS_IOADDR(0x00100000)
-#define OSIRIS_PA_CTRL1                (OSIRIS_PA_CPLD + (1<<23))
-
-#define OSIRIS_VA_CTRL2                OSIRIS_IOADDR(0x00200000)
-#define OSIRIS_PA_CTRL2                (OSIRIS_PA_CPLD + (2<<23))
-
-#define OSIRIS_VA_CTRL3                OSIRIS_IOADDR(0x00300000)
-#define OSIRIS_PA_CTRL3                (OSIRIS_PA_CPLD + (2<<23))
-
-#define OSIRIS_VA_IDREG                OSIRIS_IOADDR(0x00700000)
-#define OSIRIS_PA_IDREG                (OSIRIS_PA_CPLD + (7<<23))
-
-#endif /* __MACH_S3C24XX_OSIRIS_H */
diff --git a/arch/arm/mach-s3c24xx/otom.h b/arch/arm/mach-s3c24xx/otom.h
deleted file mode 100644 (file)
index c800f67..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * (c) 2005 Guillaume GOURAT / NexVision
- *          guillaume.gourat@nexvision.fr
- *
- * NexVision OTOM board memory map definitions
- */
-
-/*
- * ok, we've used up to 0x01300000, now we need to find space for the
- * peripherals that live in the nGCS[x] areas, which are quite numerous
- * in their space.
- */
-
-#ifndef __MACH_S3C24XX_OTOM_H
-#define __MACH_S3C24XX_OTOM_H __FILE__
-
-#define OTOM_PA_CS8900A_BASE   (S3C2410_CS3 + 0x01000000)      /* nGCS3 +0x01000000 */
-#define OTOM_VA_CS8900A_BASE   S3C2410_ADDR(0x04000000)        /* 0xF4000000 */
-
-/* physical offset addresses for the peripherals */
-
-#define OTOM_PA_FLASH0_BASE    (S3C2410_CS0)
-
-#endif /* __MACH_S3C24XX_OTOM_H */
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2410.c b/arch/arm/mach-s3c24xx/pll-s3c2410.c
deleted file mode 100644 (file)
index 0561f79..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2006-2007 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//     Vincent Sanders <vince@arm.linux.org.uk>
-//
-// S3C2410 CPU PLL tables
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/device.h>
-#include <linux/list.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
-
-/* This array should be sorted in ascending order of the frequencies */
-static struct cpufreq_frequency_table pll_vals_12MHz[] = {
-    { .frequency = 34000000,  .driver_data = PLLVAL(82, 2, 3),   },
-    { .frequency = 45000000,  .driver_data = PLLVAL(82, 1, 3),   },
-    { .frequency = 48000000,  .driver_data = PLLVAL(120, 2, 3),  },
-    { .frequency = 51000000,  .driver_data = PLLVAL(161, 3, 3),  },
-    { .frequency = 56000000,  .driver_data = PLLVAL(142, 2, 3),  },
-    { .frequency = 68000000,  .driver_data = PLLVAL(82, 2, 2),   },
-    { .frequency = 79000000,  .driver_data = PLLVAL(71, 1, 2),   },
-    { .frequency = 85000000,  .driver_data = PLLVAL(105, 2, 2),  },
-    { .frequency = 90000000,  .driver_data = PLLVAL(112, 2, 2),  },
-    { .frequency = 101000000, .driver_data = PLLVAL(127, 2, 2),  },
-    { .frequency = 113000000, .driver_data = PLLVAL(105, 1, 2),  },
-    { .frequency = 118000000, .driver_data = PLLVAL(150, 2, 2),  },
-    { .frequency = 124000000, .driver_data = PLLVAL(116, 1, 2),  },
-    { .frequency = 135000000, .driver_data = PLLVAL(82, 2, 1),   },
-    { .frequency = 147000000, .driver_data = PLLVAL(90, 2, 1),   },
-    { .frequency = 152000000, .driver_data = PLLVAL(68, 1, 1),   },
-    { .frequency = 158000000, .driver_data = PLLVAL(71, 1, 1),   },
-    { .frequency = 170000000, .driver_data = PLLVAL(77, 1, 1),   },
-    { .frequency = 180000000, .driver_data = PLLVAL(82, 1, 1),   },
-    { .frequency = 186000000, .driver_data = PLLVAL(85, 1, 1),   },
-    { .frequency = 192000000, .driver_data = PLLVAL(88, 1, 1),   },
-    { .frequency = 203000000, .driver_data = PLLVAL(161, 3, 1),  },
-
-    /* 2410A extras */
-
-    { .frequency = 210000000, .driver_data = PLLVAL(132, 2, 1),  },
-    { .frequency = 226000000, .driver_data = PLLVAL(105, 1, 1),  },
-    { .frequency = 266000000, .driver_data = PLLVAL(125, 1, 1),  },
-    { .frequency = 268000000, .driver_data = PLLVAL(126, 1, 1),  },
-    { .frequency = 270000000, .driver_data = PLLVAL(127, 1, 1),  },
-};
-
-static int s3c2410_plls_add(struct device *dev, struct subsys_interface *sif)
-{
-       return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz));
-}
-
-static struct subsys_interface s3c2410_plls_interface = {
-       .name           = "s3c2410_plls",
-       .subsys         = &s3c2410_subsys,
-       .add_dev        = s3c2410_plls_add,
-};
-
-static int __init s3c2410_pll_init(void)
-{
-       return subsys_interface_register(&s3c2410_plls_interface);
-
-}
-arch_initcall(s3c2410_pll_init);
-
-static struct subsys_interface s3c2410a_plls_interface = {
-       .name           = "s3c2410a_plls",
-       .subsys         = &s3c2410a_subsys,
-       .add_dev        = s3c2410_plls_add,
-};
-
-static int __init s3c2410a_pll_init(void)
-{
-       return subsys_interface_register(&s3c2410a_plls_interface);
-}
-arch_initcall(s3c2410a_pll_init);
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c b/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c
deleted file mode 100644 (file)
index 2ec3a2f..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006-2007 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//     Vincent Sanders <vince@arm.linux.org.uk>
-//
-// S3C2440/S3C2442 CPU PLL tables (12MHz Crystal)
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
-
-/* This array should be sorted in ascending order of the frequencies */
-static struct cpufreq_frequency_table s3c2440_plls_12[] = {
-       { .frequency = 75000000,        .driver_data = PLLVAL(0x75, 3, 3),  },  /* FVco 600.000000 */
-       { .frequency = 80000000,        .driver_data = PLLVAL(0x98, 4, 3),  },  /* FVco 640.000000 */
-       { .frequency = 90000000,        .driver_data = PLLVAL(0x70, 2, 3),  },  /* FVco 720.000000 */
-       { .frequency = 100000000,       .driver_data = PLLVAL(0x5c, 1, 3),  },  /* FVco 800.000000 */
-       { .frequency = 110000000,       .driver_data = PLLVAL(0x66, 1, 3),  },  /* FVco 880.000000 */
-       { .frequency = 120000000,       .driver_data = PLLVAL(0x70, 1, 3),  },  /* FVco 960.000000 */
-       { .frequency = 150000000,       .driver_data = PLLVAL(0x75, 3, 2),  },  /* FVco 600.000000 */
-       { .frequency = 160000000,       .driver_data = PLLVAL(0x98, 4, 2),  },  /* FVco 640.000000 */
-       { .frequency = 170000000,       .driver_data = PLLVAL(0x4d, 1, 2),  },  /* FVco 680.000000 */
-       { .frequency = 180000000,       .driver_data = PLLVAL(0x70, 2, 2),  },  /* FVco 720.000000 */
-       { .frequency = 190000000,       .driver_data = PLLVAL(0x57, 1, 2),  },  /* FVco 760.000000 */
-       { .frequency = 200000000,       .driver_data = PLLVAL(0x5c, 1, 2),  },  /* FVco 800.000000 */
-       { .frequency = 210000000,       .driver_data = PLLVAL(0x84, 2, 2),  },  /* FVco 840.000000 */
-       { .frequency = 220000000,       .driver_data = PLLVAL(0x66, 1, 2),  },  /* FVco 880.000000 */
-       { .frequency = 230000000,       .driver_data = PLLVAL(0x6b, 1, 2),  },  /* FVco 920.000000 */
-       { .frequency = 240000000,       .driver_data = PLLVAL(0x70, 1, 2),  },  /* FVco 960.000000 */
-       { .frequency = 300000000,       .driver_data = PLLVAL(0x75, 3, 1),  },  /* FVco 600.000000 */
-       { .frequency = 310000000,       .driver_data = PLLVAL(0x93, 4, 1),  },  /* FVco 620.000000 */
-       { .frequency = 320000000,       .driver_data = PLLVAL(0x98, 4, 1),  },  /* FVco 640.000000 */
-       { .frequency = 330000000,       .driver_data = PLLVAL(0x66, 2, 1),  },  /* FVco 660.000000 */
-       { .frequency = 340000000,       .driver_data = PLLVAL(0x4d, 1, 1),  },  /* FVco 680.000000 */
-       { .frequency = 350000000,       .driver_data = PLLVAL(0xa7, 4, 1),  },  /* FVco 700.000000 */
-       { .frequency = 360000000,       .driver_data = PLLVAL(0x70, 2, 1),  },  /* FVco 720.000000 */
-       { .frequency = 370000000,       .driver_data = PLLVAL(0xb1, 4, 1),  },  /* FVco 740.000000 */
-       { .frequency = 380000000,       .driver_data = PLLVAL(0x57, 1, 1),  },  /* FVco 760.000000 */
-       { .frequency = 390000000,       .driver_data = PLLVAL(0x7a, 2, 1),  },  /* FVco 780.000000 */
-       { .frequency = 400000000,       .driver_data = PLLVAL(0x5c, 1, 1),  },  /* FVco 800.000000 */
-};
-
-static int s3c2440_plls12_add(struct device *dev, struct subsys_interface *sif)
-{
-       struct clk *xtal_clk;
-       unsigned long xtal;
-
-       xtal_clk = clk_get(NULL, "xtal");
-       if (IS_ERR(xtal_clk))
-               return PTR_ERR(xtal_clk);
-
-       xtal = clk_get_rate(xtal_clk);
-       clk_put(xtal_clk);
-
-       if (xtal == 12000000) {
-               printk(KERN_INFO "Using PLL table for 12MHz crystal\n");
-               return s3c_plltab_register(s3c2440_plls_12,
-                                          ARRAY_SIZE(s3c2440_plls_12));
-       }
-
-       return 0;
-}
-
-static struct subsys_interface s3c2440_plls12_interface = {
-       .name           = "s3c2440_plls12",
-       .subsys         = &s3c2440_subsys,
-       .add_dev        = s3c2440_plls12_add,
-};
-
-static int __init s3c2440_pll_12mhz(void)
-{
-       return subsys_interface_register(&s3c2440_plls12_interface);
-
-}
-arch_initcall(s3c2440_pll_12mhz);
-
-static struct subsys_interface s3c2442_plls12_interface = {
-       .name           = "s3c2442_plls12",
-       .subsys         = &s3c2442_subsys,
-       .add_dev        = s3c2440_plls12_add,
-};
-
-static int __init s3c2442_pll_12mhz(void)
-{
-       return subsys_interface_register(&s3c2442_plls12_interface);
-
-}
-arch_initcall(s3c2442_pll_12mhz);
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c b/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c
deleted file mode 100644 (file)
index 4b3d9e3..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006-2008 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//     Vincent Sanders <vince@arm.linux.org.uk>
-//
-// S3C2440/S3C2442 CPU PLL tables (16.93444MHz Crystal)
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
-
-/* This array should be sorted in ascending order of the frequencies */
-static struct cpufreq_frequency_table s3c2440_plls_169344[] = {
-       { .frequency = 78019200,        .driver_data = PLLVAL(121, 5, 3),       },      /* FVco 624.153600 */
-       { .frequency = 84067200,        .driver_data = PLLVAL(131, 5, 3),       },      /* FVco 672.537600 */
-       { .frequency = 90115200,        .driver_data = PLLVAL(141, 5, 3),       },      /* FVco 720.921600 */
-       { .frequency = 96163200,        .driver_data = PLLVAL(151, 5, 3),       },      /* FVco 769.305600 */
-       { .frequency = 102135600,       .driver_data = PLLVAL(185, 6, 3),       },      /* FVco 817.084800 */
-       { .frequency = 108259200,       .driver_data = PLLVAL(171, 5, 3),       },      /* FVco 866.073600 */
-       { .frequency = 114307200,       .driver_data = PLLVAL(127, 3, 3),       },      /* FVco 914.457600 */
-       { .frequency = 120234240,       .driver_data = PLLVAL(134, 3, 3),       },      /* FVco 961.873920 */
-       { .frequency = 126161280,       .driver_data = PLLVAL(141, 3, 3),       },      /* FVco 1009.290240 */
-       { .frequency = 132088320,       .driver_data = PLLVAL(148, 3, 3),       },      /* FVco 1056.706560 */
-       { .frequency = 138015360,       .driver_data = PLLVAL(155, 3, 3),       },      /* FVco 1104.122880 */
-       { .frequency = 144789120,       .driver_data = PLLVAL(163, 3, 3),       },      /* FVco 1158.312960 */
-       { .frequency = 150100363,       .driver_data = PLLVAL(187, 9, 2),       },      /* FVco 600.401454 */
-       { .frequency = 156038400,       .driver_data = PLLVAL(121, 5, 2),       },      /* FVco 624.153600 */
-       { .frequency = 162086400,       .driver_data = PLLVAL(126, 5, 2),       },      /* FVco 648.345600 */
-       { .frequency = 168134400,       .driver_data = PLLVAL(131, 5, 2),       },      /* FVco 672.537600 */
-       { .frequency = 174048000,       .driver_data = PLLVAL(177, 7, 2),       },      /* FVco 696.192000 */
-       { .frequency = 180230400,       .driver_data = PLLVAL(141, 5, 2),       },      /* FVco 720.921600 */
-       { .frequency = 186278400,       .driver_data = PLLVAL(124, 4, 2),       },      /* FVco 745.113600 */
-       { .frequency = 192326400,       .driver_data = PLLVAL(151, 5, 2),       },      /* FVco 769.305600 */
-       { .frequency = 198132480,       .driver_data = PLLVAL(109, 3, 2),       },      /* FVco 792.529920 */
-       { .frequency = 204271200,       .driver_data = PLLVAL(185, 6, 2),       },      /* FVco 817.084800 */
-       { .frequency = 210268800,       .driver_data = PLLVAL(141, 4, 2),       },      /* FVco 841.075200 */
-       { .frequency = 216518400,       .driver_data = PLLVAL(171, 5, 2),       },      /* FVco 866.073600 */
-       { .frequency = 222264000,       .driver_data = PLLVAL(97, 2, 2),        },      /* FVco 889.056000 */
-       { .frequency = 228614400,       .driver_data = PLLVAL(127, 3, 2),       },      /* FVco 914.457600 */
-       { .frequency = 234259200,       .driver_data = PLLVAL(158, 4, 2),       },      /* FVco 937.036800 */
-       { .frequency = 240468480,       .driver_data = PLLVAL(134, 3, 2),       },      /* FVco 961.873920 */
-       { .frequency = 246960000,       .driver_data = PLLVAL(167, 4, 2),       },      /* FVco 987.840000 */
-       { .frequency = 252322560,       .driver_data = PLLVAL(141, 3, 2),       },      /* FVco 1009.290240 */
-       { .frequency = 258249600,       .driver_data = PLLVAL(114, 2, 2),       },      /* FVco 1032.998400 */
-       { .frequency = 264176640,       .driver_data = PLLVAL(148, 3, 2),       },      /* FVco 1056.706560 */
-       { .frequency = 270950400,       .driver_data = PLLVAL(120, 2, 2),       },      /* FVco 1083.801600 */
-       { .frequency = 276030720,       .driver_data = PLLVAL(155, 3, 2),       },      /* FVco 1104.122880 */
-       { .frequency = 282240000,       .driver_data = PLLVAL(92, 1, 2),        },      /* FVco 1128.960000 */
-       { .frequency = 289578240,       .driver_data = PLLVAL(163, 3, 2),       },      /* FVco 1158.312960 */
-       { .frequency = 294235200,       .driver_data = PLLVAL(131, 2, 2),       },      /* FVco 1176.940800 */
-       { .frequency = 300200727,       .driver_data = PLLVAL(187, 9, 1),       },      /* FVco 600.401454 */
-       { .frequency = 306358690,       .driver_data = PLLVAL(191, 9, 1),       },      /* FVco 612.717380 */
-       { .frequency = 312076800,       .driver_data = PLLVAL(121, 5, 1),       },      /* FVco 624.153600 */
-       { .frequency = 318366720,       .driver_data = PLLVAL(86, 3, 1),        },      /* FVco 636.733440 */
-       { .frequency = 324172800,       .driver_data = PLLVAL(126, 5, 1),       },      /* FVco 648.345600 */
-       { .frequency = 330220800,       .driver_data = PLLVAL(109, 4, 1),       },      /* FVco 660.441600 */
-       { .frequency = 336268800,       .driver_data = PLLVAL(131, 5, 1),       },      /* FVco 672.537600 */
-       { .frequency = 342074880,       .driver_data = PLLVAL(93, 3, 1),        },      /* FVco 684.149760 */
-       { .frequency = 348096000,       .driver_data = PLLVAL(177, 7, 1),       },      /* FVco 696.192000 */
-       { .frequency = 355622400,       .driver_data = PLLVAL(118, 4, 1),       },      /* FVco 711.244800 */
-       { .frequency = 360460800,       .driver_data = PLLVAL(141, 5, 1),       },      /* FVco 720.921600 */
-       { .frequency = 366206400,       .driver_data = PLLVAL(165, 6, 1),       },      /* FVco 732.412800 */
-       { .frequency = 372556800,       .driver_data = PLLVAL(124, 4, 1),       },      /* FVco 745.113600 */
-       { .frequency = 378201600,       .driver_data = PLLVAL(126, 4, 1),       },      /* FVco 756.403200 */
-       { .frequency = 384652800,       .driver_data = PLLVAL(151, 5, 1),       },      /* FVco 769.305600 */
-       { .frequency = 391608000,       .driver_data = PLLVAL(177, 6, 1),       },      /* FVco 783.216000 */
-       { .frequency = 396264960,       .driver_data = PLLVAL(109, 3, 1),       },      /* FVco 792.529920 */
-       { .frequency = 402192000,       .driver_data = PLLVAL(87, 2, 1),        },      /* FVco 804.384000 */
-};
-
-static int s3c2440_plls169344_add(struct device *dev,
-                                 struct subsys_interface *sif)
-{
-       struct clk *xtal_clk;
-       unsigned long xtal;
-
-       xtal_clk = clk_get(NULL, "xtal");
-       if (IS_ERR(xtal_clk))
-               return PTR_ERR(xtal_clk);
-
-       xtal = clk_get_rate(xtal_clk);
-       clk_put(xtal_clk);
-
-       if (xtal == 169344000) {
-               printk(KERN_INFO "Using PLL table for 16.9344MHz crystal\n");
-               return s3c_plltab_register(s3c2440_plls_169344,
-                                          ARRAY_SIZE(s3c2440_plls_169344));
-       }
-
-       return 0;
-}
-
-static struct subsys_interface s3c2440_plls169344_interface = {
-       .name           = "s3c2440_plls169344",
-       .subsys         = &s3c2440_subsys,
-       .add_dev        = s3c2440_plls169344_add,
-};
-
-static int __init s3c2440_pll_16934400(void)
-{
-       return subsys_interface_register(&s3c2440_plls169344_interface);
-}
-arch_initcall(s3c2440_pll_16934400);
-
-static struct subsys_interface s3c2442_plls169344_interface = {
-       .name           = "s3c2442_plls169344",
-       .subsys         = &s3c2442_subsys,
-       .add_dev        = s3c2440_plls169344_add,
-};
-
-static int __init s3c2442_pll_16934400(void)
-{
-       return subsys_interface_register(&s3c2442_plls169344_interface);
-}
-arch_initcall(s3c2442_pll_16934400);
diff --git a/arch/arm/mach-s3c24xx/pm-h1940.S b/arch/arm/mach-s3c24xx/pm-h1940.S
deleted file mode 100644 (file)
index a7bbe33..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2006 Ben Dooks <ben-linux@fluff.org>
- *
- * H1940 Suspend to RAM
- */
-
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <mach/regs-gpio.h>
-
-       .text
-       .global h1940_pm_return
-
-h1940_pm_return:
-       mov     r0, #S3C2410_PA_GPIO
-       ldr     pc, [r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO]
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2410.c b/arch/arm/mach-s3c24xx/pm-s3c2410.c
deleted file mode 100644 (file)
index 2d8ea70..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2006 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C2410 (and compatible) Power Manager (Suspend-To-RAM) support
-
-#include <linux/init.h>
-#include <linux/suspend.h>
-#include <linux/errno.h>
-#include <linux/time.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/gpio.h>
-#include <linux/io.h>
-
-#include <asm/mach-types.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-#include "h1940.h"
-
-static void s3c2410_pm_prepare(void)
-{
-       /* ensure at least GSTATUS3 has the resume address */
-
-       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2410_GSTATUS3);
-
-       S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3));
-       S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4));
-
-       if (machine_is_h1940()) {
-               void *base = phys_to_virt(H1940_SUSPEND_CHECK);
-               unsigned long ptr;
-               unsigned long calc = 0;
-
-               /* generate check for the bootloader to check on resume */
-
-               for (ptr = 0; ptr < 0x40000; ptr += 0x400)
-                       calc += __raw_readl(base+ptr);
-
-               __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM));
-       }
-
-       /* RX3715 and RX1950 use similar to H1940 code and the
-        * same offsets for resume and checksum pointers */
-
-       if (machine_is_rx3715() || machine_is_rx1950()) {
-               void *base = phys_to_virt(H1940_SUSPEND_CHECK);
-               unsigned long ptr;
-               unsigned long calc = 0;
-
-               /* generate check for the bootloader to check on resume */
-
-               for (ptr = 0; ptr < 0x40000; ptr += 0x4)
-                       calc += __raw_readl(base+ptr);
-
-               __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM));
-       }
-
-       if (machine_is_aml_m5900()) {
-               gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_HIGH, NULL);
-               gpio_free(S3C2410_GPF(2));
-       }
-
-       if (machine_is_rx1950()) {
-               /* According to S3C2442 user's manual, page 7-17,
-                * when the system is operating in NAND boot mode,
-                * the hardware pin configuration - EINT[23:21] â€“
-                * must be set as input for starting up after
-                * wakeup from sleep mode
-                */
-               s3c_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_INPUT);
-               s3c_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPIO_INPUT);
-               s3c_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPIO_INPUT);
-       }
-}
-
-static void s3c2410_pm_resume(void)
-{
-       unsigned long tmp;
-
-       /* unset the return-from-sleep flag, to ensure reset */
-
-       tmp = __raw_readl(S3C2410_GSTATUS2);
-       tmp &= S3C2410_GSTATUS2_OFFRESET;
-       __raw_writel(tmp, S3C2410_GSTATUS2);
-
-       if (machine_is_aml_m5900()) {
-               gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL);
-               gpio_free(S3C2410_GPF(2));
-       }
-}
-
-struct syscore_ops s3c2410_pm_syscore_ops = {
-       .resume         = s3c2410_pm_resume,
-};
-
-static int s3c2410_pm_add(struct device *dev, struct subsys_interface *sif)
-{
-       pm_cpu_prep = s3c2410_pm_prepare;
-       pm_cpu_sleep = s3c2410_cpu_suspend;
-
-       return 0;
-}
-
-#if defined(CONFIG_CPU_S3C2410)
-static struct subsys_interface s3c2410_pm_interface = {
-       .name           = "s3c2410_pm",
-       .subsys         = &s3c2410_subsys,
-       .add_dev        = s3c2410_pm_add,
-};
-
-/* register ourselves */
-
-static int __init s3c2410_pm_drvinit(void)
-{
-       return subsys_interface_register(&s3c2410_pm_interface);
-}
-
-arch_initcall(s3c2410_pm_drvinit);
-
-static struct subsys_interface s3c2410a_pm_interface = {
-       .name           = "s3c2410a_pm",
-       .subsys         = &s3c2410a_subsys,
-       .add_dev        = s3c2410_pm_add,
-};
-
-static int __init s3c2410a_pm_drvinit(void)
-{
-       return subsys_interface_register(&s3c2410a_pm_interface);
-}
-
-arch_initcall(s3c2410a_pm_drvinit);
-#endif
-
-#if defined(CONFIG_CPU_S3C2440)
-static struct subsys_interface s3c2440_pm_interface = {
-       .name           = "s3c2440_pm",
-       .subsys         = &s3c2440_subsys,
-       .add_dev        = s3c2410_pm_add,
-};
-
-static int __init s3c2440_pm_drvinit(void)
-{
-       return subsys_interface_register(&s3c2440_pm_interface);
-}
-
-arch_initcall(s3c2440_pm_drvinit);
-#endif
-
-#if defined(CONFIG_CPU_S3C2442)
-static struct subsys_interface s3c2442_pm_interface = {
-       .name           = "s3c2442_pm",
-       .subsys         = &s3c2442_subsys,
-       .add_dev        = s3c2410_pm_add,
-};
-
-static int __init s3c2442_pm_drvinit(void)
-{
-       return subsys_interface_register(&s3c2442_pm_interface);
-}
-
-arch_initcall(s3c2442_pm_drvinit);
-#endif
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c
deleted file mode 100644 (file)
index 2dfdaab..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://armlinux.simtec.co.uk/.
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <asm/cacheflush.h>
-#include <asm/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-
-#include <plat/cpu.h>
-#include <plat/pm.h>
-#include <plat/wakeup-mask.h>
-
-#include "regs-dsc.h"
-#include "s3c2412-power.h"
-
-extern void s3c2412_sleep_enter(void);
-
-static int s3c2412_cpu_suspend(unsigned long arg)
-{
-       unsigned long tmp;
-
-       /* set our standby method to sleep */
-
-       tmp = __raw_readl(S3C2412_PWRCFG);
-       tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP;
-       __raw_writel(tmp, S3C2412_PWRCFG);
-
-       s3c2412_sleep_enter();
-
-       pr_info("Failed to suspend the system\n");
-       return 1; /* Aborting suspend */
-}
-
-/* mapping of interrupts to parts of the wakeup mask */
-static const struct samsung_wakeup_mask wake_irqs[] = {
-       { .irq = IRQ_RTC,       .bit = S3C2412_PWRCFG_RTC_MASKIRQ, },
-};
-
-static void s3c2412_pm_prepare(void)
-{
-       samsung_sync_wakemask(S3C2412_PWRCFG,
-                             wake_irqs, ARRAY_SIZE(wake_irqs));
-}
-
-static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif)
-{
-       pm_cpu_prep = s3c2412_pm_prepare;
-       pm_cpu_sleep = s3c2412_cpu_suspend;
-
-       return 0;
-}
-
-static struct sleep_save s3c2412_sleep[] = {
-       SAVE_ITEM(S3C2412_DSC0),
-       SAVE_ITEM(S3C2412_DSC1),
-       SAVE_ITEM(S3C2413_GPJDAT),
-       SAVE_ITEM(S3C2413_GPJCON),
-       SAVE_ITEM(S3C2413_GPJUP),
-
-       /* save the PWRCFG to get back to original sleep method */
-
-       SAVE_ITEM(S3C2412_PWRCFG),
-
-       /* save the sleep configuration anyway, just in case these
-        * get damaged during wakeup */
-
-       SAVE_ITEM(S3C2412_GPBSLPCON),
-       SAVE_ITEM(S3C2412_GPCSLPCON),
-       SAVE_ITEM(S3C2412_GPDSLPCON),
-       SAVE_ITEM(S3C2412_GPFSLPCON),
-       SAVE_ITEM(S3C2412_GPGSLPCON),
-       SAVE_ITEM(S3C2412_GPHSLPCON),
-       SAVE_ITEM(S3C2413_GPJSLPCON),
-};
-
-static struct subsys_interface s3c2412_pm_interface = {
-       .name           = "s3c2412_pm",
-       .subsys         = &s3c2412_subsys,
-       .add_dev        = s3c2412_pm_add,
-};
-
-static __init int s3c2412_pm_init(void)
-{
-       return subsys_interface_register(&s3c2412_pm_interface);
-}
-
-arch_initcall(s3c2412_pm_init);
-
-static int s3c2412_pm_suspend(void)
-{
-       s3c_pm_do_save(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
-       return 0;
-}
-
-static void s3c2412_pm_resume(void)
-{
-       unsigned long tmp;
-
-       tmp = __raw_readl(S3C2412_PWRCFG);
-       tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
-       tmp |=  S3C2412_PWRCFG_STANDBYWFI_IDLE;
-       __raw_writel(tmp, S3C2412_PWRCFG);
-
-       s3c_pm_do_restore(s3c2412_sleep, ARRAY_SIZE(s3c2412_sleep));
-}
-
-struct syscore_ops s3c2412_pm_syscore_ops = {
-       .suspend        = s3c2412_pm_suspend,
-       .resume         = s3c2412_pm_resume,
-};
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2416.c b/arch/arm/mach-s3c24xx/pm-s3c2416.c
deleted file mode 100644 (file)
index 9a2f05e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2010 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com
-//
-// S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support)
-
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/io.h>
-
-#include <asm/cacheflush.h>
-
-#include <mach/regs-s3c2443-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-#include "s3c2412-power.h"
-
-#ifdef CONFIG_PM_SLEEP
-extern void s3c2412_sleep_enter(void);
-
-static int s3c2416_cpu_suspend(unsigned long arg)
-{
-       /* enable wakeup sources regardless of battery state */
-       __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
-
-       /* set the mode as sleep, 2BED represents "Go to BED" */
-       __raw_writel(0x2BED, S3C2443_PWRMODE);
-
-       s3c2412_sleep_enter();
-
-       pr_info("Failed to suspend the system\n");
-       return 1; /* Aborting suspend */
-}
-
-static void s3c2416_pm_prepare(void)
-{
-       /*
-        * write the magic value u-boot uses to check for resume into
-        * the INFORM0 register, and ensure INFORM1 is set to the
-        * correct address to resume from.
-        */
-       __raw_writel(0x2BED, S3C2412_INFORM0);
-       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
-}
-
-static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif)
-{
-       pm_cpu_prep = s3c2416_pm_prepare;
-       pm_cpu_sleep = s3c2416_cpu_suspend;
-
-       return 0;
-}
-
-static struct subsys_interface s3c2416_pm_interface = {
-       .name           = "s3c2416_pm",
-       .subsys         = &s3c2416_subsys,
-       .add_dev        = s3c2416_pm_add,
-};
-
-static __init int s3c2416_pm_init(void)
-{
-       return subsys_interface_register(&s3c2416_pm_interface);
-}
-
-arch_initcall(s3c2416_pm_init);
-#endif
-
-static void s3c2416_pm_resume(void)
-{
-       /* unset the return-from-sleep amd inform flags */
-       __raw_writel(0x0, S3C2443_PWRMODE);
-       __raw_writel(0x0, S3C2412_INFORM0);
-       __raw_writel(0x0, S3C2412_INFORM1);
-}
-
-struct syscore_ops s3c2416_pm_syscore_ops = {
-       .resume         = s3c2416_pm_resume,
-};
diff --git a/arch/arm/mach-s3c24xx/pm.c b/arch/arm/mach-s3c24xx/pm.c
deleted file mode 100644 (file)
index c64988c..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2004-2006 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C24XX Power Manager (Suspend-To-RAM) support
-//
-// See Documentation/arm/samsung-s3c24xx/suspend.rst for more information
-//
-// Parts based on arch/arm/mach-pxa/pm.c
-//
-// Thanks to Dimitry Andric for debugging
-
-#include <linux/init.h>
-#include <linux/suspend.h>
-#include <linux/errno.h>
-#include <linux/time.h>
-#include <linux/gpio.h>
-#include <linux/interrupt.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/io.h>
-
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-#include <mach/regs-irq.h>
-#include <mach/gpio-samsung.h>
-
-#include <asm/mach/time.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/pm.h>
-
-#include "regs-mem.h"
-
-#define PFX "s3c24xx-pm: "
-
-#ifdef CONFIG_PM_SLEEP
-static struct sleep_save core_save[] = {
-       /* we restore the timings here, with the proviso that the board
-        * brings the system up in an slower, or equal frequency setting
-        * to the original system.
-        *
-        * if we cannot guarantee this, then things are going to go very
-        * wrong here, as we modify the refresh and both pll settings.
-        */
-
-       SAVE_ITEM(S3C2410_BWSCON),
-       SAVE_ITEM(S3C2410_BANKCON0),
-       SAVE_ITEM(S3C2410_BANKCON1),
-       SAVE_ITEM(S3C2410_BANKCON2),
-       SAVE_ITEM(S3C2410_BANKCON3),
-       SAVE_ITEM(S3C2410_BANKCON4),
-       SAVE_ITEM(S3C2410_BANKCON5),
-};
-#endif
-
-/* s3c_pm_check_resume_pin
- *
- * check to see if the pin is configured correctly for sleep mode, and
- * make any necessary adjustments if it is not
-*/
-
-static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
-{
-       unsigned long irqstate;
-       unsigned long pinstate;
-       int irq = gpio_to_irq(pin);
-
-       if (irqoffs < 4)
-               irqstate = s3c_irqwake_intmask & (1L<<irqoffs);
-       else
-               irqstate = s3c_irqwake_eintmask & (1L<<irqoffs);
-
-       pinstate = s3c_gpio_getcfg(pin);
-
-       if (!irqstate) {
-               if (pinstate == S3C2410_GPIO_IRQ)
-                       S3C_PMDBG("Leaving IRQ %d (pin %d) as is\n", irq, pin);
-       } else {
-               if (pinstate == S3C2410_GPIO_IRQ) {
-                       S3C_PMDBG("Disabling IRQ %d (pin %d)\n", irq, pin);
-                       s3c_gpio_cfgpin(pin, S3C2410_GPIO_INPUT);
-               }
-       }
-}
-
-/* s3c_pm_configure_extint
- *
- * configure all external interrupt pins
-*/
-
-void s3c_pm_configure_extint(void)
-{
-       int pin;
-
-       /* for each of the external interrupts (EINT0..EINT15) we
-        * need to check whether it is an external interrupt source,
-        * and then configure it as an input if it is not
-       */
-
-       for (pin = S3C2410_GPF(0); pin <= S3C2410_GPF(7); pin++) {
-               s3c_pm_check_resume_pin(pin, pin - S3C2410_GPF(0));
-       }
-
-       for (pin = S3C2410_GPG(0); pin <= S3C2410_GPG(7); pin++) {
-               s3c_pm_check_resume_pin(pin, (pin - S3C2410_GPG(0))+8);
-       }
-}
-
-#ifdef CONFIG_PM_SLEEP
-void s3c_pm_restore_core(void)
-{
-       s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
-}
-
-void s3c_pm_save_core(void)
-{
-       s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
-}
-#endif
diff --git a/arch/arm/mach-s3c24xx/regs-dsc.h b/arch/arm/mach-s3c24xx/regs-dsc.h
deleted file mode 100644 (file)
index b500636..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
- *                   http://www.simtec.co.uk/products/SWLINUX/
- *
- * S3C2440/S3C2412 Signal Drive Strength Control
- */
-
-
-#ifndef __ASM_ARCH_REGS_DSC_H
-#define __ASM_ARCH_REGS_DSC_H __FILE__
-
-/* S3C2412 */
-#define S3C2412_DSC0      S3C2410_GPIOREG(0xdc)
-#define S3C2412_DSC1      S3C2410_GPIOREG(0xe0)
-
-/* S3C2440 */
-#define S3C2440_DSC0      S3C2410_GPIOREG(0xc4)
-#define S3C2440_DSC1      S3C2410_GPIOREG(0xc8)
-
-#endif /* __ASM_ARCH_REGS_DSC_H */
-
diff --git a/arch/arm/mach-s3c24xx/regs-mem.h b/arch/arm/mach-s3c24xx/regs-mem.h
deleted file mode 100644 (file)
index 2f3bc48..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
- *             http://www.simtec.co.uk/products/SWLINUX/
- *
- * S3C2410 Memory Control register definitions
- */
-
-#ifndef __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H
-#define __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H __FILE__
-
-#define S3C2410_MEMREG(x)              (S3C24XX_VA_MEMCTRL + (x))
-
-#define S3C2410_BWSCON                 S3C2410_MEMREG(0x00)
-#define S3C2410_BANKCON0               S3C2410_MEMREG(0x04)
-#define S3C2410_BANKCON1               S3C2410_MEMREG(0x08)
-#define S3C2410_BANKCON2               S3C2410_MEMREG(0x0C)
-#define S3C2410_BANKCON3               S3C2410_MEMREG(0x10)
-#define S3C2410_BANKCON4               S3C2410_MEMREG(0x14)
-#define S3C2410_BANKCON5               S3C2410_MEMREG(0x18)
-#define S3C2410_BANKCON6               S3C2410_MEMREG(0x1C)
-#define S3C2410_BANKCON7               S3C2410_MEMREG(0x20)
-#define S3C2410_REFRESH                        S3C2410_MEMREG(0x24)
-#define S3C2410_BANKSIZE               S3C2410_MEMREG(0x28)
-
-#define S3C2410_BWSCON_ST1             (1 << 7)
-#define S3C2410_BWSCON_ST2             (1 << 11)
-#define S3C2410_BWSCON_ST3             (1 << 15)
-#define S3C2410_BWSCON_ST4             (1 << 19)
-#define S3C2410_BWSCON_ST5             (1 << 23)
-
-#define S3C2410_BWSCON_GET(_bwscon, _bank) (((_bwscon) >> ((_bank) * 4)) & 0xf)
-
-#define S3C2410_BWSCON_WS              (1 << 2)
-
-#define S3C2410_BANKCON_PMC16          (0x3)
-
-#define S3C2410_BANKCON_Tacp_SHIFT     (2)
-#define S3C2410_BANKCON_Tcah_SHIFT     (4)
-#define S3C2410_BANKCON_Tcoh_SHIFT     (6)
-#define S3C2410_BANKCON_Tacc_SHIFT     (8)
-#define S3C2410_BANKCON_Tcos_SHIFT     (11)
-#define S3C2410_BANKCON_Tacs_SHIFT     (13)
-
-#define S3C2410_BANKCON_SDRAM          (0x3 << 15)
-
-#define S3C2410_REFRESH_SELF           (1 << 22)
-
-#define S3C2410_BANKSIZE_MASK          (0x7 << 0)
-
-#endif /* __ARCH_ARM_MACH_S3C24XX_REGS_MEM_H */
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
deleted file mode 100644 (file)
index ed49883..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2003-2005 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://www.simtec.co.uk/products/EB2410ITX/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/clk.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/reboot.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-#include <asm/irq.h>
-#include <asm/system_misc.h>
-
-#include <plat/cpu-freq.h>
-
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-
-#include "common.h"
-
-/* Initial IO mappings */
-
-static struct map_desc s3c2410_iodesc[] __initdata __maybe_unused = {
-       IODESC_ENT(CLKPWR),
-       IODESC_ENT(TIMER),
-       IODESC_ENT(WATCHDOG),
-};
-
-/* our uart devices */
-
-/* uart registration process */
-
-void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
-}
-
-/* s3c2410_map_io
- *
- * register the standard cpu IO areas, and any passed in from the
- * machine specific initialisation.
-*/
-
-void __init s3c2410_map_io(void)
-{
-       s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
-       s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
-
-       iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
-}
-
-struct bus_type s3c2410_subsys = {
-       .name = "s3c2410-core",
-       .dev_name = "s3c2410-core",
-};
-
-/* Note, we would have liked to name this s3c2410-core, but we cannot
- * register two subsystems with the same name.
- */
-struct bus_type s3c2410a_subsys = {
-       .name = "s3c2410a-core",
-       .dev_name = "s3c2410a-core",
-};
-
-static struct device s3c2410_dev = {
-       .bus            = &s3c2410_subsys,
-};
-
-/* need to register the subsystem before we actually register the device, and
- * we also need to ensure that it has been initialised before any of the
- * drivers even try to use it (even if not on an s3c2410 based system)
- * as a driver which may support both 2410 and 2440 may try and use it.
-*/
-
-static int __init s3c2410_core_init(void)
-{
-       return subsys_system_register(&s3c2410_subsys, NULL);
-}
-
-core_initcall(s3c2410_core_init);
-
-static int __init s3c2410a_core_init(void)
-{
-       return subsys_system_register(&s3c2410a_subsys, NULL);
-}
-
-core_initcall(s3c2410a_core_init);
-
-int __init s3c2410_init(void)
-{
-       printk("S3C2410: Initialising architecture\n");
-
-#ifdef CONFIG_PM_SLEEP
-       register_syscore_ops(&s3c2410_pm_syscore_ops);
-       register_syscore_ops(&s3c24xx_irq_syscore_ops);
-#endif
-
-       return device_register(&s3c2410_dev);
-}
-
-int __init s3c2410a_init(void)
-{
-       s3c2410_dev.bus = &s3c2410a_subsys;
-       return s3c2410_init();
-}
diff --git a/arch/arm/mach-s3c24xx/s3c2412-power.h b/arch/arm/mach-s3c24xx/s3c2412-power.h
deleted file mode 100644 (file)
index 0031cfa..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003-2006 Simtec Electronics <linux@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- */
-
-#ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H
-#define __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H __FILE__
-
-#define S3C24XX_PWRREG(x)                      ((x) + S3C24XX_VA_CLKPWR)
-
-#define S3C2412_PWRMODECON                     S3C24XX_PWRREG(0x20)
-#define S3C2412_PWRCFG                         S3C24XX_PWRREG(0x24)
-
-#define S3C2412_INFORM0                                S3C24XX_PWRREG(0x70)
-#define S3C2412_INFORM1                                S3C24XX_PWRREG(0x74)
-#define S3C2412_INFORM2                                S3C24XX_PWRREG(0x78)
-#define S3C2412_INFORM3                                S3C24XX_PWRREG(0x7C)
-
-#define S3C2412_PWRCFG_BATF_IRQ                        (1 << 0)
-#define S3C2412_PWRCFG_BATF_IGNORE             (2 << 0)
-#define S3C2412_PWRCFG_BATF_SLEEP              (3 << 0)
-#define S3C2412_PWRCFG_BATF_MASK               (3 << 0)
-
-#define S3C2412_PWRCFG_STANDBYWFI_IGNORE       (0 << 6)
-#define S3C2412_PWRCFG_STANDBYWFI_IDLE         (1 << 6)
-#define S3C2412_PWRCFG_STANDBYWFI_STOP         (2 << 6)
-#define S3C2412_PWRCFG_STANDBYWFI_SLEEP                (3 << 6)
-#define S3C2412_PWRCFG_STANDBYWFI_MASK         (3 << 6)
-
-#define S3C2412_PWRCFG_RTC_MASKIRQ             (1 << 8)
-#define S3C2412_PWRCFG_NAND_NORST              (1 << 9)
-
-#endif /* __ARCH_ARM_MACH_S3C24XX_S3C2412_POWER_H */
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
deleted file mode 100644 (file)
index d1ea1ca..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2006 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://armlinux.simtec.co.uk/.
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/reboot.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <asm/proc-fns.h>
-#include <asm/irq.h>
-#include <asm/system_misc.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/regs-spi.h>
-
-#include "common.h"
-#include "nand-core.h"
-#include "regs-dsc.h"
-#include "s3c2412-power.h"
-
-#ifndef CONFIG_CPU_S3C2412_ONLY
-void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
-
-static inline void s3c2412_init_gpio2(void)
-{
-       s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10;
-}
-#else
-#define s3c2412_init_gpio2() do { } while(0)
-#endif
-
-/* Initial IO mappings */
-
-static struct map_desc s3c2412_iodesc[] __initdata __maybe_unused = {
-       IODESC_ENT(CLKPWR),
-       IODESC_ENT(TIMER),
-       IODESC_ENT(WATCHDOG),
-       {
-               .virtual = (unsigned long)S3C2412_VA_SSMC,
-               .pfn     = __phys_to_pfn(S3C2412_PA_SSMC),
-               .length  = SZ_1M,
-               .type    = MT_DEVICE,
-       },
-       {
-               .virtual = (unsigned long)S3C2412_VA_EBI,
-               .pfn     = __phys_to_pfn(S3C2412_PA_EBI),
-               .length  = SZ_1M,
-               .type    = MT_DEVICE,
-       },
-};
-
-/* uart registration process */
-
-void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       s3c24xx_init_uartdevs("s3c2412-uart", s3c2410_uart_resources, cfg, no);
-
-       /* rename devices that are s3c2412/s3c2413 specific */
-       s3c_device_sdi.name  = "s3c2412-sdi";
-       s3c_device_lcd.name  = "s3c2412-lcd";
-       s3c_nand_setname("s3c2412-nand");
-
-       /* alter IRQ of SDI controller */
-
-       s3c_device_sdi.resource[1].start = IRQ_S3C2412_SDI;
-       s3c_device_sdi.resource[1].end   = IRQ_S3C2412_SDI;
-
-       /* spi channel related changes, s3c2412/13 specific */
-       s3c_device_spi0.name = "s3c2412-spi";
-       s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24;
-       s3c_device_spi1.name = "s3c2412-spi";
-       s3c_device_spi1.resource[0].start = S3C24XX_PA_SPI + S3C2412_SPI1;
-       s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x24;
-
-}
-
-/* s3c2412_idle
- *
- * use the standard idle call by ensuring the idle mode
- * in power config, then issuing the idle co-processor
- * instruction
-*/
-
-static void s3c2412_idle(void)
-{
-       unsigned long tmp;
-
-       /* ensure our idle mode is to go to idle */
-
-       tmp = __raw_readl(S3C2412_PWRCFG);
-       tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
-       tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
-       __raw_writel(tmp, S3C2412_PWRCFG);
-
-       cpu_do_idle();
-}
-
-/* s3c2412_map_io
- *
- * register the standard cpu IO areas, and any passed in from the
- * machine specific initialisation.
-*/
-
-void __init s3c2412_map_io(void)
-{
-       /* move base of IO */
-
-       s3c2412_init_gpio2();
-
-       /* set our idle function */
-
-       arm_pm_idle = s3c2412_idle;
-
-       /* register our io-tables */
-
-       iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
-}
-
-/* need to register the subsystem before we actually register the device, and
- * we also need to ensure that it has been initialised before any of the
- * drivers even try to use it (even if not on an s3c2412 based system)
- * as a driver which may support both 2410 and 2440 may try and use it.
-*/
-
-struct bus_type s3c2412_subsys = {
-       .name = "s3c2412-core",
-       .dev_name = "s3c2412-core",
-};
-
-static int __init s3c2412_core_init(void)
-{
-       return subsys_system_register(&s3c2412_subsys, NULL);
-}
-
-core_initcall(s3c2412_core_init);
-
-static struct device s3c2412_dev = {
-       .bus            = &s3c2412_subsys,
-};
-
-int __init s3c2412_init(void)
-{
-       printk("S3C2412: Initialising architecture\n");
-
-#ifdef CONFIG_PM_SLEEP
-       register_syscore_ops(&s3c2412_pm_syscore_ops);
-       register_syscore_ops(&s3c24xx_irq_syscore_ops);
-#endif
-
-       return device_register(&s3c2412_dev);
-}
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
deleted file mode 100644 (file)
index 17157f0..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
-//     as part of OpenInkpot project
-// Copyright (c) 2009 Promwad Innovation Company
-//     Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
-//
-// Samsung S3C2416 Mobile CPU support
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/reboot.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-#include <asm/proc-fns.h>
-#include <asm/irq.h>
-#include <asm/system_misc.h>
-
-#include <mach/regs-s3c2443-clock.h>
-#include <mach/rtc-core.h>
-
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/sdhci.h>
-#include <plat/pm.h>
-
-#include <plat/iic-core.h>
-#include <plat/adc-core.h>
-
-#include "common.h"
-#include "fb-core.h"
-#include "nand-core.h"
-#include "spi-core.h"
-
-static struct map_desc s3c2416_iodesc[] __initdata __maybe_unused = {
-       IODESC_ENT(WATCHDOG),
-       IODESC_ENT(CLKPWR),
-       IODESC_ENT(TIMER),
-};
-
-struct bus_type s3c2416_subsys = {
-       .name = "s3c2416-core",
-       .dev_name = "s3c2416-core",
-};
-
-static struct device s3c2416_dev = {
-       .bus            = &s3c2416_subsys,
-};
-
-int __init s3c2416_init(void)
-{
-       printk(KERN_INFO "S3C2416: Initializing architecture\n");
-
-       /* change WDT IRQ number */
-       s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
-       s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
-
-       /* the i2c devices are directly compatible with s3c2440 */
-       s3c_i2c0_setname("s3c2440-i2c");
-       s3c_i2c1_setname("s3c2440-i2c");
-
-       s3c_fb_setname("s3c2443-fb");
-
-       s3c_adc_setname("s3c2416-adc");
-       s3c_rtc_setname("s3c2416-rtc");
-
-#ifdef CONFIG_PM_SLEEP
-       register_syscore_ops(&s3c2416_pm_syscore_ops);
-       register_syscore_ops(&s3c24xx_irq_syscore_ops);
-       register_syscore_ops(&s3c2416_irq_syscore_ops);
-#endif
-
-       return device_register(&s3c2416_dev);
-}
-
-void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
-
-       s3c_nand_setname("s3c2412-nand");
-}
-
-/* s3c2416_map_io
- *
- * register the standard cpu IO areas, and any passed in from the
- * machine specific initialisation.
- */
-
-void __init s3c2416_map_io(void)
-{
-       s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown;
-       s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown;
-
-       /* initialize device information early */
-       s3c2416_default_sdhci0();
-       s3c2416_default_sdhci1();
-       s3c24xx_spi_setname("s3c2443-spi");
-
-       iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
-}
-
-/* need to register the subsystem before we actually register the device, and
- * we also need to ensure that it has been initialised before any of the
- * drivers even try to use it (even if not on an s3c2416 based system)
- * as a driver which may support both 2443 and 2440 may try and use it.
-*/
-
-static int __init s3c2416_core_init(void)
-{
-       return subsys_system_register(&s3c2416_subsys, NULL);
-}
-
-core_initcall(s3c2416_core_init);
diff --git a/arch/arm/mach-s3c24xx/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c
deleted file mode 100644 (file)
index 451d985..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2004-2006 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// Samsung S3C2440 Mobile CPU support
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/gpio.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-#include <asm/irq.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-
-#include "common.h"
-
-static struct device s3c2440_dev = {
-       .bus            = &s3c2440_subsys,
-};
-
-int __init s3c2440_init(void)
-{
-       printk("S3C2440: Initialising architecture\n");
-
-       /* change irq for watchdog */
-
-       s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
-       s3c_device_wdt.resource[1].end   = IRQ_S3C2440_WDT;
-
-       /* register suspend/resume handlers */
-
-#ifdef CONFIG_PM_SLEEP
-       register_syscore_ops(&s3c2410_pm_syscore_ops);
-       register_syscore_ops(&s3c24xx_irq_syscore_ops);
-       register_syscore_ops(&s3c244x_pm_syscore_ops);
-#endif
-
-       /* register our system device for everything else */
-
-       return device_register(&s3c2440_dev);
-}
-
-void __init s3c2440_map_io(void)
-{
-       s3c244x_map_io();
-
-       s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
-       s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
-}
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
deleted file mode 100644 (file)
index 432d683..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (c) 2004-2005 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C2442 core and lock support
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/errno.h>
-#include <linux/err.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/mutex.h>
-#include <linux/gpio.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-#include <linux/atomic.h>
-#include <asm/irq.h>
-
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-
-#include "common.h"
-
-static struct device s3c2442_dev = {
-       .bus            = &s3c2442_subsys,
-};
-
-int __init s3c2442_init(void)
-{
-       printk("S3C2442: Initialising architecture\n");
-
-#ifdef CONFIG_PM_SLEEP
-       register_syscore_ops(&s3c2410_pm_syscore_ops);
-       register_syscore_ops(&s3c24xx_irq_syscore_ops);
-       register_syscore_ops(&s3c244x_pm_syscore_ops);
-#endif
-
-       return device_register(&s3c2442_dev);
-}
-
-void __init s3c2442_map_io(void)
-{
-       s3c244x_map_io();
-
-       s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1down;
-       s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1down;
-}
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
deleted file mode 100644 (file)
index 2afeb53..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2007 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// Samsung S3C2443 Mobile CPU support
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/device.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/reboot.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-#include <asm/irq.h>
-#include <asm/system_misc.h>
-
-#include <mach/regs-s3c2443-clock.h>
-#include <mach/rtc-core.h>
-
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/adc-core.h>
-
-#include "fb-core.h"
-#include "nand-core.h"
-#include "spi-core.h"
-
-static struct map_desc s3c2443_iodesc[] __initdata __maybe_unused = {
-       IODESC_ENT(WATCHDOG),
-       IODESC_ENT(CLKPWR),
-       IODESC_ENT(TIMER),
-};
-
-struct bus_type s3c2443_subsys = {
-       .name = "s3c2443-core",
-       .dev_name = "s3c2443-core",
-};
-
-static struct device s3c2443_dev = {
-       .bus            = &s3c2443_subsys,
-};
-
-int __init s3c2443_init(void)
-{
-       printk("S3C2443: Initialising architecture\n");
-
-       s3c_nand_setname("s3c2412-nand");
-       s3c_fb_setname("s3c2443-fb");
-
-       s3c_adc_setname("s3c2443-adc");
-       s3c_rtc_setname("s3c2443-rtc");
-
-       /* change WDT IRQ number */
-       s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
-       s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
-
-       return device_register(&s3c2443_dev);
-}
-
-void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
-}
-
-/* s3c2443_map_io
- *
- * register the standard cpu IO areas, and any passed in from the
- * machine specific initialisation.
- */
-
-void __init s3c2443_map_io(void)
-{
-       s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull;
-       s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull;
-
-       /* initialize device information early */
-       s3c24xx_spi_setname("s3c2443-spi");
-
-       iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
-}
-
-/* need to register the subsystem before we actually register the device, and
- * we also need to ensure that it has been initialised before any of the
- * drivers even try to use it (even if not on an s3c2443 based system)
- * as a driver which may support both 2443 and 2440 may try and use it.
-*/
-
-static int __init s3c2443_core_init(void)
-{
-       return subsys_system_register(&s3c2443_subsys, NULL);
-}
-
-core_initcall(s3c2443_core_init);
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
deleted file mode 100644 (file)
index 4439cfb..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2004-2006 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443)
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/reboot.h>
-#include <linux/device.h>
-#include <linux/syscore_ops.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-
-#include <asm/system_misc.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-
-#include <plat/cpu-freq.h>
-
-#include <mach/regs-clock.h>
-#include <mach/regs-gpio.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-#include "common.h"
-#include "nand-core.h"
-#include "regs-dsc.h"
-
-static struct map_desc s3c244x_iodesc[] __initdata __maybe_unused = {
-       IODESC_ENT(CLKPWR),
-       IODESC_ENT(TIMER),
-       IODESC_ENT(WATCHDOG),
-};
-
-/* uart initialisation */
-
-void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
-}
-
-void __init s3c244x_map_io(void)
-{
-       /* register our io-tables */
-
-       iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
-
-       /* rename any peripherals used differing from the s3c2410 */
-
-       s3c_device_sdi.name  = "s3c2440-sdi";
-       s3c_device_i2c0.name  = "s3c2440-i2c";
-       s3c_nand_setname("s3c2440-nand");
-       s3c_device_ts.name = "s3c2440-ts";
-       s3c_device_usbgadget.name = "s3c2440-usbgadget";
-       s3c2410_device_dclk.name = "s3c2440-dclk";
-}
-
-/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
-
-struct bus_type s3c2440_subsys = {
-       .name           = "s3c2440-core",
-       .dev_name       = "s3c2440-core",
-};
-
-struct bus_type s3c2442_subsys = {
-       .name           = "s3c2442-core",
-       .dev_name       = "s3c2442-core",
-};
-
-/* need to register the subsystem before we actually register the device, and
- * we also need to ensure that it has been initialised before any of the
- * drivers even try to use it (even if not on an s3c2440 based system)
- * as a driver which may support both 2410 and 2440 may try and use it.
-*/
-
-static int __init s3c2440_core_init(void)
-{
-       return subsys_system_register(&s3c2440_subsys, NULL);
-}
-
-core_initcall(s3c2440_core_init);
-
-static int __init s3c2442_core_init(void)
-{
-       return subsys_system_register(&s3c2442_subsys, NULL);
-}
-
-core_initcall(s3c2442_core_init);
-
-
-#ifdef CONFIG_PM_SLEEP
-static struct sleep_save s3c244x_sleep[] = {
-       SAVE_ITEM(S3C2440_DSC0),
-       SAVE_ITEM(S3C2440_DSC1),
-       SAVE_ITEM(S3C2440_GPJDAT),
-       SAVE_ITEM(S3C2440_GPJCON),
-       SAVE_ITEM(S3C2440_GPJUP)
-};
-
-static int s3c244x_suspend(void)
-{
-       s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
-       return 0;
-}
-
-static void s3c244x_resume(void)
-{
-       s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
-}
-
-struct syscore_ops s3c244x_pm_syscore_ops = {
-       .suspend        = s3c244x_suspend,
-       .resume         = s3c244x_resume,
-};
-#endif
diff --git a/arch/arm/mach-s3c24xx/setup-camif.c b/arch/arm/mach-s3c24xx/setup-camif.c
deleted file mode 100644 (file)
index 2b262fa..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
-//
-// Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver
-
-#include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-/* Number of camera port pins, without FIELD */
-#define S3C_CAMIF_NUM_GPIOS    13
-
-/* Default camera port configuration helpers. */
-
-static void camif_get_gpios(int *gpio_start, int *gpio_reset)
-{
-#ifdef CONFIG_ARCH_S3C24XX
-       *gpio_start = S3C2410_GPJ(0);
-       *gpio_reset = S3C2410_GPJ(12);
-#else
-       /* s3c64xx */
-       *gpio_start = S3C64XX_GPF(0);
-       *gpio_reset = S3C64XX_GPF(3);
-#endif
-}
-
-int s3c_camif_gpio_get(void)
-{
-       int gpio_start, gpio_reset;
-       int ret, i;
-
-       camif_get_gpios(&gpio_start, &gpio_reset);
-
-       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
-               int gpio = gpio_start + i;
-
-               if (gpio == gpio_reset)
-                       continue;
-
-               ret = gpio_request(gpio, "camif");
-               if (!ret)
-                       ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
-               if (ret) {
-                       pr_err("failed to configure GPIO %d\n", gpio);
-                       for (--i; i >= 0; i--)
-                               gpio_free(gpio--);
-                       return ret;
-               }
-               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
-       }
-
-       return 0;
-}
-
-void s3c_camif_gpio_put(void)
-{
-       int i, gpio_start, gpio_reset;
-
-       camif_get_gpios(&gpio_start, &gpio_reset);
-
-       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
-               int gpio = gpio_start + i;
-               if (gpio != gpio_reset)
-                       gpio_free(gpio);
-       }
-}
diff --git a/arch/arm/mach-s3c24xx/setup-i2c.c b/arch/arm/mach-s3c24xx/setup-i2c.c
deleted file mode 100644 (file)
index 1a01d44..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C24XX Base setup for i2c device
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-
-struct platform_device;
-
-#include <plat/gpio-cfg.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-void s3c_i2c0_cfg_gpio(struct platform_device *dev)
-{
-       s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPE15_IICSDA);
-       s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPE14_IICSCL);
-}
diff --git a/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
deleted file mode 100644 (file)
index 218346a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2010 Promwad Innovation Company
-//     Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
-//
-// S3C2416 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
-//
-// Based on mach-s3c64xx/setup-sdhci-gpio.c
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <plat/gpio-cfg.h>
-
-void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
-{
-       s3c_gpio_cfgrange_nopull(S3C2410_GPE(5), 2 + width, S3C_GPIO_SFN(2));
-}
-
-void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
-{
-       s3c_gpio_cfgrange_nopull(S3C2410_GPL(0), width, S3C_GPIO_SFN(2));
-       s3c_gpio_cfgrange_nopull(S3C2410_GPL(8), 2, S3C_GPIO_SFN(2));
-}
diff --git a/arch/arm/mach-s3c24xx/setup-spi.c b/arch/arm/mach-s3c24xx/setup-spi.c
deleted file mode 100644 (file)
index 6c2b96a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// HS-SPI device setup for S3C2443/S3C2416
-//
-// Copyright (C) 2011 Samsung Electronics Ltd.
-//             http://www.samsung.com/
-
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-
-#include <plat/gpio-cfg.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-
-#ifdef CONFIG_S3C64XX_DEV_SPI0
-int s3c64xx_spi0_cfg_gpio(void)
-{
-       /* enable hsspi bit in misccr */
-       s3c2410_modify_misccr(S3C2416_MISCCR_HSSPI_EN2, 1);
-
-       s3c_gpio_cfgall_range(S3C2410_GPE(11), 3,
-                             S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-
-       return 0;
-}
-#endif
diff --git a/arch/arm/mach-s3c24xx/setup-ts.c b/arch/arm/mach-s3c24xx/setup-ts.c
deleted file mode 100644 (file)
index 53a14d4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2010 Samsung Electronics Co., Ltd.
-//                     http://www.samsung.com/
-//
-// Based on S3C24XX setup for i2c device
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-
-struct platform_device; /* don't need the contents */
-
-#include <plat/gpio-cfg.h>
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-
-/**
- * s3c24xx_ts_cfg_gpio - configure gpio for s3c2410 systems
- *
- * Configure the GPIO for the S3C2410 system, where we have external FETs
- * connected to the device (later systems such as the S3C2440 integrate
- * these into the device).
- */
-void s3c24xx_ts_cfg_gpio(struct platform_device *dev)
-{
-       s3c_gpio_cfgpin_range(S3C2410_GPG(12), 4, S3C_GPIO_SFN(3));
-}
diff --git a/arch/arm/mach-s3c24xx/simtec-audio.c b/arch/arm/mach-s3c24xx/simtec-audio.c
deleted file mode 100644 (file)
index 12e17f8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2009 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Audio setup for various Simtec S3C24XX implementations
-
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/io.h>
-
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-
-#include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <plat/devs.h>
-
-#include "bast.h"
-#include "simtec.h"
-
-/* platform ops for audio */
-
-static void simtec_audio_startup_lrroute(void)
-{
-       unsigned int tmp;
-       unsigned long flags;
-
-       local_irq_save(flags);
-
-       tmp = __raw_readb(BAST_VA_CTRL1);
-       tmp &= ~BAST_CPLD_CTRL1_LRMASK;
-       tmp |= BAST_CPLD_CTRL1_LRCDAC;
-       __raw_writeb(tmp, BAST_VA_CTRL1);
-
-       local_irq_restore(flags);
-}
-
-static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
-static char our_name[32];
-
-static struct platform_device simtec_audio_dev = {
-       .name   = our_name,
-       .id     = -1,
-       .dev    = {
-               .parent         = &s3c_device_iis.dev,
-               .platform_data  = &simtec_audio_platdata,
-       },
-};
-
-int __init simtec_audio_add(const char *name, bool has_lr_routing,
-                           struct s3c24xx_audio_simtec_pdata *spd)
-{
-       if (!name)
-               name = "tlv320aic23";
-
-       snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
-
-       /* copy platform data so the source can be __initdata */
-       if (spd)
-               simtec_audio_platdata = *spd;
-
-       if (has_lr_routing)
-               simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
-
-       platform_device_register(&s3c_device_iis);
-       platform_device_register(&simtec_audio_dev);
-       return 0;
-}
diff --git a/arch/arm/mach-s3c24xx/simtec-nor.c b/arch/arm/mach-s3c24xx/simtec-nor.c
deleted file mode 100644 (file)
index 26b1849..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2008 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Simtec NOR mapping
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/map.h>
-
-#include "bast.h"
-#include "simtec.h"
-
-static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
-{
-       unsigned int val;
-
-       val = __raw_readb(BAST_VA_CTRL3);
-
-       printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
-
-       if (vpp)
-               val |= BAST_CPLD_CTRL3_ROMWEN;
-       else
-               val &= ~BAST_CPLD_CTRL3_ROMWEN;
-
-       __raw_writeb(val, BAST_VA_CTRL3);
-}
-
-static struct physmap_flash_data simtec_nor_pdata = {
-       .width          = 2,
-       .set_vpp        = simtec_nor_vpp,
-       .nr_parts       = 0,
-};
-
-static struct resource simtec_nor_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
-};
-
-static struct platform_device simtec_device_nor = {
-       .name           = "physmap-flash",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(simtec_nor_resource),
-       .resource       = simtec_nor_resource,
-       .dev            = {
-               .platform_data = &simtec_nor_pdata,
-       },
-};
-
-void __init nor_simtec_init(void)
-{
-       int ret;
-
-       ret = platform_device_register(&simtec_device_nor);
-       if (ret < 0)
-               printk(KERN_ERR "failed to register physmap-flash device\n");
-       else
-               simtec_nor_vpp(NULL, 1);
-}
diff --git a/arch/arm/mach-s3c24xx/simtec-pm.c b/arch/arm/mach-s3c24xx/simtec-pm.c
deleted file mode 100644 (file)
index c19074d..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2004 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// http://armlinux.simtec.co.uk/
-//
-// Power Management helpers for Simtec S3C24XX implementations
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <mach/hardware.h>
-
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-
-#include <asm/mach-types.h>
-
-#include <plat/pm.h>
-
-#include "regs-mem.h"
-
-#define COPYRIGHT ", Copyright 2005 Simtec Electronics"
-
-/* pm_simtec_init
- *
- * enable the power management functions
-*/
-
-static __init int pm_simtec_init(void)
-{
-       unsigned long gstatus4;
-
-       /* check which machine we are running on */
-
-       if (!machine_is_bast() && !machine_is_vr1000() &&
-           !machine_is_anubis() && !machine_is_osiris() &&
-           !machine_is_aml_m5900())
-               return 0;
-
-       printk(KERN_INFO "Simtec Board Power Management" COPYRIGHT "\n");
-
-       gstatus4  = (__raw_readl(S3C2410_BANKCON7) & 0x3) << 30;
-       gstatus4 |= (__raw_readl(S3C2410_BANKCON6) & 0x3) << 28;
-       gstatus4 |= (__raw_readl(S3C2410_BANKSIZE) & S3C2410_BANKSIZE_MASK);
-
-       __raw_writel(gstatus4, S3C2410_GSTATUS4);
-
-       return s3c_pm_init();
-}
-
-arch_initcall(pm_simtec_init);
diff --git a/arch/arm/mach-s3c24xx/simtec-usb.c b/arch/arm/mach-s3c24xx/simtec-usb.c
deleted file mode 100644 (file)
index dc1016f..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2004-2005 Simtec Electronics
-//   Ben Dooks <ben@simtec.co.uk>
-//
-// http://www.simtec.co.uk/products/EB2410ITX/
-//
-// Simtec BAST and Thorcom VR1000 USB port support functions
-
-#define DEBUG
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/gpio.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/gpio-samsung.h>
-#include <asm/irq.h>
-
-#include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <plat/devs.h>
-
-#include "bast.h"
-#include "simtec.h"
-
-/* control power and monitor over-current events on various Simtec
- * designed boards.
-*/
-
-static unsigned int power_state[2];
-
-static void
-usb_simtec_powercontrol(int port, int to)
-{
-       pr_debug("usb_simtec_powercontrol(%d,%d)\n", port, to);
-
-       power_state[port] = to;
-
-       if (power_state[0] && power_state[1])
-               gpio_set_value(S3C2410_GPB(4), 0);
-       else
-               gpio_set_value(S3C2410_GPB(4), 1);
-}
-
-static irqreturn_t
-usb_simtec_ocirq(int irq, void *pw)
-{
-       struct s3c2410_hcd_info *info = pw;
-
-       if (gpio_get_value(S3C2410_GPG(10)) == 0) {
-               pr_debug("usb_simtec: over-current irq (oc detected)\n");
-               s3c2410_usb_report_oc(info, 3);
-       } else {
-               pr_debug("usb_simtec: over-current irq (oc cleared)\n");
-               s3c2410_usb_report_oc(info, 0);
-       }
-
-       return IRQ_HANDLED;
-}
-
-static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on)
-{
-       int ret;
-
-       if (on) {
-               ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq,
-                                 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                                 "USB Over-current", info);
-               if (ret != 0) {
-                       printk(KERN_ERR "failed to request usb oc irq\n");
-               }
-       } else {
-               free_irq(BAST_IRQ_USBOC, info);
-       }
-}
-
-static struct s3c2410_hcd_info usb_simtec_info __initdata = {
-       .port[0]        = {
-               .flags  = S3C_HCDFLG_USED
-       },
-       .port[1]        = {
-               .flags  = S3C_HCDFLG_USED
-       },
-
-       .power_control  = usb_simtec_powercontrol,
-       .enable_oc      = usb_simtec_enableoc,
-};
-
-
-int __init usb_simtec_init(void)
-{
-       int ret;
-
-       printk("USB Power Control, Copyright 2004 Simtec Electronics\n");
-
-       ret = gpio_request(S3C2410_GPB(4), "USB power control");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPB4\n", __func__);
-               return ret;
-       }
-
-       ret = gpio_request(S3C2410_GPG(10), "USB overcurrent");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPG10\n", __func__);
-               gpio_free(S3C2410_GPB(4));
-               return ret;
-       }
-
-       /* turn power on */
-       gpio_direction_output(S3C2410_GPB(4), 1);
-       gpio_direction_input(S3C2410_GPG(10));
-
-       s3c_ohci_set_platdata(&usb_simtec_info);
-       return 0;
-}
diff --git a/arch/arm/mach-s3c24xx/simtec.h b/arch/arm/mach-s3c24xx/simtec.h
deleted file mode 100644 (file)
index d96bd60..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * Simtec common functions
- */
-
-struct s3c24xx_audio_simtec_pdata;
-
-extern void nor_simtec_init(void);
-
-extern int usb_simtec_init(void);
-
-extern int simtec_audio_add(const char *codec_name, bool has_lr_routing,
-                           struct s3c24xx_audio_simtec_pdata *pdata);
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
deleted file mode 100644 (file)
index 659f9ef..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2004 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 Power Manager (Suspend-To-RAM) support
- *
- * Based on PXA/SA1100 sleep code by:
- *     Nicolas Pitre, (c) 2002 Monta Vista Software Inc
- *     Cliff Brake, (c) 2001
- */
-
-#include <linux/linkage.h>
-#include <linux/serial_s3c.h>
-#include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
-
-#include "regs-mem.h"
-
-       /* s3c2410_cpu_suspend
-        *
-        * put the cpu into sleep mode
-       */
-
-ENTRY(s3c2410_cpu_suspend)
-       @@ prepare cpu to sleep
-
-       ldr     r4, =S3C2410_REFRESH
-       ldr     r5, =S3C24XX_MISCCR
-       ldr     r6, =S3C2410_CLKCON
-       ldr     r7, [r4]                @ get REFRESH (and ensure in TLB)
-       ldr     r8, [r5]                @ get MISCCR (and ensure in TLB)
-       ldr     r9, [r6]                @ get CLKCON (and ensure in TLB)
-
-       orr     r7, r7, #S3C2410_REFRESH_SELF   @ SDRAM sleep command
-       orr     r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals
-       orr     r9, r9, #S3C2410_CLKCON_POWER   @ power down command
-
-       teq     pc, #0                  @ first as a trial-run to load cache
-       bl      s3c2410_do_sleep
-       teq     r0, r0                  @ now do it for real
-       b       s3c2410_do_sleep        @
-
-       @@ align next bit of code to cache line
-       .align  5
-s3c2410_do_sleep:
-       streq   r7, [r4]                        @ SDRAM sleep command
-       streq   r8, [r5]                        @ SDRAM power-down config
-       streq   r9, [r6]                        @ CPU sleep
-1:     beq     1b
-       ret     lr
diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2412.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
deleted file mode 100644 (file)
index c373f1c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2007 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2412 Power Manager low-level sleep support
- */
-
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <mach/regs-irq.h>
-
-       .text
-
-       .global s3c2412_sleep_enter
-
-s3c2412_sleep_enter:
-       mov     r0, #0                  /* argument for coprocessors */
-       ldr     r1, =S3C2410_INTPND
-       ldr     r2, =S3C2410_SRCPND
-       ldr     r3, =S3C2410_EINTPEND
-
-       teq     r0, r0
-       bl      s3c2412_sleep_enter1
-       teq     pc, r0
-       bl      s3c2412_sleep_enter1
-
-       .align  5
-
-       /* this is called twice, first with the Z flag to ensure that the
-        * instructions have been loaded into the cache, and the second
-        * time to try and suspend the system.
-       */
-s3c2412_sleep_enter1:
-       mcr     p15, 0, r0, c7, c10, 4
-       mcrne   p15, 0, r0, c7, c0, 4
-
-       /* if we return from here, it is because an interrupt was
-        * active when we tried to shutdown. Try and ack the IRQ and
-        * retry, as simply returning causes the system to lock.
-       */
-
-       ldrne   r9, [r1]
-       strne   r9, [r1]
-       ldrne   r9, [r2]
-       strne   r9, [r2]
-       ldrne   r9, [r3]
-       strne   r9, [r3]
-       bne     s3c2412_sleep_enter1
-
-       ret     lr
diff --git a/arch/arm/mach-s3c24xx/sleep.S b/arch/arm/mach-s3c24xx/sleep.S
deleted file mode 100644 (file)
index f0f11ad..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2004 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 Power Manager (Suspend-To-RAM) support
- *
- * Based on PXA/SA1100 sleep code by:
- *     Nicolas Pitre, (c) 2002 Monta Vista Software Inc
- *     Cliff Brake, (c) 2001
- */
-
-#include <linux/linkage.h>
-#include <linux/serial_s3c.h>
-#include <asm/assembler.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
-
-/*
- * S3C24XX_DEBUG_RESUME is dangerous if your bootloader does not
- * reset the UART configuration, only enable if you really need this!
- */
-//#define S3C24XX_DEBUG_RESUME
-
-       .text
-
-       /* sleep magic, to allow the bootloader to check for an valid
-        * image to resume to. Must be the first word before the
-        * s3c_cpu_resume entry.
-       */
-
-       .word   0x2bedf00d
-
-       /* s3c_cpu_resume
-        *
-        * resume code entry for bootloader to call
-       */
-
-ENTRY(s3c_cpu_resume)
-       mov     r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
-       msr     cpsr_c, r0
-
-       @@ load UART to allow us to print the two characters for
-       @@ resume debug
-
-       mov     r2, #S3C24XX_PA_UART & 0xff000000
-       orr     r2, r2, #S3C24XX_PA_UART & 0xff000
-
-#if 0
-       /* SMDK2440 LED set */
-       mov     r14, #S3C24XX_PA_GPIO
-       ldr     r12, [ r14, #0x54 ]
-       bic     r12, r12, #3<<4
-       orr     r12, r12, #1<<7
-       str     r12, [ r14, #0x54 ]
-#endif
-
-#ifdef S3C24XX_DEBUG_RESUME
-       mov     r3, #'L'
-       strb    r3, [ r2, #S3C2410_UTXH ]
-1001:
-       ldrb    r14, [ r3, #S3C2410_UTRSTAT ]
-       tst     r14, #S3C2410_UTRSTAT_TXE
-       beq     1001b
-#endif /* S3C24XX_DEBUG_RESUME */
-
-       b       cpu_resume
diff --git a/arch/arm/mach-s3c24xx/spi-core.h b/arch/arm/mach-s3c24xx/spi-core.h
deleted file mode 100644 (file)
index 1048fac..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
- */
-
-#ifndef __PLAT_S3C_SPI_CORE_H
-#define __PLAT_S3C_SPI_CORE_H
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
- */
-
-/* re-define device name depending on support. */
-static inline void s3c24xx_spi_setname(char *name)
-{
-#ifdef CONFIG_S3C64XX_DEV_SPI0
-       s3c64xx_device_spi0.name = name;
-#endif
-#ifdef CONFIG_S3C64XX_DEV_SPI1
-       s3c64xx_device_spi1.name = name;
-#endif
-#ifdef CONFIG_S3C64XX_DEV_SPI2
-       s3c64xx_device_spi2.name = name;
-#endif
-}
-
-#endif /* __PLAT_S3C_SPI_CORE_H */
diff --git a/arch/arm/mach-s3c24xx/vr1000.h b/arch/arm/mach-s3c24xx/vr1000.h
deleted file mode 100644 (file)
index 3cfa296..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2003 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * VR1000 - CPLD control constants
- * Machine VR1000 - IRQ Number definitions
- * Machine VR1000 - Memory map definitions
- */
-
-#ifndef __MACH_S3C24XX_VR1000_H
-#define __MACH_S3C24XX_VR1000_H __FILE__
-
-#define VR1000_CPLD_CTRL2_RAMWEN       (0x04)  /* SRAM Write Enable */
-
-/* irq numbers to onboard peripherals */
-
-#define VR1000_IRQ_USBOC               IRQ_EINT19
-#define VR1000_IRQ_IDE0                        IRQ_EINT16
-#define VR1000_IRQ_IDE1                        IRQ_EINT17
-#define VR1000_IRQ_SERIAL              IRQ_EINT12
-#define VR1000_IRQ_DM9000A             IRQ_EINT10
-#define VR1000_IRQ_DM9000N             IRQ_EINT9
-#define VR1000_IRQ_SMALERT             IRQ_EINT8
-
-/* map */
-
-#define VR1000_IOADDR(x)               (S3C2410_ADDR((x) + 0x01300000))
-
-/* we put the CPLD registers next, to get them out of the way */
-
-#define VR1000_VA_CTRL1                        VR1000_IOADDR(0x00000000) /* 0x01300000 */
-#define VR1000_PA_CTRL1                        (S3C2410_CS5 | 0x7800000)
-
-#define VR1000_VA_CTRL2                        VR1000_IOADDR(0x00100000) /* 0x01400000 */
-#define VR1000_PA_CTRL2                        (S3C2410_CS1 | 0x6000000)
-
-#define VR1000_VA_CTRL3                        VR1000_IOADDR(0x00200000) /* 0x01500000 */
-#define VR1000_PA_CTRL3                        (S3C2410_CS1 | 0x6800000)
-
-#define VR1000_VA_CTRL4                        VR1000_IOADDR(0x00300000) /* 0x01600000 */
-#define VR1000_PA_CTRL4                        (S3C2410_CS1 | 0x7000000)
-
-/* next, we have the PC104 ISA interrupt registers */
-
-#define VR1000_PA_PC104_IRQREQ         (S3C2410_CS5 | 0x6000000) /* 0x01700000 */
-#define VR1000_VA_PC104_IRQREQ         VR1000_IOADDR(0x00400000)
-
-#define VR1000_PA_PC104_IRQRAW         (S3C2410_CS5 | 0x6800000) /* 0x01800000 */
-#define VR1000_VA_PC104_IRQRAW         VR1000_IOADDR(0x00500000)
-
-#define VR1000_PA_PC104_IRQMASK                (S3C2410_CS5 | 0x7000000) /* 0x01900000 */
-#define VR1000_VA_PC104_IRQMASK                VR1000_IOADDR(0x00600000)
-
-/*
- * 0xE0000000 contains the IO space that is split by speed and
- * whether the access is for 8 or 16bit IO... this ensures that
- * the correct access is made
- *
- * 0x10000000 of space, partitioned as so:
- *
- * 0x00000000 to 0x04000000  8bit,  slow
- * 0x04000000 to 0x08000000  16bit, slow
- * 0x08000000 to 0x0C000000  16bit, net
- * 0x0C000000 to 0x10000000  16bit, fast
- *
- * each of these spaces has the following in:
- *
- * 0x02000000 to 0x02100000 1MB  IDE primary channel
- * 0x02100000 to 0x02200000 1MB  IDE primary channel aux
- * 0x02200000 to 0x02400000 1MB  IDE secondary channel
- * 0x02300000 to 0x02400000 1MB  IDE secondary channel aux
- * 0x02500000 to 0x02600000 1MB  Davicom DM9000 ethernet controllers
- * 0x02600000 to 0x02700000 1MB
- *
- * the phyiscal layout of the zones are:
- *  nGCS2 - 8bit, slow
- *  nGCS3 - 16bit, slow
- *  nGCS4 - 16bit, net
- *  nGCS5 - 16bit, fast
- */
-
-#define VR1000_VA_MULTISPACE   (0xE0000000)
-
-#define VR1000_VA_ISAIO                (VR1000_VA_MULTISPACE + 0x00000000)
-#define VR1000_VA_ISAMEM       (VR1000_VA_MULTISPACE + 0x01000000)
-#define VR1000_VA_IDEPRI       (VR1000_VA_MULTISPACE + 0x02000000)
-#define VR1000_VA_IDEPRIAUX    (VR1000_VA_MULTISPACE + 0x02100000)
-#define VR1000_VA_IDESEC       (VR1000_VA_MULTISPACE + 0x02200000)
-#define VR1000_VA_IDESECAUX    (VR1000_VA_MULTISPACE + 0x02300000)
-#define VR1000_VA_ASIXNET      (VR1000_VA_MULTISPACE + 0x02400000)
-#define VR1000_VA_DM9000       (VR1000_VA_MULTISPACE + 0x02500000)
-#define VR1000_VA_SUPERIO      (VR1000_VA_MULTISPACE + 0x02600000)
-
-/* physical offset addresses for the peripherals */
-
-#define VR1000_PA_IDEPRI       (0x02000000)
-#define VR1000_PA_IDEPRIAUX    (0x02800000)
-#define VR1000_PA_IDESEC       (0x03000000)
-#define VR1000_PA_IDESECAUX    (0x03800000)
-#define VR1000_PA_DM9000       (0x05000000)
-
-#define VR1000_PA_SERIAL       (0x11800000)
-#define VR1000_VA_SERIAL       (VR1000_IOADDR(0x00700000))
-
-/* VR1000 ram is in CS1, with A26..A24 = 2_101 */
-#define VR1000_PA_SRAM         (S3C2410_CS1 | 0x05000000)
-
-/* some configurations for the peripherals */
-
-#define VR1000_DM9000_CS       VR1000_VAM_CS4
-
-#endif /* __MACH_S3C24XX_VR1000_H */
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
deleted file mode 100644 (file)
index ac3e356..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright 2008 Openmoko, Inc.
-#      Simtec Electronics, Ben Dooks <ben@simtec.co.uk>
-
-menuconfig ARCH_S3C64XX
-       bool "Samsung S3C64XX"
-       depends on ARCH_MULTI_V6
-       select ARM_AMBA
-       select ARM_VIC
-       select CLKSRC_SAMSUNG_PWM
-       select COMMON_CLK_SAMSUNG
-       select GPIO_SAMSUNG if ATAGS
-       select GPIOLIB
-       select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
-       select HAVE_TCM
-       select PLAT_SAMSUNG
-       select PM_GENERIC_DOMAINS if PM
-       select S3C_DEV_NAND if ATAGS
-       select S3C_GPIO_TRACK if ATAGS
-       select SAMSUNG_ATAGS if ATAGS
-       select SAMSUNG_WAKEMASK if PM
-       select SAMSUNG_WDT_RESET
-       help
-         Samsung S3C64XX series based systems
-
-if ARCH_S3C64XX
-
-# Configuration options for the S3C6410 CPU
-
-config CPU_S3C6400
-       bool
-       help
-         Enable S3C6400 CPU support
-
-config CPU_S3C6410
-       bool
-       help
-         Enable S3C6410 CPU support
-
-config S3C64XX_PL080
-       def_bool DMADEVICES
-       select AMBA_PL08X
-
-config S3C64XX_SETUP_SDHCI
-       bool
-       select S3C64XX_SETUP_SDHCI_GPIO
-       help
-         Internal configuration for default SDHCI setup for S3C6400 and
-         S3C6410 SoCs.
-
-config S3C64XX_DEV_ONENAND1
-       bool
-       help
-         Compile in platform device definition for OneNAND1 controller
-
-config SAMSUNG_DEV_BACKLIGHT
-       bool
-       depends on SAMSUNG_DEV_PWM
-       help
-         Compile in platform device definition LCD backlight with PWM Timer
-
-# platform specific device setup
-
-config S3C64XX_SETUP_I2C0
-       bool
-       default y
-       help
-         Common setup code for i2c bus 0.
-
-         Note, currently since i2c0 is always compiled, this setup helper
-         is always compiled with it.
-
-config S3C64XX_SETUP_I2C1
-       bool
-       help
-         Common setup code for i2c bus 1.
-
-config S3C64XX_SETUP_IDE
-       bool
-       help
-         Common setup code for S3C64XX IDE.
-
-config S3C64XX_SETUP_FB_24BPP
-       bool
-       help
-         Common setup code for S3C64XX with an 24bpp RGB display helper.
-
-config S3C64XX_SETUP_KEYPAD
-       bool
-       help
-         Common setup code for S3C64XX KEYPAD GPIO configurations
-
-config S3C64XX_SETUP_SDHCI_GPIO
-       bool
-       help
-         Common setup code for S3C64XX SDHCI GPIO configurations
-
-config S3C64XX_SETUP_SPI
-       bool
-       help
-        Common setup code for SPI GPIO configurations
-
-config S3C64XX_SETUP_USB_PHY
-       bool
-       help
-         Common setup code for USB PHY controller
-
-# S36400 Macchine support
-
-config MACH_SMDK6400
-       bool "SMDK6400"
-       depends on ATAGS
-       select CPU_S3C6400
-       select S3C64XX_SETUP_SDHCI
-       select S3C_DEV_HSMMC1
-       help
-         Machine support for the Samsung SMDK6400
-
-# S3C6410 machine support
-
-config MACH_ANW6410
-       bool "A&W6410"
-       depends on ATAGS
-       select CPU_S3C6410
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C_DEV_FB
-       help
-         Machine support for the A&W6410
-
-config MACH_MINI6410
-       bool "MINI6410"
-       depends on ATAGS
-       select CPU_S3C6410
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C64XX_SETUP_SDHCI
-       select S3C_DEV_FB
-       select S3C_DEV_HSMMC
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       select SAMSUNG_DEV_ADC
-       select SAMSUNG_DEV_TS
-       help
-         Machine support for the FriendlyARM MINI6410
-
-config MACH_REAL6410
-       bool "REAL6410"
-       depends on ATAGS
-       select CPU_S3C6410
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C64XX_SETUP_SDHCI
-       select S3C_DEV_FB
-       select S3C_DEV_HSMMC
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       select SAMSUNG_DEV_ADC
-       select SAMSUNG_DEV_TS
-       help
-         Machine support for the CoreWind REAL6410
-
-config MACH_SMDK6410
-       bool "SMDK6410"
-       depends on ATAGS
-       select CPU_S3C6410
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C64XX_SETUP_I2C1
-       select S3C64XX_SETUP_IDE
-       select S3C64XX_SETUP_KEYPAD
-       select S3C64XX_SETUP_SDHCI
-       select S3C64XX_SETUP_USB_PHY
-       select S3C_DEV_FB
-       select S3C_DEV_HSMMC
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_I2C1
-       select S3C_DEV_RTC
-       select S3C_DEV_USB_HOST
-       select S3C_DEV_USB_HSOTG
-       select S3C_DEV_WDT
-       select SAMSUNG_DEV_ADC
-       select SAMSUNG_DEV_BACKLIGHT
-       select SAMSUNG_DEV_IDE
-       select SAMSUNG_DEV_KEYPAD
-       select SAMSUNG_DEV_PWM
-       select SAMSUNG_DEV_TS
-       help
-         Machine support for the Samsung SMDK6410
-
-# At least some of the SMDK6410s were shipped with the card detect
-# for the MMC/SD slots connected to the same input. This means that
-# either the boards need to be altered to have channel0 to an alternate
-# configuration or that only one slot can be used.
-
-choice
-       prompt "SMDK6410 MMC/SD slot setup"
-       depends on MACH_SMDK6410
-
-config SMDK6410_SD_CH0
-       bool "Use channel 0 only"
-       depends on MACH_SMDK6410
-       help
-          Select CON7 (channel 0) as the MMC/SD slot, as
-         at least some SMDK6410 boards come with the
-         resistors fitted so that the card detects for
-         channels 0 and 1 are the same.
-
-config SMDK6410_SD_CH1
-       bool "Use channel 1 only"
-       depends on MACH_SMDK6410
-       help
-          Select CON6 (channel 1) as the MMC/SD slot, as
-         at least some SMDK6410 boards come with the
-         resistors fitted so that the card detects for
-         channels 0 and 1 are the same.
-
-endchoice
-
-config SMDK6410_WM1190_EV1
-       bool "Support Wolfson Microelectronics 1190-EV1 PMIC card"
-       depends on MACH_SMDK6410
-       depends on I2C=y
-       select MFD_WM8350_I2C
-       select REGULATOR
-       select REGULATOR_WM8350
-       help
-         The Wolfson Microelectronics 1190-EV1 is a WM835x based PMIC
-         and audio daughtercard for the Samsung SMDK6410 reference
-         platform.  Enabling this option will build support for this
-         module into the kernel.  The presence of the module will be
-         detected at runtime so the resulting kernel can be used
-         with or without the 1190-EV1 fitted.
-
-config SMDK6410_WM1192_EV1
-       bool "Support Wolfson Microelectronics 1192-EV1 PMIC card"
-       depends on MACH_SMDK6410
-       depends on I2C=y
-       select MFD_WM831X
-       select MFD_WM831X_I2C
-       select REGULATOR
-       select REGULATOR_WM831X
-       help
-         The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC
-         daughtercard for the Samsung SMDK6410 reference platform.
-         Enabling this option will build support for this module into
-         the kernel.  The presence of the daughtercard will be
-         detected at runtime so the resulting kernel can be used
-         with or without the 1192-EV1 fitted.
-
-config MACH_NCP
-       bool "NCP"
-       depends on ATAGS
-       select CPU_S3C6410
-       select S3C64XX_SETUP_I2C1
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_I2C1
-       help
-          Machine support for the Samsung NCP
-
-config MACH_HMT
-       bool "Airgoo HMT"
-       depends on ATAGS
-       select CPU_S3C6410
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C_DEV_FB
-       select S3C_DEV_NAND
-       select S3C_DEV_USB_HOST
-       select SAMSUNG_DEV_PWM
-       help
-         Machine support for the Airgoo HMT
-
-config MACH_SMARTQ
-       bool
-       select CPU_S3C6410
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C64XX_SETUP_SDHCI
-       select S3C64XX_SETUP_USB_PHY
-       select S3C_DEV_FB
-       select S3C_DEV_HSMMC
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_HSMMC2
-       select S3C_DEV_HWMON
-       select S3C_DEV_RTC
-       select S3C_DEV_USB_HOST
-       select S3C_DEV_USB_HSOTG
-       select SAMSUNG_DEV_ADC
-       select SAMSUNG_DEV_PWM
-       select SAMSUNG_DEV_TS
-       help
-           Shared machine support for SmartQ 5/7
-
-config MACH_SMARTQ5
-       bool "SmartQ 5"
-       depends on ATAGS
-       select MACH_SMARTQ
-       help
-           Machine support for the SmartQ 5
-
-config MACH_SMARTQ7
-       bool "SmartQ 7"
-       depends on ATAGS
-       select MACH_SMARTQ
-       help
-           Machine support for the SmartQ 7
-
-config MACH_WLF_CRAGG_6410
-       bool "Wolfson Cragganmore 6410"
-       depends on ATAGS
-       depends on I2C=y
-       select CPU_S3C6410
-       select LEDS_GPIO_REGISTER
-       select S3C64XX_DEV_SPI0
-       select S3C64XX_SETUP_FB_24BPP
-       select S3C64XX_SETUP_I2C1
-       select S3C64XX_SETUP_IDE
-       select S3C64XX_SETUP_KEYPAD
-       select S3C64XX_SETUP_SDHCI
-       select S3C64XX_SETUP_SPI
-       select S3C64XX_SETUP_USB_PHY
-       select S3C_DEV_FB
-       select S3C_DEV_HSMMC
-       select S3C_DEV_HSMMC1
-       select S3C_DEV_HSMMC2
-       select S3C_DEV_I2C1
-       select S3C_DEV_RTC
-       select S3C_DEV_USB_HOST
-       select S3C_DEV_USB_HSOTG
-       select S3C_DEV_WDT
-       select SAMSUNG_DEV_ADC
-       select SAMSUNG_DEV_KEYPAD
-       select SAMSUNG_DEV_PWM
-       help
-         Machine support for the Wolfson Cragganmore S3C6410 variant.
-
-config MACH_S3C64XX_DT
-       bool "Samsung S3C6400/S3C6410 machine using Device Tree"
-       select CPU_S3C6400
-       select CPU_S3C6410
-       select PINCTRL
-       select PINCTRL_S3C64XX
-       help
-         Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
-         enabled.
-         Select this if a fdt blob is available for your S3C64XX SoC based
-         board.
-         Note: This is under development and not all peripherals can be
-         supported with this machine file.
-
-endif
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
deleted file mode 100644 (file)
index 8caeb4a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright 2008 Openmoko, Inc.
-# Copyright 2008 Simtec Electronics
-
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
-asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
-
-# PM
-
-obj-$(CONFIG_PM)               += pm.o
-obj-$(CONFIG_PM_SLEEP)         += sleep.o
-obj-$(CONFIG_CPU_IDLE)         += cpuidle.o
-
-ifdef CONFIG_SAMSUNG_ATAGS
-
-obj-$(CONFIG_PM_SLEEP)          += irq-pm.o
-
-# Core
-
-obj-y                          += common.o
-obj-$(CONFIG_CPU_S3C6400)      += s3c6400.o
-obj-$(CONFIG_CPU_S3C6410)      += s3c6410.o
-
-# DMA support
-
-obj-$(CONFIG_S3C64XX_PL080)    += pl080.o
-
-# Device support
-
-obj-y                          += dev-uart.o
-obj-y                          += dev-audio.o
-
-# Device setup
-
-obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP)   += setup-fb-24bpp.o
-obj-$(CONFIG_S3C64XX_SETUP_I2C0)       += setup-i2c0.o
-obj-$(CONFIG_S3C64XX_SETUP_I2C1)       += setup-i2c1.o
-obj-$(CONFIG_S3C64XX_SETUP_IDE)                += setup-ide.o
-obj-$(CONFIG_S3C64XX_SETUP_KEYPAD)     += setup-keypad.o
-obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
-obj-$(CONFIG_S3C64XX_SETUP_SPI)                += setup-spi.o
-obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy.o
-
-obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)    += dev-backlight.o
-
-# Machine support
-
-obj-$(CONFIG_MACH_ANW6410)             += mach-anw6410.o
-obj-$(CONFIG_MACH_HMT)                 += mach-hmt.o
-obj-$(CONFIG_MACH_MINI6410)            += mach-mini6410.o
-obj-$(CONFIG_MACH_NCP)                 += mach-ncp.o
-obj-$(CONFIG_MACH_REAL6410)            += mach-real6410.o
-obj-$(CONFIG_MACH_SMARTQ)              += mach-smartq.o
-obj-$(CONFIG_MACH_SMARTQ5)             += mach-smartq5.o
-obj-$(CONFIG_MACH_SMARTQ7)             += mach-smartq7.o
-obj-$(CONFIG_MACH_SMDK6400)            += mach-smdk6400.o
-obj-$(CONFIG_MACH_SMDK6410)            += mach-smdk6410.o
-obj-$(CONFIG_MACH_WLF_CRAGG_6410)      += mach-crag6410.o mach-crag6410-module.o
-endif
-
-obj-$(CONFIG_MACH_S3C64XX_DT)          += mach-s3c64xx-dt.o
diff --git a/arch/arm/mach-s3c64xx/ata-core.h b/arch/arm/mach-s3c64xx/ata-core.h
deleted file mode 100644 (file)
index 6d9a81f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * Samsung CF-ATA Controller core functions
- */
-
-#ifndef __ASM_PLAT_ATA_CORE_H
-#define __ASM_PLAT_ATA_CORE_H __FILE__
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
-*/
-
-/* re-define device name depending on support. */
-static inline void s3c_cfcon_setname(char *name)
-{
-#ifdef CONFIG_SAMSUNG_DEV_IDE
-       s3c_device_cfcon.name = name;
-#endif
-}
-
-#endif /* __ASM_PLAT_ATA_CORE_H */
diff --git a/arch/arm/mach-s3c64xx/backlight.h b/arch/arm/mach-s3c64xx/backlight.h
deleted file mode 100644 (file)
index 028663f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *              http://www.samsung.com
- */
-
-#ifndef __ASM_PLAT_BACKLIGHT_H
-#define __ASM_PLAT_BACKLIGHT_H __FILE__
-
-/* samsung_bl_gpio_info - GPIO info for PWM Backlight control
- * @no:                GPIO number for PWM timer out
- * @func:      Special function of GPIO line for PWM timer
- */
-struct samsung_bl_gpio_info {
-       int no;
-       int func;
-};
-
-extern void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
-       struct platform_pwm_backlight_data *bl_data);
-
-#endif /* __ASM_PLAT_BACKLIGHT_H */
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
deleted file mode 100644 (file)
index cb5aafc..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2011 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Common Codes for S3C64XX machines
-
-/*
- * NOTE: Code in this file is not used when booting with Device Tree support.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/reboot.h>
-#include <linux/io.h>
-#include <linux/dma-mapping.h>
-#include <linux/irq.h>
-#include <linux/gpio.h>
-#include <linux/irqchip/arm-vic.h>
-#include <clocksource/samsung_pwm.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/system_misc.h>
-
-#include <mach/map.h>
-#include <mach/irqs.h>
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/gpio-cfg.h>
-#include <plat/pwm-core.h>
-#include <plat/regs-irqtype.h>
-
-#include "common.h"
-#include "irq-uart.h"
-#include "watchdog-reset.h"
-
-/* External clock frequency */
-static unsigned long xtal_f __ro_after_init = 12000000;
-static unsigned long xusbxti_f __ro_after_init = 48000000;
-
-void __init s3c64xx_set_xtal_freq(unsigned long freq)
-{
-       xtal_f = freq;
-}
-
-void __init s3c64xx_set_xusbxti_freq(unsigned long freq)
-{
-       xusbxti_f = freq;
-}
-
-/* uart registration process */
-
-static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no);
-}
-
-/* table of supported CPUs */
-
-static const char name_s3c6400[] = "S3C6400";
-static const char name_s3c6410[] = "S3C6410";
-
-static struct cpu_table cpu_ids[] __initdata = {
-       {
-               .idcode         = S3C6400_CPU_ID,
-               .idmask         = S3C64XX_CPU_MASK,
-               .map_io         = s3c6400_map_io,
-               .init_uarts     = s3c64xx_init_uarts,
-               .init           = s3c6400_init,
-               .name           = name_s3c6400,
-       }, {
-               .idcode         = S3C6410_CPU_ID,
-               .idmask         = S3C64XX_CPU_MASK,
-               .map_io         = s3c6410_map_io,
-               .init_uarts     = s3c64xx_init_uarts,
-               .init           = s3c6410_init,
-               .name           = name_s3c6410,
-       },
-};
-
-/* minimal IO mapping */
-
-/*
- * note, for the boot process to work we have to keep the UART
- * virtual address aligned to an 1MiB boundary for the L1
- * mapping the head code makes. We keep the UART virtual address
- * aligned and add in the offset when we load the value here.
- */
-#define UART_OFFS (S3C_PA_UART & 0xfffff)
-
-static struct map_desc s3c_iodesc[] __initdata = {
-       {
-               .virtual        = (unsigned long)S3C_VA_SYS,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_SYSCON),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S3C_VA_MEM,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_SROM),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)(S3C_VA_UART + UART_OFFS),
-               .pfn            = __phys_to_pfn(S3C_PA_UART),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)VA_VIC0,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_VIC0),
-               .length         = SZ_16K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)VA_VIC1,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_VIC1),
-               .length         = SZ_16K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S3C_VA_TIMER,
-               .pfn            = __phys_to_pfn(S3C_PA_TIMER),
-               .length         = SZ_16K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S3C64XX_VA_GPIO,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_GPIO),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S3C64XX_VA_MODEM,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_MODEM),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S3C_VA_WATCHDOG,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_WATCHDOG),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S3C_VA_USB_HSPHY,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_USB_HSPHY),
-               .length         = SZ_1K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct bus_type s3c64xx_subsys = {
-       .name           = "s3c64xx-core",
-       .dev_name       = "s3c64xx-core",
-};
-
-static struct device s3c64xx_dev = {
-       .bus    = &s3c64xx_subsys,
-};
-
-static struct samsung_pwm_variant s3c64xx_pwm_variant = {
-       .bits           = 32,
-       .div_base       = 0,
-       .has_tint_cstat = true,
-       .tclk_mask      = (1 << 7) | (1 << 6) | (1 << 5),
-};
-
-void __init samsung_set_timer_source(unsigned int event, unsigned int source)
-{
-       s3c64xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
-       s3c64xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
-}
-
-void __init samsung_timer_init(void)
-{
-       unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
-               IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
-               IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
-       };
-
-       samsung_pwm_clocksource_init(S3C_VA_TIMER,
-                                       timer_irqs, &s3c64xx_pwm_variant);
-}
-
-/* read cpu identification code */
-
-void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
-{
-       /* initialise the io descriptors we need for initialisation */
-       iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
-       iotable_init(mach_desc, size);
-
-       /* detect cpu id */
-       s3c64xx_init_cpu();
-
-       s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
-
-       samsung_pwm_set_platdata(&s3c64xx_pwm_variant);
-}
-
-static __init int s3c64xx_dev_init(void)
-{
-       /* Not applicable when using DT. */
-       if (of_have_populated_dt() || !soc_is_s3c64xx())
-               return 0;
-
-       subsys_system_register(&s3c64xx_subsys, NULL);
-       return device_register(&s3c64xx_dev);
-}
-core_initcall(s3c64xx_dev_init);
-
-/*
- * setup the sources the vic should advertise resume
- * for, even though it is not doing the wake
- * (set_irq_wake needs to be valid)
- */
-#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE))
-#define IRQ_VIC1_RESUME (1 << (IRQ_RTC_ALARM - IRQ_VIC1_BASE) |        \
-                        1 << (IRQ_PENDN - IRQ_VIC1_BASE) |     \
-                        1 << (IRQ_HSMMC0 - IRQ_VIC1_BASE) |    \
-                        1 << (IRQ_HSMMC1 - IRQ_VIC1_BASE) |    \
-                        1 << (IRQ_HSMMC2 - IRQ_VIC1_BASE))
-
-void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
-{
-       /*
-        * FIXME: there is no better place to put this at the moment
-        * (s3c64xx_clk_init needs ioremap and must happen before init_time
-        * samsung_wdt_reset_init needs clocks)
-        */
-       s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
-       samsung_wdt_reset_init(S3C_VA_WATCHDOG);
-
-       printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
-
-       /* initialise the pair of VICs */
-       vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
-       vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
-}
-
-#define eint_offset(irq)       ((irq) - IRQ_EINT(0))
-#define eint_irq_to_bit(irq)   ((u32)(1 << eint_offset(irq)))
-
-static inline void s3c_irq_eint_mask(struct irq_data *data)
-{
-       u32 mask;
-
-       mask = __raw_readl(S3C64XX_EINT0MASK);
-       mask |= (u32)data->chip_data;
-       __raw_writel(mask, S3C64XX_EINT0MASK);
-}
-
-static void s3c_irq_eint_unmask(struct irq_data *data)
-{
-       u32 mask;
-
-       mask = __raw_readl(S3C64XX_EINT0MASK);
-       mask &= ~((u32)data->chip_data);
-       __raw_writel(mask, S3C64XX_EINT0MASK);
-}
-
-static inline void s3c_irq_eint_ack(struct irq_data *data)
-{
-       __raw_writel((u32)data->chip_data, S3C64XX_EINT0PEND);
-}
-
-static void s3c_irq_eint_maskack(struct irq_data *data)
-{
-       /* compiler should in-line these */
-       s3c_irq_eint_mask(data);
-       s3c_irq_eint_ack(data);
-}
-
-static int s3c_irq_eint_set_type(struct irq_data *data, unsigned int type)
-{
-       int offs = eint_offset(data->irq);
-       int pin, pin_val;
-       int shift;
-       u32 ctrl, mask;
-       u32 newvalue = 0;
-       void __iomem *reg;
-
-       if (offs > 27)
-               return -EINVAL;
-
-       if (offs <= 15)
-               reg = S3C64XX_EINT0CON0;
-       else
-               reg = S3C64XX_EINT0CON1;
-
-       switch (type) {
-       case IRQ_TYPE_NONE:
-               printk(KERN_WARNING "No edge setting!\n");
-               break;
-
-       case IRQ_TYPE_EDGE_RISING:
-               newvalue = S3C2410_EXTINT_RISEEDGE;
-               break;
-
-       case IRQ_TYPE_EDGE_FALLING:
-               newvalue = S3C2410_EXTINT_FALLEDGE;
-               break;
-
-       case IRQ_TYPE_EDGE_BOTH:
-               newvalue = S3C2410_EXTINT_BOTHEDGE;
-               break;
-
-       case IRQ_TYPE_LEVEL_LOW:
-               newvalue = S3C2410_EXTINT_LOWLEV;
-               break;
-
-       case IRQ_TYPE_LEVEL_HIGH:
-               newvalue = S3C2410_EXTINT_HILEV;
-               break;
-
-       default:
-               printk(KERN_ERR "No such irq type %d", type);
-               return -1;
-       }
-
-       if (offs <= 15)
-               shift = (offs / 2) * 4;
-       else
-               shift = ((offs - 16) / 2) * 4;
-       mask = 0x7 << shift;
-
-       ctrl = __raw_readl(reg);
-       ctrl &= ~mask;
-       ctrl |= newvalue << shift;
-       __raw_writel(ctrl, reg);
-
-       /* set the GPIO pin appropriately */
-
-       if (offs < 16) {
-               pin = S3C64XX_GPN(offs);
-               pin_val = S3C_GPIO_SFN(2);
-       } else if (offs < 23) {
-               pin = S3C64XX_GPL(offs + 8 - 16);
-               pin_val = S3C_GPIO_SFN(3);
-       } else {
-               pin = S3C64XX_GPM(offs - 23);
-               pin_val = S3C_GPIO_SFN(3);
-       }
-
-       s3c_gpio_cfgpin(pin, pin_val);
-
-       return 0;
-}
-
-static struct irq_chip s3c_irq_eint = {
-       .name           = "s3c-eint",
-       .irq_mask       = s3c_irq_eint_mask,
-       .irq_unmask     = s3c_irq_eint_unmask,
-       .irq_mask_ack   = s3c_irq_eint_maskack,
-       .irq_ack        = s3c_irq_eint_ack,
-       .irq_set_type   = s3c_irq_eint_set_type,
-       .irq_set_wake   = s3c_irqext_wake,
-};
-
-/* s3c_irq_demux_eint
- *
- * This function demuxes the IRQ from the group0 external interrupts,
- * from IRQ_EINT(0) to IRQ_EINT(27). It is designed to be inlined into
- * the specific handlers s3c_irq_demux_eintX_Y.
- */
-static inline void s3c_irq_demux_eint(unsigned int start, unsigned int end)
-{
-       u32 status = __raw_readl(S3C64XX_EINT0PEND);
-       u32 mask = __raw_readl(S3C64XX_EINT0MASK);
-       unsigned int irq;
-
-       status &= ~mask;
-       status >>= start;
-       status &= (1 << (end - start + 1)) - 1;
-
-       for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) {
-               if (status & 1)
-                       generic_handle_irq(irq);
-
-               status >>= 1;
-       }
-}
-
-static void s3c_irq_demux_eint0_3(struct irq_desc *desc)
-{
-       s3c_irq_demux_eint(0, 3);
-}
-
-static void s3c_irq_demux_eint4_11(struct irq_desc *desc)
-{
-       s3c_irq_demux_eint(4, 11);
-}
-
-static void s3c_irq_demux_eint12_19(struct irq_desc *desc)
-{
-       s3c_irq_demux_eint(12, 19);
-}
-
-static void s3c_irq_demux_eint20_27(struct irq_desc *desc)
-{
-       s3c_irq_demux_eint(20, 27);
-}
-
-static int __init s3c64xx_init_irq_eint(void)
-{
-       int irq;
-
-       /* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
-       if (of_have_populated_dt() || !soc_is_s3c64xx())
-               return -ENODEV;
-
-       for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
-               irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq);
-               irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq));
-               irq_clear_status_flags(irq, IRQ_NOREQUEST);
-       }
-
-       irq_set_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3);
-       irq_set_chained_handler(IRQ_EINT4_11, s3c_irq_demux_eint4_11);
-       irq_set_chained_handler(IRQ_EINT12_19, s3c_irq_demux_eint12_19);
-       irq_set_chained_handler(IRQ_EINT20_27, s3c_irq_demux_eint20_27);
-
-       return 0;
-}
-arch_initcall(s3c64xx_init_irq_eint);
-
-void s3c64xx_restart(enum reboot_mode mode, const char *cmd)
-{
-       if (mode != REBOOT_SOFT)
-               samsung_wdt_reset();
-
-       /* if all else fails, or mode was for soft, jump to 0 */
-       soft_restart(0);
-}
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
deleted file mode 100644 (file)
index 0367088..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * Common Header for S3C64XX machines
- */
-
-#ifndef __ARCH_ARM_MACH_S3C64XX_COMMON_H
-#define __ARCH_ARM_MACH_S3C64XX_COMMON_H
-
-#include <linux/reboot.h>
-
-void s3c64xx_init_irq(u32 vic0, u32 vic1);
-void s3c64xx_init_io(struct map_desc *mach_desc, int size);
-
-void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
-
-struct device_node;
-void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
-       unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base);
-void s3c64xx_set_xtal_freq(unsigned long freq);
-void s3c64xx_set_xusbxti_freq(unsigned long freq);
-
-#ifdef CONFIG_CPU_S3C6400
-
-extern  int s3c6400_init(void);
-extern void s3c6400_init_irq(void);
-extern void s3c6400_map_io(void);
-
-#else
-#define s3c6400_map_io NULL
-#define s3c6400_init NULL
-#endif
-
-#ifdef CONFIG_CPU_S3C6410
-
-extern  int s3c6410_init(void);
-extern void s3c6410_init_irq(void);
-extern void s3c6410_map_io(void);
-
-#else
-#define s3c6410_map_io NULL
-#define s3c6410_init NULL
-#endif
-
-#ifdef CONFIG_S3C64XX_PL080
-extern struct pl08x_platform_data s3c64xx_dma0_plat_data;
-extern struct pl08x_platform_data s3c64xx_dma1_plat_data;
-#endif
-
-#endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
deleted file mode 100644 (file)
index 0bac6f6..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2011 Wolfson Microelectronics, plc
-// Copyright (c) 2011 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <linux/time.h>
-
-#include <asm/cpuidle.h>
-
-#include <plat/cpu.h>
-#include <mach/map.h>
-
-#include "regs-sys.h"
-#include "regs-syscon-power.h"
-
-static int s3c64xx_enter_idle(struct cpuidle_device *dev,
-                             struct cpuidle_driver *drv,
-                             int index)
-{
-       unsigned long tmp;
-
-       /* Setup PWRCFG to enter idle mode */
-       tmp = __raw_readl(S3C64XX_PWR_CFG);
-       tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
-       tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
-       __raw_writel(tmp, S3C64XX_PWR_CFG);
-
-       cpu_do_idle();
-
-       return index;
-}
-
-static struct cpuidle_driver s3c64xx_cpuidle_driver = {
-       .name   = "s3c64xx_cpuidle",
-       .owner  = THIS_MODULE,
-       .states = {
-               {
-                       .enter            = s3c64xx_enter_idle,
-                       .exit_latency     = 1,
-                       .target_residency = 1,
-                       .name             = "IDLE",
-                       .desc             = "System active, ARM gated",
-               },
-       },
-       .state_count = 1,
-};
-
-static int __init s3c64xx_init_cpuidle(void)
-{
-       if (soc_is_s3c64xx())
-               return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
-       return 0;
-}
-device_initcall(s3c64xx_init_cpuidle);
diff --git a/arch/arm/mach-s3c64xx/crag6410.h b/arch/arm/mach-s3c64xx/crag6410.h
deleted file mode 100644 (file)
index 00d9aa1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Cragganmore 6410 shared definitions
- *
- * Copyright 2011 Wolfson Microelectronics plc
- *     Mark Brown <broonie@opensource.wolfsonmicro.com>
- */
-
-#ifndef MACH_CRAG6410_H
-#define MACH_CRAG6410_H
-
-#include <mach/gpio-samsung.h>
-
-#define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START
-#define BANFF_PMIC_IRQ_BASE            (IRQ_BOARD_START + 64)
-
-#define PCA935X_GPIO_BASE              GPIO_BOARD_START
-#define CODEC_GPIO_BASE                        (GPIO_BOARD_START + 8)
-#define GLENFARCLAS_PMIC_GPIO_BASE     (GPIO_BOARD_START + 32)
-#define BANFF_PMIC_GPIO_BASE           (GPIO_BOARD_START + 64)
-#define MMGPIO_GPIO_BASE               (GPIO_BOARD_START + 96)
-
-#endif
diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c
deleted file mode 100644 (file)
index e3c49b5..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2009 Wolfson Microelectronics
-//      Mark Brown <broonie@opensource.wolfsonmicro.com>
-
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/gpio.h>
-#include <linux/export.h>
-
-#include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/dma.h>
-
-#include <plat/devs.h>
-#include <linux/platform_data/asoc-s3c.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
-{
-       unsigned int base;
-
-       switch (pdev->id) {
-       case 0:
-               base = S3C64XX_GPD(0);
-               break;
-       case 1:
-               base = S3C64XX_GPE(0);
-               break;
-       case 2:
-               s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C_GPIO_SFN(5));
-               s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C_GPIO_SFN(5));
-               s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C_GPIO_SFN(5));
-               s3c_gpio_cfgpin_range(S3C64XX_GPH(6), 4, S3C_GPIO_SFN(5));
-               return 0;
-       default:
-               printk(KERN_DEBUG "Invalid I2S Controller number: %d\n",
-                       pdev->id);
-               return -EINVAL;
-       }
-
-       s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
-
-       return 0;
-}
-
-static struct resource s3c64xx_iis0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
-};
-
-static struct s3c_audio_pdata i2s0_pdata = {
-       .cfg_gpio = s3c64xx_i2s_cfg_gpio,
-};
-
-struct platform_device s3c64xx_device_iis0 = {
-       .name             = "samsung-i2s",
-       .id               = 0,
-       .num_resources    = ARRAY_SIZE(s3c64xx_iis0_resource),
-       .resource         = s3c64xx_iis0_resource,
-       .dev = {
-               .platform_data = &i2s0_pdata,
-       },
-};
-EXPORT_SYMBOL(s3c64xx_device_iis0);
-
-static struct resource s3c64xx_iis1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
-};
-
-static struct s3c_audio_pdata i2s1_pdata = {
-       .cfg_gpio = s3c64xx_i2s_cfg_gpio,
-};
-
-struct platform_device s3c64xx_device_iis1 = {
-       .name             = "samsung-i2s",
-       .id               = 1,
-       .num_resources    = ARRAY_SIZE(s3c64xx_iis1_resource),
-       .resource         = s3c64xx_iis1_resource,
-       .dev = {
-               .platform_data = &i2s1_pdata,
-       },
-};
-EXPORT_SYMBOL(s3c64xx_device_iis1);
-
-static struct resource s3c64xx_iisv4_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
-};
-
-static struct s3c_audio_pdata i2sv4_pdata = {
-       .cfg_gpio = s3c64xx_i2s_cfg_gpio,
-       .type = {
-               .quirks = QUIRK_PRI_6CHAN,
-       },
-};
-
-struct platform_device s3c64xx_device_iisv4 = {
-       .name = "samsung-i2s",
-       .id = 2,
-       .num_resources    = ARRAY_SIZE(s3c64xx_iisv4_resource),
-       .resource         = s3c64xx_iisv4_resource,
-       .dev = {
-               .platform_data = &i2sv4_pdata,
-       },
-};
-EXPORT_SYMBOL(s3c64xx_device_iisv4);
-
-
-/* PCM Controller platform_devices */
-
-static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
-{
-       unsigned int base;
-
-       switch (pdev->id) {
-       case 0:
-               base = S3C64XX_GPD(0);
-               break;
-       case 1:
-               base = S3C64XX_GPE(0);
-               break;
-       default:
-               printk(KERN_DEBUG "Invalid PCM Controller number: %d\n",
-                       pdev->id);
-               return -EINVAL;
-       }
-
-       s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2));
-       return 0;
-}
-
-static struct resource s3c64xx_pcm0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
-};
-
-static struct s3c_audio_pdata s3c_pcm0_pdata = {
-       .cfg_gpio = s3c64xx_pcm_cfg_gpio,
-};
-
-struct platform_device s3c64xx_device_pcm0 = {
-       .name             = "samsung-pcm",
-       .id               = 0,
-       .num_resources    = ARRAY_SIZE(s3c64xx_pcm0_resource),
-       .resource         = s3c64xx_pcm0_resource,
-       .dev = {
-               .platform_data = &s3c_pcm0_pdata,
-       },
-};
-EXPORT_SYMBOL(s3c64xx_device_pcm0);
-
-static struct resource s3c64xx_pcm1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
-};
-
-static struct s3c_audio_pdata s3c_pcm1_pdata = {
-       .cfg_gpio = s3c64xx_pcm_cfg_gpio,
-};
-
-struct platform_device s3c64xx_device_pcm1 = {
-       .name             = "samsung-pcm",
-       .id               = 1,
-       .num_resources    = ARRAY_SIZE(s3c64xx_pcm1_resource),
-       .resource         = s3c64xx_pcm1_resource,
-       .dev = {
-               .platform_data = &s3c_pcm1_pdata,
-       },
-};
-EXPORT_SYMBOL(s3c64xx_device_pcm1);
-
-/* AC97 Controller platform devices */
-
-static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev)
-{
-       return s3c_gpio_cfgpin_range(S3C64XX_GPD(0), 5, S3C_GPIO_SFN(4));
-}
-
-static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
-{
-       return s3c_gpio_cfgpin_range(S3C64XX_GPE(0), 5, S3C_GPIO_SFN(4));
-}
-
-static struct resource s3c64xx_ac97_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_AC97),
-};
-
-static struct s3c_audio_pdata s3c_ac97_pdata = {
-};
-
-static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
-
-struct platform_device s3c64xx_device_ac97 = {
-       .name             = "samsung-ac97",
-       .id               = -1,
-       .num_resources    = ARRAY_SIZE(s3c64xx_ac97_resource),
-       .resource         = s3c64xx_ac97_resource,
-       .dev = {
-               .platform_data = &s3c_ac97_pdata,
-               .dma_mask = &s3c64xx_ac97_dmamask,
-               .coherent_dma_mask = DMA_BIT_MASK(32),
-       },
-};
-EXPORT_SYMBOL(s3c64xx_device_ac97);
-
-void __init s3c64xx_ac97_setup_gpio(int num)
-{
-       if (num == S3C64XX_AC97_GPD)
-               s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpd;
-       else
-               s3c_ac97_pdata.cfg_gpio = s3c64xx_ac97_cfg_gpe;
-}
diff --git a/arch/arm/mach-s3c64xx/dev-backlight.c b/arch/arm/mach-s3c64xx/dev-backlight.c
deleted file mode 100644 (file)
index 09e6da3..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2011 Samsung Electronics Co., Ltd.
-//              http://www.samsung.com
-//
-// Common infrastructure for PWM Backlight for Samsung boards
-
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/pwm_backlight.h>
-
-#include <plat/devs.h>
-#include <plat/gpio-cfg.h>
-
-#include "backlight.h"
-
-struct samsung_bl_drvdata {
-       struct platform_pwm_backlight_data plat_data;
-       struct samsung_bl_gpio_info *gpio_info;
-};
-
-static int samsung_bl_init(struct device *dev)
-{
-       int ret = 0;
-       struct platform_pwm_backlight_data *pdata = dev->platform_data;
-       struct samsung_bl_drvdata *drvdata = container_of(pdata,
-                                       struct samsung_bl_drvdata, plat_data);
-       struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;
-
-       ret = gpio_request(bl_gpio_info->no, "Backlight");
-       if (ret) {
-               printk(KERN_ERR "failed to request GPIO for LCD Backlight\n");
-               return ret;
-       }
-
-       /* Configure GPIO pin with specific GPIO function for PWM timer */
-       s3c_gpio_cfgpin(bl_gpio_info->no, bl_gpio_info->func);
-
-       return 0;
-}
-
-static void samsung_bl_exit(struct device *dev)
-{
-       struct platform_pwm_backlight_data *pdata = dev->platform_data;
-       struct samsung_bl_drvdata *drvdata = container_of(pdata,
-                                       struct samsung_bl_drvdata, plat_data);
-       struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;
-
-       s3c_gpio_cfgpin(bl_gpio_info->no, S3C_GPIO_OUTPUT);
-       gpio_free(bl_gpio_info->no);
-}
-
-/* Initialize few important fields of platform_pwm_backlight_data
- * structure with default values. These fields can be overridden by
- * board-specific values sent from machine file.
- * For ease of operation, these fields are initialized with values
- * used by most samsung boards.
- * Users has the option of sending info about other parameters
- * for their specific boards
- */
-
-static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
-       .plat_data = {
-               .max_brightness = 255,
-               .dft_brightness = 255,
-               .init           = samsung_bl_init,
-               .exit           = samsung_bl_exit,
-       },
-};
-
-static struct platform_device samsung_dfl_bl_device __initdata = {
-       .name           = "pwm-backlight",
-};
-
-/* samsung_bl_set - Set board specific data (if any) provided by user for
- * PWM Backlight control and register specific PWM and backlight device.
- * @gpio_info: structure containing GPIO info for PWM timer
- * @bl_data:   structure containing Backlight control data
- */
-void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
-       struct platform_pwm_backlight_data *bl_data)
-{
-       int ret = 0;
-       struct platform_device *samsung_bl_device;
-       struct samsung_bl_drvdata *samsung_bl_drvdata;
-       struct platform_pwm_backlight_data *samsung_bl_data;
-
-       samsung_bl_device = kmemdup(&samsung_dfl_bl_device,
-                       sizeof(struct platform_device), GFP_KERNEL);
-       if (!samsung_bl_device)
-               return;
-
-       samsung_bl_drvdata = kmemdup(&samsung_dfl_bl_data,
-                               sizeof(samsung_dfl_bl_data), GFP_KERNEL);
-       if (!samsung_bl_drvdata)
-               goto err_data;
-
-       samsung_bl_device->dev.platform_data = &samsung_bl_drvdata->plat_data;
-       samsung_bl_drvdata->gpio_info = gpio_info;
-       samsung_bl_data = &samsung_bl_drvdata->plat_data;
-
-       /* Copy board specific data provided by user */
-       samsung_bl_device->dev.parent = &samsung_device_pwm.dev;
-
-       if (bl_data->max_brightness)
-               samsung_bl_data->max_brightness = bl_data->max_brightness;
-       if (bl_data->dft_brightness)
-               samsung_bl_data->dft_brightness = bl_data->dft_brightness;
-       if (bl_data->lth_brightness)
-               samsung_bl_data->lth_brightness = bl_data->lth_brightness;
-       if (bl_data->init)
-               samsung_bl_data->init = bl_data->init;
-       if (bl_data->notify)
-               samsung_bl_data->notify = bl_data->notify;
-       if (bl_data->notify_after)
-               samsung_bl_data->notify_after = bl_data->notify_after;
-       if (bl_data->exit)
-               samsung_bl_data->exit = bl_data->exit;
-       if (bl_data->check_fb)
-               samsung_bl_data->check_fb = bl_data->check_fb;
-
-       /* Register the Backlight dev */
-       ret = platform_device_register(samsung_bl_device);
-       if (ret) {
-               printk(KERN_ERR "failed to register backlight device: %d\n", ret);
-               goto err_plat_reg2;
-       }
-
-       return;
-
-err_plat_reg2:
-       kfree(samsung_bl_data);
-err_data:
-       kfree(samsung_bl_device);
-}
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
deleted file mode 100644 (file)
index 5fb59ad..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Base S3C64XX UART resource and device definitions
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/irq.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-#include <mach/irqs.h>
-
-#include <plat/devs.h>
-
-/* Serial port registrations */
-
-/* 64xx uarts are closer together */
-
-static struct resource s3c64xx_uart0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_UART0, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_UART0),
-};
-
-static struct resource s3c64xx_uart1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_UART1, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_UART1),
-};
-
-static struct resource s3c6xx_uart2_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_UART2, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_UART2),
-};
-
-static struct resource s3c64xx_uart3_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_UART3, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_UART3),
-};
-
-
-struct s3c24xx_uart_resources s3c64xx_uart_resources[] __initdata = {
-       [0] = {
-               .resources      = s3c64xx_uart0_resource,
-               .nr_resources   = ARRAY_SIZE(s3c64xx_uart0_resource),
-       },
-       [1] = {
-               .resources      = s3c64xx_uart1_resource,
-               .nr_resources   = ARRAY_SIZE(s3c64xx_uart1_resource),
-       },
-       [2] = {
-               .resources      = s3c6xx_uart2_resource,
-               .nr_resources   = ARRAY_SIZE(s3c6xx_uart2_resource),
-       },
-       [3] = {
-               .resources      = s3c64xx_uart3_resource,
-               .nr_resources   = ARRAY_SIZE(s3c64xx_uart3_resource),
-       },
-};
diff --git a/arch/arm/mach-s3c64xx/include/mach/dma.h b/arch/arm/mach-s3c64xx/include/mach/dma.h
deleted file mode 100644 (file)
index 40ca8de..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/arch/arm/mach-s3c6400/include/mach/dma.h
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C6400 - DMA support
- */
-
-#ifndef __ASM_ARCH_DMA_H
-#define __ASM_ARCH_DMA_H __FILE__
-
-#define S3C64XX_DMA_CHAN(name)         ((unsigned long)(name))
-
-/* DMA0/SDMA0 */
-#define DMACH_UART0            "uart0_tx"
-#define DMACH_UART0_SRC2       "uart0_rx"
-#define DMACH_UART1            "uart1_tx"
-#define DMACH_UART1_SRC2       "uart1_rx"
-#define DMACH_UART2            "uart2_tx"
-#define DMACH_UART2_SRC2       "uart2_rx"
-#define DMACH_UART3            "uart3_tx"
-#define DMACH_UART3_SRC2       "uart3_rx"
-#define DMACH_PCM0_TX          "pcm0_tx"
-#define DMACH_PCM0_RX          "pcm0_rx"
-#define DMACH_I2S0_OUT         "i2s0_tx"
-#define DMACH_I2S0_IN          "i2s0_rx"
-#define DMACH_SPI0_TX          S3C64XX_DMA_CHAN("spi0_tx")
-#define DMACH_SPI0_RX          S3C64XX_DMA_CHAN("spi0_rx")
-#define DMACH_HSI_I2SV40_TX    "i2s2_tx"
-#define DMACH_HSI_I2SV40_RX    "i2s2_rx"
-
-/* DMA1/SDMA1 */
-#define DMACH_PCM1_TX          "pcm1_tx"
-#define DMACH_PCM1_RX          "pcm1_rx"
-#define DMACH_I2S1_OUT         "i2s1_tx"
-#define DMACH_I2S1_IN          "i2s1_rx"
-#define DMACH_SPI1_TX          S3C64XX_DMA_CHAN("spi1_tx")
-#define DMACH_SPI1_RX          S3C64XX_DMA_CHAN("spi1_rx")
-#define DMACH_AC97_PCMOUT      "ac97_out"
-#define DMACH_AC97_PCMIN       "ac97_in"
-#define DMACH_AC97_MICIN       "ac97_mic"
-#define DMACH_PWM              "pwm"
-#define DMACH_IRDA             "irda"
-#define DMACH_EXTERNAL         "external"
-#define DMACH_SECURITY_RX      "sec_rx"
-#define DMACH_SECURITY_TX      "sec_tx"
-
-enum dma_ch {
-       DMACH_MAX = 32
-};
-
-#include <linux/amba/pl08x.h>
-
-#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
deleted file mode 100644 (file)
index 8ed144a..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C6400 - GPIO lib support
- */
-
-#ifndef GPIO_SAMSUNG_S3C64XX_H
-#define GPIO_SAMSUNG_S3C64XX_H
-
-#ifdef CONFIG_GPIO_SAMSUNG
-
-/* GPIO bank sizes */
-#define S3C64XX_GPIO_A_NR      (8)
-#define S3C64XX_GPIO_B_NR      (7)
-#define S3C64XX_GPIO_C_NR      (8)
-#define S3C64XX_GPIO_D_NR      (5)
-#define S3C64XX_GPIO_E_NR      (5)
-#define S3C64XX_GPIO_F_NR      (16)
-#define S3C64XX_GPIO_G_NR      (7)
-#define S3C64XX_GPIO_H_NR      (10)
-#define S3C64XX_GPIO_I_NR      (16)
-#define S3C64XX_GPIO_J_NR      (12)
-#define S3C64XX_GPIO_K_NR      (16)
-#define S3C64XX_GPIO_L_NR      (15)
-#define S3C64XX_GPIO_M_NR      (6)
-#define S3C64XX_GPIO_N_NR      (16)
-#define S3C64XX_GPIO_O_NR      (16)
-#define S3C64XX_GPIO_P_NR      (15)
-#define S3C64XX_GPIO_Q_NR      (9)
-
-/* GPIO bank numbes */
-
-/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
- * space for debugging purposes so that any accidental
- * change from one gpio bank to another can be caught.
-*/
-
-#define S3C64XX_GPIO_NEXT(__gpio) \
-       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
-
-enum s3c_gpio_number {
-       S3C64XX_GPIO_A_START = 0,
-       S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
-       S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
-       S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
-       S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
-       S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
-       S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
-       S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
-       S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
-       S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
-       S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
-       S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
-       S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
-       S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
-       S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
-       S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
-       S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
-};
-
-/* S3C64XX GPIO number definitions. */
-
-#define S3C64XX_GPA(_nr)       (S3C64XX_GPIO_A_START + (_nr))
-#define S3C64XX_GPB(_nr)       (S3C64XX_GPIO_B_START + (_nr))
-#define S3C64XX_GPC(_nr)       (S3C64XX_GPIO_C_START + (_nr))
-#define S3C64XX_GPD(_nr)       (S3C64XX_GPIO_D_START + (_nr))
-#define S3C64XX_GPE(_nr)       (S3C64XX_GPIO_E_START + (_nr))
-#define S3C64XX_GPF(_nr)       (S3C64XX_GPIO_F_START + (_nr))
-#define S3C64XX_GPG(_nr)       (S3C64XX_GPIO_G_START + (_nr))
-#define S3C64XX_GPH(_nr)       (S3C64XX_GPIO_H_START + (_nr))
-#define S3C64XX_GPI(_nr)       (S3C64XX_GPIO_I_START + (_nr))
-#define S3C64XX_GPJ(_nr)       (S3C64XX_GPIO_J_START + (_nr))
-#define S3C64XX_GPK(_nr)       (S3C64XX_GPIO_K_START + (_nr))
-#define S3C64XX_GPL(_nr)       (S3C64XX_GPIO_L_START + (_nr))
-#define S3C64XX_GPM(_nr)       (S3C64XX_GPIO_M_START + (_nr))
-#define S3C64XX_GPN(_nr)       (S3C64XX_GPIO_N_START + (_nr))
-#define S3C64XX_GPO(_nr)       (S3C64XX_GPIO_O_START + (_nr))
-#define S3C64XX_GPP(_nr)       (S3C64XX_GPIO_P_START + (_nr))
-#define S3C64XX_GPQ(_nr)       (S3C64XX_GPIO_Q_START + (_nr))
-
-/* the end of the S3C64XX specific gpios */
-#define S3C64XX_GPIO_END       (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
-#define S3C_GPIO_END           S3C64XX_GPIO_END
-
-/* define the number of gpios we need to the one after the GPQ() range */
-#define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
-
-#endif /* GPIO_SAMSUNG */
-#endif /* GPIO_SAMSUNG_S3C64XX_H */
-
diff --git a/arch/arm/mach-s3c64xx/include/mach/hardware.h b/arch/arm/mach-s3c64xx/include/mach/hardware.h
deleted file mode 100644 (file)
index c4ed359..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/arch/arm/mach-s3c6400/include/mach/hardware.h
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C6400 - Hardware support
- */
-
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H __FILE__
-
-/* currently nothing here, placeholder */
-
-#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
deleted file mode 100644 (file)
index c244e48..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/arch/arm/mach-s3c64xx/include/mach/irqs.h
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C64XX - IRQ support
- */
-
-#ifndef __ASM_MACH_S3C64XX_IRQS_H
-#define __ASM_MACH_S3C64XX_IRQS_H __FILE__
-
-/* we keep the first set of CPU IRQs out of the range of
- * the ISA space, so that the PC104 has them to itself
- * and we don't end up having to do horrible things to the
- * standard ISA drivers....
- *
- * note, since we're using the VICs, our start must be a
- * mulitple of 32 to allow the common code to work
- */
-
-#define S3C_IRQ_OFFSET (32)
-
-#define S3C_IRQ(x)     ((x) + S3C_IRQ_OFFSET)
-
-#define IRQ_VIC0_BASE  S3C_IRQ(0)
-#define IRQ_VIC1_BASE  S3C_IRQ(32)
-
-/* VIC based IRQs */
-
-#define S3C64XX_IRQ_VIC0(x)    (IRQ_VIC0_BASE + (x))
-#define S3C64XX_IRQ_VIC1(x)    (IRQ_VIC1_BASE + (x))
-
-/* VIC0 */
-
-#define IRQ_EINT0_3            S3C64XX_IRQ_VIC0(0)
-#define IRQ_EINT4_11           S3C64XX_IRQ_VIC0(1)
-#define IRQ_RTC_TIC            S3C64XX_IRQ_VIC0(2)
-#define IRQ_CAMIF_C            S3C64XX_IRQ_VIC0(3)
-#define IRQ_CAMIF_P            S3C64XX_IRQ_VIC0(4)
-#define IRQ_CAMIF_MC           S3C64XX_IRQ_VIC0(5)
-#define IRQ_S3C6410_IIC1       S3C64XX_IRQ_VIC0(5)
-#define IRQ_S3C6410_IIS                S3C64XX_IRQ_VIC0(6)
-#define IRQ_S3C6400_CAMIF_MP   S3C64XX_IRQ_VIC0(6)
-#define IRQ_CAMIF_WE_C         S3C64XX_IRQ_VIC0(7)
-#define IRQ_S3C6410_G3D                S3C64XX_IRQ_VIC0(8)
-#define IRQ_S3C6400_CAMIF_WE_P S3C64XX_IRQ_VIC0(8)
-#define IRQ_POST0              S3C64XX_IRQ_VIC0(9)
-#define IRQ_ROTATOR            S3C64XX_IRQ_VIC0(10)
-#define IRQ_2D                 S3C64XX_IRQ_VIC0(11)
-#define IRQ_TVENC              S3C64XX_IRQ_VIC0(12)
-#define IRQ_SCALER             S3C64XX_IRQ_VIC0(13)
-#define IRQ_BATF               S3C64XX_IRQ_VIC0(14)
-#define IRQ_JPEG               S3C64XX_IRQ_VIC0(15)
-#define IRQ_MFC                        S3C64XX_IRQ_VIC0(16)
-#define IRQ_SDMA0              S3C64XX_IRQ_VIC0(17)
-#define IRQ_SDMA1              S3C64XX_IRQ_VIC0(18)
-#define IRQ_ARM_DMAERR         S3C64XX_IRQ_VIC0(19)
-#define IRQ_ARM_DMA            S3C64XX_IRQ_VIC0(20)
-#define IRQ_ARM_DMAS           S3C64XX_IRQ_VIC0(21)
-#define IRQ_KEYPAD             S3C64XX_IRQ_VIC0(22)
-#define IRQ_TIMER0_VIC         S3C64XX_IRQ_VIC0(23)
-#define IRQ_TIMER1_VIC         S3C64XX_IRQ_VIC0(24)
-#define IRQ_TIMER2_VIC         S3C64XX_IRQ_VIC0(25)
-#define IRQ_WDT                        S3C64XX_IRQ_VIC0(26)
-#define IRQ_TIMER3_VIC         S3C64XX_IRQ_VIC0(27)
-#define IRQ_TIMER4_VIC         S3C64XX_IRQ_VIC0(28)
-#define IRQ_LCD_FIFO           S3C64XX_IRQ_VIC0(29)
-#define IRQ_LCD_VSYNC          S3C64XX_IRQ_VIC0(30)
-#define IRQ_LCD_SYSTEM         S3C64XX_IRQ_VIC0(31)
-
-/* VIC1 */
-
-#define IRQ_EINT12_19          S3C64XX_IRQ_VIC1(0)
-#define IRQ_EINT20_27          S3C64XX_IRQ_VIC1(1)
-#define IRQ_PCM0               S3C64XX_IRQ_VIC1(2)
-#define IRQ_PCM1               S3C64XX_IRQ_VIC1(3)
-#define IRQ_AC97               S3C64XX_IRQ_VIC1(4)
-#define IRQ_UART0              S3C64XX_IRQ_VIC1(5)
-#define IRQ_UART1              S3C64XX_IRQ_VIC1(6)
-#define IRQ_UART2              S3C64XX_IRQ_VIC1(7)
-#define IRQ_UART3              S3C64XX_IRQ_VIC1(8)
-#define IRQ_DMA0               S3C64XX_IRQ_VIC1(9)
-#define IRQ_DMA1               S3C64XX_IRQ_VIC1(10)
-#define IRQ_ONENAND0           S3C64XX_IRQ_VIC1(11)
-#define IRQ_ONENAND1           S3C64XX_IRQ_VIC1(12)
-#define IRQ_NFC                        S3C64XX_IRQ_VIC1(13)
-#define IRQ_CFCON              S3C64XX_IRQ_VIC1(14)
-#define IRQ_USBH               S3C64XX_IRQ_VIC1(15)
-#define IRQ_SPI0               S3C64XX_IRQ_VIC1(16)
-#define IRQ_SPI1               S3C64XX_IRQ_VIC1(17)
-#define IRQ_IIC                        S3C64XX_IRQ_VIC1(18)
-#define IRQ_HSItx              S3C64XX_IRQ_VIC1(19)
-#define IRQ_HSIrx              S3C64XX_IRQ_VIC1(20)
-#define IRQ_RESERVED           S3C64XX_IRQ_VIC1(21)
-#define IRQ_MSM                        S3C64XX_IRQ_VIC1(22)
-#define IRQ_HOSTIF             S3C64XX_IRQ_VIC1(23)
-#define IRQ_HSMMC0             S3C64XX_IRQ_VIC1(24)
-#define IRQ_HSMMC1             S3C64XX_IRQ_VIC1(25)
-#define IRQ_HSMMC2             IRQ_SPI1        /* shared with SPI1 */
-#define IRQ_OTG                        S3C64XX_IRQ_VIC1(26)
-#define IRQ_IRDA               S3C64XX_IRQ_VIC1(27)
-#define IRQ_RTC_ALARM          S3C64XX_IRQ_VIC1(28)
-#define IRQ_SEC                        S3C64XX_IRQ_VIC1(29)
-#define IRQ_PENDN              S3C64XX_IRQ_VIC1(30)
-#define IRQ_TC                 IRQ_PENDN
-#define IRQ_ADC                        S3C64XX_IRQ_VIC1(31)
-
-/* compatibility for device defines */
-
-#define IRQ_IIC1               IRQ_S3C6410_IIC1
-
-/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series
- * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE
- * which we place after the pair of VICs. */
-
-#define S3C_IRQ_EINT_BASE      S3C_IRQ(64+5)
-
-#define S3C_EINT(x)            ((x) + S3C_IRQ_EINT_BASE)
-#define IRQ_EINT(x)            S3C_EINT(x)
-#define IRQ_EINT_BIT(x)                ((x) - S3C_EINT(0))
-
-/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)
- * that they are sourced from the GPIO pins but with a different scheme for
- * priority and source indication.
- *
- * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO
- * interrupts, but for historical reasons they are kept apart from these
- * next interrupts.
- *
- * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the
- * machine specific support files.
- */
-
-#define IRQ_EINT_GROUP1_NR     (15)
-#define IRQ_EINT_GROUP2_NR     (8)
-#define IRQ_EINT_GROUP3_NR     (5)
-#define IRQ_EINT_GROUP4_NR     (14)
-#define IRQ_EINT_GROUP5_NR     (7)
-#define IRQ_EINT_GROUP6_NR     (10)
-#define IRQ_EINT_GROUP7_NR     (16)
-#define IRQ_EINT_GROUP8_NR     (15)
-#define IRQ_EINT_GROUP9_NR     (9)
-
-#define IRQ_EINT_GROUP_BASE    S3C_EINT(28)
-#define IRQ_EINT_GROUP1_BASE   (IRQ_EINT_GROUP_BASE + 0x00)
-#define IRQ_EINT_GROUP2_BASE   (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR)
-#define IRQ_EINT_GROUP3_BASE   (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR)
-#define IRQ_EINT_GROUP4_BASE   (IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR)
-#define IRQ_EINT_GROUP5_BASE   (IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR)
-#define IRQ_EINT_GROUP6_BASE   (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR)
-#define IRQ_EINT_GROUP7_BASE   (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR)
-#define IRQ_EINT_GROUP8_BASE   (IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR)
-#define IRQ_EINT_GROUP9_BASE   (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR)
-
-#define IRQ_EINT_GROUP(group, no)      (IRQ_EINT_GROUP##group##_BASE + (no))
-
-/* Some boards have their own IRQs behind this */
-#define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
-
-/* Set the default nr_irqs, boards can override if necessary */
-#define S3C64XX_NR_IRQS        IRQ_BOARD_START
-
-/* Compatibility */
-
-#define IRQ_ONENAND    IRQ_ONENAND0
-#define IRQ_I2S0       IRQ_S3C6410_IIS
-
-#endif /* __ASM_MACH_S3C64XX_IRQS_H */
-
diff --git a/arch/arm/mach-s3c64xx/include/mach/map.h b/arch/arm/mach-s3c64xx/include/mach/map.h
deleted file mode 100644 (file)
index 9372a53..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C64XX - Memory map definitions
- */
-
-#ifndef __ASM_ARCH_MAP_H
-#define __ASM_ARCH_MAP_H __FILE__
-
-#include <plat/map-base.h>
-#include <plat/map-s3c.h>
-
-/*
- * Post-mux Chip Select Regions Xm0CSn_
- * These may be used by SROM, NAND or CF depending on settings
- */
-
-#define S3C64XX_PA_XM0CSN0 (0x10000000)
-#define S3C64XX_PA_XM0CSN1 (0x18000000)
-#define S3C64XX_PA_XM0CSN2 (0x20000000)
-#define S3C64XX_PA_XM0CSN3 (0x28000000)
-#define S3C64XX_PA_XM0CSN4 (0x30000000)
-#define S3C64XX_PA_XM0CSN5 (0x38000000)
-
-/* HSMMC units */
-#define S3C64XX_PA_HSMMC(x)    (0x7C200000 + ((x) * 0x100000))
-#define S3C64XX_PA_HSMMC0      S3C64XX_PA_HSMMC(0)
-#define S3C64XX_PA_HSMMC1      S3C64XX_PA_HSMMC(1)
-#define S3C64XX_PA_HSMMC2      S3C64XX_PA_HSMMC(2)
-
-#define S3C_PA_UART            (0x7F005000)
-#define S3C_PA_UART0           (S3C_PA_UART + 0x00)
-#define S3C_PA_UART1           (S3C_PA_UART + 0x400)
-#define S3C_PA_UART2           (S3C_PA_UART + 0x800)
-#define S3C_PA_UART3           (S3C_PA_UART + 0xC00)
-#define S3C_UART_OFFSET                (0x400)
-
-/* See notes on UART VA mapping in debug-macro.S */
-#define S3C_VA_UARTx(x)        (S3C_VA_UART + (S3C_PA_UART & 0xfffff) + ((x) * S3C_UART_OFFSET))
-
-#define S3C_VA_UART0           S3C_VA_UARTx(0)
-#define S3C_VA_UART1           S3C_VA_UARTx(1)
-#define S3C_VA_UART2           S3C_VA_UARTx(2)
-#define S3C_VA_UART3           S3C_VA_UARTx(3)
-
-#define S3C64XX_PA_SROM                (0x70000000)
-
-#define S3C64XX_PA_ONENAND0    (0x70100000)
-#define S3C64XX_PA_ONENAND0_BUF        (0x20000000)
-#define S3C64XX_SZ_ONENAND0_BUF (SZ_64M)
-
-/* NAND and OneNAND1 controllers occupy the same register region
-   (depending on SoC POP version) */
-#define S3C64XX_PA_ONENAND1    (0x70200000)
-#define S3C64XX_PA_ONENAND1_BUF        (0x28000000)
-#define S3C64XX_SZ_ONENAND1_BUF        (SZ_64M)
-
-#define S3C64XX_PA_NAND                (0x70200000)
-#define S3C64XX_PA_FB          (0x77100000)
-#define S3C64XX_PA_USB_HSOTG   (0x7C000000)
-#define S3C64XX_PA_WATCHDOG    (0x7E004000)
-#define S3C64XX_PA_RTC         (0x7E005000)
-#define S3C64XX_PA_KEYPAD      (0x7E00A000)
-#define S3C64XX_PA_ADC         (0x7E00B000)
-#define S3C64XX_PA_SYSCON      (0x7E00F000)
-#define S3C64XX_PA_AC97                (0x7F001000)
-#define S3C64XX_PA_IIS0                (0x7F002000)
-#define S3C64XX_PA_IIS1                (0x7F003000)
-#define S3C64XX_PA_TIMER       (0x7F006000)
-#define S3C64XX_PA_IIC0                (0x7F004000)
-#define S3C64XX_PA_SPI0                (0x7F00B000)
-#define S3C64XX_PA_SPI1                (0x7F00C000)
-#define S3C64XX_PA_PCM0                (0x7F009000)
-#define S3C64XX_PA_PCM1                (0x7F00A000)
-#define S3C64XX_PA_IISV4       (0x7F00D000)
-#define S3C64XX_PA_IIC1                (0x7F00F000)
-
-#define S3C64XX_PA_GPIO                (0x7F008000)
-#define S3C64XX_SZ_GPIO                SZ_4K
-
-#define S3C64XX_PA_SDRAM       (0x50000000)
-
-#define S3C64XX_PA_CFCON       (0x70300000)
-
-#define S3C64XX_PA_VIC0                (0x71200000)
-#define S3C64XX_PA_VIC1                (0x71300000)
-
-#define S3C64XX_PA_MODEM       (0x74108000)
-
-#define S3C64XX_PA_USBHOST     (0x74300000)
-
-#define S3C64XX_PA_USB_HSPHY   (0x7C100000)
-
-/* compatibility defines. */
-#define S3C_PA_TIMER           S3C64XX_PA_TIMER
-#define S3C_PA_HSMMC0          S3C64XX_PA_HSMMC0
-#define S3C_PA_HSMMC1          S3C64XX_PA_HSMMC1
-#define S3C_PA_HSMMC2          S3C64XX_PA_HSMMC2
-#define S3C_PA_IIC             S3C64XX_PA_IIC0
-#define S3C_PA_IIC1            S3C64XX_PA_IIC1
-#define S3C_PA_NAND            S3C64XX_PA_NAND
-#define S3C_PA_ONENAND         S3C64XX_PA_ONENAND0
-#define S3C_PA_ONENAND_BUF     S3C64XX_PA_ONENAND0_BUF
-#define S3C_SZ_ONENAND_BUF     S3C64XX_SZ_ONENAND0_BUF
-#define S3C_PA_FB              S3C64XX_PA_FB
-#define S3C_PA_USBHOST         S3C64XX_PA_USBHOST
-#define S3C_PA_USB_HSOTG       S3C64XX_PA_USB_HSOTG
-#define S3C_PA_RTC             S3C64XX_PA_RTC
-#define S3C_PA_WDT             S3C64XX_PA_WATCHDOG
-#define S3C_PA_SPI0            S3C64XX_PA_SPI0
-#define S3C_PA_SPI1            S3C64XX_PA_SPI1
-
-#define SAMSUNG_PA_ADC         S3C64XX_PA_ADC
-#define SAMSUNG_PA_CFCON       S3C64XX_PA_CFCON
-#define SAMSUNG_PA_KEYPAD      S3C64XX_PA_KEYPAD
-#define SAMSUNG_PA_TIMER       S3C64XX_PA_TIMER
-
-#endif /* __ASM_ARCH_6400_MAP_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
deleted file mode 100644 (file)
index bbf79ed..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C64XX - PM core support for arch/arm/plat-s3c/pm.c
- */
-
-#ifndef __MACH_S3C64XX_PM_CORE_H
-#define __MACH_S3C64XX_PM_CORE_H __FILE__
-
-#include <linux/serial_s3c.h>
-#include <linux/delay.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
-#include <mach/map.h>
-
-static inline void s3c_pm_debug_init_uart(void)
-{
-       u32 tmp = __raw_readl(S3C_PCLK_GATE);
-
-       /* As a note, since the S3C64XX UARTs generally have multiple
-        * clock sources, we simply enable PCLK at the moment and hope
-        * that the resume settings for the UART are suitable for the
-        * use with PCLK.
-        */
-
-       tmp |= S3C_CLKCON_PCLK_UART0;
-       tmp |= S3C_CLKCON_PCLK_UART1;
-       tmp |= S3C_CLKCON_PCLK_UART2;
-       tmp |= S3C_CLKCON_PCLK_UART3;
-
-       __raw_writel(tmp, S3C_PCLK_GATE);
-       udelay(10);
-}
-
-static inline void s3c_pm_arch_prepare_irqs(void)
-{
-       /* VIC should have already been taken care of */
-
-       /* clear any pending EINT0 interrupts */
-       __raw_writel(__raw_readl(S3C64XX_EINT0PEND), S3C64XX_EINT0PEND);
-}
-
-static inline void s3c_pm_arch_stop_clocks(void)
-{
-}
-
-static inline void s3c_pm_arch_show_resume_irqs(void)
-{
-}
-
-/* make these defines, we currently do not have any need to change
- * the IRQ wake controls depending on the CPU we are running on */
-#ifdef CONFIG_PM_SLEEP
-#define s3c_irqwake_eintallow  ((1 << 28) - 1)
-#define s3c_irqwake_intallow   (~0)
-#else
-#define s3c_irqwake_eintallow 0
-#define s3c_irqwake_intallow  0
-#endif
-
-static inline void s3c_pm_arch_update_uart(void __iomem *regs,
-                                          struct pm_uart_save *save)
-{
-       u32 ucon = __raw_readl(regs + S3C2410_UCON);
-       u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK;
-       u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK;
-       u32 new_ucon;
-       u32 delta;
-
-       /* S3C64XX UART blocks only support level interrupts, so ensure that
-        * when we restore unused UART blocks we force the level interrupt
-        * settigs. */
-       save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;
-
-       /* We have a constraint on changing the clock type of the UART
-        * between UCLKx and PCLK, so ensure that when we restore UCON
-        * that the CLK field is correctly modified if the bootloader
-        * has changed anything.
-        */
-       if (ucon_clk != save_clk) {
-               new_ucon = save->ucon;
-               delta = ucon_clk ^ save_clk;
-
-               /* change from UCLKx => wrong PCLK,
-                * either UCLK can be tested for by a bit-test
-                * with UCLK0 */
-               if (ucon_clk & S3C6400_UCON_UCLK0 &&
-                   !(save_clk & S3C6400_UCON_UCLK0) &&
-                   delta & S3C6400_UCON_PCLK2) {
-                       new_ucon &= ~S3C6400_UCON_UCLK0;
-               } else if (delta == S3C6400_UCON_PCLK2) {
-                       /* as an precaution, don't change from
-                        * PCLK2 => PCLK or vice-versa */
-                       new_ucon ^= S3C6400_UCON_PCLK2;
-               }
-
-               S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",
-                         ucon, new_ucon, save->ucon);
-               save->ucon = new_ucon;
-       }
-}
-
-static inline void s3c_pm_restored_gpios(void)
-{
-       /* ensure sleep mode has been cleared from the system */
-
-       __raw_writel(0, S3C64XX_SLPEN);
-}
-
-static inline void samsung_pm_saved_gpios(void)
-{
-       /* turn on the sleep mode and keep it there, as it seems that during
-        * suspend the xCON registers get re-set and thus you can end up with
-        * problems between going to sleep and resuming.
-        */
-
-       __raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN);
-}
-#endif /* __MACH_S3C64XX_PM_CORE_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-clock.h b/arch/arm/mach-s3c64xx/include/mach/regs-clock.h
deleted file mode 100644 (file)
index 35a6876..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * S3C64XX clock register definitions
- */
-
-#ifndef __PLAT_REGS_CLOCK_H
-#define __PLAT_REGS_CLOCK_H __FILE__
-
-/*
- * FIXME: Remove remaining definitions
- */
-
-#define S3C_CLKREG(x)          (S3C_VA_SYS + (x))
-
-#define S3C_PCLK_GATE          S3C_CLKREG(0x34)
-#define S3C6410_CLK_SRC2       S3C_CLKREG(0x10C)
-#define S3C_MEM_SYS_CFG                S3C_CLKREG(0x120)
-
-/* PCLK GATE Registers */
-#define S3C_CLKCON_PCLK_UART3          (1<<4)
-#define S3C_CLKCON_PCLK_UART2          (1<<3)
-#define S3C_CLKCON_PCLK_UART1          (1<<2)
-#define S3C_CLKCON_PCLK_UART0          (1<<1)
-
-/* MEM_SYS_CFG */
-#define MEM_SYS_CFG_INDEP_CF           0x4000
-#define MEM_SYS_CFG_EBI_FIX_PRI_CFCON  0x30
-
-#endif /* _PLAT_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-gpio.h b/arch/arm/mach-s3c64xx/include/mach/regs-gpio.h
deleted file mode 100644 (file)
index 592a2be..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/arch/arm/plat-s3c64xx/include/mach/regs-gpio.h
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C64XX - GPIO register definitions
- */
-
-#ifndef __ASM_PLAT_S3C64XX_REGS_GPIO_H
-#define __ASM_PLAT_S3C64XX_REGS_GPIO_H __FILE__
-
-/* Base addresses for each of the banks */
-
-#define S3C64XX_GPIOREG(reg)   (S3C64XX_VA_GPIO + (reg))
-
-#define S3C64XX_GPA_BASE       S3C64XX_GPIOREG(0x0000)
-#define S3C64XX_GPB_BASE       S3C64XX_GPIOREG(0x0020)
-#define S3C64XX_GPC_BASE       S3C64XX_GPIOREG(0x0040)
-#define S3C64XX_GPD_BASE       S3C64XX_GPIOREG(0x0060)
-#define S3C64XX_GPE_BASE       S3C64XX_GPIOREG(0x0080)
-#define S3C64XX_GPF_BASE       S3C64XX_GPIOREG(0x00A0)
-#define S3C64XX_GPG_BASE       S3C64XX_GPIOREG(0x00C0)
-#define S3C64XX_GPH_BASE       S3C64XX_GPIOREG(0x00E0)
-#define S3C64XX_GPI_BASE       S3C64XX_GPIOREG(0x0100)
-#define S3C64XX_GPJ_BASE       S3C64XX_GPIOREG(0x0120)
-#define S3C64XX_GPK_BASE       S3C64XX_GPIOREG(0x0800)
-#define S3C64XX_GPL_BASE       S3C64XX_GPIOREG(0x0810)
-#define S3C64XX_GPM_BASE       S3C64XX_GPIOREG(0x0820)
-#define S3C64XX_GPN_BASE       S3C64XX_GPIOREG(0x0830)
-#define S3C64XX_GPO_BASE       S3C64XX_GPIOREG(0x0140)
-#define S3C64XX_GPP_BASE       S3C64XX_GPIOREG(0x0160)
-#define S3C64XX_GPQ_BASE       S3C64XX_GPIOREG(0x0180)
-
-/* SPCON */
-
-#define S3C64XX_SPCON          S3C64XX_GPIOREG(0x1A0)
-
-#define S3C64XX_SPCON_DRVCON_CAM_MASK          (0x3 << 30)
-#define S3C64XX_SPCON_DRVCON_CAM_SHIFT         (30)
-#define S3C64XX_SPCON_DRVCON_CAM_2mA           (0x0 << 30)
-#define S3C64XX_SPCON_DRVCON_CAM_4mA           (0x1 << 30)
-#define S3C64XX_SPCON_DRVCON_CAM_7mA           (0x2 << 30)
-#define S3C64XX_SPCON_DRVCON_CAM_9mA           (0x3 << 30)
-
-#define S3C64XX_SPCON_DRVCON_HSSPI_MASK                (0x3 << 28)
-#define S3C64XX_SPCON_DRVCON_HSSPI_SHIFT       (28)
-#define S3C64XX_SPCON_DRVCON_HSSPI_2mA         (0x0 << 28)
-#define S3C64XX_SPCON_DRVCON_HSSPI_4mA         (0x1 << 28)
-#define S3C64XX_SPCON_DRVCON_HSSPI_7mA         (0x2 << 28)
-#define S3C64XX_SPCON_DRVCON_HSSPI_9mA         (0x3 << 28)
-
-#define S3C64XX_SPCON_DRVCON_HSMMC_MASK                (0x3 << 26)
-#define S3C64XX_SPCON_DRVCON_HSMMC_SHIFT       (26)
-#define S3C64XX_SPCON_DRVCON_HSMMC_2mA         (0x0 << 26)
-#define S3C64XX_SPCON_DRVCON_HSMMC_4mA         (0x1 << 26)
-#define S3C64XX_SPCON_DRVCON_HSMMC_7mA         (0x2 << 26)
-#define S3C64XX_SPCON_DRVCON_HSMMC_9mA         (0x3 << 26)
-
-#define S3C64XX_SPCON_DRVCON_LCD_MASK          (0x3 << 24)
-#define S3C64XX_SPCON_DRVCON_LCD_SHIFT         (24)
-#define S3C64XX_SPCON_DRVCON_LCD_2mA           (0x0 << 24)
-#define S3C64XX_SPCON_DRVCON_LCD_4mA           (0x1 << 24)
-#define S3C64XX_SPCON_DRVCON_LCD_7mA           (0x2 << 24)
-#define S3C64XX_SPCON_DRVCON_LCD_9mA           (0x3 << 24)
-
-#define S3C64XX_SPCON_DRVCON_MODEM_MASK                (0x3 << 22)
-#define S3C64XX_SPCON_DRVCON_MODEM_SHIFT       (22)
-#define S3C64XX_SPCON_DRVCON_MODEM_2mA         (0x0 << 22)
-#define S3C64XX_SPCON_DRVCON_MODEM_4mA         (0x1 << 22)
-#define S3C64XX_SPCON_DRVCON_MODEM_7mA         (0x2 << 22)
-#define S3C64XX_SPCON_DRVCON_MODEM_9mA         (0x3 << 22)
-
-#define S3C64XX_SPCON_nRSTOUT_OEN              (1 << 21)
-
-#define S3C64XX_SPCON_DRVCON_SPICLK1_MASK      (0x3 << 18)
-#define S3C64XX_SPCON_DRVCON_SPICLK1_SHIFT     (18)
-#define S3C64XX_SPCON_DRVCON_SPICLK1_2mA       (0x0 << 18)
-#define S3C64XX_SPCON_DRVCON_SPICLK1_4mA       (0x1 << 18)
-#define S3C64XX_SPCON_DRVCON_SPICLK1_7mA       (0x2 << 18)
-#define S3C64XX_SPCON_DRVCON_SPICLK1_9mA       (0x3 << 18)
-
-#define S3C64XX_SPCON_MEM1_DQS_PUD_MASK                (0x3 << 16)
-#define S3C64XX_SPCON_MEM1_DQS_PUD_SHIFT       (16)
-#define S3C64XX_SPCON_MEM1_DQS_PUD_DISABLED    (0x0 << 16)
-#define S3C64XX_SPCON_MEM1_DQS_PUD_DOWN                (0x1 << 16)
-#define S3C64XX_SPCON_MEM1_DQS_PUD_UP          (0x2 << 16)
-
-#define S3C64XX_SPCON_MEM1_D_PUD1_MASK         (0x3 << 14)
-#define S3C64XX_SPCON_MEM1_D_PUD1_SHIFT                (14)
-#define S3C64XX_SPCON_MEM1_D_PUD1_DISABLED     (0x0 << 14)
-#define S3C64XX_SPCON_MEM1_D_PUD1_DOWN         (0x1 << 14)
-#define S3C64XX_SPCON_MEM1_D_PUD1_UP           (0x2 << 14)
-
-#define S3C64XX_SPCON_MEM1_D_PUD0_MASK         (0x3 << 12)
-#define S3C64XX_SPCON_MEM1_D_PUD0_SHIFT                (12)
-#define S3C64XX_SPCON_MEM1_D_PUD0_DISABLED     (0x0 << 12)
-#define S3C64XX_SPCON_MEM1_D_PUD0_DOWN         (0x1 << 12)
-#define S3C64XX_SPCON_MEM1_D_PUD0_UP           (0x2 << 12)
-
-#define S3C64XX_SPCON_MEM0_D_PUD_MASK          (0x3 << 8)
-#define S3C64XX_SPCON_MEM0_D_PUD_SHIFT         (8)
-#define S3C64XX_SPCON_MEM0_D_PUD_DISABLED      (0x0 << 8)
-#define S3C64XX_SPCON_MEM0_D_PUD_DOWN          (0x1 << 8)
-#define S3C64XX_SPCON_MEM0_D_PUD_UP            (0x2 << 8)
-
-#define S3C64XX_SPCON_USBH_DMPD                        (1 << 7)
-#define S3C64XX_SPCON_USBH_DPPD                        (1 << 6)
-#define S3C64XX_SPCON_USBH_PUSW2               (1 << 5)
-#define S3C64XX_SPCON_USBH_PUSW1               (1 << 4)
-#define S3C64XX_SPCON_USBH_SUSPND              (1 << 3)
-
-#define S3C64XX_SPCON_LCD_SEL_MASK             (0x3 << 0)
-#define S3C64XX_SPCON_LCD_SEL_SHIFT            (0)
-#define S3C64XX_SPCON_LCD_SEL_HOST             (0x0 << 0)
-#define S3C64XX_SPCON_LCD_SEL_RGB              (0x1 << 0)
-#define S3C64XX_SPCON_LCD_SEL_606_656          (0x2 << 0)
-
-
-/* External interrupt registers */
-
-#define S3C64XX_EINT12CON      S3C64XX_GPIOREG(0x200)
-#define S3C64XX_EINT34CON      S3C64XX_GPIOREG(0x204)
-#define S3C64XX_EINT56CON      S3C64XX_GPIOREG(0x208)
-#define S3C64XX_EINT78CON      S3C64XX_GPIOREG(0x20C)
-#define S3C64XX_EINT9CON       S3C64XX_GPIOREG(0x210)
-
-#define S3C64XX_EINT12FLTCON   S3C64XX_GPIOREG(0x220)
-#define S3C64XX_EINT34FLTCON   S3C64XX_GPIOREG(0x224)
-#define S3C64XX_EINT56FLTCON   S3C64XX_GPIOREG(0x228)
-#define S3C64XX_EINT78FLTCON   S3C64XX_GPIOREG(0x22C)
-#define S3C64XX_EINT9FLTCON    S3C64XX_GPIOREG(0x230)
-
-#define S3C64XX_EINT12MASK     S3C64XX_GPIOREG(0x240)
-#define S3C64XX_EINT34MASK     S3C64XX_GPIOREG(0x244)
-#define S3C64XX_EINT56MASK     S3C64XX_GPIOREG(0x248)
-#define S3C64XX_EINT78MASK     S3C64XX_GPIOREG(0x24C)
-#define S3C64XX_EINT9MASK      S3C64XX_GPIOREG(0x250)
-
-#define S3C64XX_EINT12PEND     S3C64XX_GPIOREG(0x260)
-#define S3C64XX_EINT34PEND     S3C64XX_GPIOREG(0x264)
-#define S3C64XX_EINT56PEND     S3C64XX_GPIOREG(0x268)
-#define S3C64XX_EINT78PEND     S3C64XX_GPIOREG(0x26C)
-#define S3C64XX_EINT9PEND      S3C64XX_GPIOREG(0x270)
-
-#define S3C64XX_PRIORITY       S3C64XX_GPIOREG(0x280)
-#define S3C64XX_PRIORITY_ARB(x)        (1 << (x))
-
-#define S3C64XX_SERVICE                S3C64XX_GPIOREG(0x284)
-#define S3C64XX_SERVICEPEND    S3C64XX_GPIOREG(0x288)
-
-#define S3C64XX_EINT0CON0      S3C64XX_GPIOREG(0x900)
-#define S3C64XX_EINT0CON1      S3C64XX_GPIOREG(0x904)
-#define S3C64XX_EINT0FLTCON0   S3C64XX_GPIOREG(0x910)
-#define S3C64XX_EINT0FLTCON1   S3C64XX_GPIOREG(0x914)
-#define S3C64XX_EINT0FLTCON2   S3C64XX_GPIOREG(0x918)
-#define S3C64XX_EINT0FLTCON3   S3C64XX_GPIOREG(0x91C)
-
-#define S3C64XX_EINT0MASK      S3C64XX_GPIOREG(0x920)
-#define S3C64XX_EINT0PEND      S3C64XX_GPIOREG(0x924)
-
-/* GPIO sleep configuration */
-
-#define S3C64XX_SPCONSLP       S3C64XX_GPIOREG(0x880)
-
-#define S3C64XX_SPCONSLP_TDO_PULLDOWN  (1 << 14)
-#define S3C64XX_SPCONSLP_CKE1INIT      (1 << 5)
-
-#define S3C64XX_SPCONSLP_RSTOUT_MASK   (0x3 << 12)
-#define S3C64XX_SPCONSLP_RSTOUT_OUT0   (0x0 << 12)
-#define S3C64XX_SPCONSLP_RSTOUT_OUT1   (0x1 << 12)
-#define S3C64XX_SPCONSLP_RSTOUT_HIZ    (0x2 << 12)
-
-#define S3C64XX_SPCONSLP_KPCOL_MASK    (0x3 << 0)
-#define S3C64XX_SPCONSLP_KPCOL_OUT0    (0x0 << 0)
-#define S3C64XX_SPCONSLP_KPCOL_OUT1    (0x1 << 0)
-#define S3C64XX_SPCONSLP_KPCOL_INP     (0x2 << 0)
-
-
-#define S3C64XX_SLPEN          S3C64XX_GPIOREG(0x930)
-
-#define S3C64XX_SLPEN_USE_xSLP         (1 << 0)
-#define S3C64XX_SLPEN_CFG_BYSLPEN      (1 << 1)
-
-#endif /* __ASM_PLAT_S3C64XX_REGS_GPIO_H */
-
diff --git a/arch/arm/mach-s3c64xx/include/mach/regs-irq.h b/arch/arm/mach-s3c64xx/include/mach/regs-irq.h
deleted file mode 100644 (file)
index b18c7bc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C64XX - IRQ register definitions
- */
-
-#ifndef __ASM_ARCH_REGS_IRQ_H
-#define __ASM_ARCH_REGS_IRQ_H __FILE__
-
-
-#endif /* __ASM_ARCH_6400_REGS_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c
deleted file mode 100644 (file)
index 31b2211..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//      Ben Dooks <ben@simtec.co.uk>
-//      http://armlinux.simtec.co.uk/
-//
-// S3C64XX - Interrupt handling Power Management
-
-/*
- * NOTE: Code in this file is not used when booting with Device Tree support.
- */
-
-#include <linux/kernel.h>
-#include <linux/syscore_ops.h>
-#include <linux/interrupt.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-#include <linux/of.h>
-
-#include <mach/map.h>
-
-#include <mach/regs-gpio.h>
-#include <plat/cpu.h>
-#include <plat/pm.h>
-
-/* We handled all the IRQ types in this code, to save having to make several
- * small files to handle each different type separately. Having the EINT_GRP
- * code here shouldn't be as much bloat as the IRQ table space needed when
- * they are enabled. The added benefit is we ensure that these registers are
- * in the same state as we suspended.
- */
-
-static struct sleep_save irq_save[] = {
-       SAVE_ITEM(S3C64XX_PRIORITY),
-       SAVE_ITEM(S3C64XX_EINT0CON0),
-       SAVE_ITEM(S3C64XX_EINT0CON1),
-       SAVE_ITEM(S3C64XX_EINT0FLTCON0),
-       SAVE_ITEM(S3C64XX_EINT0FLTCON1),
-       SAVE_ITEM(S3C64XX_EINT0FLTCON2),
-       SAVE_ITEM(S3C64XX_EINT0FLTCON3),
-       SAVE_ITEM(S3C64XX_EINT0MASK),
-};
-
-static struct irq_grp_save {
-       u32     fltcon;
-       u32     con;
-       u32     mask;
-} eint_grp_save[5];
-
-#ifndef CONFIG_SERIAL_SAMSUNG_UARTS
-#define SERIAL_SAMSUNG_UARTS 0
-#else
-#define        SERIAL_SAMSUNG_UARTS CONFIG_SERIAL_SAMSUNG_UARTS
-#endif
-
-static u32 irq_uart_mask[SERIAL_SAMSUNG_UARTS];
-
-static int s3c64xx_irq_pm_suspend(void)
-{
-       struct irq_grp_save *grp = eint_grp_save;
-       int i;
-
-       S3C_PMDBG("%s: suspending IRQs\n", __func__);
-
-       s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
-
-       for (i = 0; i < SERIAL_SAMSUNG_UARTS; i++)
-               irq_uart_mask[i] = __raw_readl(S3C_VA_UARTx(i) + S3C64XX_UINTM);
-
-       for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
-               grp->con = __raw_readl(S3C64XX_EINT12CON + (i * 4));
-               grp->mask = __raw_readl(S3C64XX_EINT12MASK + (i * 4));
-               grp->fltcon = __raw_readl(S3C64XX_EINT12FLTCON + (i * 4));
-       }
-
-       return 0;
-}
-
-static void s3c64xx_irq_pm_resume(void)
-{
-       struct irq_grp_save *grp = eint_grp_save;
-       int i;
-
-       S3C_PMDBG("%s: resuming IRQs\n", __func__);
-
-       s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
-
-       for (i = 0; i < SERIAL_SAMSUNG_UARTS; i++)
-               __raw_writel(irq_uart_mask[i], S3C_VA_UARTx(i) + S3C64XX_UINTM);
-
-       for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {
-               __raw_writel(grp->con, S3C64XX_EINT12CON + (i * 4));
-               __raw_writel(grp->mask, S3C64XX_EINT12MASK + (i * 4));
-               __raw_writel(grp->fltcon, S3C64XX_EINT12FLTCON + (i * 4));
-       }
-
-       S3C_PMDBG("%s: IRQ configuration restored\n", __func__);
-}
-
-static struct syscore_ops s3c64xx_irq_syscore_ops = {
-       .suspend = s3c64xx_irq_pm_suspend,
-       .resume  = s3c64xx_irq_pm_resume,
-};
-
-static __init int s3c64xx_syscore_init(void)
-{
-       /* Appropriate drivers (pinctrl, uart) handle this when using DT. */
-       if (of_have_populated_dt() || !soc_is_s3c64xx())
-               return 0;
-
-       register_syscore_ops(&s3c64xx_irq_syscore_ops);
-
-       return 0;
-}
-
-core_initcall(s3c64xx_syscore_init);
diff --git a/arch/arm/mach-s3c64xx/irq-uart.h b/arch/arm/mach-s3c64xx/irq-uart.h
deleted file mode 100644 (file)
index 78eccdc..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * Header file for Samsung SoC UART IRQ demux for S3C64XX and later
- */
-
-struct s3c_uart_irq {
-       void __iomem    *regs;
-       unsigned int     base_irq;
-       unsigned int     parent_irq;
-};
-
-extern void s3c_init_uart_irqs(struct s3c_uart_irq *irq, unsigned int nr_irqs);
-
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
deleted file mode 100644 (file)
index 0d3d5be..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-// Copyright 2009 Kwangwoo Lee
-//     Kwangwoo Lee <kwangwoo.lee@gmail.com>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/i2c.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-#include <linux/dm9000.h>
-
-#include <video/platform_lcd.h>
-#include <video/samsung_fimd.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/fb.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <mach/irqs.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "regs-modem.h"
-
-/* DM9000 */
-#define ANW6410_PA_DM9000      (0x18000000)
-
-/* A hardware buffer to control external devices is mapped at 0x30000000.
- * It can not be read. So current status must be kept in anw6410_extdev_status.
- */
-#define ANW6410_VA_EXTDEV      S3C_ADDR(0x02000000)
-#define ANW6410_PA_EXTDEV      (0x30000000)
-
-#define ANW6410_EN_DM9000      (1<<11)
-#define ANW6410_EN_LCD         (1<<14)
-
-static __u32 anw6410_extdev_status;
-
-static struct s3c2410_uartcfg anw6410_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-};
-
-/* framebuffer and LCD setup. */
-static void __init anw6410_lcd_mode_set(void)
-{
-       u32 tmp;
-
-       /* set the LCD type */
-       tmp = __raw_readl(S3C64XX_SPCON);
-       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
-       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
-       __raw_writel(tmp, S3C64XX_SPCON);
-
-       /* remove the LCD bypass */
-       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
-       tmp &= ~MIFPCON_LCD_BYPASS;
-       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
-}
-
-/* GPF1 = LCD panel power
- * GPF4 = LCD backlight control
- */
-static void anw6410_lcd_power_set(struct plat_lcd_data *pd,
-                                  unsigned int power)
-{
-       if (power) {
-               anw6410_extdev_status |= (ANW6410_EN_LCD << 16);
-               __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
-
-               gpio_direction_output(S3C64XX_GPF(1), 1);
-               gpio_direction_output(S3C64XX_GPF(4), 1);
-       } else {
-               anw6410_extdev_status &= ~(ANW6410_EN_LCD << 16);
-               __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
-
-               gpio_direction_output(S3C64XX_GPF(1), 0);
-               gpio_direction_output(S3C64XX_GPF(4), 0);
-       }
-}
-
-static struct plat_lcd_data anw6410_lcd_power_data = {
-       .set_power      = anw6410_lcd_power_set,
-};
-
-static struct platform_device anw6410_lcd_powerdev = {
-       .name                   = "platform-lcd",
-       .dev.parent             = &s3c_device_fb.dev,
-       .dev.platform_data      = &anw6410_lcd_power_data,
-};
-
-static struct s3c_fb_pd_win anw6410_fb_win0 = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct fb_videomode anw6410_lcd_timing = {
-       .left_margin    = 8,
-       .right_margin   = 13,
-       .upper_margin   = 7,
-       .lower_margin   = 5,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
-static struct s3c_fb_platdata anw6410_lcd_pdata __initdata = {
-       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-       .vtiming        = &anw6410_lcd_timing,
-       .win[0]         = &anw6410_fb_win0,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-};
-
-/* DM9000AEP 10/100 ethernet controller */
-static void __init anw6410_dm9000_enable(void)
-{
-       anw6410_extdev_status |= (ANW6410_EN_DM9000 << 16);
-       __raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
-}
-
-static struct resource anw6410_dm9000_resource[] = {
-       [0] = DEFINE_RES_MEM(ANW6410_PA_DM9000, 4),
-       [1] = DEFINE_RES_MEM(ANW6410_PA_DM9000 + 4, 501),
-       [2] = DEFINE_RES_NAMED(IRQ_EINT(15), 1, NULL, IORESOURCE_IRQ \
-                                       | IRQF_TRIGGER_HIGH),
-};
-
-static struct dm9000_plat_data anw6410_dm9000_pdata = {
-       .flags    = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
-       /* dev_addr can be set to provide hwaddr. */
-};
-
-static struct platform_device anw6410_device_eth = {
-       .name   = "dm9000",
-       .id     = -1,
-       .num_resources  = ARRAY_SIZE(anw6410_dm9000_resource),
-       .resource       = anw6410_dm9000_resource,
-       .dev    = {
-               .platform_data  = &anw6410_dm9000_pdata,
-       },
-};
-
-static struct map_desc anw6410_iodesc[] __initdata = {
-       {
-               .virtual        = (unsigned long)ANW6410_VA_EXTDEV,
-               .pfn            = __phys_to_pfn(ANW6410_PA_EXTDEV),
-               .length         = SZ_64K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct platform_device *anw6410_devices[] __initdata = {
-       &s3c_device_fb,
-       &anw6410_lcd_powerdev,
-       &anw6410_device_eth,
-};
-
-static void __init anw6410_map_io(void)
-{
-       s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       anw6410_lcd_mode_set();
-}
-
-static void __init anw6410_machine_init(void)
-{
-       s3c_fb_set_platdata(&anw6410_lcd_pdata);
-
-       gpio_request(S3C64XX_GPF(1), "panel power");
-       gpio_request(S3C64XX_GPF(4), "LCD backlight");
-
-       anw6410_dm9000_enable();
-
-       platform_add_devices(anw6410_devices, ARRAY_SIZE(anw6410_devices));
-}
-
-MACHINE_START(ANW6410, "A&W6410")
-       /* Maintainer: Kwangwoo Lee <kwangwoo.lee@gmail.com> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = anw6410_map_io,
-       .init_machine   = anw6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
deleted file mode 100644 (file)
index 34f1baa..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Speyside modules for Cragganmore - board data probing
-//
-// Copyright 2011 Wolfson Microelectronics plc
-//     Mark Brown <broonie@opensource.wolfsonmicro.com>
-
-#include <linux/export.h>
-#include <linux/interrupt.h>
-#include <linux/i2c.h>
-#include <linux/spi/spi.h>
-#include <linux/gpio/machine.h>
-
-#include <linux/mfd/wm831x/irq.h>
-#include <linux/mfd/wm831x/gpio.h>
-#include <linux/mfd/wm8994/pdata.h>
-#include <linux/mfd/arizona/pdata.h>
-
-#include <linux/regulator/machine.h>
-
-#include <sound/wm0010.h>
-#include <sound/wm2200.h>
-#include <sound/wm5100.h>
-#include <sound/wm8996.h>
-#include <sound/wm8962.h>
-#include <sound/wm9081.h>
-
-#include <linux/platform_data/spi-s3c64xx.h>
-
-#include <plat/cpu.h>
-#include <mach/irqs.h>
-
-#include "crag6410.h"
-
-static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
-       .line = S3C64XX_GPC(3),
-};
-
-static struct wm0010_pdata wm0010_pdata = {
-       .gpio_reset = S3C64XX_GPN(6),
-       .reset_active_high = 1, /* Active high for Glenfarclas Rev 2 */
-};
-
-static struct spi_board_info wm1253_devs[] = {
-       [0] = {
-               .modalias       = "wm0010",
-               .max_speed_hz   = 26 * 1000 * 1000,
-               .bus_num        = 0,
-               .chip_select    = 0,
-               .mode           = SPI_MODE_0,
-               .irq            = S3C_EINT(4),
-               .controller_data = &wm0010_spi_csinfo,
-               .platform_data = &wm0010_pdata,
-       },
-};
-
-static struct spi_board_info balblair_devs[] = {
-       [0] = {
-               .modalias       = "wm0010",
-               .max_speed_hz   = 26 * 1000 * 1000,
-               .bus_num        = 0,
-               .chip_select    = 0,
-               .mode           = SPI_MODE_0,
-               .irq            = S3C_EINT(4),
-               .controller_data = &wm0010_spi_csinfo,
-               .platform_data = &wm0010_pdata,
-       },
-};
-
-static struct wm5100_pdata wm5100_pdata = {
-       .ldo_ena = S3C64XX_GPN(7),
-       .irq_flags = IRQF_TRIGGER_HIGH,
-       .gpio_base = CODEC_GPIO_BASE,
-
-       .in_mode = {
-               WM5100_IN_DIFF,
-               WM5100_IN_DIFF,
-               WM5100_IN_DIFF,
-               WM5100_IN_SE,
-       },
-
-       .hp_pol = CODEC_GPIO_BASE + 3,
-       .jack_modes = {
-               { WM5100_MICDET_MICBIAS3, 0, 0 },
-               { WM5100_MICDET_MICBIAS2, 1, 1 },
-       },
-
-       .gpio_defaults = {
-               0,
-               0,
-               0,
-               0,
-               0x2, /* IRQ: CMOS output */
-               0x3, /* CLKOUT: CMOS output */
-       },
-};
-
-static struct wm8996_retune_mobile_config wm8996_retune[] = {
-       {
-               .name = "Sub LPF",
-               .rate = 48000,
-               .regs = {
-                       0x6318, 0x6300, 0x1000, 0x0000, 0x0004, 0x2000, 0xF000,
-                       0x0000, 0x0004, 0x2000, 0xF000, 0x0000, 0x0004, 0x2000,
-                       0xF000, 0x0000, 0x0004, 0x1000, 0x0800, 0x4000
-               },
-       },
-       {
-               .name = "Sub HPF",
-               .rate = 48000,
-               .regs = {
-                       0x000A, 0x6300, 0x1000, 0x0000, 0x0004, 0x2000, 0xF000,
-                       0x0000, 0x0004, 0x2000, 0xF000, 0x0000, 0x0004, 0x2000,
-                       0xF000, 0x0000, 0x0004, 0x1000, 0x0800, 0x4000
-               },
-       },
-};
-
-static struct wm8996_pdata wm8996_pdata __initdata = {
-       .ldo_ena = S3C64XX_GPN(7),
-       .gpio_base = CODEC_GPIO_BASE,
-       .micdet_def = 1,
-       .inl_mode = WM8996_DIFFERRENTIAL_1,
-       .inr_mode = WM8996_DIFFERRENTIAL_1,
-
-       .irq_flags = IRQF_TRIGGER_RISING,
-
-       .gpio_default = {
-               0x8001, /* GPIO1 == ADCLRCLK1 */
-               0x8001, /* GPIO2 == ADCLRCLK2, input due to CPU */
-               0x0141, /* GPIO3 == HP_SEL */
-               0x0002, /* GPIO4 == IRQ */
-               0x020e, /* GPIO5 == CLKOUT */
-       },
-
-       .retune_mobile_cfgs = wm8996_retune,
-       .num_retune_mobile_cfgs = ARRAY_SIZE(wm8996_retune),
-};
-
-static struct wm8962_pdata wm8962_pdata __initdata = {
-       .gpio_init = {
-               0,
-               WM8962_GPIO_FN_OPCLK,
-               WM8962_GPIO_FN_DMICCLK,
-               0,
-               0x8000 | WM8962_GPIO_FN_DMICDAT,
-               WM8962_GPIO_FN_IRQ,    /* Open drain mode */
-       },
-       .in4_dc_measure = true,
-};
-
-static struct wm9081_pdata wm9081_pdata __initdata = {
-       .irq_high = false,
-       .irq_cmos = false,
-};
-
-static const struct i2c_board_info wm1254_devs[] = {
-       { I2C_BOARD_INFO("wm8996", 0x1a),
-         .platform_data = &wm8996_pdata,
-         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
-       },
-       { I2C_BOARD_INFO("wm9081", 0x6c),
-         .platform_data = &wm9081_pdata, },
-};
-
-static const struct i2c_board_info wm1255_devs[] = {
-       { I2C_BOARD_INFO("wm5100", 0x1a),
-         .platform_data = &wm5100_pdata,
-         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
-       },
-       { I2C_BOARD_INFO("wm9081", 0x6c),
-         .platform_data = &wm9081_pdata, },
-};
-
-static const struct i2c_board_info wm1259_devs[] = {
-       { I2C_BOARD_INFO("wm8962", 0x1a),
-         .platform_data = &wm8962_pdata,
-         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
-       },
-};
-
-static struct regulator_init_data wm8994_ldo1 = {
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data wm8994_ldo2 = {
-       .supply_regulator = "WALLVDD",
-};
-
-static struct wm8994_pdata wm8994_pdata = {
-       .gpio_base = CODEC_GPIO_BASE,
-       .micb2_delay = 150,
-       .gpio_defaults = {
-               0x3,          /* IRQ out, active high, CMOS */
-       },
-       .ldo = {
-                { .init_data = &wm8994_ldo1, },
-                { .init_data = &wm8994_ldo2, },
-       },
-};
-
-static const struct i2c_board_info wm1277_devs[] = {
-       { I2C_BOARD_INFO("wm8958", 0x1a),  /* WM8958 is the superset */
-         .platform_data = &wm8994_pdata,
-         .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
-         .dev_name = "wm8958",
-       },
-};
-
-static struct gpiod_lookup_table wm8994_gpiod_table = {
-       .dev_id = "i2c-wm8958", /* I2C device name */
-       .table = {
-               GPIO_LOOKUP("GPION", 6,
-                           "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPION", 4,
-                           "wlf,ldo2ena", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct arizona_pdata wm5102_reva_pdata = {
-       .gpio_base = CODEC_GPIO_BASE,
-       .irq_flags = IRQF_TRIGGER_HIGH,
-       .micd_pol_gpio = CODEC_GPIO_BASE + 4,
-       .micd_rate = 6,
-       .gpio_defaults = {
-               [2] = 0x10000, /* AIF3TXLRCLK */
-               [3] = 0x4,     /* OPCLK */
-       },
-};
-
-static struct s3c64xx_spi_csinfo codec_spi_csinfo = {
-       .line = S3C64XX_GPN(5),
-};
-
-static struct spi_board_info wm5102_reva_spi_devs[] = {
-       [0] = {
-               .modalias       = "wm5102",
-               .max_speed_hz   = 10 * 1000 * 1000,
-               .bus_num        = 0,
-               .chip_select    = 1,
-               .mode           = SPI_MODE_0,
-               .irq            = GLENFARCLAS_PMIC_IRQ_BASE +
-                                 WM831X_IRQ_GPIO_2,
-               .controller_data = &codec_spi_csinfo,
-               .platform_data = &wm5102_reva_pdata,
-       },
-};
-
-static struct gpiod_lookup_table wm5102_reva_gpiod_table = {
-       .dev_id = "spi0.1", /* SPI device name */
-       .table = {
-               GPIO_LOOKUP("GPION", 7,
-                           "wlf,ldoena", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct arizona_pdata wm5102_pdata = {
-       .gpio_base = CODEC_GPIO_BASE,
-       .irq_flags = IRQF_TRIGGER_HIGH,
-       .micd_pol_gpio = CODEC_GPIO_BASE + 2,
-       .gpio_defaults = {
-               [2] = 0x10000, /* AIF3TXLRCLK */
-               [3] = 0x4,     /* OPCLK */
-       },
-};
-
-static struct spi_board_info wm5102_spi_devs[] = {
-       [0] = {
-               .modalias       = "wm5102",
-               .max_speed_hz   = 10 * 1000 * 1000,
-               .bus_num        = 0,
-               .chip_select    = 1,
-               .mode           = SPI_MODE_0,
-               .irq            = GLENFARCLAS_PMIC_IRQ_BASE +
-                                 WM831X_IRQ_GPIO_2,
-               .controller_data = &codec_spi_csinfo,
-               .platform_data = &wm5102_pdata,
-       },
-};
-
-static struct gpiod_lookup_table wm5102_gpiod_table = {
-       .dev_id = "spi0.1", /* SPI device name */
-       .table = {
-               GPIO_LOOKUP("GPION", 7,
-                           "wlf,ldo1ena", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct spi_board_info wm5110_spi_devs[] = {
-       [0] = {
-               .modalias       = "wm5110",
-               .max_speed_hz   = 10 * 1000 * 1000,
-               .bus_num        = 0,
-               .chip_select    = 1,
-               .mode           = SPI_MODE_0,
-               .irq            = GLENFARCLAS_PMIC_IRQ_BASE +
-                                 WM831X_IRQ_GPIO_2,
-               .controller_data = &codec_spi_csinfo,
-               .platform_data = &wm5102_reva_pdata,
-       },
-};
-
-static const struct i2c_board_info wm6230_i2c_devs[] = {
-       { I2C_BOARD_INFO("wm9081", 0x6c),
-         .platform_data = &wm9081_pdata, },
-};
-
-static struct wm2200_pdata wm2200_pdata = {
-       .ldo_ena = S3C64XX_GPN(7),
-       .gpio_defaults = {
-               [2] = 0x0005,  /* GPIO3 24.576MHz output clock */
-       },
-};
-
-static const struct i2c_board_info wm2200_i2c[] = {
-       { I2C_BOARD_INFO("wm2200", 0x3a),
-         .platform_data = &wm2200_pdata, },
-};
-
-static const struct {
-       u8 id;
-       u8 rev;
-       const char *name;
-       const struct i2c_board_info *i2c_devs;
-       int num_i2c_devs;
-       const struct spi_board_info *spi_devs;
-       int num_spi_devs;
-
-       struct gpiod_lookup_table *gpiod_table;
-} gf_mods[] = {
-       { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" },
-       { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" },
-       { .id = 0x03, .rev = 0xff, .name = "1252-EV1 Glenlivet" },
-       { .id = 0x06, .rev = 0xff, .name = "WM8997-6721-CS96-EV1 Lapraoig" },
-       { .id = 0x07, .rev = 0xff, .name = "WM5110-6271 Deanston",
-         .spi_devs = wm5110_spi_devs,
-         .num_spi_devs = ARRAY_SIZE(wm5110_spi_devs) },
-       { .id = 0x08, .rev = 0xff, .name = "WM8903-6102 Tamdhu" },
-       { .id = 0x09, .rev = 0xff, .name = "WM1811A-6305 Adelphi" },
-       { .id = 0x0a, .rev = 0xff, .name = "WM8996-6272 Blackadder" },
-       { .id = 0x0b, .rev = 0xff, .name = "WM8994-6235 Benromach" },
-       { .id = 0x11, .rev = 0xff, .name = "6249-EV2 Glenfarclas", },
-       { .id = 0x14, .rev = 0xff, .name = "6271-EV1 Lochnagar" },
-       { .id = 0x15, .rev = 0xff, .name = "6320-EV1 Bells",
-         .i2c_devs = wm6230_i2c_devs,
-         .num_i2c_devs = ARRAY_SIZE(wm6230_i2c_devs) },
-       { .id = 0x21, .rev = 0xff, .name = "1275-EV1 Mortlach" },
-       { .id = 0x25, .rev = 0xff, .name = "1274-EV1 Glencadam" },
-       { .id = 0x31, .rev = 0xff, .name = "1253-EV1 Tomatin",
-         .spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs) },
-       { .id = 0x32, .rev = 0xff, .name = "XXXX-EV1 Caol Illa" },
-       { .id = 0x33, .rev = 0xff, .name = "XXXX-EV1 Oban" },
-       { .id = 0x34, .rev = 0xff, .name = "WM0010-6320-CS42 Balblair",
-         .spi_devs = balblair_devs,
-         .num_spi_devs = ARRAY_SIZE(balblair_devs) },
-       { .id = 0x39, .rev = 0xff, .name = "1254-EV1 Dallas Dhu",
-         .i2c_devs = wm1254_devs, .num_i2c_devs = ARRAY_SIZE(wm1254_devs) },
-       { .id = 0x3a, .rev = 0xff, .name = "1259-EV1 Tobermory",
-         .i2c_devs = wm1259_devs, .num_i2c_devs = ARRAY_SIZE(wm1259_devs) },
-       { .id = 0x3b, .rev = 0xff, .name = "1255-EV1 Kilchoman",
-         .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) },
-       { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" },
-       { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill",
-         .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs),
-         .gpiod_table = &wm8994_gpiod_table },
-       { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut",
-         .spi_devs = wm5102_reva_spi_devs,
-         .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs),
-         .gpiod_table = &wm5102_reva_gpiod_table },
-       { .id = 0x3e, .rev = -1, .name = "WM5102-6271-EV1-CS127 Amrut",
-         .spi_devs = wm5102_spi_devs,
-         .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs),
-         .gpiod_table = &wm5102_gpiod_table },
-       { .id = 0x3f, .rev = -1, .name = "WM2200-6271-CS90-M-REV1",
-         .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) },
-};
-
-static int wlf_gf_module_probe(struct i2c_client *i2c,
-                              const struct i2c_device_id *i2c_id)
-{
-       int ret, i, j, id, rev;
-
-       ret = i2c_smbus_read_byte_data(i2c, 0);
-       if (ret < 0) {
-               dev_err(&i2c->dev, "Failed to read ID: %d\n", ret);
-               return ret;
-       }
-
-       id = (ret & 0xfe) >> 2;
-       rev = ret & 0x3;
-       for (i = 0; i < ARRAY_SIZE(gf_mods); i++)
-               if (id == gf_mods[i].id && (gf_mods[i].rev == 0xff ||
-                                           rev == gf_mods[i].rev))
-                       break;
-
-       gpiod_add_lookup_table(&wm5102_reva_gpiod_table);
-       gpiod_add_lookup_table(&wm5102_gpiod_table);
-       gpiod_add_lookup_table(&wm8994_gpiod_table);
-
-       if (i < ARRAY_SIZE(gf_mods)) {
-               dev_info(&i2c->dev, "%s revision %d\n",
-                        gf_mods[i].name, rev + 1);
-
-               for (j = 0; j < gf_mods[i].num_i2c_devs; j++) {
-                       if (IS_ERR(i2c_new_client_device(i2c->adapter,
-                                                        &(gf_mods[i].i2c_devs[j]))))
-                               dev_err(&i2c->dev, "Failed to register\n");
-               }
-
-               spi_register_board_info(gf_mods[i].spi_devs,
-                                       gf_mods[i].num_spi_devs);
-
-               if (gf_mods[i].gpiod_table)
-                       gpiod_add_lookup_table(gf_mods[i].gpiod_table);
-       } else {
-               dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n",
-                        id, rev + 1);
-       }
-
-       return 0;
-}
-
-static const struct i2c_device_id wlf_gf_module_id[] = {
-       { "wlf-gf-module", 0 },
-       { }
-};
-
-static struct i2c_driver wlf_gf_module_driver = {
-       .driver = {
-               .name = "wlf-gf-module"
-       },
-       .probe = wlf_gf_module_probe,
-       .id_table = wlf_gf_module_id,
-};
-
-static int __init wlf_gf_module_register(void)
-{
-       if (!soc_is_s3c64xx())
-               return 0;
-
-       return i2c_add_driver(&wlf_gf_module_driver);
-}
-device_initcall(wlf_gf_module_register);
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
deleted file mode 100644 (file)
index da96542..0000000
+++ /dev/null
@@ -1,882 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2011 Wolfson Microelectronics plc
-//     Mark Brown <broonie@opensource.wolfsonmicro.com>
-//
-// Copyright 2011 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/fb.h>
-#include <linux/io.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/leds.h>
-#include <linux/delay.h>
-#include <linux/mmc/host.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-#include <linux/pwm.h>
-#include <linux/pwm_backlight.h>
-#include <linux/dm9000.h>
-#include <linux/gpio_keys.h>
-#include <linux/gpio/driver.h>
-#include <linux/spi/spi.h>
-
-#include <linux/platform_data/pca953x.h>
-#include <linux/platform_data/s3c-hsotg.h>
-
-#include <video/platform_lcd.h>
-
-#include <linux/mfd/wm831x/core.h>
-#include <linux/mfd/wm831x/pdata.h>
-#include <linux/mfd/wm831x/irq.h>
-#include <linux/mfd/wm831x/gpio.h>
-
-#include <sound/wm1250-ev1.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach-types.h>
-
-#include <video/samsung_fimd.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <mach/irqs.h>
-
-#include <plat/fb.h>
-#include <plat/sdhci.h>
-#include <plat/gpio-cfg.h>
-#include <linux/platform_data/spi-s3c64xx.h>
-
-#include <plat/keypad.h>
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/adc.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/pm.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "crag6410.h"
-#include "regs-gpio-memport.h"
-#include "regs-modem.h"
-#include "regs-sys.h"
-
-/* serial port setup */
-
-#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport         = 0,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [1] = {
-               .hwport         = 1,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [2] = {
-               .hwport         = 2,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-       [3] = {
-               .hwport         = 3,
-               .flags          = 0,
-               .ucon           = UCON,
-               .ulcon          = ULCON,
-               .ufcon          = UFCON,
-       },
-};
-
-static struct pwm_lookup crag6410_pwm_lookup[] = {
-       PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 100000,
-                  PWM_POLARITY_NORMAL),
-};
-
-static struct platform_pwm_backlight_data crag6410_backlight_data = {
-       .max_brightness = 1000,
-       .dft_brightness = 600,
-};
-
-static struct platform_device crag6410_backlight_device = {
-       .name           = "pwm-backlight",
-       .id             = -1,
-       .dev            = {
-               .parent = &samsung_device_pwm.dev,
-               .platform_data = &crag6410_backlight_data,
-       },
-};
-
-static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
-{
-       pr_debug("%s: setting power %d\n", __func__, power);
-
-       if (power) {
-               gpio_set_value(S3C64XX_GPB(0), 1);
-               msleep(1);
-               s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
-       } else {
-               gpio_direction_output(S3C64XX_GPF(14), 0);
-               gpio_set_value(S3C64XX_GPB(0), 0);
-       }
-}
-
-static struct platform_device crag6410_lcd_powerdev = {
-       .name                   = "platform-lcd",
-       .id                     = -1,
-       .dev.parent             = &s3c_device_fb.dev,
-       .dev.platform_data      = &(struct plat_lcd_data) {
-               .set_power      = crag6410_lcd_power_set,
-       },
-};
-
-/* 640x480 URT */
-static struct s3c_fb_pd_win crag6410_fb_win0 = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 640,
-       .yres           = 480,
-       .virtual_y      = 480 * 2,
-       .virtual_x      = 640,
-};
-
-static struct fb_videomode crag6410_lcd_timing = {
-       .left_margin    = 150,
-       .right_margin   = 80,
-       .upper_margin   = 40,
-       .lower_margin   = 5,
-       .hsync_len      = 40,
-       .vsync_len      = 5,
-       .xres           = 640,
-       .yres           = 480,
-};
-
-/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
-static struct s3c_fb_platdata crag6410_lcd_pdata = {
-       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-       .vtiming        = &crag6410_lcd_timing,
-       .win[0]         = &crag6410_fb_win0,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-};
-
-/* 2x6 keypad */
-
-static uint32_t crag6410_keymap[] = {
-       /* KEY(row, col, keycode) */
-       KEY(0, 0, KEY_VOLUMEUP),
-       KEY(0, 1, KEY_HOME),
-       KEY(0, 2, KEY_VOLUMEDOWN),
-       KEY(0, 3, KEY_HELP),
-       KEY(0, 4, KEY_MENU),
-       KEY(0, 5, KEY_MEDIA),
-       KEY(1, 0, 232),
-       KEY(1, 1, KEY_DOWN),
-       KEY(1, 2, KEY_LEFT),
-       KEY(1, 3, KEY_UP),
-       KEY(1, 4, KEY_RIGHT),
-       KEY(1, 5, KEY_CAMERA),
-};
-
-static struct matrix_keymap_data crag6410_keymap_data = {
-       .keymap         = crag6410_keymap,
-       .keymap_size    = ARRAY_SIZE(crag6410_keymap),
-};
-
-static struct samsung_keypad_platdata crag6410_keypad_data = {
-       .keymap_data    = &crag6410_keymap_data,
-       .rows           = 2,
-       .cols           = 6,
-};
-
-static struct gpio_keys_button crag6410_gpio_keys[] = {
-       [0] = {
-               .code   = KEY_SUSPEND,
-               .gpio   = S3C64XX_GPL(10),      /* EINT 18 */
-               .type   = EV_KEY,
-               .wakeup = 1,
-               .active_low = 1,
-       },
-       [1] = {
-               .code   = SW_FRONT_PROXIMITY,
-               .gpio   = S3C64XX_GPN(11),      /* EINT 11 */
-               .type   = EV_SW,
-       },
-};
-
-static struct gpio_keys_platform_data crag6410_gpio_keydata = {
-       .buttons        = crag6410_gpio_keys,
-       .nbuttons       = ARRAY_SIZE(crag6410_gpio_keys),
-};
-
-static struct platform_device crag6410_gpio_keydev = {
-       .name           = "gpio-keys",
-       .id             = 0,
-       .dev.platform_data = &crag6410_gpio_keydata,
-};
-
-static struct resource crag6410_dm9k_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),
-       [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),
-       [2] = DEFINE_RES_NAMED(S3C_EINT(17), 1, NULL, IORESOURCE_IRQ \
-                               | IORESOURCE_IRQ_HIGHLEVEL),
-};
-
-static struct dm9000_plat_data mini6410_dm9k_pdata = {
-       .flags  = DM9000_PLATF_16BITONLY,
-};
-
-static struct platform_device crag6410_dm9k_device = {
-       .name           = "dm9000",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(crag6410_dm9k_resource),
-       .resource       = crag6410_dm9k_resource,
-       .dev.platform_data = &mini6410_dm9k_pdata,
-};
-
-static struct resource crag6410_mmgpio_resource[] = {
-       [0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),
-};
-
-static struct platform_device crag6410_mmgpio = {
-       .name           = "basic-mmio-gpio",
-       .id             = -1,
-       .resource       = crag6410_mmgpio_resource,
-       .num_resources  = ARRAY_SIZE(crag6410_mmgpio_resource),
-       .dev.platform_data = &(struct bgpio_pdata) {
-               .base   = MMGPIO_GPIO_BASE,
-       },
-};
-
-static struct platform_device speyside_device = {
-       .name           = "speyside",
-       .id             = -1,
-};
-
-static struct platform_device lowland_device = {
-       .name           = "lowland",
-       .id             = -1,
-};
-
-static struct platform_device tobermory_device = {
-       .name           = "tobermory",
-       .id             = -1,
-};
-
-static struct platform_device littlemill_device = {
-       .name           = "littlemill",
-       .id             = -1,
-};
-
-static struct platform_device bells_wm2200_device = {
-       .name           = "bells",
-       .id             = 0,
-};
-
-static struct platform_device bells_wm5102_device = {
-       .name           = "bells",
-       .id             = 1,
-};
-
-static struct platform_device bells_wm5110_device = {
-       .name           = "bells",
-       .id             = 2,
-};
-
-static struct regulator_consumer_supply wallvdd_consumers[] = {
-       REGULATOR_SUPPLY("SPKVDD", "1-001a"),
-       REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
-       REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
-       REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
-       REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
-
-       REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
-       REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
-
-       REGULATOR_SUPPLY("DC1VDD", "0-0034"),
-       REGULATOR_SUPPLY("DC2VDD", "0-0034"),
-       REGULATOR_SUPPLY("DC3VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO1VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO2VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO4VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO5VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO6VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO7VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO8VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO9VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO10VDD", "0-0034"),
-       REGULATOR_SUPPLY("LDO11VDD", "0-0034"),
-
-       REGULATOR_SUPPLY("DC1VDD", "1-0034"),
-       REGULATOR_SUPPLY("DC2VDD", "1-0034"),
-       REGULATOR_SUPPLY("DC3VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO1VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO2VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO4VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO5VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO6VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO7VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO8VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO9VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO10VDD", "1-0034"),
-       REGULATOR_SUPPLY("LDO11VDD", "1-0034"),
-};
-
-static struct regulator_init_data wallvdd_data = {
-       .constraints = {
-               .always_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(wallvdd_consumers),
-       .consumer_supplies = wallvdd_consumers,
-};
-
-static struct fixed_voltage_config wallvdd_pdata = {
-       .supply_name = "WALLVDD",
-       .microvolts = 5000000,
-       .init_data = &wallvdd_data,
-};
-
-static struct platform_device wallvdd_device = {
-       .name           = "reg-fixed-voltage",
-       .id             = -1,
-       .dev = {
-               .platform_data = &wallvdd_pdata,
-       },
-};
-
-static struct platform_device *crag6410_devices[] __initdata = {
-       &s3c_device_hsmmc0,
-       &s3c_device_hsmmc2,
-       &s3c_device_i2c0,
-       &s3c_device_i2c1,
-       &s3c_device_fb,
-       &s3c_device_ohci,
-       &s3c_device_usb_hsotg,
-       &samsung_device_pwm,
-       &s3c64xx_device_iis0,
-       &s3c64xx_device_iis1,
-       &samsung_device_keypad,
-       &crag6410_gpio_keydev,
-       &crag6410_dm9k_device,
-       &s3c64xx_device_spi0,
-       &crag6410_mmgpio,
-       &crag6410_lcd_powerdev,
-       &crag6410_backlight_device,
-       &speyside_device,
-       &tobermory_device,
-       &littlemill_device,
-       &lowland_device,
-       &bells_wm2200_device,
-       &bells_wm5102_device,
-       &bells_wm5110_device,
-       &wallvdd_device,
-};
-
-static struct pca953x_platform_data crag6410_pca_data = {
-       .gpio_base      = PCA935X_GPIO_BASE,
-       .irq_base       = -1,
-};
-
-/* VDDARM is controlled by DVS1 connected to GPK(0) */
-static struct wm831x_buckv_pdata vddarm_pdata = {
-       .dvs_control_src = 1,
-};
-
-static struct regulator_consumer_supply vddarm_consumers[] = {
-       REGULATOR_SUPPLY("vddarm", NULL),
-};
-
-static struct regulator_init_data vddarm = {
-       .constraints = {
-               .name = "VDDARM",
-               .min_uV = 1000000,
-               .max_uV = 1300000,
-               .always_on = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vddarm_consumers),
-       .consumer_supplies = vddarm_consumers,
-       .supply_regulator = "WALLVDD",
-       .driver_data = &vddarm_pdata,
-};
-
-static struct regulator_consumer_supply vddint_consumers[] = {
-       REGULATOR_SUPPLY("vddint", NULL),
-};
-
-static struct regulator_init_data vddint = {
-       .constraints = {
-               .name = "VDDINT",
-               .min_uV = 1000000,
-               .max_uV = 1200000,
-               .always_on = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vddint_consumers),
-       .consumer_supplies = vddint_consumers,
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddmem = {
-       .constraints = {
-               .name = "VDDMEM",
-               .always_on = 1,
-       },
-};
-
-static struct regulator_init_data vddsys = {
-       .constraints = {
-               .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
-               .always_on = 1,
-       },
-};
-
-static struct regulator_consumer_supply vddmmc_consumers[] = {
-       REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
-       REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
-       REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
-};
-
-static struct regulator_init_data vddmmc = {
-       .constraints = {
-               .name = "VDDMMC,UH",
-               .always_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
-       .consumer_supplies = vddmmc_consumers,
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddotgi = {
-       .constraints = {
-               .name = "VDDOTGi",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddotg = {
-       .constraints = {
-               .name = "VDDOTG",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddhi = {
-       .constraints = {
-               .name = "VDDHI",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddadc = {
-       .constraints = {
-               .name = "VDDADC,VDDDAC",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddmem0 = {
-       .constraints = {
-               .name = "VDDMEM0",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddpll = {
-       .constraints = {
-               .name = "VDDPLL",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddlcd = {
-       .constraints = {
-               .name = "VDDLCD",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct regulator_init_data vddalive = {
-       .constraints = {
-               .name = "VDDALIVE",
-               .always_on = 1,
-       },
-       .supply_regulator = "WALLVDD",
-};
-
-static struct wm831x_backup_pdata banff_backup_pdata = {
-       .charger_enable = 1,
-       .vlim = 2500,  /* mV */
-       .ilim = 200,   /* uA */
-};
-
-static struct wm831x_status_pdata banff_red_led = {
-       .name = "banff:red:",
-       .default_src = WM831X_STATUS_MANUAL,
-};
-
-static struct wm831x_status_pdata banff_green_led = {
-       .name = "banff:green:",
-       .default_src = WM831X_STATUS_MANUAL,
-};
-
-static struct wm831x_touch_pdata touch_pdata = {
-       .data_irq = S3C_EINT(26),
-       .pd_irq = S3C_EINT(27),
-};
-
-static struct wm831x_pdata crag_pmic_pdata = {
-       .wm831x_num = 1,
-       .irq_base = BANFF_PMIC_IRQ_BASE,
-       .gpio_base = BANFF_PMIC_GPIO_BASE,
-       .soft_shutdown = true,
-
-       .backup = &banff_backup_pdata,
-
-       .gpio_defaults = {
-               /* GPIO5: DVS1_REQ - CMOS, DBVDD, active high */
-               [4] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA | 0x8,
-               /* GPIO11: Touchscreen data - CMOS, DBVDD, active high*/
-               [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
-               /* GPIO12: Touchscreen pen down - CMOS, DBVDD, active high*/
-               [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
-       },
-
-       .dcdc = {
-               &vddarm,  /* DCDC1 */
-               &vddint,  /* DCDC2 */
-               &vddmem,  /* DCDC3 */
-       },
-
-       .ldo = {
-               &vddsys,   /* LDO1 */
-               &vddmmc,   /* LDO2 */
-               NULL,      /* LDO3 */
-               &vddotgi,  /* LDO4 */
-               &vddotg,   /* LDO5 */
-               &vddhi,    /* LDO6 */
-               &vddadc,   /* LDO7 */
-               &vddmem0,  /* LDO8 */
-               &vddpll,   /* LDO9 */
-               &vddlcd,   /* LDO10 */
-               &vddalive, /* LDO11 */
-       },
-
-       .status = {
-               &banff_green_led,
-               &banff_red_led,
-       },
-
-       .touch = &touch_pdata,
-};
-
-/*
- * VDDARM is eventually ending up as a regulator hanging on the MFD cell device
- * "wm831x-buckv.1" spawn from drivers/mfd/wm831x-core.c.
- *
- * From the note on the platform data we can see that this is clearly DVS1
- * and assigned as dcdc1 resource to the MFD core which sets .id of the cell
- * spawning the DVS1 platform device to 1, then the cell platform device
- * name is calculated from 10*instance + id resulting in the device name
- * "wm831x-buckv.11"
- */
-static struct gpiod_lookup_table crag_pmic_gpiod_table = {
-       .dev_id = "wm831x-buckv.11",
-       .table = {
-               GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static struct i2c_board_info i2c_devs0[] = {
-       { I2C_BOARD_INFO("24c08", 0x50), },
-       { I2C_BOARD_INFO("tca6408", 0x20),
-         .platform_data = &crag6410_pca_data,
-       },
-       { I2C_BOARD_INFO("wm8312", 0x34),
-         .platform_data = &crag_pmic_pdata,
-         .irq = S3C_EINT(23),
-       },
-};
-
-static struct s3c2410_platform_i2c i2c0_pdata = {
-       .frequency = 400000,
-};
-
-static struct regulator_consumer_supply pvdd_1v2_consumers[] = {
-       REGULATOR_SUPPLY("DCVDD", "spi0.0"),
-       REGULATOR_SUPPLY("AVDD", "spi0.0"),
-       REGULATOR_SUPPLY("AVDD", "spi0.1"),
-};
-
-static struct regulator_init_data pvdd_1v2 = {
-       .constraints = {
-               .name = "PVDD_1V2",
-               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-       },
-
-       .consumer_supplies = pvdd_1v2_consumers,
-       .num_consumer_supplies = ARRAY_SIZE(pvdd_1v2_consumers),
-};
-
-static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
-       REGULATOR_SUPPLY("LDOVDD", "1-001a"),
-       REGULATOR_SUPPLY("PLLVDD", "1-001a"),
-       REGULATOR_SUPPLY("DBVDD", "1-001a"),
-       REGULATOR_SUPPLY("DBVDD1", "1-001a"),
-       REGULATOR_SUPPLY("DBVDD2", "1-001a"),
-       REGULATOR_SUPPLY("DBVDD3", "1-001a"),
-       REGULATOR_SUPPLY("CPVDD", "1-001a"),
-       REGULATOR_SUPPLY("AVDD2", "1-001a"),
-       REGULATOR_SUPPLY("DCVDD", "1-001a"),
-       REGULATOR_SUPPLY("AVDD", "1-001a"),
-       REGULATOR_SUPPLY("DBVDD", "spi0.0"),
-
-       REGULATOR_SUPPLY("DBVDD", "1-003a"),
-       REGULATOR_SUPPLY("LDOVDD", "1-003a"),
-       REGULATOR_SUPPLY("CPVDD", "1-003a"),
-       REGULATOR_SUPPLY("AVDD", "1-003a"),
-       REGULATOR_SUPPLY("DBVDD1", "spi0.1"),
-       REGULATOR_SUPPLY("DBVDD2", "spi0.1"),
-       REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
-       REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
-       REGULATOR_SUPPLY("CPVDD", "spi0.1"),
-};
-
-static struct regulator_init_data pvdd_1v8 = {
-       .constraints = {
-               .name = "PVDD_1V8",
-               .always_on = 1,
-       },
-
-       .consumer_supplies = pvdd_1v8_consumers,
-       .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
-};
-
-static struct regulator_consumer_supply pvdd_3v3_consumers[] = {
-       REGULATOR_SUPPLY("MICVDD", "1-001a"),
-       REGULATOR_SUPPLY("AVDD1", "1-001a"),
-};
-
-static struct regulator_init_data pvdd_3v3 = {
-       .constraints = {
-               .name = "PVDD_3V3",
-               .always_on = 1,
-       },
-
-       .consumer_supplies = pvdd_3v3_consumers,
-       .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
-};
-
-static struct wm831x_pdata glenfarclas_pmic_pdata = {
-       .wm831x_num = 2,
-       .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
-       .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
-       .soft_shutdown = true,
-
-       .gpio_defaults = {
-               /* GPIO1-3: IRQ inputs, rising edge triggered, CMOS */
-               [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
-               [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
-               [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
-       },
-
-       .dcdc = {
-               &pvdd_1v2,  /* DCDC1 */
-               &pvdd_1v8,  /* DCDC2 */
-               &pvdd_3v3,  /* DCDC3 */
-       },
-
-       .disable_touch = true,
-};
-
-static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
-       .gpios = {
-               [WM1250_EV1_GPIO_CLK_ENA] = S3C64XX_GPN(12),
-               [WM1250_EV1_GPIO_CLK_SEL0] = S3C64XX_GPL(12),
-               [WM1250_EV1_GPIO_CLK_SEL1] = S3C64XX_GPL(13),
-               [WM1250_EV1_GPIO_OSR] = S3C64XX_GPL(14),
-               [WM1250_EV1_GPIO_MASTER] = S3C64XX_GPL(8),
-       },
-};
-
-static struct i2c_board_info i2c_devs1[] = {
-       { I2C_BOARD_INFO("wm8311", 0x34),
-         .irq = S3C_EINT(0),
-         .platform_data = &glenfarclas_pmic_pdata },
-
-       { I2C_BOARD_INFO("wlf-gf-module", 0x20) },
-       { I2C_BOARD_INFO("wlf-gf-module", 0x22) },
-       { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
-       { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
-       { I2C_BOARD_INFO("wlf-gf-module", 0x26) },
-
-       { I2C_BOARD_INFO("wm1250-ev1", 0x27),
-         .platform_data = &wm1250_ev1_pdata },
-};
-
-static struct s3c2410_platform_i2c i2c1_pdata = {
-       .frequency = 400000,
-       .bus_num = 1,
-};
-
-static void __init crag6410_map_io(void)
-{
-       s3c64xx_init_io(NULL, 0);
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* LCD type and Bypass set by bootloader */
-}
-
-static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
-       .max_width              = 4,
-       .cd_type                = S3C_SDHCI_CD_PERMANENT,
-       .host_caps              = MMC_CAP_POWER_OFF_CARD,
-};
-
-static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
-{
-       /* Set all the necessary GPG pins to special-function 2 */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
-
-       /* force card-detected for prototype 0 */
-       s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
-}
-
-static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
-       .max_width              = 4,
-       .cd_type                = S3C_SDHCI_CD_INTERNAL,
-       .cfg_gpio               = crag6410_cfg_sdhci0,
-       .host_caps              = MMC_CAP_POWER_OFF_CARD,
-};
-
-static const struct gpio_led gpio_leds[] = {
-       {
-               .name = "d13:green:",
-               .gpio = MMGPIO_GPIO_BASE + 0,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d14:green:",
-               .gpio = MMGPIO_GPIO_BASE + 1,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d15:green:",
-               .gpio = MMGPIO_GPIO_BASE + 2,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d16:green:",
-               .gpio = MMGPIO_GPIO_BASE + 3,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d17:green:",
-               .gpio = MMGPIO_GPIO_BASE + 4,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d18:green:",
-               .gpio = MMGPIO_GPIO_BASE + 5,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d19:green:",
-               .gpio = MMGPIO_GPIO_BASE + 6,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-       {
-               .name = "d20:green:",
-               .gpio = MMGPIO_GPIO_BASE + 7,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-};
-
-static const struct gpio_led_platform_data gpio_leds_pdata = {
-       .leds = gpio_leds,
-       .num_leds = ARRAY_SIZE(gpio_leds),
-};
-
-static struct dwc2_hsotg_plat crag6410_hsotg_pdata;
-
-static void __init crag6410_machine_init(void)
-{
-       /* Open drain IRQs need pullups */
-       s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
-       s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
-
-       gpio_request(S3C64XX_GPB(0), "LCD power");
-       gpio_direction_output(S3C64XX_GPB(0), 0);
-
-       gpio_request(S3C64XX_GPF(14), "LCD PWM");
-       gpio_direction_output(S3C64XX_GPF(14), 0);  /* turn off */
-
-       gpio_request(S3C64XX_GPB(1), "SD power");
-       gpio_direction_output(S3C64XX_GPB(1), 0);
-
-       gpio_request(S3C64XX_GPF(10), "nRESETSEL");
-       gpio_direction_output(S3C64XX_GPF(10), 1);
-
-       s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
-       s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
-
-       s3c_i2c0_set_platdata(&i2c0_pdata);
-       s3c_i2c1_set_platdata(&i2c1_pdata);
-       s3c_fb_set_platdata(&crag6410_lcd_pdata);
-       dwc2_hsotg_set_platdata(&crag6410_hsotg_pdata);
-
-       gpiod_add_lookup_table(&crag_pmic_gpiod_table);
-       i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
-       i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
-
-       samsung_keypad_set_platdata(&crag6410_keypad_data);
-       s3c64xx_spi0_set_platdata(NULL, 0, 2);
-
-       pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
-       platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
-
-       gpio_led_register_device(-1, &gpio_leds_pdata);
-
-       regulator_has_full_constraints();
-
-       s3c64xx_pm_init();
-}
-
-MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
-       /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = crag6410_map_io,
-       .init_machine   = crag6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
deleted file mode 100644 (file)
index e708021..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// mach-hmt.c - Platform code for Airgoo HMT
-//
-// Copyright 2009 Peter Korsgaard <jacmet@sunsite.dk>
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/i2c.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-#include <linux/leds.h>
-#include <linux/pwm.h>
-#include <linux/pwm_backlight.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <video/samsung_fimd.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-#include <mach/irqs.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-#include <plat/fb.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-};
-
-static struct pwm_lookup hmt_pwm_lookup[] = {
-       PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
-                  1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
-};
-
-static int hmt_bl_init(struct device *dev)
-{
-       int ret;
-
-       ret = gpio_request(S3C64XX_GPB(4), "lcd backlight enable");
-       if (!ret)
-               ret = gpio_direction_output(S3C64XX_GPB(4), 0);
-
-       return ret;
-}
-
-static int hmt_bl_notify(struct device *dev, int brightness)
-{
-       /*
-        * translate from CIELUV/CIELAB L*->brightness, E.G. from
-        * perceived luminance to light output. Assumes range 0..25600
-        */
-       if (brightness < 0x800) {
-               /* Y = Yn * L / 903.3 */
-               brightness = (100*256 * brightness + 231245/2) / 231245;
-       } else {
-               /* Y = Yn * ((L + 16) / 116 )^3 */
-               int t = (brightness*4 + 16*1024 + 58)/116;
-               brightness = 25 * ((t * t * t + 0x100000/2) / 0x100000);
-       }
-
-       gpio_set_value(S3C64XX_GPB(4), brightness);
-
-       return brightness;
-}
-
-static void hmt_bl_exit(struct device *dev)
-{
-       gpio_free(S3C64XX_GPB(4));
-}
-
-static struct platform_pwm_backlight_data hmt_backlight_data = {
-       .max_brightness = 100 * 256,
-       .dft_brightness = 40 * 256,
-       .init           = hmt_bl_init,
-       .notify         = hmt_bl_notify,
-       .exit           = hmt_bl_exit,
-
-};
-
-static struct platform_device hmt_backlight_device = {
-       .name           = "pwm-backlight",
-       .dev            = {
-               .parent = &samsung_device_pwm.dev,
-               .platform_data = &hmt_backlight_data,
-       },
-};
-
-static struct s3c_fb_pd_win hmt_fb_win0 = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct fb_videomode hmt_lcd_timing = {
-       .left_margin    = 8,
-       .right_margin   = 13,
-       .upper_margin   = 7,
-       .lower_margin   = 5,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
-static struct s3c_fb_platdata hmt_lcd_pdata __initdata = {
-       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-       .vtiming        = &hmt_lcd_timing,
-       .win[0]         = &hmt_fb_win0,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-};
-
-static struct mtd_partition hmt_nand_part[] = {
-       [0] = {
-               .name   = "uboot",
-               .size   = SZ_512K,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "uboot-env1",
-               .size   = SZ_256K,
-               .offset = SZ_512K,
-       },
-       [2] = {
-               .name   = "uboot-env2",
-               .size   = SZ_256K,
-               .offset = SZ_512K + SZ_256K,
-       },
-       [3] = {
-               .name   = "kernel",
-               .size   = SZ_2M,
-               .offset = SZ_1M,
-       },
-       [4] = {
-               .name   = "rootfs",
-               .size   = MTDPART_SIZ_FULL,
-               .offset = SZ_1M + SZ_2M,
-       },
-};
-
-static struct s3c2410_nand_set hmt_nand_sets[] = {
-       [0] = {
-               .name           = "nand",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(hmt_nand_part),
-               .partitions     = hmt_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand hmt_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 55,
-       .twrph1         = 40,
-       .nr_sets        = ARRAY_SIZE(hmt_nand_sets),
-       .sets           = hmt_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-static struct gpio_led hmt_leds[] = {
-       { /* left function keys */
-               .name                   = "left:blue",
-               .gpio                   = S3C64XX_GPO(12),
-               .default_trigger        = "default-on",
-       },
-       { /* right function keys - red */
-               .name                   = "right:red",
-               .gpio                   = S3C64XX_GPO(13),
-       },
-       { /* right function keys - green */
-               .name                   = "right:green",
-               .gpio                   = S3C64XX_GPO(14),
-       },
-       { /* right function keys - blue */
-               .name                   = "right:blue",
-               .gpio                   = S3C64XX_GPO(15),
-               .default_trigger        = "default-on",
-       },
-};
-
-static struct gpio_led_platform_data hmt_led_data = {
-       .num_leds = ARRAY_SIZE(hmt_leds),
-       .leds = hmt_leds,
-};
-
-static struct platform_device hmt_leds_device = {
-       .name                   = "leds-gpio",
-       .id                     = -1,
-       .dev.platform_data      = &hmt_led_data,
-};
-
-static struct map_desc hmt_iodesc[] = {};
-
-static struct platform_device *hmt_devices[] __initdata = {
-       &s3c_device_i2c0,
-       &s3c_device_nand,
-       &s3c_device_fb,
-       &s3c_device_ohci,
-       &samsung_device_pwm,
-       &hmt_backlight_device,
-       &hmt_leds_device,
-};
-
-static void __init hmt_map_io(void)
-{
-       s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init hmt_machine_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       s3c_fb_set_platdata(&hmt_lcd_pdata);
-       s3c_nand_set_platdata(&hmt_nand_info);
-
-       gpio_request(S3C64XX_GPC(7), "usb power");
-       gpio_direction_output(S3C64XX_GPC(7), 0);
-       gpio_request(S3C64XX_GPM(0), "usb power");
-       gpio_direction_output(S3C64XX_GPM(0), 1);
-       gpio_request(S3C64XX_GPK(7), "usb power");
-       gpio_direction_output(S3C64XX_GPK(7), 1);
-       gpio_request(S3C64XX_GPF(13), "usb power");
-       gpio_direction_output(S3C64XX_GPF(13), 1);
-
-       pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
-       platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
-}
-
-MACHINE_START(HMT, "Airgoo-HMT")
-       /* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = hmt_map_io,
-       .init_machine   = hmt_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
deleted file mode 100644 (file)
index 0dd36ae..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2010 Darius Augulis <augulis.darius@gmail.com>
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/dm9000.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/types.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/adc.h>
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/mmc-sdhci-s3c.h>
-#include <plat/sdhci.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-#include <mach/irqs.h>
-
-#include <video/platform_lcd.h>
-#include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "regs-modem.h"
-#include "regs-srom.h"
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg mini6410_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport = 0,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-       [1] = {
-               .hwport = 1,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-       [2] = {
-               .hwport = 2,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-       [3] = {
-               .hwport = 3,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-};
-
-/* DM9000AEP 10/100 ethernet controller */
-
-static struct resource mini6410_dm9k_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
-       [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
-       [2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
-                                       | IORESOURCE_IRQ_HIGHLEVEL),
-};
-
-static struct dm9000_plat_data mini6410_dm9k_pdata = {
-       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
-};
-
-static struct platform_device mini6410_device_eth = {
-       .name           = "dm9000",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(mini6410_dm9k_resource),
-       .resource       = mini6410_dm9k_resource,
-       .dev            = {
-               .platform_data  = &mini6410_dm9k_pdata,
-       },
-};
-
-static struct mtd_partition mini6410_nand_part[] = {
-       [0] = {
-               .name   = "uboot",
-               .size   = SZ_1M,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "kernel",
-               .size   = SZ_2M,
-               .offset = SZ_1M,
-       },
-       [2] = {
-               .name   = "rootfs",
-               .size   = MTDPART_SIZ_FULL,
-               .offset = SZ_1M + SZ_2M,
-       },
-};
-
-static struct s3c2410_nand_set mini6410_nand_sets[] = {
-       [0] = {
-               .name           = "nand",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(mini6410_nand_part),
-               .partitions     = mini6410_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand mini6410_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 55,
-       .twrph1         = 40,
-       .nr_sets        = ARRAY_SIZE(mini6410_nand_sets),
-       .sets           = mini6410_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-static struct s3c_fb_pd_win mini6410_lcd_type0_fb_win = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 480,
-       .yres           = 272,
-};
-
-static struct fb_videomode mini6410_lcd_type0_timing = {
-       /* 4.3" 480x272 */
-       .left_margin    = 3,
-       .right_margin   = 2,
-       .upper_margin   = 1,
-       .lower_margin   = 1,
-       .hsync_len      = 40,
-       .vsync_len      = 1,
-       .xres           = 480,
-       .yres           = 272,
-};
-
-static struct s3c_fb_pd_win mini6410_lcd_type1_fb_win = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct fb_videomode mini6410_lcd_type1_timing = {
-       /* 7.0" 800x480 */
-       .left_margin    = 8,
-       .right_margin   = 13,
-       .upper_margin   = 7,
-       .lower_margin   = 5,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct s3c_fb_platdata mini6410_lcd_pdata[] __initdata = {
-       {
-               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-               .vtiming        = &mini6410_lcd_type0_timing,
-               .win[0]         = &mini6410_lcd_type0_fb_win,
-               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-       }, {
-               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-               .vtiming        = &mini6410_lcd_type1_timing,
-               .win[0]         = &mini6410_lcd_type1_fb_win,
-               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-       },
-       { },
-};
-
-static void mini6410_lcd_power_set(struct plat_lcd_data *pd,
-                                  unsigned int power)
-{
-       if (power)
-               gpio_direction_output(S3C64XX_GPE(0), 1);
-       else
-               gpio_direction_output(S3C64XX_GPE(0), 0);
-}
-
-static struct plat_lcd_data mini6410_lcd_power_data = {
-       .set_power      = mini6410_lcd_power_set,
-};
-
-static struct platform_device mini6410_lcd_powerdev = {
-       .name                   = "platform-lcd",
-       .dev.parent             = &s3c_device_fb.dev,
-       .dev.platform_data      = &mini6410_lcd_power_data,
-};
-
-static struct s3c_sdhci_platdata mini6410_hsmmc1_pdata = {
-       .max_width              = 4,
-       .cd_type                = S3C_SDHCI_CD_GPIO,
-       .ext_cd_gpio            = S3C64XX_GPN(10),
-       .ext_cd_gpio_invert     = true,
-};
-
-static struct platform_device *mini6410_devices[] __initdata = {
-       &mini6410_device_eth,
-       &s3c_device_hsmmc0,
-       &s3c_device_hsmmc1,
-       &s3c_device_ohci,
-       &s3c_device_nand,
-       &s3c_device_fb,
-       &mini6410_lcd_powerdev,
-       &s3c_device_adc,
-};
-
-static void __init mini6410_map_io(void)
-{
-       u32 tmp;
-
-       s3c64xx_init_io(NULL, 0);
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* set the LCD type */
-       tmp = __raw_readl(S3C64XX_SPCON);
-       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
-       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
-       __raw_writel(tmp, S3C64XX_SPCON);
-
-       /* remove the LCD bypass */
-       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
-       tmp &= ~MIFPCON_LCD_BYPASS;
-       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
-}
-
-/*
- * mini6410_features string
- *
- * 0-9 LCD configuration
- *
- */
-static char mini6410_features_str[12] __initdata = "0";
-
-static int __init mini6410_features_setup(char *str)
-{
-       if (str)
-               strlcpy(mini6410_features_str, str,
-                       sizeof(mini6410_features_str));
-       return 1;
-}
-
-__setup("mini6410=", mini6410_features_setup);
-
-#define FEATURE_SCREEN (1 << 0)
-
-struct mini6410_features_t {
-       int done;
-       int lcd_index;
-};
-
-static void mini6410_parse_features(
-               struct mini6410_features_t *features,
-               const char *features_str)
-{
-       const char *fp = features_str;
-
-       features->done = 0;
-       features->lcd_index = 0;
-
-       while (*fp) {
-               char f = *fp++;
-
-               switch (f) {
-               case '0'...'9': /* tft screen */
-                       if (features->done & FEATURE_SCREEN) {
-                               printk(KERN_INFO "MINI6410: '%c' ignored, "
-                                       "screen type already set\n", f);
-                       } else {
-                               int li = f - '0';
-                               if (li >= ARRAY_SIZE(mini6410_lcd_pdata))
-                                       printk(KERN_INFO "MINI6410: '%c' out "
-                                               "of range LCD mode\n", f);
-                               else {
-                                       features->lcd_index = li;
-                               }
-                       }
-                       features->done |= FEATURE_SCREEN;
-                       break;
-               }
-       }
-}
-
-static void __init mini6410_machine_init(void)
-{
-       u32 cs1;
-       struct mini6410_features_t features = { 0 };
-
-       printk(KERN_INFO "MINI6410: Option string mini6410=%s\n",
-                       mini6410_features_str);
-
-       /* Parse the feature string */
-       mini6410_parse_features(&features, mini6410_features_str);
-
-       printk(KERN_INFO "MINI6410: selected LCD display is %dx%d\n",
-               mini6410_lcd_pdata[features.lcd_index].win[0]->xres,
-               mini6410_lcd_pdata[features.lcd_index].win[0]->yres);
-
-       s3c_nand_set_platdata(&mini6410_nand_info);
-       s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]);
-       s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);
-       s3c64xx_ts_set_platdata(NULL);
-
-       /* configure nCS1 width to 16 bits */
-
-       cs1 = __raw_readl(S3C64XX_SROM_BW) &
-               ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
-       cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
-               (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
-               (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
-                       S3C64XX_SROM_BW__NCS1__SHIFT;
-       __raw_writel(cs1, S3C64XX_SROM_BW);
-
-       /* set timing for nCS1 suitable for ethernet chip */
-
-       __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
-               (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
-               (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
-               (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
-               (13 << S3C64XX_SROM_BCX__TACC__SHIFT) |
-               (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
-               (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
-
-       gpio_request(S3C64XX_GPF(15), "LCD power");
-       gpio_request(S3C64XX_GPE(0), "LCD power");
-
-       platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices));
-}
-
-MACHINE_START(MINI6410, "MINI6410")
-       /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = mini6410_map_io,
-       .init_machine   = mini6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
deleted file mode 100644 (file)
index 13fea5c..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2008-2009 Samsung Electronics
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/i2c.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-
-#include <video/platform_lcd.h>
-#include <video/samsung_fimd.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/irqs.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/fb.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg ncp_uartcfgs[] __initdata = {
-       /* REVISIT: NCP uses only serial 1, 2 */
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-};
-
-static struct platform_device *ncp_devices[] __initdata = {
-       &s3c_device_hsmmc1,
-       &s3c_device_i2c0,
-};
-
-static struct map_desc ncp_iodesc[] __initdata = {};
-
-static void __init ncp_map_io(void)
-{
-       s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static void __init ncp_machine_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-
-       platform_add_devices(ncp_devices, ARRAY_SIZE(ncp_devices));
-}
-
-MACHINE_START(NCP, "NCP")
-       /* Maintainer: Samsung Electronics */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = ncp_map_io,
-       .init_machine   = ncp_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
deleted file mode 100644 (file)
index 0ff88b6..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2010 Darius Augulis <augulis.darius@gmail.com>
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/dm9000.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/platform_device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/types.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <mach/irqs.h>
-
-#include <plat/adc.h>
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-
-#include <video/platform_lcd.h>
-#include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "regs-modem.h"
-#include "regs-srom.h"
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg real6410_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport = 0,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-       [1] = {
-               .hwport = 1,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-       [2] = {
-               .hwport = 2,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-       [3] = {
-               .hwport = 3,
-               .flags  = 0,
-               .ucon   = UCON,
-               .ulcon  = ULCON,
-               .ufcon  = UFCON,
-       },
-};
-
-/* DM9000AEP 10/100 ethernet controller */
-
-static struct resource real6410_dm9k_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
-       [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
-       [2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
-                                       | IORESOURCE_IRQ_HIGHLEVEL),
-};
-
-static struct dm9000_plat_data real6410_dm9k_pdata = {
-       .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
-};
-
-static struct platform_device real6410_device_eth = {
-       .name           = "dm9000",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(real6410_dm9k_resource),
-       .resource       = real6410_dm9k_resource,
-       .dev            = {
-               .platform_data  = &real6410_dm9k_pdata,
-       },
-};
-
-static struct s3c_fb_pd_win real6410_lcd_type0_fb_win = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 480,
-       .yres           = 272,
-};
-
-static struct fb_videomode real6410_lcd_type0_timing = {
-       /* 4.3" 480x272 */
-       .left_margin    = 3,
-       .right_margin   = 2,
-       .upper_margin   = 1,
-       .lower_margin   = 1,
-       .hsync_len      = 40,
-       .vsync_len      = 1,
-};
-
-static struct s3c_fb_pd_win real6410_lcd_type1_fb_win = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct fb_videomode real6410_lcd_type1_timing = {
-       /* 7.0" 800x480 */
-       .left_margin    = 8,
-       .right_margin   = 13,
-       .upper_margin   = 7,
-       .lower_margin   = 5,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct s3c_fb_platdata real6410_lcd_pdata[] __initdata = {
-       {
-               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-               .vtiming        = &real6410_lcd_type0_timing,
-               .win[0]         = &real6410_lcd_type0_fb_win,
-               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-       }, {
-               .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-               .vtiming        = &real6410_lcd_type1_timing,
-               .win[0]         = &real6410_lcd_type1_fb_win,
-               .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-               .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-       },
-       { },
-};
-
-static struct mtd_partition real6410_nand_part[] = {
-       [0] = {
-               .name   = "uboot",
-               .size   = SZ_1M,
-               .offset = 0,
-       },
-       [1] = {
-               .name   = "kernel",
-               .size   = SZ_2M,
-               .offset = SZ_1M,
-       },
-       [2] = {
-               .name   = "rootfs",
-               .size   = MTDPART_SIZ_FULL,
-               .offset = SZ_1M + SZ_2M,
-       },
-};
-
-static struct s3c2410_nand_set real6410_nand_sets[] = {
-       [0] = {
-               .name           = "nand",
-               .nr_chips       = 1,
-               .nr_partitions  = ARRAY_SIZE(real6410_nand_part),
-               .partitions     = real6410_nand_part,
-       },
-};
-
-static struct s3c2410_platform_nand real6410_nand_info = {
-       .tacls          = 25,
-       .twrph0         = 55,
-       .twrph1         = 40,
-       .nr_sets        = ARRAY_SIZE(real6410_nand_sets),
-       .sets           = real6410_nand_sets,
-       .ecc_mode       = NAND_ECC_SOFT,
-};
-
-static struct platform_device *real6410_devices[] __initdata = {
-       &real6410_device_eth,
-       &s3c_device_hsmmc0,
-       &s3c_device_hsmmc1,
-       &s3c_device_fb,
-       &s3c_device_nand,
-       &s3c_device_adc,
-       &s3c_device_ohci,
-};
-
-static void __init real6410_map_io(void)
-{
-       u32 tmp;
-
-       s3c64xx_init_io(NULL, 0);
-       s3c24xx_init_clocks(12000000);
-       s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* set the LCD type */
-       tmp = __raw_readl(S3C64XX_SPCON);
-       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
-       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
-       __raw_writel(tmp, S3C64XX_SPCON);
-
-       /* remove the LCD bypass */
-       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
-       tmp &= ~MIFPCON_LCD_BYPASS;
-       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
-}
-
-/*
- * real6410_features string
- *
- * 0-9 LCD configuration
- *
- */
-static char real6410_features_str[12] __initdata = "0";
-
-static int __init real6410_features_setup(char *str)
-{
-       if (str)
-               strlcpy(real6410_features_str, str,
-                       sizeof(real6410_features_str));
-       return 1;
-}
-
-__setup("real6410=", real6410_features_setup);
-
-#define FEATURE_SCREEN (1 << 0)
-
-struct real6410_features_t {
-       int done;
-       int lcd_index;
-};
-
-static void real6410_parse_features(
-               struct real6410_features_t *features,
-               const char *features_str)
-{
-       const char *fp = features_str;
-
-       features->done = 0;
-       features->lcd_index = 0;
-
-       while (*fp) {
-               char f = *fp++;
-
-               switch (f) {
-               case '0'...'9': /* tft screen */
-                       if (features->done & FEATURE_SCREEN) {
-                               printk(KERN_INFO "REAL6410: '%c' ignored, "
-                                       "screen type already set\n", f);
-                       } else {
-                               int li = f - '0';
-                               if (li >= ARRAY_SIZE(real6410_lcd_pdata))
-                                       printk(KERN_INFO "REAL6410: '%c' out "
-                                               "of range LCD mode\n", f);
-                               else {
-                                       features->lcd_index = li;
-                               }
-                       }
-                       features->done |= FEATURE_SCREEN;
-                       break;
-               }
-       }
-}
-
-static void __init real6410_machine_init(void)
-{
-       u32 cs1;
-       struct real6410_features_t features = { 0 };
-
-       printk(KERN_INFO "REAL6410: Option string real6410=%s\n",
-                       real6410_features_str);
-
-       /* Parse the feature string */
-       real6410_parse_features(&features, real6410_features_str);
-
-       printk(KERN_INFO "REAL6410: selected LCD display is %dx%d\n",
-               real6410_lcd_pdata[features.lcd_index].win[0]->xres,
-               real6410_lcd_pdata[features.lcd_index].win[0]->yres);
-
-       s3c_fb_set_platdata(&real6410_lcd_pdata[features.lcd_index]);
-       s3c_nand_set_platdata(&real6410_nand_info);
-       s3c64xx_ts_set_platdata(NULL);
-
-       /* configure nCS1 width to 16 bits */
-
-       cs1 = __raw_readl(S3C64XX_SROM_BW) &
-               ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
-       cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
-               (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
-               (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
-                       S3C64XX_SROM_BW__NCS1__SHIFT;
-       __raw_writel(cs1, S3C64XX_SROM_BW);
-
-       /* set timing for nCS1 suitable for ethernet chip */
-
-       __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
-               (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
-               (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
-               (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
-               (13 << S3C64XX_SROM_BCX__TACC__SHIFT) |
-               (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
-               (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
-
-       gpio_request(S3C64XX_GPF(15), "LCD power");
-
-       platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices));
-}
-
-MACHINE_START(REAL6410, "REAL6410")
-       /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = real6410_map_io,
-       .init_machine   = real6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
deleted file mode 100644 (file)
index 1724f5e..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Samsung's S3C64XX flattened device tree enabled machine
-//
-// Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/system_misc.h>
-
-#include <plat/cpu.h>
-#include <mach/map.h>
-
-#include "common.h"
-#include "watchdog-reset.h"
-
-/*
- * IO mapping for shared system controller IP.
- *
- * FIXME: Make remaining drivers use dynamic mapping.
- */
-static struct map_desc s3c64xx_dt_iodesc[] __initdata = {
-       {
-               .virtual        = (unsigned long)S3C_VA_SYS,
-               .pfn            = __phys_to_pfn(S3C64XX_PA_SYSCON),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static void __init s3c64xx_dt_map_io(void)
-{
-       debug_ll_io_init();
-       iotable_init(s3c64xx_dt_iodesc, ARRAY_SIZE(s3c64xx_dt_iodesc));
-
-       s3c64xx_init_cpu();
-
-       if (!soc_is_s3c64xx())
-               panic("SoC is not S3C64xx!");
-}
-
-static void __init s3c64xx_dt_init_machine(void)
-{
-       samsung_wdt_reset_of_init();
-}
-
-static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
-{
-       if (mode != REBOOT_SOFT)
-               samsung_wdt_reset();
-
-       /* if all else fails, or mode was for soft, jump to 0 */
-       soft_restart(0);
-}
-
-static const char *const s3c64xx_dt_compat[] __initconst = {
-       "samsung,s3c6400",
-       "samsung,s3c6410",
-       NULL
-};
-
-DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)")
-       /* Maintainer: Tomasz Figa <tomasz.figa@gmail.com> */
-       .dt_compat      = s3c64xx_dt_compat,
-       .map_io         = s3c64xx_dt_map_io,
-       .init_machine   = s3c64xx_dt_init_machine,
-       .restart        = s3c64xx_dt_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
deleted file mode 100644 (file)
index 5025db6..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2010 Maurus Cuelenaere
-
-#include <linux/delay.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/pwm.h>
-#include <linux/pwm_backlight.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/spi/spi_gpio.h>
-#include <linux/platform_data/s3c-hsotg.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/map.h>
-
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/gpio-cfg.h>
-#include <linux/platform_data/hwmon-s3c.h>
-#include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <plat/sdhci.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-
-#include <video/platform_lcd.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "mach-smartq.h"
-#include "regs-modem.h"
-
-#define UCON S3C2410_UCON_DEFAULT
-#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
-#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
-
-static struct s3c2410_uartcfg smartq_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-};
-
-static void smartq_usb_host_powercontrol(int port, int to)
-{
-       pr_debug("%s(%d, %d)\n", __func__, port, to);
-
-       if (port == 0) {
-               gpio_set_value(S3C64XX_GPL(0), to);
-               gpio_set_value(S3C64XX_GPL(1), to);
-       }
-}
-
-static irqreturn_t smartq_usb_host_ocirq(int irq, void *pw)
-{
-       struct s3c2410_hcd_info *info = pw;
-
-       if (gpio_get_value(S3C64XX_GPL(10)) == 0) {
-               pr_debug("%s: over-current irq (oc detected)\n", __func__);
-               s3c2410_usb_report_oc(info, 3);
-       } else {
-               pr_debug("%s: over-current irq (oc cleared)\n", __func__);
-               s3c2410_usb_report_oc(info, 0);
-       }
-
-       return IRQ_HANDLED;
-}
-
-static void smartq_usb_host_enableoc(struct s3c2410_hcd_info *info, int on)
-{
-       int ret;
-
-       /* This isn't present on a SmartQ 5 board */
-       if (machine_is_smartq5())
-               return;
-
-       if (on) {
-               ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)),
-                                 smartq_usb_host_ocirq,
-                                 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                                 "USB host overcurrent", info);
-               if (ret != 0)
-                       pr_err("failed to request usb oc irq: %d\n", ret);
-       } else {
-               free_irq(gpio_to_irq(S3C64XX_GPL(10)), info);
-       }
-}
-
-static struct s3c2410_hcd_info smartq_usb_host_info = {
-       .port[0]        = {
-               .flags  = S3C_HCDFLG_USED
-       },
-       .port[1]        = {
-               .flags  = 0
-       },
-
-       .power_control  = smartq_usb_host_powercontrol,
-       .enable_oc      = smartq_usb_host_enableoc,
-};
-
-static struct gpiod_lookup_table smartq_usb_otg_vbus_gpiod_table = {
-       .dev_id = "gpio-vbus",
-       .table = {
-               GPIO_LOOKUP("GPL", 9, "vbus", GPIO_ACTIVE_LOW),
-               { },
-       },
-};
-
-static struct platform_device smartq_usb_otg_vbus_dev = {
-       .name                   = "gpio-vbus",
-};
-
-static struct pwm_lookup smartq_pwm_lookup[] = {
-       PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
-                  1000000000 / (1000 * 20), PWM_POLARITY_NORMAL),
-};
-
-static int smartq_bl_init(struct device *dev)
-{
-    s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
-
-    return 0;
-}
-
-static struct platform_pwm_backlight_data smartq_backlight_data = {
-       .max_brightness = 1000,
-       .dft_brightness = 600,
-       .init           = smartq_bl_init,
-};
-
-static struct platform_device smartq_backlight_device = {
-       .name           = "pwm-backlight",
-       .dev            = {
-               .parent = &samsung_device_pwm.dev,
-               .platform_data = &smartq_backlight_data,
-       },
-};
-
-static struct s3c2410_ts_mach_info smartq_touchscreen_pdata __initdata = {
-       .delay                  = 65535,
-       .presc                  = 99,
-       .oversampling_shift     = 4,
-};
-
-static struct s3c_sdhci_platdata smartq_internal_hsmmc_pdata = {
-       .max_width              = 4,
-       .cd_type                = S3C_SDHCI_CD_PERMANENT,
-};
-
-static struct s3c_hwmon_pdata smartq_hwmon_pdata __initdata = {
-       /* Battery voltage (?-4.2V) */
-       .in[0] = &(struct s3c_hwmon_chcfg) {
-               .name           = "smartq:battery-voltage",
-               .mult           = 3300,
-               .div            = 2048,
-       },
-       /* Reference voltage (1.2V) */
-       .in[1] = &(struct s3c_hwmon_chcfg) {
-               .name           = "smartq:reference-voltage",
-               .mult           = 3300,
-               .div            = 4096,
-       },
-};
-
-static struct dwc2_hsotg_plat smartq_hsotg_pdata;
-
-static int __init smartq_lcd_setup_gpio(void)
-{
-       int ret;
-
-       ret = gpio_request(S3C64XX_GPM(3), "LCD power");
-       if (ret < 0)
-               return ret;
-
-       /* turn power off */
-       gpio_direction_output(S3C64XX_GPM(3), 0);
-
-       return 0;
-}
-
-/* GPM0 -> CS */
-static struct spi_gpio_platform_data smartq_lcd_control = {
-       .num_chipselect = 1,
-};
-
-static struct platform_device smartq_lcd_control_device = {
-       .name                   = "spi_gpio",
-       .id                     = 1,
-       .dev.platform_data      = &smartq_lcd_control,
-};
-
-static struct gpiod_lookup_table smartq_lcd_control_gpiod_table = {
-       .dev_id         = "spi_gpio",
-       .table          = {
-               GPIO_LOOKUP("GPIOM", 1,
-                           "sck", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOM", 2,
-                           "mosi", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOM", 3,
-                           "miso", GPIO_ACTIVE_HIGH),
-               GPIO_LOOKUP("GPIOM", 0,
-                           "cs", GPIO_ACTIVE_HIGH),
-               { },
-       },
-};
-
-static void smartq_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
-{
-       gpio_direction_output(S3C64XX_GPM(3), power);
-}
-
-static struct plat_lcd_data smartq_lcd_power_data = {
-       .set_power      = smartq_lcd_power_set,
-};
-
-static struct platform_device smartq_lcd_power_device = {
-       .name                   = "platform-lcd",
-       .dev.parent             = &s3c_device_fb.dev,
-       .dev.platform_data      = &smartq_lcd_power_data,
-};
-
-static struct i2c_board_info smartq_i2c_devs[] __initdata = {
-       { I2C_BOARD_INFO("wm8987", 0x1a), },
-};
-
-static struct platform_device *smartq_devices[] __initdata = {
-       &s3c_device_hsmmc1,     /* Init iNAND first, ... */
-       &s3c_device_hsmmc0,     /* ... then the external SD card */
-       &s3c_device_hsmmc2,
-       &s3c_device_adc,
-       &s3c_device_fb,
-       &s3c_device_hwmon,
-       &s3c_device_i2c0,
-       &s3c_device_ohci,
-       &s3c_device_rtc,
-       &samsung_device_pwm,
-       &s3c_device_usb_hsotg,
-       &s3c64xx_device_iis0,
-       &smartq_backlight_device,
-       &smartq_lcd_control_device,
-       &smartq_lcd_power_device,
-       &smartq_usb_otg_vbus_dev,
-};
-
-static void __init smartq_lcd_mode_set(void)
-{
-       u32 tmp;
-
-       /* set the LCD type */
-       tmp = __raw_readl(S3C64XX_SPCON);
-       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
-       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
-       __raw_writel(tmp, S3C64XX_SPCON);
-
-       /* remove the LCD bypass */
-       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
-       tmp &= ~MIFPCON_LCD_BYPASS;
-       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
-}
-
-static void smartq_power_off(void)
-{
-       gpio_direction_output(S3C64XX_GPK(15), 1);
-}
-
-static int __init smartq_power_off_init(void)
-{
-       int ret;
-
-       ret = gpio_request(S3C64XX_GPK(15), "Power control");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPK15\n", __func__);
-               return ret;
-       }
-
-       /* leave power on */
-       gpio_direction_output(S3C64XX_GPK(15), 0);
-
-       pm_power_off = smartq_power_off;
-
-       return ret;
-}
-
-static int __init smartq_usb_host_init(void)
-{
-       int ret;
-
-       ret = gpio_request(S3C64XX_GPL(0), "USB power control");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPL0\n", __func__);
-               return ret;
-       }
-
-       ret = gpio_request(S3C64XX_GPL(1), "USB host power control");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPL1\n", __func__);
-               goto err;
-       }
-
-       if (!machine_is_smartq5()) {
-               /* This isn't present on a SmartQ 5 board */
-               ret = gpio_request(S3C64XX_GPL(10), "USB host overcurrent");
-               if (ret < 0) {
-                       pr_err("%s: failed to get GPL10\n", __func__);
-                       goto err2;
-               }
-       }
-
-       /* turn power off */
-       gpio_direction_output(S3C64XX_GPL(0), 0);
-       gpio_direction_output(S3C64XX_GPL(1), 0);
-       if (!machine_is_smartq5())
-               gpio_direction_input(S3C64XX_GPL(10));
-
-       s3c_device_ohci.dev.platform_data = &smartq_usb_host_info;
-
-       return 0;
-
-err2:
-       gpio_free(S3C64XX_GPL(1));
-err:
-       gpio_free(S3C64XX_GPL(0));
-       return ret;
-}
-
-static int __init smartq_wifi_init(void)
-{
-       int ret;
-
-       ret = gpio_request(S3C64XX_GPK(1), "wifi control");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPK1\n", __func__);
-               return ret;
-       }
-
-       ret = gpio_request(S3C64XX_GPK(2), "wifi reset");
-       if (ret < 0) {
-               pr_err("%s: failed to get GPK2\n", __func__);
-               gpio_free(S3C64XX_GPK(1));
-               return ret;
-       }
-
-       /* turn power on */
-       gpio_direction_output(S3C64XX_GPK(1), 1);
-
-       /* reset device */
-       gpio_direction_output(S3C64XX_GPK(2), 0);
-       mdelay(100);
-       gpio_set_value(S3C64XX_GPK(2), 1);
-       gpio_direction_input(S3C64XX_GPK(2));
-
-       return 0;
-}
-
-static struct map_desc smartq_iodesc[] __initdata = {};
-void __init smartq_map_io(void)
-{
-       s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
-       s3c64xx_set_xtal_freq(12000000);
-       s3c64xx_set_xusbxti_freq(12000000);
-       s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       smartq_lcd_mode_set();
-}
-
-static struct gpiod_lookup_table smartq_audio_gpios = {
-       .dev_id = "smartq-audio",
-       .table = {
-               GPIO_LOOKUP("GPL", 12, "headphone detect", 0),
-               GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", 0),
-               { },
-       },
-};
-
-void __init smartq_machine_init(void)
-{
-       s3c_i2c0_set_platdata(NULL);
-       dwc2_hsotg_set_platdata(&smartq_hsotg_pdata);
-       s3c_hwmon_set_platdata(&smartq_hwmon_pdata);
-       s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata);
-       s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata);
-       s3c64xx_ts_set_platdata(&smartq_touchscreen_pdata);
-
-       i2c_register_board_info(0, smartq_i2c_devs,
-                               ARRAY_SIZE(smartq_i2c_devs));
-
-       WARN_ON(smartq_lcd_setup_gpio());
-       WARN_ON(smartq_power_off_init());
-       WARN_ON(smartq_usb_host_init());
-       WARN_ON(smartq_wifi_init());
-
-       pwm_add_table(smartq_pwm_lookup, ARRAY_SIZE(smartq_pwm_lookup));
-       gpiod_add_lookup_table(&smartq_lcd_control_gpiod_table);
-       gpiod_add_lookup_table(&smartq_usb_otg_vbus_gpiod_table);
-       platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
-
-       gpiod_add_lookup_table(&smartq_audio_gpios);
-       platform_device_register_simple("smartq-audio", -1, NULL, 0);
-}
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.h b/arch/arm/mach-s3c64xx/mach-smartq.h
deleted file mode 100644 (file)
index f98132f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * linux/arch/arm/mach-s3c64xx/mach-smartq.h
- *
- * Copyright (C) 2010 Maurus Cuelenaere
- */
-
-#ifndef __MACH_SMARTQ_H
-#define __MACH_SMARTQ_H __FILE__
-
-#include <linux/init.h>
-
-extern void __init smartq_map_io(void);
-extern void __init smartq_machine_init(void);
-
-#endif /* __MACH_SMARTQ_H */
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
deleted file mode 100644 (file)
index 44e9edb..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2010 Maurus Cuelenaere
-
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/gpio_keys.h>
-#include <linux/init.h>
-#include <linux/input.h>
-#include <linux/leds.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#include <video/samsung_fimd.h>
-#include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "mach-smartq.h"
-
-static struct gpio_led smartq5_leds[] = {
-       {
-               .name                   = "smartq5:green",
-               .active_low             = 1,
-               .gpio                   = S3C64XX_GPN(8),
-       },
-       {
-               .name                   = "smartq5:red",
-               .active_low             = 1,
-               .gpio                   = S3C64XX_GPN(9),
-       },
-};
-
-static struct gpio_led_platform_data smartq5_led_data = {
-       .num_leds = ARRAY_SIZE(smartq5_leds),
-       .leds = smartq5_leds,
-};
-
-static struct platform_device smartq5_leds_device = {
-       .name                   = "leds-gpio",
-       .id                     = -1,
-       .dev.platform_data      = &smartq5_led_data,
-};
-
-/* Labels according to the SmartQ manual */
-static struct gpio_keys_button smartq5_buttons[] = {
-       {
-               .gpio                   = S3C64XX_GPL(14),
-               .code                   = KEY_POWER,
-               .desc                   = "Power",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(2),
-               .code                   = KEY_KPMINUS,
-               .desc                   = "Minus",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(12),
-               .code                   = KEY_KPPLUS,
-               .desc                   = "Plus",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(15),
-               .code                   = KEY_ENTER,
-               .desc                   = "Move",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-};
-
-static struct gpio_keys_platform_data smartq5_buttons_data  = {
-       .buttons        = smartq5_buttons,
-       .nbuttons       = ARRAY_SIZE(smartq5_buttons),
-};
-
-static struct platform_device smartq5_buttons_device  = {
-       .name           = "gpio-keys",
-       .id             = 0,
-       .num_resources  = 0,
-       .dev            = {
-               .platform_data  = &smartq5_buttons_data,
-       }
-};
-
-static struct s3c_fb_pd_win smartq5_fb_win0 = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct fb_videomode smartq5_lcd_timing = {
-       .left_margin    = 216,
-       .right_margin   = 40,
-       .upper_margin   = 35,
-       .lower_margin   = 10,
-       .hsync_len      = 1,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-       .refresh        = 80,
-};
-
-static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
-       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-       .vtiming        = &smartq5_lcd_timing,
-       .win[0]         = &smartq5_fb_win0,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
-                         VIDCON1_INV_VDEN,
-};
-
-static struct platform_device *smartq5_devices[] __initdata = {
-       &smartq5_leds_device,
-       &smartq5_buttons_device,
-};
-
-static void __init smartq5_machine_init(void)
-{
-       s3c_fb_set_platdata(&smartq5_lcd_pdata);
-
-       smartq_machine_init();
-
-       platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
-}
-
-MACHINE_START(SMARTQ5, "SmartQ 5")
-       /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = smartq_map_io,
-       .init_machine   = smartq5_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
deleted file mode 100644 (file)
index 815ee7d..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2010 Maurus Cuelenaere
-
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/gpio_keys.h>
-#include <linux/init.h>
-#include <linux/input.h>
-#include <linux/leds.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#include <video/samsung_fimd.h>
-#include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-#include "mach-smartq.h"
-
-static struct gpio_led smartq7_leds[] = {
-       {
-               .name                   = "smartq7:red",
-               .active_low             = 1,
-               .gpio                   = S3C64XX_GPN(8),
-       },
-       {
-               .name                   = "smartq7:green",
-               .active_low             = 1,
-               .gpio                   = S3C64XX_GPN(9),
-       },
-};
-
-static struct gpio_led_platform_data smartq7_led_data = {
-       .num_leds = ARRAY_SIZE(smartq7_leds),
-       .leds = smartq7_leds,
-};
-
-static struct platform_device smartq7_leds_device = {
-       .name                   = "leds-gpio",
-       .id                     = -1,
-       .dev.platform_data      = &smartq7_led_data,
-};
-
-/* Labels according to the SmartQ manual */
-static struct gpio_keys_button smartq7_buttons[] = {
-       {
-               .gpio                   = S3C64XX_GPL(14),
-               .code                   = KEY_POWER,
-               .desc                   = "Power",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(2),
-               .code                   = KEY_FN,
-               .desc                   = "Function",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(3),
-               .code                   = KEY_KPMINUS,
-               .desc                   = "Minus",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(4),
-               .code                   = KEY_KPPLUS,
-               .desc                   = "Plus",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(12),
-               .code                   = KEY_ENTER,
-               .desc                   = "Enter",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-       {
-               .gpio                   = S3C64XX_GPN(15),
-               .code                   = KEY_ESC,
-               .desc                   = "Cancel",
-               .active_low             = 1,
-               .debounce_interval      = 5,
-               .type                   = EV_KEY,
-       },
-};
-
-static struct gpio_keys_platform_data smartq7_buttons_data  = {
-       .buttons        = smartq7_buttons,
-       .nbuttons       = ARRAY_SIZE(smartq7_buttons),
-};
-
-static struct platform_device smartq7_buttons_device  = {
-       .name           = "gpio-keys",
-       .id             = 0,
-       .num_resources  = 0,
-       .dev            = {
-               .platform_data  = &smartq7_buttons_data,
-       }
-};
-
-static struct s3c_fb_pd_win smartq7_fb_win0 = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-static struct fb_videomode smartq7_lcd_timing = {
-       .left_margin    = 3,
-       .right_margin   = 5,
-       .upper_margin   = 1,
-       .lower_margin   = 20,
-       .hsync_len      = 10,
-       .vsync_len      = 3,
-       .xres           = 800,
-       .yres           = 480,
-       .refresh        = 80,
-};
-
-static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
-       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-       .vtiming        = &smartq7_lcd_timing,
-       .win[0]         = &smartq7_fb_win0,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
-                         VIDCON1_INV_VCLK,
-};
-
-static struct platform_device *smartq7_devices[] __initdata = {
-       &smartq7_leds_device,
-       &smartq7_buttons_device,
-};
-
-static void __init smartq7_machine_init(void)
-{
-       s3c_fb_set_platdata(&smartq7_lcd_pdata);
-
-       smartq_machine_init();
-
-       platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
-}
-
-MACHINE_START(SMARTQ7, "SmartQ 7")
-       /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = smartq_map_io,
-       .init_machine   = smartq7_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
deleted file mode 100644 (file)
index cbd1684..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/i2c.h>
-#include <linux/io.h>
-
-#include <asm/mach-types.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/irqs.h>
-#include <mach/hardware.h>
-#include <mach/map.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <mach/gpio-samsung.h>
-#include <plat/samsung-time.h>
-
-#include "common.h"
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg smdk6400_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = 0x3c5,
-               .ulcon       = 0x03,
-               .ufcon       = 0x51,
-       },
-};
-
-static struct map_desc smdk6400_iodesc[] = {};
-
-static void __init smdk6400_map_io(void)
-{
-       s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-}
-
-static struct platform_device *smdk6400_devices[] __initdata = {
-       &s3c_device_hsmmc1,
-       &s3c_device_i2c0,
-};
-
-static struct i2c_board_info i2c_devs[] __initdata = {
-       { I2C_BOARD_INFO("wm8753", 0x1A), },
-       { I2C_BOARD_INFO("24c08", 0x50), },
-};
-
-static void __init smdk6400_machine_init(void)
-{
-       i2c_register_board_info(0, i2c_devs, ARRAY_SIZE(i2c_devs));
-       platform_add_devices(smdk6400_devices, ARRAY_SIZE(smdk6400_devices));
-}
-
-MACHINE_START(SMDK6400, "SMDK6400")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6400_init_irq,
-       .map_io         = smdk6400_map_io,
-       .init_machine   = smdk6400_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
deleted file mode 100644 (file)
index 56f406c..0000000
+++ /dev/null
@@ -1,709 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/input.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/i2c.h>
-#include <linux/leds.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-#include <linux/smsc911x.h>
-#include <linux/regulator/fixed.h>
-#include <linux/regulator/machine.h>
-#include <linux/pwm.h>
-#include <linux/pwm_backlight.h>
-#include <linux/platform_data/s3c-hsotg.h>
-
-#ifdef CONFIG_SMDK6410_WM1190_EV1
-#include <linux/mfd/wm8350/core.h>
-#include <linux/mfd/wm8350/pmic.h>
-#endif
-
-#ifdef CONFIG_SMDK6410_WM1192_EV1
-#include <linux/mfd/wm831x/core.h>
-#include <linux/mfd/wm831x/pdata.h>
-#endif
-
-#include <video/platform_lcd.h>
-#include <video/samsung_fimd.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/irqs.h>
-#include <mach/map.h>
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/ata-samsung_cf.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-
-#include <plat/devs.h>
-#include <plat/cpu.h>
-#include <plat/adc.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/keypad.h>
-#include <plat/samsung-time.h>
-
-#include "backlight.h"
-#include "common.h"
-#include "regs-modem.h"
-#include "regs-srom.h"
-#include "regs-sys.h"
-
-#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
-#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
-#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
-
-static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
-       [0] = {
-               .hwport      = 0,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [1] = {
-               .hwport      = 1,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [2] = {
-               .hwport      = 2,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-       [3] = {
-               .hwport      = 3,
-               .flags       = 0,
-               .ucon        = UCON,
-               .ulcon       = ULCON,
-               .ufcon       = UFCON,
-       },
-};
-
-/* framebuffer and LCD setup. */
-
-/* GPF15 = LCD backlight control
- * GPF13 => Panel power
- * GPN5 = LCD nRESET signal
- * PWM_TOUT1 => backlight brightness
- */
-
-static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
-                                  unsigned int power)
-{
-       if (power) {
-               gpio_direction_output(S3C64XX_GPF(13), 1);
-
-               /* fire nRESET on power up */
-               gpio_direction_output(S3C64XX_GPN(5), 0);
-               msleep(10);
-               gpio_direction_output(S3C64XX_GPN(5), 1);
-               msleep(1);
-       } else {
-               gpio_direction_output(S3C64XX_GPF(13), 0);
-       }
-}
-
-static struct plat_lcd_data smdk6410_lcd_power_data = {
-       .set_power      = smdk6410_lcd_power_set,
-};
-
-static struct platform_device smdk6410_lcd_powerdev = {
-       .name                   = "platform-lcd",
-       .dev.parent             = &s3c_device_fb.dev,
-       .dev.platform_data      = &smdk6410_lcd_power_data,
-};
-
-static struct s3c_fb_pd_win smdk6410_fb_win0 = {
-       .max_bpp        = 32,
-       .default_bpp    = 16,
-       .xres           = 800,
-       .yres           = 480,
-       .virtual_y      = 480 * 2,
-       .virtual_x      = 800,
-};
-
-static struct fb_videomode smdk6410_lcd_timing = {
-       .left_margin    = 8,
-       .right_margin   = 13,
-       .upper_margin   = 7,
-       .lower_margin   = 5,
-       .hsync_len      = 3,
-       .vsync_len      = 1,
-       .xres           = 800,
-       .yres           = 480,
-};
-
-/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
-static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
-       .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
-       .vtiming        = &smdk6410_lcd_timing,
-       .win[0]         = &smdk6410_fb_win0,
-       .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
-       .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
-};
-
-/*
- * Configuring Ethernet on SMDK6410
- *
- * Both CS8900A and LAN9115 chips share one chip select mediated by CFG6.
- * The constant address below corresponds to nCS1
- *
- *  1) Set CFGB2 p3 ON others off, no other CFGB selects "ethernet"
- *  2) CFG6 needs to be switched to "LAN9115" side
- */
-
-static struct resource smdk6410_smsc911x_resources[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, SZ_64K),
-       [1] = DEFINE_RES_NAMED(S3C_EINT(10), 1, NULL, IORESOURCE_IRQ \
-                                       | IRQ_TYPE_LEVEL_LOW),
-};
-
-static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
-       .irq_polarity  = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-       .irq_type      = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
-       .flags         = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
-       .phy_interface = PHY_INTERFACE_MODE_MII,
-};
-
-
-static struct platform_device smdk6410_smsc911x = {
-       .name          = "smsc911x",
-       .id            = -1,
-       .num_resources = ARRAY_SIZE(smdk6410_smsc911x_resources),
-       .resource      = &smdk6410_smsc911x_resources[0],
-       .dev = {
-               .platform_data = &smdk6410_smsc911x_pdata,
-       },
-};
-
-#ifdef CONFIG_REGULATOR
-static struct regulator_consumer_supply smdk6410_b_pwr_5v_consumers[] = {
-       REGULATOR_SUPPLY("PVDD", "0-001b"),
-       REGULATOR_SUPPLY("AVDD", "0-001b"),
-};
-
-static struct regulator_init_data __maybe_unused smdk6410_b_pwr_5v_data = {
-       .constraints = {
-               .always_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(smdk6410_b_pwr_5v_consumers),
-       .consumer_supplies = smdk6410_b_pwr_5v_consumers,
-};
-
-static struct fixed_voltage_config smdk6410_b_pwr_5v_pdata = {
-       .supply_name = "B_PWR_5V",
-       .microvolts = 5000000,
-       .init_data = &smdk6410_b_pwr_5v_data,
-};
-
-static struct platform_device smdk6410_b_pwr_5v = {
-       .name          = "reg-fixed-voltage",
-       .id            = -1,
-       .dev = {
-               .platform_data = &smdk6410_b_pwr_5v_pdata,
-       },
-};
-#endif
-
-static struct s3c_ide_platdata smdk6410_ide_pdata __initdata = {
-       .setup_gpio     = s3c64xx_ide_setup_gpio,
-};
-
-static uint32_t smdk6410_keymap[] __initdata = {
-       /* KEY(row, col, keycode) */
-       KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
-       KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
-       KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
-       KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
-};
-
-static struct matrix_keymap_data smdk6410_keymap_data __initdata = {
-       .keymap         = smdk6410_keymap,
-       .keymap_size    = ARRAY_SIZE(smdk6410_keymap),
-};
-
-static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
-       .keymap_data    = &smdk6410_keymap_data,
-       .rows           = 2,
-       .cols           = 8,
-};
-
-static struct map_desc smdk6410_iodesc[] = {};
-
-static struct platform_device *smdk6410_devices[] __initdata = {
-#ifdef CONFIG_SMDK6410_SD_CH0
-       &s3c_device_hsmmc0,
-#endif
-#ifdef CONFIG_SMDK6410_SD_CH1
-       &s3c_device_hsmmc1,
-#endif
-       &s3c_device_i2c0,
-       &s3c_device_i2c1,
-       &s3c_device_fb,
-       &s3c_device_ohci,
-       &samsung_device_pwm,
-       &s3c_device_usb_hsotg,
-       &s3c64xx_device_iisv4,
-       &samsung_device_keypad,
-
-#ifdef CONFIG_REGULATOR
-       &smdk6410_b_pwr_5v,
-#endif
-       &smdk6410_lcd_powerdev,
-
-       &smdk6410_smsc911x,
-       &s3c_device_adc,
-       &s3c_device_cfcon,
-       &s3c_device_rtc,
-       &s3c_device_wdt,
-};
-
-#ifdef CONFIG_REGULATOR
-/* ARM core */
-static struct regulator_consumer_supply smdk6410_vddarm_consumers[] = {
-       REGULATOR_SUPPLY("vddarm", NULL),
-};
-
-/* VDDARM, BUCK1 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddarm = {
-       .constraints = {
-               .name = "PVDD_ARM",
-               .min_uV = 1000000,
-               .max_uV = 1300000,
-               .always_on = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(smdk6410_vddarm_consumers),
-       .consumer_supplies = smdk6410_vddarm_consumers,
-};
-
-/* VDD_INT, BUCK2 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddint = {
-       .constraints = {
-               .name = "PVDD_INT",
-               .min_uV = 1000000,
-               .max_uV = 1200000,
-               .always_on = 1,
-               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
-       },
-};
-
-/* VDD_HI, LDO3 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddhi = {
-       .constraints = {
-               .name = "PVDD_HI",
-               .always_on = 1,
-       },
-};
-
-/* VDD_PLL, LDO2 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddpll = {
-       .constraints = {
-               .name = "PVDD_PLL",
-               .always_on = 1,
-       },
-};
-
-/* VDD_UH_MMC, LDO5 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vdduh_mmc = {
-       .constraints = {
-               .name = "PVDD_UH+PVDD_MMC",
-               .always_on = 1,
-       },
-};
-
-/* VCCM3BT, LDO8 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vccmc3bt = {
-       .constraints = {
-               .name = "PVCCM3BT",
-               .always_on = 1,
-       },
-};
-
-/* VCCM2MTV, LDO11 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vccm2mtv = {
-       .constraints = {
-               .name = "PVCCM2MTV",
-               .always_on = 1,
-       },
-};
-
-/* VDD_LCD, LDO12 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddlcd = {
-       .constraints = {
-               .name = "PVDD_LCD",
-               .always_on = 1,
-       },
-};
-
-/* VDD_OTGI, LDO9 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddotgi = {
-       .constraints = {
-               .name = "PVDD_OTGI",
-               .always_on = 1,
-       },
-};
-
-/* VDD_OTG, LDO14 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddotg = {
-       .constraints = {
-               .name = "PVDD_OTG",
-               .always_on = 1,
-       },
-};
-
-/* VDD_ALIVE, LDO15 on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddalive = {
-       .constraints = {
-               .name = "PVDD_ALIVE",
-               .always_on = 1,
-       },
-};
-
-/* VDD_AUDIO, VLDO_AUDIO on J5 */
-static struct regulator_init_data __maybe_unused smdk6410_vddaudio = {
-       .constraints = {
-               .name = "PVDD_AUDIO",
-               .always_on = 1,
-       },
-};
-#endif
-
-#ifdef CONFIG_SMDK6410_WM1190_EV1
-/* S3C64xx internal logic & PLL */
-static struct regulator_init_data __maybe_unused wm8350_dcdc1_data = {
-       .constraints = {
-               .name = "PVDD_INT+PVDD_PLL",
-               .min_uV = 1200000,
-               .max_uV = 1200000,
-               .always_on = 1,
-               .apply_uV = 1,
-       },
-};
-
-/* Memory */
-static struct regulator_init_data __maybe_unused wm8350_dcdc3_data = {
-       .constraints = {
-               .name = "PVDD_MEM",
-               .min_uV = 1800000,
-               .max_uV = 1800000,
-               .always_on = 1,
-               .state_mem = {
-                        .uV = 1800000,
-                        .mode = REGULATOR_MODE_NORMAL,
-                        .enabled = 1,
-               },
-               .initial_state = PM_SUSPEND_MEM,
-       },
-};
-
-/* USB, EXT, PCM, ADC/DAC, USB, MMC */
-static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
-       REGULATOR_SUPPLY("DVDD", "0-001b"),
-};
-
-static struct regulator_init_data __maybe_unused wm8350_dcdc4_data = {
-       .constraints = {
-               .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
-               .min_uV = 3000000,
-               .max_uV = 3000000,
-               .always_on = 1,
-       },
-       .num_consumer_supplies = ARRAY_SIZE(wm8350_dcdc4_consumers),
-       .consumer_supplies = wm8350_dcdc4_consumers,
-};
-
-/* OTGi/1190-EV1 HPVDD & AVDD */
-static struct regulator_init_data __maybe_unused wm8350_ldo4_data = {
-       .constraints = {
-               .name = "PVDD_OTGI+HPVDD+AVDD",
-               .min_uV = 1200000,
-               .max_uV = 1200000,
-               .apply_uV = 1,
-               .always_on = 1,
-       },
-};
-
-static struct {
-       int regulator;
-       struct regulator_init_data *initdata;
-} wm1190_regulators[] = {
-       { WM8350_DCDC_1, &wm8350_dcdc1_data },
-       { WM8350_DCDC_3, &wm8350_dcdc3_data },
-       { WM8350_DCDC_4, &wm8350_dcdc4_data },
-       { WM8350_DCDC_6, &smdk6410_vddarm },
-       { WM8350_LDO_1, &smdk6410_vddalive },
-       { WM8350_LDO_2, &smdk6410_vddotg },
-       { WM8350_LDO_3, &smdk6410_vddlcd },
-       { WM8350_LDO_4, &wm8350_ldo4_data },
-};
-
-static int __init smdk6410_wm8350_init(struct wm8350 *wm8350)
-{
-       int i;
-
-       /* Configure the IRQ line */
-       s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
-
-       /* Instantiate the regulators */
-       for (i = 0; i < ARRAY_SIZE(wm1190_regulators); i++)
-               wm8350_register_regulator(wm8350,
-                                         wm1190_regulators[i].regulator,
-                                         wm1190_regulators[i].initdata);
-
-       return 0;
-}
-
-static struct wm8350_platform_data __initdata smdk6410_wm8350_pdata = {
-       .init = smdk6410_wm8350_init,
-       .irq_high = 1,
-       .irq_base = IRQ_BOARD_START,
-};
-#endif
-
-#ifdef CONFIG_SMDK6410_WM1192_EV1
-static struct gpio_led wm1192_pmic_leds[] = {
-       {
-               .name = "PMIC:red:power",
-               .gpio = GPIO_BOARD_START + 3,
-               .default_state = LEDS_GPIO_DEFSTATE_ON,
-       },
-};
-
-static struct gpio_led_platform_data wm1192_pmic_led = {
-       .num_leds = ARRAY_SIZE(wm1192_pmic_leds),
-       .leds = wm1192_pmic_leds,
-};
-
-static struct platform_device wm1192_pmic_led_dev = {
-       .name          = "leds-gpio",
-       .id            = -1,
-       .dev = {
-               .platform_data = &wm1192_pmic_led,
-       },
-};
-
-static int wm1192_pre_init(struct wm831x *wm831x)
-{
-       int ret;
-
-       /* Configure the IRQ line */
-       s3c_gpio_setpull(S3C64XX_GPN(12), S3C_GPIO_PULL_UP);
-
-       ret = platform_device_register(&wm1192_pmic_led_dev);
-       if (ret != 0)
-               dev_err(wm831x->dev, "Failed to add PMIC LED: %d\n", ret);
-
-       return 0;
-}
-
-static struct wm831x_backlight_pdata wm1192_backlight_pdata = {
-       .isink = 1,
-       .max_uA = 27554,
-};
-
-static struct regulator_init_data __maybe_unused wm1192_dcdc3 = {
-       .constraints = {
-               .name = "PVDD_MEM+PVDD_GPS",
-               .always_on = 1,
-       },
-};
-
-static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
-       REGULATOR_SUPPLY("DVDD", "0-001b"),   /* WM8580 */
-};
-
-static struct regulator_init_data __maybe_unused wm1192_ldo1 = {
-       .constraints = {
-               .name = "PVDD_LCD+PVDD_EXT",
-               .always_on = 1,
-       },
-       .consumer_supplies = wm1192_ldo1_consumers,
-       .num_consumer_supplies = ARRAY_SIZE(wm1192_ldo1_consumers),
-};
-
-static struct wm831x_status_pdata wm1192_led7_pdata = {
-       .name = "LED7:green:",
-};
-
-static struct wm831x_status_pdata wm1192_led8_pdata = {
-       .name = "LED8:green:",
-};
-
-static struct wm831x_pdata smdk6410_wm1192_pdata = {
-       .pre_init = wm1192_pre_init,
-
-       .backlight = &wm1192_backlight_pdata,
-       .dcdc = {
-               &smdk6410_vddarm,  /* DCDC1 */
-               &smdk6410_vddint,  /* DCDC2 */
-               &wm1192_dcdc3,
-       },
-       .gpio_base = GPIO_BOARD_START,
-       .ldo = {
-                &wm1192_ldo1,        /* LDO1 */
-                &smdk6410_vdduh_mmc, /* LDO2 */
-                NULL,                /* LDO3 NC */
-                &smdk6410_vddotgi,   /* LDO4 */
-                &smdk6410_vddotg,    /* LDO5 */
-                &smdk6410_vddhi,     /* LDO6 */
-                &smdk6410_vddaudio,  /* LDO7 */
-                &smdk6410_vccm2mtv,  /* LDO8 */
-                &smdk6410_vddpll,    /* LDO9 */
-                &smdk6410_vccmc3bt,  /* LDO10 */
-                &smdk6410_vddalive,  /* LDO11 */
-       },
-       .status = {
-               &wm1192_led7_pdata,
-               &wm1192_led8_pdata,
-       },
-};
-#endif
-
-static struct i2c_board_info i2c_devs0[] __initdata = {
-       { I2C_BOARD_INFO("24c08", 0x50), },
-       { I2C_BOARD_INFO("wm8580", 0x1b), },
-
-#ifdef CONFIG_SMDK6410_WM1192_EV1
-       { I2C_BOARD_INFO("wm8312", 0x34),
-         .platform_data = &smdk6410_wm1192_pdata,
-         .irq = S3C_EINT(12),
-       },
-#endif
-
-#ifdef CONFIG_SMDK6410_WM1190_EV1
-       { I2C_BOARD_INFO("wm8350", 0x1a),
-         .platform_data = &smdk6410_wm8350_pdata,
-         .irq = S3C_EINT(12),
-       },
-#endif
-};
-
-static struct i2c_board_info i2c_devs1[] __initdata = {
-       { I2C_BOARD_INFO("24c128", 0x57), },    /* Samsung S524AD0XD1 */
-};
-
-/* LCD Backlight data */
-static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
-       .no = S3C64XX_GPF(15),
-       .func = S3C_GPIO_SFN(2),
-};
-
-static struct pwm_lookup smdk6410_pwm_lookup[] = {
-       PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL, 78770,
-                  PWM_POLARITY_NORMAL),
-};
-
-static struct platform_pwm_backlight_data smdk6410_bl_data = {
-       /* Intentionally blank */
-};
-
-static struct dwc2_hsotg_plat smdk6410_hsotg_pdata;
-
-static void __init smdk6410_map_io(void)
-{
-       u32 tmp;
-
-       s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
-       s3c64xx_set_xtal_freq(12000000);
-       s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
-       samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
-
-       /* set the LCD type */
-
-       tmp = __raw_readl(S3C64XX_SPCON);
-       tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
-       tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
-       __raw_writel(tmp, S3C64XX_SPCON);
-
-       /* remove the lcd bypass */
-       tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
-       tmp &= ~MIFPCON_LCD_BYPASS;
-       __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
-}
-
-static void __init smdk6410_machine_init(void)
-{
-       u32 cs1;
-
-       s3c_i2c0_set_platdata(NULL);
-       s3c_i2c1_set_platdata(NULL);
-       s3c_fb_set_platdata(&smdk6410_lcd_pdata);
-       dwc2_hsotg_set_platdata(&smdk6410_hsotg_pdata);
-
-       samsung_keypad_set_platdata(&smdk6410_keypad_data);
-
-       s3c64xx_ts_set_platdata(NULL);
-
-       /* configure nCS1 width to 16 bits */
-
-       cs1 = __raw_readl(S3C64XX_SROM_BW) &
-                   ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
-       cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
-               (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
-               (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
-                                                  S3C64XX_SROM_BW__NCS1__SHIFT;
-       __raw_writel(cs1, S3C64XX_SROM_BW);
-
-       /* set timing for nCS1 suitable for ethernet chip */
-
-       __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
-                    (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
-                    (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
-                    (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
-                    (0xe << S3C64XX_SROM_BCX__TACC__SHIFT) |
-                    (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
-                    (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
-
-       gpio_request(S3C64XX_GPN(5), "LCD power");
-       gpio_request(S3C64XX_GPF(13), "LCD power");
-
-       i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
-       i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
-
-       s3c_ide_set_platdata(&smdk6410_ide_pdata);
-
-       platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
-
-       pwm_add_table(smdk6410_pwm_lookup, ARRAY_SIZE(smdk6410_pwm_lookup));
-       samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
-}
-
-MACHINE_START(SMDK6410, "SMDK6410")
-       /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .atag_offset    = 0x100,
-       .nr_irqs        = S3C64XX_NR_IRQS,
-       .init_irq       = s3c6410_init_irq,
-       .map_io         = smdk6410_map_io,
-       .init_machine   = smdk6410_machine_init,
-       .init_time      = samsung_timer_init,
-       .restart        = s3c64xx_restart,
-MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/onenand-core.h b/arch/arm/mach-s3c64xx/onenand-core.h
deleted file mode 100644 (file)
index 0cf6b5e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- *  Copyright (c) 2010 Samsung Electronics
- *  Kyungmin Park <kyungmin.park@samsung.com>
- *  Marek Szyprowski <m.szyprowski@samsung.com>
- *
- * Samsung OneNAD Controller core functions
- */
-
-#ifndef __ASM_ARCH_ONENAND_CORE_H
-#define __ASM_ARCH_ONENAND_CORE_H __FILE__
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
- */
-
-/* re-define device name depending on support. */
-static inline void s3c_onenand_setname(char *name)
-{
-#ifdef CONFIG_S3C_DEV_ONENAND
-       s3c_device_onenand.name = name;
-#endif
-}
-
-static inline void s3c64xx_onenand1_setname(char *name)
-{
-#ifdef CONFIG_S3C64XX_DEV_ONENAND1
-       s3c64xx_device_onenand1.name = name;
-#endif
-}
-
-#endif /* __ASM_ARCH_ONENAND_CORE_H */
diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c
deleted file mode 100644 (file)
index 152edbe..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Samsung's S3C64XX generic DMA support using amba-pl08x driver.
-//
-// Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
-
-#include <linux/kernel.h>
-#include <linux/amba/bus.h>
-#include <linux/amba/pl080.h>
-#include <linux/amba/pl08x.h>
-#include <linux/of.h>
-
-#include <plat/cpu.h>
-#include <mach/irqs.h>
-#include <mach/map.h>
-
-#include "regs-sys.h"
-
-static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd)
-{
-       return cd->min_signal;
-}
-
-static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch)
-{
-}
-
-/*
- * DMA0
- */
-
-static struct pl08x_channel_data s3c64xx_dma0_info[] = {
-       {
-               .bus_id = "uart0_tx",
-               .min_signal = 0,
-               .max_signal = 0,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart0_rx",
-               .min_signal = 1,
-               .max_signal = 1,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart1_tx",
-               .min_signal = 2,
-               .max_signal = 2,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart1_rx",
-               .min_signal = 3,
-               .max_signal = 3,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart2_tx",
-               .min_signal = 4,
-               .max_signal = 4,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart2_rx",
-               .min_signal = 5,
-               .max_signal = 5,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart3_tx",
-               .min_signal = 6,
-               .max_signal = 6,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "uart3_rx",
-               .min_signal = 7,
-               .max_signal = 7,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "pcm0_tx",
-               .min_signal = 8,
-               .max_signal = 8,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "pcm0_rx",
-               .min_signal = 9,
-               .max_signal = 9,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "i2s0_tx",
-               .min_signal = 10,
-               .max_signal = 10,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "i2s0_rx",
-               .min_signal = 11,
-               .max_signal = 11,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "spi0_tx",
-               .min_signal = 12,
-               .max_signal = 12,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "spi0_rx",
-               .min_signal = 13,
-               .max_signal = 13,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "i2s2_tx",
-               .min_signal = 14,
-               .max_signal = 14,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "i2s2_rx",
-               .min_signal = 15,
-               .max_signal = 15,
-               .periph_buses = PL08X_AHB2,
-       }
-};
-
-static const struct dma_slave_map s3c64xx_dma0_slave_map[] = {
-       { "s3c6400-uart.0", "tx", &s3c64xx_dma0_info[0] },
-       { "s3c6400-uart.0", "rx", &s3c64xx_dma0_info[1] },
-       { "s3c6400-uart.1", "tx", &s3c64xx_dma0_info[2] },
-       { "s3c6400-uart.1", "rx", &s3c64xx_dma0_info[3] },
-       { "s3c6400-uart.2", "tx", &s3c64xx_dma0_info[4] },
-       { "s3c6400-uart.2", "rx", &s3c64xx_dma0_info[5] },
-       { "s3c6400-uart.3", "tx", &s3c64xx_dma0_info[6] },
-       { "s3c6400-uart.3", "rx", &s3c64xx_dma0_info[7] },
-       { "samsung-pcm.0", "tx", &s3c64xx_dma0_info[8] },
-       { "samsung-pcm.0", "rx", &s3c64xx_dma0_info[9] },
-       { "samsung-i2s.0", "tx", &s3c64xx_dma0_info[10] },
-       { "samsung-i2s.0", "rx", &s3c64xx_dma0_info[11] },
-       { "s3c6410-spi.0", "tx", &s3c64xx_dma0_info[12] },
-       { "s3c6410-spi.0", "rx", &s3c64xx_dma0_info[13] },
-       { "samsung-i2s.2", "tx", &s3c64xx_dma0_info[14] },
-       { "samsung-i2s.2", "rx", &s3c64xx_dma0_info[15] },
-};
-
-struct pl08x_platform_data s3c64xx_dma0_plat_data = {
-       .memcpy_burst_size = PL08X_BURST_SZ_4,
-       .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
-       .memcpy_prot_buff = true,
-       .memcpy_prot_cache = true,
-       .lli_buses = PL08X_AHB1,
-       .mem_buses = PL08X_AHB1,
-       .get_xfer_signal = pl08x_get_xfer_signal,
-       .put_xfer_signal = pl08x_put_xfer_signal,
-       .slave_channels = s3c64xx_dma0_info,
-       .num_slave_channels = ARRAY_SIZE(s3c64xx_dma0_info),
-       .slave_map = s3c64xx_dma0_slave_map,
-       .slave_map_len = ARRAY_SIZE(s3c64xx_dma0_slave_map),
-};
-
-static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0,
-                       0x75000000, {IRQ_DMA0}, &s3c64xx_dma0_plat_data);
-
-/*
- * DMA1
- */
-
-static struct pl08x_channel_data s3c64xx_dma1_info[] = {
-       {
-               .bus_id = "pcm1_tx",
-               .min_signal = 0,
-               .max_signal = 0,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "pcm1_rx",
-               .min_signal = 1,
-               .max_signal = 1,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "i2s1_tx",
-               .min_signal = 2,
-               .max_signal = 2,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "i2s1_rx",
-               .min_signal = 3,
-               .max_signal = 3,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "spi1_tx",
-               .min_signal = 4,
-               .max_signal = 4,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "spi1_rx",
-               .min_signal = 5,
-               .max_signal = 5,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "ac97_out",
-               .min_signal = 6,
-               .max_signal = 6,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "ac97_in",
-               .min_signal = 7,
-               .max_signal = 7,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "ac97_mic",
-               .min_signal = 8,
-               .max_signal = 8,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "pwm",
-               .min_signal = 9,
-               .max_signal = 9,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "irda",
-               .min_signal = 10,
-               .max_signal = 10,
-               .periph_buses = PL08X_AHB2,
-       }, {
-               .bus_id = "external",
-               .min_signal = 11,
-               .max_signal = 11,
-               .periph_buses = PL08X_AHB2,
-       },
-};
-
-static const struct dma_slave_map s3c64xx_dma1_slave_map[] = {
-       { "samsung-pcm.1", "tx", &s3c64xx_dma1_info[0] },
-       { "samsung-pcm.1", "rx", &s3c64xx_dma1_info[1] },
-       { "samsung-i2s.1", "tx", &s3c64xx_dma1_info[2] },
-       { "samsung-i2s.1", "rx", &s3c64xx_dma1_info[3] },
-       { "s3c6410-spi.1", "tx", &s3c64xx_dma1_info[4] },
-       { "s3c6410-spi.1", "rx", &s3c64xx_dma1_info[5] },
-};
-
-struct pl08x_platform_data s3c64xx_dma1_plat_data = {
-       .memcpy_burst_size = PL08X_BURST_SZ_4,
-       .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
-       .memcpy_prot_buff = true,
-       .memcpy_prot_cache = true,
-       .lli_buses = PL08X_AHB1,
-       .mem_buses = PL08X_AHB1,
-       .get_xfer_signal = pl08x_get_xfer_signal,
-       .put_xfer_signal = pl08x_put_xfer_signal,
-       .slave_channels = s3c64xx_dma1_info,
-       .num_slave_channels = ARRAY_SIZE(s3c64xx_dma1_info),
-       .slave_map = s3c64xx_dma1_slave_map,
-       .slave_map_len = ARRAY_SIZE(s3c64xx_dma1_slave_map),
-};
-
-static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
-                       0x75100000, {IRQ_DMA1}, &s3c64xx_dma1_plat_data);
-
-static int __init s3c64xx_pl080_init(void)
-{
-       if (!soc_is_s3c64xx())
-               return 0;
-
-       /* Set all DMA configuration to be DMA, not SDMA */
-       writel(0xffffff, S3C64XX_SDMA_SEL);
-
-       if (of_have_populated_dt())
-               return 0;
-
-       amba_device_register(&s3c64xx_dma0_device, &iomem_resource);
-       amba_device_register(&s3c64xx_dma1_device, &iomem_resource);
-
-       return 0;
-}
-arch_initcall(s3c64xx_pl080_init);
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
deleted file mode 100644 (file)
index fd6dbb2..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// S3C64XX CPU PM support.
-
-#include <linux/init.h>
-#include <linux/suspend.h>
-#include <linux/serial_core.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-#include <linux/pm_domain.h>
-
-#include <mach/map.h>
-#include <mach/irqs.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/pm.h>
-#include <plat/wakeup-mask.h>
-
-#include <mach/regs-gpio.h>
-#include <mach/regs-clock.h>
-#include <mach/gpio-samsung.h>
-
-#include "regs-gpio-memport.h"
-#include "regs-modem.h"
-#include "regs-sys.h"
-#include "regs-syscon-power.h"
-
-struct s3c64xx_pm_domain {
-       char *const name;
-       u32 ena;
-       u32 pwr_stat;
-       struct generic_pm_domain pd;
-};
-
-static int s3c64xx_pd_off(struct generic_pm_domain *domain)
-{
-       struct s3c64xx_pm_domain *pd;
-       u32 val;
-
-       pd = container_of(domain, struct s3c64xx_pm_domain, pd);
-
-       val = __raw_readl(S3C64XX_NORMAL_CFG);
-       val &= ~(pd->ena);
-       __raw_writel(val, S3C64XX_NORMAL_CFG);
-
-       return 0;
-}
-
-static int s3c64xx_pd_on(struct generic_pm_domain *domain)
-{
-       struct s3c64xx_pm_domain *pd;
-       u32 val;
-       long retry = 1000000L;
-
-       pd = container_of(domain, struct s3c64xx_pm_domain, pd);
-
-       val = __raw_readl(S3C64XX_NORMAL_CFG);
-       val |= pd->ena;
-       __raw_writel(val, S3C64XX_NORMAL_CFG);
-
-       /* Not all domains provide power status readback */
-       if (pd->pwr_stat) {
-               do {
-                       cpu_relax();
-                       if (__raw_readl(S3C64XX_BLK_PWR_STAT) & pd->pwr_stat)
-                               break;
-               } while (retry--);
-
-               if (!retry) {
-                       pr_err("Failed to start domain %s\n", pd->name);
-                       return -EBUSY;
-               }
-       }
-
-       return 0;
-}
-
-static struct s3c64xx_pm_domain s3c64xx_pm_irom = {
-       .name = "IROM",
-       .ena = S3C64XX_NORMALCFG_IROM_ON,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_etm = {
-       .name = "ETM",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_ETM_ON,
-       .pwr_stat = S3C64XX_BLKPWRSTAT_ETM,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_s = {
-       .name = "S",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_S_ON,
-       .pwr_stat = S3C64XX_BLKPWRSTAT_S,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_f = {
-       .name = "F",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_F_ON,
-       .pwr_stat = S3C64XX_BLKPWRSTAT_F,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_p = {
-       .name = "P",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_P_ON,
-       .pwr_stat = S3C64XX_BLKPWRSTAT_P,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_i = {
-       .name = "I",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_I_ON,
-       .pwr_stat = S3C64XX_BLKPWRSTAT_I,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_g = {
-       .name = "G",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_G_ON,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain s3c64xx_pm_v = {
-       .name = "V",
-       .ena = S3C64XX_NORMALCFG_DOMAIN_V_ON,
-       .pwr_stat = S3C64XX_BLKPWRSTAT_V,
-       .pd = {
-               .power_off = s3c64xx_pd_off,
-               .power_on = s3c64xx_pd_on,
-       },
-};
-
-static struct s3c64xx_pm_domain *s3c64xx_always_on_pm_domains[] = {
-       &s3c64xx_pm_irom,
-};
-
-static struct s3c64xx_pm_domain *s3c64xx_pm_domains[] = {
-       &s3c64xx_pm_etm,
-       &s3c64xx_pm_g,
-       &s3c64xx_pm_v,
-       &s3c64xx_pm_i,
-       &s3c64xx_pm_p,
-       &s3c64xx_pm_s,
-       &s3c64xx_pm_f,
-};
-
-#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
-void s3c_pm_debug_smdkled(u32 set, u32 clear)
-{
-       unsigned long flags;
-       int i;
-
-       local_irq_save(flags);
-       for (i = 0; i < 4; i++) {
-               if (clear & (1 << i))
-                       gpio_set_value(S3C64XX_GPN(12 + i), 0);
-               if (set & (1 << i))
-                       gpio_set_value(S3C64XX_GPN(12 + i), 1);
-       }
-       local_irq_restore(flags);
-}
-#endif
-
-#ifdef CONFIG_PM_SLEEP
-static struct sleep_save core_save[] = {
-       SAVE_ITEM(S3C64XX_MEM0DRVCON),
-       SAVE_ITEM(S3C64XX_MEM1DRVCON),
-};
-
-static struct sleep_save misc_save[] = {
-       SAVE_ITEM(S3C64XX_AHB_CON0),
-       SAVE_ITEM(S3C64XX_AHB_CON1),
-       SAVE_ITEM(S3C64XX_AHB_CON2),
-       
-       SAVE_ITEM(S3C64XX_SPCON),
-
-       SAVE_ITEM(S3C64XX_MEM0CONSTOP),
-       SAVE_ITEM(S3C64XX_MEM1CONSTOP),
-       SAVE_ITEM(S3C64XX_MEM0CONSLP0),
-       SAVE_ITEM(S3C64XX_MEM0CONSLP1),
-       SAVE_ITEM(S3C64XX_MEM1CONSLP),
-
-       SAVE_ITEM(S3C64XX_SDMA_SEL),
-       SAVE_ITEM(S3C64XX_MODEM_MIFPCON),
-
-       SAVE_ITEM(S3C64XX_NORMAL_CFG),
-};
-
-void s3c_pm_configure_extint(void)
-{
-       __raw_writel(s3c_irqwake_eintmask, S3C64XX_EINT_MASK);
-}
-
-void s3c_pm_restore_core(void)
-{
-       __raw_writel(0, S3C64XX_EINT_MASK);
-
-       s3c_pm_debug_smdkled(1 << 2, 0);
-
-       s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
-       s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
-}
-
-void s3c_pm_save_core(void)
-{
-       s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
-       s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
-}
-#endif
-
-/* since both s3c6400 and s3c6410 share the same sleep pm calls, we
- * put the per-cpu code in here until any new cpu comes along and changes
- * this.
- */
-
-static int s3c64xx_cpu_suspend(unsigned long arg)
-{
-       unsigned long tmp;
-
-       /* set our standby method to sleep */
-
-       tmp = __raw_readl(S3C64XX_PWR_CFG);
-       tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
-       tmp |= S3C64XX_PWRCFG_CFG_WFI_SLEEP;
-       __raw_writel(tmp, S3C64XX_PWR_CFG);
-
-       /* clear any old wakeup */
-
-       __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT),
-                    S3C64XX_WAKEUP_STAT);
-
-       /* set the LED state to 0110 over sleep */
-       s3c_pm_debug_smdkled(3 << 1, 0xf);
-
-       /* issue the standby signal into the pm unit. Note, we
-        * issue a write-buffer drain just in case */
-
-       tmp = 0;
-
-       asm("b 1f\n\t"
-           ".align 5\n\t"
-           "1:\n\t"
-           "mcr p15, 0, %0, c7, c10, 5\n\t"
-           "mcr p15, 0, %0, c7, c10, 4\n\t"
-           "mcr p15, 0, %0, c7, c0, 4" :: "r" (tmp));
-
-       /* we should never get past here */
-
-       pr_info("Failed to suspend the system\n");
-       return 1; /* Aborting suspend */
-}
-
-/* mapping of interrupts to parts of the wakeup mask */
-static const struct samsung_wakeup_mask wake_irqs[] = {
-       { .irq = IRQ_RTC_ALARM, .bit = S3C64XX_PWRCFG_RTC_ALARM_DISABLE, },
-       { .irq = IRQ_RTC_TIC,   .bit = S3C64XX_PWRCFG_RTC_TICK_DISABLE, },
-       { .irq = IRQ_PENDN,     .bit = S3C64XX_PWRCFG_TS_DISABLE, },
-       { .irq = IRQ_HSMMC0,    .bit = S3C64XX_PWRCFG_MMC0_DISABLE, },
-       { .irq = IRQ_HSMMC1,    .bit = S3C64XX_PWRCFG_MMC1_DISABLE, },
-       { .irq = IRQ_HSMMC2,    .bit = S3C64XX_PWRCFG_MMC2_DISABLE, },
-       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_BATF_DISABLE},
-       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_MSM_DISABLE },
-       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_HSI_DISABLE },
-       { .irq = NO_WAKEUP_IRQ, .bit = S3C64XX_PWRCFG_MSM_DISABLE },
-};
-
-static void s3c64xx_pm_prepare(void)
-{
-       samsung_sync_wakemask(S3C64XX_PWR_CFG,
-                             wake_irqs, ARRAY_SIZE(wake_irqs));
-
-       /* store address of resume. */
-       __raw_writel(__pa_symbol(s3c_cpu_resume), S3C64XX_INFORM0);
-
-       /* ensure previous wakeup state is cleared before sleeping */
-       __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT);
-}
-
-int __init s3c64xx_pm_init(void)
-{
-       int i;
-
-       s3c_pm_init();
-
-       for (i = 0; i < ARRAY_SIZE(s3c64xx_always_on_pm_domains); i++)
-               pm_genpd_init(&s3c64xx_always_on_pm_domains[i]->pd,
-                             &pm_domain_always_on_gov, false);
-
-       for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++)
-               pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false);
-
-#ifdef CONFIG_S3C_DEV_FB
-       if (dev_get_platdata(&s3c_device_fb.dev))
-               pm_genpd_add_device(&s3c64xx_pm_f.pd, &s3c_device_fb.dev);
-#endif
-
-       return 0;
-}
-
-static __init int s3c64xx_pm_initcall(void)
-{
-       if (!soc_is_s3c64xx())
-               return 0;
-
-       pm_cpu_prep = s3c64xx_pm_prepare;
-       pm_cpu_sleep = s3c64xx_cpu_suspend;
-
-#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
-       gpio_request(S3C64XX_GPN(12), "DEBUG_LED0");
-       gpio_request(S3C64XX_GPN(13), "DEBUG_LED1");
-       gpio_request(S3C64XX_GPN(14), "DEBUG_LED2");
-       gpio_request(S3C64XX_GPN(15), "DEBUG_LED3");
-       gpio_direction_output(S3C64XX_GPN(12), 0);
-       gpio_direction_output(S3C64XX_GPN(13), 0);
-       gpio_direction_output(S3C64XX_GPN(14), 0);
-       gpio_direction_output(S3C64XX_GPN(15), 0);
-#endif
-
-       return 0;
-}
-arch_initcall(s3c64xx_pm_initcall);
diff --git a/arch/arm/mach-s3c64xx/regs-gpio-memport.h b/arch/arm/mach-s3c64xx/regs-gpio-memport.h
deleted file mode 100644 (file)
index 589afe1..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C64XX - GPIO memory port register definitions
- */
-
-#ifndef __MACH_S3C64XX_REGS_GPIO_MEMPORT_H
-#define __MACH_S3C64XX_REGS_GPIO_MEMPORT_H __FILE__
-
-#define S3C64XX_MEM0CONSTOP    S3C64XX_GPIOREG(0x1B0)
-#define S3C64XX_MEM1CONSTOP    S3C64XX_GPIOREG(0x1B4)
-
-#define S3C64XX_MEM0CONSLP0    S3C64XX_GPIOREG(0x1C0)
-#define S3C64XX_MEM0CONSLP1    S3C64XX_GPIOREG(0x1C4)
-#define S3C64XX_MEM1CONSLP     S3C64XX_GPIOREG(0x1C8)
-
-#define S3C64XX_MEM0DRVCON     S3C64XX_GPIOREG(0x1D0)
-#define S3C64XX_MEM1DRVCON     S3C64XX_GPIOREG(0x1D4)
-
-#endif /* __MACH_S3C64XX_REGS_GPIO_MEMPORT_H */
-
diff --git a/arch/arm/mach-s3c64xx/regs-modem.h b/arch/arm/mach-s3c64xx/regs-modem.h
deleted file mode 100644 (file)
index 136ad44..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      http://armlinux.simtec.co.uk/
- *      Ben Dooks <ben@simtec.co.uk>
- *
- * S3C64XX - modem block registers
- */
-
-#ifndef __MACH_S3C64XX_REGS_MODEM_H
-#define __MACH_S3C64XX_REGS_MODEM_H __FILE__
-
-#define S3C64XX_MODEMREG(x)                    (S3C64XX_VA_MODEM + (x))
-
-#define S3C64XX_MODEM_INT2AP                   S3C64XX_MODEMREG(0x0)
-#define S3C64XX_MODEM_INT2MODEM                        S3C64XX_MODEMREG(0x4)
-#define S3C64XX_MODEM_MIFCON                   S3C64XX_MODEMREG(0x8)
-#define S3C64XX_MODEM_MIFPCON                  S3C64XX_MODEMREG(0xC)
-#define S3C64XX_MODEM_INTCLR                   S3C64XX_MODEMREG(0x10)
-#define S3C64XX_MODEM_DMA_TXADDR               S3C64XX_MODEMREG(0x14)
-#define S3C64XX_MODEM_DMA_RXADDR               S3C64XX_MODEMREG(0x18)
-
-#define MIFPCON_INT2M_LEVEL                    (1 << 4)
-#define MIFPCON_LCD_BYPASS                     (1 << 3)
-
-#endif /* __MACH_S3C64XX_REGS_MODEM_H */
diff --git a/arch/arm/mach-s3c64xx/regs-srom.h b/arch/arm/mach-s3c64xx/regs-srom.h
deleted file mode 100644 (file)
index 2b37988..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2009 Andy Green <andy@warmcat.com>
- *
- * S3C64XX SROM definitions
- */
-
-#ifndef __MACH_S3C64XX_REGS_SROM_H
-#define __MACH_S3C64XX_REGS_SROM_H __FILE__
-
-#define S3C64XX_SROMREG(x)     (S3C_VA_MEM + (x))
-
-#define S3C64XX_SROM_BW                S3C64XX_SROMREG(0)
-#define S3C64XX_SROM_BC0       S3C64XX_SROMREG(4)
-#define S3C64XX_SROM_BC1       S3C64XX_SROMREG(8)
-#define S3C64XX_SROM_BC2       S3C64XX_SROMREG(0xc)
-#define S3C64XX_SROM_BC3       S3C64XX_SROMREG(0x10)
-#define S3C64XX_SROM_BC4       S3C64XX_SROMREG(0x14)
-#define S3C64XX_SROM_BC5       S3C64XX_SROMREG(0x18)
-
-/*
- * one register BW holds 5 x 4-bit packed settings for NCS0 - NCS4
- */
-
-#define S3C64XX_SROM_BW__DATAWIDTH__SHIFT      0
-#define S3C64XX_SROM_BW__WAITENABLE__SHIFT     2
-#define S3C64XX_SROM_BW__BYTEENABLE__SHIFT     3
-#define S3C64XX_SROM_BW__CS_MASK               0xf
-
-#define S3C64XX_SROM_BW__NCS0__SHIFT   0
-#define S3C64XX_SROM_BW__NCS1__SHIFT   4
-#define S3C64XX_SROM_BW__NCS2__SHIFT   8
-#define S3C64XX_SROM_BW__NCS3__SHIFT   0xc
-#define S3C64XX_SROM_BW__NCS4__SHIFT   0x10
-
-/*
- * applies to same to BCS0 - BCS4
- */
-
-#define S3C64XX_SROM_BCX__PMC__SHIFT   0
-#define S3C64XX_SROM_BCX__PMC__MASK    3
-#define S3C64XX_SROM_BCX__TACP__SHIFT  4
-#define S3C64XX_SROM_BCX__TACP__MASK   0xf
-#define S3C64XX_SROM_BCX__TCAH__SHIFT  8
-#define S3C64XX_SROM_BCX__TCAH__MASK   0xf
-#define S3C64XX_SROM_BCX__TCOH__SHIFT  12
-#define S3C64XX_SROM_BCX__TCOH__MASK   0xf
-#define S3C64XX_SROM_BCX__TACC__SHIFT  16
-#define S3C64XX_SROM_BCX__TACC__MASK   0x1f
-#define S3C64XX_SROM_BCX__TCOS__SHIFT  24
-#define S3C64XX_SROM_BCX__TCOS__MASK   0xf
-#define S3C64XX_SROM_BCX__TACS__SHIFT  28
-#define S3C64XX_SROM_BCX__TACS__MASK   0xf
-
-#endif /* __MACH_S3C64XX_REGS_SROM_H */
diff --git a/arch/arm/mach-s3c64xx/regs-sys.h b/arch/arm/mach-s3c64xx/regs-sys.h
deleted file mode 100644 (file)
index 3687325..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * S3C64XX system register definitions
-*/
-
-#ifndef __MACH_S3C64XX_REGS_SYS_H
-#define __MACH_S3C64XX_REGS_SYS_H __FILE__
-
-#define S3C_SYSREG(x)                  (S3C_VA_SYS + (x))
-
-#define S3C64XX_AHB_CON0               S3C_SYSREG(0x100)
-#define S3C64XX_AHB_CON1               S3C_SYSREG(0x104)
-#define S3C64XX_AHB_CON2               S3C_SYSREG(0x108)
-
-#define S3C64XX_SDMA_SEL               S3C_SYSREG(0x110)
-
-#define S3C64XX_OTHERS                 S3C_SYSREG(0x900)
-
-#define S3C64XX_OTHERS_USBMASK         (1 << 16)
-#define S3C64XX_OTHERS_SYNCMUXSEL      (1 << 6)
-
-#endif /* __MACH_S3C64XX_REGS_SYS_H */
diff --git a/arch/arm/mach-s3c64xx/regs-syscon-power.h b/arch/arm/mach-s3c64xx/regs-syscon-power.h
deleted file mode 100644 (file)
index a35811c..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      http://armlinux.simtec.co.uk/
- *      Ben Dooks <ben@simtec.co.uk>
- *
- * S3C64XX - syscon power and sleep control registers
-*/
-
-#ifndef __MACH_S3C64XX_REGS_SYSCON_POWER_H
-#define __MACH_S3C64XX_REGS_SYSCON_POWER_H __FILE__
-
-#define S3C64XX_PWR_CFG                                S3C_SYSREG(0x804)
-
-#define S3C64XX_PWRCFG_OSC_OTG_DISABLE         (1 << 17)
-#define S3C64XX_PWRCFG_MMC2_DISABLE            (1 << 16)
-#define S3C64XX_PWRCFG_MMC1_DISABLE            (1 << 15)
-#define S3C64XX_PWRCFG_MMC0_DISABLE            (1 << 14)
-#define S3C64XX_PWRCFG_HSI_DISABLE             (1 << 13)
-#define S3C64XX_PWRCFG_TS_DISABLE              (1 << 12)
-#define S3C64XX_PWRCFG_RTC_TICK_DISABLE                (1 << 11)
-#define S3C64XX_PWRCFG_RTC_ALARM_DISABLE       (1 << 10)
-#define S3C64XX_PWRCFG_MSM_DISABLE             (1 << 9)
-#define S3C64XX_PWRCFG_KEY_DISABLE             (1 << 8)
-#define S3C64XX_PWRCFG_BATF_DISABLE            (1 << 7)
-
-#define S3C64XX_PWRCFG_CFG_WFI_MASK            (0x3 << 5)
-#define S3C64XX_PWRCFG_CFG_WFI_SHIFT           (5)
-#define S3C64XX_PWRCFG_CFG_WFI_IGNORE          (0x0 << 5)
-#define S3C64XX_PWRCFG_CFG_WFI_IDLE            (0x1 << 5)
-#define S3C64XX_PWRCFG_CFG_WFI_STOP            (0x2 << 5)
-#define S3C64XX_PWRCFG_CFG_WFI_SLEEP           (0x3 << 5)
-
-#define S3C64XX_PWRCFG_CFG_BATFLT_MASK         (0x3 << 3)
-#define S3C64XX_PWRCFG_CFG_BATFLT_SHIFT                (3)
-#define S3C64XX_PWRCFG_CFG_BATFLT_IGNORE       (0x0 << 3)
-#define S3C64XX_PWRCFG_CFG_BATFLT_IRQ          (0x1 << 3)
-#define S3C64XX_PWRCFG_CFG_BATFLT_SLEEP                (0x3 << 3)
-
-#define S3C64XX_PWRCFG_CFG_BAT_WAKE            (1 << 2)
-#define S3C64XX_PWRCFG_OSC27_EN                        (1 << 0)
-
-#define S3C64XX_EINT_MASK                      S3C_SYSREG(0x808)
-
-#define S3C64XX_NORMAL_CFG                     S3C_SYSREG(0x810)
-
-#define S3C64XX_NORMALCFG_IROM_ON              (1 << 30)
-#define S3C64XX_NORMALCFG_DOMAIN_ETM_ON                (1 << 16)
-#define S3C64XX_NORMALCFG_DOMAIN_S_ON          (1 << 15)
-#define S3C64XX_NORMALCFG_DOMAIN_F_ON          (1 << 14)
-#define S3C64XX_NORMALCFG_DOMAIN_P_ON          (1 << 13)
-#define S3C64XX_NORMALCFG_DOMAIN_I_ON          (1 << 12)
-#define S3C64XX_NORMALCFG_DOMAIN_G_ON          (1 << 10)
-#define S3C64XX_NORMALCFG_DOMAIN_V_ON          (1 << 9)
-
-#define S3C64XX_STOP_CFG                       S3C_SYSREG(0x814)
-
-#define S3C64XX_STOPCFG_MEMORY_ARM_ON          (1 << 29)
-#define S3C64XX_STOPCFG_TOP_MEMORY_ON          (1 << 20)
-#define S3C64XX_STOPCFG_ARM_LOGIC_ON           (1 << 17)
-#define S3C64XX_STOPCFG_TOP_LOGIC_ON           (1 << 8)
-#define S3C64XX_STOPCFG_OSC_EN                 (1 << 0)
-
-#define S3C64XX_SLEEP_CFG                      S3C_SYSREG(0x818)
-
-#define S3C64XX_SLEEPCFG_OSC_EN                        (1 << 0)
-
-#define S3C64XX_STOP_MEM_CFG                   S3C_SYSREG(0x81c)
-
-#define S3C64XX_STOPMEMCFG_MODEMIF_RETAIN      (1 << 6)
-#define S3C64XX_STOPMEMCFG_HOSTIF_RETAIN       (1 << 5)
-#define S3C64XX_STOPMEMCFG_OTG_RETAIN          (1 << 4)
-#define S3C64XX_STOPMEMCFG_HSMCC_RETAIN                (1 << 3)
-#define S3C64XX_STOPMEMCFG_IROM_RETAIN         (1 << 2)
-#define S3C64XX_STOPMEMCFG_IRDA_RETAIN         (1 << 1)
-#define S3C64XX_STOPMEMCFG_NFCON_RETAIN                (1 << 0)
-
-#define S3C64XX_OSC_STABLE                     S3C_SYSREG(0x824)
-#define S3C64XX_PWR_STABLE                     S3C_SYSREG(0x828)
-
-#define S3C64XX_WAKEUP_STAT                    S3C_SYSREG(0x908)
-
-#define S3C64XX_WAKEUPSTAT_MMC2                        (1 << 11)
-#define S3C64XX_WAKEUPSTAT_MMC1                        (1 << 10)
-#define S3C64XX_WAKEUPSTAT_MMC0                        (1 << 9)
-#define S3C64XX_WAKEUPSTAT_HSI                 (1 << 8)
-#define S3C64XX_WAKEUPSTAT_BATFLT              (1 << 6)
-#define S3C64XX_WAKEUPSTAT_MSM                 (1 << 5)
-#define S3C64XX_WAKEUPSTAT_KEY                 (1 << 4)
-#define S3C64XX_WAKEUPSTAT_TS                  (1 << 3)
-#define S3C64XX_WAKEUPSTAT_RTC_TICK            (1 << 2)
-#define S3C64XX_WAKEUPSTAT_RTC_ALARM           (1 << 1)
-#define S3C64XX_WAKEUPSTAT_EINT                        (1 << 0)
-
-#define S3C64XX_BLK_PWR_STAT                   S3C_SYSREG(0x90c)
-
-#define S3C64XX_BLKPWRSTAT_G                   (1 << 7)
-#define S3C64XX_BLKPWRSTAT_ETM                 (1 << 6)
-#define S3C64XX_BLKPWRSTAT_S                   (1 << 5)
-#define S3C64XX_BLKPWRSTAT_F                   (1 << 4)
-#define S3C64XX_BLKPWRSTAT_P                   (1 << 3)
-#define S3C64XX_BLKPWRSTAT_I                   (1 << 2)
-#define S3C64XX_BLKPWRSTAT_V                   (1 << 1)
-#define S3C64XX_BLKPWRSTAT_TOP                 (1 << 0)
-
-#define S3C64XX_INFORM0                                S3C_SYSREG(0xA00)
-#define S3C64XX_INFORM1                                S3C_SYSREG(0xA04)
-#define S3C64XX_INFORM2                                S3C_SYSREG(0xA08)
-#define S3C64XX_INFORM3                                S3C_SYSREG(0xA0C)
-
-#endif /* __MACH_S3C64XX_REGS_SYSCON_POWER_H */
diff --git a/arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h b/arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h
deleted file mode 100644 (file)
index deb1dd2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      http://armlinux.simtec.co.uk/
- *      Ben Dooks <ben@simtec.co.uk>
- *
- * S3C - USB2.0 Highspeed/OtG device PHY registers
-*/
-
-/* Note, this is a separate header file as some of the clock framework
- * needs to touch this if the clk_48m is used as the USB OHCI or other
- * peripheral source.
-*/
-
-#ifndef __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H
-#define __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H __FILE__
-
-/* S3C64XX_PA_USB_HSPHY */
-
-#define S3C_HSOTG_PHYREG(x)    ((x) + S3C_VA_USB_HSPHY)
-
-#define S3C_PHYPWR                             S3C_HSOTG_PHYREG(0x00)
-#define S3C_PHYPWR_NORMAL_MASK                 (0x19 << 0)
-#define S3C_PHYPWR_OTG_DISABLE                 (1 << 4)
-#define S3C_PHYPWR_ANALOG_POWERDOWN            (1 << 3)
-#define SRC_PHYPWR_FORCE_SUSPEND               (1 << 1)
-
-#define S3C_PHYCLK                             S3C_HSOTG_PHYREG(0x04)
-#define S3C_PHYCLK_MODE_USB11                  (1 << 6)
-#define S3C_PHYCLK_EXT_OSC                     (1 << 5)
-#define S3C_PHYCLK_CLK_FORCE                   (1 << 4)
-#define S3C_PHYCLK_ID_PULL                     (1 << 2)
-#define S3C_PHYCLK_CLKSEL_MASK                 (0x3 << 0)
-#define S3C_PHYCLK_CLKSEL_SHIFT                        (0)
-#define S3C_PHYCLK_CLKSEL_48M                  (0x0 << 0)
-#define S3C_PHYCLK_CLKSEL_12M                  (0x2 << 0)
-#define S3C_PHYCLK_CLKSEL_24M                  (0x3 << 0)
-
-#define S3C_RSTCON                             S3C_HSOTG_PHYREG(0x08)
-#define S3C_RSTCON_PHYCLK                      (1 << 2)
-#define S3C_RSTCON_HCLK                                (1 << 1)
-#define S3C_RSTCON_PHY                         (1 << 0)
-
-#define S3C_PHYTUNE                            S3C_HSOTG_PHYREG(0x20)
-
-#endif /* __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H */
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
deleted file mode 100644 (file)
index 545eea7..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2009 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-
-/*
- * NOTE: Code in this file is not used when booting with Device Tree support.
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-
-#include <plat/cpu-freq.h>
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/sdhci.h>
-#include <plat/iic-core.h>
-
-#include "common.h"
-#include "onenand-core.h"
-
-void __init s3c6400_map_io(void)
-{
-       /* setup SDHCI */
-
-       s3c6400_default_sdhci0();
-       s3c6400_default_sdhci1();
-       s3c6400_default_sdhci2();
-
-       /* the i2c devices are directly compatible with s3c2440 */
-       s3c_i2c0_setname("s3c2440-i2c");
-
-       s3c_device_nand.name = "s3c6400-nand";
-
-       s3c_onenand_setname("s3c6400-onenand");
-       s3c64xx_onenand1_setname("s3c6400-onenand");
-}
-
-void __init s3c6400_init_irq(void)
-{
-       /* VIC0 does not have IRQS 5..7,
-        * VIC1 is fully populated. */
-       s3c64xx_init_irq(~0 & ~(0xf << 5), ~0);
-}
-
-static struct bus_type s3c6400_subsys = {
-       .name           = "s3c6400-core",
-       .dev_name       = "s3c6400-core",
-};
-
-static struct device s3c6400_dev = {
-       .bus    = &s3c6400_subsys,
-};
-
-static int __init s3c6400_core_init(void)
-{
-       /* Not applicable when using DT. */
-       if (of_have_populated_dt() || soc_is_s3c64xx())
-               return 0;
-
-       return subsys_system_register(&s3c6400_subsys, NULL);
-}
-
-core_initcall(s3c6400_core_init);
-
-int __init s3c6400_init(void)
-{
-       printk("S3C6400: Initialising architecture\n");
-
-       return device_register(&s3c6400_dev);
-}
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
deleted file mode 100644 (file)
index 47e04e0..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Simtec Electronics
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-
-/*
- * NOTE: Code in this file is not used when booting with Device Tree support.
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/device.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-
-#include <plat/cpu-freq.h>
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/sdhci.h>
-#include <plat/adc-core.h>
-#include <plat/iic-core.h>
-
-#include "ata-core.h"
-#include "common.h"
-#include "onenand-core.h"
-
-void __init s3c6410_map_io(void)
-{
-       /* initialise device information early */
-       s3c6410_default_sdhci0();
-       s3c6410_default_sdhci1();
-       s3c6410_default_sdhci2();
-
-       /* the i2c devices are directly compatible with s3c2440 */
-       s3c_i2c0_setname("s3c2440-i2c");
-       s3c_i2c1_setname("s3c2440-i2c");
-
-       s3c_adc_setname("s3c64xx-adc");
-       s3c_device_nand.name = "s3c6400-nand";
-       s3c_onenand_setname("s3c6410-onenand");
-       s3c64xx_onenand1_setname("s3c6410-onenand");
-       s3c_cfcon_setname("s3c64xx-pata");
-}
-
-void __init s3c6410_init_irq(void)
-{
-       /* VIC0 is missing IRQ7, VIC1 is fully populated. */
-       s3c64xx_init_irq(~0 & ~(1 << 7), ~0);
-}
-
-struct bus_type s3c6410_subsys = {
-       .name           = "s3c6410-core",
-       .dev_name       = "s3c6410-core",
-};
-
-static struct device s3c6410_dev = {
-       .bus    = &s3c6410_subsys,
-};
-
-static int __init s3c6410_core_init(void)
-{
-       /* Not applicable when using DT. */
-       if (of_have_populated_dt() || !soc_is_s3c64xx())
-               return 0;
-
-       return subsys_system_register(&s3c6410_subsys, NULL);
-}
-
-core_initcall(s3c6410_core_init);
-
-int __init s3c6410_init(void)
-{
-       printk("S3C6410: Initialising architecture\n");
-
-       return device_register(&s3c6410_dev);
-}
diff --git a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
deleted file mode 100644 (file)
index 2c7178b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Base S3C64XX setup information for 24bpp LCD framebuffer
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-
-#include <plat/fb.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-void s3c64xx_fb_gpio_setup_24bpp(void)
-{
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2));
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2));
-}
diff --git a/arch/arm/mach-s3c64xx/setup-i2c0.c b/arch/arm/mach-s3c64xx/setup-i2c0.c
deleted file mode 100644 (file)
index 552eb50..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Base S3C64XX I2C bus 0 gpio configuration
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/gpio.h>
-
-struct platform_device; /* don't need the contents */
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-void s3c_i2c0_cfg_gpio(struct platform_device *dev)
-{
-       s3c_gpio_cfgall_range(S3C64XX_GPB(5), 2,
-                             S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-}
diff --git a/arch/arm/mach-s3c64xx/setup-i2c1.c b/arch/arm/mach-s3c64xx/setup-i2c1.c
deleted file mode 100644 (file)
index d231f0f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Base S3C64XX I2C bus 1 gpio configuration
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/gpio.h>
-
-struct platform_device; /* don't need the contents */
-
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-void s3c_i2c1_cfg_gpio(struct platform_device *dev)
-{
-       s3c_gpio_cfgall_range(S3C64XX_GPB(2), 2,
-                             S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
-}
diff --git a/arch/arm/mach-s3c64xx/setup-ide.c b/arch/arm/mach-s3c64xx/setup-ide.c
deleted file mode 100644 (file)
index 810139a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2010 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com/
-//
-// S3C64XX setup information for IDE
-
-#include <linux/kernel.h>
-#include <linux/gpio.h>
-#include <linux/io.h>
-
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-#include <linux/platform_data/ata-samsung_cf.h>
-
-void s3c64xx_ide_setup_gpio(void)
-{
-       u32 reg;
-
-       reg = readl(S3C_MEM_SYS_CFG) & (~0x3f);
-
-       /* Independent CF interface, CF chip select configuration */
-       writel(reg | MEM_SYS_CFG_INDEP_CF |
-               MEM_SYS_CFG_EBI_FIX_PRI_CFCON, S3C_MEM_SYS_CFG);
-
-       s3c_gpio_cfgpin(S3C64XX_GPB(4), S3C_GPIO_SFN(4));
-
-       /* Set XhiDATA[15:0] pins as CF Data[15:0] */
-       s3c_gpio_cfgpin_range(S3C64XX_GPK(0), 16, S3C_GPIO_SFN(5));
-
-       /* Set XhiADDR[2:0] pins as CF ADDR[2:0] */
-       s3c_gpio_cfgpin_range(S3C64XX_GPL(0), 3, S3C_GPIO_SFN(6));
-
-       /* Set Xhi ctrl pins as CF ctrl pins(IORDY, IOWR, IORD, CE[0:1]) */
-       s3c_gpio_cfgpin(S3C64XX_GPM(5), S3C_GPIO_SFN(1));
-       s3c_gpio_cfgpin_range(S3C64XX_GPM(0), 5, S3C_GPIO_SFN(6));
-}
diff --git a/arch/arm/mach-s3c64xx/setup-keypad.c b/arch/arm/mach-s3c64xx/setup-keypad.c
deleted file mode 100644 (file)
index 3519610..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2010 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com/
-//
-// GPIO configuration for S3C64XX KeyPad device
-
-#include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <plat/keypad.h>
-#include <mach/gpio-samsung.h>
-
-void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
-{
-       /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), rows, S3C_GPIO_SFN(3));
-
-       /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3));
-}
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
deleted file mode 100644 (file)
index 138455a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// S3C64XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-
-#include <plat/gpio-cfg.h>
-#include <plat/sdhci.h>
-#include <mach/gpio-samsung.h>
-
-void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
-{
-       struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
-
-       /* Set all the necessary GPG pins to special-function 2 */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
-
-       if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
-               s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
-               s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
-       }
-}
-
-void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
-{
-       struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
-
-       /* Set all the necessary GPH pins to special-function 2 */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPH(0), 2 + width, S3C_GPIO_SFN(2));
-
-       if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
-               s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
-               s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
-       }
-}
-
-void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
-{
-       /* Set all the necessary GPH pins to special-function 3 */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPH(6), width, S3C_GPIO_SFN(3));
-
-       /* Set all the necessary GPC pins to special-function 3 */
-       s3c_gpio_cfgrange_nopull(S3C64XX_GPC(4), 2, S3C_GPIO_SFN(3));
-}
diff --git a/arch/arm/mach-s3c64xx/setup-spi.c b/arch/arm/mach-s3c64xx/setup-spi.c
deleted file mode 100644 (file)
index 39dfae1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2011 Samsung Electronics Ltd.
-//             http://www.samsung.com/
-
-#include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-#ifdef CONFIG_S3C64XX_DEV_SPI0
-int s3c64xx_spi0_cfg_gpio(void)
-{
-       s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3,
-                               S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-       return 0;
-}
-#endif
-
-#ifdef CONFIG_S3C64XX_DEV_SPI1
-int s3c64xx_spi1_cfg_gpio(void)
-{
-       s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3,
-                               S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-       return 0;
-}
-#endif
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c
deleted file mode 100644 (file)
index d6b0e3b..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (C) 2011 Samsung Electronics Co.Ltd
-// Author: Joonyoung Shim <jy0922.shim@samsung.com>
-
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <mach/map.h>
-#include <plat/cpu.h>
-#include <plat/usb-phy.h>
-
-#include "regs-sys.h"
-#include "regs-usb-hsotg-phy.h"
-
-enum samsung_usb_phy_type {
-       USB_PHY_TYPE_DEVICE,
-       USB_PHY_TYPE_HOST,
-};
-
-static int s3c_usb_otgphy_init(struct platform_device *pdev)
-{
-       struct clk *xusbxti;
-       u32 phyclk;
-
-       writel(readl(S3C64XX_OTHERS) | S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
-
-       /* set clock frequency for PLL */
-       phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK;
-
-       xusbxti = clk_get(&pdev->dev, "xusbxti");
-       if (xusbxti && !IS_ERR(xusbxti)) {
-               switch (clk_get_rate(xusbxti)) {
-               case 12 * MHZ:
-                       phyclk |= S3C_PHYCLK_CLKSEL_12M;
-                       break;
-               case 24 * MHZ:
-                       phyclk |= S3C_PHYCLK_CLKSEL_24M;
-                       break;
-               default:
-               case 48 * MHZ:
-                       /* default reference clock */
-                       break;
-               }
-               clk_put(xusbxti);
-       }
-
-       /* TODO: select external clock/oscillator */
-       writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK);
-
-       /* set to normal OTG PHY */
-       writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR);
-       mdelay(1);
-
-       /* reset OTG PHY and Link */
-       writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK,
-                       S3C_RSTCON);
-       udelay(20);     /* at-least 10uS */
-       writel(0, S3C_RSTCON);
-
-       return 0;
-}
-
-static int s3c_usb_otgphy_exit(struct platform_device *pdev)
-{
-       writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN |
-                               S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR);
-
-       writel(readl(S3C64XX_OTHERS) & ~S3C64XX_OTHERS_USBMASK, S3C64XX_OTHERS);
-
-       return 0;
-}
-
-int s3c_usb_phy_init(struct platform_device *pdev, int type)
-{
-       if (type == USB_PHY_TYPE_DEVICE)
-               return s3c_usb_otgphy_init(pdev);
-
-       return -EINVAL;
-}
-
-int s3c_usb_phy_exit(struct platform_device *pdev, int type)
-{
-       if (type == USB_PHY_TYPE_DEVICE)
-               return s3c_usb_otgphy_exit(pdev);
-
-       return -EINVAL;
-}
diff --git a/arch/arm/mach-s3c64xx/sleep.S b/arch/arm/mach-s3c64xx/sleep.S
deleted file mode 100644 (file)
index 39e16a0..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/arch/arm/plat-s3c64xx/sleep.S
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * S3C64XX CPU sleep code
- */
-
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <mach/map.h>
-
-#undef S3C64XX_VA_GPIO
-#define S3C64XX_VA_GPIO (0x0)
-
-#include <mach/regs-gpio.h>
-
-#define LL_UART (S3C_PA_UART + (0x400 * CONFIG_S3C_LOWLEVEL_UART_PORT))
-
-       .text
-
-       /* Sleep magic, the word before the resume entry point so that the
-        * bootloader can check for a resumeable image. */
-
-       .word   0x2bedf00d
-
-       /* s3c_cpu_reusme
-        *
-        * This is the entry point, stored by whatever method the bootloader
-        * requires to get the kernel runnign again. This code expects to be
-        * entered with no caches live and the MMU disabled. It will then
-        * restore the MMU and other basic CP registers saved and restart
-        * the kernel C code to finish the resume code.
-       */
-
-ENTRY(s3c_cpu_resume)
-       msr     cpsr_c, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
-       ldr     r2, =LL_UART            /* for debug */
-
-#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
-
-#define S3C64XX_GPNCON                 (S3C64XX_GPN_BASE + 0x00)
-#define S3C64XX_GPNDAT                 (S3C64XX_GPN_BASE + 0x04)
-
-#define S3C64XX_GPN_CONMASK(__gpio)    (0x3 << ((__gpio) * 2))
-#define S3C64XX_GPN_OUTPUT(__gpio)     (0x1 << ((__gpio) * 2))
-
-       /* Initialise the GPIO state if we are debugging via the SMDK LEDs,
-        * as the uboot version supplied resets these to inputs during the
-        * resume checks.
-       */
-
-       ldr     r3, =S3C64XX_PA_GPIO
-       ldr     r0, [ r3, #S3C64XX_GPNCON ]
-       bic     r0, r0, #(S3C64XX_GPN_CONMASK(12) | S3C64XX_GPN_CONMASK(13) | \
-                         S3C64XX_GPN_CONMASK(14) | S3C64XX_GPN_CONMASK(15))
-       orr     r0, r0, #(S3C64XX_GPN_OUTPUT(12) | S3C64XX_GPN_OUTPUT(13) | \
-                         S3C64XX_GPN_OUTPUT(14) | S3C64XX_GPN_OUTPUT(15))
-       str     r0, [ r3, #S3C64XX_GPNCON ]
-
-       ldr     r0, [ r3, #S3C64XX_GPNDAT ]
-       bic     r0, r0, #0xf << 12                      @ GPN12..15
-       orr     r0, r0, #1 << 15                        @ GPN15
-       str     r0, [ r3, #S3C64XX_GPNDAT ]
-#endif
-       b       cpu_resume
diff --git a/arch/arm/mach-s3c64xx/watchdog-reset.h b/arch/arm/mach-s3c64xx/watchdog-reset.h
deleted file mode 100644 (file)
index 1042d6c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - System define for arch_reset() function
- */
-
-#ifndef __PLAT_SAMSUNG_WATCHDOG_RESET_H
-#define __PLAT_SAMSUNG_WATCHDOG_RESET_H
-
-extern void samsung_wdt_reset(void);
-extern void samsung_wdt_reset_of_init(void);
-extern void samsung_wdt_reset_init(void __iomem *base);
-
-#endif /* __PLAT_SAMSUNG_WATCHDOG_RESET_H */
index 03984a7..95d4e82 100644 (file)
@@ -14,10 +14,10 @@ config ARCH_S5PV210
        select COMMON_CLK_SAMSUNG
        select GPIOLIB
        select HAVE_S3C2410_I2C if I2C
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
+       select SOC_SAMSUNG
        help
          Samsung S5PV210/S5PC110 series based systems
 
index e7b551e..aa0a1f0 100644 (file)
@@ -3,12 +3,5 @@
 # Copyright (c) 2010 Samsung Electronics Co., Ltd.
 #              http://www.samsung.com/
 
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/arch/arm/plat-samsung/include
-
-# Core
-
 obj-$(CONFIG_PM_SLEEP)         += pm.o sleep.o
-
-# machine support
-
 obj-y                          += s5pv210.o
index b336df0..d59c094 100644 (file)
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/cacheflush.h>
 #include <asm/suspend.h>
 
-#include <plat/pm-common.h>
-
 #include "common.h"
 #include "regs-clock.h"
 
+/* helper functions to save and restore register state */
+struct sleep_save {
+       void __iomem    *reg;
+       unsigned long   val;
+};
+
+#define SAVE_ITEM(x) \
+       { .reg = (x) }
+
+/**
+ * s3c_pm_do_save() - save a set of registers for restoration on resume.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Run through the list of registers given, saving their contents in the
+ * array for later restoration when we wakeup.
+ */
+static void s3c_pm_do_save(struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++) {
+               ptr->val = readl_relaxed(ptr->reg);
+               S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
+       }
+}
+
+/**
+ * s3c_pm_do_restore() - restore register values from the save list.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Restore the register values saved from s3c_pm_do_save().
+ *
+ * WARNING: Do not put any debug in here that may effect memory or use
+ * peripherals, as things may be changing!
+*/
+
+static void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++)
+               writel_relaxed(ptr->val, ptr->reg);
+}
+
 static struct sleep_save s5pv210_core_save[] = {
        /* Clock ETC */
        SAVE_ITEM(S5P_MDNIE_SEL),
@@ -99,8 +140,6 @@ static int s5pv210_suspend_enter(suspend_state_t state)
        u32 eint_wakeup_mask = s5pv210_read_eint_wakeup_mask();
        int ret;
 
-       s3c_pm_debug_init();
-
        S3C_PMDBG("%s: suspending the system...\n", __func__);
 
        S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__,
@@ -113,7 +152,7 @@ static int s5pv210_suspend_enter(suspend_state_t state)
                return -EINVAL;
        }
 
-       s3c_pm_save_uarts();
+       s3c_pm_save_uarts(false);
        s5pv210_pm_prepare();
        flush_cache_all();
        s3c_pm_check_store();
@@ -122,7 +161,7 @@ static int s5pv210_suspend_enter(suspend_state_t state)
        if (ret)
                return ret;
 
-       s3c_pm_restore_uarts();
+       s3c_pm_restore_uarts(false);
 
        S3C_PMDBG("%s: wakeup stat: %08x\n", __func__,
                        __raw_readl(S5P_WAKEUP_STAT));
index 2a35c83..9cad230 100644 (file)
@@ -9,7 +9,9 @@
 #ifndef __ASM_ARCH_REGS_CLOCK_H
 #define __ASM_ARCH_REGS_CLOCK_H __FILE__
 
-#include <plat/map-base.h>
+#define S3C_ADDR_BASE          0xF6000000
+#define S3C_ADDR(x)            ((void __iomem __force *)S3C_ADDR_BASE + (x))
+#define S3C_VA_SYS             S3C_ADDR(0x00100000)
 
 #define S5P_CLKREG(x)          (S3C_VA_SYS + (x))
 
index 868f9c2..a21ed3b 100644 (file)
@@ -13,8 +13,6 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
-#include <plat/map-base.h>
-
 #include "common.h"
 #include "regs-clock.h"
 
index 4777fff..af9dbd6 100644 (file)
@@ -2,8 +2,6 @@
 #ifndef __ASM_RCAR_GEN2_H__
 #define __ASM_RCAR_GEN2_H__
 
-void rcar_gen2_timer_init(void);
-void rcar_gen2_reserve(void);
 void rcar_gen2_pm_init(void);
 
 #endif /* __ASM_RCAR_GEN2_H__ */
index c42ff8c..07866e4 100644 (file)
@@ -59,7 +59,7 @@ static unsigned int __init get_extal_freq(void)
 #define CNTCR 0
 #define CNTFID0 0x20
 
-void __init rcar_gen2_timer_init(void)
+static void __init rcar_gen2_timer_init(void)
 {
        bool need_update = true;
        void __iomem *base;
@@ -174,7 +174,7 @@ static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
        return 0;
 }
 
-void __init rcar_gen2_reserve(void)
+static void __init rcar_gen2_reserve(void)
 {
        struct memory_reserve_config mrc;
 
index 76a65df..d5c805a 100644 (file)
@@ -70,7 +70,7 @@ static void __init tegra_cpu_reset_handler_enable(void)
        switch (err) {
        case -ENOSYS:
                tegra_cpu_reset_handler_set(reset_address);
-               /* fall through */
+               fallthrough;
        case 0:
                is_enabled = true;
                break;
index f4bfc1c..ea81e89 100644 (file)
@@ -694,7 +694,7 @@ thumb2arm(u16 tinstr)
                        return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] |
                            (tinstr & 255);             /* register_list */
                }
-               /* Else, fall through - for illegal instruction case */
+               fallthrough;    /* for illegal instruction case */
 
        default:
                return BAD_INSTR;
@@ -750,7 +750,7 @@ do_alignment_t32_to_handler(u32 *pinstr, struct pt_regs *regs,
        case 0xe8e0:
        case 0xe9e0:
                poffset->un = (tinst2 & 0xff) << 2;
-               /* Fall through */
+               fallthrough;
 
        case 0xe940:
        case 0xe9c0:
index c0fbfca..114c05a 100644 (file)
@@ -71,7 +71,7 @@ static void cpu_v7_spectre_init(void)
                /* Other ARM CPUs require no workaround */
                if (read_cpuid_implementor() == ARM_CPU_IMP_ARM)
                        break;
-               /* fallthrough */
+               fallthrough;
                /* Cortex A57/A72 require firmware workaround */
        case ARM_CPU_PART_CORTEX_A57:
        case ARM_CPU_PART_CORTEX_A72: {
index b2e9e82..1eb5900 100644 (file)
@@ -309,14 +309,14 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
                 * not supported by current hardware on OMAP1
                 * w |= (0x03 << 7);
                 */
-               /* fall through */
+               fallthrough;
        case OMAP_DMA_DATA_BURST_16:
                if (dma_omap2plus()) {
                        burst = 0x3;
                        break;
                }
                /* OMAP1 don't support burst 16 */
-               /* fall through */
+               fallthrough;
        default:
                BUG();
        }
@@ -393,7 +393,7 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
                        break;
                }
                /* OMAP1 don't support burst 16 */
-               /* fall through */
+               fallthrough;
        default:
                printk(KERN_ERR "Invalid DMA burst mode\n");
                BUG();
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
deleted file mode 100644 (file)
index 790c87e..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright 2009 Simtec Electronics
-
-config PLAT_SAMSUNG
-       bool
-       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_EXYNOS || ARCH_S5PV210
-       default y
-       select GENERIC_IRQ_CHIP
-       select NO_IOPORT_MAP
-       help
-         Base platform code for all Samsung SoC based systems
-
-config SAMSUNG_PM
-       bool
-       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX)
-       default y
-       help
-         Base platform power management code for samsung code
-
-if PLAT_SAMSUNG
-menu "Samsung Common options"
-
-# boot configurations
-
-comment "Boot options"
-
-config S3C_LOWLEVEL_UART_PORT
-       int "S3C UART to use for low-level messages"
-       depends on ARCH_S3C64XX
-       default 0
-       help
-         Choice of which UART port to use for the low-level messages,
-         such as the `Uncompressing...` at start time. The value of
-         this configuration should be between zero and two. The port
-         must have been initialised by the boot-loader before use.
-
-config SAMSUNG_ATAGS
-       def_bool n
-       depends on ATAGS
-       help
-          This option enables ATAGS based boot support code for
-          Samsung platforms, including static platform devices, legacy
-          clock, timer and interrupt initialization, etc.
-
-          Platforms that support only DT based boot need not to select
-          this option.
-
-if SAMSUNG_ATAGS
-
-config S3C_GPIO_SPACE
-       int "Space between gpio banks"
-       default 0
-       help
-         Add a number of spare GPIO entries between each bank for debugging
-         purposes. This allows any problems where an counter overflows from
-         one bank to another to be caught, at the expense of using a little
-         more memory.
-
-config S3C_GPIO_TRACK
-       bool
-       help
-         Internal configuration option to enable the s3c specific gpio
-         chip tracking if the platform requires it.
-
-# ADC driver
-
-config S3C_ADC
-       bool "ADC common driver support"
-       depends on !ARCH_MULTIPLATFORM
-       help
-         Core support for the ADC block found in the Samsung SoC systems
-         for drivers such as the touchscreen and hwmon to use to share
-         this resource.
-
-# device definitions to compile in
-
-config S3C_DEV_HSMMC
-       bool
-       help
-         Compile in platform device definitions for HSMMC code
-
-config S3C_DEV_HSMMC1
-       bool
-       help
-         Compile in platform device definitions for HSMMC channel 1
-
-config S3C_DEV_HSMMC2
-       bool
-       help
-         Compile in platform device definitions for HSMMC channel 2
-
-config S3C_DEV_HSMMC3
-       bool
-       help
-         Compile in platform device definitions for HSMMC channel 3
-
-config S3C_DEV_HWMON
-       bool
-       help
-           Compile in platform device definitions for HWMON
-
-config S3C_DEV_I2C1
-       bool
-       help
-         Compile in platform device definitions for I2C channel 1
-
-config S3C_DEV_I2C2
-       bool
-       help
-         Compile in platform device definitions for I2C channel 2
-
-config S3C_DEV_I2C3
-       bool
-       help
-         Compile in platform device definition for I2C controller 3
-
-config S3C_DEV_I2C4
-       bool
-       help
-         Compile in platform device definition for I2C controller 4
-
-config S3C_DEV_I2C5
-       bool
-       help
-         Compile in platform device definition for I2C controller 5
-
-config S3C_DEV_I2C6
-       bool
-       help
-         Compile in platform device definition for I2C controller 6
-
-config S3C_DEV_I2C7
-       bool
-       help
-         Compile in platform device definition for I2C controller 7
-
-config S3C_DEV_FB
-       bool
-       help
-         Compile in platform device definition for framebuffer
-
-config S3C_DEV_USB_HOST
-       bool
-       help
-         Compile in platform device definition for USB host.
-
-config S3C_DEV_USB_HSOTG
-       bool
-       help
-         Compile in platform device definition for USB high-speed OtG
-
-config S3C_DEV_WDT
-       bool
-       default y if ARCH_S3C24XX
-       help
-         Complie in platform device definition for Watchdog Timer
-
-config S3C_DEV_NAND
-       bool
-       help
-         Compile in platform device definition for NAND controller
-
-config S3C_DEV_ONENAND
-       bool
-       help
-         Compile in platform device definition for OneNAND controller
-
-config S3C_DEV_RTC
-       bool
-       help
-         Complie in platform device definition for RTC
-
-config SAMSUNG_DEV_ADC
-       bool
-       help
-         Compile in platform device definition for ADC controller
-
-config SAMSUNG_DEV_IDE
-       bool
-       help
-         Compile in platform device definitions for IDE
-
-config S3C64XX_DEV_SPI0
-       bool
-       help
-         Compile in platform device definitions for S3C64XX's type
-         SPI controller 0
-
-config S3C64XX_DEV_SPI1
-       bool
-       help
-         Compile in platform device definitions for S3C64XX's type
-         SPI controller 1
-
-config S3C64XX_DEV_SPI2
-       bool
-       help
-         Compile in platform device definitions for S3C64XX's type
-         SPI controller 2
-
-config SAMSUNG_DEV_TS
-       bool
-       help
-           Common in platform device definitions for touchscreen device
-
-config SAMSUNG_DEV_KEYPAD
-       bool
-       help
-         Compile in platform device definitions for keypad
-
-config SAMSUNG_DEV_PWM
-       bool
-       default y if ARCH_S3C24XX
-       help
-         Compile in platform device definition for PWM Timer
-
-config S3C24XX_PWM
-       bool "PWM device support"
-       select PWM
-       select PWM_SAMSUNG
-       help
-         Support for exporting the PWM timer blocks via the pwm device
-         system
-
-config GPIO_SAMSUNG
-       def_bool y
-
-config SAMSUNG_PM_GPIO
-       bool
-       default y if GPIO_SAMSUNG && PM
-       help
-         Include legacy GPIO power management code for platforms not using
-         pinctrl-samsung driver.
-endif
-
-comment "Power management"
-
-config SAMSUNG_PM_DEBUG
-       bool "Samsung PM Suspend debug"
-       depends on PM && DEBUG_KERNEL
-       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
-       depends on DEBUG_EXYNOS_UART || DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
-       depends on DEBUG_LL && MMU
-       help
-         Say Y here if you want verbose debugging from the PM Suspend and
-         Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-         for more information.
-
-config S3C_PM_DEBUG_LED_SMDK
-       bool "SMDK LED suspend/resume debugging"
-       depends on PM && (MACH_SMDK6410)
-       help
-         Say Y here to enable the use of the SMDK LEDs on the baseboard
-        for debugging of the state of the suspend and resume process.
-
-        Note, this currently only works for S3C64XX based SMDK boards.
-
-config SAMSUNG_PM_CHECK
-       bool "S3C2410 PM Suspend Memory CRC"
-       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
-       select CRC32
-       help
-         Enable the PM code's memory area checksum over sleep. This option
-         will generate CRCs of all blocks of memory, and store them before
-         going to sleep. The blocks are then checked on resume for any
-         errors.
-
-         Note, this can take several seconds depending on memory size
-         and CPU speed.
-
-         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-
-config SAMSUNG_PM_CHECK_CHUNKSIZE
-       int "S3C2410 PM Suspend CRC Chunksize (KiB)"
-       depends on PM && SAMSUNG_PM_CHECK
-       default 64
-       help
-         Set the chunksize in Kilobytes of the CRC for checking memory
-         corruption over suspend and resume. A smaller value will mean that
-         the CRC data block will take more memory, but will identify any
-         faults with better precision.
-
-         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-
-config SAMSUNG_WAKEMASK
-       bool
-       depends on PM
-       help
-         Compile support for wakeup-mask controls found on the S3C6400
-         and above. This code allows a set of interrupt to wakeup-mask
-         mappings. See <plat/wakeup-mask.h>
-
-config SAMSUNG_WDT_RESET
-       bool
-       help
-         Compile support for system restart by triggering watchdog reset.
-         Used on SoCs that do not provide dedicated reset control.
-
-config DEBUG_S3C_UART
-       depends on PLAT_SAMSUNG
-       int
-       default "0" if DEBUG_S3C_UART0
-       default "1" if DEBUG_S3C_UART1
-       default "2" if DEBUG_S3C_UART2
-       default "3" if DEBUG_S3C_UART3
-
-endmenu
-endif
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
deleted file mode 100644 (file)
index 3db9d2c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright 2009 Simtec Electronics
-
-ccflags-$(CONFIG_ARCH_S3C64XX) := -I$(srctree)/arch/arm/mach-s3c64xx/include
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include
-
-# Objects we always build independent of SoC choice
-
-obj-y                          += init.o cpu.o
-
-# ADC
-
-obj-$(CONFIG_S3C_ADC)  += adc.o
-
-# devices
-
-obj-$(CONFIG_SAMSUNG_ATAGS)    += platformdata.o
-
-obj-$(CONFIG_SAMSUNG_ATAGS)    += devs.o
-obj-$(CONFIG_SAMSUNG_ATAGS)    += dev-uart.o
-
-obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
-
-# PM support
-
-obj-$(CONFIG_PM_SLEEP)         += pm-common.o
-obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm-common.o
-obj-$(CONFIG_SAMSUNG_PM)       += pm.o
-obj-$(CONFIG_SAMSUNG_PM_GPIO)  += pm-gpio.o
-obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
-obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o
-
-obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
-obj-$(CONFIG_SAMSUNG_WDT_RESET)        += watchdog-reset.o
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
deleted file mode 100644 (file)
index 55b1925..0000000
+++ /dev/null
@@ -1,510 +0,0 @@
-// SPDX-License-Identifier: GPL-1.0+
-//
-// Copyright (c) 2008 Simtec Electronics
-//     http://armlinux.simtec.co.uk/
-//     Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
-//
-// Samsung ADC device core
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mod_devicetable.h>
-#include <linux/platform_device.h>
-#include <linux/sched.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/regulator/consumer.h>
-
-#include <plat/regs-adc.h>
-#include <plat/adc.h>
-
-/* This driver is designed to control the usage of the ADC block between
- * the touchscreen and any other drivers that may need to use it, such as
- * the hwmon driver.
- *
- * Priority will be given to the touchscreen driver, but as this itself is
- * rate limited it should not starve other requests which are processed in
- * order that they are received.
- *
- * Each user registers to get a client block which uniquely identifies it
- * and stores information such as the necessary functions to callback when
- * action is required.
- */
-
-enum s3c_cpu_type {
-       TYPE_ADCV1, /* S3C24XX */
-       TYPE_ADCV11, /* S3C2443 */
-       TYPE_ADCV12, /* S3C2416, S3C2450 */
-       TYPE_ADCV2, /* S3C64XX */
-       TYPE_ADCV3, /* S5PV210, S5PC110, Exynos4210 */
-};
-
-struct s3c_adc_client {
-       struct platform_device  *pdev;
-       struct list_head         pend;
-       wait_queue_head_t       *wait;
-
-       unsigned int             nr_samples;
-       int                      result;
-       unsigned char            is_ts;
-       unsigned char            channel;
-
-       void    (*select_cb)(struct s3c_adc_client *c, unsigned selected);
-       void    (*convert_cb)(struct s3c_adc_client *c,
-                             unsigned val1, unsigned val2,
-                             unsigned *samples_left);
-};
-
-struct adc_device {
-       struct platform_device  *pdev;
-       struct platform_device  *owner;
-       struct clk              *clk;
-       struct s3c_adc_client   *cur;
-       struct s3c_adc_client   *ts_pend;
-       void __iomem            *regs;
-       spinlock_t               lock;
-
-       unsigned int             prescale;
-
-       int                      irq;
-       struct regulator        *vdd;
-};
-
-static struct adc_device *adc_dev;
-
-static LIST_HEAD(adc_pending); /* protected by adc_device.lock */
-
-#define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg)
-
-static inline void s3c_adc_convert(struct adc_device *adc)
-{
-       unsigned con = readl(adc->regs + S3C2410_ADCCON);
-
-       con |= S3C2410_ADCCON_ENABLE_START;
-       writel(con, adc->regs + S3C2410_ADCCON);
-}
-
-static inline void s3c_adc_select(struct adc_device *adc,
-                                 struct s3c_adc_client *client)
-{
-       unsigned con = readl(adc->regs + S3C2410_ADCCON);
-       enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
-
-       client->select_cb(client, 1);
-
-       if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
-               con &= ~S3C2410_ADCCON_MUXMASK;
-       con &= ~S3C2410_ADCCON_STDBM;
-       con &= ~S3C2410_ADCCON_STARTMASK;
-
-       if (!client->is_ts) {
-               if (cpu == TYPE_ADCV3)
-                       writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
-               else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12)
-                       writel(client->channel & 0xf,
-                                               adc->regs + S3C2443_ADCMUX);
-               else
-                       con |= S3C2410_ADCCON_SELMUX(client->channel);
-       }
-
-       writel(con, adc->regs + S3C2410_ADCCON);
-}
-
-static void s3c_adc_dbgshow(struct adc_device *adc)
-{
-       adc_dbg(adc, "CON=%08x, TSC=%08x, DLY=%08x\n",
-               readl(adc->regs + S3C2410_ADCCON),
-               readl(adc->regs + S3C2410_ADCTSC),
-               readl(adc->regs + S3C2410_ADCDLY));
-}
-
-static void s3c_adc_try(struct adc_device *adc)
-{
-       struct s3c_adc_client *next = adc->ts_pend;
-
-       if (!next && !list_empty(&adc_pending)) {
-               next = list_first_entry(&adc_pending,
-                                       struct s3c_adc_client, pend);
-               list_del(&next->pend);
-       } else
-               adc->ts_pend = NULL;
-
-       if (next) {
-               adc_dbg(adc, "new client is %p\n", next);
-               adc->cur = next;
-               s3c_adc_select(adc, next);
-               s3c_adc_convert(adc);
-               s3c_adc_dbgshow(adc);
-       }
-}
-
-int s3c_adc_start(struct s3c_adc_client *client,
-                 unsigned int channel, unsigned int nr_samples)
-{
-       struct adc_device *adc = adc_dev;
-       unsigned long flags;
-
-       if (!adc) {
-               printk(KERN_ERR "%s: failed to find adc\n", __func__);
-               return -EINVAL;
-       }
-
-       spin_lock_irqsave(&adc->lock, flags);
-
-       if (client->is_ts && adc->ts_pend) {
-               spin_unlock_irqrestore(&adc->lock, flags);
-               return -EAGAIN;
-       }
-
-       client->channel = channel;
-       client->nr_samples = nr_samples;
-
-       if (client->is_ts)
-               adc->ts_pend = client;
-       else
-               list_add_tail(&client->pend, &adc_pending);
-
-       if (!adc->cur)
-               s3c_adc_try(adc);
-
-       spin_unlock_irqrestore(&adc->lock, flags);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(s3c_adc_start);
-
-static void s3c_convert_done(struct s3c_adc_client *client,
-                            unsigned v, unsigned u, unsigned *left)
-{
-       client->result = v;
-       wake_up(client->wait);
-}
-
-int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch)
-{
-       DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
-       int ret;
-
-       client->convert_cb = s3c_convert_done;
-       client->wait = &wake;
-       client->result = -1;
-
-       ret = s3c_adc_start(client, ch, 1);
-       if (ret < 0)
-               goto err;
-
-       ret = wait_event_timeout(wake, client->result >= 0, HZ / 2);
-       if (client->result < 0) {
-               ret = -ETIMEDOUT;
-               goto err;
-       }
-
-       client->convert_cb = NULL;
-       return client->result;
-
-err:
-       return ret;
-}
-EXPORT_SYMBOL_GPL(s3c_adc_read);
-
-static void s3c_adc_default_select(struct s3c_adc_client *client,
-                                  unsigned select)
-{
-}
-
-struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
-                                       void (*select)(struct s3c_adc_client *client,
-                                                      unsigned int selected),
-                                       void (*conv)(struct s3c_adc_client *client,
-                                                    unsigned d0, unsigned d1,
-                                                    unsigned *samples_left),
-                                       unsigned int is_ts)
-{
-       struct s3c_adc_client *client;
-
-       WARN_ON(!pdev);
-
-       if (!select)
-               select = s3c_adc_default_select;
-
-       if (!pdev)
-               return ERR_PTR(-EINVAL);
-
-       client = kzalloc(sizeof(*client), GFP_KERNEL);
-       if (!client)
-               return ERR_PTR(-ENOMEM);
-
-       client->pdev = pdev;
-       client->is_ts = is_ts;
-       client->select_cb = select;
-       client->convert_cb = conv;
-
-       return client;
-}
-EXPORT_SYMBOL_GPL(s3c_adc_register);
-
-void s3c_adc_release(struct s3c_adc_client *client)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&adc_dev->lock, flags);
-
-       /* We should really check that nothing is in progress. */
-       if (adc_dev->cur == client)
-               adc_dev->cur = NULL;
-       if (adc_dev->ts_pend == client)
-               adc_dev->ts_pend = NULL;
-       else {
-               struct list_head *p, *n;
-               struct s3c_adc_client *tmp;
-
-               list_for_each_safe(p, n, &adc_pending) {
-                       tmp = list_entry(p, struct s3c_adc_client, pend);
-                       if (tmp == client)
-                               list_del(&tmp->pend);
-               }
-       }
-
-       if (adc_dev->cur == NULL)
-               s3c_adc_try(adc_dev);
-
-       spin_unlock_irqrestore(&adc_dev->lock, flags);
-       kfree(client);
-}
-EXPORT_SYMBOL_GPL(s3c_adc_release);
-
-static irqreturn_t s3c_adc_irq(int irq, void *pw)
-{
-       struct adc_device *adc = pw;
-       struct s3c_adc_client *client = adc->cur;
-       enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
-       unsigned data0, data1;
-
-       if (!client) {
-               dev_warn(&adc->pdev->dev, "%s: no adc pending\n", __func__);
-               goto exit;
-       }
-
-       data0 = readl(adc->regs + S3C2410_ADCDAT0);
-       data1 = readl(adc->regs + S3C2410_ADCDAT1);
-       adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1);
-
-       client->nr_samples--;
-
-       if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) {
-               data0 &= 0x3ff;
-               data1 &= 0x3ff;
-       } else {
-               /* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */
-               data0 &= 0xfff;
-               data1 &= 0xfff;
-       }
-
-       if (client->convert_cb)
-               (client->convert_cb)(client, data0, data1, &client->nr_samples);
-
-       if (client->nr_samples > 0) {
-               /* fire another conversion for this */
-
-               client->select_cb(client, 1);
-               s3c_adc_convert(adc);
-       } else {
-               spin_lock(&adc->lock);
-               (client->select_cb)(client, 0);
-               adc->cur = NULL;
-
-               s3c_adc_try(adc);
-               spin_unlock(&adc->lock);
-       }
-
-exit:
-       if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
-               /* Clear ADC interrupt */
-               writel(0, adc->regs + S3C64XX_ADCCLRINT);
-       }
-       return IRQ_HANDLED;
-}
-
-static int s3c_adc_probe(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct adc_device *adc;
-       enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
-       int ret;
-       unsigned tmp;
-
-       adc = devm_kzalloc(dev, sizeof(*adc), GFP_KERNEL);
-       if (!adc)
-               return -ENOMEM;
-
-       spin_lock_init(&adc->lock);
-
-       adc->pdev = pdev;
-       adc->prescale = S3C2410_ADCCON_PRSCVL(49);
-
-       adc->vdd = devm_regulator_get(dev, "vdd");
-       if (IS_ERR(adc->vdd)) {
-               dev_err(dev, "operating without regulator \"vdd\" .\n");
-               return PTR_ERR(adc->vdd);
-       }
-
-       adc->irq = platform_get_irq(pdev, 1);
-       if (adc->irq <= 0)
-               return -ENOENT;
-
-       ret = devm_request_irq(dev, adc->irq, s3c_adc_irq, 0, dev_name(dev),
-                               adc);
-       if (ret < 0) {
-               dev_err(dev, "failed to attach adc irq\n");
-               return ret;
-       }
-
-       adc->clk = devm_clk_get(dev, "adc");
-       if (IS_ERR(adc->clk)) {
-               dev_err(dev, "failed to get adc clock\n");
-               return PTR_ERR(adc->clk);
-       }
-
-       adc->regs = devm_platform_ioremap_resource(pdev, 0);
-       if (IS_ERR(adc->regs))
-               return PTR_ERR(adc->regs);
-
-       ret = regulator_enable(adc->vdd);
-       if (ret)
-               return ret;
-
-       clk_prepare_enable(adc->clk);
-
-       tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
-
-       /* Enable 12-bit ADC resolution */
-       if (cpu == TYPE_ADCV12)
-               tmp |= S3C2416_ADCCON_RESSEL;
-       if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
-               tmp |= S3C64XX_ADCCON_RESSEL;
-
-       writel(tmp, adc->regs + S3C2410_ADCCON);
-
-       dev_info(dev, "attached adc driver\n");
-
-       platform_set_drvdata(pdev, adc);
-       adc_dev = adc;
-
-       return 0;
-}
-
-static int s3c_adc_remove(struct platform_device *pdev)
-{
-       struct adc_device *adc = platform_get_drvdata(pdev);
-
-       clk_disable_unprepare(adc->clk);
-       regulator_disable(adc->vdd);
-
-       return 0;
-}
-
-#ifdef CONFIG_PM
-static int s3c_adc_suspend(struct device *dev)
-{
-       struct adc_device *adc = dev_get_drvdata(dev);
-       unsigned long flags;
-       u32 con;
-
-       spin_lock_irqsave(&adc->lock, flags);
-
-       con = readl(adc->regs + S3C2410_ADCCON);
-       con |= S3C2410_ADCCON_STDBM;
-       writel(con, adc->regs + S3C2410_ADCCON);
-
-       disable_irq(adc->irq);
-       spin_unlock_irqrestore(&adc->lock, flags);
-       clk_disable(adc->clk);
-       regulator_disable(adc->vdd);
-
-       return 0;
-}
-
-static int s3c_adc_resume(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct adc_device *adc = platform_get_drvdata(pdev);
-       enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
-       int ret;
-       unsigned long tmp;
-
-       ret = regulator_enable(adc->vdd);
-       if (ret)
-               return ret;
-       clk_enable(adc->clk);
-       enable_irq(adc->irq);
-
-       tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
-
-       /* Enable 12-bit ADC resolution */
-       if (cpu == TYPE_ADCV12)
-               tmp |= S3C2416_ADCCON_RESSEL;
-       if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
-               tmp |= S3C64XX_ADCCON_RESSEL;
-
-       writel(tmp, adc->regs + S3C2410_ADCCON);
-
-       return 0;
-}
-
-#else
-#define s3c_adc_suspend NULL
-#define s3c_adc_resume NULL
-#endif
-
-static const struct platform_device_id s3c_adc_driver_ids[] = {
-       {
-               .name           = "s3c24xx-adc",
-               .driver_data    = TYPE_ADCV1,
-       }, {
-               .name           = "s3c2443-adc",
-               .driver_data    = TYPE_ADCV11,
-       }, {
-               .name           = "s3c2416-adc",
-               .driver_data    = TYPE_ADCV12,
-       }, {
-               .name           = "s3c64xx-adc",
-               .driver_data    = TYPE_ADCV2,
-       }, {
-               .name           = "samsung-adc-v3",
-               .driver_data    = TYPE_ADCV3,
-       },
-       { }
-};
-MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids);
-
-static const struct dev_pm_ops adc_pm_ops = {
-       .suspend        = s3c_adc_suspend,
-       .resume         = s3c_adc_resume,
-};
-
-static struct platform_driver s3c_adc_driver = {
-       .id_table       = s3c_adc_driver_ids,
-       .driver         = {
-               .name   = "s3c-adc",
-               .pm     = &adc_pm_ops,
-       },
-       .probe          = s3c_adc_probe,
-       .remove         = s3c_adc_remove,
-};
-
-static int __init adc_init(void)
-{
-       int ret;
-
-       ret = platform_driver_register(&s3c_adc_driver);
-       if (ret)
-               printk(KERN_ERR "%s: failed to add adc driver\n", __func__);
-
-       return ret;
-}
-
-module_init(adc_init);
diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c
deleted file mode 100644 (file)
index e1ba88b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com
-//
-// Samsung CPU Support
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/io.h>
-
-#include <plat/map-base.h>
-#include <plat/cpu.h>
-
-unsigned long samsung_cpu_id;
-static unsigned int samsung_cpu_rev;
-
-unsigned int samsung_rev(void)
-{
-       return samsung_cpu_rev;
-}
-EXPORT_SYMBOL(samsung_rev);
-
-void __init s3c64xx_init_cpu(void)
-{
-       samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118);
-       if (!samsung_cpu_id) {
-               /*
-                * S3C6400 has the ID register in a different place,
-                * and needs a write before it can be read.
-                */
-               writel_relaxed(0x0, S3C_VA_SYS + 0xA1C);
-               samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C);
-       }
-
-       samsung_cpu_rev = 0;
-
-       pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
-}
-
-void __init s5p_init_cpu(const void __iomem *cpuid_addr)
-{
-       samsung_cpu_id = readl_relaxed(cpuid_addr);
-       samsung_cpu_rev = samsung_cpu_id & 0xFF;
-
-       pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id);
-}
diff --git a/arch/arm/plat-samsung/dev-uart.c b/arch/arm/plat-samsung/dev-uart.c
deleted file mode 100644 (file)
index 7476a5d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-//     originally from arch/arm/plat-s3c24xx/devs.c
-//
-// Copyright (c) 2004 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Base S3C24XX platform device definitions
-
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-
-#include <plat/devs.h>
-
-/* uart devices */
-
-static struct platform_device s3c24xx_uart_device0 = {
-       .id             = 0,
-};
-
-static struct platform_device s3c24xx_uart_device1 = {
-       .id             = 1,
-};
-
-static struct platform_device s3c24xx_uart_device2 = {
-       .id             = 2,
-};
-
-static struct platform_device s3c24xx_uart_device3 = {
-       .id             = 3,
-};
-
-struct platform_device *s3c24xx_uart_src[4] = {
-       &s3c24xx_uart_device0,
-       &s3c24xx_uart_device1,
-       &s3c24xx_uart_device2,
-       &s3c24xx_uart_device3,
-};
-
-struct platform_device *s3c24xx_uart_devs[4] = {
-};
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
deleted file mode 100644 (file)
index 089a176..0000000
+++ /dev/null
@@ -1,1166 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2011 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com
-//
-// Base Samsung platform device definitions
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/dma-mapping.h>
-#include <linux/fb.h>
-#include <linux/gfp.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/onenand.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mmc/host.h>
-#include <linux/ioport.h>
-#include <linux/sizes.h>
-#include <linux/platform_data/s3c-hsudc.h>
-#include <linux/platform_data/s3c-hsotg.h>
-#include <linux/platform_data/dma-s3c24xx.h>
-
-#include <linux/platform_data/media/s5p_hdmi.h>
-
-#include <asm/irq.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/dma.h>
-#include <mach/irqs.h>
-#include <mach/map.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-#include <plat/adc.h>
-#include <linux/platform_data/ata-samsung_cf.h>
-#include <plat/fb.h>
-#include <plat/fb-s3c2410.h>
-#include <linux/platform_data/hwmon-s3c.h>
-#include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/keypad.h>
-#include <linux/platform_data/mmc-s3cmci.h>
-#include <linux/platform_data/mtd-nand-s3c2410.h>
-#include <plat/pwm-core.h>
-#include <plat/sdhci.h>
-#include <linux/platform_data/touchscreen-s3c2410.h>
-#include <linux/platform_data/usb-s3c2410_udc.h>
-#include <linux/platform_data/usb-ohci-s3c2410.h>
-#include <plat/usb-phy.h>
-#include <plat/regs-spi.h>
-#include <linux/platform_data/asoc-s3c.h>
-#include <linux/platform_data/spi-s3c64xx.h>
-
-#define samsung_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
-
-/* AC97 */
-#ifdef CONFIG_CPU_S3C2440
-static struct resource s3c_ac97_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
-       [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
-};
-
-struct platform_device s3c_device_ac97 = {
-       .name           = "samsung-ac97",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_ac97_resource),
-       .resource       = s3c_ac97_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-#endif /* CONFIG_CPU_S3C2440 */
-
-/* ADC */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_adc_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
-       [1] = DEFINE_RES_IRQ(IRQ_TC),
-       [2] = DEFINE_RES_IRQ(IRQ_ADC),
-};
-
-struct platform_device s3c_device_adc = {
-       .name           = "s3c24xx-adc",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_adc_resource),
-       .resource       = s3c_adc_resource,
-};
-#endif /* CONFIG_PLAT_S3C24XX */
-
-#if defined(CONFIG_SAMSUNG_DEV_ADC)
-static struct resource s3c_adc_resource[] = {
-       [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_ADC),
-       [2] = DEFINE_RES_IRQ(IRQ_TC),
-};
-
-struct platform_device s3c_device_adc = {
-       .name           = "exynos-adc",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_adc_resource),
-       .resource       = s3c_adc_resource,
-};
-#endif /* CONFIG_SAMSUNG_DEV_ADC */
-
-/* Camif Controller */
-
-#ifdef CONFIG_CPU_S3C2440
-static struct resource s3c_camif_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2440_PA_CAMIF, S3C2440_SZ_CAMIF),
-       [1] = DEFINE_RES_IRQ(IRQ_S3C2440_CAM_C),
-       [2] = DEFINE_RES_IRQ(IRQ_S3C2440_CAM_P),
-};
-
-struct platform_device s3c_device_camif = {
-       .name           = "s3c2440-camif",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_camif_resource),
-       .resource       = s3c_camif_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-#endif /* CONFIG_CPU_S3C2440 */
-
-/* FB */
-
-#ifdef CONFIG_S3C_DEV_FB
-static struct resource s3c_fb_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K),
-       [1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC),
-       [2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO),
-       [3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM),
-};
-
-struct platform_device s3c_device_fb = {
-       .name           = "s3c-fb",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_fb_resource),
-       .resource       = s3c_fb_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       },
-};
-
-void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
-{
-       s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
-                        &s3c_device_fb);
-}
-#endif /* CONFIG_S3C_DEV_FB */
-
-/* HWMON */
-
-#ifdef CONFIG_S3C_DEV_HWMON
-struct platform_device s3c_device_hwmon = {
-       .name           = "s3c-hwmon",
-       .id             = -1,
-       .dev.parent     = &s3c_device_adc.dev,
-};
-
-void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
-{
-       s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
-                        &s3c_device_hwmon);
-}
-#endif /* CONFIG_S3C_DEV_HWMON */
-
-/* HSMMC */
-
-#ifdef CONFIG_S3C_DEV_HSMMC
-static struct resource s3c_hsmmc_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC0, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_HSMMC0),
-};
-
-struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
-       .max_width      = 4,
-       .host_caps      = (MMC_CAP_4_BIT_DATA |
-                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
-};
-
-struct platform_device s3c_device_hsmmc0 = {
-       .name           = "s3c-sdhci",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c_hsmmc_resource),
-       .resource       = s3c_hsmmc_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-               .platform_data          = &s3c_hsmmc0_def_platdata,
-       },
-};
-
-void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
-{
-       s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
-}
-#endif /* CONFIG_S3C_DEV_HSMMC */
-
-#ifdef CONFIG_S3C_DEV_HSMMC1
-static struct resource s3c_hsmmc1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC1, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_HSMMC1),
-};
-
-struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
-       .max_width      = 4,
-       .host_caps      = (MMC_CAP_4_BIT_DATA |
-                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
-};
-
-struct platform_device s3c_device_hsmmc1 = {
-       .name           = "s3c-sdhci",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(s3c_hsmmc1_resource),
-       .resource       = s3c_hsmmc1_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-               .platform_data          = &s3c_hsmmc1_def_platdata,
-       },
-};
-
-void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
-{
-       s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
-}
-#endif /* CONFIG_S3C_DEV_HSMMC1 */
-
-/* HSMMC2 */
-
-#ifdef CONFIG_S3C_DEV_HSMMC2
-static struct resource s3c_hsmmc2_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC2, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_HSMMC2),
-};
-
-struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
-       .max_width      = 4,
-       .host_caps      = (MMC_CAP_4_BIT_DATA |
-                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
-};
-
-struct platform_device s3c_device_hsmmc2 = {
-       .name           = "s3c-sdhci",
-       .id             = 2,
-       .num_resources  = ARRAY_SIZE(s3c_hsmmc2_resource),
-       .resource       = s3c_hsmmc2_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-               .platform_data          = &s3c_hsmmc2_def_platdata,
-       },
-};
-
-void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
-{
-       s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
-}
-#endif /* CONFIG_S3C_DEV_HSMMC2 */
-
-#ifdef CONFIG_S3C_DEV_HSMMC3
-static struct resource s3c_hsmmc3_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_HSMMC3, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_HSMMC3),
-};
-
-struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
-       .max_width      = 4,
-       .host_caps      = (MMC_CAP_4_BIT_DATA |
-                          MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
-};
-
-struct platform_device s3c_device_hsmmc3 = {
-       .name           = "s3c-sdhci",
-       .id             = 3,
-       .num_resources  = ARRAY_SIZE(s3c_hsmmc3_resource),
-       .resource       = s3c_hsmmc3_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-               .platform_data          = &s3c_hsmmc3_def_platdata,
-       },
-};
-
-void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
-{
-       s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
-}
-#endif /* CONFIG_S3C_DEV_HSMMC3 */
-
-/* I2C */
-
-static struct resource s3c_i2c0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC),
-};
-
-struct platform_device s3c_device_i2c0 = {
-       .name           = "s3c2410-i2c",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c_i2c0_resource),
-       .resource       = s3c_i2c0_resource,
-};
-
-struct s3c2410_platform_i2c default_i2c_data __initdata = {
-       .flags          = 0,
-       .slave_addr     = 0x10,
-       .frequency      = 100*1000,
-       .sda_delay      = 100,
-};
-
-void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 0;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c0);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c0_cfg_gpio;
-}
-
-#ifdef CONFIG_S3C_DEV_I2C1
-static struct resource s3c_i2c1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC1, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC1),
-};
-
-struct platform_device s3c_device_i2c1 = {
-       .name           = "s3c2410-i2c",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(s3c_i2c1_resource),
-       .resource       = s3c_i2c1_resource,
-};
-
-void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 1;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c1);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c1_cfg_gpio;
-}
-#endif /* CONFIG_S3C_DEV_I2C1 */
-
-#ifdef CONFIG_S3C_DEV_I2C2
-static struct resource s3c_i2c2_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC2, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC2),
-};
-
-struct platform_device s3c_device_i2c2 = {
-       .name           = "s3c2410-i2c",
-       .id             = 2,
-       .num_resources  = ARRAY_SIZE(s3c_i2c2_resource),
-       .resource       = s3c_i2c2_resource,
-};
-
-void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 2;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c2);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c2_cfg_gpio;
-}
-#endif /* CONFIG_S3C_DEV_I2C2 */
-
-#ifdef CONFIG_S3C_DEV_I2C3
-static struct resource s3c_i2c3_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC3, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC3),
-};
-
-struct platform_device s3c_device_i2c3 = {
-       .name           = "s3c2440-i2c",
-       .id             = 3,
-       .num_resources  = ARRAY_SIZE(s3c_i2c3_resource),
-       .resource       = s3c_i2c3_resource,
-};
-
-void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 3;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c3);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c3_cfg_gpio;
-}
-#endif /*CONFIG_S3C_DEV_I2C3 */
-
-#ifdef CONFIG_S3C_DEV_I2C4
-static struct resource s3c_i2c4_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC4, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC4),
-};
-
-struct platform_device s3c_device_i2c4 = {
-       .name           = "s3c2440-i2c",
-       .id             = 4,
-       .num_resources  = ARRAY_SIZE(s3c_i2c4_resource),
-       .resource       = s3c_i2c4_resource,
-};
-
-void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 4;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c4);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c4_cfg_gpio;
-}
-#endif /*CONFIG_S3C_DEV_I2C4 */
-
-#ifdef CONFIG_S3C_DEV_I2C5
-static struct resource s3c_i2c5_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC5, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC5),
-};
-
-struct platform_device s3c_device_i2c5 = {
-       .name           = "s3c2440-i2c",
-       .id             = 5,
-       .num_resources  = ARRAY_SIZE(s3c_i2c5_resource),
-       .resource       = s3c_i2c5_resource,
-};
-
-void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 5;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c5);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c5_cfg_gpio;
-}
-#endif /*CONFIG_S3C_DEV_I2C5 */
-
-#ifdef CONFIG_S3C_DEV_I2C6
-static struct resource s3c_i2c6_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC6, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC6),
-};
-
-struct platform_device s3c_device_i2c6 = {
-       .name           = "s3c2440-i2c",
-       .id             = 6,
-       .num_resources  = ARRAY_SIZE(s3c_i2c6_resource),
-       .resource       = s3c_i2c6_resource,
-};
-
-void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 6;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c6);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c6_cfg_gpio;
-}
-#endif /* CONFIG_S3C_DEV_I2C6 */
-
-#ifdef CONFIG_S3C_DEV_I2C7
-static struct resource s3c_i2c7_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_IIC7, SZ_4K),
-       [1] = DEFINE_RES_IRQ(IRQ_IIC7),
-};
-
-struct platform_device s3c_device_i2c7 = {
-       .name           = "s3c2440-i2c",
-       .id             = 7,
-       .num_resources  = ARRAY_SIZE(s3c_i2c7_resource),
-       .resource       = s3c_i2c7_resource,
-};
-
-void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
-{
-       struct s3c2410_platform_i2c *npd;
-
-       if (!pd) {
-               pd = &default_i2c_data;
-               pd->bus_num = 7;
-       }
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c7);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = s3c_i2c7_cfg_gpio;
-}
-#endif /* CONFIG_S3C_DEV_I2C7 */
-
-/* I2S */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_iis_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
-};
-
-struct platform_device s3c_device_iis = {
-       .name           = "s3c24xx-iis",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_iis_resource),
-       .resource       = s3c_iis_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-#endif /* CONFIG_PLAT_S3C24XX */
-
-/* IDE CFCON */
-
-#ifdef CONFIG_SAMSUNG_DEV_IDE
-static struct resource s3c_cfcon_resource[] = {
-       [0] = DEFINE_RES_MEM(SAMSUNG_PA_CFCON, SZ_16K),
-       [1] = DEFINE_RES_IRQ(IRQ_CFCON),
-};
-
-struct platform_device s3c_device_cfcon = {
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c_cfcon_resource),
-       .resource       = s3c_cfcon_resource,
-};
-
-void __init s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
-{
-       s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
-                        &s3c_device_cfcon);
-}
-#endif /* CONFIG_SAMSUNG_DEV_IDE */
-
-/* KEYPAD */
-
-#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
-static struct resource samsung_keypad_resources[] = {
-       [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
-       [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
-};
-
-struct platform_device samsung_device_keypad = {
-       .name           = "samsung-keypad",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(samsung_keypad_resources),
-       .resource       = samsung_keypad_resources,
-};
-
-void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
-{
-       struct samsung_keypad_platdata *npd;
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &samsung_device_keypad);
-
-       if (!npd->cfg_gpio)
-               npd->cfg_gpio = samsung_keypad_cfg_gpio;
-}
-#endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
-
-/* LCD Controller */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_lcd_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_LCD, S3C24XX_SZ_LCD),
-       [1] = DEFINE_RES_IRQ(IRQ_LCD),
-};
-
-struct platform_device s3c_device_lcd = {
-       .name           = "s3c2410-lcd",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_lcd_resource),
-       .resource       = s3c_lcd_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-
-void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
-{
-       struct s3c2410fb_mach_info *npd;
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
-       if (npd) {
-               npd->displays = kmemdup(pd->displays,
-                       sizeof(struct s3c2410fb_display) * npd->num_displays,
-                       GFP_KERNEL);
-               if (!npd->displays)
-                       printk(KERN_ERR "no memory for LCD display data\n");
-       } else {
-               printk(KERN_ERR "no memory for LCD platform data\n");
-       }
-}
-#endif /* CONFIG_PLAT_S3C24XX */
-
-/* NAND */
-
-#ifdef CONFIG_S3C_DEV_NAND
-static struct resource s3c_nand_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_NAND, SZ_1M),
-};
-
-struct platform_device s3c_device_nand = {
-       .name           = "s3c2410-nand",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_nand_resource),
-       .resource       = s3c_nand_resource,
-};
-
-/*
- * s3c_nand_copy_set() - copy nand set data
- * @set: The new structure, directly copied from the old.
- *
- * Copy all the fields from the NAND set field from what is probably __initdata
- * to new kernel memory. The code returns 0 if the copy happened correctly or
- * an error code for the calling function to display.
- *
- * Note, we currently do not try and look to see if we've already copied the
- * data in a previous set.
- */
-static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
-{
-       void *ptr;
-       int size;
-
-       size = sizeof(struct mtd_partition) * set->nr_partitions;
-       if (size) {
-               ptr = kmemdup(set->partitions, size, GFP_KERNEL);
-               set->partitions = ptr;
-
-               if (!ptr)
-                       return -ENOMEM;
-       }
-
-       if (set->nr_map && set->nr_chips) {
-               size = sizeof(int) * set->nr_chips;
-               ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
-               set->nr_map = ptr;
-
-               if (!ptr)
-                       return -ENOMEM;
-       }
-
-       return 0;
-}
-
-void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
-{
-       struct s3c2410_platform_nand *npd;
-       int size;
-       int ret;
-
-       /* note, if we get a failure in allocation, we simply drop out of the
-        * function. If there is so little memory available at initialisation
-        * time then there is little chance the system is going to run.
-        */
-
-       npd = s3c_set_platdata(nand, sizeof(*npd), &s3c_device_nand);
-       if (!npd)
-               return;
-
-       /* now see if we need to copy any of the nand set data */
-
-       size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
-       if (size) {
-               struct s3c2410_nand_set *from = npd->sets;
-               struct s3c2410_nand_set *to;
-               int i;
-
-               to = kmemdup(from, size, GFP_KERNEL);
-               npd->sets = to; /* set, even if we failed */
-
-               if (!to) {
-                       printk(KERN_ERR "%s: no memory for sets\n", __func__);
-                       return;
-               }
-
-               for (i = 0; i < npd->nr_sets; i++) {
-                       ret = s3c_nand_copy_set(to);
-                       if (ret) {
-                               printk(KERN_ERR "%s: failed to copy set %d\n",
-                               __func__, i);
-                               return;
-                       }
-                       to++;
-               }
-       }
-}
-#endif /* CONFIG_S3C_DEV_NAND */
-
-/* ONENAND */
-
-#ifdef CONFIG_S3C_DEV_ONENAND
-static struct resource s3c_onenand_resources[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_ONENAND, SZ_1K),
-       [1] = DEFINE_RES_MEM(S3C_PA_ONENAND_BUF, S3C_SZ_ONENAND_BUF),
-       [2] = DEFINE_RES_IRQ(IRQ_ONENAND),
-};
-
-struct platform_device s3c_device_onenand = {
-       .name           = "samsung-onenand",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c_onenand_resources),
-       .resource       = s3c_onenand_resources,
-};
-#endif /* CONFIG_S3C_DEV_ONENAND */
-
-#ifdef CONFIG_S3C64XX_DEV_ONENAND1
-static struct resource s3c64xx_onenand1_resources[] = {
-       [0] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1, SZ_1K),
-       [1] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1_BUF, S3C64XX_SZ_ONENAND1_BUF),
-       [2] = DEFINE_RES_IRQ(IRQ_ONENAND1),
-};
-
-struct platform_device s3c64xx_device_onenand1 = {
-       .name           = "samsung-onenand",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(s3c64xx_onenand1_resources),
-       .resource       = s3c64xx_onenand1_resources,
-};
-
-void __init s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
-{
-       s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
-                        &s3c64xx_device_onenand1);
-}
-#endif /* CONFIG_S3C64XX_DEV_ONENAND1 */
-
-/* PWM Timer */
-
-#ifdef CONFIG_SAMSUNG_DEV_PWM
-static struct resource samsung_pwm_resource[] = {
-       DEFINE_RES_MEM(SAMSUNG_PA_TIMER, SZ_4K),
-};
-
-struct platform_device samsung_device_pwm = {
-       .name           = "samsung-pwm",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(samsung_pwm_resource),
-       .resource       = samsung_pwm_resource,
-};
-
-void __init samsung_pwm_set_platdata(struct samsung_pwm_variant *pd)
-{
-       samsung_device_pwm.dev.platform_data = pd;
-}
-#endif /* CONFIG_SAMSUNG_DEV_PWM */
-
-/* RTC */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_rtc_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_RTC, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_RTC),
-       [2] = DEFINE_RES_IRQ(IRQ_TICK),
-};
-
-struct platform_device s3c_device_rtc = {
-       .name           = "s3c2410-rtc",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_rtc_resource),
-       .resource       = s3c_rtc_resource,
-};
-#endif /* CONFIG_PLAT_S3C24XX */
-
-#ifdef CONFIG_S3C_DEV_RTC
-static struct resource s3c_rtc_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_RTC, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_RTC_ALARM),
-       [2] = DEFINE_RES_IRQ(IRQ_RTC_TIC),
-};
-
-struct platform_device s3c_device_rtc = {
-       .name           = "s3c64xx-rtc",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_rtc_resource),
-       .resource       = s3c_rtc_resource,
-};
-#endif /* CONFIG_S3C_DEV_RTC */
-
-/* SDI */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_sdi_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
-       [1] = DEFINE_RES_IRQ(IRQ_SDI),
-};
-
-struct platform_device s3c_device_sdi = {
-       .name           = "s3c2410-sdi",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_sdi_resource),
-       .resource       = s3c_sdi_resource,
-};
-
-void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
-{
-       s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
-                        &s3c_device_sdi);
-}
-#endif /* CONFIG_PLAT_S3C24XX */
-
-/* SPI */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_spi0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI, SZ_32),
-       [1] = DEFINE_RES_IRQ(IRQ_SPI0),
-};
-
-struct platform_device s3c_device_spi0 = {
-       .name           = "s3c2410-spi",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c_spi0_resource),
-       .resource       = s3c_spi0_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-
-static struct resource s3c_spi1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI1, SZ_32),
-       [1] = DEFINE_RES_IRQ(IRQ_SPI1),
-};
-
-struct platform_device s3c_device_spi1 = {
-       .name           = "s3c2410-spi",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(s3c_spi1_resource),
-       .resource       = s3c_spi1_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-#endif /* CONFIG_PLAT_S3C24XX */
-
-/* Touchscreen */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_ts_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
-       [1] = DEFINE_RES_IRQ(IRQ_TC),
-};
-
-struct platform_device s3c_device_ts = {
-       .name           = "s3c2410-ts",
-       .id             = -1,
-       .dev.parent     = &s3c_device_adc.dev,
-       .num_resources  = ARRAY_SIZE(s3c_ts_resource),
-       .resource       = s3c_ts_resource,
-};
-
-void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
-{
-       s3c_set_platdata(hard_s3c2410ts_info,
-                        sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
-}
-#endif /* CONFIG_PLAT_S3C24XX */
-
-#ifdef CONFIG_SAMSUNG_DEV_TS
-static struct s3c2410_ts_mach_info default_ts_data __initdata = {
-       .delay                  = 10000,
-       .presc                  = 49,
-       .oversampling_shift     = 2,
-};
-
-void __init s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
-{
-       if (!pd)
-               pd = &default_ts_data;
-
-       s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
-                        &s3c_device_adc);
-}
-#endif /* CONFIG_SAMSUNG_DEV_TS */
-
-/* USB */
-
-#ifdef CONFIG_S3C_DEV_USB_HOST
-static struct resource s3c_usb_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_USBHOST, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_USBH),
-};
-
-struct platform_device s3c_device_ohci = {
-       .name           = "s3c2410-ohci",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_usb_resource),
-       .resource       = s3c_usb_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       }
-};
-
-/*
- * s3c_ohci_set_platdata - initialise OHCI device platform data
- * @info: The platform data.
- *
- * This call copies the @info passed in and sets the device .platform_data
- * field to that copy. The @info is copied so that the original can be marked
- * __initdata.
- */
-
-void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
-{
-       s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
-                        &s3c_device_ohci);
-}
-#endif /* CONFIG_S3C_DEV_USB_HOST */
-
-/* USB Device (Gadget) */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_usbgadget_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C24XX_PA_USBDEV, S3C24XX_SZ_USBDEV),
-       [1] = DEFINE_RES_IRQ(IRQ_USBD),
-};
-
-struct platform_device s3c_device_usbgadget = {
-       .name           = "s3c2410-usbgadget",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_usbgadget_resource),
-       .resource       = s3c_usbgadget_resource,
-};
-
-void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
-{
-       s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
-}
-#endif /* CONFIG_PLAT_S3C24XX */
-
-/* USB HSOTG */
-
-#ifdef CONFIG_S3C_DEV_USB_HSOTG
-static struct resource s3c_usb_hsotg_resources[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
-       [1] = DEFINE_RES_IRQ(IRQ_OTG),
-};
-
-struct platform_device s3c_device_usb_hsotg = {
-       .name           = "s3c-hsotg",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_usb_hsotg_resources),
-       .resource       = s3c_usb_hsotg_resources,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       },
-};
-
-void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd)
-{
-       struct dwc2_hsotg_plat *npd;
-
-       npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_usb_hsotg);
-
-       if (!npd->phy_init)
-               npd->phy_init = s3c_usb_phy_init;
-       if (!npd->phy_exit)
-               npd->phy_exit = s3c_usb_phy_exit;
-}
-#endif /* CONFIG_S3C_DEV_USB_HSOTG */
-
-/* USB High Spped 2.0 Device (Gadget) */
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct resource s3c_hsudc_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C2416_PA_HSUDC, S3C2416_SZ_HSUDC),
-       [1] = DEFINE_RES_IRQ(IRQ_USBD),
-};
-
-struct platform_device s3c_device_usb_hsudc = {
-       .name           = "s3c-hsudc",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_hsudc_resource),
-       .resource       = s3c_hsudc_resource,
-       .dev            = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       },
-};
-
-void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
-{
-       s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
-}
-#endif /* CONFIG_PLAT_S3C24XX */
-
-/* WDT */
-
-#ifdef CONFIG_S3C_DEV_WDT
-static struct resource s3c_wdt_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
-       [1] = DEFINE_RES_IRQ(IRQ_WDT),
-};
-
-struct platform_device s3c_device_wdt = {
-       .name           = "s3c2410-wdt",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(s3c_wdt_resource),
-       .resource       = s3c_wdt_resource,
-};
-#endif /* CONFIG_S3C_DEV_WDT */
-
-#ifdef CONFIG_S3C64XX_DEV_SPI0
-static struct resource s3c64xx_spi0_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_SPI0),
-};
-
-struct platform_device s3c64xx_device_spi0 = {
-       .name           = "s3c6410-spi",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(s3c64xx_spi0_resource),
-       .resource       = s3c64xx_spi0_resource,
-       .dev = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       },
-};
-
-void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
-                                               int num_cs)
-{
-       struct s3c64xx_spi_info pd;
-
-       /* Reject invalid configuration */
-       if (!num_cs || src_clk_nr < 0) {
-               pr_err("%s: Invalid SPI configuration\n", __func__);
-               return;
-       }
-
-       pd.num_cs = num_cs;
-       pd.src_clk_nr = src_clk_nr;
-       pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
-
-       s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
-}
-#endif /* CONFIG_S3C64XX_DEV_SPI0 */
-
-#ifdef CONFIG_S3C64XX_DEV_SPI1
-static struct resource s3c64xx_spi1_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_SPI1),
-};
-
-struct platform_device s3c64xx_device_spi1 = {
-       .name           = "s3c6410-spi",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(s3c64xx_spi1_resource),
-       .resource       = s3c64xx_spi1_resource,
-       .dev = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       },
-};
-
-void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
-                                               int num_cs)
-{
-       struct s3c64xx_spi_info pd;
-
-       /* Reject invalid configuration */
-       if (!num_cs || src_clk_nr < 0) {
-               pr_err("%s: Invalid SPI configuration\n", __func__);
-               return;
-       }
-
-       pd.num_cs = num_cs;
-       pd.src_clk_nr = src_clk_nr;
-       pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
-
-       s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
-}
-#endif /* CONFIG_S3C64XX_DEV_SPI1 */
-
-#ifdef CONFIG_S3C64XX_DEV_SPI2
-static struct resource s3c64xx_spi2_resource[] = {
-       [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
-       [1] = DEFINE_RES_IRQ(IRQ_SPI2),
-};
-
-struct platform_device s3c64xx_device_spi2 = {
-       .name           = "s3c6410-spi",
-       .id             = 2,
-       .num_resources  = ARRAY_SIZE(s3c64xx_spi2_resource),
-       .resource       = s3c64xx_spi2_resource,
-       .dev = {
-               .dma_mask               = &samsung_device_dma_mask,
-               .coherent_dma_mask      = DMA_BIT_MASK(32),
-       },
-};
-
-void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
-                                               int num_cs)
-{
-       struct s3c64xx_spi_info pd;
-
-       /* Reject invalid configuration */
-       if (!num_cs || src_clk_nr < 0) {
-               pr_err("%s: Invalid SPI configuration\n", __func__);
-               return;
-       }
-
-       pd.num_cs = num_cs;
-       pd.src_clk_nr = src_clk_nr;
-       pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
-
-       s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
-}
-#endif /* CONFIG_S3C64XX_DEV_SPI2 */
diff --git a/arch/arm/plat-samsung/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
deleted file mode 100644 (file)
index 8955fd6..0000000
+++ /dev/null
@@ -1,1324 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
-//             http://www.samsung.com/
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//      Ben Dooks <ben@simtec.co.uk>
-//      http://armlinux.simtec.co.uk/
-//
-// Samsung - GPIOlib support
-
-#include <linux/kernel.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/device.h>
-#include <linux/ioport.h>
-#include <linux/of.h>
-#include <linux/slab.h>
-#include <linux/of_address.h>
-
-#include <asm/irq.h>
-
-#include <mach/irqs.h>
-#include <mach/map.h>
-#include <mach/regs-gpio.h>
-#include <mach/gpio-samsung.h>
-
-#include <plat/cpu.h>
-#include <plat/gpio-core.h>
-#include <plat/gpio-cfg.h>
-#include <plat/gpio-cfg-helpers.h>
-#include <plat/pm.h>
-
-int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
-                               unsigned int off, samsung_gpio_pull_t pull)
-{
-       void __iomem *reg = chip->base + 0x08;
-       int shift = off * 2;
-       u32 pup;
-
-       pup = __raw_readl(reg);
-       pup &= ~(3 << shift);
-       pup |= pull << shift;
-       __raw_writel(pup, reg);
-
-       return 0;
-}
-
-samsung_gpio_pull_t samsung_gpio_getpull_updown(struct samsung_gpio_chip *chip,
-                                               unsigned int off)
-{
-       void __iomem *reg = chip->base + 0x08;
-       int shift = off * 2;
-       u32 pup = __raw_readl(reg);
-
-       pup >>= shift;
-       pup &= 0x3;
-
-       return (__force samsung_gpio_pull_t)pup;
-}
-
-int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip,
-                        unsigned int off, samsung_gpio_pull_t pull)
-{
-       switch (pull) {
-       case S3C_GPIO_PULL_NONE:
-               pull = 0x01;
-               break;
-       case S3C_GPIO_PULL_UP:
-               pull = 0x00;
-               break;
-       case S3C_GPIO_PULL_DOWN:
-               pull = 0x02;
-               break;
-       }
-       return samsung_gpio_setpull_updown(chip, off, pull);
-}
-
-samsung_gpio_pull_t s3c2443_gpio_getpull(struct samsung_gpio_chip *chip,
-                                        unsigned int off)
-{
-       samsung_gpio_pull_t pull;
-
-       pull = samsung_gpio_getpull_updown(chip, off);
-
-       switch (pull) {
-       case 0x00:
-               pull = S3C_GPIO_PULL_UP;
-               break;
-       case 0x01:
-       case 0x03:
-               pull = S3C_GPIO_PULL_NONE;
-               break;
-       case 0x02:
-               pull = S3C_GPIO_PULL_DOWN;
-               break;
-       }
-
-       return pull;
-}
-
-static int s3c24xx_gpio_setpull_1(struct samsung_gpio_chip *chip,
-                                 unsigned int off, samsung_gpio_pull_t pull,
-                                 samsung_gpio_pull_t updown)
-{
-       void __iomem *reg = chip->base + 0x08;
-       u32 pup = __raw_readl(reg);
-
-       if (pull == updown)
-               pup &= ~(1 << off);
-       else if (pull == S3C_GPIO_PULL_NONE)
-               pup |= (1 << off);
-       else
-               return -EINVAL;
-
-       __raw_writel(pup, reg);
-       return 0;
-}
-
-static samsung_gpio_pull_t s3c24xx_gpio_getpull_1(struct samsung_gpio_chip *chip,
-                                                 unsigned int off,
-                                                 samsung_gpio_pull_t updown)
-{
-       void __iomem *reg = chip->base + 0x08;
-       u32 pup = __raw_readl(reg);
-
-       pup &= (1 << off);
-       return pup ? S3C_GPIO_PULL_NONE : updown;
-}
-
-samsung_gpio_pull_t s3c24xx_gpio_getpull_1up(struct samsung_gpio_chip *chip,
-                                            unsigned int off)
-{
-       return s3c24xx_gpio_getpull_1(chip, off, S3C_GPIO_PULL_UP);
-}
-
-int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip,
-                            unsigned int off, samsung_gpio_pull_t pull)
-{
-       return s3c24xx_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_UP);
-}
-
-samsung_gpio_pull_t s3c24xx_gpio_getpull_1down(struct samsung_gpio_chip *chip,
-                                              unsigned int off)
-{
-       return s3c24xx_gpio_getpull_1(chip, off, S3C_GPIO_PULL_DOWN);
-}
-
-int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip,
-                              unsigned int off, samsung_gpio_pull_t pull)
-{
-       return s3c24xx_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN);
-}
-
-/*
- * samsung_gpio_setcfg_2bit - Samsung 2bit style GPIO configuration.
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- * @cfg: The configuration value to set.
- *
- * This helper deal with the GPIO cases where the control register
- * has two bits of configuration per gpio, which have the following
- * functions:
- *     00 = input
- *     01 = output
- *     1x = special function
- */
-
-static int samsung_gpio_setcfg_2bit(struct samsung_gpio_chip *chip,
-                                   unsigned int off, unsigned int cfg)
-{
-       void __iomem *reg = chip->base;
-       unsigned int shift = off * 2;
-       u32 con;
-
-       if (samsung_gpio_is_cfg_special(cfg)) {
-               cfg &= 0xf;
-               if (cfg > 3)
-                       return -EINVAL;
-
-               cfg <<= shift;
-       }
-
-       con = __raw_readl(reg);
-       con &= ~(0x3 << shift);
-       con |= cfg;
-       __raw_writel(con, reg);
-
-       return 0;
-}
-
-/*
- * samsung_gpio_getcfg_2bit - Samsung 2bit style GPIO configuration read.
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- *
- * The reverse of samsung_gpio_setcfg_2bit(). Will return a value which
- * could be directly passed back to samsung_gpio_setcfg_2bit(), from the
- * S3C_GPIO_SPECIAL() macro.
- */
-
-static unsigned int samsung_gpio_getcfg_2bit(struct samsung_gpio_chip *chip,
-                                            unsigned int off)
-{
-       u32 con;
-
-       con = __raw_readl(chip->base);
-       con >>= off * 2;
-       con &= 3;
-
-       /* this conversion works for IN and OUT as well as special mode */
-       return S3C_GPIO_SPECIAL(con);
-}
-
-/*
- * samsung_gpio_setcfg_4bit - Samsung 4bit single register GPIO config.
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- * @cfg: The configuration value to set.
- *
- * This helper deal with the GPIO cases where the control register has 4 bits
- * of control per GPIO, generally in the form of:
- *     0000 = Input
- *     0001 = Output
- *     others = Special functions (dependent on bank)
- *
- * Note, since the code to deal with the case where there are two control
- * registers instead of one, we do not have a separate set of functions for
- * each case.
- */
-
-static int samsung_gpio_setcfg_4bit(struct samsung_gpio_chip *chip,
-                                   unsigned int off, unsigned int cfg)
-{
-       void __iomem *reg = chip->base;
-       unsigned int shift = (off & 7) * 4;
-       u32 con;
-
-       if (off < 8 && chip->chip.ngpio > 8)
-               reg -= 4;
-
-       if (samsung_gpio_is_cfg_special(cfg)) {
-               cfg &= 0xf;
-               cfg <<= shift;
-       }
-
-       con = __raw_readl(reg);
-       con &= ~(0xf << shift);
-       con |= cfg;
-       __raw_writel(con, reg);
-
-       return 0;
-}
-
-/*
- * samsung_gpio_getcfg_4bit - Samsung 4bit single register GPIO config read.
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- *
- * The reverse of samsung_gpio_setcfg_4bit(), turning a gpio configuration
- * register setting into a value the software can use, such as could be passed
- * to samsung_gpio_setcfg_4bit().
- *
- * @sa samsung_gpio_getcfg_2bit
- */
-
-static unsigned samsung_gpio_getcfg_4bit(struct samsung_gpio_chip *chip,
-                                        unsigned int off)
-{
-       void __iomem *reg = chip->base;
-       unsigned int shift = (off & 7) * 4;
-       u32 con;
-
-       if (off < 8 && chip->chip.ngpio > 8)
-               reg -= 4;
-
-       con = __raw_readl(reg);
-       con >>= shift;
-       con &= 0xf;
-
-       /* this conversion works for IN and OUT as well as special mode */
-       return S3C_GPIO_SPECIAL(con);
-}
-
-#ifdef CONFIG_PLAT_S3C24XX
-/*
- * s3c24xx_gpio_setcfg_abank - S3C24XX style GPIO configuration (Bank A)
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- * @cfg: The configuration value to set.
- *
- * This helper deal with the GPIO cases where the control register
- * has one bit of configuration for the gpio, where setting the bit
- * means the pin is in special function mode and unset means output.
- */
-
-static int s3c24xx_gpio_setcfg_abank(struct samsung_gpio_chip *chip,
-                                    unsigned int off, unsigned int cfg)
-{
-       void __iomem *reg = chip->base;
-       unsigned int shift = off;
-       u32 con;
-
-       if (samsung_gpio_is_cfg_special(cfg)) {
-               cfg &= 0xf;
-
-               /* Map output to 0, and SFN2 to 1 */
-               cfg -= 1;
-               if (cfg > 1)
-                       return -EINVAL;
-
-               cfg <<= shift;
-       }
-
-       con = __raw_readl(reg);
-       con &= ~(0x1 << shift);
-       con |= cfg;
-       __raw_writel(con, reg);
-
-       return 0;
-}
-
-/*
- * s3c24xx_gpio_getcfg_abank - S3C24XX style GPIO configuration read (Bank A)
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- *
- * The reverse of s3c24xx_gpio_setcfg_abank() turning an GPIO into a usable
- * GPIO configuration value.
- *
- * @sa samsung_gpio_getcfg_2bit
- * @sa samsung_gpio_getcfg_4bit
- */
-
-static unsigned s3c24xx_gpio_getcfg_abank(struct samsung_gpio_chip *chip,
-                                         unsigned int off)
-{
-       u32 con;
-
-       con = __raw_readl(chip->base);
-       con >>= off;
-       con &= 1;
-       con++;
-
-       return S3C_GPIO_SFN(con);
-}
-#endif
-
-static void __init samsung_gpiolib_set_cfg(struct samsung_gpio_cfg *chipcfg,
-                                          int nr_chips)
-{
-       for (; nr_chips > 0; nr_chips--, chipcfg++) {
-               if (!chipcfg->set_config)
-                       chipcfg->set_config = samsung_gpio_setcfg_4bit;
-               if (!chipcfg->get_config)
-                       chipcfg->get_config = samsung_gpio_getcfg_4bit;
-               if (!chipcfg->set_pull)
-                       chipcfg->set_pull = samsung_gpio_setpull_updown;
-               if (!chipcfg->get_pull)
-                       chipcfg->get_pull = samsung_gpio_getpull_updown;
-       }
-}
-
-struct samsung_gpio_cfg s3c24xx_gpiocfg_default = {
-       .set_config     = samsung_gpio_setcfg_2bit,
-       .get_config     = samsung_gpio_getcfg_2bit,
-};
-
-#ifdef CONFIG_PLAT_S3C24XX
-static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = {
-       .set_config     = s3c24xx_gpio_setcfg_abank,
-       .get_config     = s3c24xx_gpio_getcfg_abank,
-};
-#endif
-
-static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
-       [0] = {
-               .cfg_eint       = 0x0,
-       },
-       [1] = {
-               .cfg_eint       = 0x3,
-       },
-       [2] = {
-               .cfg_eint       = 0x7,
-       },
-       [3] = {
-               .cfg_eint       = 0xF,
-       },
-       [4] = {
-               .cfg_eint       = 0x0,
-               .set_config     = samsung_gpio_setcfg_2bit,
-               .get_config     = samsung_gpio_getcfg_2bit,
-       },
-       [5] = {
-               .cfg_eint       = 0x2,
-               .set_config     = samsung_gpio_setcfg_2bit,
-               .get_config     = samsung_gpio_getcfg_2bit,
-       },
-       [6] = {
-               .cfg_eint       = 0x3,
-               .set_config     = samsung_gpio_setcfg_2bit,
-               .get_config     = samsung_gpio_getcfg_2bit,
-       },
-       [7] = {
-               .set_config     = samsung_gpio_setcfg_2bit,
-               .get_config     = samsung_gpio_getcfg_2bit,
-       },
-};
-
-/*
- * Default routines for controlling GPIO, based on the original S3C24XX
- * GPIO functions which deal with the case where each gpio bank of the
- * chip is as following:
- *
- * base + 0x00: Control register, 2 bits per gpio
- *             gpio n: 2 bits starting at (2*n)
- *             00 = input, 01 = output, others mean special-function
- * base + 0x04: Data register, 1 bit per gpio
- *             bit n: data bit n
-*/
-
-static int samsung_gpiolib_2bit_input(struct gpio_chip *chip, unsigned offset)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       unsigned long flags;
-       unsigned long con;
-
-       samsung_gpio_lock(ourchip, flags);
-
-       con = __raw_readl(base + 0x00);
-       con &= ~(3 << (offset * 2));
-
-       __raw_writel(con, base + 0x00);
-
-       samsung_gpio_unlock(ourchip, flags);
-       return 0;
-}
-
-static int samsung_gpiolib_2bit_output(struct gpio_chip *chip,
-                                      unsigned offset, int value)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       unsigned long flags;
-       unsigned long dat;
-       unsigned long con;
-
-       samsung_gpio_lock(ourchip, flags);
-
-       dat = __raw_readl(base + 0x04);
-       dat &= ~(1 << offset);
-       if (value)
-               dat |= 1 << offset;
-       __raw_writel(dat, base + 0x04);
-
-       con = __raw_readl(base + 0x00);
-       con &= ~(3 << (offset * 2));
-       con |= 1 << (offset * 2);
-
-       __raw_writel(con, base + 0x00);
-       __raw_writel(dat, base + 0x04);
-
-       samsung_gpio_unlock(ourchip, flags);
-       return 0;
-}
-
-/*
- * The samsung_gpiolib_4bit routines are to control the gpio banks where
- * the gpio configuration register (GPxCON) has 4 bits per GPIO, as the
- * following example:
- *
- * base + 0x00: Control register, 4 bits per gpio
- *             gpio n: 4 bits starting at (4*n)
- *             0000 = input, 0001 = output, others mean special-function
- * base + 0x04: Data register, 1 bit per gpio
- *             bit n: data bit n
- *
- * Note, since the data register is one bit per gpio and is at base + 0x4
- * we can use samsung_gpiolib_get and samsung_gpiolib_set to change the
- * state of the output.
- */
-
-static int samsung_gpiolib_4bit_input(struct gpio_chip *chip,
-                                     unsigned int offset)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       unsigned long con;
-
-       con = __raw_readl(base + GPIOCON_OFF);
-       if (ourchip->bitmap_gpio_int & BIT(offset))
-               con |= 0xf << con_4bit_shift(offset);
-       else
-               con &= ~(0xf << con_4bit_shift(offset));
-       __raw_writel(con, base + GPIOCON_OFF);
-
-       pr_debug("%s: %p: CON now %08lx\n", __func__, base, con);
-
-       return 0;
-}
-
-static int samsung_gpiolib_4bit_output(struct gpio_chip *chip,
-                                      unsigned int offset, int value)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       unsigned long con;
-       unsigned long dat;
-
-       con = __raw_readl(base + GPIOCON_OFF);
-       con &= ~(0xf << con_4bit_shift(offset));
-       con |= 0x1 << con_4bit_shift(offset);
-
-       dat = __raw_readl(base + GPIODAT_OFF);
-
-       if (value)
-               dat |= 1 << offset;
-       else
-               dat &= ~(1 << offset);
-
-       __raw_writel(dat, base + GPIODAT_OFF);
-       __raw_writel(con, base + GPIOCON_OFF);
-       __raw_writel(dat, base + GPIODAT_OFF);
-
-       pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
-
-       return 0;
-}
-
-/*
- * The next set of routines are for the case where the GPIO configuration
- * registers are 4 bits per GPIO but there is more than one register (the
- * bank has more than 8 GPIOs.
- *
- * This case is the similar to the 4 bit case, but the registers are as
- * follows:
- *
- * base + 0x00: Control register, 4 bits per gpio (lower 8 GPIOs)
- *             gpio n: 4 bits starting at (4*n)
- *             0000 = input, 0001 = output, others mean special-function
- * base + 0x04: Control register, 4 bits per gpio (up to 8 additions GPIOs)
- *             gpio n: 4 bits starting at (4*n)
- *             0000 = input, 0001 = output, others mean special-function
- * base + 0x08: Data register, 1 bit per gpio
- *             bit n: data bit n
- *
- * To allow us to use the samsung_gpiolib_get and samsung_gpiolib_set
- * routines we store the 'base + 0x4' address so that these routines see
- * the data register at ourchip->base + 0x04.
- */
-
-static int samsung_gpiolib_4bit2_input(struct gpio_chip *chip,
-                                      unsigned int offset)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       void __iomem *regcon = base;
-       unsigned long con;
-
-       if (offset > 7)
-               offset -= 8;
-       else
-               regcon -= 4;
-
-       con = __raw_readl(regcon);
-       con &= ~(0xf << con_4bit_shift(offset));
-       __raw_writel(con, regcon);
-
-       pr_debug("%s: %p: CON %08lx\n", __func__, base, con);
-
-       return 0;
-}
-
-static int samsung_gpiolib_4bit2_output(struct gpio_chip *chip,
-                                       unsigned int offset, int value)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       void __iomem *regcon = base;
-       unsigned long con;
-       unsigned long dat;
-       unsigned con_offset = offset;
-
-       if (con_offset > 7)
-               con_offset -= 8;
-       else
-               regcon -= 4;
-
-       con = __raw_readl(regcon);
-       con &= ~(0xf << con_4bit_shift(con_offset));
-       con |= 0x1 << con_4bit_shift(con_offset);
-
-       dat = __raw_readl(base + GPIODAT_OFF);
-
-       if (value)
-               dat |= 1 << offset;
-       else
-               dat &= ~(1 << offset);
-
-       __raw_writel(dat, base + GPIODAT_OFF);
-       __raw_writel(con, regcon);
-       __raw_writel(dat, base + GPIODAT_OFF);
-
-       pr_debug("%s: %p: CON %08lx, DAT %08lx\n", __func__, base, con, dat);
-
-       return 0;
-}
-
-#ifdef CONFIG_PLAT_S3C24XX
-/* The next set of routines are for the case of s3c24xx bank a */
-
-static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
-{
-       return -EINVAL;
-}
-
-static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
-                                       unsigned offset, int value)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       unsigned long flags;
-       unsigned long dat;
-       unsigned long con;
-
-       local_irq_save(flags);
-
-       con = __raw_readl(base + 0x00);
-       dat = __raw_readl(base + 0x04);
-
-       dat &= ~(1 << offset);
-       if (value)
-               dat |= 1 << offset;
-
-       __raw_writel(dat, base + 0x04);
-
-       con &= ~(1 << offset);
-
-       __raw_writel(con, base + 0x00);
-       __raw_writel(dat, base + 0x04);
-
-       local_irq_restore(flags);
-       return 0;
-}
-#endif
-
-static void samsung_gpiolib_set(struct gpio_chip *chip,
-                               unsigned offset, int value)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       void __iomem *base = ourchip->base;
-       unsigned long flags;
-       unsigned long dat;
-
-       samsung_gpio_lock(ourchip, flags);
-
-       dat = __raw_readl(base + 0x04);
-       dat &= ~(1 << offset);
-       if (value)
-               dat |= 1 << offset;
-       __raw_writel(dat, base + 0x04);
-
-       samsung_gpio_unlock(ourchip, flags);
-}
-
-static int samsung_gpiolib_get(struct gpio_chip *chip, unsigned offset)
-{
-       struct samsung_gpio_chip *ourchip = to_samsung_gpio(chip);
-       unsigned long val;
-
-       val = __raw_readl(ourchip->base + 0x04);
-       val >>= offset;
-       val &= 1;
-
-       return val;
-}
-
-/*
- * CONFIG_S3C_GPIO_TRACK enables the tracking of the s3c specific gpios
- * for use with the configuration calls, and other parts of the s3c gpiolib
- * support code.
- *
- * Not all s3c support code will need this, as some configurations of cpu
- * may only support one or two different configuration options and have an
- * easy gpio to samsung_gpio_chip mapping function. If this is the case, then
- * the machine support file should provide its own samsung_gpiolib_getchip()
- * and any other necessary functions.
- */
-
-#ifdef CONFIG_S3C_GPIO_TRACK
-struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
-
-static __init void s3c_gpiolib_track(struct samsung_gpio_chip *chip)
-{
-       unsigned int gpn;
-       int i;
-
-       gpn = chip->chip.base;
-       for (i = 0; i < chip->chip.ngpio; i++, gpn++) {
-               BUG_ON(gpn >= ARRAY_SIZE(s3c_gpios));
-               s3c_gpios[gpn] = chip;
-       }
-}
-#endif /* CONFIG_S3C_GPIO_TRACK */
-
-/*
- * samsung_gpiolib_add() - add the Samsung gpio_chip.
- * @chip: The chip to register
- *
- * This is a wrapper to gpiochip_add() that takes our specific gpio chip
- * information and makes the necessary alterations for the platform and
- * notes the information for use with the configuration systems and any
- * other parts of the system.
- */
-
-static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
-{
-       struct gpio_chip *gc = &chip->chip;
-       int ret;
-
-       BUG_ON(!chip->base);
-       BUG_ON(!gc->label);
-       BUG_ON(!gc->ngpio);
-
-       spin_lock_init(&chip->lock);
-
-       if (!gc->direction_input)
-               gc->direction_input = samsung_gpiolib_2bit_input;
-       if (!gc->direction_output)
-               gc->direction_output = samsung_gpiolib_2bit_output;
-       if (!gc->set)
-               gc->set = samsung_gpiolib_set;
-       if (!gc->get)
-               gc->get = samsung_gpiolib_get;
-
-#ifdef CONFIG_PM
-       if (chip->pm != NULL) {
-               if (!chip->pm->save || !chip->pm->resume)
-                       pr_err("gpio: %s has missing PM functions\n",
-                              gc->label);
-       } else
-               pr_err("gpio: %s has no PM function\n", gc->label);
-#endif
-
-       /* gpiochip_add() prints own failure message on error. */
-       ret = gpiochip_add_data(gc, chip);
-       if (ret >= 0)
-               s3c_gpiolib_track(chip);
-}
-
-static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip,
-                                            int nr_chips, void __iomem *base)
-{
-       int i;
-       struct gpio_chip *gc = &chip->chip;
-
-       for (i = 0 ; i < nr_chips; i++, chip++) {
-               /* skip banks not present on SoC */
-               if (chip->chip.base >= S3C_GPIO_END)
-                       continue;
-
-               if (!chip->config)
-                       chip->config = &s3c24xx_gpiocfg_default;
-               if (!chip->pm)
-                       chip->pm = __gpio_pm(&samsung_gpio_pm_2bit);
-               if ((base != NULL) && (chip->base == NULL))
-                       chip->base = base + ((i) * 0x10);
-
-               if (!gc->direction_input)
-                       gc->direction_input = samsung_gpiolib_2bit_input;
-               if (!gc->direction_output)
-                       gc->direction_output = samsung_gpiolib_2bit_output;
-
-               samsung_gpiolib_add(chip);
-       }
-}
-
-static void __init samsung_gpiolib_add_2bit_chips(struct samsung_gpio_chip *chip,
-                                                 int nr_chips, void __iomem *base,
-                                                 unsigned int offset)
-{
-       int i;
-
-       for (i = 0 ; i < nr_chips; i++, chip++) {
-               chip->chip.direction_input = samsung_gpiolib_2bit_input;
-               chip->chip.direction_output = samsung_gpiolib_2bit_output;
-
-               if (!chip->config)
-                       chip->config = &samsung_gpio_cfgs[7];
-               if (!chip->pm)
-                       chip->pm = __gpio_pm(&samsung_gpio_pm_2bit);
-               if ((base != NULL) && (chip->base == NULL))
-                       chip->base = base + ((i) * offset);
-
-               samsung_gpiolib_add(chip);
-       }
-}
-
-/*
- * samsung_gpiolib_add_4bit_chips - 4bit single register GPIO config.
- * @chip: The gpio chip that is being configured.
- * @nr_chips: The no of chips (gpio ports) for the GPIO being configured.
- *
- * This helper deal with the GPIO cases where the control register has 4 bits
- * of control per GPIO, generally in the form of:
- * 0000 = Input
- * 0001 = Output
- * others = Special functions (dependent on bank)
- *
- * Note, since the code to deal with the case where there are two control
- * registers instead of one, we do not have a separate set of function
- * (samsung_gpiolib_add_4bit2_chips)for each case.
- */
-
-static void __init samsung_gpiolib_add_4bit_chips(struct samsung_gpio_chip *chip,
-                                                 int nr_chips, void __iomem *base)
-{
-       int i;
-
-       for (i = 0 ; i < nr_chips; i++, chip++) {
-               chip->chip.direction_input = samsung_gpiolib_4bit_input;
-               chip->chip.direction_output = samsung_gpiolib_4bit_output;
-
-               if (!chip->config)
-                       chip->config = &samsung_gpio_cfgs[2];
-               if (!chip->pm)
-                       chip->pm = __gpio_pm(&samsung_gpio_pm_4bit);
-               if ((base != NULL) && (chip->base == NULL))
-                       chip->base = base + ((i) * 0x20);
-
-               chip->bitmap_gpio_int = 0;
-
-               samsung_gpiolib_add(chip);
-       }
-}
-
-static void __init samsung_gpiolib_add_4bit2_chips(struct samsung_gpio_chip *chip,
-                                                  int nr_chips)
-{
-       for (; nr_chips > 0; nr_chips--, chip++) {
-               chip->chip.direction_input = samsung_gpiolib_4bit2_input;
-               chip->chip.direction_output = samsung_gpiolib_4bit2_output;
-
-               if (!chip->config)
-                       chip->config = &samsung_gpio_cfgs[2];
-               if (!chip->pm)
-                       chip->pm = __gpio_pm(&samsung_gpio_pm_4bit);
-
-               samsung_gpiolib_add(chip);
-       }
-}
-
-int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
-{
-       struct samsung_gpio_chip *samsung_chip = gpiochip_get_data(chip);
-
-       return samsung_chip->irq_base + offset;
-}
-
-#ifdef CONFIG_PLAT_S3C24XX
-static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset)
-{
-       if (offset < 4) {
-               if (soc_is_s3c2412())
-                       return IRQ_EINT0_2412 + offset;
-               else
-                       return IRQ_EINT0 + offset;
-       }
-
-       if (offset < 8)
-               return IRQ_EINT4 + offset - 4;
-
-       return -EINVAL;
-}
-#endif
-
-#ifdef CONFIG_ARCH_S3C64XX
-static int s3c64xx_gpiolib_mbank_to_irq(struct gpio_chip *chip, unsigned pin)
-{
-       return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO;
-}
-
-static int s3c64xx_gpiolib_lbank_to_irq(struct gpio_chip *chip, unsigned pin)
-{
-       return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO;
-}
-#endif
-
-struct samsung_gpio_chip s3c24xx_gpios[] = {
-#ifdef CONFIG_PLAT_S3C24XX
-       {
-               .config = &s3c24xx_gpiocfg_banka,
-               .chip   = {
-                       .base                   = S3C2410_GPA(0),
-                       .owner                  = THIS_MODULE,
-                       .label                  = "GPIOA",
-                       .ngpio                  = 27,
-                       .direction_input        = s3c24xx_gpiolib_banka_input,
-                       .direction_output       = s3c24xx_gpiolib_banka_output,
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C2410_GPB(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOB",
-                       .ngpio  = 11,
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C2410_GPC(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOC",
-                       .ngpio  = 16,
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C2410_GPD(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOD",
-                       .ngpio  = 16,
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C2410_GPE(0),
-                       .label  = "GPIOE",
-                       .owner  = THIS_MODULE,
-                       .ngpio  = 16,
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C2410_GPF(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOF",
-                       .ngpio  = 8,
-                       .to_irq = s3c24xx_gpiolib_fbank_to_irq,
-               },
-       }, {
-               .irq_base = IRQ_EINT8,
-               .chip   = {
-                       .base   = S3C2410_GPG(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOG",
-                       .ngpio  = 16,
-                       .to_irq = samsung_gpiolib_to_irq,
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C2410_GPH(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOH",
-                       .ngpio  = 15,
-               },
-       },
-               /* GPIOS for the S3C2443 and later devices. */
-       {
-               .base   = S3C2440_GPJCON,
-               .chip   = {
-                       .base   = S3C2410_GPJ(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOJ",
-                       .ngpio  = 16,
-               },
-       }, {
-               .base   = S3C2443_GPKCON,
-               .chip   = {
-                       .base   = S3C2410_GPK(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOK",
-                       .ngpio  = 16,
-               },
-       }, {
-               .base   = S3C2443_GPLCON,
-               .chip   = {
-                       .base   = S3C2410_GPL(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOL",
-                       .ngpio  = 15,
-               },
-       }, {
-               .base   = S3C2443_GPMCON,
-               .chip   = {
-                       .base   = S3C2410_GPM(0),
-                       .owner  = THIS_MODULE,
-                       .label  = "GPIOM",
-                       .ngpio  = 2,
-               },
-       },
-#endif
-};
-
-/*
- * GPIO bank summary:
- *
- * Bank        GPIOs   Style   SlpCon  ExtInt Group
- * A   8       4Bit    Yes     1
- * B   7       4Bit    Yes     1
- * C   8       4Bit    Yes     2
- * D   5       4Bit    Yes     3
- * E   5       4Bit    Yes     None
- * F   16      2Bit    Yes     4 [1]
- * G   7       4Bit    Yes     5
- * H   10      4Bit[2] Yes     6
- * I   16      2Bit    Yes     None
- * J   12      2Bit    Yes     None
- * K   16      4Bit[2] No      None
- * L   15      4Bit[2] No      None
- * M   6       4Bit    No      IRQ_EINT
- * N   16      2Bit    No      IRQ_EINT
- * O   16      2Bit    Yes     7
- * P   15      2Bit    Yes     8
- * Q   9       2Bit    Yes     9
- *
- * [1] BANKF pins 14,15 do not form part of the external interrupt sources
- * [2] BANK has two control registers, GPxCON0 and GPxCON1
- */
-
-static struct samsung_gpio_chip s3c64xx_gpios_4bit[] = {
-#ifdef CONFIG_ARCH_S3C64XX
-       {
-               .chip   = {
-                       .base   = S3C64XX_GPA(0),
-                       .ngpio  = S3C64XX_GPIO_A_NR,
-                       .label  = "GPA",
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C64XX_GPB(0),
-                       .ngpio  = S3C64XX_GPIO_B_NR,
-                       .label  = "GPB",
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C64XX_GPC(0),
-                       .ngpio  = S3C64XX_GPIO_C_NR,
-                       .label  = "GPC",
-               },
-       }, {
-               .chip   = {
-                       .base   = S3C64XX_GPD(0),
-                       .ngpio  = S3C64XX_GPIO_D_NR,
-                       .label  = "GPD",
-               },
-       }, {
-               .config = &samsung_gpio_cfgs[0],
-               .chip   = {
-                       .base   = S3C64XX_GPE(0),
-                       .ngpio  = S3C64XX_GPIO_E_NR,
-                       .label  = "GPE",
-               },
-       }, {
-               .base   = S3C64XX_GPG_BASE,
-               .chip   = {
-                       .base   = S3C64XX_GPG(0),
-                       .ngpio  = S3C64XX_GPIO_G_NR,
-                       .label  = "GPG",
-               },
-       }, {
-               .base   = S3C64XX_GPM_BASE,
-               .config = &samsung_gpio_cfgs[1],
-               .chip   = {
-                       .base   = S3C64XX_GPM(0),
-                       .ngpio  = S3C64XX_GPIO_M_NR,
-                       .label  = "GPM",
-                       .to_irq = s3c64xx_gpiolib_mbank_to_irq,
-               },
-       },
-#endif
-};
-
-static struct samsung_gpio_chip s3c64xx_gpios_4bit2[] = {
-#ifdef CONFIG_ARCH_S3C64XX
-       {
-               .base   = S3C64XX_GPH_BASE + 0x4,
-               .chip   = {
-                       .base   = S3C64XX_GPH(0),
-                       .ngpio  = S3C64XX_GPIO_H_NR,
-                       .label  = "GPH",
-               },
-       }, {
-               .base   = S3C64XX_GPK_BASE + 0x4,
-               .config = &samsung_gpio_cfgs[0],
-               .chip   = {
-                       .base   = S3C64XX_GPK(0),
-                       .ngpio  = S3C64XX_GPIO_K_NR,
-                       .label  = "GPK",
-               },
-       }, {
-               .base   = S3C64XX_GPL_BASE + 0x4,
-               .config = &samsung_gpio_cfgs[1],
-               .chip   = {
-                       .base   = S3C64XX_GPL(0),
-                       .ngpio  = S3C64XX_GPIO_L_NR,
-                       .label  = "GPL",
-                       .to_irq = s3c64xx_gpiolib_lbank_to_irq,
-               },
-       },
-#endif
-};
-
-static struct samsung_gpio_chip s3c64xx_gpios_2bit[] = {
-#ifdef CONFIG_ARCH_S3C64XX
-       {
-               .base   = S3C64XX_GPF_BASE,
-               .config = &samsung_gpio_cfgs[6],
-               .chip   = {
-                       .base   = S3C64XX_GPF(0),
-                       .ngpio  = S3C64XX_GPIO_F_NR,
-                       .label  = "GPF",
-               },
-       }, {
-               .config = &samsung_gpio_cfgs[7],
-               .chip   = {
-                       .base   = S3C64XX_GPI(0),
-                       .ngpio  = S3C64XX_GPIO_I_NR,
-                       .label  = "GPI",
-               },
-       }, {
-               .config = &samsung_gpio_cfgs[7],
-               .chip   = {
-                       .base   = S3C64XX_GPJ(0),
-                       .ngpio  = S3C64XX_GPIO_J_NR,
-                       .label  = "GPJ",
-               },
-       }, {
-               .config = &samsung_gpio_cfgs[6],
-               .chip   = {
-                       .base   = S3C64XX_GPO(0),
-                       .ngpio  = S3C64XX_GPIO_O_NR,
-                       .label  = "GPO",
-               },
-       }, {
-               .config = &samsung_gpio_cfgs[6],
-               .chip   = {
-                       .base   = S3C64XX_GPP(0),
-                       .ngpio  = S3C64XX_GPIO_P_NR,
-                       .label  = "GPP",
-               },
-       }, {
-               .config = &samsung_gpio_cfgs[6],
-               .chip   = {
-                       .base   = S3C64XX_GPQ(0),
-                       .ngpio  = S3C64XX_GPIO_Q_NR,
-                       .label  = "GPQ",
-               },
-       }, {
-               .base   = S3C64XX_GPN_BASE,
-               .irq_base = IRQ_EINT(0),
-               .config = &samsung_gpio_cfgs[5],
-               .chip   = {
-                       .base   = S3C64XX_GPN(0),
-                       .ngpio  = S3C64XX_GPIO_N_NR,
-                       .label  = "GPN",
-                       .to_irq = samsung_gpiolib_to_irq,
-               },
-       },
-#endif
-};
-
-/* TODO: cleanup soc_is_* */
-static __init int samsung_gpiolib_init(void)
-{
-       /*
-        * Currently there are two drivers that can provide GPIO support for
-        * Samsung SoCs. For device tree enabled platforms, the new
-        * pinctrl-samsung driver is used, providing both GPIO and pin control
-        * interfaces. For legacy (non-DT) platforms this driver is used.
-        */
-       if (of_have_populated_dt())
-               return 0;
-
-       if (soc_is_s3c24xx()) {
-               samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
-                               ARRAY_SIZE(samsung_gpio_cfgs));
-               s3c24xx_gpiolib_add_chips(s3c24xx_gpios,
-                               ARRAY_SIZE(s3c24xx_gpios), S3C24XX_VA_GPIO);
-       } else if (soc_is_s3c64xx()) {
-               samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
-                               ARRAY_SIZE(samsung_gpio_cfgs));
-               samsung_gpiolib_add_2bit_chips(s3c64xx_gpios_2bit,
-                               ARRAY_SIZE(s3c64xx_gpios_2bit),
-                               S3C64XX_VA_GPIO + 0xE0, 0x20);
-               samsung_gpiolib_add_4bit_chips(s3c64xx_gpios_4bit,
-                               ARRAY_SIZE(s3c64xx_gpios_4bit),
-                               S3C64XX_VA_GPIO);
-               samsung_gpiolib_add_4bit2_chips(s3c64xx_gpios_4bit2,
-                               ARRAY_SIZE(s3c64xx_gpios_4bit2));
-       }
-
-       return 0;
-}
-core_initcall(samsung_gpiolib_init);
-
-int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
-{
-       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
-       unsigned long flags;
-       int offset;
-       int ret;
-
-       if (!chip)
-               return -EINVAL;
-
-       offset = pin - chip->chip.base;
-
-       samsung_gpio_lock(chip, flags);
-       ret = samsung_gpio_do_setcfg(chip, offset, config);
-       samsung_gpio_unlock(chip, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(s3c_gpio_cfgpin);
-
-int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
-                         unsigned int cfg)
-{
-       int ret;
-
-       for (; nr > 0; nr--, start++) {
-               ret = s3c_gpio_cfgpin(start, cfg);
-               if (ret != 0)
-                       return ret;
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range);
-
-int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
-                         unsigned int cfg, samsung_gpio_pull_t pull)
-{
-       int ret;
-
-       for (; nr > 0; nr--, start++) {
-               s3c_gpio_setpull(start, pull);
-               ret = s3c_gpio_cfgpin(start, cfg);
-               if (ret != 0)
-                       return ret;
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range);
-
-unsigned s3c_gpio_getcfg(unsigned int pin)
-{
-       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
-       unsigned long flags;
-       unsigned ret = 0;
-       int offset;
-
-       if (chip) {
-               offset = pin - chip->chip.base;
-
-               samsung_gpio_lock(chip, flags);
-               ret = samsung_gpio_do_getcfg(chip, offset);
-               samsung_gpio_unlock(chip, flags);
-       }
-
-       return ret;
-}
-EXPORT_SYMBOL(s3c_gpio_getcfg);
-
-int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull)
-{
-       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
-       unsigned long flags;
-       int offset, ret;
-
-       if (!chip)
-               return -EINVAL;
-
-       offset = pin - chip->chip.base;
-
-       samsung_gpio_lock(chip, flags);
-       ret = samsung_gpio_do_setpull(chip, offset, pull);
-       samsung_gpio_unlock(chip, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(s3c_gpio_setpull);
-
-samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin)
-{
-       struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
-       unsigned long flags;
-       int offset;
-       u32 pup = 0;
-
-       if (chip) {
-               offset = pin - chip->chip.base;
-
-               samsung_gpio_lock(chip, flags);
-               pup = samsung_gpio_do_getpull(chip, offset);
-               samsung_gpio_unlock(chip, flags);
-       }
-
-       return (__force samsung_gpio_pull_t)pup;
-}
-EXPORT_SYMBOL(s3c_gpio_getpull);
-
-#ifdef CONFIG_PLAT_S3C24XX
-unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change)
-{
-       unsigned long flags;
-       unsigned long misccr;
-
-       local_irq_save(flags);
-       misccr = __raw_readl(S3C24XX_MISCCR);
-       misccr &= ~clear;
-       misccr ^= change;
-       __raw_writel(misccr, S3C24XX_MISCCR);
-       local_irq_restore(flags);
-
-       return misccr;
-}
-EXPORT_SYMBOL(s3c2410_modify_misccr);
-#endif
diff --git a/arch/arm/plat-samsung/include/plat/adc-core.h b/arch/arm/plat-samsung/include/plat/adc-core.h
deleted file mode 100644 (file)
index 039f686..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * Samsung ADC Controller core functions
- */
-
-#ifndef __ASM_PLAT_ADC_CORE_H
-#define __ASM_PLAT_ADC_CORE_H __FILE__
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
- */
-
-/* re-define device name depending on support. */
-static inline void s3c_adc_setname(char *name)
-{
-#if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX)
-       s3c_device_adc.name = name;
-#endif
-}
-
-#endif /* __ASM_PLAT_ADC_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/adc.h b/arch/arm/plat-samsung/include/plat/adc.h
deleted file mode 100644 (file)
index 74d1a46..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/   
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C ADC driver information
- */
-
-#ifndef __ASM_PLAT_ADC_H
-#define __ASM_PLAT_ADC_H __FILE__
-
-struct s3c_adc_client;
-struct platform_device;
-
-extern int s3c_adc_start(struct s3c_adc_client *client,
-                        unsigned int channel, unsigned int nr_samples);
-
-extern int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch);
-
-extern struct s3c_adc_client *
-       s3c_adc_register(struct platform_device *pdev,
-                        void (*select)(struct s3c_adc_client *client,
-                                       unsigned selected),
-                        void (*conv)(struct s3c_adc_client *client,
-                                     unsigned d0, unsigned d1,
-                                     unsigned *samples_left),
-                        unsigned int is_ts);
-
-extern void s3c_adc_release(struct s3c_adc_client *client);
-
-#endif /* __ASM_PLAT_ADC_H */
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
deleted file mode 100644 (file)
index 2c7cf26..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2006-2009 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C CPU frequency scaling support - core support
- */
-
-#include <plat/cpu-freq.h>
-
-struct seq_file;
-
-#define MAX_BANKS (8)
-#define S3C2412_MAX_IO (8)
-
-/**
- * struct s3c2410_iobank_timing - IO bank timings for S3C2410 style timings
- * @bankcon: The cached version of settings in this structure.
- * @tacp:
- * @tacs: Time from address valid to nCS asserted.
- * @tcos: Time from nCS asserted to nOE or nWE asserted.
- * @tacc: Time that nOE or nWE is asserted.
- * @tcoh: Time nCS is held after nOE or nWE are released.
- * @tcah: Time address is held for after
- * @nwait_en: Whether nWAIT is enabled for this bank.
- *
- * This structure represents the IO timings for a S3C2410 style IO bank
- * used by the CPU frequency support if it needs to change the settings
- * of the IO.
- */
-struct s3c2410_iobank_timing {
-       unsigned long   bankcon;
-       unsigned int    tacp;
-       unsigned int    tacs;
-       unsigned int    tcos;
-       unsigned int    tacc;
-       unsigned int    tcoh;           /* nCS hold after nOE/nWE */
-       unsigned int    tcah;           /* Address hold after nCS */
-       unsigned char   nwait_en;       /* nWait enabled for bank. */
-};
-
-/**
- * struct s3c2412_iobank_timing - io timings for PL092 (S3C2412) style IO
- * @idcy: The idle cycle time between transactions.
- * @wstrd: nCS release to end of read cycle.
- * @wstwr: nCS release to end of write cycle.
- * @wstoen: nCS assertion to nOE assertion time.
- * @wstwen: nCS assertion to nWE assertion time.
- * @wstbrd: Burst ready delay.
- * @smbidcyr: Register cache for smbidcyr value.
- * @smbwstrd: Register cache for smbwstrd value.
- * @smbwstwr: Register cache for smbwstwr value.
- * @smbwstoen: Register cache for smbwstoen value.
- * @smbwstwen: Register cache for smbwstwen value.
- * @smbwstbrd: Register cache for smbwstbrd value.
- *
- * Timing information for a IO bank on an S3C2412 or similar system which
- * uses a PL093 block.
- */
-struct s3c2412_iobank_timing {
-       unsigned int    idcy;
-       unsigned int    wstrd;
-       unsigned int    wstwr;
-       unsigned int    wstoen;
-       unsigned int    wstwen;
-       unsigned int    wstbrd;
-
-       /* register cache */
-       unsigned char   smbidcyr;
-       unsigned char   smbwstrd;
-       unsigned char   smbwstwr;
-       unsigned char   smbwstoen;
-       unsigned char   smbwstwen;
-       unsigned char   smbwstbrd;
-};
-
-union s3c_iobank {
-       struct s3c2410_iobank_timing    *io_2410;
-       struct s3c2412_iobank_timing    *io_2412;
-};
-
-/**
- * struct s3c_iotimings - Chip IO timings holder
- * @bank: The timings for each IO bank.
- */
-struct s3c_iotimings {
-       union s3c_iobank        bank[MAX_BANKS];
-};
-
-/**
- * struct s3c_plltab - PLL table information.
- * @vals: List of PLL values.
- * @size: Size of the PLL table @vals.
- */
-struct s3c_plltab {
-       struct s3c_pllval       *vals;
-       int                      size;
-};
-
-/**
- * struct s3c_cpufreq_config - current cpu frequency configuration
- * @freq: The current settings for the core clocks.
- * @max: Maxium settings, derived from core, board and user settings.
- * @pll: The PLL table entry for the current PLL settings.
- * @divs: The divisor settings for the core clocks.
- * @info: The current core driver information.
- * @board: The information for the board we are running on.
- * @lock_pll: Set if the PLL settings cannot be changed.
- *
- * This is for the core drivers that need to know information about
- * the current settings and values. It should not be needed by any
- * device drivers.
-*/
-struct s3c_cpufreq_config {
-       struct s3c_freq         freq;
-       struct s3c_freq         max;
-       struct clk              *mpll;
-       struct cpufreq_frequency_table pll;
-       struct s3c_clkdivs      divs;
-       struct s3c_cpufreq_info *info;  /* for core, not drivers */
-       struct s3c_cpufreq_board *board;
-
-       unsigned int    lock_pll:1;
-};
-
-/**
- * struct s3c_cpufreq_info - Information for the CPU frequency driver.
- * @name: The name of this implementation.
- * @max: The maximum frequencies for the system.
- * @latency: Transition latency to give to cpufreq.
- * @locktime_m: The lock-time in uS for the MPLL.
- * @locktime_u: The lock-time in uS for the UPLL.
- * @locttime_bits: The number of bits each LOCKTIME field.
- * @need_pll: Set if this driver needs to change the PLL values to achieve
- *     any frequency changes. This is really only need by devices like the
- *     S3C2410 where there is no or limited divider between the PLL and the
- *     ARMCLK.
- * @get_iotiming: Get the current IO timing data, mainly for use at start.
- * @set_iotiming: Update the IO timings from the cached copies calculated
- *     from the @calc_iotiming entry when changing the frequency.
- * @calc_iotiming: Calculate and update the cached copies of the IO timings
- *     from the newly calculated frequencies.
- * @calc_freqtable: Calculate (fill in) the given frequency table from the
- *     current frequency configuration. If the table passed in is NULL,
- *     then the return is the number of elements to be filled for allocation
- *     of the table.
- * @set_refresh: Set the memory refresh configuration.
- * @set_fvco: Set the PLL frequencies.
- * @set_divs: Update the clock divisors.
- * @calc_divs: Calculate the clock divisors.
- */
-struct s3c_cpufreq_info {
-       const char              *name;
-       struct s3c_freq         max;
-
-       unsigned int            latency;
-
-       unsigned int            locktime_m;
-       unsigned int            locktime_u;
-       unsigned char           locktime_bits;
-
-       unsigned int            need_pll:1;
-
-       /* driver routines */
-
-       int             (*get_iotiming)(struct s3c_cpufreq_config *cfg,
-                                       struct s3c_iotimings *timings);
-
-       void            (*set_iotiming)(struct s3c_cpufreq_config *cfg,
-                                       struct s3c_iotimings *timings);
-
-       int             (*calc_iotiming)(struct s3c_cpufreq_config *cfg,
-                                        struct s3c_iotimings *timings);
-
-       int             (*calc_freqtable)(struct s3c_cpufreq_config *cfg,
-                                         struct cpufreq_frequency_table *t,
-                                         size_t table_size);
-
-       void            (*debug_io_show)(struct seq_file *seq,
-                                        struct s3c_cpufreq_config *cfg,
-                                        union s3c_iobank *iob);
-
-       void            (*set_refresh)(struct s3c_cpufreq_config *cfg);
-       void            (*set_fvco)(struct s3c_cpufreq_config *cfg);
-       void            (*set_divs)(struct s3c_cpufreq_config *cfg);
-       int             (*calc_divs)(struct s3c_cpufreq_config *cfg);
-};
-
-extern int s3c_cpufreq_register(struct s3c_cpufreq_info *info);
-
-extern int s3c_plltab_register(struct cpufreq_frequency_table *plls,
-                              unsigned int plls_no);
-
-/* exports and utilities for debugfs */
-extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
-extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
-
-#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS
-#define s3c_cpufreq_debugfs_call(x) x
-#else
-#define s3c_cpufreq_debugfs_call(x) NULL
-#endif
-
-/* Useful utility functions. */
-
-extern struct clk *s3c_cpufreq_clk_get(struct device *, const char *);
-
-/* S3C2410 and compatible exported functions */
-
-extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
-extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg);
-
-#ifdef CONFIG_S3C2410_IOTIMING
-extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
-                                    struct s3c_cpufreq_config *cfg,
-                                    union s3c_iobank *iob);
-
-extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
-                                struct s3c_iotimings *iot);
-
-extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
-                               struct s3c_iotimings *timings);
-
-extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
-                                struct s3c_iotimings *iot);
-#else
-#define s3c2410_iotiming_debugfs NULL
-#define s3c2410_iotiming_calc NULL
-#define s3c2410_iotiming_get NULL
-#define s3c2410_iotiming_set NULL
-#endif /* CONFIG_S3C2410_IOTIMING */
-
-/* S3C2412 compatible routines */
-
-#ifdef CONFIG_S3C2412_IOTIMING
-extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
-                                    struct s3c_cpufreq_config *cfg,
-                                    union s3c_iobank *iob);
-
-extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
-                               struct s3c_iotimings *timings);
-
-extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
-                                struct s3c_iotimings *iot);
-
-extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
-                                struct s3c_iotimings *iot);
-#else
-#define s3c2412_iotiming_debugfs NULL
-#define s3c2412_iotiming_calc NULL
-#define s3c2412_iotiming_get NULL
-#define s3c2412_iotiming_set NULL
-#endif /* CONFIG_S3C2412_IOTIMING */
-
-#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG
-#define s3c_freq_dbg(x...) printk(KERN_INFO x)
-#else
-#define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0)
-#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG */
-
-#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG
-#define s3c_freq_iodbg(x...) printk(KERN_INFO x)
-#else
-#define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0)
-#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG */
-
-static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
-                                     int index, size_t table_size,
-                                     unsigned int freq)
-{
-       if (index < 0)
-               return index;
-
-       if (table) {
-               if (index >= table_size)
-                       return -ENOMEM;
-
-               s3c_freq_dbg("%s: { %d = %u kHz }\n",
-                            __func__, index, freq);
-
-               table[index].driver_data = index;
-               table[index].frequency = freq;
-       }
-
-       return index + 1;
-}
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq.h b/arch/arm/plat-samsung/include/plat/cpu-freq.h
deleted file mode 100644 (file)
index 558892b..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2006-2007 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C CPU frequency scaling support - driver and board
- */
-
-#include <linux/cpufreq.h>
-
-struct s3c_cpufreq_info;
-struct s3c_cpufreq_board;
-struct s3c_iotimings;
-
-/**
- * struct s3c_freq - frequency information (mainly for core drivers)
- * @fclk: The FCLK frequency in Hz.
- * @armclk: The ARMCLK frequency in Hz.
- * @hclk_tns: HCLK cycle time in 10ths of nano-seconds.
- * @hclk: The HCLK frequency in Hz.
- * @pclk: The PCLK frequency in Hz.
- *
- * This contains the frequency information about the current configuration
- * mainly for the core drivers to ensure we do not end up passing about
- * a large number of parameters.
- *
- * The @hclk_tns field is a useful cache for the parts of the drivers that
- * need to calculate IO timings and suchlike.
- */
-struct s3c_freq {
-       unsigned long   fclk;
-       unsigned long   armclk;
-       unsigned long   hclk_tns;       /* in 10ths of ns */
-       unsigned long   hclk;
-       unsigned long   pclk;
-};
-
-/**
- * struct s3c_cpufreq_freqs - s3c cpufreq notification information.
- * @freqs: The cpufreq setting information.
- * @old: The old clock settings.
- * @new: The new clock settings.
- * @pll_changing: Set if the PLL is changing.
- *
- * Wrapper 'struct cpufreq_freqs' so that any drivers receiving the
- * notification can use this information that is not provided by just
- * having the core frequency alone.
- *
- * The pll_changing flag is used to indicate if the PLL itself is
- * being set during this change. This is important as the clocks
- * will temporarily be set to the XTAL clock during this time, so
- * drivers may want to close down their output during this time.
- *
- * Note, this is not being used by any current drivers and therefore
- * may be removed in the future.
- */
-struct s3c_cpufreq_freqs {
-       struct cpufreq_freqs    freqs;
-       struct s3c_freq         old;
-       struct s3c_freq         new;
-
-       unsigned int            pll_changing:1;
-};
-
-#define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs)
-
-/**
- * struct s3c_clkdivs - clock divisor information
- * @p_divisor: Divisor from FCLK to PCLK.
- * @h_divisor: Divisor from FCLK to HCLK.
- * @arm_divisor: Divisor from FCLK to ARMCLK (not all CPUs).
- * @dvs: Non-zero if using DVS mode for ARMCLK.
- *
- * Divisor settings for the core clocks.
- */
-struct s3c_clkdivs {
-       int             p_divisor;
-       int             h_divisor;
-       int             arm_divisor;
-       unsigned char   dvs;
-};
-
-#define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s))
-
-/**
- * struct s3c_pllval - PLL value entry.
- * @freq: The frequency for this entry in Hz.
- * @pll_reg: The PLL register setting for this PLL value.
- */
-struct s3c_pllval {
-       unsigned long           freq;
-       unsigned long           pll_reg;
-};
-
-/**
- * struct s3c_cpufreq_board - per-board cpu frequency informatin
- * @refresh: The SDRAM refresh period in nanoseconds.
- * @auto_io: Set if the IO timing settings should be generated from the
- *     initialisation time hardware registers.
- * @need_io: Set if the board has external IO on any of the chipselect
- *     lines that will require the hardware timing registers to be
- *     updated on a clock change.
- * @max: The maxium frequency limits for the system. Any field that
- *     is left at zero will use the CPU's settings.
- *
- * This contains the board specific settings that affect how the CPU
- * drivers chose settings. These include the memory refresh and IO
- * timing information.
- *
- * Registration depends on the driver being used, the ARMCLK only
- * implementation does not currently need this but the older style
- * driver requires this to be available.
- */
-struct s3c_cpufreq_board {
-       unsigned int    refresh;
-       unsigned int    auto_io:1;      /* automatically init io timings. */
-       unsigned int    need_io:1;      /* set if needs io timing support. */
-
-       /* any non-zero field in here is taken as an upper limit. */
-       struct s3c_freq max;    /* frequency limits */
-};
-
-/* Things depending on frequency scaling. */
-#ifdef CONFIG_ARM_S3C_CPUFREQ
-#define __init_or_cpufreq
-#else
-#define __init_or_cpufreq __init
-#endif
-
-/* Board functions */
-
-#ifdef CONFIG_ARM_S3C_CPUFREQ
-extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board);
-#else
-
-static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
-{
-       return 0;
-}
-#endif  /* CONFIG_ARM_S3C_CPUFREQ */
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
deleted file mode 100644 (file)
index fadcddb..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * Copyright (c) 2004-2005 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * Header file for Samsung CPU support
- */
-
-/* todo - fix when rmk changes iodescs to use `void __iomem *` */
-
-#ifndef __SAMSUNG_PLAT_CPU_H
-#define __SAMSUNG_PLAT_CPU_H
-
-extern unsigned long samsung_cpu_id;
-
-#define S3C2410_CPU_ID         0x32410000
-#define S3C2410_CPU_MASK       0xFFFFFFFF
-
-#define S3C24XX_CPU_ID         0x32400000
-#define S3C24XX_CPU_MASK       0xFFF00000
-
-#define S3C2412_CPU_ID         0x32412000
-#define S3C2412_CPU_MASK       0xFFFFF000
-
-#define S3C6400_CPU_ID         0x36400000
-#define S3C6410_CPU_ID         0x36410000
-#define S3C64XX_CPU_MASK       0xFFFFF000
-
-#define S5PV210_CPU_ID         0x43110000
-#define S5PV210_CPU_MASK       0xFFFFF000
-
-#define IS_SAMSUNG_CPU(name, id, mask)         \
-static inline int is_samsung_##name(void)      \
-{                                              \
-       return ((samsung_cpu_id & mask) == (id & mask));        \
-}
-
-IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
-IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
-IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
-IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
-IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
-
-#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
-    defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
-    defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
-    defined(CONFIG_CPU_S3C2443)
-# define soc_is_s3c24xx()      is_samsung_s3c24xx()
-# define soc_is_s3c2410()      is_samsung_s3c2410()
-#else
-# define soc_is_s3c24xx()      0
-# define soc_is_s3c2410()      0
-#endif
-
-#if defined(CONFIG_CPU_S3C2412)
-# define soc_is_s3c2412()      is_samsung_s3c2412()
-#else
-# define soc_is_s3c2412()      0
-#endif
-
-#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
-# define soc_is_s3c6400()      is_samsung_s3c6400()
-# define soc_is_s3c6410()      is_samsung_s3c6410()
-# define soc_is_s3c64xx()      (is_samsung_s3c6400() || is_samsung_s3c6410())
-#else
-# define soc_is_s3c6400()      0
-# define soc_is_s3c6410()      0
-# define soc_is_s3c64xx()      0
-#endif
-
-#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
-
-#ifndef KHZ
-#define KHZ (1000)
-#endif
-
-#ifndef MHZ
-#define MHZ (1000*1000)
-#endif
-
-#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
-
-/* forward declaration */
-struct s3c24xx_uart_resources;
-struct platform_device;
-struct s3c2410_uartcfg;
-struct map_desc;
-
-/* per-cpu initialisation function table. */
-
-struct cpu_table {
-       unsigned long   idcode;
-       unsigned long   idmask;
-       void            (*map_io)(void);
-       void            (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
-       void            (*init_clocks)(int xtal);
-       int             (*init)(void);
-       const char      *name;
-};
-
-extern void s3c_init_cpu(unsigned long idcode,
-                        struct cpu_table *cpus, unsigned int cputab_size);
-
-/* core initialisation functions */
-
-extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
-
-extern void s3c64xx_init_cpu(void);
-extern void s5p_init_cpu(const void __iomem *cpuid_addr);
-
-extern unsigned int samsung_rev(void);
-
-extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
-
-extern void s3c24xx_init_clocks(int xtal);
-
-extern void s3c24xx_init_uartdevs(char *name,
-                                 struct s3c24xx_uart_resources *res,
-                                 struct s3c2410_uartcfg *cfg, int no);
-
-extern struct syscore_ops s3c2410_pm_syscore_ops;
-extern struct syscore_ops s3c2412_pm_syscore_ops;
-extern struct syscore_ops s3c2416_pm_syscore_ops;
-extern struct syscore_ops s3c244x_pm_syscore_ops;
-
-/* system device subsystems */
-
-extern struct bus_type s3c2410_subsys;
-extern struct bus_type s3c2410a_subsys;
-extern struct bus_type s3c2412_subsys;
-extern struct bus_type s3c2416_subsys;
-extern struct bus_type s3c2440_subsys;
-extern struct bus_type s3c2442_subsys;
-extern struct bus_type s3c2443_subsys;
-extern struct bus_type s3c6410_subsys;
-
-#endif
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
deleted file mode 100644 (file)
index 02b0c57..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * Copyright (c) 2004 Simtec Electronics
- * Ben Dooks <ben@simtec.co.uk>
- *
- * Header file for s3c2410 standard platform devices
- */
-
-#ifndef __PLAT_DEVS_H
-#define __PLAT_DEVS_H __FILE__
-
-#include <linux/platform_device.h>
-
-struct s3c24xx_uart_resources {
-       struct resource         *resources;
-       unsigned long            nr_resources;
-};
-
-extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
-extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
-
-extern struct platform_device *s3c24xx_uart_devs[];
-extern struct platform_device *s3c24xx_uart_src[];
-
-extern struct platform_device s3c64xx_device_ac97;
-extern struct platform_device s3c64xx_device_iis0;
-extern struct platform_device s3c64xx_device_iis1;
-extern struct platform_device s3c64xx_device_iisv4;
-extern struct platform_device s3c64xx_device_onenand1;
-extern struct platform_device s3c64xx_device_pcm0;
-extern struct platform_device s3c64xx_device_pcm1;
-extern struct platform_device s3c64xx_device_spi0;
-extern struct platform_device s3c64xx_device_spi1;
-extern struct platform_device s3c64xx_device_spi2;
-
-extern struct platform_device s3c_device_adc;
-extern struct platform_device s3c_device_cfcon;
-extern struct platform_device s3c_device_fb;
-extern struct platform_device s3c_device_hwmon;
-extern struct platform_device s3c_device_hsmmc0;
-extern struct platform_device s3c_device_hsmmc1;
-extern struct platform_device s3c_device_hsmmc2;
-extern struct platform_device s3c_device_hsmmc3;
-extern struct platform_device s3c_device_i2c0;
-extern struct platform_device s3c_device_i2c1;
-extern struct platform_device s3c_device_i2c2;
-extern struct platform_device s3c_device_i2c3;
-extern struct platform_device s3c_device_i2c4;
-extern struct platform_device s3c_device_i2c5;
-extern struct platform_device s3c_device_i2c6;
-extern struct platform_device s3c_device_i2c7;
-extern struct platform_device s3c_device_iis;
-extern struct platform_device s3c_device_lcd;
-extern struct platform_device s3c_device_nand;
-extern struct platform_device s3c_device_ohci;
-extern struct platform_device s3c_device_onenand;
-extern struct platform_device s3c_device_rtc;
-extern struct platform_device s3c_device_sdi;
-extern struct platform_device s3c_device_spi0;
-extern struct platform_device s3c_device_spi1;
-extern struct platform_device s3c_device_ts;
-extern struct platform_device s3c_device_timer[];
-extern struct platform_device s3c_device_usbgadget;
-extern struct platform_device s3c_device_usb_hsotg;
-extern struct platform_device s3c_device_usb_hsudc;
-extern struct platform_device s3c_device_wdt;
-
-extern struct platform_device samsung_asoc_idma;
-extern struct platform_device samsung_device_keypad;
-extern struct platform_device samsung_device_pwm;
-
-/* s3c2440 specific devices */
-
-#ifdef CONFIG_CPU_S3C2440
-
-extern struct platform_device s3c_device_camif;
-extern struct platform_device s3c_device_ac97;
-
-#endif
-
-/**
- * s3c_set_platdata() - helper for setting platform data
- * @pd: The default platform data for this device.
- * @pdsize: The size of the platform data.
- * @pdev: Pointer to the device to fill in.
- *
- * This helper replaces a number of calls that copy and then set the
- * platform data of the device.
- */
-extern void *s3c_set_platdata(void *pd, size_t pdsize,
-                             struct platform_device *pdev);
-
-#endif /* __PLAT_DEVS_H */
diff --git a/arch/arm/plat-samsung/include/plat/fb-s3c2410.h b/arch/arm/plat-samsung/include/plat/fb-s3c2410.h
deleted file mode 100644 (file)
index 614240d..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
- *
- * Inspired by pxafb.h
-*/
-
-#ifndef __ASM_PLAT_FB_S3C2410_H
-#define __ASM_PLAT_FB_S3C2410_H __FILE__
-
-struct s3c2410fb_hw {
-       unsigned long   lcdcon1;
-       unsigned long   lcdcon2;
-       unsigned long   lcdcon3;
-       unsigned long   lcdcon4;
-       unsigned long   lcdcon5;
-};
-
-/* LCD description */
-struct s3c2410fb_display {
-       /* LCD type */
-       unsigned type;
-
-       /* Screen size */
-       unsigned short width;
-       unsigned short height;
-
-       /* Screen info */
-       unsigned short xres;
-       unsigned short yres;
-       unsigned short bpp;
-
-       unsigned pixclock;              /* pixclock in picoseconds */
-       unsigned short left_margin;  /* value in pixels (TFT) or HCLKs (STN) */
-       unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */
-       unsigned short hsync_len;    /* value in pixels (TFT) or HCLKs (STN) */
-       unsigned short upper_margin;    /* value in lines (TFT) or 0 (STN) */
-       unsigned short lower_margin;    /* value in lines (TFT) or 0 (STN) */
-       unsigned short vsync_len;       /* value in lines (TFT) or 0 (STN) */
-
-       /* lcd configuration registers */
-       unsigned long   lcdcon5;
-};
-
-struct s3c2410fb_mach_info {
-
-       struct s3c2410fb_display *displays;     /* attached displays info */
-       unsigned num_displays;                  /* number of defined displays */
-       unsigned default_display;
-
-       /* GPIOs */
-
-       unsigned long   gpcup;
-       unsigned long   gpcup_mask;
-       unsigned long   gpccon;
-       unsigned long   gpccon_mask;
-       unsigned long   gpdup;
-       unsigned long   gpdup_mask;
-       unsigned long   gpdcon;
-       unsigned long   gpdcon_mask;
-
-       /* lpc3600 control register */
-       unsigned long   lpcsel;
-};
-
-extern void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
-
-#endif /* __ASM_PLAT_FB_S3C2410_H */
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
deleted file mode 100644 (file)
index 615d381..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C - FB platform data definitions
- */
-
-#ifndef __PLAT_S3C_FB_H
-#define __PLAT_S3C_FB_H __FILE__
-
-#include <linux/platform_data/video_s3c.h>
-
-/**
- * s3c_fb_set_platdata() - Setup the FB device with platform data.
- * @pd: The platform data to set. The data is copied from the passed structure
- *      so the machine data can mark the data __initdata so that any unused
- *      machines will end up dumping their data at runtime.
- */
-extern void s3c_fb_set_platdata(struct s3c_fb_platdata *pd);
-
-/**
- * s3c64xx_fb_gpio_setup_24bpp() - S3C64XX setup function for 24bpp LCD
- *
- * Initialise the GPIO for an 24bpp LCD display on the RGB interface.
- */
-extern void s3c64xx_fb_gpio_setup_24bpp(void);
-
-#endif /* __PLAT_S3C_FB_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
deleted file mode 100644 (file)
index db0c56f..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * Samsung Platform - GPIO pin configuration helper definitions
- */
-
-/* This is meant for core cpu support, machine or other driver files
- * should not be including this header.
- */
-
-#ifndef __PLAT_GPIO_CFG_HELPERS_H
-#define __PLAT_GPIO_CFG_HELPERS_H __FILE__
-
-/* As a note, all gpio configuration functions are entered exclusively, either
- * with the relevant lock held or the system prevented from doing anything else
- * by disabling interrupts.
-*/
-
-static inline int samsung_gpio_do_setcfg(struct samsung_gpio_chip *chip,
-                                        unsigned int off, unsigned int config)
-{
-       return (chip->config->set_config)(chip, off, config);
-}
-
-static inline unsigned samsung_gpio_do_getcfg(struct samsung_gpio_chip *chip,
-                                             unsigned int off)
-{
-       return (chip->config->get_config)(chip, off);
-}
-
-static inline int samsung_gpio_do_setpull(struct samsung_gpio_chip *chip,
-                                         unsigned int off, samsung_gpio_pull_t pull)
-{
-       return (chip->config->set_pull)(chip, off, pull);
-}
-
-static inline samsung_gpio_pull_t samsung_gpio_do_getpull(struct samsung_gpio_chip *chip,
-                                                         unsigned int off)
-{
-       return chip->config->get_pull(chip, off);
-}
-
-/* Pull-{up,down} resistor controls.
- *
- * S3C2410,S3C2440 = Pull-UP,
- * S3C2412,S3C2413 = Pull-Down
- * S3C6400,S3C6410 = Pull-Both [None,Down,Up,Undef]
- * S3C2443 = Pull-Both [not same as S3C6400]
- */
-
-/**
- * s3c24xx_gpio_setpull_1up() - Pull configuration for choice of up or none.
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- * @param: pull: The pull mode being requested.
- *
- * This is a helper function for the case where we have GPIOs with one
- * bit configuring the presence of a pull-up resistor.
- */
-extern int s3c24xx_gpio_setpull_1up(struct samsung_gpio_chip *chip,
-                                   unsigned int off, samsung_gpio_pull_t pull);
-
-/**
- * s3c24xx_gpio_setpull_1down() - Pull configuration for choice of down or none
- * @chip: The gpio chip that is being configured
- * @off: The offset for the GPIO being configured
- * @param: pull: The pull mode being requested
- *
- * This is a helper function for the case where we have GPIOs with one
- * bit configuring the presence of a pull-down resistor.
- */
-extern int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip,
-                                     unsigned int off, samsung_gpio_pull_t pull);
-
-/**
- * samsung_gpio_setpull_upown() - Pull configuration for choice of up,
- * down or none
- *
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- * @param: pull: The pull mode being requested.
- *
- * This is a helper function for the case where we have GPIOs with two
- * bits configuring the presence of a pull resistor, in the following
- * order:
- *     00 = No pull resistor connected
- *     01 = Pull-up resistor connected
- *     10 = Pull-down resistor connected
- */
-extern int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
-                                      unsigned int off, samsung_gpio_pull_t pull);
-
-/**
- * samsung_gpio_getpull_updown() - Get configuration for choice of up,
- * down or none
- *
- * @chip: The gpio chip that the GPIO pin belongs to
- * @off: The offset to the pin to get the configuration of.
- *
- * This helper function reads the state of the pull-{up,down} resistor
- * for the given GPIO in the same case as samsung_gpio_setpull_upown.
-*/
-extern samsung_gpio_pull_t samsung_gpio_getpull_updown(struct samsung_gpio_chip *chip,
-                                                      unsigned int off);
-
-/**
- * s3c24xx_gpio_getpull_1up() - Get configuration for choice of up or none
- * @chip: The gpio chip that the GPIO pin belongs to
- * @off: The offset to the pin to get the configuration of.
- *
- * This helper function reads the state of the pull-up resistor for the
- * given GPIO in the same case as s3c24xx_gpio_setpull_1up.
-*/
-extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1up(struct samsung_gpio_chip *chip,
-                                                   unsigned int off);
-
-/**
- * s3c24xx_gpio_getpull_1down() - Get configuration for choice of down or none
- * @chip: The gpio chip that the GPIO pin belongs to
- * @off: The offset to the pin to get the configuration of.
- *
- * This helper function reads the state of the pull-down resistor for the
- * given GPIO in the same case as s3c24xx_gpio_setpull_1down.
-*/
-extern samsung_gpio_pull_t s3c24xx_gpio_getpull_1down(struct samsung_gpio_chip *chip,
-                                                     unsigned int off);
-
-/**
- * s3c2443_gpio_setpull() - Pull configuration for s3c2443.
- * @chip: The gpio chip that is being configured.
- * @off: The offset for the GPIO being configured.
- * @param: pull: The pull mode being requested.
- *
- * This is a helper function for the case where we have GPIOs with two
- * bits configuring the presence of a pull resistor, in the following
- * order:
- *     00 = Pull-up resistor connected
- *     10 = Pull-down resistor connected
- *     x1 = No pull up resistor
- */
-extern int s3c2443_gpio_setpull(struct samsung_gpio_chip *chip,
-                               unsigned int off, samsung_gpio_pull_t pull);
-
-/**
- * s3c2443_gpio_getpull() - Get configuration for s3c2443 pull resistors
- * @chip: The gpio chip that the GPIO pin belongs to.
- * @off: The offset to the pin to get the configuration of.
- *
- * This helper function reads the state of the pull-{up,down} resistor for the
- * given GPIO in the same case as samsung_gpio_setpull_upown.
-*/
-extern samsung_gpio_pull_t s3c2443_gpio_getpull(struct samsung_gpio_chip *chip,
-                                               unsigned int off);
-
-#endif /* __PLAT_GPIO_CFG_HELPERS_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
deleted file mode 100644 (file)
index 469c220..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C Platform - GPIO pin configuration
- */
-
-/* This file contains the necessary definitions to get the basic gpio
- * pin configuration done such as setting a pin to input or output or
- * changing the pull-{up,down} configurations.
- */
-
-/* Note, this interface is being added to the s3c64xx arch first and will
- * be added to the s3c24xx systems later.
- */
-
-#ifndef __PLAT_GPIO_CFG_H
-#define __PLAT_GPIO_CFG_H __FILE__
-
-#include <linux/types.h>
-
-typedef unsigned int __bitwise samsung_gpio_pull_t;
-
-/* forward declaration if gpio-core.h hasn't been included */
-struct samsung_gpio_chip;
-
-/**
- * struct samsung_gpio_cfg GPIO configuration
- * @cfg_eint: Configuration setting when used for external interrupt source
- * @get_pull: Read the current pull configuration for the GPIO
- * @set_pull: Set the current pull configuration for the GPIO
- * @set_config: Set the current configuration for the GPIO
- * @get_config: Read the current configuration for the GPIO
- *
- * Each chip can have more than one type of GPIO bank available and some
- * have different capabilites even when they have the same control register
- * layouts. Provide an point to vector control routine and provide any
- * per-bank configuration information that other systems such as the
- * external interrupt code will need.
- *
- * @sa samsung_gpio_cfgpin
- * @sa s3c_gpio_getcfg
- * @sa s3c_gpio_setpull
- * @sa s3c_gpio_getpull
- */
-struct samsung_gpio_cfg {
-       unsigned int    cfg_eint;
-
-       samsung_gpio_pull_t     (*get_pull)(struct samsung_gpio_chip *chip, unsigned offs);
-       int             (*set_pull)(struct samsung_gpio_chip *chip, unsigned offs,
-                                   samsung_gpio_pull_t pull);
-
-       unsigned (*get_config)(struct samsung_gpio_chip *chip, unsigned offs);
-       int      (*set_config)(struct samsung_gpio_chip *chip, unsigned offs,
-                              unsigned config);
-};
-
-#define S3C_GPIO_SPECIAL_MARK  (0xfffffff0)
-#define S3C_GPIO_SPECIAL(x)    (S3C_GPIO_SPECIAL_MARK | (x))
-
-/* Defines for generic pin configurations */
-#define S3C_GPIO_INPUT (S3C_GPIO_SPECIAL(0))
-#define S3C_GPIO_OUTPUT        (S3C_GPIO_SPECIAL(1))
-#define S3C_GPIO_SFN(x)        (S3C_GPIO_SPECIAL(x))
-
-#define samsung_gpio_is_cfg_special(_cfg) \
-       (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
-
-/**
- * s3c_gpio_cfgpin() - Change the GPIO function of a pin.
- * @pin pin The pin number to configure.
- * @to to The configuration for the pin's function.
- *
- * Configure which function is actually connected to the external
- * pin, such as an gpio input, output or some form of special function
- * connected to an internal peripheral block.
- *
- * The @to parameter can be one of the generic S3C_GPIO_INPUT, S3C_GPIO_OUTPUT
- * or S3C_GPIO_SFN() to indicate one of the possible values that the helper
- * will then generate the correct bit mask and shift for the configuration.
- *
- * If a bank of GPIOs all needs to be set to special-function 2, then
- * the following code will work:
- *
- *     for (gpio = start; gpio < end; gpio++)
- *             s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
- *
- * The @to parameter can also be a specific value already shifted to the
- * correct position in the control register, although these are discouraged
- * in newer kernels and are only being kept for compatibility.
- */
-extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
-
-/**
- * s3c_gpio_getcfg - Read the current function for a GPIO pin
- * @pin: The pin to read the configuration value for.
- *
- * Read the configuration state of the given @pin, returning a value that
- * could be passed back to s3c_gpio_cfgpin().
- *
- * @sa s3c_gpio_cfgpin
- */
-extern unsigned s3c_gpio_getcfg(unsigned int pin);
-
-/**
- * s3c_gpio_cfgpin_range() - Change the GPIO function for configuring pin range
- * @start: The pin number to start at
- * @nr: The number of pins to configure from @start.
- * @cfg: The configuration for the pin's function
- *
- * Call s3c_gpio_cfgpin() for the @nr pins starting at @start.
- *
- * @sa s3c_gpio_cfgpin.
- */
-extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
-                                unsigned int cfg);
-
-/* Define values for the pull-{up,down} available for each gpio pin.
- *
- * These values control the state of the weak pull-{up,down} resistors
- * available on most pins on the S3C series. Not all chips support both
- * up or down settings, and it may be dependent on the chip that is being
- * used to whether the particular mode is available.
- */
-#define S3C_GPIO_PULL_NONE     ((__force samsung_gpio_pull_t)0x00)
-#define S3C_GPIO_PULL_DOWN     ((__force samsung_gpio_pull_t)0x01)
-#define S3C_GPIO_PULL_UP       ((__force samsung_gpio_pull_t)0x02)
-
-/**
- * s3c_gpio_setpull() - set the state of a gpio pin pull resistor
- * @pin: The pin number to configure the pull resistor.
- * @pull: The configuration for the pull resistor.
- *
- * This function sets the state of the pull-{up,down} resistor for the
- * specified pin. It will return 0 if successful, or a negative error
- * code if the pin cannot support the requested pull setting.
- *
- * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP.
-*/
-extern int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull);
-
-/**
- * s3c_gpio_getpull() - get the pull resistor state of a gpio pin
- * @pin: The pin number to get the settings for
- *
- * Read the pull resistor value for the specified pin.
-*/
-extern samsung_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
-
-/* configure `all` aspects of an gpio */
-
-/**
- * s3c_gpio_cfgall_range() - configure range of gpio functtion and pull.
- * @start: The gpio number to start at.
- * @nr: The number of gpio to configure from @start.
- * @cfg: The configuration to use
- * @pull: The pull setting to use.
- *
- * Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting
- * @gpio and running for @size.
- *
- * @sa s3c_gpio_cfgpin
- * @sa s3c_gpio_setpull
- * @sa s3c_gpio_cfgpin_range
- */
-extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
-                                unsigned int cfg, samsung_gpio_pull_t pull);
-
-static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size,
-                                          unsigned int cfg)
-{
-       return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE);
-}
-
-#endif /* __PLAT_GPIO_CFG_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
deleted file mode 100644 (file)
index c0bfceb..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C Platform - GPIO core
- */
-
-#ifndef __PLAT_SAMSUNG_GPIO_CORE_H
-#define __PLAT_SAMSUNG_GPIO_CORE_H
-
-/* Bring in machine-local definitions, especially S3C_GPIO_END */
-#include <mach/gpio-samsung.h>
-#include <linux/gpio/driver.h>
-
-#define GPIOCON_OFF    (0x00)
-#define GPIODAT_OFF    (0x04)
-
-#define con_4bit_shift(__off) ((__off) * 4)
-
-/* Define the core gpiolib support functions that the s3c platforms may
- * need to extend or change depending on the hardware and the s3c chip
- * selected at build or found at run time.
- *
- * These definitions are not intended for driver inclusion, there is
- * nothing here that should not live outside the platform and core
- * specific code.
-*/
-
-struct samsung_gpio_chip;
-
-/**
- * struct samsung_gpio_pm - power management (suspend/resume) information
- * @save: Routine to save the state of the GPIO block
- * @resume: Routine to resume the GPIO block.
- */
-struct samsung_gpio_pm {
-       void (*save)(struct samsung_gpio_chip *chip);
-       void (*resume)(struct samsung_gpio_chip *chip);
-};
-
-struct samsung_gpio_cfg;
-
-/**
- * struct samsung_gpio_chip - wrapper for specific implementation of gpio
- * @chip: The chip structure to be exported via gpiolib.
- * @base: The base pointer to the gpio configuration registers.
- * @group: The group register number for gpio interrupt support.
- * @irq_base: The base irq number.
- * @config: special function and pull-resistor control information.
- * @lock: Lock for exclusive access to this gpio bank.
- * @pm_save: Save information for suspend/resume support.
- * @bitmap_gpio_int: Bitmap for representing GPIO interrupt or not.
- *
- * This wrapper provides the necessary information for the Samsung
- * specific gpios being registered with gpiolib.
- *
- * The lock protects each gpio bank from multiple access of the shared
- * configuration registers, or from reading of data whilst another thread
- * is writing to the register set.
- *
- * Each chip has its own lock to avoid any  contention between different
- * CPU cores trying to get one lock for different GPIO banks, where each
- * bank of GPIO has its own register space and configuration registers.
- */
-struct samsung_gpio_chip {
-       struct gpio_chip        chip;
-       struct samsung_gpio_cfg *config;
-       struct samsung_gpio_pm  *pm;
-       void __iomem            *base;
-       int                     irq_base;
-       int                     group;
-       spinlock_t               lock;
-#ifdef CONFIG_PM
-       u32                     pm_save[4];
-#endif
-       u32                     bitmap_gpio_int;
-};
-
-static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
-{
-       return container_of(gpc, struct samsung_gpio_chip, chip);
-}
-
-/**
- * samsung_gpiolib_to_irq - convert gpio pin to irq number
- * @chip: The gpio chip that the pin belongs to.
- * @offset: The offset of the pin in the chip.
- *
- * This helper returns the irq number calculated from the chip->irq_base and
- * the provided offset.
- */
-extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
-
-/* exported for core SoC support to change */
-extern struct samsung_gpio_cfg s3c24xx_gpiocfg_default;
-
-#ifdef CONFIG_S3C_GPIO_TRACK
-extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
-
-static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip)
-{
-       return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
-}
-#else
-/* machine specific code should provide samsung_gpiolib_getchip */
-
-extern struct samsung_gpio_chip s3c24xx_gpios[];
-
-static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int pin)
-{
-       struct samsung_gpio_chip *chip;
-
-       if (pin > S3C_GPIO_END)
-               return NULL;
-
-       chip = &s3c24xx_gpios[pin/32];
-       return ((pin - chip->chip.base) < chip->chip.ngpio) ? chip : NULL;
-}
-
-static inline void s3c_gpiolib_track(struct samsung_gpio_chip *chip) { }
-#endif
-
-#ifdef CONFIG_PM
-extern struct samsung_gpio_pm samsung_gpio_pm_1bit;
-extern struct samsung_gpio_pm samsung_gpio_pm_2bit;
-extern struct samsung_gpio_pm samsung_gpio_pm_4bit;
-#define __gpio_pm(x) x
-#else
-#define samsung_gpio_pm_1bit NULL
-#define samsung_gpio_pm_2bit NULL
-#define samsung_gpio_pm_4bit NULL
-#define __gpio_pm(x) NULL
-
-#endif /* CONFIG_PM */
-
-/* locking wrappers to deal with multiple access to the same gpio bank */
-#define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl)
-#define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl)
-
-#endif /* __PLAT_SAMSUNG_GPIO_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/iic-core.h b/arch/arm/plat-samsung/include/plat/iic-core.h
deleted file mode 100644 (file)
index c5cfd5a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C - I2C Controller core functions
- */
-
-#ifndef __ASM_ARCH_IIC_CORE_H
-#define __ASM_ARCH_IIC_CORE_H __FILE__
-
-/* These functions are only for use with the core support code, such as
- * the cpu specific initialisation code
- */
-
-/* re-define device name depending on support. */
-static inline void s3c_i2c0_setname(char *name)
-{
-       /* currently this device is always compiled in */
-       s3c_device_i2c0.name = name;
-}
-
-static inline void s3c_i2c1_setname(char *name)
-{
-#ifdef CONFIG_S3C_DEV_I2C1
-       s3c_device_i2c1.name = name;
-#endif
-}
-
-static inline void s3c_i2c2_setname(char *name)
-{
-#ifdef CONFIG_S3C_DEV_I2C2
-       s3c_device_i2c2.name = name;
-#endif
-}
-
-#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-samsung/include/plat/keypad.h b/arch/arm/plat-samsung/include/plat/keypad.h
deleted file mode 100644 (file)
index 9754b9a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Samsung Platform - Keypad platform data definitions
- *
- * Copyright (C) 2010 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <jy0922.shim@samsung.com>
- */
-
-#ifndef __PLAT_SAMSUNG_KEYPAD_H
-#define __PLAT_SAMSUNG_KEYPAD_H
-
-#include <linux/input/samsung-keypad.h>
-
-/**
- * samsung_keypad_set_platdata - Set platform data for Samsung Keypad device.
- * @pd: Platform data to register to device.
- *
- * Register the given platform data for use with Samsung Keypad device.
- * The call will copy the platform data, so the board definitions can
- * make the structure itself __initdata.
- */
-extern void samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd);
-
-/* defined by architecture to configure gpio. */
-extern void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols);
-
-#endif /* __PLAT_SAMSUNG_KEYPAD_H */
diff --git a/arch/arm/plat-samsung/include/plat/map-base.h b/arch/arm/plat-samsung/include/plat/map-base.h
deleted file mode 100644 (file)
index 34b39de..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2003, 2007 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C - Memory map definitions (virtual addresses)
- */
-
-#ifndef __ASM_PLAT_MAP_H
-#define __ASM_PLAT_MAP_H __FILE__
-
-/* Fit all our registers in at 0xF6000000 upwards, trying to use as
- * little of the VA space as possible so vmalloc and friends have a
- * better chance of getting memory.
- *
- * we try to ensure stuff like the IRQ registers are available for
- * an single MOVS instruction (ie, only 8 bits of set data)
- */
-
-#define S3C_ADDR_BASE  0xF6000000
-
-#ifndef __ASSEMBLY__
-#define S3C_ADDR(x)    ((void __iomem __force *)S3C_ADDR_BASE + (x))
-#else
-#define S3C_ADDR(x)    (S3C_ADDR_BASE + (x))
-#endif
-
-#define S3C_VA_IRQ     S3C_ADDR(0x00000000)    /* irq controller(s) */
-#define S3C_VA_SYS     S3C_ADDR(0x00100000)    /* system control */
-#define S3C_VA_MEM     S3C_ADDR(0x00200000)    /* memory control */
-#define S3C_VA_TIMER   S3C_ADDR(0x00300000)    /* timer block */
-#define S3C_VA_WATCHDOG        S3C_ADDR(0x00400000)    /* watchdog */
-#define S3C_VA_UART    S3C_ADDR(0x01000000)    /* UART */
-
-/* This is used for the CPU specific mappings that may be needed, so that
- * they do not need to directly used S3C_ADDR() and thus make it easier to
- * modify the space for mapping.
- */
-#define S3C_ADDR_CPU(x)        S3C_ADDR(0x00500000 + (x))
-
-#endif /* __ASM_PLAT_MAP_H */
diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h b/arch/arm/plat-samsung/include/plat/map-s3c.h
deleted file mode 100644 (file)
index 4244acb..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C24XX - Memory map definitions
- */
-
-#ifndef __ASM_PLAT_MAP_S3C_H
-#define __ASM_PLAT_MAP_S3C_H __FILE__
-
-#define S3C24XX_VA_IRQ         S3C_VA_IRQ
-#define S3C24XX_VA_MEMCTRL     S3C_VA_MEM
-#define S3C24XX_VA_UART                S3C_VA_UART
-
-#define S3C24XX_VA_TIMER       S3C_VA_TIMER
-#define S3C24XX_VA_CLKPWR      S3C_VA_SYS
-#define S3C24XX_VA_WATCHDOG    S3C_VA_WATCHDOG
-
-#define S3C2412_VA_SSMC                S3C_ADDR_CPU(0x00000000)
-#define S3C2412_VA_EBI         S3C_ADDR_CPU(0x00100000)
-
-#define S3C2410_PA_UART                (0x50000000)
-#define S3C24XX_PA_UART                S3C2410_PA_UART
-
-/*
- * GPIO ports
- *
- * the calculation for the VA of this must ensure that
- * it is the same distance apart from the UART in the
- * phsyical address space, as the initial mapping for the IO
- * is done as a 1:1 mapping. This puts it (currently) at
- * 0xFA800000, which is not in the way of any current mapping
- * by the base system.
-*/
-
-#define S3C2410_PA_GPIO                (0x56000000)
-#define S3C24XX_PA_GPIO                S3C2410_PA_GPIO
-
-#define S3C24XX_VA_GPIO                ((S3C24XX_PA_GPIO - S3C24XX_PA_UART) + S3C24XX_VA_UART)
-#define S3C64XX_VA_GPIO                S3C_ADDR_CPU(0x00000000)
-
-#define S3C64XX_VA_MODEM       S3C_ADDR_CPU(0x00100000)
-#define S3C64XX_VA_USB_HSPHY   S3C_ADDR_CPU(0x00200000)
-
-#define S3C_VA_USB_HSPHY       S3C64XX_VA_USB_HSPHY
-
-/*
- * ISA style IO, for each machine to sort out mappings for,
- * if it implements it. We reserve two 16M regions for ISA.
- */
-
-#define S3C2410_ADDR(x)                S3C_ADDR(x)
-
-#define S3C24XX_VA_ISA_WORD    S3C2410_ADDR(0x02000000)
-#define S3C24XX_VA_ISA_BYTE    S3C2410_ADDR(0x03000000)
-
-/* deal with the registers that move under the 2412/2413 */
-
-#if defined(CONFIG_CPU_S3C2412)
-#ifndef __ASSEMBLY__
-extern void __iomem *s3c24xx_va_gpio2;
-#endif
-#ifdef CONFIG_CPU_S3C2412_ONLY
-#define S3C24XX_VA_GPIO2       (S3C24XX_VA_GPIO + 0x10)
-#else
-#define S3C24XX_VA_GPIO2 s3c24xx_va_gpio2
-#endif
-#else
-#define s3c24xx_va_gpio2 S3C24XX_VA_GPIO
-#define S3C24XX_VA_GPIO2 S3C24XX_VA_GPIO
-#endif
-
-#include <plat/map-s5p.h>
-
-#endif /* __ASM_PLAT_MAP_S3C_H */
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h
deleted file mode 100644 (file)
index d69a0ca..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * S5P - Memory map definitions
- */
-
-#ifndef __ASM_PLAT_MAP_S5P_H
-#define __ASM_PLAT_MAP_S5P_H __FILE__
-
-#define S5P_VA_CHIPID          S3C_ADDR(0x02000000)
-
-#define VA_VIC(x)              (S3C_VA_IRQ + ((x) * 0x10000))
-#define VA_VIC0                        VA_VIC(0)
-#define VA_VIC1                        VA_VIC(1)
-#define VA_VIC2                        VA_VIC(2)
-#define VA_VIC3                        VA_VIC(3)
-
-#include <plat/map-s3c.h>
-
-#endif /* __ASM_PLAT_MAP_S5P_H */
diff --git a/arch/arm/plat-samsung/include/plat/pm-common.h b/arch/arm/plat-samsung/include/plat/pm-common.h
deleted file mode 100644 (file)
index 1268bae..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2013 Samsung Electronics Co., Ltd.
- *     Tomasz Figa <t.figa@samsung.com>
- * Copyright (c) 2004 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Written by Ben Dooks, <ben@simtec.co.uk>
- */
-
-#ifndef __PLAT_SAMSUNG_PM_COMMON_H
-#define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
-
-#include <linux/irq.h>
-
-/* sleep save info */
-
-/**
- * struct sleep_save - save information for shared peripherals.
- * @reg: Pointer to the register to save.
- * @val: Holder for the value saved from reg.
- *
- * This describes a list of registers which is used by the pm core and
- * other subsystem to save and restore register values over suspend.
- */
-struct sleep_save {
-       void __iomem    *reg;
-       unsigned long   val;
-};
-
-#define SAVE_ITEM(x) \
-       { .reg = (x) }
-
-/* helper functions to save/restore lists of registers. */
-
-extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
-extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
-extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
-
-/* PM debug functions */
-
-/**
- * struct pm_uart_save - save block for core UART
- * @ulcon: Save value for S3C2410_ULCON
- * @ucon: Save value for S3C2410_UCON
- * @ufcon: Save value for S3C2410_UFCON
- * @umcon: Save value for S3C2410_UMCON
- * @ubrdiv: Save value for S3C2410_UBRDIV
- *
- * Save block for UART registers to be held over sleep and restored if they
- * are needed (say by debug).
-*/
-struct pm_uart_save {
-       u32     ulcon;
-       u32     ucon;
-       u32     ufcon;
-       u32     umcon;
-       u32     ubrdiv;
-       u32     udivslot;
-};
-
-#ifdef CONFIG_SAMSUNG_PM_DEBUG
-/**
- * s3c_pm_dbg() - low level debug function for use in suspend/resume.
- * @msg: The message to print.
- *
- * This function is used mainly to debug the resume process before the system
- * can rely on printk/console output. It uses the low-level debugging output
- * routine printascii() to do its work.
- */
-extern void s3c_pm_dbg(const char *msg, ...);
-
-/**
- * s3c_pm_debug_init() - suspend/resume low level debug initialization.
- * @base: Virtual base of UART to use for suspend/resume debugging.
- *
- * This function needs to be called before S3C_PMDBG() can be used, to set up
- * UART port base address and configuration.
- */
-extern void s3c_pm_debug_init(void);
-
-#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
-
-extern void s3c_pm_save_uarts(void);
-extern void s3c_pm_restore_uarts(void);
-#else
-#define S3C_PMDBG(fmt...) pr_debug(fmt)
-#define s3c_pm_debug_init() do { } while (0)
-
-static inline void s3c_pm_save_uarts(void) { }
-static inline void s3c_pm_restore_uarts(void) { }
-#endif
-
-/* suspend memory checking */
-
-#ifdef CONFIG_SAMSUNG_PM_CHECK
-extern void s3c_pm_check_prepare(void);
-extern void s3c_pm_check_restore(void);
-extern void s3c_pm_check_cleanup(void);
-extern void s3c_pm_check_store(void);
-#else
-#define s3c_pm_check_prepare() do { } while (0)
-#define s3c_pm_check_restore() do { } while (0)
-#define s3c_pm_check_cleanup() do { } while (0)
-#define s3c_pm_check_store()   do { } while (0)
-#endif
-
-#endif
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
deleted file mode 100644 (file)
index 2746137..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Written by Ben Dooks, <ben@simtec.co.uk>
- */
-
-/* s3c_pm_init
- *
- * called from board at initialisation time to setup the power
- * management
-*/
-
-#include <plat/pm-common.h>
-
-struct device;
-
-#ifdef CONFIG_SAMSUNG_PM
-
-extern __init int s3c_pm_init(void);
-extern __init int s3c64xx_pm_init(void);
-
-#else
-
-static inline int s3c_pm_init(void)
-{
-       return 0;
-}
-
-static inline int s3c64xx_pm_init(void)
-{
-       return 0;
-}
-#endif
-
-/* configuration for the IRQ mask over sleep */
-extern unsigned long s3c_irqwake_intmask;
-extern unsigned long s3c_irqwake_eintmask;
-
-/* per-cpu sleep functions */
-
-extern void (*pm_cpu_prep)(void);
-extern int (*pm_cpu_sleep)(unsigned long);
-
-/* Flags for PM Control */
-
-extern unsigned long s3c_pm_flags;
-
-/* from sleep.S */
-
-extern int s3c2410_cpu_suspend(unsigned long);
-
-#ifdef CONFIG_PM_SLEEP
-extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
-extern void s3c_cpu_resume(void);
-#else
-#define s3c_irq_wake NULL
-#define s3c_cpu_resume NULL
-#endif
-
-#ifdef CONFIG_SAMSUNG_PM
-extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
-#else
-#define s3c_irqext_wake NULL
-#endif
-
-#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK
-/**
- * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs
- * @set: set bits for the state of the LEDs
- * @clear: clear bits for the state of the LEDs.
- */
-extern void s3c_pm_debug_smdkled(u32 set, u32 clear);
-
-#else
-static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }
-#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */
-
-/**
- * s3c_pm_configure_extint() - ensure pins are correctly set for IRQ
- *
- * Setup all the necessary GPIO pins for waking the system on external
- * interrupt.
- */
-extern void s3c_pm_configure_extint(void);
-
-#ifdef CONFIG_GPIO_SAMSUNG
-/**
- * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
- *
- * Restore the state of the GPIO pins after sleep, which may involve ensuring
- * that we do not glitch the state of the pins from that the bootloader's
- * resume code has done.
-*/
-extern void samsung_pm_restore_gpios(void);
-
-/**
- * samsung_pm_save_gpios() - save the state of the GPIOs for restoring after sleep.
- *
- * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
- */
-extern void samsung_pm_save_gpios(void);
-#else
-static inline void samsung_pm_restore_gpios(void) {}
-static inline void samsung_pm_save_gpios(void) {}
-#endif
-
-extern void s3c_pm_save_core(void);
-extern void s3c_pm_restore_core(void);
diff --git a/arch/arm/plat-samsung/include/plat/pwm-core.h b/arch/arm/plat-samsung/include/plat/pwm-core.h
deleted file mode 100644 (file)
index 05e3448..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2013 Tomasz Figa <tomasz.figa@gmail.com>
- *
- * Samsung PWM controller platform data helpers.
- */
-
-#ifndef __ASM_ARCH_PWM_CORE_H
-#define __ASM_ARCH_PWM_CORE_H __FILE__
-
-#include <clocksource/samsung_pwm.h>
-
-#ifdef CONFIG_SAMSUNG_DEV_PWM
-extern void samsung_pwm_set_platdata(struct samsung_pwm_variant *pd);
-#else
-static inline void samsung_pwm_set_platdata(struct samsung_pwm_variant *pd) { }
-#endif
-
-#endif /* __ASM_ARCH_PWM_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h b/arch/arm/plat-samsung/include/plat/regs-adc.h
deleted file mode 100644 (file)
index 58953c7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Shannon Holland <holland@loser.net>
- *
- * S3C2410 ADC registers
- */
-
-#ifndef __ASM_ARCH_REGS_ADC_H
-#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
-
-#define S3C2410_ADCREG(x) (x)
-
-#define S3C2410_ADCCON    S3C2410_ADCREG(0x00)
-#define S3C2410_ADCTSC    S3C2410_ADCREG(0x04)
-#define S3C2410_ADCDLY    S3C2410_ADCREG(0x08)
-#define S3C2410_ADCDAT0           S3C2410_ADCREG(0x0C)
-#define S3C2410_ADCDAT1           S3C2410_ADCREG(0x10)
-#define S3C64XX_ADCUPDN                S3C2410_ADCREG(0x14)
-#define S3C2443_ADCMUX         S3C2410_ADCREG(0x18)
-#define S3C64XX_ADCCLRINT      S3C2410_ADCREG(0x18)
-#define S5P_ADCMUX             S3C2410_ADCREG(0x1C)
-#define S3C64XX_ADCCLRINTPNDNUP        S3C2410_ADCREG(0x20)
-
-
-/* ADCCON Register Bits */
-#define S3C64XX_ADCCON_RESSEL          (1<<16)
-#define S3C2410_ADCCON_ECFLG           (1<<15)
-#define S3C2410_ADCCON_PRSCEN          (1<<14)
-#define S3C2410_ADCCON_PRSCVL(x)       (((x)&0xFF)<<6)
-#define S3C2410_ADCCON_PRSCVLMASK      (0xFF<<6)
-#define S3C2410_ADCCON_SELMUX(x)       (((x)&0x7)<<3)
-#define S3C2410_ADCCON_MUXMASK         (0x7<<3)
-#define S3C2416_ADCCON_RESSEL          (1 << 3)
-#define S3C2410_ADCCON_STDBM           (1<<2)
-#define S3C2410_ADCCON_READ_START      (1<<1)
-#define S3C2410_ADCCON_ENABLE_START    (1<<0)
-#define S3C2410_ADCCON_STARTMASK       (0x3<<0)
-
-
-/* ADCTSC Register Bits */
-#define S3C2443_ADCTSC_UD_SEN          (1 << 8)
-#define S3C2410_ADCTSC_YM_SEN          (1<<7)
-#define S3C2410_ADCTSC_YP_SEN          (1<<6)
-#define S3C2410_ADCTSC_XM_SEN          (1<<5)
-#define S3C2410_ADCTSC_XP_SEN          (1<<4)
-#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
-#define S3C2410_ADCTSC_AUTO_PST                (1<<2)
-#define S3C2410_ADCTSC_XY_PST(x)       (((x)&0x3)<<0)
-
-/* ADCDAT0 Bits */
-#define S3C2410_ADCDAT0_UPDOWN         (1<<15)
-#define S3C2410_ADCDAT0_AUTO_PST       (1<<14)
-#define S3C2410_ADCDAT0_XY_PST         (0x3<<12)
-#define S3C2410_ADCDAT0_XPDATA_MASK    (0x03FF)
-
-/* ADCDAT1 Bits */
-#define S3C2410_ADCDAT1_UPDOWN         (1<<15)
-#define S3C2410_ADCDAT1_AUTO_PST       (1<<14)
-#define S3C2410_ADCDAT1_XY_PST         (0x3<<12)
-#define S3C2410_ADCDAT1_YPDATA_MASK    (0x03FF)
-
-#endif /* __ASM_ARCH_REGS_ADC_H */
-
-
diff --git a/arch/arm/plat-samsung/include/plat/regs-irqtype.h b/arch/arm/plat-samsung/include/plat/regs-irqtype.h
deleted file mode 100644 (file)
index ec5c4c5..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C - IRQ detection types.
- */
-
-/* values for S3C2410_EXTINT0/1/2 and other cpus in the series, including
- * the S3C64XX
-*/
-#define S3C2410_EXTINT_LOWLEV   (0x00)
-#define S3C2410_EXTINT_HILEV    (0x01)
-#define S3C2410_EXTINT_FALLEDGE         (0x02)
-#define S3C2410_EXTINT_RISEEDGE         (0x04)
-#define S3C2410_EXTINT_BOTHEDGE         (0x06)
diff --git a/arch/arm/plat-samsung/include/plat/regs-spi.h b/arch/arm/plat-samsung/include/plat/regs-spi.h
deleted file mode 100644 (file)
index 6078443..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2004 Fetron GmbH
- *
- * S3C2410 SPI register definition
- */
-
-#ifndef __ASM_ARCH_REGS_SPI_H
-#define __ASM_ARCH_REGS_SPI_H
-
-#define S3C2410_SPI1           (0x20)
-#define S3C2412_SPI1           (0x100)
-
-#define S3C2410_SPCON          (0x00)
-
-#define S3C2410_SPCON_SMOD_DMA (2 << 5)        /* DMA mode */
-#define S3C2410_SPCON_SMOD_INT (1 << 5)        /* interrupt mode */
-#define S3C2410_SPCON_SMOD_POLL        (0 << 5)        /* polling mode */
-#define S3C2410_SPCON_ENSCK    (1 << 4)        /* Enable SCK */
-#define S3C2410_SPCON_MSTR     (1 << 3)        /* Master:1, Slave:0 select */
-#define S3C2410_SPCON_CPOL_HIGH        (1 << 2)        /* Clock polarity select */
-#define S3C2410_SPCON_CPOL_LOW (0 << 2)        /* Clock polarity select */
-
-#define S3C2410_SPCON_CPHA_FMTB        (1 << 1)        /* Clock Phase Select */
-#define S3C2410_SPCON_CPHA_FMTA        (0 << 1)        /* Clock Phase Select */
-
-#define S3C2410_SPSTA          (0x04)
-
-#define S3C2410_SPSTA_DCOL     (1 << 2)        /* Data Collision Error */
-#define S3C2410_SPSTA_MULD     (1 << 1)        /* Multi Master Error */
-#define S3C2410_SPSTA_READY    (1 << 0)        /* Data Tx/Rx ready */
-#define S3C2412_SPSTA_READY_ORG        (1 << 3)
-
-#define S3C2410_SPPIN          (0x08)
-
-#define S3C2410_SPPIN_ENMUL    (1 << 2)        /* Multi Master Error detect */
-#define S3C2410_SPPIN_RESERVED (1 << 1)
-#define S3C2410_SPPIN_KEEP     (1 << 0)        /* Master Out keep */
-
-#define S3C2410_SPPRE          (0x0C)
-#define S3C2410_SPTDAT         (0x10)
-#define S3C2410_SPRDAT         (0x14)
-
-#endif /* __ASM_ARCH_REGS_SPI_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-udc.h b/arch/arm/plat-samsung/include/plat/regs-udc.h
deleted file mode 100644 (file)
index d8d2eea..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
- */
-
-#ifndef __ASM_ARCH_REGS_UDC_H
-#define __ASM_ARCH_REGS_UDC_H
-
-#define S3C2410_USBDREG(x) (x)
-
-#define S3C2410_UDC_FUNC_ADDR_REG      S3C2410_USBDREG(0x0140)
-#define S3C2410_UDC_PWR_REG            S3C2410_USBDREG(0x0144)
-#define S3C2410_UDC_EP_INT_REG         S3C2410_USBDREG(0x0148)
-
-#define S3C2410_UDC_USB_INT_REG                S3C2410_USBDREG(0x0158)
-#define S3C2410_UDC_EP_INT_EN_REG      S3C2410_USBDREG(0x015c)
-
-#define S3C2410_UDC_USB_INT_EN_REG     S3C2410_USBDREG(0x016c)
-
-#define S3C2410_UDC_FRAME_NUM1_REG     S3C2410_USBDREG(0x0170)
-#define S3C2410_UDC_FRAME_NUM2_REG     S3C2410_USBDREG(0x0174)
-
-#define S3C2410_UDC_EP0_FIFO_REG       S3C2410_USBDREG(0x01c0)
-#define S3C2410_UDC_EP1_FIFO_REG       S3C2410_USBDREG(0x01c4)
-#define S3C2410_UDC_EP2_FIFO_REG       S3C2410_USBDREG(0x01c8)
-#define S3C2410_UDC_EP3_FIFO_REG       S3C2410_USBDREG(0x01cc)
-#define S3C2410_UDC_EP4_FIFO_REG       S3C2410_USBDREG(0x01d0)
-
-#define S3C2410_UDC_EP1_DMA_CON                S3C2410_USBDREG(0x0200)
-#define S3C2410_UDC_EP1_DMA_UNIT       S3C2410_USBDREG(0x0204)
-#define S3C2410_UDC_EP1_DMA_FIFO       S3C2410_USBDREG(0x0208)
-#define S3C2410_UDC_EP1_DMA_TTC_L      S3C2410_USBDREG(0x020c)
-#define S3C2410_UDC_EP1_DMA_TTC_M      S3C2410_USBDREG(0x0210)
-#define S3C2410_UDC_EP1_DMA_TTC_H      S3C2410_USBDREG(0x0214)
-
-#define S3C2410_UDC_EP2_DMA_CON                S3C2410_USBDREG(0x0218)
-#define S3C2410_UDC_EP2_DMA_UNIT       S3C2410_USBDREG(0x021c)
-#define S3C2410_UDC_EP2_DMA_FIFO       S3C2410_USBDREG(0x0220)
-#define S3C2410_UDC_EP2_DMA_TTC_L      S3C2410_USBDREG(0x0224)
-#define S3C2410_UDC_EP2_DMA_TTC_M      S3C2410_USBDREG(0x0228)
-#define S3C2410_UDC_EP2_DMA_TTC_H      S3C2410_USBDREG(0x022c)
-
-#define S3C2410_UDC_EP3_DMA_CON                S3C2410_USBDREG(0x0240)
-#define S3C2410_UDC_EP3_DMA_UNIT       S3C2410_USBDREG(0x0244)
-#define S3C2410_UDC_EP3_DMA_FIFO       S3C2410_USBDREG(0x0248)
-#define S3C2410_UDC_EP3_DMA_TTC_L      S3C2410_USBDREG(0x024c)
-#define S3C2410_UDC_EP3_DMA_TTC_M      S3C2410_USBDREG(0x0250)
-#define S3C2410_UDC_EP3_DMA_TTC_H      S3C2410_USBDREG(0x0254)
-
-#define S3C2410_UDC_EP4_DMA_CON                S3C2410_USBDREG(0x0258)
-#define S3C2410_UDC_EP4_DMA_UNIT       S3C2410_USBDREG(0x025c)
-#define S3C2410_UDC_EP4_DMA_FIFO       S3C2410_USBDREG(0x0260)
-#define S3C2410_UDC_EP4_DMA_TTC_L      S3C2410_USBDREG(0x0264)
-#define S3C2410_UDC_EP4_DMA_TTC_M      S3C2410_USBDREG(0x0268)
-#define S3C2410_UDC_EP4_DMA_TTC_H      S3C2410_USBDREG(0x026c)
-
-#define S3C2410_UDC_INDEX_REG          S3C2410_USBDREG(0x0178)
-
-/* indexed registers */
-
-#define S3C2410_UDC_MAXP_REG           S3C2410_USBDREG(0x0180)
-
-#define S3C2410_UDC_EP0_CSR_REG                S3C2410_USBDREG(0x0184)
-
-#define S3C2410_UDC_IN_CSR1_REG                S3C2410_USBDREG(0x0184)
-#define S3C2410_UDC_IN_CSR2_REG                S3C2410_USBDREG(0x0188)
-
-#define S3C2410_UDC_OUT_CSR1_REG       S3C2410_USBDREG(0x0190)
-#define S3C2410_UDC_OUT_CSR2_REG       S3C2410_USBDREG(0x0194)
-#define S3C2410_UDC_OUT_FIFO_CNT1_REG  S3C2410_USBDREG(0x0198)
-#define S3C2410_UDC_OUT_FIFO_CNT2_REG  S3C2410_USBDREG(0x019c)
-
-#define S3C2410_UDC_FUNCADDR_UPDATE    (1 << 7)
-
-#define S3C2410_UDC_PWR_ISOUP          (1 << 7) /* R/W */
-#define S3C2410_UDC_PWR_RESET          (1 << 3) /* R   */
-#define S3C2410_UDC_PWR_RESUME         (1 << 2) /* R/W */
-#define S3C2410_UDC_PWR_SUSPEND                (1 << 1) /* R   */
-#define S3C2410_UDC_PWR_ENSUSPEND      (1 << 0) /* R/W */
-
-#define S3C2410_UDC_PWR_DEFAULT                (0x00)
-
-#define S3C2410_UDC_INT_EP4            (1 << 4) /* R/W (clear only) */
-#define S3C2410_UDC_INT_EP3            (1 << 3) /* R/W (clear only) */
-#define S3C2410_UDC_INT_EP2            (1 << 2) /* R/W (clear only) */
-#define S3C2410_UDC_INT_EP1            (1 << 1) /* R/W (clear only) */
-#define S3C2410_UDC_INT_EP0            (1 << 0) /* R/W (clear only) */
-
-#define S3C2410_UDC_USBINT_RESET       (1 << 2) /* R/W (clear only) */
-#define S3C2410_UDC_USBINT_RESUME      (1 << 1) /* R/W (clear only) */
-#define S3C2410_UDC_USBINT_SUSPEND     (1 << 0) /* R/W (clear only) */
-
-#define S3C2410_UDC_INTE_EP4           (1 << 4) /* R/W */
-#define S3C2410_UDC_INTE_EP3           (1 << 3) /* R/W */
-#define S3C2410_UDC_INTE_EP2           (1 << 2) /* R/W */
-#define S3C2410_UDC_INTE_EP1           (1 << 1) /* R/W */
-#define S3C2410_UDC_INTE_EP0           (1 << 0) /* R/W */
-
-#define S3C2410_UDC_USBINTE_RESET      (1 << 2) /* R/W */
-#define S3C2410_UDC_USBINTE_SUSPEND    (1 << 0) /* R/W */
-
-#define S3C2410_UDC_INDEX_EP0          (0x00)
-#define S3C2410_UDC_INDEX_EP1          (0x01)
-#define S3C2410_UDC_INDEX_EP2          (0x02)
-#define S3C2410_UDC_INDEX_EP3          (0x03)
-#define S3C2410_UDC_INDEX_EP4          (0x04)
-
-#define S3C2410_UDC_ICSR1_CLRDT                (1 << 6) /* R/W */
-#define S3C2410_UDC_ICSR1_SENTSTL      (1 << 5) /* R/W (clear only) */
-#define S3C2410_UDC_ICSR1_SENDSTL      (1 << 4) /* R/W */
-#define S3C2410_UDC_ICSR1_FFLUSH       (1 << 3) /* W   (set only) */
-#define S3C2410_UDC_ICSR1_UNDRUN       (1 << 2) /* R/W (clear only) */
-#define S3C2410_UDC_ICSR1_PKTRDY       (1 << 0) /* R/W (set only) */
-
-#define S3C2410_UDC_ICSR2_AUTOSET      (1 << 7) /* R/W */
-#define S3C2410_UDC_ICSR2_ISO          (1 << 6) /* R/W */
-#define S3C2410_UDC_ICSR2_MODEIN       (1 << 5) /* R/W */
-#define S3C2410_UDC_ICSR2_DMAIEN       (1 << 4) /* R/W */
-
-#define S3C2410_UDC_OCSR1_CLRDT                (1 << 7) /* R/W */
-#define S3C2410_UDC_OCSR1_SENTSTL      (1 << 6) /* R/W (clear only) */
-#define S3C2410_UDC_OCSR1_SENDSTL      (1 << 5) /* R/W */
-#define S3C2410_UDC_OCSR1_FFLUSH       (1 << 4) /* R/W */
-#define S3C2410_UDC_OCSR1_DERROR       (1 << 3) /* R   */
-#define S3C2410_UDC_OCSR1_OVRRUN       (1 << 2) /* R/W (clear only) */
-#define S3C2410_UDC_OCSR1_PKTRDY       (1 << 0) /* R/W (clear only) */
-
-#define S3C2410_UDC_OCSR2_AUTOCLR      (1 << 7) /* R/W */
-#define S3C2410_UDC_OCSR2_ISO          (1 << 6) /* R/W */
-#define S3C2410_UDC_OCSR2_DMAIEN       (1 << 5) /* R/W */
-
-#define S3C2410_UDC_EP0_CSR_OPKRDY     (1 << 0)
-#define S3C2410_UDC_EP0_CSR_IPKRDY     (1 << 1)
-#define S3C2410_UDC_EP0_CSR_SENTSTL    (1 << 2)
-#define S3C2410_UDC_EP0_CSR_DE         (1 << 3)
-#define S3C2410_UDC_EP0_CSR_SE         (1 << 4)
-#define S3C2410_UDC_EP0_CSR_SENDSTL    (1 << 5)
-#define S3C2410_UDC_EP0_CSR_SOPKTRDY   (1 << 6)
-#define S3C2410_UDC_EP0_CSR_SSE                (1 << 7)
-
-#define S3C2410_UDC_MAXP_8             (1 << 0)
-#define S3C2410_UDC_MAXP_16            (1 << 1)
-#define S3C2410_UDC_MAXP_32            (1 << 2)
-#define S3C2410_UDC_MAXP_64            (1 << 3)
-
-#endif
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
deleted file mode 100644 (file)
index 32ab086..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com/
- *
- * Header file for samsung s3c and s5p time support
- */
-
-#ifndef __ASM_PLAT_SAMSUNG_TIME_H
-#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
-
-/* Samsung HR-Timer Clock mode */
-enum samsung_timer_mode {
-       SAMSUNG_PWM0,
-       SAMSUNG_PWM1,
-       SAMSUNG_PWM2,
-       SAMSUNG_PWM3,
-       SAMSUNG_PWM4,
-};
-
-extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
-                                       enum samsung_timer_mode source);
-
-extern void __init samsung_timer_init(void);
-
-#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
deleted file mode 100644 (file)
index 5731e42..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C Platform - SDHCI (HSMMC) platform data definitions
- */
-
-#ifndef __PLAT_S3C_SDHCI_H
-#define __PLAT_S3C_SDHCI_H __FILE__
-
-#include <linux/platform_data/mmc-sdhci-s3c.h>
-#include <plat/devs.h>
-
-/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
- * @pd: The default platform data for this device.
- * @set: Pointer to the platform data to fill in.
- */
-extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
-                                   struct s3c_sdhci_platdata *set);
-
-/**
- * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
- * @pd: Platform data to register to device.
- *
- * Register the given platform data for use withe S3C SDHCI device.
- * The call will copy the platform data, so the board definitions can
- * make the structure itself __initdata.
- */
-extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
-extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
-extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
-extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
-
-/* Default platform data, exported so that per-cpu initialisation can
- * set the correct one when there are more than one cpu type selected.
-*/
-
-extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
-extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
-extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
-extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
-
-/* Helper function availability */
-
-extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
-extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
-extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
-extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
-extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
-
-/* S3C2416 SDHCI setup */
-
-#ifdef CONFIG_S3C2416_SETUP_SDHCI
-static inline void s3c2416_default_sdhci0(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC
-       s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
-#endif /* CONFIG_S3C_DEV_HSMMC */
-}
-
-static inline void s3c2416_default_sdhci1(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC1
-       s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
-#endif /* CONFIG_S3C_DEV_HSMMC1 */
-}
-
-#else
-static inline void s3c2416_default_sdhci0(void) { }
-static inline void s3c2416_default_sdhci1(void) { }
-
-#endif /* CONFIG_S3C2416_SETUP_SDHCI */
-
-/* S3C64XX SDHCI setup */
-
-#ifdef CONFIG_S3C64XX_SETUP_SDHCI
-static inline void s3c6400_default_sdhci0(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC
-       s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
-#endif
-}
-
-static inline void s3c6400_default_sdhci1(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC1
-       s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
-#endif
-}
-
-static inline void s3c6400_default_sdhci2(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC2
-       s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
-#endif
-}
-
-static inline void s3c6410_default_sdhci0(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC
-       s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
-#endif
-}
-
-static inline void s3c6410_default_sdhci1(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC1
-       s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
-#endif
-}
-
-static inline void s3c6410_default_sdhci2(void)
-{
-#ifdef CONFIG_S3C_DEV_HSMMC2
-       s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
-#endif
-}
-
-#else
-static inline void s3c6410_default_sdhci0(void) { }
-static inline void s3c6410_default_sdhci1(void) { }
-static inline void s3c6410_default_sdhci2(void) { }
-static inline void s3c6400_default_sdhci0(void) { }
-static inline void s3c6400_default_sdhci1(void) { }
-static inline void s3c6400_default_sdhci2(void) { }
-
-#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
-
-static inline void s3c_sdhci_setname(int id, char *name)
-{
-       switch (id) {
-#ifdef CONFIG_S3C_DEV_HSMMC
-       case 0:
-               s3c_device_hsmmc0.name = name;
-               break;
-#endif
-#ifdef CONFIG_S3C_DEV_HSMMC1
-       case 1:
-               s3c_device_hsmmc1.name = name;
-               break;
-#endif
-#ifdef CONFIG_S3C_DEV_HSMMC2
-       case 2:
-               s3c_device_hsmmc2.name = name;
-               break;
-#endif
-#ifdef CONFIG_S3C_DEV_HSMMC3
-       case 3:
-               s3c_device_hsmmc3.name = name;
-               break;
-#endif
-       default:
-               break;
-       }
-}
-#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h b/arch/arm/plat-samsung/include/plat/usb-phy.h
deleted file mode 100644 (file)
index 759d66a..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2011 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <jy0922.shim@samsung.com>
- */
-
-#ifndef __PLAT_SAMSUNG_USB_PHY_H
-#define __PLAT_SAMSUNG_USB_PHY_H __FILE__
-
-extern int s3c_usb_phy_init(struct platform_device *pdev, int type);
-extern int s3c_usb_phy_exit(struct platform_device *pdev, int type);
-
-#endif /* __PLAT_SAMSUNG_USB_PHY_H */
diff --git a/arch/arm/plat-samsung/include/plat/wakeup-mask.h b/arch/arm/plat-samsung/include/plat/wakeup-mask.h
deleted file mode 100644 (file)
index 630909e..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
- *
- * Support for wakeup mask interrupts on newer SoCs
- */
-
-#ifndef __PLAT_WAKEUP_MASK_H
-#define __PLAT_WAKEUP_MASK_H __file__
-
-/* if no irq yet defined, but still want to mask */
-#define NO_WAKEUP_IRQ (0x90000000)
-
-/**
- * struct samsung_wakeup_mask - wakeup mask information
- * @irq: The interrupt associated with this wakeup.
- * @bit: The bit, as a (1 << bitno) controlling this source.
- */ 
-struct samsung_wakeup_mask {
-       unsigned int    irq;
-       u32             bit;
-};
-
-/**
- * samsung_sync_wakemask - sync wakeup mask information for pm
- * @reg: The register that is used.
- * @masks: The list of masks to use.
- * @nr_masks: The number of entries pointed to buy @masks.
- *
- * Synchronise the wakeup mask information at suspend time from the list
- * of interrupts and control bits in @masks. We do this at suspend time
- * as overriding the relevant irq chips is harder and the register is only
- * required to be correct before we enter sleep.
- */
-extern void samsung_sync_wakemask(void __iomem *reg,
-                                 const struct samsung_wakeup_mask *masks,
-                                 int nr_masks);
-
-#endif /* __PLAT_WAKEUP_MASK_H */
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
deleted file mode 100644 (file)
index e9acf02..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// S3C series CPU initialisation
-
-/*
- * NOTE: Code in this file is not used on S3C64xx when booting with
- * Device Tree support.
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <plat/cpu.h>
-#include <plat/devs.h>
-
-static struct cpu_table *cpu;
-
-static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
-                                               struct cpu_table *tab,
-                                               unsigned int count)
-{
-       for (; count != 0; count--, tab++) {
-               if ((idcode & tab->idmask) == (tab->idcode & tab->idmask))
-                       return tab;
-       }
-
-       return NULL;
-}
-
-void __init s3c_init_cpu(unsigned long idcode,
-                        struct cpu_table *cputab, unsigned int cputab_size)
-{
-       cpu = s3c_lookup_cpu(idcode, cputab, cputab_size);
-
-       if (cpu == NULL) {
-               printk(KERN_ERR "Unknown CPU type 0x%08lx\n", idcode);
-               panic("Unknown S3C24XX CPU");
-       }
-
-       printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
-
-       if (cpu->init == NULL) {
-               printk(KERN_ERR "CPU %s support not enabled\n", cpu->name);
-               panic("Unsupported Samsung CPU");
-       }
-
-       if (cpu->map_io)
-               cpu->map_io();
-}
-
-/* s3c24xx_init_clocks
- *
- * Initialise the clock subsystem and associated information from the
- * given master crystal value.
- *
- * xtal  = 0 -> use default PLL crystal value (normally 12MHz)
- *      != 0 -> PLL crystal value in Hz
-*/
-
-void __init s3c24xx_init_clocks(int xtal)
-{
-       if (xtal == 0)
-               xtal = 12*1000*1000;
-
-       if (cpu == NULL)
-               panic("s3c24xx_init_clocks: no cpu setup?\n");
-
-       if (cpu->init_clocks == NULL)
-               panic("s3c24xx_init_clocks: cpu has no clock init\n");
-       else
-               (cpu->init_clocks)(xtal);
-}
-
-/* uart management */
-#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
-static int nr_uarts __initdata = 0;
-
-#ifdef CONFIG_SERIAL_SAMSUNG_UARTS
-static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS];
-#endif
-
-/* s3c24xx_init_uartdevs
- *
- * copy the specified platform data and configuration into our central
- * set of devices, before the data is thrown away after the init process.
- *
- * This also fills in the array passed to the serial driver for the
- * early initialisation of the console.
-*/
-
-void __init s3c24xx_init_uartdevs(char *name,
-                                 struct s3c24xx_uart_resources *res,
-                                 struct s3c2410_uartcfg *cfg, int no)
-{
-#ifdef CONFIG_SERIAL_SAMSUNG_UARTS
-       struct platform_device *platdev;
-       struct s3c2410_uartcfg *cfgptr = uart_cfgs;
-       struct s3c24xx_uart_resources *resp;
-       int uart;
-
-       memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no);
-
-       for (uart = 0; uart < no; uart++, cfg++, cfgptr++) {
-               platdev = s3c24xx_uart_src[cfgptr->hwport];
-
-               resp = res + cfgptr->hwport;
-
-               s3c24xx_uart_devs[uart] = platdev;
-
-               platdev->name = name;
-               platdev->resource = resp->resources;
-               platdev->num_resources = resp->nr_resources;
-
-               platdev->dev.platform_data = cfgptr;
-       }
-
-       nr_uarts = no;
-#endif
-}
-
-void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
-{
-       if (cpu == NULL)
-               return;
-
-       if (cpu->init_uarts == NULL && IS_ENABLED(CONFIG_SAMSUNG_ATAGS)) {
-               printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
-       } else
-               (cpu->init_uarts)(cfg, no);
-}
-#endif
-
-static int __init s3c_arch_init(void)
-{
-       int ret;
-
-       /* init is only needed for ATAGS based platforms */
-       if (!IS_ENABLED(CONFIG_ATAGS) ||
-           (!soc_is_s3c24xx() && !soc_is_s3c64xx()))
-               return 0;
-
-       // do the correct init for cpu
-
-       if (cpu == NULL) {
-               /* Not needed when booting with device tree. */
-               if (of_have_populated_dt())
-                       return 0;
-               panic("s3c_arch_init: NULL cpu\n");
-       }
-
-       ret = (cpu->init)();
-       if (ret != 0)
-               return ret;
-#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
-       ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
-#endif
-       return ret;
-}
-
-arch_initcall(s3c_arch_init);
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c
deleted file mode 100644 (file)
index cbc3b4b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
-//
-// Helper for platform data setting
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/platform_device.h>
-
-#include <plat/devs.h>
-#include <plat/sdhci.h>
-
-void __init *s3c_set_platdata(void *pd, size_t pdsize,
-                             struct platform_device *pdev)
-{
-       void *npd;
-
-       if (!pd) {
-               /* too early to use dev_name(), may not be registered */
-               printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
-               return NULL;
-       }
-
-       npd = kmemdup(pd, pdsize, GFP_KERNEL);
-       if (!npd)
-               return NULL;
-
-       pdev->dev.platform_data = npd;
-       return npd;
-}
-
-void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
-                            struct s3c_sdhci_platdata *set)
-{
-       set->cd_type = pd->cd_type;
-       set->ext_cd_init = pd->ext_cd_init;
-       set->ext_cd_cleanup = pd->ext_cd_cleanup;
-       set->ext_cd_gpio = pd->ext_cd_gpio;
-       set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
-
-       if (pd->max_width)
-               set->max_width = pd->max_width;
-       if (pd->cfg_gpio)
-               set->cfg_gpio = pd->cfg_gpio;
-       if (pd->host_caps)
-               set->host_caps |= pd->host_caps;
-       if (pd->host_caps2)
-               set->host_caps2 |= pd->host_caps2;
-       if (pd->pm_caps)
-               set->pm_caps |= pd->pm_caps;
-}
diff --git a/arch/arm/plat-samsung/pm-check.c b/arch/arm/plat-samsung/pm-check.c
deleted file mode 100644 (file)
index cd2c02c..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// originally in linux/arch/arm/plat-s3c24xx/pm.c
-//
-// Copyright (c) 2004-2008 Simtec Electronics
-//     http://armlinux.simtec.co.uk
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// S3C Power Mangament - suspend/resume memory corruption check.
-
-#include <linux/kernel.h>
-#include <linux/suspend.h>
-#include <linux/init.h>
-#include <linux/crc32.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-
-#include <plat/pm-common.h>
-
-#if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1
-#error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
-#endif
-
-/* suspend checking code...
- *
- * this next area does a set of crc checks over all the installed
- * memory, so the system can verify if the resume was ok.
- *
- * CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE defines the block-size for the CRC,
- * increasing it will mean that the area corrupted will be less easy to spot,
- * and reducing the size will cause the CRC save area to grow
-*/
-
-#define CHECK_CHUNKSIZE (CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE * 1024)
-
-static u32 crc_size;   /* size needed for the crc block */
-static u32 *crcs;      /* allocated over suspend/resume */
-
-typedef u32 *(run_fn_t)(struct resource *ptr, u32 *arg);
-
-/* s3c_pm_run_res
- *
- * go through the given resource list, and look for system ram
-*/
-
-static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
-{
-       while (ptr != NULL) {
-               if (ptr->child != NULL)
-                       s3c_pm_run_res(ptr->child, fn, arg);
-
-               if ((ptr->flags & IORESOURCE_SYSTEM_RAM)
-                               == IORESOURCE_SYSTEM_RAM) {
-                       S3C_PMDBG("Found system RAM at %08lx..%08lx\n",
-                                 (unsigned long)ptr->start,
-                                 (unsigned long)ptr->end);
-                       arg = (fn)(ptr, arg);
-               }
-
-               ptr = ptr->sibling;
-       }
-}
-
-static void s3c_pm_run_sysram(run_fn_t fn, u32 *arg)
-{
-       s3c_pm_run_res(&iomem_resource, fn, arg);
-}
-
-static u32 *s3c_pm_countram(struct resource *res, u32 *val)
-{
-       u32 size = (u32)resource_size(res);
-
-       size += CHECK_CHUNKSIZE-1;
-       size /= CHECK_CHUNKSIZE;
-
-       S3C_PMDBG("Area %08lx..%08lx, %d blocks\n",
-                 (unsigned long)res->start, (unsigned long)res->end, size);
-
-       *val += size * sizeof(u32);
-       return val;
-}
-
-/* s3c_pm_prepare_check
- *
- * prepare the necessary information for creating the CRCs. This
- * must be done before the final save, as it will require memory
- * allocating, and thus touching bits of the kernel we do not
- * know about.
-*/
-
-void s3c_pm_check_prepare(void)
-{
-       crc_size = 0;
-
-       s3c_pm_run_sysram(s3c_pm_countram, &crc_size);
-
-       S3C_PMDBG("s3c_pm_prepare_check: %u checks needed\n", crc_size);
-
-       crcs = kmalloc(crc_size+4, GFP_KERNEL);
-       if (crcs == NULL)
-               printk(KERN_ERR "Cannot allocated CRC save area\n");
-}
-
-static u32 *s3c_pm_makecheck(struct resource *res, u32 *val)
-{
-       unsigned long addr, left;
-
-       for (addr = res->start; addr < res->end;
-            addr += CHECK_CHUNKSIZE) {
-               left = res->end - addr;
-
-               if (left > CHECK_CHUNKSIZE)
-                       left = CHECK_CHUNKSIZE;
-
-               *val = crc32_le(~0, phys_to_virt(addr), left);
-               val++;
-       }
-
-       return val;
-}
-
-/* s3c_pm_check_store
- *
- * compute the CRC values for the memory blocks before the final
- * sleep.
-*/
-
-void s3c_pm_check_store(void)
-{
-       if (crcs != NULL)
-               s3c_pm_run_sysram(s3c_pm_makecheck, crcs);
-}
-
-/* in_region
- *
- * return TRUE if the area defined by ptr..ptr+size contains the
- * what..what+whatsz
-*/
-
-static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
-{
-       if ((what+whatsz) < ptr)
-               return 0;
-
-       if (what > (ptr+size))
-               return 0;
-
-       return 1;
-}
-
-/**
- * s3c_pm_runcheck() - helper to check a resource on restore.
- * @res: The resource to check
- * @vak: Pointer to list of CRC32 values to check.
- *
- * Called from the s3c_pm_check_restore() via s3c_pm_run_sysram(), this
- * function runs the given memory resource checking it against the stored
- * CRC to ensure that memory is restored. The function tries to skip as
- * many of the areas used during the suspend process.
- */
-static u32 *s3c_pm_runcheck(struct resource *res, u32 *val)
-{
-       unsigned long addr;
-       unsigned long left;
-       void *stkpage;
-       void *ptr;
-       u32 calc;
-
-       stkpage = (void *)((u32)&calc & ~PAGE_MASK);
-
-       for (addr = res->start; addr < res->end;
-            addr += CHECK_CHUNKSIZE) {
-               left = res->end - addr;
-
-               if (left > CHECK_CHUNKSIZE)
-                       left = CHECK_CHUNKSIZE;
-
-               ptr = phys_to_virt(addr);
-
-               if (in_region(ptr, left, stkpage, 4096)) {
-                       S3C_PMDBG("skipping %08lx, has stack in\n", addr);
-                       goto skip_check;
-               }
-
-               if (in_region(ptr, left, crcs, crc_size)) {
-                       S3C_PMDBG("skipping %08lx, has crc block in\n", addr);
-                       goto skip_check;
-               }
-
-               /* calculate and check the checksum */
-
-               calc = crc32_le(~0, ptr, left);
-               if (calc != *val) {
-                       printk(KERN_ERR "Restore CRC error at "
-                              "%08lx (%08x vs %08x)\n", addr, calc, *val);
-
-                       S3C_PMDBG("Restore CRC error at %08lx (%08x vs %08x)\n",
-                           addr, calc, *val);
-               }
-
-       skip_check:
-               val++;
-       }
-
-       return val;
-}
-
-/**
- * s3c_pm_check_restore() - memory check called on resume
- *
- * check the CRCs after the restore event and free the memory used
- * to hold them
-*/
-void s3c_pm_check_restore(void)
-{
-       if (crcs != NULL)
-               s3c_pm_run_sysram(s3c_pm_runcheck, crcs);
-}
-
-/**
- * s3c_pm_check_cleanup() - free memory resources
- *
- * Free the resources that where allocated by the suspend
- * memory check code. We do this separately from the
- * s3c_pm_check_restore() function as we cannot call any
- * functions that might sleep during that resume.
- */
-void s3c_pm_check_cleanup(void)
-{
-       kfree(crcs);
-       crcs = NULL;
-}
-
diff --git a/arch/arm/plat-samsung/pm-common.c b/arch/arm/plat-samsung/pm-common.c
deleted file mode 100644 (file)
index 59a10c6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2013 Samsung Electronics Co., Ltd.
-//     Tomasz Figa <t.figa@samsung.com>
-// Copyright (C) 2008 Openmoko, Inc.
-// Copyright (C) 2004-2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Samsung common power management helper functions.
-
-#include <linux/io.h>
-#include <linux/kernel.h>
-
-#include <plat/pm-common.h>
-
-/* helper functions to save and restore register state */
-
-/**
- * s3c_pm_do_save() - save a set of registers for restoration on resume.
- * @ptr: Pointer to an array of registers.
- * @count: Size of the ptr array.
- *
- * Run through the list of registers given, saving their contents in the
- * array for later restoration when we wakeup.
- */
-void s3c_pm_do_save(struct sleep_save *ptr, int count)
-{
-       for (; count > 0; count--, ptr++) {
-               ptr->val = readl_relaxed(ptr->reg);
-               S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
-       }
-}
-
-/**
- * s3c_pm_do_restore() - restore register values from the save list.
- * @ptr: Pointer to an array of registers.
- * @count: Size of the ptr array.
- *
- * Restore the register values saved from s3c_pm_do_save().
- *
- * Note, we do not use S3C_PMDBG() in here, as the system may not have
- * restore the UARTs state yet
-*/
-
-void s3c_pm_do_restore(const struct sleep_save *ptr, int count)
-{
-       for (; count > 0; count--, ptr++) {
-               pr_debug("restore %p (restore %08lx, was %08x)\n",
-                               ptr->reg, ptr->val, readl_relaxed(ptr->reg));
-
-               writel_relaxed(ptr->val, ptr->reg);
-       }
-}
-
-/**
- * s3c_pm_do_restore_core() - early restore register values from save list.
- *
- * This is similar to s3c_pm_do_restore() except we try and minimise the
- * side effects of the function in case registers that hardware might need
- * to work has been restored.
- *
- * WARNING: Do not put any debug in here that may effect memory or use
- * peripherals, as things may be changing!
-*/
-
-void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
-{
-       for (; count > 0; count--, ptr++)
-               writel_relaxed(ptr->val, ptr->reg);
-}
diff --git a/arch/arm/plat-samsung/pm-debug.c b/arch/arm/plat-samsung/pm-debug.c
deleted file mode 100644 (file)
index b76b1e9..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (C) 2013 Samsung Electronics Co., Ltd.
-//     Tomasz Figa <t.figa@samsung.com>
-// Copyright (C) 2008 Openmoko, Inc.
-// Copyright (C) 2004-2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// Samsung common power management (suspend to RAM) debug support
-
-#include <linux/serial_core.h>
-#include <linux/serial_s3c.h>
-#include <linux/io.h>
-
-#include <asm/mach/map.h>
-
-#include <plat/cpu.h>
-#include <plat/pm-common.h>
-
-#ifdef CONFIG_SAMSUNG_ATAGS
-#include <plat/pm.h>
-#include <mach/pm-core.h>
-#else
-static inline void s3c_pm_debug_init_uart(void) {}
-static inline void s3c_pm_arch_update_uart(void __iomem *regs,
-                                          struct pm_uart_save *save) {}
-#endif
-
-static struct pm_uart_save uart_save;
-
-extern void printascii(const char *);
-
-void s3c_pm_dbg(const char *fmt, ...)
-{
-       va_list va;
-       char buff[256];
-
-       va_start(va, fmt);
-       vsnprintf(buff, sizeof(buff), fmt, va);
-       va_end(va);
-
-       printascii(buff);
-}
-
-void s3c_pm_debug_init(void)
-{
-       /* restart uart clocks so we can use them to output */
-       s3c_pm_debug_init_uart();
-}
-
-static inline void __iomem *s3c_pm_uart_base(void)
-{
-       unsigned long paddr;
-       unsigned long vaddr;
-
-       debug_ll_addr(&paddr, &vaddr);
-
-       return (void __iomem *)vaddr;
-}
-
-void s3c_pm_save_uarts(void)
-{
-       void __iomem *regs = s3c_pm_uart_base();
-       struct pm_uart_save *save = &uart_save;
-
-       save->ulcon = __raw_readl(regs + S3C2410_ULCON);
-       save->ucon = __raw_readl(regs + S3C2410_UCON);
-       save->ufcon = __raw_readl(regs + S3C2410_UFCON);
-       save->umcon = __raw_readl(regs + S3C2410_UMCON);
-       save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);
-
-       if (!soc_is_s3c2410())
-               save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);
-
-       S3C_PMDBG("UART[%p]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
-                 regs, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);
-}
-
-void s3c_pm_restore_uarts(void)
-{
-       void __iomem *regs = s3c_pm_uart_base();
-       struct pm_uart_save *save = &uart_save;
-
-       s3c_pm_arch_update_uart(regs, save);
-
-       __raw_writel(save->ulcon, regs + S3C2410_ULCON);
-       __raw_writel(save->ucon,  regs + S3C2410_UCON);
-       __raw_writel(save->ufcon, regs + S3C2410_UFCON);
-       __raw_writel(save->umcon, regs + S3C2410_UMCON);
-       __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);
-
-       if (!soc_is_s3c2410())
-               __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);
-}
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
deleted file mode 100644 (file)
index cb2e3bc..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// S3C series GPIO PM code
-
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-
-#include <mach/gpio-samsung.h>
-
-#include <plat/gpio-core.h>
-#include <plat/pm.h>
-
-/* PM GPIO helpers */
-
-#define OFFS_CON       (0x00)
-#define OFFS_DAT       (0x04)
-#define OFFS_UP                (0x08)
-
-static void samsung_gpio_pm_1bit_save(struct samsung_gpio_chip *chip)
-{
-       chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
-       chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
-}
-
-static void samsung_gpio_pm_1bit_resume(struct samsung_gpio_chip *chip)
-{
-       void __iomem *base = chip->base;
-       u32 old_gpcon = __raw_readl(base + OFFS_CON);
-       u32 old_gpdat = __raw_readl(base + OFFS_DAT);
-       u32 gps_gpcon = chip->pm_save[0];
-       u32 gps_gpdat = chip->pm_save[1];
-       u32 gpcon;
-
-       /* GPACON only has one bit per control / data and no PULLUPs.
-        * GPACON[x] = 0 => Output, 1 => SFN */
-
-       /* first set all SFN bits to SFN */
-
-       gpcon = old_gpcon | gps_gpcon;
-       __raw_writel(gpcon, base + OFFS_CON);
-
-       /* now set all the other bits */
-
-       __raw_writel(gps_gpdat, base + OFFS_DAT);
-       __raw_writel(gps_gpcon, base + OFFS_CON);
-
-       S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
-                 chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
-}
-
-struct samsung_gpio_pm samsung_gpio_pm_1bit = {
-       .save   = samsung_gpio_pm_1bit_save,
-       .resume = samsung_gpio_pm_1bit_resume,
-};
-
-static void samsung_gpio_pm_2bit_save(struct samsung_gpio_chip *chip)
-{
-       chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
-       chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
-       chip->pm_save[2] = __raw_readl(chip->base + OFFS_UP);
-}
-
-/* Test whether the given masked+shifted bits of an GPIO configuration
- * are one of the SFN (special function) modes. */
-
-static inline int is_sfn(unsigned long con)
-{
-       return con >= 2;
-}
-
-/* Test if the given masked+shifted GPIO configuration is an input */
-
-static inline int is_in(unsigned long con)
-{
-       return con == 0;
-}
-
-/* Test if the given masked+shifted GPIO configuration is an output */
-
-static inline int is_out(unsigned long con)
-{
-       return con == 1;
-}
-
-/**
- * samsung_gpio_pm_2bit_resume() - restore the given GPIO bank
- * @chip: The chip information to resume.
- *
- * Restore one of the GPIO banks that was saved during suspend. This is
- * not as simple as once thought, due to the possibility of glitches
- * from the order that the CON and DAT registers are set in.
- *
- * The three states the pin can be are {IN,OUT,SFN} which gives us 9
- * combinations of changes to check. Three of these, if the pin stays
- * in the same configuration can be discounted. This leaves us with
- * the following:
- *
- * { IN => OUT }  Change DAT first
- * { IN => SFN }  Change CON first
- * { OUT => SFN } Change CON first, so new data will not glitch
- * { OUT => IN }  Change CON first, so new data will not glitch
- * { SFN => IN }  Change CON first
- * { SFN => OUT } Change DAT first, so new data will not glitch [1]
- *
- * We do not currently deal with the UP registers as these control
- * weak resistors, so a small delay in change should not need to bring
- * these into the calculations.
- *
- * [1] this assumes that writing to a pin DAT whilst in SFN will set the
- *     state for when it is next output.
- */
-static void samsung_gpio_pm_2bit_resume(struct samsung_gpio_chip *chip)
-{
-       void __iomem *base = chip->base;
-       u32 old_gpcon = __raw_readl(base + OFFS_CON);
-       u32 old_gpdat = __raw_readl(base + OFFS_DAT);
-       u32 gps_gpcon = chip->pm_save[0];
-       u32 gps_gpdat = chip->pm_save[1];
-       u32 gpcon, old, new, mask;
-       u32 change_mask = 0x0;
-       int nr;
-
-       /* restore GPIO pull-up settings */
-       __raw_writel(chip->pm_save[2], base + OFFS_UP);
-
-       /* Create a change_mask of all the items that need to have
-        * their CON value changed before their DAT value, so that
-        * we minimise the work between the two settings.
-        */
-
-       for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {
-               old = (old_gpcon & mask) >> nr;
-               new = (gps_gpcon & mask) >> nr;
-
-               /* If there is no change, then skip */
-
-               if (old == new)
-                       continue;
-
-               /* If both are special function, then skip */
-
-               if (is_sfn(old) && is_sfn(new))
-                       continue;
-
-               /* Change is IN => OUT, do not change now */
-
-               if (is_in(old) && is_out(new))
-                       continue;
-
-               /* Change is SFN => OUT, do not change now */
-
-               if (is_sfn(old) && is_out(new))
-                       continue;
-
-               /* We should now be at the case of IN=>SFN,
-                * OUT=>SFN, OUT=>IN, SFN=>IN. */
-
-               change_mask |= mask;
-       }
-
-
-       /* Write the new CON settings */
-
-       gpcon = old_gpcon & ~change_mask;
-       gpcon |= gps_gpcon & change_mask;
-
-       __raw_writel(gpcon, base + OFFS_CON);
-
-       /* Now change any items that require DAT,CON */
-
-       __raw_writel(gps_gpdat, base + OFFS_DAT);
-       __raw_writel(gps_gpcon, base + OFFS_CON);
-
-       S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
-                 chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
-}
-
-struct samsung_gpio_pm samsung_gpio_pm_2bit = {
-       .save   = samsung_gpio_pm_2bit_save,
-       .resume = samsung_gpio_pm_2bit_resume,
-};
-
-#if defined(CONFIG_ARCH_S3C64XX)
-static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip)
-{
-       chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
-       chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT);
-       chip->pm_save[3] = __raw_readl(chip->base + OFFS_UP);
-
-       if (chip->chip.ngpio > 8)
-               chip->pm_save[0] = __raw_readl(chip->base - 4);
-}
-
-static u32 samsung_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon)
-{
-       u32 old, new, mask;
-       u32 change_mask = 0x0;
-       int nr;
-
-       for (nr = 0, mask = 0x0f; nr < 16; nr += 4, mask <<= 4) {
-               old = (old_gpcon & mask) >> nr;
-               new = (gps_gpcon & mask) >> nr;
-
-               /* If there is no change, then skip */
-
-               if (old == new)
-                       continue;
-
-               /* If both are special function, then skip */
-
-               if (is_sfn(old) && is_sfn(new))
-                       continue;
-
-               /* Change is IN => OUT, do not change now */
-
-               if (is_in(old) && is_out(new))
-                       continue;
-
-               /* Change is SFN => OUT, do not change now */
-
-               if (is_sfn(old) && is_out(new))
-                       continue;
-
-               /* We should now be at the case of IN=>SFN,
-                * OUT=>SFN, OUT=>IN, SFN=>IN. */
-
-               change_mask |= mask;
-       }
-
-       return change_mask;
-}
-
-static void samsung_gpio_pm_4bit_con(struct samsung_gpio_chip *chip, int index)
-{
-       void __iomem *con = chip->base + (index * 4);
-       u32 old_gpcon = __raw_readl(con);
-       u32 gps_gpcon = chip->pm_save[index + 1];
-       u32 gpcon, mask;
-
-       mask = samsung_gpio_pm_4bit_mask(old_gpcon, gps_gpcon);
-
-       gpcon = old_gpcon & ~mask;
-       gpcon |= gps_gpcon & mask;
-
-       __raw_writel(gpcon, con);
-}
-
-static void samsung_gpio_pm_4bit_resume(struct samsung_gpio_chip *chip)
-{
-       void __iomem *base = chip->base;
-       u32 old_gpcon[2];
-       u32 old_gpdat = __raw_readl(base + OFFS_DAT);
-       u32 gps_gpdat = chip->pm_save[2];
-
-       /* First, modify the CON settings */
-
-       old_gpcon[0] = 0;
-       old_gpcon[1] = __raw_readl(base + OFFS_CON);
-
-       samsung_gpio_pm_4bit_con(chip, 0);
-       if (chip->chip.ngpio > 8) {
-               old_gpcon[0] = __raw_readl(base - 4);
-               samsung_gpio_pm_4bit_con(chip, -1);
-       }
-
-       /* Now change the configurations that require DAT,CON */
-
-       __raw_writel(chip->pm_save[2], base + OFFS_DAT);
-       __raw_writel(chip->pm_save[1], base + OFFS_CON);
-       if (chip->chip.ngpio > 8)
-               __raw_writel(chip->pm_save[0], base - 4);
-
-       __raw_writel(chip->pm_save[2], base + OFFS_DAT);
-       __raw_writel(chip->pm_save[3], base + OFFS_UP);
-
-       if (chip->chip.ngpio > 8) {
-               S3C_PMDBG("%s: CON4 %08x,%08x => %08x,%08x, DAT %08x => %08x\n",
-                         chip->chip.label, old_gpcon[0], old_gpcon[1],
-                         __raw_readl(base - 4),
-                         __raw_readl(base + OFFS_CON),
-                         old_gpdat, gps_gpdat);
-       } else
-               S3C_PMDBG("%s: CON4 %08x => %08x, DAT %08x => %08x\n",
-                         chip->chip.label, old_gpcon[1],
-                         __raw_readl(base + OFFS_CON),
-                         old_gpdat, gps_gpdat);
-}
-
-struct samsung_gpio_pm samsung_gpio_pm_4bit = {
-       .save   = samsung_gpio_pm_4bit_save,
-       .resume = samsung_gpio_pm_4bit_resume,
-};
-#endif /* CONFIG_ARCH_S3C64XX */
-
-/**
- * samsung_pm_save_gpio() - save gpio chip data for suspend
- * @ourchip: The chip for suspend.
- */
-static void samsung_pm_save_gpio(struct samsung_gpio_chip *ourchip)
-{
-       struct samsung_gpio_pm *pm = ourchip->pm;
-
-       if (pm == NULL || pm->save == NULL)
-               S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
-       else
-               pm->save(ourchip);
-}
-
-/**
- * samsung_pm_save_gpios() - Save the state of the GPIO banks.
- *
- * For all the GPIO banks, save the state of each one ready for going
- * into a suspend mode.
- */
-void samsung_pm_save_gpios(void)
-{
-       struct samsung_gpio_chip *ourchip;
-       unsigned int gpio_nr;
-
-       for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
-               ourchip = samsung_gpiolib_getchip(gpio_nr);
-               if (!ourchip) {
-                       gpio_nr++;
-                       continue;
-               }
-
-               samsung_pm_save_gpio(ourchip);
-
-               S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n",
-                         ourchip->chip.label,
-                         ourchip->pm_save[0],
-                         ourchip->pm_save[1],
-                         ourchip->pm_save[2],
-                         ourchip->pm_save[3]);
-
-               gpio_nr += ourchip->chip.ngpio;
-               gpio_nr += CONFIG_S3C_GPIO_SPACE;
-       }
-}
-
-/**
- * samsung_pm_resume_gpio() - restore gpio chip data after suspend
- * @ourchip: The suspended chip.
- */
-static void samsung_pm_resume_gpio(struct samsung_gpio_chip *ourchip)
-{
-       struct samsung_gpio_pm *pm = ourchip->pm;
-
-       if (pm == NULL || pm->resume == NULL)
-               S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
-       else
-               pm->resume(ourchip);
-}
-
-void samsung_pm_restore_gpios(void)
-{
-       struct samsung_gpio_chip *ourchip;
-       unsigned int gpio_nr;
-
-       for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
-               ourchip = samsung_gpiolib_getchip(gpio_nr);
-               if (!ourchip) {
-                       gpio_nr++;
-                       continue;
-               }
-
-               samsung_pm_resume_gpio(ourchip);
-
-               gpio_nr += ourchip->chip.ngpio;
-               gpio_nr += CONFIG_S3C_GPIO_SPACE;
-       }
-}
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
deleted file mode 100644 (file)
index d6bfd66..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2008 Openmoko, Inc.
-// Copyright 2004-2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//     http://armlinux.simtec.co.uk/
-//
-// S3C common power management (suspend to ram) support.
-
-#include <linux/init.h>
-#include <linux/suspend.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-#include <linux/of.h>
-#include <linux/serial_s3c.h>
-#include <linux/io.h>
-
-#include <asm/cacheflush.h>
-#include <asm/suspend.h>
-
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-irq.h>
-#include <mach/irqs.h>
-
-#include <asm/irq.h>
-
-#include <plat/pm.h>
-#include <mach/pm-core.h>
-
-/* for external use */
-
-unsigned long s3c_pm_flags;
-
-/* The IRQ ext-int code goes here, it is too small to currently bother
- * with its own file. */
-
-unsigned long s3c_irqwake_intmask      = 0xffffffffL;
-unsigned long s3c_irqwake_eintmask     = 0xffffffffL;
-
-int s3c_irqext_wake(struct irq_data *data, unsigned int state)
-{
-       unsigned long bit = 1L << IRQ_EINT_BIT(data->irq);
-
-       if (!(s3c_irqwake_eintallow & bit))
-               return -ENOENT;
-
-       printk(KERN_INFO "wake %s for irq %d\n",
-              state ? "enabled" : "disabled", data->irq);
-
-       if (!state)
-               s3c_irqwake_eintmask |= bit;
-       else
-               s3c_irqwake_eintmask &= ~bit;
-
-       return 0;
-}
-
-void (*pm_cpu_prep)(void);
-int (*pm_cpu_sleep)(unsigned long);
-
-#define any_allowed(mask, allow) (((mask) & (allow)) != (allow))
-
-/* s3c_pm_enter
- *
- * central control for sleep/resume process
-*/
-
-static int s3c_pm_enter(suspend_state_t state)
-{
-       int ret;
-       /* ensure the debug is initialised (if enabled) */
-
-       s3c_pm_debug_init();
-
-       S3C_PMDBG("%s(%d)\n", __func__, state);
-
-       if (pm_cpu_prep == NULL || pm_cpu_sleep == NULL) {
-               printk(KERN_ERR "%s: error: no cpu sleep function\n", __func__);
-               return -EINVAL;
-       }
-
-       /* check if we have anything to wake-up with... bad things seem
-        * to happen if you suspend with no wakeup (system will often
-        * require a full power-cycle)
-       */
-
-       if (!of_have_populated_dt() &&
-           !any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) &&
-           !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) {
-               printk(KERN_ERR "%s: No wake-up sources!\n", __func__);
-               printk(KERN_ERR "%s: Aborting sleep\n", __func__);
-               return -EINVAL;
-       }
-
-       /* save all necessary core registers not covered by the drivers */
-
-       if (!of_have_populated_dt()) {
-               samsung_pm_save_gpios();
-               samsung_pm_saved_gpios();
-       }
-
-       s3c_pm_save_uarts();
-       s3c_pm_save_core();
-
-       /* set the irq configuration for wake */
-
-       s3c_pm_configure_extint();
-
-       S3C_PMDBG("sleep: irq wakeup masks: %08lx,%08lx\n",
-           s3c_irqwake_intmask, s3c_irqwake_eintmask);
-
-       s3c_pm_arch_prepare_irqs();
-
-       /* call cpu specific preparation */
-
-       pm_cpu_prep();
-
-       /* flush cache back to ram */
-
-       flush_cache_all();
-
-       s3c_pm_check_store();
-
-       /* send the cpu to sleep... */
-
-       s3c_pm_arch_stop_clocks();
-
-       /* this will also act as our return point from when
-        * we resume as it saves its own register state and restores it
-        * during the resume.  */
-
-       ret = cpu_suspend(0, pm_cpu_sleep);
-       if (ret)
-               return ret;
-
-       /* restore the system state */
-
-       s3c_pm_restore_core();
-       s3c_pm_restore_uarts();
-
-       if (!of_have_populated_dt()) {
-               samsung_pm_restore_gpios();
-               s3c_pm_restored_gpios();
-       }
-
-       s3c_pm_debug_init();
-
-       /* check what irq (if any) restored the system */
-
-       s3c_pm_arch_show_resume_irqs();
-
-       S3C_PMDBG("%s: post sleep, preparing to return\n", __func__);
-
-       /* LEDs should now be 1110 */
-       s3c_pm_debug_smdkled(1 << 1, 0);
-
-       s3c_pm_check_restore();
-
-       /* ok, let's return from sleep */
-
-       S3C_PMDBG("S3C PM Resume (post-restore)\n");
-       return 0;
-}
-
-static int s3c_pm_prepare(void)
-{
-       /* prepare check area if configured */
-
-       s3c_pm_check_prepare();
-       return 0;
-}
-
-static void s3c_pm_finish(void)
-{
-       s3c_pm_check_cleanup();
-}
-
-static const struct platform_suspend_ops s3c_pm_ops = {
-       .enter          = s3c_pm_enter,
-       .prepare        = s3c_pm_prepare,
-       .finish         = s3c_pm_finish,
-       .valid          = suspend_valid_only_mem,
-};
-
-/* s3c_pm_init
- *
- * Attach the power management functions. This should be called
- * from the board specific initialisation if the board supports
- * it.
-*/
-
-int __init s3c_pm_init(void)
-{
-       printk("S3C Power Management, Copyright 2004 Simtec Electronics\n");
-
-       suspend_set_ops(&s3c_pm_ops);
-       return 0;
-}
diff --git a/arch/arm/plat-samsung/wakeup-mask.c b/arch/arm/plat-samsung/wakeup-mask.c
deleted file mode 100644 (file)
index 24f96fb..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright 2010 Ben Dooks <ben-linux@fluff.org>
-//
-// Support for wakeup mask interrupts on newer SoCs
-
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <linux/device.h>
-#include <linux/types.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-
-#include <plat/wakeup-mask.h>
-#include <plat/pm.h>
-
-void samsung_sync_wakemask(void __iomem *reg,
-                          const struct samsung_wakeup_mask *mask, int nr_mask)
-{
-       struct irq_data *data;
-       u32 val;
-
-       val = __raw_readl(reg);
-
-       for (; nr_mask > 0; nr_mask--, mask++) {
-               if (mask->irq == NO_WAKEUP_IRQ) {
-                       val |= mask->bit;
-                       continue;
-               }
-
-               data = irq_get_irq_data(mask->irq);
-
-               /* bit of a liberty to read this directly from irq_data. */
-               if (irqd_is_wakeup_set(data))
-                       val &= ~mask->bit;
-               else
-                       val |= mask->bit;
-       }
-
-       printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
-       __raw_writel(val, reg);
-}
diff --git a/arch/arm/plat-samsung/watchdog-reset.c b/arch/arm/plat-samsung/watchdog-reset.c
deleted file mode 100644 (file)
index 71d85ff..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2008 Simtec Electronics
-//     Ben Dooks <ben@simtec.co.uk>
-//
-// Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
-//
-// Watchdog reset support for Samsung SoCs.
-
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-
-#define S3C2410_WTCON                  0x00
-#define S3C2410_WTDAT                  0x04
-#define S3C2410_WTCNT                  0x08
-
-#define S3C2410_WTCON_ENABLE           (1 << 5)
-#define S3C2410_WTCON_DIV16            (0 << 3)
-#define S3C2410_WTCON_RSTEN            (1 << 0)
-#define S3C2410_WTCON_PRESCALE(x)      ((x) << 8)
-
-static void __iomem *wdt_base;
-static struct clk *wdt_clock;
-
-void samsung_wdt_reset(void)
-{
-       if (!wdt_base) {
-               pr_err("%s: wdt reset not initialized\n", __func__);
-               /* delay to allow the serial port to show the message */
-               mdelay(50);
-               return;
-       }
-
-       if (!IS_ERR(wdt_clock))
-               clk_prepare_enable(wdt_clock);
-
-       /* disable watchdog, to be safe  */
-       __raw_writel(0, wdt_base + S3C2410_WTCON);
-
-       /* put initial values into count and data */
-       __raw_writel(0x80, wdt_base + S3C2410_WTCNT);
-       __raw_writel(0x80, wdt_base + S3C2410_WTDAT);
-
-       /* set the watchdog to go and reset... */
-       __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV16 |
-                       S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x20),
-                       wdt_base + S3C2410_WTCON);
-
-       /* wait for reset to assert... */
-       mdelay(500);
-
-       pr_err("Watchdog reset failed to assert reset\n");
-
-       /* delay to allow the serial port to show the message */
-       mdelay(50);
-}
-
-#ifdef CONFIG_OF
-static const struct of_device_id s3c2410_wdt_match[] = {
-       { .compatible = "samsung,s3c2410-wdt" },
-       { .compatible = "samsung,s3c6410-wdt" },
-       {},
-};
-
-void __init samsung_wdt_reset_of_init(void)
-{
-       struct device_node *np;
-
-       np = of_find_matching_node(NULL, s3c2410_wdt_match);
-       if (!np) {
-               pr_err("%s: failed to find watchdog node\n", __func__);
-               return;
-       }
-
-       wdt_base = of_iomap(np, 0);
-       if (!wdt_base) {
-               pr_err("%s: failed to map watchdog registers\n", __func__);
-               return;
-       }
-
-       wdt_clock = of_clk_get(np, 0);
-}
-#endif
-
-void __init samsung_wdt_reset_init(void __iomem *base)
-{
-       wdt_base = base;
-       wdt_clock = clk_get(NULL, "watchdog");
-}
index fe81a9c..c84053a 100644 (file)
@@ -307,7 +307,7 @@ static bool __kprobes decode_regs(probes_opcode_t *pinsn, u32 regs, bool modify)
                case REG_TYPE_NOPCWB:
                        if (!is_writeback(insn))
                                break; /* No writeback, so any register is OK */
-                       /* fall through... */
+                       fallthrough;
                case REG_TYPE_NOPC:
                case REG_TYPE_NOPCX:
                        /* Reject PC (R15) */
index 90b5bc7..feefa20 100644 (file)
@@ -280,7 +280,7 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
                                /* A nested probe was hit in FIQ, it is a BUG */
                                pr_warn("Unrecoverable kprobe detected.\n");
                                dump_kprobe(p);
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* impossible cases */
                                BUG();
index cd58f84..d235b27 100644 (file)
@@ -80,7 +80,6 @@ config ARCH_EXYNOS
        select EXYNOS_CHIPID
        select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS
        select EXYNOS_PMU
-       select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
index 55bc854..130569f 100644 (file)
@@ -82,8 +82,8 @@ endif
 # compiler to generate them and consequently to break the single image contract
 # we pass it only to the assembler. This option is utilized only in case of non
 # integrated assemblers.
-ifneq ($(CONFIG_AS_HAS_ARMV8_4), y)
-branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
+ifeq ($(CONFIG_AS_HAS_PAC), y)
+asm-arch := armv8.3-a
 endif
 endif
 
@@ -91,7 +91,12 @@ KBUILD_CFLAGS += $(branch-prot-flags-y)
 
 ifeq ($(CONFIG_AS_HAS_ARMV8_4), y)
 # make sure to pass the newest target architecture to -march.
-KBUILD_CFLAGS  += -Wa,-march=armv8.4-a
+asm-arch := armv8.4-a
+endif
+
+ifdef asm-arch
+KBUILD_CFLAGS  += -Wa,-march=$(asm-arch) \
+                  -DARM64_ASM_ARCH='"$(asm-arch)"'
 endif
 
 ifeq ($(CONFIG_SHADOW_CALL_STACK), y)
@@ -165,6 +170,8 @@ zinstall install:
 PHONY += vdso_install
 vdso_install:
        $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
+       $(if $(CONFIG_COMPAT_VDSO), \
+               $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@)
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
index 9edfae5..24ef18f 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <56>;
-               ti,sci-rm-range-girq = <0x1>;
+               ti,sci-dev-id = <100>;
+               ti,interrupt-ranges = <0 392 32>;
        };
 
        main_navss {
                        ti,intr-trigger-type = <4>;
                        interrupt-controller;
                        interrupt-parent = <&gic500>;
-                       #interrupt-cells = <2>;
+                       #interrupt-cells = <1>;
                        ti,sci = <&dmsc>;
-                       ti,sci-dst-id = <56>;
-                       ti,sci-rm-range-girq = <0x0>, <0x2>;
+                       ti,sci-dev-id = <182>;
+                       ti,interrupt-ranges = <0 64 64>,
+                                             <64 448 64>;
                };
 
                inta_main_udmass: interrupt-controller@33d00000 {
                        msi-controller;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <179>;
-                       ti,sci-rm-range-vint = <0x0>;
-                       ti,sci-rm-range-global-event = <0x1>;
+                       ti,interrupt-ranges = <0 0 256>;
                };
 
                secure_proxy_main: mailbox@32c00000 {
                                <0x0 0x33000000 0x0 0x40000>;
                        reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
                        ti,num-rings = <818>;
-                       ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */
+                       ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
                        ti,dma-ring-reset-quirk;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <187>;
                        ti,sci-dev-id = <188>;
                        ti,ringacc = <&ringacc>;
 
-                       ti,sci-rm-range-tchan = <0x1>, /* TX_HCHAN */
-                                               <0x2>; /* TX_CHAN */
-                       ti,sci-rm-range-rchan = <0x4>, /* RX_HCHAN */
-                                               <0x5>; /* RX_CHAN */
-                       ti,sci-rm-range-rflow = <0x6>; /* GP RFLOW */
+                       ti,sci-rm-range-tchan = <0xf>, /* TX_HCHAN */
+                                               <0xd>; /* TX_CHAN */
+                       ti,sci-rm-range-rchan = <0xb>, /* RX_HCHAN */
+                                               <0xa>; /* RX_CHAN */
+                       ti,sci-rm-range-rflow = <0x0>; /* GP RFLOW */
                };
 
                cpts@310d0000 {
                        reg-names = "cpts";
                        clocks = <&main_cpts_mux>;
                        clock-names = "cpts";
-                       interrupts-extended = <&intr_main_navss 163 0>;
+                       interrupts-extended = <&intr_main_navss 391>;
                        interrupt-names = "cpts";
                        ti,cpts-periodic-outputs = <6>;
                        ti,cpts-ext-ts-inputs = <8>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&intr_main_gpio>;
-               interrupts = <57 256>, <57 257>, <57 258>, <57 259>, <57 260>,
-                               <57 261>;
+               interrupts = <192>, <193>, <194>, <195>, <196>, <197>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <96>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&intr_main_gpio>;
-               interrupts = <58 256>, <58 257>, <58 258>, <58 259>, <58 260>,
-                               <58 261>;
+               interrupts = <200>, <201>, <202>, <203>, <204>, <205>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <90>;
index 8c1abcf..51ca4b4 100644 (file)
                                <0x0 0x2a500000 0x0 0x40000>;
                        reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
                        ti,num-rings = <286>;
-                       ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */
+                       ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
                        ti,dma-ring-reset-quirk;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <195>;
                        ti,sci-dev-id = <194>;
                        ti,ringacc = <&mcu_ringacc>;
 
-                       ti,sci-rm-range-tchan = <0x1>, /* TX_HCHAN */
-                                               <0x2>; /* TX_CHAN */
-                       ti,sci-rm-range-rchan = <0x3>, /* RX_HCHAN */
-                                               <0x4>; /* RX_CHAN */
-                       ti,sci-rm-range-rflow = <0x5>; /* GP RFLOW */
+                       ti,sci-rm-range-tchan = <0xf>, /* TX_HCHAN */
+                                               <0xd>; /* TX_CHAN */
+                       ti,sci-rm-range-rchan = <0xb>, /* RX_HCHAN */
+                                               <0xa>; /* RX_CHAN */
+                       ti,sci-rm-range-rflow = <0x0>; /* GP RFLOW */
                };
        };
 
index 5f55b9e..a1ffe88 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <56>;
-               ti,sci-rm-range-girq = <0x4>;
+               ti,sci-dev-id = <156>;
+               ti,interrupt-ranges = <0 712 16>;
        };
 
        wkup_gpio0: wkup_gpio0@42110000 {
@@ -86,7 +86,7 @@
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&intr_wkup_gpio>;
-               interrupts = <59 128>, <59 129>, <59 130>, <59 131>;
+               interrupts = <60>, <61>, <62>, <63>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <56>;
index 611e662..b8a8a0f 100644 (file)
 };
 
 &mailbox0_cluster0 {
-       interrupts = <164 0>;
+       interrupts = <436>;
 
        mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
                ti,mbox-tx = <1 0 0>;
 };
 
 &mailbox0_cluster1 {
-       interrupts = <165 0>;
+       interrupts = <432>;
 
        mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
                ti,mbox-tx = <1 0 0>;
index 8bc1e6e..e8fc01d 100644 (file)
 };
 
 &mailbox0_cluster0 {
-       interrupts = <214 0>;
+       interrupts = <436>;
 
        mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster1 {
-       interrupts = <215 0>;
+       interrupts = <432>;
 
        mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster2 {
-       interrupts = <216 0>;
+       interrupts = <428>;
 
        mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster3 {
-       interrupts = <217 0>;
+       interrupts = <424>;
 
        mbox_c66_0: mbox-c66-0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster4 {
-       interrupts = <218 0>;
+       interrupts = <420>;
 
        mbox_c71_0: mbox-c71-0 {
                ti,mbox-rx = <0 0 0>;
index d140602..12ceea9 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <14>;
-               ti,sci-rm-range-girq = <0x1>;
+               ti,sci-dev-id = <131>;
+               ti,interrupt-ranges = <8 392 56>;
        };
 
        main_navss {
                        ti,intr-trigger-type = <4>;
                        interrupt-controller;
                        interrupt-parent = <&gic500>;
-                       #interrupt-cells = <2>;
+                       #interrupt-cells = <1>;
                        ti,sci = <&dmsc>;
-                       ti,sci-dst-id = <14>;
-                       ti,sci-rm-range-girq = <0>, <2>;
+                       ti,sci-dev-id = <213>;
+                       ti,interrupt-ranges = <0 64 64>,
+                                             <64 448 64>,
+                                             <128 672 64>;
                };
 
                main_udmass_inta: interrupt-controller@33d00000 {
                        msi-controller;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <209>;
-                       ti,sci-rm-range-vint = <0xa>;
-                       ti,sci-rm-range-global-event = <0xd>;
+                       ti,interrupt-ranges = <0 0 256>;
                };
 
                secure_proxy_main: mailbox@32c00000 {
                        reg-names = "cpts";
                        clocks = <&k3_clks 201 1>;
                        clock-names = "cpts";
-                       interrupts-extended = <&main_navss_intr 201 0>;
+                       interrupts-extended = <&main_navss_intr 391>;
                        interrupt-names = "cpts";
                        ti,cpts-periodic-outputs = <6>;
                        ti,cpts-ext-ts-inputs = <8>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <105 0>, <105 1>, <105 2>, <105 3>,
-                            <105 4>, <105 5>, <105 6>, <105 7>;
+               interrupts = <256>, <257>, <258>, <259>,
+                            <260>, <261>, <262>, <263>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <106 0>, <106 1>, <106 2>;
+               interrupts = <288>, <289>, <290>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <107 0>, <107 1>, <107 2>, <107 3>,
-                            <107 4>, <107 5>, <107 6>, <107 7>;
+               interrupts = <264>, <265>, <266>, <267>,
+                            <268>, <269>, <270>, <271>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <108 0>, <108 1>, <108 2>;
+               interrupts = <292>, <293>, <294>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <109 0>, <109 1>, <109 2>, <109 3>,
-                            <109 4>, <109 5>, <109 6>, <109 7>;
+               interrupts = <272>, <273>, <274>, <275>,
+                            <276>, <277>, <278>, <279>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <110 0>, <110 1>, <110 2>;
+               interrupts = <296>, <297>, <298>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <111 0>, <111 1>, <111 2>, <111 3>,
-                            <111 4>, <111 5>, <111 6>, <111 7>;
+               interrupts = <280>, <281>, <282>, <283>,
+                            <284>, <285>, <286>, <287>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <112 0>, <112 1>, <112 2>;
+               interrupts = <300>, <301>, <302>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
index 30a735b..c4a48e8 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <14>;
-               ti,sci-rm-range-girq = <0x5>;
+               ti,sci-dev-id = <137>;
+               ti,interrupt-ranges = <16 960 16>;
        };
 
        wkup_gpio0: gpio@42110000 {
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&wkup_gpio_intr>;
-               interrupts = <113 0>, <113 1>, <113 2>,
-                            <113 3>, <113 4>, <113 5>;
+               interrupts = <103>, <104>, <105>, <106>, <107>, <108>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <84>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&wkup_gpio_intr>;
-               interrupts = <114 0>, <114 1>, <114 2>,
-                            <114 3>, <114 4>, <114 5>;
+               interrupts = <112>, <113>, <114>, <115>, <116>, <117>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <84>;
index 51a7ce8..6fb2e6b 100644 (file)
@@ -2,6 +2,12 @@
 #ifndef __ASM_COMPILER_H
 #define __ASM_COMPILER_H
 
+#ifdef ARM64_ASM_ARCH
+#define ARM64_ASM_PREAMBLE ".arch " ARM64_ASM_ARCH "\n"
+#else
+#define ARM64_ASM_PREAMBLE
+#endif
+
 /*
  * The EL0/EL1 pointer bits used by a pointer authentication code.
  * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply.
index aa4b652..ff328e5 100644 (file)
@@ -95,6 +95,11 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
        return res;
 }
 
+static inline int arch_irqs_disabled(void)
+{
+       return arch_irqs_disabled_flags(arch_local_save_flags());
+}
+
 static inline unsigned long arch_local_irq_save(void)
 {
        unsigned long flags;
index 51c1d99..1da8e3d 100644 (file)
  * IMO:                Override CPSR.I and enable signaling with VI
  * FMO:                Override CPSR.F and enable signaling with VF
  * SWIO:       Turn set/way invalidates into set/way clean+invalidate
+ * PTW:                Take a stage2 fault if a stage1 walk steps in device memory
  */
 #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \
                         HCR_BSU_IS | HCR_FB | HCR_TAC | \
                         HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \
-                        HCR_FMO | HCR_IMO)
+                        HCR_FMO | HCR_IMO | HCR_PTW )
 #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF)
 #define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK)
 #define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H)
index fb1a922..6f98fbd 100644 (file)
@@ -169,6 +169,34 @@ extern char __smccc_workaround_1_smc[__SMCCC_WORKAROUND_1_SMC_SZ];
                *__hyp_this_cpu_ptr(sym);                               \
         })
 
+#define __KVM_EXTABLE(from, to)                                                \
+       "       .pushsection    __kvm_ex_table, \"a\"\n"                \
+       "       .align          3\n"                                    \
+       "       .long           (" #from " - .), (" #to " - .)\n"       \
+       "       .popsection\n"
+
+
+#define __kvm_at(at_op, addr)                                          \
+( {                                                                    \
+       int __kvm_at_err = 0;                                           \
+       u64 spsr, elr;                                                  \
+       asm volatile(                                                   \
+       "       mrs     %1, spsr_el2\n"                                 \
+       "       mrs     %2, elr_el2\n"                                  \
+       "1:     at      "at_op", %3\n"                                  \
+       "       isb\n"                                                  \
+       "       b       9f\n"                                           \
+       "2:     msr     spsr_el2, %1\n"                                 \
+       "       msr     elr_el2, %2\n"                                  \
+       "       mov     %w0, %4\n"                                      \
+       "9:\n"                                                          \
+       __KVM_EXTABLE(1b, 2b)                                           \
+       : "+r" (__kvm_at_err), "=&r" (spsr), "=&r" (elr)                \
+       : "r" (addr), "i" (-EFAULT));                                   \
+       __kvm_at_err;                                                   \
+} )
+
+
 #else /* __ASSEMBLY__ */
 
 .macro hyp_adr_this_cpu reg, sym, tmp
@@ -193,6 +221,21 @@ extern char __smccc_workaround_1_smc[__SMCCC_WORKAROUND_1_SMC_SZ];
        ldr     \vcpu, [\ctxt, #HOST_CONTEXT_VCPU]
 .endm
 
+/*
+ * KVM extable for unexpected exceptions.
+ * In the same format _asm_extable, but output to a different section so that
+ * it can be mapped to EL2. The KVM version is not sorted. The caller must
+ * ensure:
+ * x18 has the hypervisor value to allow any Shadow-Call-Stack instrumented
+ * code to write to it, and that SPSR_EL2 and ELR_EL2 are restored by the fixup.
+ */
+.macro _kvm_extable, from, to
+       .pushsection    __kvm_ex_table, "a"
+       .align          3
+       .long           (\from - .), (\to - .)
+       .popsection
+.endm
+
 #endif
 
 #endif /* __ARM_KVM_ASM_H__ */
index 65568b2..e52c927 100644 (file)
@@ -473,7 +473,7 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
 
 #define KVM_ARCH_WANT_MMU_NOTIFIER
 int kvm_unmap_hva_range(struct kvm *kvm,
-                       unsigned long start, unsigned long end);
+                       unsigned long start, unsigned long end, unsigned flags);
 int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
index d493174..cc3f5a3 100644 (file)
  * not. The macros handles invoking the asm with or without the
  * register argument as appropriate.
  */
-#define __TLBI_0(op, arg) asm ("tlbi " #op "\n"                                       \
+#define __TLBI_0(op, arg) asm (ARM64_ASM_PREAMBLE                             \
+                              "tlbi " #op "\n"                                \
                   ALTERNATIVE("nop\n                   nop",                  \
                               "dsb ish\n               tlbi " #op,            \
                               ARM64_WORKAROUND_REPEAT_TLBI,                   \
                               CONFIG_ARM64_WORKAROUND_REPEAT_TLBI)            \
                            : : )
 
-#define __TLBI_1(op, arg) asm ("tlbi " #op ", %0\n"                           \
+#define __TLBI_1(op, arg) asm (ARM64_ASM_PREAMBLE                             \
+                              "tlbi " #op ", %0\n"                            \
                   ALTERNATIVE("nop\n                   nop",                  \
                               "dsb ish\n               tlbi " #op ", %0",     \
                               ARM64_WORKAROUND_REPEAT_TLBI,                   \
index 4559664..a85174d 100644 (file)
@@ -322,7 +322,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
                         */
                        if (memblock_is_map_memory(phys))
                                return (void __iomem *)__phys_to_virt(phys);
-                       /* fall through */
+                       fallthrough;
 
                default:
                        if (region->attribute & EFI_MEMORY_WB)
index 6bd1d3a..c332d49 100644 (file)
@@ -910,6 +910,8 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
                .desc = "ARM erratum 1418040",
                .capability = ARM64_WORKAROUND_1418040,
                ERRATA_MIDR_RANGE_LIST(erratum_1418040_list),
+               .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU |
+                        ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU),
        },
 #endif
 #ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
index a389b99..6424584 100644 (file)
@@ -686,7 +686,7 @@ static s64 arm64_ftr_safe_value(const struct arm64_ftr_bits *ftrp, s64 new,
        case FTR_HIGHER_OR_ZERO_SAFE:
                if (!cur || !new)
                        break;
-               /* Fallthrough */
+               fallthrough;
        case FTR_HIGHER_SAFE:
                ret = new > cur ? new : cur;
                break;
index 393c6fb..d0076c2 100644 (file)
@@ -327,7 +327,6 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
                set_bit(ICACHEF_VPIPT, &__icache_flags);
                break;
        default:
-               /* Fallthrough */
        case ICACHE_POLICY_VIPT:
                /* Assume aliasing */
                set_bit(ICACHEF_ALIASING, &__icache_flags);
index 2646178..55af8b5 100644 (file)
@@ -170,19 +170,6 @@ alternative_cb_end
        stp     x28, x29, [sp, #16 * 14]
 
        .if     \el == 0
-       .if     \regsize == 32
-       /*
-        * If we're returning from a 32-bit task on a system affected by
-        * 1418040 then re-enable userspace access to the virtual counter.
-        */
-#ifdef CONFIG_ARM64_ERRATUM_1418040
-alternative_if ARM64_WORKAROUND_1418040
-       mrs     x0, cntkctl_el1
-       orr     x0, x0, #2      // ARCH_TIMER_USR_VCT_ACCESS_EN
-       msr     cntkctl_el1, x0
-alternative_else_nop_endif
-#endif
-       .endif
        clear_gp_regs
        mrs     x21, sp_el0
        ldr_this_cpu    tsk, __entry_task, x20
@@ -294,14 +281,6 @@ alternative_else_nop_endif
        tst     x22, #PSR_MODE32_BIT            // native task?
        b.eq    3f
 
-#ifdef CONFIG_ARM64_ERRATUM_1418040
-alternative_if ARM64_WORKAROUND_1418040
-       mrs     x0, cntkctl_el1
-       bic     x0, x0, #2                      // ARCH_TIMER_USR_VCT_ACCESS_EN
-       msr     cntkctl_el1, x0
-alternative_else_nop_endif
-#endif
-
 #ifdef CONFIG_ARM64_ERRATUM_845719
 alternative_if ARM64_WORKAROUND_845719
 #ifdef CONFIG_PID_IN_CONTEXTIDR
index af234a1..712e97c 100644 (file)
@@ -257,7 +257,7 @@ static int hw_breakpoint_control(struct perf_event *bp,
                 * level.
                 */
                enable_debug_monitors(dbg_el);
-               /* Fall through */
+               fallthrough;
        case HW_BREAKPOINT_RESTORE:
                /* Setup the address register. */
                write_wb_reg(val_reg, i, info->address);
@@ -541,13 +541,13 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
                        if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2)
                                break;
 
-                       /* Fallthrough */
+                       fallthrough;
                case 3:
                        /* Allow single byte watchpoint. */
                        if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
                                break;
 
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        return -EINVAL;
                }
index 9e897c5..8982b68 100644 (file)
@@ -103,6 +103,10 @@ KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
 KVM_NVHE_ALIAS(gic_pmr_sync);
 #endif
 
+/* EL2 exception handling */
+KVM_NVHE_ALIAS(__start___kvm_ex_table);
+KVM_NVHE_ALIAS(__stop___kvm_ex_table);
+
 #endif /* CONFIG_KVM */
 
 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
index 1cd1a4d..2a1ad95 100644 (file)
@@ -315,21 +315,21 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
                /* MOVW instruction relocations. */
                case R_AARCH64_MOVW_UABS_G0_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_MOVW_UABS_G0:
                        ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0,
                                              AARCH64_INSN_IMM_MOVKZ);
                        break;
                case R_AARCH64_MOVW_UABS_G1_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_MOVW_UABS_G1:
                        ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16,
                                              AARCH64_INSN_IMM_MOVKZ);
                        break;
                case R_AARCH64_MOVW_UABS_G2_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_MOVW_UABS_G2:
                        ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32,
                                              AARCH64_INSN_IMM_MOVKZ);
@@ -397,7 +397,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
                        break;
                case R_AARCH64_ADR_PREL_PG_HI21_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_ADR_PREL_PG_HI21:
                        ovf = reloc_insn_adrp(me, sechdrs, loc, val);
                        if (ovf && ovf != -ERANGE)
index 84ec630..f180449 100644 (file)
@@ -123,10 +123,8 @@ void arch_cpu_idle(void)
         * This should do all the clock switching and wait for interrupt
         * tricks
         */
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
        cpu_do_idle();
        local_irq_enable();
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -515,6 +513,39 @@ static void entry_task_switch(struct task_struct *next)
        __this_cpu_write(__entry_task, next);
 }
 
+/*
+ * ARM erratum 1418040 handling, affecting the 32bit view of CNTVCT.
+ * Assuming the virtual counter is enabled at the beginning of times:
+ *
+ * - disable access when switching from a 64bit task to a 32bit task
+ * - enable access when switching from a 32bit task to a 64bit task
+ */
+static void erratum_1418040_thread_switch(struct task_struct *prev,
+                                         struct task_struct *next)
+{
+       bool prev32, next32;
+       u64 val;
+
+       if (!(IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) &&
+             cpus_have_const_cap(ARM64_WORKAROUND_1418040)))
+               return;
+
+       prev32 = is_compat_thread(task_thread_info(prev));
+       next32 = is_compat_thread(task_thread_info(next));
+
+       if (prev32 == next32)
+               return;
+
+       val = read_sysreg(cntkctl_el1);
+
+       if (!next32)
+               val |= ARCH_TIMER_USR_VCT_ACCESS_EN;
+       else
+               val &= ~ARCH_TIMER_USR_VCT_ACCESS_EN;
+
+       write_sysreg(val, cntkctl_el1);
+}
+
 /*
  * Thread switching.
  */
@@ -530,6 +561,7 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
        entry_task_switch(next);
        uao_thread_switch(next);
        ssbs_thread_switch(next);
+       erratum_1418040_thread_switch(prev, next);
 
        /*
         * Complete any pending TLB or cache maintenance on this CPU in case
index 03957a1..355ee9e 100644 (file)
@@ -151,7 +151,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
                        break;
                }
                pr_crit("CPU%u: may not have shut down cleanly\n", cpu);
-               /* Fall through */
+               fallthrough;
        case CPU_STUCK_IN_KERNEL:
                pr_crit("CPU%u: is stuck in kernel\n", cpu);
                if (status & CPU_STUCK_REASON_52_BIT_VA)
index 5139a5f..d6adb46 100644 (file)
@@ -208,7 +208,7 @@ quiet_cmd_vdsosym = VDSOSYM $@
       cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
 
 # Install commands for the unstripped file
-quiet_cmd_vdso_install = INSTALL $@
+quiet_cmd_vdso_install = INSTALL32 $@
       cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so
 
 vdso.so: $(obj)/vdso.so.dbg
index ec8e894..7cba762 100644 (file)
@@ -20,6 +20,13 @@ ENTRY(_text)
 
 jiffies = jiffies_64;
 
+
+#define HYPERVISOR_EXTABLE                                     \
+       . = ALIGN(SZ_8);                                        \
+       __start___kvm_ex_table = .;                             \
+       *(__kvm_ex_table)                                       \
+       __stop___kvm_ex_table = .;
+
 #define HYPERVISOR_TEXT                                        \
        /*                                              \
         * Align to 4 KB so that                        \
@@ -35,6 +42,7 @@ jiffies = jiffies_64;
        __hyp_idmap_text_end = .;                       \
        __hyp_text_start = .;                           \
        *(.hyp.text)                                    \
+       HYPERVISOR_EXTABLE                              \
        __hyp_text_end = .;
 
 #define IDMAP_TEXT                                     \
index 691d21e..46dc3d7 100644 (file)
@@ -1640,6 +1640,10 @@ int kvm_arch_init(void *opaque)
                return -ENODEV;
        }
 
+       if (cpus_have_final_cap(ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE))
+               kvm_info("Guests without required CPU erratum workarounds can deadlock system!\n" \
+                        "Only trusted guests should be used on this system.\n");
+
        for_each_online_cpu(cpu) {
                smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
                if (ret < 0) {
index fe6c7d7..5d690d6 100644 (file)
@@ -128,7 +128,7 @@ static int kvm_handle_guest_debug(struct kvm_vcpu *vcpu)
        switch (ESR_ELx_EC(esr)) {
        case ESR_ELx_EC_WATCHPT_LOW:
                run->debug.arch.far = vcpu->arch.fault.far_el2;
-               /* fall through */
+               fallthrough;
        case ESR_ELx_EC_SOFTSTP_LOW:
        case ESR_ELx_EC_BREAKPT_LOW:
        case ESR_ELx_EC_BKPT32:
index ee32a77..76e7eaf 100644 (file)
@@ -196,20 +196,23 @@ alternative_endif
        // This is our single instruction exception window. A pending
        // SError is guaranteed to occur at the earliest when we unmask
        // it, and at the latest just after the ISB.
-       .global abort_guest_exit_start
 abort_guest_exit_start:
 
        isb
 
-       .global abort_guest_exit_end
 abort_guest_exit_end:
 
        msr     daifset, #4     // Mask aborts
+       ret
+
+       _kvm_extable    abort_guest_exit_start, 9997f
+       _kvm_extable    abort_guest_exit_end, 9997f
+9997:
+       msr     daifset, #4     // Mask aborts
+       mov     x0, #(1 << ARM_EXIT_WITH_SERROR_BIT)
 
-       // If the exception took place, restore the EL1 exception
-       // context so that we can report some information.
-       // Merge the exception code with the SError pending bit.
-       tbz     x0, #ARM_EXIT_WITH_SERROR_BIT, 1f
+       // restore the EL1 exception context so that we can report some
+       // information. Merge the exception code with the SError pending bit.
        msr     elr_el2, x2
        msr     esr_el2, x3
        msr     spsr_el2, x4
index 689fccb..46b4dab 100644 (file)
 #include <asm/kvm_mmu.h>
 #include <asm/mmu.h>
 
+.macro save_caller_saved_regs_vect
+       /* x0 and x1 were saved in the vector entry */
+       stp     x2, x3,   [sp, #-16]!
+       stp     x4, x5,   [sp, #-16]!
+       stp     x6, x7,   [sp, #-16]!
+       stp     x8, x9,   [sp, #-16]!
+       stp     x10, x11, [sp, #-16]!
+       stp     x12, x13, [sp, #-16]!
+       stp     x14, x15, [sp, #-16]!
+       stp     x16, x17, [sp, #-16]!
+.endm
+
+.macro restore_caller_saved_regs_vect
+       ldp     x16, x17, [sp], #16
+       ldp     x14, x15, [sp], #16
+       ldp     x12, x13, [sp], #16
+       ldp     x10, x11, [sp], #16
+       ldp     x8, x9,   [sp], #16
+       ldp     x6, x7,   [sp], #16
+       ldp     x4, x5,   [sp], #16
+       ldp     x2, x3,   [sp], #16
+       ldp     x0, x1,   [sp], #16
+.endm
+
        .text
 
 .macro do_el2_call
@@ -143,13 +167,19 @@ el1_error:
        b       __guest_exit
 
 el2_sync:
-       /* Check for illegal exception return, otherwise panic */
+       /* Check for illegal exception return */
        mrs     x0, spsr_el2
+       tbnz    x0, #20, 1f
 
-       /* if this was something else, then panic! */
-       tst     x0, #PSR_IL_BIT
-       b.eq    __hyp_panic
+       save_caller_saved_regs_vect
+       stp     x29, x30, [sp, #-16]!
+       bl      kvm_unexpected_el2_exception
+       ldp     x29, x30, [sp], #16
+       restore_caller_saved_regs_vect
 
+       eret
+
+1:
        /* Let's attempt a recovery from the illegal exception return */
        get_vcpu_ptr    x1, x0
        mov     x0, #ARM_EXCEPTION_IL
@@ -157,27 +187,14 @@ el2_sync:
 
 
 el2_error:
-       ldp     x0, x1, [sp], #16
+       save_caller_saved_regs_vect
+       stp     x29, x30, [sp, #-16]!
+
+       bl      kvm_unexpected_el2_exception
+
+       ldp     x29, x30, [sp], #16
+       restore_caller_saved_regs_vect
 
-       /*
-        * Only two possibilities:
-        * 1) Either we come from the exit path, having just unmasked
-        *    PSTATE.A: change the return code to an EL2 fault, and
-        *    carry on, as we're already in a sane state to handle it.
-        * 2) Or we come from anywhere else, and that's a bug: we panic.
-        *
-        * For (1), x0 contains the original return code and x1 doesn't
-        * contain anything meaningful at that stage. We can reuse them
-        * as temp registers.
-        * For (2), who cares?
-        */
-       mrs     x0, elr_el2
-       adr     x1, abort_guest_exit_start
-       cmp     x0, x1
-       adr     x1, abort_guest_exit_end
-       ccmp    x0, x1, #4, ne
-       b.ne    __hyp_panic
-       mov     x0, #(1 << ARM_EXIT_WITH_SERROR_BIT)
        eret
        sb
 
index 0297dc6..5e28ea6 100644 (file)
 #define save_debug(ptr,reg,nr)                                         \
        switch (nr) {                                                   \
        case 15:        ptr[15] = read_debug(reg, 15);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 14:        ptr[14] = read_debug(reg, 14);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 13:        ptr[13] = read_debug(reg, 13);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 12:        ptr[12] = read_debug(reg, 12);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 11:        ptr[11] = read_debug(reg, 11);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 10:        ptr[10] = read_debug(reg, 10);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 9:         ptr[9] = read_debug(reg, 9);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 8:         ptr[8] = read_debug(reg, 8);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 7:         ptr[7] = read_debug(reg, 7);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 6:         ptr[6] = read_debug(reg, 6);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 5:         ptr[5] = read_debug(reg, 5);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 4:         ptr[4] = read_debug(reg, 4);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 3:         ptr[3] = read_debug(reg, 3);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 2:         ptr[2] = read_debug(reg, 2);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 1:         ptr[1] = read_debug(reg, 1);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        default:        ptr[0] = read_debug(reg, 0);                    \
        }
 
 #define restore_debug(ptr,reg,nr)                                      \
        switch (nr) {                                                   \
        case 15:        write_debug(ptr[15], reg, 15);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 14:        write_debug(ptr[14], reg, 14);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 13:        write_debug(ptr[13], reg, 13);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 12:        write_debug(ptr[12], reg, 12);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 11:        write_debug(ptr[11], reg, 11);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 10:        write_debug(ptr[10], reg, 10);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 9:         write_debug(ptr[9], reg, 9);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 8:         write_debug(ptr[8], reg, 8);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 7:         write_debug(ptr[7], reg, 7);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 6:         write_debug(ptr[6], reg, 6);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 5:         write_debug(ptr[5], reg, 5);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 4:         write_debug(ptr[4], reg, 4);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 3:         write_debug(ptr[3], reg, 3);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 2:         write_debug(ptr[2], reg, 2);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 1:         write_debug(ptr[1], reg, 1);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        default:        write_debug(ptr[0], reg, 0);                    \
        }
 
index 426ef65..5b6b8fa 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <asm/barrier.h>
 #include <asm/cpufeature.h>
+#include <asm/extable.h>
 #include <asm/kprobes.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_emulate.h>
@@ -29,6 +30,9 @@
 
 extern const char __hyp_panic_string[];
 
+extern struct exception_table_entry __start___kvm_ex_table;
+extern struct exception_table_entry __stop___kvm_ex_table;
+
 /* Check whether the FP regs were dirtied while in the host-side run loop: */
 static inline bool update_fp_enabled(struct kvm_vcpu *vcpu)
 {
@@ -142,10 +146,10 @@ static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar)
         * saved the guest context yet, and we may return early...
         */
        par = read_sysreg(par_el1);
-       asm volatile("at s1e1r, %0" : : "r" (far));
-       isb();
-
-       tmp = read_sysreg(par_el1);
+       if (!__kvm_at("s1e1r", far))
+               tmp = read_sysreg(par_el1);
+       else
+               tmp = SYS_PAR_EL1_F; /* back to the guest */
        write_sysreg(par, par_el1);
 
        if (unlikely(tmp & SYS_PAR_EL1_F))
@@ -508,4 +512,31 @@ static inline void __set_host_arch_workaround_state(struct kvm_vcpu *vcpu)
 #endif
 }
 
+static inline void __kvm_unexpected_el2_exception(void)
+{
+       unsigned long addr, fixup;
+       struct kvm_cpu_context *host_ctxt;
+       struct exception_table_entry *entry, *end;
+       unsigned long elr_el2 = read_sysreg(elr_el2);
+
+       entry = hyp_symbol_addr(__start___kvm_ex_table);
+       end = hyp_symbol_addr(__stop___kvm_ex_table);
+       host_ctxt = &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt;
+
+       while (entry < end) {
+               addr = (unsigned long)&entry->insn + entry->insn;
+               fixup = (unsigned long)&entry->fixup + entry->fixup;
+
+               if (addr != elr_el2) {
+                       entry++;
+                       continue;
+               }
+
+               write_sysreg(fixup, elr_el2);
+               return;
+       }
+
+       hyp_panic(host_ctxt);
+}
+
 #endif /* __ARM64_KVM_HYP_SWITCH_H__ */
index 341be2f..0970442 100644 (file)
@@ -270,3 +270,8 @@ void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
                       read_sysreg(hpfar_el2), par, vcpu);
        unreachable();
 }
+
+asmlinkage void kvm_unexpected_el2_exception(void)
+{
+       return __kvm_unexpected_el2_exception();
+}
index 5a00735..452f4ca 100644 (file)
@@ -340,10 +340,10 @@ void __vgic_v3_save_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                cpu_if->vgic_ap0r[3] = __vgic_v3_read_ap0rn(3);
                cpu_if->vgic_ap0r[2] = __vgic_v3_read_ap0rn(2);
-               /* Fall through */
+               fallthrough;
        case 6:
                cpu_if->vgic_ap0r[1] = __vgic_v3_read_ap0rn(1);
-               /* Fall through */
+               fallthrough;
        default:
                cpu_if->vgic_ap0r[0] = __vgic_v3_read_ap0rn(0);
        }
@@ -352,10 +352,10 @@ void __vgic_v3_save_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                cpu_if->vgic_ap1r[3] = __vgic_v3_read_ap1rn(3);
                cpu_if->vgic_ap1r[2] = __vgic_v3_read_ap1rn(2);
-               /* Fall through */
+               fallthrough;
        case 6:
                cpu_if->vgic_ap1r[1] = __vgic_v3_read_ap1rn(1);
-               /* Fall through */
+               fallthrough;
        default:
                cpu_if->vgic_ap1r[0] = __vgic_v3_read_ap1rn(0);
        }
@@ -373,10 +373,10 @@ void __vgic_v3_restore_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[3], 3);
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[2], 2);
-               /* Fall through */
+               fallthrough;
        case 6:
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[1], 1);
-               /* Fall through */
+               fallthrough;
        default:
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[0], 0);
        }
@@ -385,10 +385,10 @@ void __vgic_v3_restore_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[3], 3);
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[2], 2);
-               /* Fall through */
+               fallthrough;
        case 6:
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[1], 1);
-               /* Fall through */
+               fallthrough;
        default:
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[0], 0);
        }
index c52d714..c1da4f8 100644 (file)
@@ -217,3 +217,8 @@ void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
        __hyp_call_panic(spsr, elr, par, host_ctxt);
        unreachable();
 }
+
+asmlinkage void kvm_unexpected_el2_exception(void)
+{
+       return __kvm_unexpected_el2_exception();
+}
index 0121ef2..ba00bcc 100644 (file)
@@ -343,7 +343,8 @@ static void unmap_stage2_p4ds(struct kvm_s2_mmu *mmu, pgd_t *pgd,
  * destroying the VM), otherwise another faulting VCPU may come in and mess
  * with things behind our backs.
  */
-static void unmap_stage2_range(struct kvm_s2_mmu *mmu, phys_addr_t start, u64 size)
+static void __unmap_stage2_range(struct kvm_s2_mmu *mmu, phys_addr_t start, u64 size,
+                                bool may_block)
 {
        struct kvm *kvm = mmu->kvm;
        pgd_t *pgd;
@@ -369,11 +370,16 @@ static void unmap_stage2_range(struct kvm_s2_mmu *mmu, phys_addr_t start, u64 si
                 * If the range is too large, release the kvm->mmu_lock
                 * to prevent starvation and lockup detector warnings.
                 */
-               if (next != end)
+               if (may_block && next != end)
                        cond_resched_lock(&kvm->mmu_lock);
        } while (pgd++, addr = next, addr != end);
 }
 
+static void unmap_stage2_range(struct kvm_s2_mmu *mmu, phys_addr_t start, u64 size)
+{
+       __unmap_stage2_range(mmu, start, size, true);
+}
+
 static void stage2_flush_ptes(struct kvm_s2_mmu *mmu, pmd_t *pmd,
                              phys_addr_t addr, phys_addr_t end)
 {
@@ -2208,18 +2214,21 @@ static int handle_hva_to_gpa(struct kvm *kvm,
 
 static int kvm_unmap_hva_handler(struct kvm *kvm, gpa_t gpa, u64 size, void *data)
 {
-       unmap_stage2_range(&kvm->arch.mmu, gpa, size);
+       unsigned flags = *(unsigned *)data;
+       bool may_block = flags & MMU_NOTIFIER_RANGE_BLOCKABLE;
+
+       __unmap_stage2_range(&kvm->arch.mmu, gpa, size, may_block);
        return 0;
 }
 
 int kvm_unmap_hva_range(struct kvm *kvm,
-                       unsigned long start, unsigned long end)
+                       unsigned long start, unsigned long end, unsigned flags)
 {
        if (!kvm->arch.mmu.pgd)
                return 0;
 
        trace_kvm_unmap_hva_range(start, end);
-       handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
+       handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, &flags);
        return 0;
 }
 
index a206655..9b11c09 100644 (file)
@@ -45,7 +45,7 @@ static u32 get_cpu_asid_bits(void)
        default:
                pr_warn("CPU%d: Unknown ASID size (%d); assuming 8-bit\n",
                                        smp_processor_id(),  fld);
-               /* Fallthrough */
+               fallthrough;
        case 0:
                asid = 8;
                break;
index e456652..d05c78e 100644 (file)
@@ -220,7 +220,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
                        regs->a4 = -EINTR;
                        break;
                }
-       /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
 do_restart:
                regs->a4 = regs->orig_a4;
@@ -252,7 +252,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
                                break;
                        }
 
-                       /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->a4 = regs->orig_a4;
                        regs->pc -= 4;
index 9452d65..970895d 100644 (file)
@@ -194,7 +194,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->a0 = -EINTR;
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->a0 = regs->orig_a0;
                        regs->pc -= TRAP0_SIZE;
index 38d3354..69e6894 100644 (file)
@@ -227,7 +227,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka)
                        regs->er0 = -EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
 do_restart:
                regs->er0 = regs->orig_er0;
index cf99fb7..cb3bf19 100644 (file)
@@ -120,7 +120,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
                }
                case R_HEXAGON_HI16:
                        value = (value>>16) & 0xffff;
-                       /* fallthrough */
+                       fallthrough;
                case R_HEXAGON_LO16:
                        *location &= ~0x00c03fff;
                        *location |= value & 0x3fff;
index d48864c..94cc7ff 100644 (file)
@@ -155,7 +155,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->r00 = -EINTR;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->r06 = regs->syscall_nr;
                        pt_set_elr(regs, pt_elr(regs) - 4);
index 1085089..779b697 100644 (file)
@@ -366,6 +366,15 @@ pgd_index (unsigned long address)
 }
 #define pgd_index pgd_index
 
+/*
+ * In the kernel's mapped region we know everything is in region number 5, so
+ * as an optimisation its PGD already points to the area for that region.
+ * However, this also means that we cannot use pgd_index() and we must
+ * never add the region here.
+ */
+#define pgd_offset_k(addr) \
+       (init_mm.pgd + (((addr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)))
+
 /* Look up a pgd entry in the gate area.  On IA-64, the gate-area
    resides in the kernel-mapped segment, hence we use pgd_offset_k()
    here.  */
index bec762a..fec70d6 100644 (file)
@@ -163,7 +163,7 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)
                case DIE_INIT_MONARCH_LEAVE:
                        if (!kdump_freeze_monarch)
                                break;
-                       /* fall through */
+                       fallthrough;
                case DIE_INIT_SLAVE_LEAVE:
                case DIE_INIT_MONARCH_ENTER:
                case DIE_MCA_RENDZVOUS_LEAVE:
index 1a42ba8..00a496c 100644 (file)
@@ -654,7 +654,7 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,
                                }
                        } else if (!is_internal(mod, val))
                                val = get_plt(mod, location, val, &ok);
-                       /* FALL THROUGH */
+                       fallthrough;
                      default:
                        val -= bundle(location);
                        break;
index 971f166..0dc3611 100644 (file)
@@ -3472,7 +3472,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
                        break;
                case PFM_CTX_LOADED: 
                        if (CTX_HAS_SMPL(ctx) && fmt->fmt_restart_active) break;
-                       /* fall through */
+                       fallthrough;
                case PFM_CTX_UNLOADED:
                case PFM_CTX_ZOMBIE:
                        DPRINT(("invalid state=%d\n", state));
index d07ed65..e67b22f 100644 (file)
@@ -374,7 +374,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
                                        /* note: scr->pt.r10 is already -1 */
                                        break;
                                }
-                               /*FALLTHRU*/
+                               fallthrough;
                        case ERESTARTNOINTR:
                                ia64_decrement_ip(&scr->pt);
                                restart = 0; /* don't restart twice if handle_signal() fails... */
index 2d4e65b..6c1a895 100644 (file)
@@ -1431,7 +1431,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                if (u.insn.x)
                        /* oops, really a semaphore op (cmpxchg, etc) */
                        goto failure;
-               /*FALLTHRU*/
+               fallthrough;
              case LDS_IMM_OP:
              case LDSA_IMM_OP:
              case LDFS_OP:
@@ -1459,7 +1459,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                if (u.insn.x)
                        /* oops, really a semaphore op (cmpxchg, etc) */
                        goto failure;
-               /*FALLTHRU*/
+               fallthrough;
              case LD_IMM_OP:
              case LDA_IMM_OP:
              case LDBIAS_IMM_OP:
@@ -1475,7 +1475,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                if (u.insn.x)
                        /* oops, really a semaphore op (cmpxchg, etc) */
                        goto failure;
-               /*FALLTHRU*/
+               fallthrough;
              case ST_IMM_OP:
              case STREL_IMM_OP:
                ret = emulate_store_int(ifa, u.insn, regs);
index 7601fe0..6bd64c3 100644 (file)
@@ -324,7 +324,7 @@ unw_access_gr (struct unw_frame_info *info, int regnum, unsigned long *val, char
                                                        return 0;
                                                }
                                        }
-                                       /* fall through */
+                                       fallthrough;
                                      case UNW_NAT_NONE:
                                        dummy_nat = 0;
                                        nat_addr = &dummy_nat;
index 3709189..5e0e682 100644 (file)
@@ -207,7 +207,7 @@ repeat:
                                        self_test_last_rcv = jiffies;
                                        break;
                                }
-                               /* FALL THROUGH */
+                               fallthrough;
 
                        default:
                                break_flag = scancode & BREAK_MASK;
index fc034fd..a98fca9 100644 (file)
@@ -1067,7 +1067,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
                        regs->d0 = -EINTR;
                        break;
                }
-       /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
        do_restart:
                regs->d0 = regs->orig_d0;
index 5c9f3a2..a621fcc 100644 (file)
@@ -1018,7 +1018,7 @@ int __init mac_platform_init(void)
                 */
                platform_device_register_simple("mac_scsi", 1,
                        mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
-               /* fall through */
+               fallthrough;
        case MAC_SCSI_OLD:
                /* Addresses from Developer Notes for Duo System,
                 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
index 1f0fad2..ac77d73 100644 (file)
@@ -370,7 +370,7 @@ void via_nubus_irq_startup(int irq)
                        /* Allow NuBus slots 9 through F. */
                        via2[vDirA] &= 0x80 | ~(1 << irq_idx);
                }
-               /* fall through */
+               fallthrough;
        case MAC_VIA_IICI:
                via_irq_enable(irq);
                break;
index 795f483..ef46e77 100644 (file)
@@ -118,7 +118,7 @@ good_area:
        pr_debug("do_page_fault: good_area\n");
        switch (error_code & 3) {
                default:        /* 3: write, present */
-                       /* fall through */
+                       fallthrough;
                case 2:         /* write, not present */
                        if (!(vma->vm_flags & VM_WRITE))
                                goto acc_err;
index 65bf5fd..4a96b59 100644 (file)
@@ -249,7 +249,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
                        regs->r3 = -EINTR;
                        break;
        }
-       /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
 do_restart:
                /* offset of 4 bytes to re-execute trap (brki) instruction */
index 47a8ffc..f5b8300 100644 (file)
@@ -137,6 +137,11 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
        return !(flags & 1);
 }
 
+static inline int arch_irqs_disabled(void)
+{
+       return arch_irqs_disabled_flags(arch_local_save_flags());
+}
+
 #endif /* #ifndef __ASSEMBLY__ */
 
 /*
index d35eaed..825d337 100644 (file)
@@ -969,7 +969,7 @@ enum kvm_mips_fault_result kvm_trap_emul_gva_fault(struct kvm_vcpu *vcpu,
 
 #define KVM_ARCH_WANT_MMU_NOTIFIER
 int kvm_unmap_hva_range(struct kvm *kvm,
-                       unsigned long start, unsigned long end);
+                       unsigned long start, unsigned long end, unsigned flags);
 int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
index 7dd4a80..6f4ac85 100644 (file)
        BUILD_BUG_ON(!__builtin_constant_p(times));             \
                                                                \
        switch (times) {                                        \
-       case 32: fn(__VA_ARGS__); /* fall through */            \
-       case 31: fn(__VA_ARGS__); /* fall through */            \
-       case 30: fn(__VA_ARGS__); /* fall through */            \
-       case 29: fn(__VA_ARGS__); /* fall through */            \
-       case 28: fn(__VA_ARGS__); /* fall through */            \
-       case 27: fn(__VA_ARGS__); /* fall through */            \
-       case 26: fn(__VA_ARGS__); /* fall through */            \
-       case 25: fn(__VA_ARGS__); /* fall through */            \
-       case 24: fn(__VA_ARGS__); /* fall through */            \
-       case 23: fn(__VA_ARGS__); /* fall through */            \
-       case 22: fn(__VA_ARGS__); /* fall through */            \
-       case 21: fn(__VA_ARGS__); /* fall through */            \
-       case 20: fn(__VA_ARGS__); /* fall through */            \
-       case 19: fn(__VA_ARGS__); /* fall through */            \
-       case 18: fn(__VA_ARGS__); /* fall through */            \
-       case 17: fn(__VA_ARGS__); /* fall through */            \
-       case 16: fn(__VA_ARGS__); /* fall through */            \
-       case 15: fn(__VA_ARGS__); /* fall through */            \
-       case 14: fn(__VA_ARGS__); /* fall through */            \
-       case 13: fn(__VA_ARGS__); /* fall through */            \
-       case 12: fn(__VA_ARGS__); /* fall through */            \
-       case 11: fn(__VA_ARGS__); /* fall through */            \
-       case 10: fn(__VA_ARGS__); /* fall through */            \
-       case 9: fn(__VA_ARGS__); /* fall through */             \
-       case 8: fn(__VA_ARGS__); /* fall through */             \
-       case 7: fn(__VA_ARGS__); /* fall through */             \
-       case 6: fn(__VA_ARGS__); /* fall through */             \
-       case 5: fn(__VA_ARGS__); /* fall through */             \
-       case 4: fn(__VA_ARGS__); /* fall through */             \
-       case 3: fn(__VA_ARGS__); /* fall through */             \
-       case 2: fn(__VA_ARGS__); /* fall through */             \
-       case 1: fn(__VA_ARGS__); /* fall through */             \
+       case 32: fn(__VA_ARGS__); fallthrough;                  \
+       case 31: fn(__VA_ARGS__); fallthrough;                  \
+       case 30: fn(__VA_ARGS__); fallthrough;                  \
+       case 29: fn(__VA_ARGS__); fallthrough;                  \
+       case 28: fn(__VA_ARGS__); fallthrough;                  \
+       case 27: fn(__VA_ARGS__); fallthrough;                  \
+       case 26: fn(__VA_ARGS__); fallthrough;                  \
+       case 25: fn(__VA_ARGS__); fallthrough;                  \
+       case 24: fn(__VA_ARGS__); fallthrough;                  \
+       case 23: fn(__VA_ARGS__); fallthrough;                  \
+       case 22: fn(__VA_ARGS__); fallthrough;                  \
+       case 21: fn(__VA_ARGS__); fallthrough;                  \
+       case 20: fn(__VA_ARGS__); fallthrough;                  \
+       case 19: fn(__VA_ARGS__); fallthrough;                  \
+       case 18: fn(__VA_ARGS__); fallthrough;                  \
+       case 17: fn(__VA_ARGS__); fallthrough;                  \
+       case 16: fn(__VA_ARGS__); fallthrough;                  \
+       case 15: fn(__VA_ARGS__); fallthrough;                  \
+       case 14: fn(__VA_ARGS__); fallthrough;                  \
+       case 13: fn(__VA_ARGS__); fallthrough;                  \
+       case 12: fn(__VA_ARGS__); fallthrough;                  \
+       case 11: fn(__VA_ARGS__); fallthrough;                  \
+       case 10: fn(__VA_ARGS__); fallthrough;                  \
+       case 9: fn(__VA_ARGS__); fallthrough;                   \
+       case 8: fn(__VA_ARGS__); fallthrough;                   \
+       case 7: fn(__VA_ARGS__); fallthrough;                   \
+       case 6: fn(__VA_ARGS__); fallthrough;                   \
+       case 5: fn(__VA_ARGS__); fallthrough;                   \
+       case 4: fn(__VA_ARGS__); fallthrough;                   \
+       case 3: fn(__VA_ARGS__); fallthrough;                   \
+       case 2: fn(__VA_ARGS__); fallthrough;                   \
+       case 1: fn(__VA_ARGS__); fallthrough;                   \
        case 0: break;                                          \
                                                                \
        default:                                                \
index 87fa8d8..28c366d 100644 (file)
@@ -486,7 +486,8 @@ static int kvm_unmap_hva_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end,
        return 1;
 }
 
-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
+int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
+                       unsigned flags)
 {
        handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
 
index fb45ec4..51ef800 100644 (file)
@@ -34,3 +34,8 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
 {
        return !flags;
 }
+
+static inline int arch_irqs_disabled(void)
+{
+       return arch_irqs_disabled_flags(arch_local_save_flags());
+}
index 62bdafb..9edd7ed 100644 (file)
@@ -45,7 +45,7 @@ void save_fpu(struct task_struct *tsk)
                              : /* no output */
                              : "r" (&tsk->thread.fpu)
                              : "memory");
-               /* fall through */
+               fallthrough;
        case SP32_DP16_reg:
                asm volatile ("fsdi $fd15, [%0+0x78]\n\t"
                              "fsdi $fd14, [%0+0x70]\n\t"
@@ -58,7 +58,7 @@ void save_fpu(struct task_struct *tsk)
                              : /* no output */
                              : "r" (&tsk->thread.fpu)
                              : "memory");
-               /* fall through */
+               fallthrough;
        case SP16_DP8_reg:
                asm volatile ("fsdi $fd7,  [%0+0x38]\n\t"
                              "fsdi $fd6,  [%0+0x30]\n\t"
@@ -67,7 +67,7 @@ void save_fpu(struct task_struct *tsk)
                              : /* no output */
                              : "r" (&tsk->thread.fpu)
                              : "memory");
-               /* fall through */
+               fallthrough;
        case SP8_DP4_reg:
                asm volatile ("fsdi $fd3,  [%1+0x18]\n\t"
                              "fsdi $fd2,  [%1+0x10]\n\t"
@@ -108,7 +108,7 @@ void load_fpu(const struct fpu_struct *fpregs)
                              "fldi $fd16, [%0+0x80]\n\t"
                              : /* no output */
                              : "r" (fpregs));
-               /* fall through */
+               fallthrough;
        case SP32_DP16_reg:
                asm volatile ("fldi $fd15, [%0+0x78]\n\t"
                              "fldi $fd14, [%0+0x70]\n\t"
@@ -120,7 +120,7 @@ void load_fpu(const struct fpu_struct *fpregs)
                              "fldi $fd8,  [%0+0x40]\n\t"
                              : /* no output */
                              : "r" (fpregs));
-               /* fall through */
+               fallthrough;
        case SP16_DP8_reg:
                asm volatile ("fldi $fd7,  [%0+0x38]\n\t"
                              "fldi $fd6,  [%0+0x30]\n\t"
@@ -128,7 +128,7 @@ void load_fpu(const struct fpu_struct *fpregs)
                              "fldi $fd4,  [%0+0x20]\n\t"
                              : /* no output */
                              : "r" (fpregs));
-               /* fall through */
+               fallthrough;
        case SP8_DP4_reg:
                asm volatile ("fldi $fd3,  [%1+0x18]\n\t"
                              "fldi $fd2,  [%1+0x10]\n\t"
index 330b19f..36e25a4 100644 (file)
@@ -316,7 +316,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->uregs[0] = -EINTR;
                                break;
                        }
-                       /* Else, fall through */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->uregs[0] = regs->orig_r0;
                        regs->ipc -= 4;
@@ -361,7 +361,7 @@ static void do_signal(struct pt_regs *regs)
                switch (regs->uregs[0]) {
                case -ERESTART_RESTARTBLOCK:
                        regs->uregs[15] = __NR_restart_syscall;
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
index 97804f2..c779364 100644 (file)
@@ -244,7 +244,7 @@ int do_signal(struct pt_regs *regs, int syscall)
                switch (retval) {
                case -ERESTART_RESTARTBLOCK:
                        restart = -2;
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
index 5df5d4c..3c037fc 100644 (file)
@@ -502,7 +502,7 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
                        regs->gr[28] = -EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
                check_syscallno_in_delay_branch(regs);
                break;
index 43875c2..a52c7ab 100644 (file)
@@ -437,7 +437,6 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o
                break;
 
        default:
-               /* Fall through */
                break;
 
        }
@@ -644,12 +643,12 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
 
        case 15:
                /* Data TLB miss fault/Data page fault */
-               /* Fall through */
+               fallthrough;
        case 16:
                /* Non-access instruction TLB miss fault */
                /* The instruction TLB entry needed for the target address of the FIC
                   is absent, and hardware can't find it, so we get to cleanup */
-               /* Fall through */
+               fallthrough;
        case 17:
                /* Non-access data TLB miss fault/Non-access data page fault */
                /* FIXME: 
@@ -673,7 +672,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
                        handle_unaligned(regs);
                        return;
                }
-               /* Fall Through */
+               fallthrough;
        case 26: 
                /* PCXL: Data memory access rights trap */
                fault_address = regs->ior;
@@ -683,7 +682,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
        case 19:
                /* Data memory break trap */
                regs->gr[0] |= PSW_X; /* So we can single-step over the trap */
-               /* fall thru */
+               fallthrough;
        case 21:
                /* Page reference trap */
                handle_gdb_break(regs, TRAP_HWBKPT);
@@ -730,7 +729,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
                        }
                        mmap_read_unlock(current->mm);
                }
-               /* Fall Through */
+               fallthrough;
        case 27: 
                /* Data memory protection ID trap */
                if (code == 27 && !user_mode(regs) &&
index 4bfe2da..716960f 100644 (file)
@@ -67,7 +67,7 @@ parisc_acctyp(unsigned long code, unsigned int inst)
        case 0x30000000: /* coproc2 */
                if (bit22set(inst))
                        return VM_WRITE;
-               /* fall through */
+               fallthrough;
 
        case 0x0: /* indexed/memory management */
                if (bit22set(inst)) {
@@ -370,7 +370,7 @@ bad_area:
                        }
 
                        /* probably address is outside of mapped file */
-                       /* fall through */
+                       fallthrough;
                case 17:        /* NA data TLB miss / page fault */
                case 18:        /* Unaligned access - PCXS only */
                        signo = SIGBUS;
index 1f48bbf..65bed1f 100644 (file)
@@ -860,6 +860,18 @@ config PPC_SUBPAGE_PROT
 
          If unsure, say N here.
 
+config PPC_PROT_SAO_LPAR
+       bool "Support PROT_SAO mappings in LPARs"
+       depends on PPC_BOOK3S_64
+       help
+         This option adds support for PROT_SAO mappings from userspace
+         inside LPARs on supported CPUs.
+
+         This may cause issues when performing guest migration from
+         a CPU that supports SAO to one that does not.
+
+         If unsure, say N here.
+
 config PPC_COPRO_BASE
        bool
 
index 6de56c3..495fc0c 100644 (file)
 #define _PAGE_RW               (_PAGE_READ | _PAGE_WRITE)
 #define _PAGE_RWX              (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)
 #define _PAGE_PRIVILEGED       0x00008 /* kernel access only */
-
-#define _PAGE_CACHE_CTL                0x00030 /* Bits for the folowing cache modes */
-                       /*      No bits set is normal cacheable memory */
-                       /*      0x00010 unused, is SAO bit on radix POWER9 */
+#define _PAGE_SAO              0x00010 /* Strong access order */
 #define _PAGE_NON_IDEMPOTENT   0x00020 /* non idempotent memory */
 #define _PAGE_TOLERANT         0x00030 /* tolerant memory, cache inhibited */
-
 #define _PAGE_DIRTY            0x00080 /* C: page changed */
 #define _PAGE_ACCESSED         0x00100 /* R: page referenced */
 /*
@@ -828,6 +824,8 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
        return hash__set_pte_at(mm, addr, ptep, pte, percpu);
 }
 
+#define _PAGE_CACHE_CTL        (_PAGE_SAO | _PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT)
+
 #define pgprot_noncached pgprot_noncached
 static inline pgprot_t pgprot_noncached(pgprot_t prot)
 {
index fdddb82..32a15dc 100644 (file)
@@ -9,6 +9,11 @@
 
 #ifndef __ASSEMBLY__
 
+/*
+ * Added to include __machine_check_early_realmode_* functions
+ */
+#include <asm/mce.h>
+
 /* This structure can grow, it's real size is used by head.S code
  * via the mkdefs mechanism.
  */
@@ -191,7 +196,7 @@ static inline void cpu_feature_keys_init(void) { }
 #define CPU_FTR_SPURR                  LONG_ASM_CONST(0x0000000001000000)
 #define CPU_FTR_DSCR                   LONG_ASM_CONST(0x0000000002000000)
 #define CPU_FTR_VSX                    LONG_ASM_CONST(0x0000000004000000)
-// Free                                        LONG_ASM_CONST(0x0000000008000000)
+#define CPU_FTR_SAO                    LONG_ASM_CONST(0x0000000008000000)
 #define CPU_FTR_CP_USE_DCBTZ           LONG_ASM_CONST(0x0000000010000000)
 #define CPU_FTR_UNALIGNED_LD_STD       LONG_ASM_CONST(0x0000000020000000)
 #define CPU_FTR_ASYM_SMT               LONG_ASM_CONST(0x0000000040000000)
@@ -436,7 +441,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | CPU_FTR_ASYM_SMT | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | CPU_FTR_ASYM_SMT | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | \
            CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX )
@@ -445,7 +450,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \
@@ -456,7 +461,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
@@ -474,7 +479,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
index 925cf89..6bfc879 100644 (file)
@@ -52,7 +52,7 @@ enum fixed_addresses {
        FIX_HOLE,
        /* reserve the top 128K for early debugging purposes */
        FIX_EARLY_DEBUG_TOP = FIX_HOLE,
-       FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+(ALIGN(SZ_128, PAGE_SIZE)/PAGE_SIZE)-1,
+       FIX_EARLY_DEBUG_BASE = FIX_EARLY_DEBUG_TOP+(ALIGN(SZ_128K, PAGE_SIZE)/PAGE_SIZE)-1,
 #ifdef CONFIG_HIGHMEM
        FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
        FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
index 3a0db7b..35060be 100644 (file)
@@ -200,17 +200,14 @@ static inline bool arch_irqs_disabled(void)
 #define powerpc_local_irq_pmu_save(flags)                      \
         do {                                                   \
                raw_local_irq_pmu_save(flags);                  \
-               trace_hardirqs_off();                           \
+               if (!raw_irqs_disabled_flags(flags))            \
+                       trace_hardirqs_off();                   \
        } while(0)
 #define powerpc_local_irq_pmu_restore(flags)                   \
        do {                                                    \
-               if (raw_irqs_disabled_flags(flags)) {           \
-                       raw_local_irq_pmu_restore(flags);       \
-                       trace_hardirqs_off();                   \
-               } else {                                        \
+               if (!raw_irqs_disabled_flags(flags))            \
                        trace_hardirqs_on();                    \
-                       raw_local_irq_pmu_restore(flags);       \
-               }                                               \
+               raw_local_irq_pmu_restore(flags);               \
        } while(0)
 #else
 #define powerpc_local_irq_pmu_save(flags)                      \
index d635b96..7355ed0 100644 (file)
 #ifndef __ASSEMBLY__
 
 #include <asm/page.h>
+#include <linux/sizes.h>
 
 #define KASAN_SHADOW_SCALE_SHIFT       3
 
+#if defined(CONFIG_PPC_BOOK3S_32) && defined(CONFIG_MODULES) && defined(CONFIG_STRICT_KERNEL_RWX)
+#define KASAN_KERN_START       ALIGN_DOWN(PAGE_OFFSET - SZ_256M, SZ_256M)
+#else
+#define KASAN_KERN_START       PAGE_OFFSET
+#endif
+
 #define KASAN_SHADOW_START     (KASAN_SHADOW_OFFSET + \
-                                (PAGE_OFFSET >> KASAN_SHADOW_SCALE_SHIFT))
+                                (KASAN_KERN_START >> KASAN_SHADOW_SCALE_SHIFT))
 
 #define KASAN_SHADOW_OFFSET    ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
 
index e020d26..10ded83 100644 (file)
@@ -58,7 +58,8 @@
 #define KVM_ARCH_WANT_MMU_NOTIFIER
 
 extern int kvm_unmap_hva_range(struct kvm *kvm,
-                              unsigned long start, unsigned long end);
+                              unsigned long start, unsigned long end,
+                              unsigned flags);
 extern int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 extern int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
index adf2cda..89aa824 100644 (file)
@@ -210,6 +210,9 @@ struct mce_error_info {
 #define MCE_EVENT_RELEASE      true
 #define MCE_EVENT_DONTRELEASE  false
 
+struct pt_regs;
+struct notifier_block;
+
 extern void save_mce_event(struct pt_regs *regs, long handled,
                           struct mce_error_info *mce_err, uint64_t nip,
                           uint64_t addr, uint64_t phys_addr);
@@ -225,5 +228,9 @@ int mce_register_notifier(struct notifier_block *nb);
 int mce_unregister_notifier(struct notifier_block *nb);
 #ifdef CONFIG_PPC_BOOK3S_64
 void flush_and_reload_slb(void);
+long __machine_check_early_realmode_p7(struct pt_regs *regs);
+long __machine_check_early_realmode_p8(struct pt_regs *regs);
+long __machine_check_early_realmode_p9(struct pt_regs *regs);
+long __machine_check_early_realmode_p10(struct pt_regs *regs);
 #endif /* CONFIG_PPC_BOOK3S_64 */
 #endif /* __ASM_PPC64_MCE_H__ */
index 7c07728..7cb6d18 100644 (file)
 #include <linux/pkeys.h>
 #include <asm/cpu_has_feature.h>
 
-#ifdef CONFIG_PPC_MEM_KEYS
 static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
                unsigned long pkey)
 {
-       return pkey_to_vmflag_bits(pkey);
+#ifdef CONFIG_PPC_MEM_KEYS
+       return (((prot & PROT_SAO) ? VM_SAO : 0) | pkey_to_vmflag_bits(pkey));
+#else
+       return ((prot & PROT_SAO) ? VM_SAO : 0);
+#endif
 }
 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
 
 static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
 {
-       return __pgprot(vmflag_to_pte_pkey_bits(vm_flags));
+#ifdef CONFIG_PPC_MEM_KEYS
+       return (vm_flags & VM_SAO) ?
+               __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
+               __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
+#else
+       return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
+#endif
 }
 #define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-#endif
+
+static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
+{
+       if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
+               return false;
+       if (prot & PROT_SAO) {
+               if (!cpu_has_feature(CPU_FTR_SAO))
+                       return false;
+               if (firmware_has_feature(FW_FEATURE_LPAR) &&
+                   !IS_ENABLED(CONFIG_PPC_PROT_SAO_LPAR))
+                       return false;
+       }
+       return true;
+}
+#define arch_validate_prot arch_validate_prot
 
 #endif /* CONFIG_PPC64 */
 #endif /* _ASM_POWERPC_MMAN_H */
index 59ee9fa..6cb8aa3 100644 (file)
@@ -82,6 +82,8 @@
  */
 #include <asm/nohash/pte-book3e.h>
 
+#define _PAGE_SAO      0
+
 #define PTE_RPN_MASK   (~((1UL << PTE_RPN_SHIFT) - 1))
 
 /*
index 1e8b2e1..daec64d 100644 (file)
@@ -40,4 +40,7 @@ static inline bool is_sier_available(void) { return false; }
 
 /* To support perf_regs sier update */
 extern bool is_sier_available(void);
+/* To define perf extended regs mask value */
+extern u64 PERF_REG_EXTENDED_MASK;
+#define PERF_REG_EXTENDED_MASK PERF_REG_EXTENDED_MASK
 #endif
index 86c9eb0..f6acabb 100644 (file)
@@ -62,6 +62,11 @@ struct power_pmu {
        int             *blacklist_ev;
        /* BHRB entries in the PMU */
        int             bhrb_nr;
+       /*
+        * set this flag with `PERF_PMU_CAP_EXTENDED_REGS` if
+        * the pmu supports extended perf regs capability
+        */
+       int             capabilities;
 };
 
 /*
index 3a70035..c0c7372 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm-generic/mman-common.h>
 
 
-#define PROT_SAO       0x10            /* Unsupported since v5.9 */
+#define PROT_SAO       0x10            /* Strong Access Ordering */
 
 #define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */
 #define MAP_NORESERVE   0x40            /* don't reserve swap pages */
index f599064..bdf5f10 100644 (file)
@@ -48,6 +48,24 @@ enum perf_event_powerpc_regs {
        PERF_REG_POWERPC_DSISR,
        PERF_REG_POWERPC_SIER,
        PERF_REG_POWERPC_MMCRA,
-       PERF_REG_POWERPC_MAX,
+       /* Extended registers */
+       PERF_REG_POWERPC_MMCR0,
+       PERF_REG_POWERPC_MMCR1,
+       PERF_REG_POWERPC_MMCR2,
+       PERF_REG_POWERPC_MMCR3,
+       PERF_REG_POWERPC_SIER2,
+       PERF_REG_POWERPC_SIER3,
+       /* Max regs without the extended regs */
+       PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
 };
+
+#define PERF_REG_PMU_MASK      ((1ULL << PERF_REG_POWERPC_MAX) - 1)
+
+/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300 */
+#define PERF_REG_PMU_MASK_300   (((1ULL << (PERF_REG_POWERPC_MMCR2 + 1)) - 1) - PERF_REG_PMU_MASK)
+/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31 */
+#define PERF_REG_PMU_MASK_31   (((1ULL << (PERF_REG_POWERPC_SIER3 + 1)) - 1) - PERF_REG_PMU_MASK)
+
+#define PERF_REG_MAX_ISA_300   (PERF_REG_POWERPC_MMCR2 + 1)
+#define PERF_REG_MAX_ISA_31    (PERF_REG_POWERPC_SIER3 + 1)
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
index 3d406a9..2aa89c6 100644 (file)
@@ -72,9 +72,6 @@ extern void __setup_cpu_power9(unsigned long offset, struct cpu_spec* spec);
 extern void __restore_cpu_power9(void);
 extern void __setup_cpu_power10(unsigned long offset, struct cpu_spec* spec);
 extern void __restore_cpu_power10(void);
-extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
-extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
-extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
 #endif /* CONFIG_PPC64 */
 #if defined(CONFIG_E500)
 extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
@@ -542,6 +539,25 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .machine_check_early    = __machine_check_early_realmode_p9,
                .platform               = "power9",
        },
+       {       /* Power10 */
+               .pvr_mask               = 0xffff0000,
+               .pvr_value              = 0x00800000,
+               .cpu_name               = "POWER10 (raw)",
+               .cpu_features           = CPU_FTRS_POWER10,
+               .cpu_user_features      = COMMON_USER_POWER10,
+               .cpu_user_features2     = COMMON_USER2_POWER10,
+               .mmu_features           = MMU_FTRS_POWER10,
+               .icache_bsize           = 128,
+               .dcache_bsize           = 128,
+               .num_pmcs               = 6,
+               .pmc_type               = PPC_PMC_IBM,
+               .oprofile_cpu_type      = "ppc64/power10",
+               .oprofile_type          = PPC_OPROFILE_INVALID,
+               .cpu_setup              = __setup_cpu_power10,
+               .cpu_restore            = __restore_cpu_power10,
+               .machine_check_early    = __machine_check_early_realmode_p10,
+               .platform               = "power10",
+       },
        {       /* Cell Broadband Engine */
                .pvr_mask               = 0xffff0000,
                .pvr_value              = 0x00700000,
index 6f8c0c6..f204ad7 100644 (file)
@@ -64,10 +64,6 @@ struct dt_cpu_feature {
  * Set up the base CPU
  */
 
-extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
-extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
-extern long __machine_check_early_realmode_p10(struct pt_regs *regs);
-
 static int hv_mode;
 
 static struct {
@@ -657,7 +653,7 @@ static struct dt_cpu_feature_match __initdata
        {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL},
        {"processor-utilization-of-resources-register", feat_enable_purr, 0},
        {"no-execute", feat_enable, 0},
-       /* strong-access-ordering is unused */
+       {"strong-access-ordering", feat_enable, CPU_FTR_SAO},
        {"cache-inhibited-large-page", feat_enable_large_ci, 0},
        {"coprocessor-icswx", feat_enable, 0},
        {"hypervisor-virtualization-interrupt", feat_enable_hvi, 0},
index 33a42e4..733e40e 100644 (file)
@@ -113,6 +113,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM)
        ld      r11,exception_marker@toc(r2)
        std     r11,-16(r10)            /* "regshere" marker */
 
+BEGIN_FTR_SECTION
+       HMT_MEDIUM
+END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
+
        /*
         * RECONCILE_IRQ_STATE without calling trace_hardirqs_off(), which
         * would clobber syscall parameters. Also we always enter with IRQs
index 016bd83..73a5704 100644 (file)
@@ -548,7 +548,7 @@ void notrace restore_math(struct pt_regs *regs)
         * are live for the user thread).
         */
        if ((!(msr & MSR_FP)) && should_restore_fp())
-               new_msr |= MSR_FP | current->thread.fpexc_mode;
+               new_msr |= MSR_FP;
 
        if ((!(msr & MSR_VEC)) && should_restore_altivec())
                new_msr |= MSR_VEC;
@@ -559,11 +559,17 @@ void notrace restore_math(struct pt_regs *regs)
        }
 
        if (new_msr) {
+               unsigned long fpexc_mode = 0;
+
                msr_check_and_set(new_msr);
 
-               if (new_msr & MSR_FP)
+               if (new_msr & MSR_FP) {
                        do_restore_fp();
 
+                       // This also covers VSX, because VSX implies FP
+                       fpexc_mode = current->thread.fpexc_mode;
+               }
+
                if (new_msr & MSR_VEC)
                        do_restore_altivec();
 
@@ -572,7 +578,7 @@ void notrace restore_math(struct pt_regs *regs)
 
                msr_check_and_clear(new_msr);
 
-               regs->msr |= new_msr;
+               regs->msr |= new_msr | fpexc_mode;
        }
 }
 #endif
index b198b0f..808ec9f 100644 (file)
@@ -311,6 +311,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                                min = pvr & 0xFF;
                                break;
                        case 0x004e: /* POWER9 bits 12-15 give chip type */
+                       case 0x0080: /* POWER10 bit 12 gives SMT8/4 */
                                maj = (pvr >> 8) & 0x0F;
                                min = pvr & 0xFF;
                                break;
index 41fedec..49db50d 100644 (file)
@@ -834,7 +834,8 @@ void kvmppc_core_commit_memory_region(struct kvm *kvm,
        kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new, change);
 }
 
-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
+int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
+                       unsigned flags)
 {
        return kvm->arch.kvm_ops->unmap_hva_range(kvm, start, end);
 }
index d6c1069..ed0c9c4 100644 (file)
@@ -734,7 +734,8 @@ static int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
        return 0;
 }
 
-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
+int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
+                       unsigned flags)
 {
        /* kvm_unmap_hva flushes everything anyways */
        kvm_unmap_hva(kvm, start);
index c016291..d426eaf 100644 (file)
@@ -191,10 +191,17 @@ static bool is_module_segment(unsigned long addr)
 {
        if (!IS_ENABLED(CONFIG_MODULES))
                return false;
+#ifdef MODULES_VADDR
+       if (addr < ALIGN_DOWN(MODULES_VADDR, SZ_256M))
+               return false;
+       if (addr > ALIGN(MODULES_END, SZ_256M) - 1)
+               return false;
+#else
        if (addr < ALIGN_DOWN(VMALLOC_START, SZ_256M))
                return false;
-       if (addr >= ALIGN(VMALLOC_END, SZ_256M))
+       if (addr > ALIGN(VMALLOC_END, SZ_256M) - 1)
                return false;
+#endif
        return true;
 }
 
index 1da9dbb..c663e7b 100644 (file)
@@ -232,6 +232,8 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)
                rflags |= HPTE_R_I;
        else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_NON_IDEMPOTENT)
                rflags |= (HPTE_R_I | HPTE_R_G);
+       else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO)
+               rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M);
        else
                /*
                 * Add memory coherence if cache inhibited is not set
@@ -1115,8 +1117,10 @@ void hash__early_init_mmu_secondary(void)
                        && cpu_has_feature(CPU_FTR_HVMODE))
                tlbiel_all();
 
-       if (IS_ENABLED(CONFIG_PPC_MEM_KEYS) && mmu_has_feature(MMU_FTR_PKEY))
+#ifdef CONFIG_PPC_MEM_KEYS
+       if (mmu_has_feature(MMU_FTR_PKEY))
                mtspr(SPRN_UAMOR, default_uamor);
+#endif
 }
 #endif /* CONFIG_SMP */
 
index 16d09b3..78d61f9 100644 (file)
@@ -475,7 +475,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
                case BPF_JMP | BPF_JSET | BPF_K:
                case BPF_JMP | BPF_JSET | BPF_X:
                        true_cond = COND_NE;
-                       /* Fall through */
+                       fallthrough;
                cond_branch:
                        /* same targets, can avoid doing the test :) */
                        if (filter[i].jt == filter[i].jf) {
index 78fe349..08643cb 100644 (file)
@@ -1557,9 +1557,16 @@ nocheck:
        ret = 0;
  out:
        if (has_branch_stack(event)) {
-               power_pmu_bhrb_enable(event);
-               cpuhw->bhrb_filter = ppmu->bhrb_filter_map(
-                                       event->attr.branch_sample_type);
+               u64 bhrb_filter = -1;
+
+               if (ppmu->bhrb_filter_map)
+                       bhrb_filter = ppmu->bhrb_filter_map(
+                               event->attr.branch_sample_type);
+
+               if (bhrb_filter != -1) {
+                       cpuhw->bhrb_filter = bhrb_filter;
+                       power_pmu_bhrb_enable(event);
+               }
        }
 
        perf_pmu_enable(event->pmu);
@@ -1881,7 +1888,6 @@ static int power_pmu_event_init(struct perf_event *event)
        int n;
        int err;
        struct cpu_hw_events *cpuhw;
-       u64 bhrb_filter;
 
        if (!ppmu)
                return -ENOENT;
@@ -1987,7 +1993,10 @@ static int power_pmu_event_init(struct perf_event *event)
        err = power_check_constraints(cpuhw, events, cflags, n + 1);
 
        if (has_branch_stack(event)) {
-               bhrb_filter = ppmu->bhrb_filter_map(
+               u64 bhrb_filter = -1;
+
+               if (ppmu->bhrb_filter_map)
+                       bhrb_filter = ppmu->bhrb_filter_map(
                                        event->attr.branch_sample_type);
 
                if (bhrb_filter == -1) {
@@ -2141,6 +2150,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
 
                if (perf_event_overflow(event, &data, regs))
                        power_pmu_stop(event, 0);
+       } else if (period) {
+               /* Account for interrupt in case of invalid SIAR */
+               if (perf_event_account_interrupt(event))
+                       power_pmu_stop(event, 0);
        }
 }
 
@@ -2323,6 +2336,7 @@ int register_power_pmu(struct power_pmu *pmu)
                pmu->name);
 
        power_pmu.attr_groups = ppmu->attr_groups;
+       power_pmu.capabilities |= (ppmu->capabilities & PERF_PMU_CAP_EXTENDED_REGS);
 
 #ifdef MSR_HV
        /*
index cdb7bfb..6e7e820 100644 (file)
@@ -1128,6 +1128,15 @@ static struct bin_attribute *if_bin_attrs[] = {
        NULL,
 };
 
+static struct attribute *cpumask_attrs[] = {
+       &dev_attr_cpumask.attr,
+       NULL,
+};
+
+static struct attribute_group cpumask_attr_group = {
+       .attrs = cpumask_attrs,
+};
+
 static struct attribute *if_attrs[] = {
        &dev_attr_catalog_len.attr,
        &dev_attr_catalog_version.attr,
@@ -1135,7 +1144,6 @@ static struct attribute *if_attrs[] = {
        &dev_attr_sockets.attr,
        &dev_attr_chipspersocket.attr,
        &dev_attr_coresperchip.attr,
-       &dev_attr_cpumask.attr,
        NULL,
 };
 
@@ -1151,6 +1159,7 @@ static const struct attribute_group *attr_groups[] = {
        &event_desc_group,
        &event_long_desc_group,
        &if_group,
+       &cpumask_attr_group,
        NULL,
 };
 
index a45d694..62d0b54 100644 (file)
@@ -1289,7 +1289,7 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem,
        header->misc = 0;
 
        if (cpu_has_feature(CPU_FTR_ARCH_31)) {
-               switch (IMC_TRACE_RECORD_VAL_HVPR(mem->val)) {
+               switch (IMC_TRACE_RECORD_VAL_HVPR(be64_to_cpu(READ_ONCE(mem->val)))) {
                case 0:/* when MSR HV and PR not set in the trace-record */
                        header->misc |= PERF_RECORD_MISC_GUEST_KERNEL;
                        break;
@@ -1297,7 +1297,7 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem,
                        header->misc |= PERF_RECORD_MISC_GUEST_USER;
                        break;
                case 2: /* MSR HV is 1 and PR is 0 */
-                       header->misc |= PERF_RECORD_MISC_HYPERVISOR;
+                       header->misc |= PERF_RECORD_MISC_KERNEL;
                        break;
                case 3: /* MSR HV is 1 and PR is 1 */
                        header->misc |= PERF_RECORD_MISC_USER;
index a213a0a..8e53f2f 100644 (file)
 #include <asm/ptrace.h>
 #include <asm/perf_regs.h>
 
+u64 PERF_REG_EXTENDED_MASK;
+
 #define PT_REGS_OFFSET(id, r) [id] = offsetof(struct pt_regs, r)
 
-#define REG_RESERVED (~((1ULL << PERF_REG_POWERPC_MAX) - 1))
+#define REG_RESERVED (~(PERF_REG_EXTENDED_MASK | PERF_REG_PMU_MASK))
 
 static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
        PT_REGS_OFFSET(PERF_REG_POWERPC_R0,  gpr[0]),
@@ -69,10 +71,36 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
        PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr),
 };
 
+/* Function to return the extended register values */
+static u64 get_ext_regs_value(int idx)
+{
+       switch (idx) {
+       case PERF_REG_POWERPC_MMCR0:
+               return mfspr(SPRN_MMCR0);
+       case PERF_REG_POWERPC_MMCR1:
+               return mfspr(SPRN_MMCR1);
+       case PERF_REG_POWERPC_MMCR2:
+               return mfspr(SPRN_MMCR2);
+#ifdef CONFIG_PPC64
+       case PERF_REG_POWERPC_MMCR3:
+               return mfspr(SPRN_MMCR3);
+       case PERF_REG_POWERPC_SIER2:
+               return mfspr(SPRN_SIER2);
+       case PERF_REG_POWERPC_SIER3:
+               return mfspr(SPRN_SIER3);
+#endif
+       default: return 0;
+       }
+}
+
 u64 perf_reg_value(struct pt_regs *regs, int idx)
 {
-       if (WARN_ON_ONCE(idx >= PERF_REG_POWERPC_MAX))
-               return 0;
+       u64 perf_reg_extended_max = PERF_REG_POWERPC_MAX;
+
+       if (cpu_has_feature(CPU_FTR_ARCH_31))
+               perf_reg_extended_max = PERF_REG_MAX_ISA_31;
+       else if (cpu_has_feature(CPU_FTR_ARCH_300))
+               perf_reg_extended_max = PERF_REG_MAX_ISA_300;
 
        if (idx == PERF_REG_POWERPC_SIER &&
           (IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) ||
@@ -85,6 +113,16 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
            IS_ENABLED(CONFIG_PPC32)))
                return 0;
 
+       if (idx >= PERF_REG_POWERPC_MAX && idx < perf_reg_extended_max)
+               return get_ext_regs_value(idx);
+
+       /*
+        * If the idx is referring to value beyond the
+        * supported registers, return 0 with a warning
+        */
+       if (WARN_ON_ONCE(idx >= perf_reg_extended_max))
+               return 0;
+
        return regs_get_register(regs, pt_regs_offset[idx]);
 }
 
index f7cff7f..8314865 100644 (file)
@@ -87,6 +87,8 @@
 #define POWER10_MMCRA_IFM3             0x00000000C0000000UL
 #define POWER10_MMCRA_BHRB_MASK                0x00000000C0000000UL
 
+extern u64 PERF_REG_EXTENDED_MASK;
+
 /* Table of alternatives, sorted by column 0 */
 static const unsigned int power10_event_alternatives[][MAX_ALT] = {
        { PM_RUN_CYC_ALT,               PM_RUN_CYC },
@@ -397,6 +399,7 @@ static struct power_pmu power10_pmu = {
        .cache_events           = &power10_cache_events,
        .attr_groups            = power10_pmu_attr_groups,
        .bhrb_nr                = 32,
+       .capabilities           = PERF_PMU_CAP_EXTENDED_REGS,
 };
 
 int init_power10_pmu(void)
@@ -408,6 +411,9 @@ int init_power10_pmu(void)
            strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power10"))
                return -ENODEV;
 
+       /* Set the PERF_REG_EXTENDED_MASK here */
+       PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_31;
+
        rc = register_power_pmu(&power10_pmu);
        if (rc)
                return rc;
index 05dae38..2a57e93 100644 (file)
@@ -90,6 +90,8 @@ enum {
 #define POWER9_MMCRA_IFM3              0x00000000C0000000UL
 #define POWER9_MMCRA_BHRB_MASK         0x00000000C0000000UL
 
+extern u64 PERF_REG_EXTENDED_MASK;
+
 /* Nasty Power9 specific hack */
 #define PVR_POWER9_CUMULUS             0x00002000
 
@@ -434,6 +436,7 @@ static struct power_pmu power9_pmu = {
        .cache_events           = &power9_cache_events,
        .attr_groups            = power9_pmu_attr_groups,
        .bhrb_nr                = 32,
+       .capabilities           = PERF_PMU_CAP_EXTENDED_REGS,
 };
 
 int init_power9_pmu(void)
@@ -457,6 +460,9 @@ int init_power9_pmu(void)
                }
        }
 
+       /* Set the PERF_REG_EXTENDED_MASK here */
+       PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_300;
+
        rc = register_power_pmu(&power9_pmu);
        if (rc)
                return rc;
index 87737ec..1dc9d3c 100644 (file)
@@ -36,7 +36,7 @@ config PPC_BOOK3S_6xx
        select PPC_HAVE_PMU_SUPPORT
        select PPC_HAVE_KUEP
        select PPC_HAVE_KUAP
-       select HAVE_ARCH_VMAP_STACK
+       select HAVE_ARCH_VMAP_STACK if !ADB_PMU
 
 config PPC_BOOK3S_601
        bool "PowerPC 601"
index 77513a8..345ab06 100644 (file)
@@ -1223,7 +1223,7 @@ static void __init pnv_probe_idle_states(void)
                return;
        }
 
-       if (pvr_version_is(PVR_POWER9))
+       if (cpu_has_feature(CPU_FTR_ARCH_300))
                pnv_power9_idle_init();
 
        for (i = 0; i < nr_pnv_idle_states; i++)
index c9c25fb..023a4f9 100644 (file)
@@ -2705,7 +2705,7 @@ void pnv_pci_ioda2_release_pe_dma(struct pnv_ioda_pe *pe)
        struct iommu_table *tbl = pe->table_group.tables[0];
        int64_t rc;
 
-       if (pe->dma_setup_done)
+       if (!pe->dma_setup_done)
                return;
 
        rc = pnv_pci_ioda2_unset_window(&pe->table_group, 0);
index c6e0d8a..7a974ed 100644 (file)
@@ -107,22 +107,28 @@ static int pseries_cpu_disable(void)
  */
 static void pseries_cpu_die(unsigned int cpu)
 {
-       int tries;
        int cpu_status = 1;
        unsigned int pcpu = get_hard_smp_processor_id(cpu);
+       unsigned long timeout = jiffies + msecs_to_jiffies(120000);
 
-       for (tries = 0; tries < 25; tries++) {
+       while (true) {
                cpu_status = smp_query_cpu_stopped(pcpu);
                if (cpu_status == QCSS_STOPPED ||
                    cpu_status == QCSS_HARDWARE_ERROR)
                        break;
-               cpu_relax();
 
+               if (time_after(jiffies, timeout)) {
+                       pr_warn("CPU %i (hwid %i) didn't die after 120 seconds\n",
+                               cpu, pcpu);
+                       timeout = jiffies + msecs_to_jiffies(120000);
+               }
+
+               cond_resched();
        }
 
-       if (cpu_status != 0) {
-               printk("Querying DEAD? cpu %i (%i) shows %i\n",
-                      cpu, pcpu, cpu_status);
+       if (cpu_status == QCSS_HARDWARE_ERROR) {
+               pr_warn("CPU %i (hwid %i) reported error while dying\n",
+                       cpu, pcpu);
        }
 
        /* Isolation and deallocation are definitely done by
index f3736fc..13c86a2 100644 (file)
@@ -184,7 +184,6 @@ static void handle_system_shutdown(char event_modifier)
        case EPOW_SHUTDOWN_ON_UPS:
                pr_emerg("Loss of system power detected. System is running on"
                         " UPS/battery. Check RTAS error log for details\n");
-               orderly_poweroff(true);
                break;
 
        case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS:
index 7b59055..df18372 100644 (file)
@@ -81,7 +81,7 @@ config RISCV
        select PCI_DOMAINS_GENERIC if PCI
        select PCI_MSI if PCI
        select RISCV_INTC
-       select RISCV_TIMER
+       select RISCV_TIMER if RISCV_SBI
        select SPARSEMEM_STATIC if 32BIT
        select SPARSE_IRQ
        select SYSCTL_EXCEPTION_TRACE
index 6c88148..8a55f61 100644 (file)
@@ -12,6 +12,7 @@ config SOC_SIFIVE
 
 config SOC_VIRT
        bool "QEMU Virt Machine"
+       select CLINT_TIMER if RISCV_M_MODE
        select POWER_RESET
        select POWER_RESET_SYSCON
        select POWER_RESET_SYSCON_POWEROFF
@@ -24,6 +25,7 @@ config SOC_VIRT
 config SOC_KENDRYTE
        bool "Kendryte K210 SoC"
        depends on !MMU
+       select CLINT_TIMER if RISCV_M_MODE
        select SERIAL_SIFIVE if TTY
        select SERIAL_SIFIVE_CONSOLE if TTY
        select SIFIVE_PLIC
index f27596e..e046a0b 100644 (file)
@@ -26,6 +26,7 @@ CONFIG_EXPERT=y
 CONFIG_SLOB=y
 # CONFIG_SLAB_MERGE_DEFAULT is not set
 # CONFIG_MMU is not set
+CONFIG_SOC_VIRT=y
 CONFIG_MAXPHYSMEM_2GB=y
 CONFIG_SMP=y
 CONFIG_CMDLINE="root=/dev/vda rw earlycon=uart8250,mmio,0x10000000,115200n8 console=ttyS0"
@@ -49,7 +50,6 @@ CONFIG_VIRTIO_BLK=y
 # CONFIG_SERIO is not set
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_LDISC_AUTOLOAD is not set
-# CONFIG_DEVMEM is not set
 CONFIG_SERIAL_8250=y
 # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -57,16 +57,13 @@ CONFIG_SERIAL_8250_NR_UARTS=1
 CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
+# CONFIG_DEVMEM is not set
 # CONFIG_HWMON is not set
-# CONFIG_LCD_CLASS_DEVICE is not set
-# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
 # CONFIG_VGA_CONSOLE is not set
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_VIRTIO_MMIO=y
 CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
-CONFIG_SIFIVE_PLIC=y
-# CONFIG_VALIDATE_FS_PARSER is not set
 CONFIG_EXT2_FS=y
 # CONFIG_DNOTIFY is not set
 # CONFIG_INOTIFY_USER is not set
index 3a55f0e..2c2cda6 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_CHECKPOINT_RESTORE=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_EXPERT=y
 CONFIG_BPF_SYSCALL=y
+CONFIG_SOC_SIFIVE=y
 CONFIG_SOC_VIRT=y
 CONFIG_ARCH_RV32I=y
 CONFIG_SMP=y
@@ -62,6 +63,8 @@ CONFIG_HVC_RISCV_SBI=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_VIRTIO=y
+CONFIG_SPI=y
+CONFIG_SPI_SIFIVE=y
 # CONFIG_PTP_1588_CLOCK is not set
 CONFIG_POWER_RESET=y
 CONFIG_DRM=y
@@ -77,6 +80,8 @@ CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_UAS=y
+CONFIG_MMC=y
+CONFIG_MMC_SPI=y
 CONFIG_RTC_CLASS=y
 CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_BALLOON=y
diff --git a/arch/riscv/include/asm/clint.h b/arch/riscv/include/asm/clint.h
deleted file mode 100644 (file)
index a279b17..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_RISCV_CLINT_H
-#define _ASM_RISCV_CLINT_H 1
-
-#include <linux/io.h>
-#include <linux/smp.h>
-
-#ifdef CONFIG_RISCV_M_MODE
-extern u32 __iomem *clint_ipi_base;
-
-void clint_init_boot_cpu(void);
-
-static inline void clint_send_ipi_single(unsigned long hartid)
-{
-       writel(1, clint_ipi_base + hartid);
-}
-
-static inline void clint_send_ipi_mask(const struct cpumask *mask)
-{
-       int cpu;
-
-       for_each_cpu(cpu, mask)
-               clint_send_ipi_single(cpuid_to_hartid_map(cpu));
-}
-
-static inline void clint_clear_ipi(unsigned long hartid)
-{
-       writel(0, clint_ipi_base + hartid);
-}
-#else /* CONFIG_RISCV_M_MODE */
-#define clint_init_boot_cpu()  do { } while (0)
-
-/* stubs to for code is only reachable under IS_ENABLED(CONFIG_RISCV_M_MODE): */
-void clint_send_ipi_single(unsigned long hartid);
-void clint_send_ipi_mask(const struct cpumask *hartid_mask);
-void clint_clear_ipi(unsigned long hartid);
-#endif /* CONFIG_RISCV_M_MODE */
-
-#endif /* _ASM_RISCV_CLINT_H */
index 6dfd2a1..df1f7c4 100644 (file)
 struct seq_file;
 extern unsigned long boot_cpu_hartid;
 
+struct riscv_ipi_ops {
+       void (*ipi_inject)(const struct cpumask *target);
+       void (*ipi_clear)(void);
+};
+
 #ifdef CONFIG_SMP
 /*
  * Mapping between linux logical cpu index and hartid.
@@ -40,6 +45,12 @@ void arch_send_call_function_single_ipi(int cpu);
 int riscv_hartid_to_cpuid(int hartid);
 void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out);
 
+/* Set custom IPI operations */
+void riscv_set_ipi_ops(struct riscv_ipi_ops *ops);
+
+/* Clear IPI for current CPU */
+void riscv_clear_ipi(void);
+
 /* Secondary hart entry */
 asmlinkage void smp_callin(void);
 
@@ -81,6 +92,14 @@ static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in,
        cpumask_set_cpu(boot_cpu_hartid, out);
 }
 
+static inline void riscv_set_ipi_ops(struct riscv_ipi_ops *ops)
+{
+}
+
+static inline void riscv_clear_ipi(void)
+{
+}
+
 #endif /* CONFIG_SMP */
 
 #if defined(CONFIG_HOTPLUG_CPU) && (CONFIG_SMP)
index bad2a7c..a3fb85d 100644 (file)
@@ -7,41 +7,27 @@
 #define _ASM_RISCV_TIMEX_H
 
 #include <asm/csr.h>
-#include <asm/mmio.h>
 
 typedef unsigned long cycles_t;
 
-extern u64 __iomem *riscv_time_val;
-extern u64 __iomem *riscv_time_cmp;
-
-#ifdef CONFIG_64BIT
-#define mmio_get_cycles()      readq_relaxed(riscv_time_val)
-#else
-#define mmio_get_cycles()      readl_relaxed(riscv_time_val)
-#define mmio_get_cycles_hi()   readl_relaxed(((u32 *)riscv_time_val) + 1)
-#endif
-
 static inline cycles_t get_cycles(void)
 {
-       if (IS_ENABLED(CONFIG_RISCV_SBI))
-               return csr_read(CSR_TIME);
-       return mmio_get_cycles();
+       return csr_read(CSR_TIME);
 }
 #define get_cycles get_cycles
 
+static inline u32 get_cycles_hi(void)
+{
+       return csr_read(CSR_TIMEH);
+}
+#define get_cycles_hi get_cycles_hi
+
 #ifdef CONFIG_64BIT
 static inline u64 get_cycles64(void)
 {
        return get_cycles();
 }
 #else /* CONFIG_64BIT */
-static inline u32 get_cycles_hi(void)
-{
-       if (IS_ENABLED(CONFIG_RISCV_SBI))
-               return csr_read(CSR_TIMEH);
-       return mmio_get_cycles_hi();
-}
-
 static inline u64 get_cycles64(void)
 {
        u32 hi, lo;
index a5287ab..dc93710 100644 (file)
@@ -31,7 +31,7 @@ obj-y += cacheinfo.o
 obj-y  += patch.o
 obj-$(CONFIG_MMU) += vdso.o vdso/
 
-obj-$(CONFIG_RISCV_M_MODE)     += clint.o traps_misaligned.o
+obj-$(CONFIG_RISCV_M_MODE)     += traps_misaligned.o
 obj-$(CONFIG_FPU)              += fpu.o
 obj-$(CONFIG_SMP)              += smpboot.o
 obj-$(CONFIG_SMP)              += smp.o
diff --git a/arch/riscv/kernel/clint.c b/arch/riscv/kernel/clint.c
deleted file mode 100644 (file)
index 3647980..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2019 Christoph Hellwig.
- */
-
-#include <linux/io.h>
-#include <linux/of_address.h>
-#include <linux/types.h>
-#include <asm/clint.h>
-#include <asm/csr.h>
-#include <asm/timex.h>
-#include <asm/smp.h>
-
-/*
- * This is the layout used by the SiFive clint, which is also shared by the qemu
- * virt platform, and the Kendryte KD210 at least.
- */
-#define CLINT_IPI_OFF          0
-#define CLINT_TIME_CMP_OFF     0x4000
-#define CLINT_TIME_VAL_OFF     0xbff8
-
-u32 __iomem *clint_ipi_base;
-
-void clint_init_boot_cpu(void)
-{
-       struct device_node *np;
-       void __iomem *base;
-
-       np = of_find_compatible_node(NULL, NULL, "riscv,clint0");
-       if (!np) {
-               panic("clint not found");
-               return;
-       }
-
-       base = of_iomap(np, 0);
-       if (!base)
-               panic("could not map CLINT");
-
-       clint_ipi_base = base + CLINT_IPI_OFF;
-       riscv_time_cmp = base + CLINT_TIME_CMP_OFF;
-       riscv_time_val = base + CLINT_TIME_VAL_OFF;
-
-       clint_clear_ipi(boot_cpu_hartid);
-}
index f383ef5..226ccce 100644 (file)
@@ -547,6 +547,18 @@ static inline long sbi_get_firmware_version(void)
        return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
 }
 
+static void sbi_send_cpumask_ipi(const struct cpumask *target)
+{
+       struct cpumask hartid_mask;
+
+       riscv_cpuid_to_hartid_mask(target, &hartid_mask);
+
+       sbi_send_ipi(cpumask_bits(&hartid_mask));
+}
+
+static struct riscv_ipi_ops sbi_ipi_ops = {
+       .ipi_inject = sbi_send_cpumask_ipi
+};
 
 int __init sbi_init(void)
 {
@@ -587,5 +599,7 @@ int __init sbi_init(void)
                __sbi_rfence    = __sbi_rfence_v01;
        }
 
+       riscv_set_ipi_ops(&sbi_ipi_ops);
+
        return 0;
 }
index f04373b..2c6dd32 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/swiotlb.h>
 #include <linux/smp.h>
 
-#include <asm/clint.h>
 #include <asm/cpu_ops.h>
 #include <asm/setup.h>
 #include <asm/sections.h>
@@ -79,7 +78,6 @@ void __init setup_arch(char **cmdline_p)
 #else
        unflatten_device_tree();
 #endif
-       clint_init_boot_cpu();
 
 #ifdef CONFIG_SWIOTLB
        swiotlb_init(1);
index 17ba190..e996e08 100644 (file)
@@ -250,7 +250,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->a0 = -EINTR;
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                         regs->a0 = regs->orig_a0;
                        regs->epc -= 0x4;
index 554b0fb..ea028d9 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/delay.h>
 #include <linux/irq_work.h>
 
-#include <asm/clint.h>
 #include <asm/sbi.h>
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
@@ -86,9 +85,25 @@ static void ipi_stop(void)
                wait_for_interrupt();
 }
 
+static struct riscv_ipi_ops *ipi_ops;
+
+void riscv_set_ipi_ops(struct riscv_ipi_ops *ops)
+{
+       ipi_ops = ops;
+}
+EXPORT_SYMBOL_GPL(riscv_set_ipi_ops);
+
+void riscv_clear_ipi(void)
+{
+       if (ipi_ops && ipi_ops->ipi_clear)
+               ipi_ops->ipi_clear();
+
+       csr_clear(CSR_IP, IE_SIE);
+}
+EXPORT_SYMBOL_GPL(riscv_clear_ipi);
+
 static void send_ipi_mask(const struct cpumask *mask, enum ipi_message_type op)
 {
-       struct cpumask hartid_mask;
        int cpu;
 
        smp_mb__before_atomic();
@@ -96,33 +111,22 @@ static void send_ipi_mask(const struct cpumask *mask, enum ipi_message_type op)
                set_bit(op, &ipi_data[cpu].bits);
        smp_mb__after_atomic();
 
-       riscv_cpuid_to_hartid_mask(mask, &hartid_mask);
-       if (IS_ENABLED(CONFIG_RISCV_SBI))
-               sbi_send_ipi(cpumask_bits(&hartid_mask));
+       if (ipi_ops && ipi_ops->ipi_inject)
+               ipi_ops->ipi_inject(mask);
        else
-               clint_send_ipi_mask(mask);
+               pr_warn("SMP: IPI inject method not available\n");
 }
 
 static void send_ipi_single(int cpu, enum ipi_message_type op)
 {
-       int hartid = cpuid_to_hartid_map(cpu);
-
        smp_mb__before_atomic();
        set_bit(op, &ipi_data[cpu].bits);
        smp_mb__after_atomic();
 
-       if (IS_ENABLED(CONFIG_RISCV_SBI))
-               sbi_send_ipi(cpumask_bits(cpumask_of(hartid)));
-       else
-               clint_send_ipi_single(hartid);
-}
-
-static inline void clear_ipi(void)
-{
-       if (IS_ENABLED(CONFIG_RISCV_SBI))
-               csr_clear(CSR_IP, IE_SIE);
+       if (ipi_ops && ipi_ops->ipi_inject)
+               ipi_ops->ipi_inject(cpumask_of(cpu));
        else
-               clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id()));
+               pr_warn("SMP: IPI inject method not available\n");
 }
 
 #ifdef CONFIG_IRQ_WORK
@@ -140,7 +144,7 @@ void handle_IPI(struct pt_regs *regs)
 
        irq_enter();
 
-       clear_ipi();
+       riscv_clear_ipi();
 
        while (true) {
                unsigned long ops;
index 356825a..96167d5 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/of.h>
 #include <linux/sched/task_stack.h>
 #include <linux/sched/mm.h>
-#include <asm/clint.h>
 #include <asm/cpu_ops.h>
 #include <asm/irq.h>
 #include <asm/mmu_context.h>
@@ -147,8 +146,7 @@ asmlinkage __visible void smp_callin(void)
        struct mm_struct *mm = &init_mm;
        unsigned int curr_cpuid = smp_processor_id();
 
-       if (!IS_ENABLED(CONFIG_RISCV_SBI))
-               clint_clear_ipi(cpuid_to_hartid_map(smp_processor_id()));
+       riscv_clear_ipi();
 
        /* All kernel threads share the same mm context.  */
        mmgrab(mm);
index bc5f220..579575f 100644 (file)
@@ -1020,7 +1020,7 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx,
                        emit_zext64(dst, ctx);
                        break;
                }
-               /* Fallthrough. */
+               fallthrough;
 
        case BPF_ALU | BPF_ADD | BPF_X:
        case BPF_ALU | BPF_SUB | BPF_X:
@@ -1079,7 +1079,7 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx,
                case 16:
                        emit(rv_slli(lo(rd), lo(rd), 16), ctx);
                        emit(rv_srli(lo(rd), lo(rd), 16), ctx);
-                       /* Fallthrough. */
+                       fallthrough;
                case 32:
                        if (!ctx->prog->aux->verifier_zext)
                                emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx);
index 50b4ce8..918f0ba 100644 (file)
@@ -29,7 +29,7 @@
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ old__, new__, prev__;                                \
        pcp_op_T__ *ptr__;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        prev__ = *ptr__;                                                \
        do {                                                            \
@@ -37,7 +37,7 @@
                new__ = old__ op (val);                                 \
                prev__ = cmpxchg(ptr__, old__, new__);                  \
        } while (prev__ != old__);                                      \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        new__;                                                          \
 })
 
@@ -68,7 +68,7 @@
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                            \
        if (__builtin_constant_p(val__) &&                              \
            ((szcast)val__ > -129) && ((szcast)val__ < 128)) {          \
@@ -84,7 +84,7 @@
                        : [val__] "d" (val__)                           \
                        : "cc");                                        \
        }                                                               \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
 }
 
 #define this_cpu_add_4(pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int)
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        asm volatile(                                                   \
                op "    %[old__],%[val__],%[ptr__]\n"                   \
                : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__)           \
                : [val__] "d" (val__)                                   \
                : "cc");                                                \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                               \
        old__ + val__;                                                  \
 })
 
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        asm volatile(                                                   \
                op "    %[old__],%[val__],%[ptr__]\n"                   \
                : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__)           \
                : [val__] "d" (val__)                                   \
                : "cc");                                                \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
 }
 
 #define this_cpu_and_4(pcp, val)       arch_this_cpu_to_op(pcp, val, "lan")
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ ret__;                                               \
        pcp_op_T__ *ptr__;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        ret__ = cmpxchg(ptr__, oval, nval);                             \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        ret__;                                                          \
 })
 
 ({                                                                     \
        typeof(pcp) *ptr__;                                             \
        typeof(pcp) ret__;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        ret__ = xchg(ptr__, nval);                                      \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        ret__;                                                          \
 })
 
        typeof(pcp1) *p1__;                                             \
        typeof(pcp2) *p2__;                                             \
        int ret__;                                                      \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        p1__ = raw_cpu_ptr(&(pcp1));                                    \
        p2__ = raw_cpu_ptr(&(pcp2));                                    \
        ret__ = __cmpxchg_double(p1__, p2__, o1__, o2__, n1__, n2__);   \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        ret__;                                                          \
 })
 
index 88bb42c..c73f506 100644 (file)
@@ -33,14 +33,13 @@ void enabled_wait(void)
                PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
        clear_cpu_flag(CIF_NOHZ_DELAY);
 
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
        local_irq_save(flags);
        /* Call the assembler magic in entry.S */
        psw_idle(idle, psw_mask);
        local_irq_restore(flags);
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 
        /* Account time spent with enabled wait psw loaded as idle time. */
+       /* XXX seqcount has tracepoints that require RCU */
        write_seqcount_begin(&idle->seqcount);
        idle_time = idle->clock_idle_exit - idle->clock_idle_enter;
        idle->clock_idle_enter = idle->clock_idle_exit = 0ULL;
index 11d2f7d..a76dd27 100644 (file)
@@ -1268,7 +1268,6 @@ static bool is_ri_cb_valid(struct runtime_instr_cb *cb)
                cb->pc == 1 &&
                cb->qc == 0 &&
                cb->reserved2 == 0 &&
-               cb->key == PAGE_DEFAULT_KEY &&
                cb->reserved3 == 0 &&
                cb->reserved4 == 0 &&
                cb->reserved5 == 0 &&
@@ -1330,7 +1329,11 @@ static int s390_runtime_instr_set(struct task_struct *target,
                kfree(data);
                return -EINVAL;
        }
-
+       /*
+        * Override access key in any case, since user space should
+        * not be able to set it, nor should it care about it.
+        */
+       ri_cb.key = PAGE_DEFAULT_KEY >> 4;
        preempt_disable();
        if (!target->thread.ri_cb)
                target->thread.ri_cb = data;
index 125c7f6..1788a54 100644 (file)
@@ -57,7 +57,7 @@ static void init_runtime_instr_cb(struct runtime_instr_cb *cb)
        cb->k = 1;
        cb->ps = 1;
        cb->pc = 1;
-       cb->key = PAGE_DEFAULT_KEY;
+       cb->key = PAGE_DEFAULT_KEY >> 4;
        cb->v = 1;
 }
 
index 1aed1a4..eddf71c 100644 (file)
@@ -402,6 +402,7 @@ static int modify_p4d_table(pgd_t *pgd, unsigned long addr, unsigned long end,
                        pud = vmem_crst_alloc(_REGION3_ENTRY_EMPTY);
                        if (!pud)
                                goto out;
+                       p4d_populate(&init_mm, p4d, pud);
                }
                ret = modify_pud_table(p4d, addr, next, add, direct);
                if (ret)
index 3902c9f..4b62d6b 100644 (file)
@@ -672,6 +672,19 @@ int zpci_disable_device(struct zpci_dev *zdev)
 }
 EXPORT_SYMBOL_GPL(zpci_disable_device);
 
+void zpci_remove_device(struct zpci_dev *zdev)
+{
+       struct zpci_bus *zbus = zdev->zbus;
+       struct pci_dev *pdev;
+
+       pdev = pci_get_slot(zbus->bus, zdev->devfn);
+       if (pdev) {
+               if (pdev->is_virtfn)
+                       return zpci_remove_virtfn(pdev, zdev->vfn);
+               pci_stop_and_remove_bus_device_locked(pdev);
+       }
+}
+
 int zpci_create_device(struct zpci_dev *zdev)
 {
        int rc;
@@ -716,13 +729,8 @@ void zpci_release_device(struct kref *kref)
 {
        struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
 
-       if (zdev->zbus->bus) {
-               struct pci_dev *pdev;
-
-               pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
-               if (pdev)
-                       pci_stop_and_remove_bus_device_locked(pdev);
-       }
+       if (zdev->zbus->bus)
+               zpci_remove_device(zdev);
 
        switch (zdev->state) {
        case ZPCI_FN_STATE_ONLINE:
index 642a993..5967f30 100644 (file)
@@ -132,13 +132,14 @@ static int zpci_bus_link_virtfn(struct pci_dev *pdev,
 {
        int rc;
 
-       virtfn->physfn = pci_dev_get(pdev);
        rc = pci_iov_sysfs_link(pdev, virtfn, vfid);
-       if (rc) {
-               pci_dev_put(pdev);
-               virtfn->physfn = NULL;
+       if (rc)
                return rc;
-       }
+
+       virtfn->is_virtfn = 1;
+       virtfn->multifunction = 0;
+       virtfn->physfn = pci_dev_get(pdev);
+
        return 0;
 }
 
@@ -151,9 +152,9 @@ static int zpci_bus_setup_virtfn(struct zpci_bus *zbus,
        int vfid = vfn - 1; /* Linux' vfid's start at 0 vfn at 1*/
        int rc = 0;
 
-       virtfn->is_virtfn = 1;
-       virtfn->multifunction = 0;
-       WARN_ON(vfid < 0);
+       if (!zbus->multifunction)
+               return 0;
+
        /* If the parent PF for the given VF is also configured in the
         * instance, it must be on the same zbus.
         * We can then identify the parent PF by checking what
@@ -165,11 +166,17 @@ static int zpci_bus_setup_virtfn(struct zpci_bus *zbus,
                zdev = zbus->function[i];
                if (zdev && zdev->is_physfn) {
                        pdev = pci_get_slot(zbus->bus, zdev->devfn);
+                       if (!pdev)
+                               continue;
                        cand_devfn = pci_iov_virtfn_devfn(pdev, vfid);
                        if (cand_devfn == virtfn->devfn) {
                                rc = zpci_bus_link_virtfn(pdev, virtfn, vfid);
+                               /* balance pci_get_slot() */
+                               pci_dev_put(pdev);
                                break;
                        }
+                       /* balance pci_get_slot() */
+                       pci_dev_put(pdev);
                }
        }
        return rc;
@@ -178,12 +185,23 @@ static int zpci_bus_setup_virtfn(struct zpci_bus *zbus,
 static inline int zpci_bus_setup_virtfn(struct zpci_bus *zbus,
                struct pci_dev *virtfn, int vfn)
 {
-       virtfn->is_virtfn = 1;
-       virtfn->multifunction = 0;
        return 0;
 }
 #endif
 
+void pcibios_bus_add_device(struct pci_dev *pdev)
+{
+       struct zpci_dev *zdev = to_zpci(pdev);
+
+       /*
+        * With pdev->no_vf_scan the common PCI probing code does not
+        * perform PF/VF linking.
+        */
+       if (zdev->vfn)
+               zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
+
+}
+
 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
 {
        struct pci_bus *bus;
@@ -214,20 +232,10 @@ static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
        }
 
        pdev = pci_scan_single_device(bus, zdev->devfn);
-       if (pdev) {
-               if (!zdev->is_physfn) {
-                       rc = zpci_bus_setup_virtfn(zbus, pdev, zdev->vfn);
-                       if (rc)
-                               goto failed_with_pdev;
-               }
+       if (pdev)
                pci_bus_add_device(pdev);
-       }
-       return 0;
 
-failed_with_pdev:
-       pci_stop_and_remove_bus_device(pdev);
-       pci_dev_put(pdev);
-       return rc;
+       return 0;
 }
 
 static void zpci_bus_add_devices(struct zpci_bus *zbus)
index 89be3c3..4972433 100644 (file)
@@ -29,3 +29,16 @@ static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus,
 
        return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
 }
+
+#ifdef CONFIG_PCI_IOV
+static inline void zpci_remove_virtfn(struct pci_dev *pdev, int vfn)
+{
+
+       pci_lock_rescan_remove();
+       /* Linux' vfid's start at 0 vfn at 1 */
+       pci_iov_remove_virtfn(pdev->physfn, vfn - 1);
+       pci_unlock_rescan_remove();
+}
+#else /* CONFIG_PCI_IOV */
+static inline void zpci_remove_virtfn(struct pci_dev *pdev, int vfn) {}
+#endif /* CONFIG_PCI_IOV */
index fdebd28..9a3a291 100644 (file)
@@ -92,6 +92,9 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                        ret = clp_add_pci_device(ccdf->fid, ccdf->fh, 1);
                        break;
                }
+               /* the configuration request may be stale */
+               if (zdev->state != ZPCI_FN_STATE_STANDBY)
+                       break;
                zdev->fh = ccdf->fh;
                zdev->state = ZPCI_FN_STATE_CONFIGURED;
                ret = zpci_enable_device(zdev);
@@ -118,7 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                if (!zdev)
                        break;
                if (pdev)
-                       pci_stop_and_remove_bus_device_locked(pdev);
+                       zpci_remove_device(zdev);
 
                ret = zpci_disable_device(zdev);
                if (ret)
@@ -137,7 +140,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                        /* Give the driver a hint that the function is
                         * already unusable. */
                        pdev->error_state = pci_channel_io_perm_failure;
-                       pci_stop_and_remove_bus_device_locked(pdev);
+                       zpci_remove_device(zdev);
                }
 
                zdev->state = ZPCI_FN_STATE_STANDBY;
index f3dc3f2..143747c 100644 (file)
@@ -246,7 +246,7 @@ static int __init sh_early_platform_driver_probe_id(char *class_str,
                case EARLY_PLATFORM_ID_ERROR:
                        pr_warn("%s: unable to parse %s parameter\n",
                                class_str, epdrv->pdrv->driver.name);
-                       /* fall-through */
+                       fallthrough;
                case EARLY_PLATFORM_ID_UNSET:
                        match = NULL;
                        break;
index 08e1af6..34e25a4 100644 (file)
@@ -486,7 +486,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
                                        pr_cont("xd%d", rn & ~1);
                                        break;
                                }
-                               /* else, fall through */
+                               fallthrough;
                        case D_REG_N:
                                pr_cont("dr%d", rn);
                                break;
@@ -495,7 +495,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
                                        pr_cont("xd%d", rm & ~1);
                                        break;
                                }
-                               /* else, fall through */
+                               fallthrough;
                        case D_REG_M:
                                pr_cont("dr%d", rm);
                                break;
index 0d5f3c9..e4147ef 100644 (file)
@@ -266,7 +266,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                ptr = &remcomInBuffer[1];
                if (kgdb_hex2long(&ptr, &addr))
                        linux_regs->pc = addr;
-               /* fallthrough */
+               fallthrough;
        case 'D':
        case 'k':
                atomic_set(&kgdb_cpu_doing_single_step, -1);
index a0fbb84..4fe3f00 100644 (file)
@@ -418,7 +418,7 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
                case -ERESTARTSYS:
                        if (!(sa->sa_flags & SA_RESTART))
                                goto no_system_call_restart;
-               /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->regs[0] = save_r0;
                        regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
index 4843f48..774a82b 100644 (file)
@@ -87,7 +87,6 @@ void auxio_set_lte(int on)
                __auxio_sbus_set_lte(on);
                break;
        case AUXIO_TYPE_EBUS:
-               /* FALL-THROUGH */
        default:
                break;
        }
index bfae98a..23f8838 100644 (file)
@@ -55,7 +55,7 @@ static int clock_board_calc_nslots(struct clock_board *p)
                        else
                                return 5;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                return 4;
        }
index 7580775..58ad3f7 100644 (file)
@@ -122,7 +122,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                        linux_regs->pc = addr;
                        linux_regs->npc = addr + 4;
                }
-               /* fall through */
+               fallthrough;
 
        case 'D':
        case 'k':
index 5d6c2d2..177746a 100644 (file)
@@ -148,7 +148,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                        linux_regs->tpc = addr;
                        linux_regs->tnpc = addr + 4;
                }
-               /* fall through */
+               fallthrough;
 
        case 'D':
        case 'k':
index c0886b4..2a12c86 100644 (file)
@@ -359,7 +359,7 @@ int __init pcr_arch_init(void)
                 * counter overflow interrupt so we can't make use of
                 * their hardware currently.
                 */
-               /* fallthrough */
+               fallthrough;
        default:
                err = -ENODEV;
                goto out_unregister;
index da89022..3df960c 100644 (file)
@@ -224,7 +224,7 @@ void __init of_console_init(void)
 
                case PROMDEV_TTYB:
                        skip = 1;
-                       /* FALLTHRU */
+                       fallthrough;
 
                case PROMDEV_TTYA:
                        type = "serial";
index e2c6f0a..e9695a0 100644 (file)
@@ -646,7 +646,7 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
        case ERESTARTSYS:
                if (!(sa->sa_flags & SA_RESTART))
                        goto no_system_call_restart;
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->u_regs[UREG_I0] = orig_i0;
                regs->tpc -= 4;
@@ -686,7 +686,7 @@ void do_signal32(struct pt_regs * regs)
                                regs->tpc -= 4;
                                regs->tnpc -= 4;
                                pt_regs_clear_syscall(regs);
-                               /* fall through */
+                               fallthrough;
                        case ERESTART_RESTARTBLOCK:
                                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                                regs->tpc -= 4;
index f1f8c8e..d0e0025 100644 (file)
@@ -440,7 +440,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
        case ERESTARTSYS:
                if (!(sa->sa_flags & SA_RESTART))
                        goto no_system_call_restart;
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->u_regs[UREG_I0] = orig_i0;
                regs->pc -= 4;
@@ -506,7 +506,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
                                regs->pc -= 4;
                                regs->npc -= 4;
                                pt_regs_clear_syscall(regs);
-                               /* fall through */
+                               fallthrough;
                        case ERESTART_RESTARTBLOCK:
                                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                                regs->pc -= 4;
index 6937339..255264b 100644 (file)
@@ -461,7 +461,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
        case ERESTARTSYS:
                if (!(sa->sa_flags & SA_RESTART))
                        goto no_system_call_restart;
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->u_regs[UREG_I0] = orig_i0;
                regs->tpc -= 4;
@@ -532,7 +532,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
                                regs->tpc -= 4;
                                regs->tnpc -= 4;
                                pt_regs_clear_syscall(regs);
-                               /* fall through */
+                               fallthrough;
                        case ERESTART_RESTARTBLOCK:
                                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                                regs->tpc -= 4;
index 72e560e..d5beec8 100644 (file)
@@ -359,7 +359,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
                        *pfsr |= (6 << 14);
                        return 0;                       /* simulate invalid_fp_register exception */
                }
-       /* fall through */
+               fallthrough;
        case 2:
                if (freg & 1) {                         /* doublewords must have bit 5 zeroed */
                        *pfsr |= (6 << 14);
@@ -380,7 +380,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
                        *pfsr |= (6 << 14);
                        return 0;                       /* simulate invalid_fp_register exception */
                }
-       /* fall through */
+               fallthrough;
        case 2:
                if (freg & 1) {                         /* doublewords must have bit 5 zeroed */
                        *pfsr |= (6 << 14);
@@ -408,13 +408,13 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
                        *pfsr |= (6 << 14);
                        return 0;                       /* simulate invalid_fp_register exception */
                }
-       /* fall through */
+               fallthrough;
        case 2:
                if (freg & 1) {                         /* doublewords must have bit 5 zeroed */
                        *pfsr |= (6 << 14);
                        return 0;
                }
-       /* fall through */
+               fallthrough;
        case 1:
                rd = (void *)&fregs[freg];
                break;
index c8eabb9..b1dbf2f 100644 (file)
@@ -491,7 +491,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
                                } else {
                                        emit_loadimm(K, r_A);
                                }
-                               /* Fallthrough */
+                               fallthrough;
                        case BPF_RET | BPF_A:
                                if (seen_or_pass0) {
                                        if (i != flen - 1) {
index 3d57c71..88cd9b5 100644 (file)
@@ -70,7 +70,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                PT_REGS_SYSCALL_RET(regs) = -EINTR;
                                break;
                        }
-               /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        PT_REGS_RESTART_SYSCALL(regs);
                        PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs);
index 4ff0117..21d56ae 100644 (file)
@@ -54,7 +54,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b
                        /* else */
                        state = st_wordcmp;
                        opptr = option;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if (c == '=' && !*opptr) {
@@ -129,7 +129,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, const char *option)
                        state = st_wordcmp;
                        opptr = option;
                        wstart = pos;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if (!*opptr)
index 0048269..dde7cb3 100644 (file)
@@ -178,7 +178,7 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size,
                        }
                        *size = 0;
                }
-               /* Fall through */
+               fallthrough;
        default:
                /*
                 * If w/o offset, only size specified, memmap=nn[KMG] has the
index 39e592d..e478e40 100644 (file)
 #define STATIC         static
 
 /*
- * Use normal definitions of mem*() from string.c. There are already
- * included header files which expect a definition of memset() and by
- * the time we define memset macro, it is too late.
+ * Provide definitions of memzero and memmove as some of the decompressors will
+ * try to define their own functions if these are not defined as macros.
  */
-#undef memcpy
-#undef memset
 #define memzero(s, n)  memset((s), 0, (n))
 #define memmove                memmove
 
index 995f7b7..a232da4 100644 (file)
@@ -11,10 +11,7 @@ void *memcpy(void *dst, const void *src, size_t len);
 void *memset(void *dst, int c, size_t len);
 int memcmp(const void *s1, const void *s2, size_t len);
 
-/*
- * Access builtin version by default. If one needs to use optimized version,
- * do "undef memcpy" in .c file and link against right string.c
- */
+/* Access builtin version by default. */
 #define memcpy(d,s,l) __builtin_memcpy(d,s,l)
 #define memset(d,c,l) __builtin_memset(d,c,l)
 #define memcmp __builtin_memcmp
index 98e4d88..ae9b0d4 100644 (file)
@@ -374,12 +374,14 @@ For 32-bit we have the following conventions - kernel is built with
  * Fetch the per-CPU GSBASE value for this processor and put it in @reg.
  * We normally use %gs for accessing per-CPU data, but we are setting up
  * %gs here and obviously can not use %gs itself to access per-CPU data.
+ *
+ * Do not use RDPID, because KVM loads guest's TSC_AUX on vm-entry and
+ * may not restore the host's value until the CPU returns to userspace.
+ * Thus the kernel would consume a guest's TSC_AUX if an NMI arrives
+ * while running KVM's run loop.
  */
 .macro GET_PERCPU_BASE reg:req
-       ALTERNATIVE \
-               "LOAD_CPU_AND_NODE_SEG_LIMIT \reg", \
-               "RDPID  \reg", \
-               X86_FEATURE_RDPID
+       LOAD_CPU_AND_NODE_SEG_LIMIT \reg
        andq    $VDSO_CPUNODE_MASK, \reg
        movq    __per_cpu_offset(, \reg, 8), \reg
 .endm
index 3a07ce3..f1f96d4 100644 (file)
@@ -29,11 +29,6 @@ SYM_CODE_START_NOALIGN(\name)
 SYM_CODE_END(\name)
        .endm
 
-#ifdef CONFIG_TRACE_IRQFLAGS
-       THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
-       THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
-#endif
-
 #ifdef CONFIG_PREEMPTION
        THUNK preempt_schedule_thunk, preempt_schedule
        THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
index 5096347..31e6887 100644 (file)
@@ -4682,7 +4682,7 @@ __init int intel_pmu_init(void)
 
        case INTEL_FAM6_CORE2_MEROM:
                x86_add_quirk(intel_clovertown_quirk);
-               /* fall through */
+               fallthrough;
 
        case INTEL_FAM6_CORE2_MEROM_L:
        case INTEL_FAM6_CORE2_PENRYN:
@@ -5062,7 +5062,7 @@ __init int intel_pmu_init(void)
 
        case INTEL_FAM6_SKYLAKE_X:
                pmem = true;
-               /* fall through */
+               fallthrough;
        case INTEL_FAM6_SKYLAKE_L:
        case INTEL_FAM6_SKYLAKE:
        case INTEL_FAM6_KABYLAKE_L:
@@ -5114,7 +5114,7 @@ __init int intel_pmu_init(void)
        case INTEL_FAM6_ICELAKE_X:
        case INTEL_FAM6_ICELAKE_D:
                pmem = true;
-               /* fall through */
+               fallthrough;
        case INTEL_FAM6_ICELAKE_L:
        case INTEL_FAM6_ICELAKE:
        case INTEL_FAM6_TIGERLAKE_L:
index 63f58bd..8961653 100644 (file)
@@ -1268,7 +1268,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
                        ret = X86_BR_ZERO_CALL;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 0x9a: /* call far absolute */
                ret = X86_BR_CALL;
                break;
index cb94ba8..6a4ca27 100644 (file)
@@ -390,6 +390,18 @@ static struct uncore_event_desc snb_uncore_imc_events[] = {
        INTEL_UNCORE_EVENT_DESC(data_writes.scale, "6.103515625e-5"),
        INTEL_UNCORE_EVENT_DESC(data_writes.unit, "MiB"),
 
+       INTEL_UNCORE_EVENT_DESC(gt_requests, "event=0x03"),
+       INTEL_UNCORE_EVENT_DESC(gt_requests.scale, "6.103515625e-5"),
+       INTEL_UNCORE_EVENT_DESC(gt_requests.unit, "MiB"),
+
+       INTEL_UNCORE_EVENT_DESC(ia_requests, "event=0x04"),
+       INTEL_UNCORE_EVENT_DESC(ia_requests.scale, "6.103515625e-5"),
+       INTEL_UNCORE_EVENT_DESC(ia_requests.unit, "MiB"),
+
+       INTEL_UNCORE_EVENT_DESC(io_requests, "event=0x05"),
+       INTEL_UNCORE_EVENT_DESC(io_requests.scale, "6.103515625e-5"),
+       INTEL_UNCORE_EVENT_DESC(io_requests.unit, "MiB"),
+
        { /* end: all zeroes */ },
 };
 
@@ -405,13 +417,35 @@ static struct uncore_event_desc snb_uncore_imc_events[] = {
 #define SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE    0x5054
 #define SNB_UNCORE_PCI_IMC_CTR_BASE            SNB_UNCORE_PCI_IMC_DATA_READS_BASE
 
+/* BW break down- legacy counters */
+#define SNB_UNCORE_PCI_IMC_GT_REQUESTS         0x3
+#define SNB_UNCORE_PCI_IMC_GT_REQUESTS_BASE    0x5040
+#define SNB_UNCORE_PCI_IMC_IA_REQUESTS         0x4
+#define SNB_UNCORE_PCI_IMC_IA_REQUESTS_BASE    0x5044
+#define SNB_UNCORE_PCI_IMC_IO_REQUESTS         0x5
+#define SNB_UNCORE_PCI_IMC_IO_REQUESTS_BASE    0x5048
+
 enum perf_snb_uncore_imc_freerunning_types {
-       SNB_PCI_UNCORE_IMC_DATA         = 0,
+       SNB_PCI_UNCORE_IMC_DATA_READS           = 0,
+       SNB_PCI_UNCORE_IMC_DATA_WRITES,
+       SNB_PCI_UNCORE_IMC_GT_REQUESTS,
+       SNB_PCI_UNCORE_IMC_IA_REQUESTS,
+       SNB_PCI_UNCORE_IMC_IO_REQUESTS,
+
        SNB_PCI_UNCORE_IMC_FREERUNNING_TYPE_MAX,
 };
 
 static struct freerunning_counters snb_uncore_imc_freerunning[] = {
-       [SNB_PCI_UNCORE_IMC_DATA]     = { SNB_UNCORE_PCI_IMC_DATA_READS_BASE, 0x4, 0x0, 2, 32 },
+       [SNB_PCI_UNCORE_IMC_DATA_READS]         = { SNB_UNCORE_PCI_IMC_DATA_READS_BASE,
+                                                       0x0, 0x0, 1, 32 },
+       [SNB_PCI_UNCORE_IMC_DATA_READS]         = { SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE,
+                                                       0x0, 0x0, 1, 32 },
+       [SNB_PCI_UNCORE_IMC_GT_REQUESTS]        = { SNB_UNCORE_PCI_IMC_GT_REQUESTS_BASE,
+                                                       0x0, 0x0, 1, 32 },
+       [SNB_PCI_UNCORE_IMC_IA_REQUESTS]        = { SNB_UNCORE_PCI_IMC_IA_REQUESTS_BASE,
+                                                       0x0, 0x0, 1, 32 },
+       [SNB_PCI_UNCORE_IMC_IO_REQUESTS]        = { SNB_UNCORE_PCI_IMC_IO_REQUESTS_BASE,
+                                                       0x0, 0x0, 1, 32 },
 };
 
 static struct attribute *snb_uncore_imc_formats_attr[] = {
@@ -525,6 +559,18 @@ static int snb_uncore_imc_event_init(struct perf_event *event)
                base = SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE;
                idx = UNCORE_PMC_IDX_FREERUNNING;
                break;
+       case SNB_UNCORE_PCI_IMC_GT_REQUESTS:
+               base = SNB_UNCORE_PCI_IMC_GT_REQUESTS_BASE;
+               idx = UNCORE_PMC_IDX_FREERUNNING;
+               break;
+       case SNB_UNCORE_PCI_IMC_IA_REQUESTS:
+               base = SNB_UNCORE_PCI_IMC_IA_REQUESTS_BASE;
+               idx = UNCORE_PMC_IDX_FREERUNNING;
+               break;
+       case SNB_UNCORE_PCI_IMC_IO_REQUESTS:
+               base = SNB_UNCORE_PCI_IMC_IO_REQUESTS_BASE;
+               idx = UNCORE_PMC_IDX_FREERUNNING;
+               break;
        default:
                return -EINVAL;
        }
@@ -598,7 +644,7 @@ static struct intel_uncore_ops snb_uncore_imc_ops = {
 
 static struct intel_uncore_type snb_uncore_imc = {
        .name           = "imc",
-       .num_counters   = 2,
+       .num_counters   = 5,
        .num_boxes      = 1,
        .num_freerunning_types  = SNB_PCI_UNCORE_IMC_FREERUNNING_TYPE_MAX,
        .mmio_map_size  = SNB_UNCORE_PCI_IMC_MAP_SIZE,
index b9c2667..bc9758e 100644 (file)
@@ -81,11 +81,8 @@ extern unsigned long efi_fw_vendor, efi_config_table;
        kernel_fpu_end();                                               \
 })
 
-
 #define arch_efi_call_virt(p, f, args...)      p->f(args)
 
-#define efi_ioremap(addr, size, type, attr)    ioremap_cache(addr, size)
-
 #else /* !CONFIG_X86_32 */
 
 #define EFI_LOADER_SIGNATURE   "EL64"
@@ -125,9 +122,6 @@ struct efi_scratch {
        kernel_fpu_end();                                               \
 })
 
-extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,
-                                       u32 type, u64 attribute);
-
 #ifdef CONFIG_KASAN
 /*
  * CONFIG_KASAN may redefine memset to __memset.  __memset function is present
@@ -143,17 +137,13 @@ extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,
 #endif /* CONFIG_X86_32 */
 
 extern struct efi_scratch efi_scratch;
-extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable);
 extern int __init efi_memblock_x86_reserve_range(void);
 extern void __init efi_print_memmap(void);
-extern void __init efi_memory_uc(u64 addr, unsigned long size);
 extern void __init efi_map_region(efi_memory_desc_t *md);
 extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
 extern void efi_sync_low_kernel_mappings(void);
 extern int __init efi_alloc_page_tables(void);
 extern int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages);
-extern void __init old_map_region(efi_memory_desc_t *md);
-extern void __init runtime_code_page_mkexec(void);
 extern void __init efi_runtime_update_mappings(void);
 extern void __init efi_dump_pagetable(void);
 extern void __init efi_apply_memmap_quirks(void);
index 5ab3af7..5303dbc 100644 (file)
@@ -1596,7 +1596,8 @@ asmlinkage void kvm_spurious_fault(void);
        _ASM_EXTABLE(666b, 667b)
 
 #define KVM_ARCH_WANT_MMU_NOTIFIER
-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end);
+int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
+                       unsigned flags);
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
index 0a301ad..9257667 100644 (file)
@@ -59,5 +59,6 @@ typedef struct {
        }
 
 void leave_mm(int cpu);
+#define leave_mm leave_mm
 
 #endif /* _ASM_X86_MMU_H */
index c3daf0a..cdaab30 100644 (file)
@@ -239,7 +239,7 @@ void __init arch_init_ideal_nops(void)
                        return;
                }
 
-               /* fall through */
+               fallthrough;
 
        default:
 #ifdef CONFIG_X86_64
index 21325a4..779a89e 100644 (file)
@@ -800,7 +800,7 @@ static int irq_polarity(int idx)
                return IOAPIC_POL_HIGH;
        case MP_IRQPOL_RESERVED:
                pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n");
-               /* fall through */
+               fallthrough;
        case MP_IRQPOL_ACTIVE_LOW:
        default: /* Pointless default required due to do gcc stupidity */
                return IOAPIC_POL_LOW;
@@ -848,7 +848,7 @@ static int irq_trigger(int idx)
                return IOAPIC_EDGE;
        case MP_IRQTRIG_RESERVED:
                pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n");
-               /* fall through */
+               fallthrough;
        case MP_IRQTRIG_LEVEL:
        default: /* Pointless default required due to do gcc stupidity */
                return IOAPIC_LEVEL;
index 7bda71d..99ee61c 100644 (file)
@@ -149,7 +149,7 @@ void __init default_setup_apic_routing(void)
                                break;
                        }
                        /* P4 and above */
-                       /* fall through */
+                       fallthrough;
                case X86_VENDOR_HYGON:
                case X86_VENDOR_AMD:
                        def_to_bigsmp = 1;
index dae32d9..f8a56b5 100644 (file)
@@ -161,6 +161,7 @@ static void apic_update_vector(struct irq_data *irqd, unsigned int newvec,
                apicd->move_in_progress = true;
                apicd->prev_vector = apicd->vector;
                apicd->prev_cpu = apicd->cpu;
+               WARN_ON_ONCE(apicd->cpu == newcpu);
        } else {
                irq_matrix_free(vector_matrix, apicd->cpu, apicd->vector,
                                managed);
@@ -910,7 +911,7 @@ void send_cleanup_vector(struct irq_cfg *cfg)
                __send_cleanup_vector(apicd);
 }
 
-static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector)
+void irq_complete_move(struct irq_cfg *cfg)
 {
        struct apic_chip_data *apicd;
 
@@ -918,15 +919,16 @@ static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector)
        if (likely(!apicd->move_in_progress))
                return;
 
-       if (vector == apicd->vector && apicd->cpu == smp_processor_id())
+       /*
+        * If the interrupt arrived on the new target CPU, cleanup the
+        * vector on the old target CPU. A vector check is not required
+        * because an interrupt can never move from one vector to another
+        * on the same CPU.
+        */
+       if (apicd->cpu == smp_processor_id())
                __send_cleanup_vector(apicd);
 }
 
-void irq_complete_move(struct irq_cfg *cfg)
-{
-       __irq_complete_move(cfg, ~get_irq_regs()->orig_ax);
-}
-
 /*
  * Called from fixup_irqs() with @desc->lock held and interrupts disabled.
  */
index c7503be..57074cf 100644 (file)
@@ -248,7 +248,7 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
        switch (leaf) {
        case 1:
                l1 = &l1i;
-               /* fall through */
+               fallthrough;
        case 0:
                if (!l1->val)
                        return;
index 7843ab3..3a44346 100644 (file)
@@ -199,7 +199,7 @@ static int raise_local(void)
                         * calling irq_enter, but the necessary
                         * machinery isn't exported currently.
                         */
-                       /*FALL THROUGH*/
+                       fallthrough;
                case MCJ_CTX_PROCESS:
                        raise_exception(m, NULL);
                        break;
index d8f9230..abe9fe0 100644 (file)
@@ -193,7 +193,7 @@ unsigned long cmci_intel_adjust_timer(unsigned long interval)
                if (!atomic_sub_return(1, &cmci_storm_on_cpus))
                        pr_notice("CMCI storm subsided: switching to interrupt mode\n");
 
-               /* FALLTHROUGH */
+               fallthrough;
 
        case CMCI_STORM_SUBSIDED:
                /*
index 7218280..ca67091 100644 (file)
@@ -98,7 +98,7 @@ cyrix_get_free_region(unsigned long base, unsigned long size, int replace_reg)
        case 7:
                if (size < 0x40)
                        break;
-               /* Else, fall through */
+               fallthrough;
        case 6:
        case 5:
        case 4:
index 8cdf29f..b98ff62 100644 (file)
@@ -349,7 +349,7 @@ static int arch_build_bp_info(struct perf_event *bp,
                        hw->len = X86_BREAKPOINT_LEN_X;
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 68acd30..c2f02f3 100644 (file)
@@ -450,7 +450,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                ptr = &remcomInBuffer[1];
                if (kgdb_hex2long(&ptr, &addr))
                        linux_regs->ip = addr;
-               /* fall through */
+               fallthrough;
        case 'D':
        case 'k':
                /* clear the trace bit */
@@ -539,7 +539,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
                         * a system call which should be ignored
                         */
                        return NOTIFY_DONE;
-               /* fall through */
+               fallthrough;
        default:
                if (user_mode(regs))
                        return NOTIFY_DONE;
index 411af4a..baa2109 100644 (file)
@@ -312,7 +312,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
                case 2:
                        if (i == 0 || i == 13)
                                continue;       /* IRQ0 & IRQ13 not connected */
-                       /* fall through */
+                       fallthrough;
                default:
                        if (i == 2)
                                continue;       /* IRQ2 is never connected */
@@ -356,7 +356,7 @@ static void __init construct_ioapic_table(int mpc_default_type)
        default:
                pr_err("???\nUnknown standard configuration %d\n",
                       mpc_default_type);
-               /* fall through */
+               fallthrough;
        case 1:
        case 5:
                memcpy(bus.bustype, "ISA   ", 6);
index 994d839..13ce616 100644 (file)
@@ -684,9 +684,7 @@ void arch_cpu_idle(void)
  */
 void __cpuidle default_idle(void)
 {
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
        safe_halt();
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 #if defined(CONFIG_APM_MODULE) || defined(CONFIG_HALTPOLL_CPUIDLE_MODULE)
 EXPORT_SYMBOL(default_idle);
@@ -792,7 +790,6 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
 static __cpuidle void mwait_idle(void)
 {
        if (!current_set_polling_and_test()) {
-               trace_cpu_idle_rcuidle(1, smp_processor_id());
                if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
                        mb(); /* quirk */
                        clflush((void *)&current_thread_info()->flags);
@@ -804,7 +801,6 @@ static __cpuidle void mwait_idle(void)
                        __sti_mwait(0, 0);
                else
                        local_irq_enable();
-               trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
        } else {
                local_irq_enable();
        }
index 5679aa3..e7537c5 100644 (file)
@@ -204,7 +204,7 @@ static int set_segment_reg(struct task_struct *task,
        case offsetof(struct user_regs_struct, ss):
                if (unlikely(value == 0))
                        return -EIO;
-               /* Else, fall through */
+               fallthrough;
 
        default:
                *pt_regs_access(task_pt_regs(task), offset) = value;
index 0ec7ced..a515e2d 100644 (file)
@@ -654,7 +654,7 @@ static void native_machine_emergency_restart(void)
 
                case BOOT_CF9_FORCE:
                        port_cf9_safe = true;
-                       /* Fall through */
+                       fallthrough;
 
                case BOOT_CF9_SAFE:
                        if (port_cf9_safe) {
index d5fa494..be0d7d4 100644 (file)
@@ -726,7 +726,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->ax = -EINTR;
                                break;
                        }
-               /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->ax = regs->orig_ax;
                        regs->ip -= 2;
index 27aa04a..f5ef689 100644 (file)
@@ -1594,14 +1594,28 @@ int native_cpu_disable(void)
        if (ret)
                return ret;
 
-       /*
-        * Disable the local APIC. Otherwise IPI broadcasts will reach
-        * it. It still responds normally to INIT, NMI, SMI, and SIPI
-        * messages.
-        */
-       apic_soft_disable();
        cpu_disable_common();
 
+        /*
+         * Disable the local APIC. Otherwise IPI broadcasts will reach
+         * it. It still responds normally to INIT, NMI, SMI, and SIPI
+         * messages.
+         *
+         * Disabling the APIC must happen after cpu_disable_common()
+         * which invokes fixup_irqs().
+         *
+         * Disabling the APIC preserves already set bits in IRR, but
+         * an interrupt arriving after disabling the local APIC does not
+         * set the corresponding IRR bit.
+         *
+         * fixup_irqs() scans IRR for set bits so it can raise a not
+         * yet handled interrupt on the new destination CPU via an IPI
+         * but obviously it can't do so for IRR bits which are not set.
+         * IOW, interrupts arriving after disabling the local APIC will
+         * be lost.
+         */
+       apic_soft_disable();
+
        return 0;
 }
 
index 15e5aad..3fdaa04 100644 (file)
@@ -735,7 +735,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
                 * OPCODE1() of the "short" jmp which checks the same condition.
                 */
                opc1 = OPCODE2(insn) - 0x10;
-               /* fall through */
+               fallthrough;
        default:
                if (!is_cond_jmp_opcode(opc1))
                        return -ENOSYS;
@@ -892,7 +892,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
                        fix_ip_or_call = 0;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                riprel_analyze(auprobe, &insn);
        }
index d0e2825..5299ef5 100644 (file)
@@ -3016,7 +3016,7 @@ static void string_registers_quirk(struct x86_emulate_ctxt *ctxt)
        case 0xa4:      /* movsb */
        case 0xa5:      /* movsd/w */
                *reg_rmw(ctxt, VCPU_REGS_RSI) &= (u32)-1;
-               /* fall through */
+               fallthrough;
        case 0xaa:      /* stosb */
        case 0xab:      /* stosd/w */
                *reg_rmw(ctxt, VCPU_REGS_RDI) &= (u32)-1;
index 814d3ae..1d33056 100644 (file)
@@ -1779,7 +1779,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
                ret = kvm_hvcall_signal_event(vcpu, fast, ingpa);
                if (ret != HV_STATUS_INVALID_PORT_ID)
                        break;
-               /* fall through - maybe userspace knows this conn_id. */
+               fallthrough;    /* maybe userspace knows this conn_id */
        case HVCALL_POST_MESSAGE:
                /* don't bother userspace if it has no way to handle it */
                if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) {
index c47d2ac..4aa1c2e 100644 (file)
@@ -285,7 +285,7 @@ int kvm_set_routing_entry(struct kvm *kvm,
                switch (ue->u.irqchip.irqchip) {
                case KVM_IRQCHIP_PIC_SLAVE:
                        e->irqchip.pin += PIC_NUM_PINS / 2;
-                       /* fall through */
+                       fallthrough;
                case KVM_IRQCHIP_PIC_MASTER:
                        if (ue->u.irqchip.pin >= PIC_NUM_PINS / 2)
                                return -EINVAL;
index 5ccbee7..35cca2e 100644 (file)
@@ -1053,7 +1053,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
        switch (delivery_mode) {
        case APIC_DM_LOWEST:
                vcpu->arch.apic_arb_prio++;
-               /* fall through */
+               fallthrough;
        case APIC_DM_FIXED:
                if (unlikely(trig_mode && !level))
                        break;
@@ -1341,7 +1341,7 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset)
                break;
        case APIC_TASKPRI:
                report_tpr_access(apic, false);
-               /* fall thru */
+               fallthrough;
        default:
                val = kvm_lapic_get_reg(apic, offset);
                break;
@@ -2027,7 +2027,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
 
        case APIC_LVT0:
                apic_manage_nmi_watchdog(apic, val);
-               /* fall through */
+               fallthrough;
        case APIC_LVTTHMR:
        case APIC_LVTPC:
        case APIC_LVT1:
index 4e03841..43fdb0c 100644 (file)
@@ -1916,7 +1916,8 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
        return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler);
 }
 
-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
+int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
+                       unsigned flags)
 {
        return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
 }
@@ -4421,7 +4422,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
                        rsvd_bits(maxphyaddr, 51);
                rsvd_check->rsvd_bits_mask[1][4] =
                        rsvd_check->rsvd_bits_mask[0][4];
-               /* fall through */
+               fallthrough;
        case PT64_ROOT_4LEVEL:
                rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd |
                        nonleaf_bit8_rsvd | rsvd_bits(7, 7) |
index 03dd7ba..0194336 100644 (file)
@@ -2668,7 +2668,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
        case MSR_IA32_APICBASE:
                if (kvm_vcpu_apicv_active(vcpu))
                        avic_update_vapic_bar(to_svm(vcpu), data);
-               /* Fall through */
+               fallthrough;
        default:
                return kvm_set_msr_common(vcpu, msr);
        }
index 46ba2e0..819c185 100644 (file)
@@ -4654,7 +4654,7 @@ static bool rmode_exception(struct kvm_vcpu *vcpu, int vec)
                        vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
                if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP)
                        return false;
-               /* fall through */
+               fallthrough;
        case DB_VECTOR:
                return !(vcpu->guest_debug &
                        (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP));
@@ -4827,7 +4827,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
                }
                kvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1 | DR6_RTM;
                kvm_run->debug.arch.dr7 = vmcs_readl(GUEST_DR7);
-               /* fall through */
+               fallthrough;
        case BP_VECTOR:
                /*
                 * Update instruction length as we may reinject #BP from
@@ -5257,7 +5257,7 @@ static int handle_task_switch(struct kvm_vcpu *vcpu)
                                error_code =
                                        vmcs_read32(IDT_VECTORING_ERROR_CODE);
                        }
-                       /* fall through */
+                       fallthrough;
                case INTR_TYPE_SOFT_EXCEPTION:
                        kvm_clear_exception_queue(vcpu);
                        break;
@@ -5610,7 +5610,7 @@ static int handle_invpcid(struct kvm_vcpu *vcpu)
                 * keeping track of global entries in shadow page tables.
                 */
 
-               /* fall-through */
+               fallthrough;
        case INVPCID_TYPE_ALL_INCL_GLOBAL:
                kvm_mmu_unload(vcpu);
                return kvm_skip_emulated_instruction(vcpu);
@@ -6578,7 +6578,7 @@ static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu,
                break;
        case INTR_TYPE_SOFT_EXCEPTION:
                vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
-               /* fall through */
+               fallthrough;
        case INTR_TYPE_HARD_EXCEPTION:
                if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) {
                        u32 err = vmcs_read32(error_code_field);
@@ -6588,7 +6588,7 @@ static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu,
                break;
        case INTR_TYPE_SOFT_INTR:
                vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
-               /* fall through */
+               fallthrough;
        case INTR_TYPE_EXT_INTR:
                kvm_queue_interrupt(vcpu, vector, type == INTR_TYPE_SOFT_INTR);
                break;
index 599d732..d39d6cf 100644 (file)
@@ -975,7 +975,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 {
        unsigned long old_cr4 = kvm_read_cr4(vcpu);
        unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
-                                  X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE;
+                                  X86_CR4_SMEP;
 
        if (kvm_valid_cr4(vcpu, cr4))
                return 1;
@@ -1116,14 +1116,12 @@ static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
                        vcpu->arch.eff_db[dr] = val;
                break;
        case 4:
-               /* fall through */
        case 6:
                if (!kvm_dr6_valid(val))
                        return -1; /* #GP */
                vcpu->arch.dr6 = (val & DR6_VOLATILE) | kvm_dr6_fixed(vcpu);
                break;
        case 5:
-               /* fall through */
        default: /* 7 */
                if (!kvm_dr7_valid(val))
                        return -1; /* #GP */
@@ -1154,12 +1152,10 @@ int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val)
                *val = vcpu->arch.db[array_index_nospec(dr, size)];
                break;
        case 4:
-               /* fall through */
        case 6:
                *val = vcpu->arch.dr6;
                break;
        case 5:
-               /* fall through */
        default: /* 7 */
                *val = vcpu->arch.dr7;
                break;
@@ -3051,7 +3047,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 
        case MSR_K7_PERFCTR0 ... MSR_K7_PERFCTR3:
        case MSR_P6_PERFCTR0 ... MSR_P6_PERFCTR1:
-               pr = true; /* fall through */
+               pr = true;
+               fallthrough;
        case MSR_K7_EVNTSEL0 ... MSR_K7_EVNTSEL3:
        case MSR_P6_EVNTSEL0 ... MSR_P6_EVNTSEL1:
                if (kvm_pmu_is_valid_msr(vcpu, msr))
@@ -4359,7 +4356,7 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
        case KVM_CAP_HYPERV_SYNIC2:
                if (cap->args[0])
                        return -EINVAL;
-               /* fall through */
+               fallthrough;
 
        case KVM_CAP_HYPERV_SYNIC:
                if (!irqchip_in_kernel(vcpu->kvm))
@@ -8672,7 +8669,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu)
                vcpu->arch.pv.pv_unhalted = false;
                vcpu->arch.mp_state =
                        KVM_MP_STATE_RUNNABLE;
-               /* fall through */
+               fallthrough;
        case KVM_MP_STATE_RUNNABLE:
                vcpu->arch.apf.halted = false;
                break;
@@ -10751,9 +10748,11 @@ EXPORT_SYMBOL_GPL(kvm_spec_ctrl_test_value);
 void kvm_fixup_and_inject_pf_error(struct kvm_vcpu *vcpu, gva_t gva, u16 error_code)
 {
        struct x86_exception fault;
+       u32 access = error_code &
+               (PFERR_WRITE_MASK | PFERR_FETCH_MASK | PFERR_USER_MASK);
 
        if (!(error_code & PFERR_PRESENT_MASK) ||
-           vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, error_code, &fault) != UNMAPPED_GVA) {
+           vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, &fault) != UNMAPPED_GVA) {
                /*
                 * If vcpu->arch.walk_mmu->gva_to_gpa succeeded, the page
                 * tables probably do not match the TLB.  Just proceed
index 4f1719e..b6da093 100644 (file)
@@ -58,7 +58,7 @@ __cmdline_find_option_bool(const char *cmdline, int max_cmdline_size,
                        state = st_wordcmp;
                        opptr = option;
                        wstart = pos;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if (!*opptr) {
@@ -89,7 +89,7 @@ __cmdline_find_option_bool(const char *cmdline, int max_cmdline_size,
                                break;
                        }
                        state = st_wordskip;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordskip:
                        if (!c)
@@ -151,7 +151,7 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size,
 
                        state = st_wordcmp;
                        opptr = option;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if ((c == '=') && !*opptr) {
@@ -172,7 +172,7 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size,
                                break;
                        }
                        state = st_wordskip;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordskip:
                        if (myisspace(c))
index 31600d8..5e69603 100644 (file)
@@ -179,7 +179,7 @@ static int resolve_default_seg(struct insn *insn, struct pt_regs *regs, int off)
                if (insn->addr_bytes == 2)
                        return -EINVAL;
 
-               /* fall through */
+               fallthrough;
 
        case -EDOM:
        case offsetof(struct pt_regs, bx):
@@ -362,7 +362,6 @@ static short get_segment_selector(struct pt_regs *regs, int seg_reg_idx)
                case INAT_SEG_REG_GS:
                        return vm86regs->gs;
                case INAT_SEG_REG_IGNORE:
-                       /* fall through */
                default:
                        return -EINVAL;
                }
@@ -386,7 +385,6 @@ static short get_segment_selector(struct pt_regs *regs, int seg_reg_idx)
                 */
                return get_user_gs(regs);
        case INAT_SEG_REG_IGNORE:
-               /* fall through */
        default:
                return -EINVAL;
        }
@@ -786,7 +784,7 @@ int insn_get_code_seg_params(struct pt_regs *regs)
                 */
                return INSN_CODE_SEG_PARAMS(4, 8);
        case 3: /* Invalid setting. CS.L=1, CS.D=1 */
-               /* fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 73dc66d..ec071cb 100644 (file)
@@ -186,7 +186,7 @@ void FPU_printall(void)
                case TAG_Special:
                        /* Update tagi for the printk below */
                        tagi = FPU_Special(r);
-                       /* fall through */
+                       fallthrough;
                case TAG_Valid:
                        printk("st(%d)  %c .%04lx %04lx %04lx %04lx e%+-6d ", i,
                               getsign(r) ? '-' : '+',
index 127ea54..4a98878 100644 (file)
@@ -1352,7 +1352,7 @@ static void fyl2xp1(FPU_REG *st0_ptr, u_char st0_tag)
                case TW_Denormal:
                        if (denormal_operand() < 0)
                                return;
-                       /* fall through */
+                       fallthrough;
                case TAG_Zero:
                case TAG_Valid:
                        setsign(st0_ptr, getsign(st0_ptr) ^ getsign(st1_ptr));
index 84d85db..9e5ccc5 100644 (file)
@@ -574,7 +574,7 @@ static bool memremap_should_map_decrypted(resource_size_t phys_addr,
                /* For SEV, these areas are encrypted */
                if (sev_active())
                        break;
-               /* Fallthrough */
+               fallthrough;
 
        case E820_TYPE_PRAM:
                return true;
index 1a3569b..0951b47 100644 (file)
@@ -555,21 +555,12 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
                this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen);
                load_new_mm_cr3(next->pgd, new_asid, true);
 
-               /*
-                * NB: This gets called via leave_mm() in the idle path
-                * where RCU functions differently.  Tracing normally
-                * uses RCU, so we need to use the _rcuidle variant.
-                *
-                * (There is no good reason for this.  The idle code should
-                *  be rearranged to call this before rcu_idle_enter().)
-                */
-               trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
+               trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
        } else {
                /* The new ASID is already up to date. */
                load_new_mm_cr3(next->pgd, new_asid, false);
 
-               /* See above wrt _rcuidle. */
-               trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, 0);
+               trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, 0);
        }
 
        /* Make sure we write CR3 before loaded_mm. */
index 9f9aad4..89395a5 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/xen/pci.h>
 #include <asm/xen/cpuid.h>
 #include <asm/apic.h>
+#include <asm/acpi.h>
 #include <asm/i8259.h>
 
 static int xen_pcifront_enable_irq(struct pci_dev *dev)
index f6ea8f1..d37ebe6 100644 (file)
@@ -49,7 +49,6 @@
 #include <asm/efi.h>
 #include <asm/e820/api.h>
 #include <asm/time.h>
-#include <asm/set_memory.h>
 #include <asm/tlbflush.h>
 #include <asm/x86_init.h>
 #include <asm/uv/uv.h>
@@ -496,74 +495,6 @@ void __init efi_init(void)
                efi_print_memmap();
 }
 
-#if defined(CONFIG_X86_32)
-
-void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
-{
-       u64 addr, npages;
-
-       addr = md->virt_addr;
-       npages = md->num_pages;
-
-       memrange_efi_to_native(&addr, &npages);
-
-       if (executable)
-               set_memory_x(addr, npages);
-       else
-               set_memory_nx(addr, npages);
-}
-
-void __init runtime_code_page_mkexec(void)
-{
-       efi_memory_desc_t *md;
-
-       /* Make EFI runtime service code area executable */
-       for_each_efi_memory_desc(md) {
-               if (md->type != EFI_RUNTIME_SERVICES_CODE)
-                       continue;
-
-               efi_set_executable(md, true);
-       }
-}
-
-void __init efi_memory_uc(u64 addr, unsigned long size)
-{
-       unsigned long page_shift = 1UL << EFI_PAGE_SHIFT;
-       u64 npages;
-
-       npages = round_up(size, page_shift) / page_shift;
-       memrange_efi_to_native(&addr, &npages);
-       set_memory_uc(addr, npages);
-}
-
-void __init old_map_region(efi_memory_desc_t *md)
-{
-       u64 start_pfn, end_pfn, end;
-       unsigned long size;
-       void *va;
-
-       start_pfn = PFN_DOWN(md->phys_addr);
-       size      = md->num_pages << PAGE_SHIFT;
-       end       = md->phys_addr + size;
-       end_pfn   = PFN_UP(end);
-
-       if (pfn_range_is_mapped(start_pfn, end_pfn)) {
-               va = __va(md->phys_addr);
-
-               if (!(md->attribute & EFI_MEMORY_WB))
-                       efi_memory_uc((u64)(unsigned long)va, size);
-       } else
-               va = efi_ioremap(md->phys_addr, size,
-                                md->type, md->attribute);
-
-       md->virt_addr = (u64) (unsigned long) va;
-       if (!va)
-               pr_err("ioremap of 0x%llX failed!\n",
-                      (unsigned long long)md->phys_addr);
-}
-
-#endif
-
 /* Merge contiguous regions of the same type and attribute */
 static void __init efi_merge_regions(void)
 {
index 826ead6..e06a199 100644 (file)
 #include <asm/io.h>
 #include <asm/desc.h>
 #include <asm/page.h>
+#include <asm/set_memory.h>
 #include <asm/tlbflush.h>
 #include <asm/efi.h>
 
+void __init efi_map_region(efi_memory_desc_t *md)
+{
+       u64 start_pfn, end_pfn, end;
+       unsigned long size;
+       void *va;
+
+       start_pfn       = PFN_DOWN(md->phys_addr);
+       size            = md->num_pages << PAGE_SHIFT;
+       end             = md->phys_addr + size;
+       end_pfn         = PFN_UP(end);
+
+       if (pfn_range_is_mapped(start_pfn, end_pfn)) {
+               va = __va(md->phys_addr);
+
+               if (!(md->attribute & EFI_MEMORY_WB))
+                       set_memory_uc((unsigned long)va, md->num_pages);
+       } else {
+               va = ioremap_cache(md->phys_addr, size);
+       }
+
+       md->virt_addr = (unsigned long)va;
+       if (!va)
+               pr_err("ioremap of 0x%llX failed!\n", md->phys_addr);
+}
+
 /*
  * To make EFI call EFI runtime service in physical addressing mode we need
  * prolog/epilog before/after the invocation to claim the EFI runtime service
@@ -58,11 +84,6 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
        return 0;
 }
 
-void __init efi_map_region(efi_memory_desc_t *md)
-{
-       old_map_region(md);
-}
-
 void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
 void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
 
@@ -107,6 +128,15 @@ efi_status_t __init efi_set_virtual_address_map(unsigned long memory_map_size,
 
 void __init efi_runtime_update_mappings(void)
 {
-       if (__supported_pte_mask & _PAGE_NX)
-               runtime_code_page_mkexec();
+       if (__supported_pte_mask & _PAGE_NX) {
+               efi_memory_desc_t *md;
+
+               /* Make EFI runtime service code area executable */
+               for_each_efi_memory_desc(md) {
+                       if (md->type != EFI_RUNTIME_SERVICES_CODE)
+                               continue;
+
+                       set_memory_x(md->virt_addr, md->num_pages);
+               }
+       }
 }
index 413583f..6af4da1 100644 (file)
@@ -259,6 +259,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
        npages = (__end_rodata - __start_rodata) >> PAGE_SHIFT;
        rodata = __pa(__start_rodata);
        pfn = rodata >> PAGE_SHIFT;
+
+       pf = _PAGE_NX | _PAGE_ENC;
        if (kernel_map_pages_in_pgd(pgd, pfn, rodata, npages, pf)) {
                pr_err("Failed to map kernel rodata 1:1\n");
                return 1;
index 76cee34..b3b17d6 100644 (file)
@@ -448,7 +448,7 @@ static void do_signal(struct pt_regs *regs)
                                                regs->areg[2] = -EINTR;
                                                break;
                                        }
-                                       /* fallthrough */
+                                       fallthrough;
                                case -ERESTARTNOINTR:
                                        regs->areg[2] = regs->syscall;
                                        regs->pc -= 3;
index 2e5f569..d390566 100644 (file)
@@ -525,7 +525,7 @@ ssize_t badblocks_store(struct badblocks *bb, const char *page, size_t len,
        case 3:
                if (newline != '\n')
                        return -EINVAL;
-               /* fall through */
+               fallthrough;
        case 2:
                if (length <= 0)
                        return -EINVAL;
index 68882b9..b791e20 100644 (file)
@@ -332,7 +332,7 @@ static void bfqg_put(struct bfq_group *bfqg)
                kfree(bfqg);
 }
 
-void bfqg_and_blkg_get(struct bfq_group *bfqg)
+static void bfqg_and_blkg_get(struct bfq_group *bfqg)
 {
        /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */
        bfqg_get(bfqg);
index a4c0bec..c34b090 100644 (file)
@@ -4980,7 +4980,7 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
                pr_err("bdi %s: bfq: bad prio class %d\n",
                                bdi_dev_name(bfqq->bfqd->queue->backing_dev_info),
                                ioprio_class);
-               /* fall through */
+               fallthrough;
        case IOPRIO_CLASS_NONE:
                /*
                 * No prio set, inherit CPU scheduling settings.
@@ -5112,7 +5112,7 @@ static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,
                return &bfqg->async_bfqq[0][ioprio];
        case IOPRIO_CLASS_NONE:
                ioprio = IOPRIO_NORM;
-               /* fall through */
+               fallthrough;
        case IOPRIO_CLASS_BE:
                return &bfqg->async_bfqq[1][ioprio];
        case IOPRIO_CLASS_IDLE:
index cd224aa..7038952 100644 (file)
@@ -986,7 +986,6 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
 struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg);
 struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
 struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node);
-void bfqg_and_blkg_get(struct bfq_group *bfqg);
 void bfqg_and_blkg_put(struct bfq_group *bfqg);
 
 #ifdef CONFIG_BFQ_GROUP_IOSCHED
index eb0e2a6..26776bd 100644 (file)
@@ -533,9 +533,7 @@ static void bfq_get_entity(struct bfq_entity *entity)
                bfqq->ref++;
                bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d",
                             bfqq, bfqq->ref);
-       } else
-               bfqg_and_blkg_get(container_of(entity, struct bfq_group,
-                                              entity));
+       }
 }
 
 /**
@@ -649,14 +647,8 @@ static void bfq_forget_entity(struct bfq_service_tree *st,
 
        entity->on_st_or_in_serv = false;
        st->wsum -= entity->weight;
-       if (is_in_service)
-               return;
-
-       if (bfqq)
+       if (bfqq && !is_in_service)
                bfq_put_queue(bfqq);
-       else
-               bfqg_and_blkg_put(container_of(entity, struct bfq_group,
-                                              entity));
 }
 
 /**
index c63ba04..a9931f2 100644 (file)
@@ -740,8 +740,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
                struct page *page, unsigned int len, unsigned int off,
                bool *same_page)
 {
-       phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) +
-               bv->bv_offset + bv->bv_len - 1;
+       size_t bv_end = bv->bv_offset + bv->bv_len;
+       phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_end - 1;
        phys_addr_t page_addr = page_to_phys(page);
 
        if (vec_end_addr + 1 != page_addr + off)
@@ -750,9 +750,9 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
                return false;
 
        *same_page = ((vec_end_addr & PAGE_MASK) == page_addr);
-       if (!*same_page && pfn_to_page(PFN_DOWN(vec_end_addr)) + 1 != page)
-               return false;
-       return true;
+       if (*same_page)
+               return true;
+       return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE);
 }
 
 /*
index 619a79b..c195365 100644 (file)
@@ -1152,13 +1152,15 @@ int blkcg_init_queue(struct request_queue *q)
        if (preloaded)
                radix_tree_preload_end();
 
-       ret = blk_iolatency_init(q);
+       ret = blk_throtl_init(q);
        if (ret)
                goto err_destroy_all;
 
-       ret = blk_throtl_init(q);
-       if (ret)
+       ret = blk_iolatency_init(q);
+       if (ret) {
+               blk_throtl_exit(q);
                goto err_destroy_all;
+       }
        return 0;
 
 err_destroy_all:
index 6529e3a..f685d63 100644 (file)
@@ -154,7 +154,7 @@ static inline unsigned get_max_io_size(struct request_queue *q,
        if (max_sectors > start_offset)
                return max_sectors - start_offset;
 
-       return sectors & (lbs - 1);
+       return sectors & ~(lbs - 1);
 }
 
 static inline unsigned get_max_segment_size(const struct request_queue *q,
@@ -533,10 +533,17 @@ int __blk_rq_map_sg(struct request_queue *q, struct request *rq,
 }
 EXPORT_SYMBOL(__blk_rq_map_sg);
 
+static inline unsigned int blk_rq_get_max_segments(struct request *rq)
+{
+       if (req_op(rq) == REQ_OP_DISCARD)
+               return queue_max_discard_segments(rq->q);
+       return queue_max_segments(rq->q);
+}
+
 static inline int ll_new_hw_segment(struct request *req, struct bio *bio,
                unsigned int nr_phys_segs)
 {
-       if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(req->q))
+       if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req))
                goto no_merge;
 
        if (blk_integrity_merge_bio(req->q, req, bio) == false)
@@ -624,7 +631,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
                return 0;
 
        total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
-       if (total_phys_segments > queue_max_segments(q))
+       if (total_phys_segments > blk_rq_get_max_segments(req))
                return 0;
 
        if (blk_integrity_merge_rq(q, req, next) == false)
index a19cdf1..d2790e5 100644 (file)
@@ -78,6 +78,15 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx)
                return;
        clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
 
+       /*
+        * Order clearing SCHED_RESTART and list_empty_careful(&hctx->dispatch)
+        * in blk_mq_run_hw_queue(). Its pair is the barrier in
+        * blk_mq_dispatch_rq_list(). So dispatch code won't see SCHED_RESTART,
+        * meantime new request added to hctx->dispatch is missed to check in
+        * blk_mq_run_hw_queue().
+        */
+       smp_mb();
+
        blk_mq_run_hw_queue(hctx, true);
 }
 
index 0015a18..b3d2785 100644 (file)
@@ -1437,6 +1437,15 @@ out:
                list_splice_tail_init(list, &hctx->dispatch);
                spin_unlock(&hctx->lock);
 
+               /*
+                * Order adding requests to hctx->dispatch and checking
+                * SCHED_RESTART flag. The pair of this smp_mb() is the one
+                * in blk_mq_sched_restart(). Avoid restart code path to
+                * miss the new added requests to hctx->dispatch, meantime
+                * SCHED_RESTART is observed here.
+                */
+               smp_mb();
+
                /*
                 * If SCHED_RESTART was set by the caller of this function and
                 * it is no longer set that means that it was cleared by another
@@ -1834,6 +1843,7 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 /**
  * blk_mq_request_bypass_insert - Insert a request at dispatch list.
  * @rq: Pointer to request to be inserted.
+ * @at_head: true if the request should be inserted at the head of the list.
  * @run_queue: If we should run the hardware queue after inserting the request.
  *
  * Should only be used carefully, when the caller knows we want to
@@ -2016,7 +2026,8 @@ insert:
        if (bypass_insert)
                return BLK_STS_RESOURCE;
 
-       blk_mq_request_bypass_insert(rq, false, run_queue);
+       blk_mq_sched_insert_request(rq, false, run_queue, false);
+
        return BLK_STS_OK;
 }
 
index 0fa615e..fd41008 100644 (file)
@@ -528,7 +528,7 @@ static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio *bio)
                if ((bio->bi_opf & (REQ_SYNC | REQ_IDLE)) ==
                    (REQ_SYNC | REQ_IDLE))
                        return false;
-               /* fallthrough */
+               fallthrough;
        case REQ_OP_DISCARD:
                return true;
        default:
index fb7b347..d185396 100644 (file)
@@ -378,7 +378,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
        bset->timeout_fn = timeout;
 
        set = &bset->tag_set;
-       set->ops = &bsg_mq_ops,
+       set->ops = &bsg_mq_ops;
        set->nr_hw_queues = 1;
        set->queue_depth = 128;
        set->numa_node = NUMA_NO_NODE;
index 77bcab1..04ebd37 100644 (file)
@@ -71,7 +71,7 @@ int ioprio_check_cap(int ioprio)
                case IOPRIO_CLASS_RT:
                        if (!capable(CAP_SYS_ADMIN))
                                return -EPERM;
-                       /* fall through */
+                       fallthrough;
                        /* rt has prio field too */
                case IOPRIO_CLASS_BE:
                        if (data >= IOPRIO_BE_NR || data < 0)
index a6f581a..8be8bec 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/rwsem.h>
+#include <linux/sched.h>
 #include <linux/sched/signal.h>
 #include <linux/security.h>
 
@@ -845,9 +846,15 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
        }
 
        lock_sock(sk);
-       if (ctx->init && (init || !ctx->more)) {
-               err = -EINVAL;
-               goto unlock;
+       if (ctx->init && !ctx->more) {
+               if (ctx->used) {
+                       err = -EINVAL;
+                       goto unlock;
+               }
+
+               pr_info_once(
+                       "%s sent an empty control message without MSG_MORE.\n",
+                       current->comm);
        }
        ctx->init = true;
 
index e99fe34..3132967 100644 (file)
@@ -1521,7 +1521,7 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)
 
        case -EALREADY:
                err = 0;
-               /* fall through */
+               fallthrough;
 
        default:
                drbg->random_ready.func = NULL;
index ba0b770..12e82a6 100644 (file)
@@ -2348,121 +2348,121 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
                        test_hash_speed(alg, sec, generic_hash_speed_template);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 301:
                test_hash_speed("md4", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 302:
                test_hash_speed("md5", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 303:
                test_hash_speed("sha1", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 304:
                test_hash_speed("sha256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 305:
                test_hash_speed("sha384", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 306:
                test_hash_speed("sha512", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 307:
                test_hash_speed("wp256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 308:
                test_hash_speed("wp384", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 309:
                test_hash_speed("wp512", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 310:
                test_hash_speed("tgr128", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 311:
                test_hash_speed("tgr160", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 312:
                test_hash_speed("tgr192", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 313:
                test_hash_speed("sha224", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 314:
                test_hash_speed("rmd128", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 315:
                test_hash_speed("rmd160", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 316:
                test_hash_speed("rmd256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 317:
                test_hash_speed("rmd320", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 318:
                test_hash_speed("ghash-generic", sec, hash_speed_template_16);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 319:
                test_hash_speed("crc32c", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 320:
                test_hash_speed("crct10dif", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 321:
                test_hash_speed("poly1305", sec, poly1305_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 322:
                test_hash_speed("sha3-224", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 323:
                test_hash_speed("sha3-256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 324:
                test_hash_speed("sha3-384", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 325:
                test_hash_speed("sha3-512", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 326:
                test_hash_speed("sm3", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 327:
                test_hash_speed("streebog256", sec,
                                generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 328:
                test_hash_speed("streebog512", sec,
                                generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 399:
                break;
 
@@ -2471,121 +2471,121 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
                        test_ahash_speed(alg, sec, generic_hash_speed_template);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 401:
                test_ahash_speed("md4", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 402:
                test_ahash_speed("md5", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 403:
                test_ahash_speed("sha1", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 404:
                test_ahash_speed("sha256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 405:
                test_ahash_speed("sha384", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 406:
                test_ahash_speed("sha512", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 407:
                test_ahash_speed("wp256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 408:
                test_ahash_speed("wp384", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 409:
                test_ahash_speed("wp512", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 410:
                test_ahash_speed("tgr128", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 411:
                test_ahash_speed("tgr160", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 412:
                test_ahash_speed("tgr192", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 413:
                test_ahash_speed("sha224", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 414:
                test_ahash_speed("rmd128", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 415:
                test_ahash_speed("rmd160", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 416:
                test_ahash_speed("rmd256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 417:
                test_ahash_speed("rmd320", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 418:
                test_ahash_speed("sha3-224", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 419:
                test_ahash_speed("sha3-256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 420:
                test_ahash_speed("sha3-384", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 421:
                test_ahash_speed("sha3-512", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 422:
                test_mb_ahash_speed("sha1", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 423:
                test_mb_ahash_speed("sha256", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 424:
                test_mb_ahash_speed("sha512", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 425:
                test_mb_ahash_speed("sm3", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 426:
                test_mb_ahash_speed("streebog256", sec,
                                    generic_hash_speed_template, num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 427:
                test_mb_ahash_speed("streebog512", sec,
                                    generic_hash_speed_template, num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 499:
                break;
 
index c2b452a..9861302 100644 (file)
@@ -290,7 +290,7 @@ static int vt_notifier_call(struct notifier_block *blk,
                        break;
                case '\t':
                        c = ' ';
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        if (c < 32)
                                /* Ignore other control sequences */
index 0803c20..07ecbbd 100644 (file)
@@ -42,6 +42,11 @@ config SPEAKUP
                one of the listed synthesizers, you should say n.
 
 if SPEAKUP
+
+config SPEAKUP_SERIALIO
+       def_bool y
+       depends on ISA || COMPILE_TEST
+
 config SPEAKUP_SYNTH_ACNTSA
        tristate "Accent SA synthesizer support"
        help
@@ -52,7 +57,7 @@ config SPEAKUP_SYNTH_ACNTSA
 
 config SPEAKUP_SYNTH_ACNTPC
        tristate "Accent PC synthesizer support"
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        help
                This is the Speakup driver for the accent pc
                synthesizer.  You can say y to build it into the kernel,
@@ -104,7 +109,7 @@ config SPEAKUP_SYNTH_DECEXT
 
 config SPEAKUP_SYNTH_DECPC
        depends on m
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        tristate "DECtalk PC (big ISA card) synthesizer support"
        help
 
@@ -127,7 +132,7 @@ config SPEAKUP_SYNTH_DECPC
 
 config SPEAKUP_SYNTH_DTLK
        tristate "DoubleTalk PC synthesizer support"
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        help
 
                This is the Speakup driver for the internal DoubleTalk
@@ -138,7 +143,7 @@ config SPEAKUP_SYNTH_DTLK
 
 config SPEAKUP_SYNTH_KEYPC
        tristate "Keynote Gold PC synthesizer support"
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        help
 
                This is the Speakup driver for the Keynote Gold
index 5befb49..6e4bfac 100644 (file)
@@ -25,8 +25,8 @@ speakup-y := \
        keyhelp.o \
        kobjects.o \
        selection.o \
-       serialio.o \
        spk_ttyio.o \
        synth.o \
        thread.o \
        varhandlers.o
+speakup-$(CONFIG_SPEAKUP_SERIALIO) += serialio.o
index 177a298..403b01d 100644 (file)
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
 static void spk_serial_flush_buffer(void);
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_serial_io_ops = {
        .synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
        .synth_in = spk_serial_in,
        .synth_in_nowait = spk_serial_in_nowait,
        .flush_buffer = spk_serial_flush_buffer,
+       .wait_for_xmitr = spk_serial_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
 }
 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
 
-int spk_wait_for_xmitr(struct spk_synth *in_synth)
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
 {
        int tmout = SPK_XMITR_TIMEOUT;
 
@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)
 
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
-       if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+       if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
                outb_p(ch, speakup_info.port_tts);
                return 1;
        }
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth *synth,
        while ((ch = *buff)) {
                if (ch == '\n')
                        ch = synth->procspeech;
-               if (spk_wait_for_xmitr(synth))
+               if (spk_serial_wait_for_xmitr(synth))
                        outb(ch, speakup_info.port_tts);
                else
                        return buff;
index c75b408..0f4bcbe 100644 (file)
@@ -34,7 +34,6 @@
 
 const struct old_serial_port *spk_serial_init(int index);
 void spk_stop_serial_interrupt(void);
-int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
 void spk_ttyio_register_ldisc(void);
index 9b95f77..a831ff6 100644 (file)
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
 static void spk_ttyio_flush_buffer(void);
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_ttyio_ops = {
        .synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
        .synth_in = spk_ttyio_in,
        .synth_in_nowait = spk_ttyio_in_nowait,
        .flush_buffer = spk_ttyio_flush_buffer,
+       .wait_for_xmitr = spk_ttyio_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -286,6 +288,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
        mutex_unlock(&speakup_tty_mutex);
 }
 
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
+{
+       return 1;
+}
+
 static unsigned char ttyio_in(int timeout)
 {
        struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
index d3272c6..7398f11 100644 (file)
@@ -158,6 +158,7 @@ struct spk_io_ops {
        unsigned char (*synth_in)(void);
        unsigned char (*synth_in_nowait)(void);
        void (*flush_buffer)(void);
+       int (*wait_for_xmitr)(struct spk_synth *synth);
 };
 
 struct spk_synth {
index 3568bfb..ac47dba 100644 (file)
@@ -159,7 +159,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth)
 {
        if (synth->alive)
                return 1;
-       if (spk_wait_for_xmitr(synth) > 0) {
+       if (synth->io_ops->wait_for_xmitr(synth) > 0) {
                /* restart */
                synth->alive = 1;
                synth_printf("%s", synth->init);
index 4c34837..806b8ce 100644 (file)
@@ -99,8 +99,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
        if (ret < 0)
                return -ENOENT;
 
-       acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj);
-       clk_data->is_rv = obj->integer.value;
+       if (!acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj))
+               clk_data->is_rv = obj->integer.value;
 
        list_for_each_entry(rentry, &resource_list, node) {
                clk_data->base = devm_ioremap(&adev->dev, rentry->res->start,
index 6ad8cb0..4a0b077 100644 (file)
@@ -350,7 +350,7 @@ void __iomem __ref
 
        pg_off = round_down(phys, PAGE_SIZE);
        pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-       virt = acpi_map(pg_off, pg_sz);
+       virt = acpi_map(phys, size);
        if (!virt) {
                mutex_unlock(&acpi_ioremap_lock);
                kfree(map);
@@ -358,7 +358,7 @@ void __iomem __ref
        }
 
        INIT_LIST_HEAD(&map->list);
-       map->virt = virt;
+       map->virt = (void __iomem __force *)((unsigned long)virt & PAGE_MASK);
        map->phys = pg_off;
        map->size = pg_sz;
        map->track.refcount = 1;
@@ -1575,11 +1575,26 @@ static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level,
 acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
                                u32 level)
 {
+       acpi_status status;
+
        if (!(res->flags & IORESOURCE_MEM))
                return AE_TYPE;
 
-       return acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
-                                  acpi_deactivate_mem_region, NULL, res, NULL);
+       status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
+                                    acpi_deactivate_mem_region, NULL,
+                                    res, NULL);
+       if (ACPI_FAILURE(status))
+               return status;
+
+       /*
+        * Wait for all of the mappings queued up for removal by
+        * acpi_deactivate_mem_region() to actually go away.
+        */
+       synchronize_rcu();
+       rcu_barrier();
+       flush_scheduled_work();
+
+       return AE_OK;
 }
 EXPORT_SYMBOL_GPL(acpi_release_memory);
 
index 6853dbb..49f7acb 100644 (file)
@@ -470,7 +470,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
        switch (priv->version) {
        case BRCM_SATA_BCM7425:
                hpriv->flags |= AHCI_HFLAG_DELAY_ENGINE;
-               /* fall through */
+               fallthrough;
        case BRCM_SATA_NSP:
                hpriv->flags |= AHCI_HFLAG_NO_NCQ;
                priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
index 129556f..86261de 100644 (file)
@@ -326,7 +326,7 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port,
                                node);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case -ENODEV:
                /* continue normally */
                hpriv->phys[port] = NULL;
index b1cd4d9..1a82058 100644 (file)
@@ -190,7 +190,7 @@ struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap,
                case ATA_LITER_PMP_FIRST:
                        if (sata_pmp_attached(ap))
                                return ap->pmp_link;
-                       /* fall through */
+                       fallthrough;
                case ATA_LITER_HOST_FIRST:
                        return &ap->link;
                }
@@ -201,11 +201,11 @@ struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap,
                case ATA_LITER_HOST_FIRST:
                        if (sata_pmp_attached(ap))
                                return ap->pmp_link;
-                       /* fall through */
+                       fallthrough;
                case ATA_LITER_PMP_FIRST:
                        if (unlikely(ap->slave_link))
                                return ap->slave_link;
-                       /* fall through */
+                       fallthrough;
                case ATA_LITER_EDGE:
                        return NULL;
                }
@@ -523,7 +523,7 @@ int atapi_cmd_type(u8 opcode)
        case ATA_12:
                if (atapi_passthru16)
                        return ATAPI_PASS_THRU;
-               /* fall thru */
+               fallthrough;
        default:
                return ATAPI_MISC;
        }
@@ -1800,7 +1800,7 @@ retry:
        switch (class) {
        case ATA_DEV_SEMB:
                class = ATA_DEV_ATA;    /* some hard drives report SEMB sig */
-               /* fall through */
+               fallthrough;
        case ATA_DEV_ATA:
        case ATA_DEV_ZAC:
                tf.command = ATA_CMD_ID_ATA;
@@ -2907,7 +2907,7 @@ int ata_bus_probe(struct ata_port *ap)
        case -ENODEV:
                /* give it just one more chance */
                tries[dev->devno] = min(tries[dev->devno], 1);
-               /* fall through */
+               fallthrough;
        case -EIO:
                if (tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
@@ -3158,7 +3158,7 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel)
 
        case ATA_DNXFER_FORCE_PIO0:
                pio_mask &= 1;
-               /* fall through */
+               fallthrough;
        case ATA_DNXFER_FORCE_PIO:
                mwdma_mask = 0;
                udma_mask = 0;
@@ -4694,7 +4694,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
                            qc->tf.feature != SETFEATURES_RA_ON &&
                            qc->tf.feature != SETFEATURES_RA_OFF)
                                break;
-                       /* fall through */
+                       fallthrough;
                case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
                case ATA_CMD_SET_MULTI: /* multi_count changed */
                        /* revalidate device */
index 474c6c3..d912eaa 100644 (file)
@@ -1576,7 +1576,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
        case ATA_DEV_ZAC:
                if (stat & ATA_SENSE)
                        ata_eh_request_sense(qc, qc->scsicmd);
-               /* fall through */
+               fallthrough;
        case ATA_DEV_ATA:
                if (err & ATA_ICRC)
                        qc->err_mask |= AC_ERR_ATA_BUS;
@@ -3473,11 +3473,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
        case -ENODEV:
                /* device missing or wrong IDENTIFY data, schedule probing */
                ehc->i.probe_mask |= (1 << dev->devno);
-               /* fall through */
+               fallthrough;
        case -EINVAL:
                /* give it just one more chance */
                ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
-               /* fall through */
+               fallthrough;
        case -EIO:
                if (ehc->tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
index ec23320..4ce4cd3 100644 (file)
@@ -4162,7 +4162,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
                                ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b6);
                                break;
                        }
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        ata_scsi_set_invalid_field(dev, cmd, 2, 0xff);
                        break;
@@ -4198,7 +4198,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
         * turning this into a no-op.
         */
        case SYNCHRONIZE_CACHE:
-               /* fall through */
+               fallthrough;
 
        /* no-op's, complete with success */
        case REZERO_UNIT:
index e01a3a6..2bc5fc8 100644 (file)
@@ -157,7 +157,7 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
        default:
                printk(KERN_WARNING "ATP867X: active %dclk is invalid. "
                        "Using 12clk.\n", clk);
-               /* fall through */
+               fallthrough;
        case 9 ... 12:
                clocks = 7;     /* 12 clk */
                break;
@@ -190,7 +190,7 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk)
        default:
                printk(KERN_WARNING "ATP867X: recover %dclk is invalid. "
                        "Using default 12clk.\n", clk);
-               /* fall through */
+               fallthrough;
        case 12:        /* default 12 clk */
                clocks = 0;
                break;
index 916bf02..7511e11 100644 (file)
@@ -369,7 +369,7 @@ static int serverworks_fixup(struct pci_dev *pdev)
                break;
        case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
                ata_pci_bmdma_clear_simplex(pdev);
-               /* fall through */
+               fallthrough;
        case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
        case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
                rc = serverworks_fixup_csb(pdev);
index d7228f8..664ef65 100644 (file)
@@ -2010,7 +2010,7 @@ static void mv_rw_multi_errata_sata24(struct ata_queued_cmd *qc)
                                break;
                        case ATA_CMD_WRITE_MULTI_FUA_EXT:
                                tf->flags &= ~ATA_TFLAG_FUA; /* ugh */
-                               /* fall through */
+                               fallthrough;
                        case ATA_CMD_WRITE_MULTI_EXT:
                                tf->command = ATA_CMD_PIO_WRITE_EXT;
                                break;
@@ -2044,7 +2044,7 @@ static enum ata_completion_errors mv_qc_prep(struct ata_queued_cmd *qc)
        case ATA_PROT_DMA:
                if (tf->command == ATA_CMD_DSM)
                        return AC_ERR_OK;
-               /* fall-thru */
+               fallthrough;
        case ATA_PROT_NCQ:
                break;  /* continue below */
        case ATA_PROT_PIO:
@@ -2296,7 +2296,7 @@ static unsigned int mv_qc_issue_fis(struct ata_queued_cmd *qc)
        switch (qc->tf.protocol) {
        case ATAPI_PROT_PIO:
                pp->pp_flags |= MV_PP_FLAG_FAKE_ATA_BUSY;
-               /* fall through */
+               fallthrough;
        case ATAPI_PROT_NODATA:
                ap->hsm_task_state = HSM_ST_FIRST;
                break;
@@ -2347,7 +2347,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
                                return AC_ERR_OTHER;
                        break;  /* use bmdma for this */
                }
-               /* fall thru */
+               fallthrough;
        case ATA_PROT_NCQ:
                mv_start_edma(ap, port_mmio, pp, qc->tf.protocol);
                pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK;
@@ -2376,7 +2376,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
                                      ": attempting PIO w/multiple DRQ: "
                                      "this may fail due to h/w errata\n");
                }
-               /* fall through */
+               fallthrough;
        case ATA_PROT_NODATA:
        case ATAPI_PROT_PIO:
        case ATAPI_PROT_NODATA:
@@ -3864,7 +3864,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
                                " and avoid the final two gigabytes on"
                                " all RocketRAID BIOS initialized drives.\n");
                }
-               /* fall through */
+               fallthrough;
        case chip_6042:
                hpriv->ops = &mv6xxx_ops;
                hp_flags |= MV_HP_GEN_IIE;
index 8729f78..7815da8 100644 (file)
@@ -637,7 +637,7 @@ static enum ata_completion_errors pdc_qc_prep(struct ata_queued_cmd *qc)
        switch (qc->tf.protocol) {
        case ATA_PROT_DMA:
                pdc_fill_sg(qc);
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATA_PROT_NODATA:
                i = pdc_pkt_header(&qc->tf, qc->ap->bmdma_prd_dma,
                                   qc->dev->devno, pp->pkt);
@@ -652,7 +652,7 @@ static enum ata_completion_errors pdc_qc_prep(struct ata_queued_cmd *qc)
                break;
        case ATAPI_PROT_DMA:
                pdc_fill_sg(qc);
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATAPI_PROT_NODATA:
                pdc_atapi_pkt(qc);
                break;
@@ -1022,11 +1022,11 @@ static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc)
        case ATAPI_PROT_NODATA:
                if (qc->dev->flags & ATA_DFLAG_CDB_INTR)
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATA_PROT_NODATA:
                if (qc->tf.flags & ATA_TFLAG_POLLING)
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATAPI_PROT_DMA:
        case ATA_PROT_DMA:
                pdc_packet_start(qc);
index 2c7b30c..4c01190 100644 (file)
@@ -669,7 +669,7 @@ static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc)
        case ATA_PROT_NODATA:
                if (qc->tf.flags & ATA_TFLAG_POLLING)
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATA_PROT_DMA:
                pdc20621_packet_start(qc);
                return 0;
index 2ca9ec8..c798856 100644 (file)
@@ -711,7 +711,7 @@ static void process_txdone_queue (struct fs_dev *dev, struct queue *q)
 
                switch (STATUS_CODE (qe)) {
                case 0x01: /* This is for AAL0 where we put the chip in streaming mode */
-                       /* Fall through */
+                       fallthrough;
                case 0x02:
                        /* Process a real txdone entry. */
                        tmp = qe->p0;
index a81bc49..9a70bee 100644 (file)
@@ -376,33 +376,33 @@ fore200e_shutdown(struct fore200e* fore200e)
     case FORE200E_STATE_COMPLETE:
        kfree(fore200e->stats);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_IRQ:
        free_irq(fore200e->irq, fore200e->atm_dev);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_ALLOC_BUF:
        fore200e_free_rx_buf(fore200e);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_BSQ:
        fore200e_uninit_bs_queue(fore200e);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_RXQ:
        fore200e_dma_chunk_free(fore200e, &fore200e->host_rxq.status);
        fore200e_dma_chunk_free(fore200e, &fore200e->host_rxq.rpd);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_TXQ:
        fore200e_dma_chunk_free(fore200e, &fore200e->host_txq.status);
        fore200e_dma_chunk_free(fore200e, &fore200e->host_txq.tpd);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_CMDQ:
        fore200e_dma_chunk_free(fore200e, &fore200e->host_cmdq.status);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INITIALIZE:
        /* nothing to do for that state */
 
@@ -415,7 +415,7 @@ fore200e_shutdown(struct fore200e* fore200e)
     case FORE200E_STATE_MAP:
        fore200e->bus->unmap(fore200e);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_CONFIGURE:
        /* nothing to do for that state */
 
index 8af793f..17f44ab 100644 (file)
@@ -1944,14 +1944,14 @@ he_tasklet(unsigned long data)
                switch (type) {
                        case ITYPE_RBRQ_THRESH:
                                HPRINTK("rbrq%d threshold\n", group);
-                               /* fall through */
+                               fallthrough;
                        case ITYPE_RBRQ_TIMER:
                                if (he_service_rbrq(he_dev, group))
                                        he_service_rbpl(he_dev, group);
                                break;
                        case ITYPE_TBRQ_THRESH:
                                HPRINTK("tbrq%d threshold\n", group);
-                               /* fall through */
+                               fallthrough;
                        case ITYPE_TPD_COMPLETE:
                                he_service_tbrq(he_dev, group);
                                break;
index 6387185..3c081b6 100644 (file)
@@ -192,7 +192,7 @@ static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
        switch (cmd) {
                case IDT77105_GETSTATZ:
                        if (!capable(CAP_NET_ADMIN)) return -EPERM;
-                       /* fall through */
+                       fallthrough;
                case IDT77105_GETSTAT:
                        return fetch_stats(dev, arg, cmd == IDT77105_GETSTATZ);
                case ATM_SETLOOP:
index 986c131..ac811cf 100644 (file)
@@ -2019,7 +2019,7 @@ static int lanai_normalize_ci(struct lanai_dev *lanai,
        switch (*vpip) {
                case ATM_VPI_ANY:
                        *vpip = 0;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case 0:
                        break;
                default:
index ee059c7..cf5fffc 100644 (file)
@@ -1447,7 +1447,7 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
        switch (cmd) {
                case ZATM_GETPOOLZ:
                        if (!capable(CAP_NET_ADMIN)) return -EPERM;
-                       /* fall through */
+                       fallthrough;
                case ZATM_GETPOOL:
                        {
                                struct zatm_pool_info info;
index 99980aa..1c82d82 100644 (file)
@@ -1365,7 +1365,7 @@ static void panel_process_inputs(void)
                                break;
                        input->rise_timer = 0;
                        input->state = INPUT_ST_RISING;
-                       /* fall through */
+                       fallthrough;
                case INPUT_ST_RISING:
                        if ((phys_curr & input->mask) != input->value) {
                                input->state = INPUT_ST_LOW;
@@ -1378,11 +1378,11 @@ static void panel_process_inputs(void)
                        }
                        input->high_timer = 0;
                        input->state = INPUT_ST_HIGH;
-                       /* fall through */
+                       fallthrough;
                case INPUT_ST_HIGH:
                        if (input_state_high(input))
                                break;
-                       /* fall through */
+                       fallthrough;
                case INPUT_ST_FALLING:
                        input_state_falling(input);
                }
index ac1046a..f6f620a 100644 (file)
@@ -4264,9 +4264,9 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
  */
 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
 {
-       if (fwnode) {
-               struct fwnode_handle *fn = dev->fwnode;
+       struct fwnode_handle *fn = dev->fwnode;
 
+       if (fwnode) {
                if (fwnode_is_primary(fn))
                        fn = fn->secondary;
 
@@ -4276,8 +4276,12 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
                }
                dev->fwnode = fwnode;
        } else {
-               dev->fwnode = fwnode_is_primary(dev->fwnode) ?
-                       dev->fwnode->secondary : NULL;
+               if (fwnode_is_primary(fn)) {
+                       dev->fwnode = fn->secondary;
+                       fn->secondary = NULL;
+               } else {
+                       dev->fwnode = NULL;
+               }
        }
 }
 EXPORT_SYMBOL_GPL(set_primary_fwnode);
index 5327bfc..283ca2d 100644 (file)
@@ -289,10 +289,10 @@ static ssize_t firmware_loading_store(struct device *dev,
                        }
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        default:
                dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading);
-               /* fallthrough */
+               fallthrough;
        case -1:
                fw_load_abort(fw_sysfs);
                break;
index 9dd85be..205a067 100644 (file)
@@ -1606,13 +1606,17 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
        }
 
        /*
-        * If a device configured to wake up the system from sleep states
-        * has been suspended at run time and there's a resume request pending
-        * for it, this is equivalent to the device signaling wakeup, so the
-        * system suspend operation should be aborted.
+        * Wait for possible runtime PM transitions of the device in progress
+        * to complete and if there's a runtime resume request pending for it,
+        * resume it before proceeding with invoking the system-wide suspend
+        * callbacks for it.
+        *
+        * If the system-wide suspend callbacks below change the configuration
+        * of the device, they must disable runtime PM for it or otherwise
+        * ensure that its runtime-resume callbacks will not be confused by that
+        * change in case they are invoked going forward.
         */
-       if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
-               pm_wakeup_event(dev, 0);
+       pm_runtime_barrier(dev);
 
        if (pm_wakeup_pending()) {
                dev->power.direct_complete = false;
index 3cf9bc5..6dba413 100644 (file)
@@ -1135,7 +1135,7 @@ noskb:            if (buf)
                        break;
                }
                bvcpy(skb, f->buf->bio, f->iter, n);
-               /* fall through */
+               fallthrough;
        case ATA_CMD_PIO_WRITE:
        case ATA_CMD_PIO_WRITE_EXT:
                spin_lock_irq(&d->lock);
index 1553d41..a50e13a 100644 (file)
@@ -1726,7 +1726,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode,
                /* MSch: invalidate default_params */
                default_params[drive].blocks  = 0;
                set_capacity(floppy->disk, MAX_DISK_SIZE * 2);
-               /* Fall through */
+               fallthrough;
        case FDFMTEND:
        case FDFLUSH:
                /* invalidate the buffer track to force a reread */
index fe6cb99..740e93b 100644 (file)
@@ -1733,7 +1733,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,
                                _drbd_set_state(_NS(device, disk, D_INCONSISTENT), CS_HARD, NULL);
                        break;
                }
-               /* fall through - for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */
+               fallthrough;    /* for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */
        case EP_DETACH:
        case EP_CALL_HELPER:
                /* Remember whether we saw a READ or WRITE error.
index cb687cc..04b6bde 100644 (file)
@@ -430,7 +430,7 @@ int drbd_thread_start(struct drbd_thread *thi)
                thi->t_state = RESTARTING;
                drbd_info(resource, "Restarting %s thread (from %s [%d])\n",
                                thi->name, current->comm, current->pid);
-               /* fall through */
+               fallthrough;
        case RUNNING:
        case RESTARTING:
        default:
index 28eb078..43c8ae4 100644 (file)
@@ -3883,7 +3883,7 @@ static int nla_put_status_info(struct sk_buff *skb, struct drbd_device *device,
                        if (nla_put_u32(skb, T_helper_exit_code,
                                        sib->helper_exit_code))
                                goto nla_put_failure;
-                       /* fall through */
+                       fallthrough;
                case SIB_HELPER_PRE:
                        if (nla_put_string(skb, T_helper, sib->helper_name))
                                goto nla_put_failure;
index 1d17593..422363d 100644 (file)
@@ -1797,7 +1797,7 @@ static int receive_Barrier(struct drbd_connection *connection, struct packet_inf
                        break;
                else
                        drbd_warn(connection, "Allocation of an epoch failed, slowing down\n");
-                       /* Fall through */
+               fallthrough;
 
        case WO_BDEV_FLUSH:
        case WO_DRAIN_IO:
@@ -2917,7 +2917,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
                   then we would do something smarter here than reading
                   the block... */
                peer_req->flags |= EE_RS_THIN_REQ;
-               /* fall through */
+               fallthrough;
        case P_RS_DATA_REQUEST:
                peer_req->w.cb = w_e_end_rsdata_req;
                fault_type = DRBD_FAULT_RS_RD;
@@ -3083,7 +3083,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
                        rv =  1;
                        break;
                }
-               /* Else fall through - to one of the other strategies... */
+               fallthrough;    /* to one of the other strategies */
        case ASB_DISCARD_OLDER_PRI:
                if (self == 0 && peer == 1) {
                        rv = 1;
@@ -3096,7 +3096,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
                /* Else fall through to one of the other strategies... */
                drbd_warn(device, "Discard younger/older primary did not find a decision\n"
                     "Using discard-least-changes instead\n");
-               /* fall through */
+               fallthrough;
        case ASB_DISCARD_ZERO_CHG:
                if (ch_peer == 0 && ch_self == 0) {
                        rv = test_bit(RESOLVE_CONFLICTS, &peer_device->connection->flags)
@@ -3108,7 +3108,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
                }
                if (after_sb_0p == ASB_DISCARD_ZERO_CHG)
                        break;
-               /* else, fall through */
+               fallthrough;
        case ASB_DISCARD_LEAST_CHG:
                if      (ch_self < ch_peer)
                        rv = -1;
@@ -3608,7 +3608,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device,
                switch (rr_conflict) {
                case ASB_CALL_HELPER:
                        drbd_khelper(device, "pri-lost");
-                       /* fall through */
+                       fallthrough;
                case ASB_DISCONNECT:
                        drbd_err(device, "I shall become SyncTarget, but I am primary!\n");
                        return C_MASK;
index 674be09..5c975af 100644 (file)
@@ -611,7 +611,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
                drbd_set_out_of_sync(device, req->i.sector, req->i.size);
                drbd_report_io_error(device, req);
                __drbd_chk_io_error(device, DRBD_READ_ERROR);
-               /* fall through. */
+               fallthrough;
        case READ_AHEAD_COMPLETED_WITH_ERROR:
                /* it is legal to fail read-ahead, no __drbd_chk_io_error in that case. */
                mod_rq_state(req, m, RQ_LOCAL_PENDING, RQ_LOCAL_COMPLETED);
@@ -836,7 +836,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
                        } /* else: FIXME can this happen? */
                        break;
                }
-               /* else, fall through - to BARRIER_ACKED */
+               fallthrough;    /* to BARRIER_ACKED */
 
        case BARRIER_ACKED:
                /* barrier ack for READ requests does not make sense */
index 09079ae..a563b02 100644 (file)
@@ -1680,7 +1680,7 @@ static void recal_interrupt(void)
                        clear_bit(FD_DISK_NEWCHANGE_BIT,
                                  &drive_state[current_drive].flags);
                        drive_state[current_drive].select_date = jiffies;
-                       /* fall through */
+                       fallthrough;
                default:
                        debugt(__func__, "default");
                        /* Recalibrate moves the head by at
@@ -3592,7 +3592,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
                if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
                        return -EINTR;
                process_fd_request();
-               /* fall through */
+               fallthrough;
        case FDGETDRVSTAT:
                outparam = &drive_state[drive];
                break;
index 2f137d6..d339419 100644 (file)
@@ -878,6 +878,7 @@ static void loop_config_discard(struct loop_device *lo)
        struct file *file = lo->lo_backing_file;
        struct inode *inode = file->f_mapping->host;
        struct request_queue *q = lo->lo_queue;
+       u32 granularity, max_discard_sectors;
 
        /*
         * If the backing device is a block device, mirror its zeroing
@@ -890,11 +891,10 @@ static void loop_config_discard(struct loop_device *lo)
                struct request_queue *backingq;
 
                backingq = bdev_get_queue(inode->i_bdev);
-               blk_queue_max_discard_sectors(q,
-                       backingq->limits.max_write_zeroes_sectors);
 
-               blk_queue_max_write_zeroes_sectors(q,
-                       backingq->limits.max_write_zeroes_sectors);
+               max_discard_sectors = backingq->limits.max_write_zeroes_sectors;
+               granularity = backingq->limits.discard_granularity ?:
+                       queue_physical_block_size(backingq);
 
        /*
         * We use punch hole to reclaim the free space used by the
@@ -903,23 +903,26 @@ static void loop_config_discard(struct loop_device *lo)
         * useful information.
         */
        } else if (!file->f_op->fallocate || lo->lo_encrypt_key_size) {
-               q->limits.discard_granularity = 0;
-               q->limits.discard_alignment = 0;
-               blk_queue_max_discard_sectors(q, 0);
-               blk_queue_max_write_zeroes_sectors(q, 0);
+               max_discard_sectors = 0;
+               granularity = 0;
 
        } else {
-               q->limits.discard_granularity = inode->i_sb->s_blocksize;
-               q->limits.discard_alignment = 0;
-
-               blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
-               blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
+               max_discard_sectors = UINT_MAX >> 9;
+               granularity = inode->i_sb->s_blocksize;
        }
 
-       if (q->limits.max_write_zeroes_sectors)
+       if (max_discard_sectors) {
+               q->limits.discard_granularity = granularity;
+               blk_queue_max_discard_sectors(q, max_discard_sectors);
+               blk_queue_max_write_zeroes_sectors(q, max_discard_sectors);
                blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
-       else
+       } else {
+               q->limits.discard_granularity = 0;
+               blk_queue_max_discard_sectors(q, 0);
+               blk_queue_max_write_zeroes_sectors(q, 0);
                blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
+       }
+       q->limits.discard_alignment = 0;
 }
 
 static void loop_unprepare_queue(struct loop_device *lo)
@@ -1111,8 +1114,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
        mapping = file->f_mapping;
        inode = mapping->host;
 
-       size = get_loop_size(lo, file);
-
        if ((config->info.lo_flags & ~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
                error = -EINVAL;
                goto out_unlock;
@@ -1162,6 +1163,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
        loop_update_rotational(lo);
        loop_update_dio(lo);
        loop_sysfs_init(lo);
+
+       size = get_loop_size(lo, file);
        loop_set_size(lo, size);
 
        set_blocksize(bdev, S_ISBLK(inode->i_mode) ?
@@ -1719,7 +1722,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
        case LOOP_SET_BLOCK_SIZE:
                if (!(mode & FMODE_WRITE) && !capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               /* Fall through */
+               fallthrough;
        default:
                err = lo_simple_ioctl(lo, cmd, arg);
                break;
@@ -1867,7 +1870,7 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode,
        case LOOP_SET_STATUS64:
        case LOOP_CONFIGURE:
                arg = (unsigned long) compat_ptr(arg);
-               /* fall through */
+               fallthrough;
        case LOOP_SET_FD:
        case LOOP_CHANGE_FD:
        case LOOP_SET_BLOCK_SIZE:
index 3ff4054..edf8b63 100644 (file)
@@ -1363,6 +1363,8 @@ static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout)
        nbd->tag_set.timeout = timeout * HZ;
        if (timeout)
                blk_queue_rq_timeout(nbd->disk->queue, timeout * HZ);
+       else
+               blk_queue_rq_timeout(nbd->disk->queue, 30 * HZ);
 }
 
 /* Must be called with config_lock held */
index 47a9dad..d74443a 100644 (file)
@@ -1147,7 +1147,7 @@ static int null_handle_rq(struct nullb_cmd *cmd)
                len = bvec.bv_len;
                err = null_transfer(nullb, bvec.bv_page, len, bvec.bv_offset,
                                     op_is_write(req_op(rq)), sector,
-                                    req_op(rq) & REQ_FUA);
+                                    rq->cmd_flags & REQ_FUA);
                if (err) {
                        spin_unlock_irq(&nullb->lock);
                        return err;
index c096750..a7af4f2 100644 (file)
@@ -440,7 +440,7 @@ static void run_fsm(void)
                                pd_claimed = 1;
                                if (!pi_schedule_claimed(pi_current, run_fsm))
                                        return;
-                               /* fall through */
+                               fallthrough;
                        case 1:
                                pd_claimed = 2;
                                pi_current->proto->connect(pi_current);
@@ -465,7 +465,7 @@ static void run_fsm(void)
                                if (stop)
                                        return;
                                }
-                               /* fall through */
+                               fallthrough;
                        case Hold:
                                schedule_fsm();
                                return;
index 4becc1e..1034e44 100644 (file)
@@ -2641,7 +2641,7 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                 */
                if (pd->refcnt == 1)
                        pkt_lock_door(pd, 0);
-               /* fall through */
+               fallthrough;
        /*
         * forward selected CDROM ioctls to CD-ROM, for UDF
         */
index d9c0e7d..0115390 100644 (file)
@@ -3293,7 +3293,7 @@ again:
        case __RBD_OBJ_COPYUP_OBJECT_MAPS:
                if (!pending_result_dec(&obj_req->pending, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_OBJ_COPYUP_OBJECT_MAPS:
                if (*result) {
                        rbd_warn(rbd_dev, "snap object map update failed: %d",
@@ -3312,7 +3312,7 @@ again:
        case __RBD_OBJ_COPYUP_WRITE_OBJECT:
                if (!pending_result_dec(&obj_req->pending, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_OBJ_COPYUP_WRITE_OBJECT:
                return true;
        default:
@@ -3399,7 +3399,7 @@ again:
        case __RBD_OBJ_WRITE_COPYUP:
                if (!rbd_obj_advance_copyup(obj_req, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_OBJ_WRITE_COPYUP:
                if (*result) {
                        rbd_warn(rbd_dev, "copyup failed: %d", *result);
@@ -3592,7 +3592,7 @@ again:
        case __RBD_IMG_OBJECT_REQUESTS:
                if (!pending_result_dec(&img_req->pending, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_IMG_OBJECT_REQUESTS:
                return true;
        default:
index 0fb9484..e1bc8b4 100644 (file)
@@ -148,7 +148,8 @@ static int process_rdma(struct rtrs_srv *sess,
        /* Generate bio with pages pointing to the rdma buffer */
        bio = rnbd_bio_map_kern(data, sess_dev->rnbd_dev->ibd_bio_set, datalen, GFP_KERNEL);
        if (IS_ERR(bio)) {
-               rnbd_srv_err(sess_dev, "Failed to generate bio, err: %ld\n", PTR_ERR(bio));
+               err = PTR_ERR(bio);
+               rnbd_srv_err(sess_dev, "Failed to generate bio, err: %d\n", err);
                goto sess_dev_put;
        }
 
index 7e26122..8799e3b 100644 (file)
@@ -425,7 +425,7 @@ static void card_state_change(struct rsxx_cardinfo *card,
                 * Fall through so the DMA devices can be attached and
                 * the user can attempt to pull off their data.
                 */
-               /* fall through */
+               fallthrough;
        case CARD_STATE_GOOD:
                st = rsxx_get_card_size8(card, &card->size8);
                if (st)
index 3a476dc..ae6454c 100644 (file)
@@ -1436,7 +1436,7 @@ static void skd_resolve_req_exception(struct skd_device *skdev,
                        blk_mq_requeue_request(req, true);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case SKD_CHECK_STATUS_REPORT_ERROR:
        default:
index 63b213e..b2e48da 100644 (file)
@@ -126,16 +126,31 @@ static int virtblk_setup_discard_write_zeroes(struct request *req, bool unmap)
        if (!range)
                return -ENOMEM;
 
-       __rq_for_each_bio(bio, req) {
-               u64 sector = bio->bi_iter.bi_sector;
-               u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT;
-
-               range[n].flags = cpu_to_le32(flags);
-               range[n].num_sectors = cpu_to_le32(num_sectors);
-               range[n].sector = cpu_to_le64(sector);
-               n++;
+       /*
+        * Single max discard segment means multi-range discard isn't
+        * supported, and block layer only runs contiguity merge like
+        * normal RW request. So we can't reply on bio for retrieving
+        * each range info.
+        */
+       if (queue_max_discard_segments(req->q) == 1) {
+               range[0].flags = cpu_to_le32(flags);
+               range[0].num_sectors = cpu_to_le32(blk_rq_sectors(req));
+               range[0].sector = cpu_to_le64(blk_rq_pos(req));
+               n = 1;
+       } else {
+               __rq_for_each_bio(bio, req) {
+                       u64 sector = bio->bi_iter.bi_sector;
+                       u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT;
+
+                       range[n].flags = cpu_to_le32(flags);
+                       range[n].num_sectors = cpu_to_le32(num_sectors);
+                       range[n].sector = cpu_to_le64(sector);
+                       n++;
+               }
        }
 
+       WARN_ON_ONCE(n != segments);
+
        req->special_vec.bv_page = virt_to_page(range);
        req->special_vec.bv_offset = offset_in_page(range);
        req->special_vec.bv_len = sizeof(*range) * segments;
index c2f7126..adfc935 100644 (file)
@@ -1260,7 +1260,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
                break;
        case BLKIF_OP_WRITE_BARRIER:
                drain = true;
-               /* fall through */
+               fallthrough;
        case BLKIF_OP_FLUSH_DISKCACHE:
                ring->st_f_req++;
                operation = REQ_OP_WRITE;
index 42944d4..b9aa5d1 100644 (file)
@@ -843,7 +843,7 @@ static void frontend_changed(struct xenbus_device *dev,
                xenbus_switch_state(dev, XenbusStateClosed);
                if (xenbus_dev_is_online(dev))
                        break;
-               /* fall through */
+               fallthrough;
                /* if not online */
        case XenbusStateUnknown:
                /* implies xen_blkif_disconnect() via xen_blkbk_remove() */
index 3bb3dd8..91de2e0 100644 (file)
@@ -1403,7 +1403,6 @@ static enum blk_req_status blkif_rsp_to_req_status(int rsp)
        case BLKIF_RSP_EOPNOTSUPP:
                return REQ_EOPNOTSUPP;
        case BLKIF_RSP_ERROR:
-               /* Fallthrough. */
        default:
                return REQ_ERROR;
        }
@@ -1643,7 +1642,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
                                info->feature_flush = 0;
                                xlvbd_flush(info);
                        }
-                       /* fall through */
+                       fallthrough;
                case BLKIF_OP_READ:
                case BLKIF_OP_WRITE:
                        if (unlikely(bret->status != BLKIF_RSP_OKAY))
@@ -2484,7 +2483,7 @@ static void blkback_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through */
+               fallthrough;
        case XenbusStateClosing:
                if (info)
                        blkfront_closing(info);
index fb5a901..efb088d 100644 (file)
@@ -1849,7 +1849,7 @@ static int sysc_clockdomain_init(struct sysc *ddata)
        switch (ddata->nr_clocks) {
        case 2:
                ick = ddata->clocks[SYSC_ICK];
-               /* fallthrough */
+               fallthrough;
        case 1:
                fck = ddata->clocks[SYSC_FCK];
                break;
index 89527ba..760d9a9 100644 (file)
@@ -357,7 +357,7 @@ found:
                default:
                        break;
                }
-               /*FALLTHROUGH*/
+               fallthrough;
        default:
                bridge->driver = &ali_generic_bridge;
        }
index d704cef..055cfe5 100644 (file)
@@ -92,8 +92,7 @@ static int ingenic_rng_probe(struct platform_device *pdev)
        priv->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->base)) {
                pr_err("%s: Failed to map RNG registers\n", __func__);
-               ret = PTR_ERR(priv->base);
-               goto err_free_rng;
+               return PTR_ERR(priv->base);
        }
 
        priv->version = (enum ingenic_rng_version)of_device_get_match_data(&pdev->dev);
@@ -106,17 +105,13 @@ static int ingenic_rng_probe(struct platform_device *pdev)
        ret = hwrng_register(&priv->rng);
        if (ret) {
                dev_err(&pdev->dev, "Failed to register hwrng\n");
-               goto err_free_rng;
+               return ret;
        }
 
        platform_set_drvdata(pdev, priv);
 
        dev_info(&pdev->dev, "Ingenic RNG driver registered\n");
        return 0;
-
-err_free_rng:
-       kfree(priv);
-       return ret;
 }
 
 static int ingenic_rng_remove(struct platform_device *pdev)
index ed4dc3b..f292e74 100644 (file)
@@ -99,7 +99,7 @@ static void kcs_bmc_handle_data(struct kcs_bmc *kcs_bmc)
        switch (kcs_bmc->phase) {
        case KCS_PHASE_WRITE_START:
                kcs_bmc->phase = KCS_PHASE_WRITE_DATA;
-               /* fall through */
+               fallthrough;
 
        case KCS_PHASE_WRITE_DATA:
                if (kcs_bmc->data_in_idx < KCS_MSG_BUFSIZ) {
index bd95aba..45932f0 100644 (file)
@@ -734,7 +734,7 @@ static long lp_ioctl(struct file *file, unsigned int cmd,
                        ret = lp_set_timeout32(minor, (void __user *)arg);
                        break;
                }
-               /* fall through - for 64-bit */
+               fallthrough;    /* for 64-bit */
        case LPSETTIMEOUT_NEW:
                ret = lp_set_timeout64(minor, (void __user *)arg);
                break;
@@ -762,7 +762,7 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd,
                        ret = lp_set_timeout32(minor, (void __user *)arg);
                        break;
                }
-               /* fall through - for x32 mode */
+               fallthrough;    /* for x32 mode */
        case LPSETTIMEOUT_NEW:
                ret = lp_set_timeout64(minor, (void __user *)arg);
                break;
index 687d4af..abd4ffd 100644 (file)
@@ -791,7 +791,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
        switch (orig) {
        case SEEK_CUR:
                offset += file->f_pos;
-               /* fall through */
+               fallthrough;
        case SEEK_SET:
                /* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */
                if ((unsigned long long)offset >= -MAX_ERRNO) {
index 8206412..e9f694b 100644 (file)
@@ -286,7 +286,7 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd,
 #ifdef CONFIG_PPC
        case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
                pr_warn("nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
-               /* fall through */
+               fallthrough;
        case IOC_NVRAM_GET_OFFSET:
                ret = -EINVAL;
 #ifdef CONFIG_PPC_PMAC
index 7dad909..f5e0a6b 100644 (file)
 #include <linux/clk-provider.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/clk-s3c2410.h>
 #include <linux/module.h>
 #include "clk.h"
 
-/* legacy access to misccr, until dt conversion is finished */
-#include <mach/hardware.h>
-#include <mach/regs-gpio.h>
-
 #define MUX_DCLK0      0
 #define MUX_DCLK1      1
 #define DIV_DCLK0      2
@@ -52,6 +49,7 @@ struct s3c24xx_clkout {
        struct clk_hw           hw;
        u32                     mask;
        u8                      shift;
+       unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg);
 };
 
 #define to_s3c24xx_clkout(_hw) container_of(_hw, struct s3c24xx_clkout, hw)
@@ -62,7 +60,7 @@ static u8 s3c24xx_clkout_get_parent(struct clk_hw *hw)
        int num_parents = clk_hw_get_num_parents(hw);
        u32 val;
 
-       val = readl_relaxed(S3C24XX_MISCCR) >> clkout->shift;
+       val = clkout->modify_misccr(0, 0) >> clkout->shift;
        val >>= clkout->shift;
        val &= clkout->mask;
 
@@ -76,7 +74,7 @@ static int s3c24xx_clkout_set_parent(struct clk_hw *hw, u8 index)
 {
        struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw);
 
-       s3c2410_modify_misccr((clkout->mask << clkout->shift),
+       clkout->modify_misccr((clkout->mask << clkout->shift),
                              (index << clkout->shift));
 
        return 0;
@@ -92,10 +90,14 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
                const char *name, const char **parent_names, u8 num_parents,
                u8 shift, u32 mask)
 {
+       struct s3c2410_clk_platform_data *pdata = dev_get_platdata(dev);
        struct s3c24xx_clkout *clkout;
        struct clk_init_data init;
        int ret;
 
+       if (!pdata)
+               return ERR_PTR(-EINVAL);
+
        /* allocate the clkout */
        clkout = kzalloc(sizeof(*clkout), GFP_KERNEL);
        if (!clkout)
@@ -110,6 +112,7 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
        clkout->shift = shift;
        clkout->mask = mask;
        clkout->hw.init = &init;
+       clkout->modify_misccr = pdata->modify_misccr;
 
        ret = clk_hw_register(dev, &clkout->hw);
        if (ret)
index fcf6764..5831d06 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index a95ab5f..724ef64 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index c7aba1e..a827d63 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index b96d33e..56f95b6 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/slab.h>
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index 3576ad7..68b087b 100644 (file)
@@ -653,9 +653,8 @@ config ATCPIT100_TIMER
          This option enables support for the Andestech ATCPIT100 timers.
 
 config RISCV_TIMER
-       bool "Timer for the RISC-V platform"
+       bool "Timer for the RISC-V platform" if COMPILE_TEST
        depends on GENERIC_SCHED_CLOCK && RISCV
-       default y
        select TIMER_PROBE
        select TIMER_OF
        help
@@ -663,6 +662,15 @@ config RISCV_TIMER
          is accessed via both the SBI and the rdcycle instruction.  This is
          required for all RISC-V systems.
 
+config CLINT_TIMER
+       bool "CLINT Timer for the RISC-V platform" if COMPILE_TEST
+       depends on GENERIC_SCHED_CLOCK && RISCV
+       select TIMER_PROBE
+       select TIMER_OF
+       help
+         This option enables the CLINT timer for RISC-V systems.  The CLINT
+         driver is usually used for NoMMU RISC-V systems.
+
 config CSKY_MP_TIMER
        bool "SMP Timer for the C-SKY platform" if COMPILE_TEST
        depends on CSKY
index eaedb72..1c444cc 100644 (file)
@@ -89,6 +89,7 @@ obj-$(CONFIG_CLKSRC_ST_LPC)           += clksrc_st_lpc.o
 obj-$(CONFIG_X86_NUMACHIP)             += numachip.o
 obj-$(CONFIG_ATCPIT100_TIMER)          += timer-atcpit100.o
 obj-$(CONFIG_RISCV_TIMER)              += timer-riscv.o
+obj-$(CONFIG_CLINT_TIMER)              += timer-clint.o
 obj-$(CONFIG_CSKY_MP_TIMER)            += timer-mp-csky.o
 obj-$(CONFIG_GX6605S_TIMER)            += timer-gx6605s.o
 obj-$(CONFIG_HYPERV_TIMER)             += hyperv_timer.o
index 38858e1..80e9606 100644 (file)
@@ -309,7 +309,7 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,
                /* restore original register value */
                writel_relaxed(ttccs->scale_clk_ctrl_reg_old,
                               ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET);
-               /* fall through */
+               fallthrough;
        default:
                return NOTIFY_DONE;
        }
@@ -392,7 +392,7 @@ static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
 
                clockevents_update_freq(&ttcce->ce, ndata->new_rate / PRESCALE);
 
-               /* fall through */
+               fallthrough;
        case PRE_RATE_CHANGE:
        case ABORT_RATE_CHANGE:
        default:
diff --git a/drivers/clocksource/timer-clint.c b/drivers/clocksource/timer-clint.c
new file mode 100644 (file)
index 0000000..8eeafa8
--- /dev/null
@@ -0,0 +1,226 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Western Digital Corporation or its affiliates.
+ *
+ * Most of the M-mode (i.e. NoMMU) RISC-V systems usually have a
+ * CLINT MMIO timer device.
+ */
+
+#define pr_fmt(fmt) "clint: " fmt
+#include <linux/bitops.h>
+#include <linux/clocksource.h>
+#include <linux/clockchips.h>
+#include <linux/cpu.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/sched_clock.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/interrupt.h>
+#include <linux/of_irq.h>
+#include <linux/smp.h>
+
+#define CLINT_IPI_OFF          0
+#define CLINT_TIMER_CMP_OFF    0x4000
+#define CLINT_TIMER_VAL_OFF    0xbff8
+
+/* CLINT manages IPI and Timer for RISC-V M-mode  */
+static u32 __iomem *clint_ipi_base;
+static u64 __iomem *clint_timer_cmp;
+static u64 __iomem *clint_timer_val;
+static unsigned long clint_timer_freq;
+static unsigned int clint_timer_irq;
+
+static void clint_send_ipi(const struct cpumask *target)
+{
+       unsigned int cpu;
+
+       for_each_cpu(cpu, target)
+               writel(1, clint_ipi_base + cpuid_to_hartid_map(cpu));
+}
+
+static void clint_clear_ipi(void)
+{
+       writel(0, clint_ipi_base + cpuid_to_hartid_map(smp_processor_id()));
+}
+
+static struct riscv_ipi_ops clint_ipi_ops = {
+       .ipi_inject = clint_send_ipi,
+       .ipi_clear = clint_clear_ipi,
+};
+
+#ifdef CONFIG_64BIT
+#define clint_get_cycles()     readq_relaxed(clint_timer_val)
+#else
+#define clint_get_cycles()     readl_relaxed(clint_timer_val)
+#define clint_get_cycles_hi()  readl_relaxed(((u32 *)clint_timer_val) + 1)
+#endif
+
+#ifdef CONFIG_64BIT
+static u64 notrace clint_get_cycles64(void)
+{
+       return clint_get_cycles();
+}
+#else /* CONFIG_64BIT */
+static u64 notrace clint_get_cycles64(void)
+{
+       u32 hi, lo;
+
+       do {
+               hi = clint_get_cycles_hi();
+               lo = clint_get_cycles();
+       } while (hi != clint_get_cycles_hi());
+
+       return ((u64)hi << 32) | lo;
+}
+#endif /* CONFIG_64BIT */
+
+static u64 clint_rdtime(struct clocksource *cs)
+{
+       return clint_get_cycles64();
+}
+
+static struct clocksource clint_clocksource = {
+       .name           = "clint_clocksource",
+       .rating         = 300,
+       .mask           = CLOCKSOURCE_MASK(64),
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
+       .read           = clint_rdtime,
+};
+
+static int clint_clock_next_event(unsigned long delta,
+                                  struct clock_event_device *ce)
+{
+       void __iomem *r = clint_timer_cmp +
+                         cpuid_to_hartid_map(smp_processor_id());
+
+       csr_set(CSR_IE, IE_TIE);
+       writeq_relaxed(clint_get_cycles64() + delta, r);
+       return 0;
+}
+
+static DEFINE_PER_CPU(struct clock_event_device, clint_clock_event) = {
+       .name           = "clint_clockevent",
+       .features       = CLOCK_EVT_FEAT_ONESHOT,
+       .rating         = 100,
+       .set_next_event = clint_clock_next_event,
+};
+
+static int clint_timer_starting_cpu(unsigned int cpu)
+{
+       struct clock_event_device *ce = per_cpu_ptr(&clint_clock_event, cpu);
+
+       ce->cpumask = cpumask_of(cpu);
+       clockevents_config_and_register(ce, clint_timer_freq, 100, 0x7fffffff);
+
+       enable_percpu_irq(clint_timer_irq,
+                         irq_get_trigger_type(clint_timer_irq));
+       return 0;
+}
+
+static int clint_timer_dying_cpu(unsigned int cpu)
+{
+       disable_percpu_irq(clint_timer_irq);
+       return 0;
+}
+
+static irqreturn_t clint_timer_interrupt(int irq, void *dev_id)
+{
+       struct clock_event_device *evdev = this_cpu_ptr(&clint_clock_event);
+
+       csr_clear(CSR_IE, IE_TIE);
+       evdev->event_handler(evdev);
+
+       return IRQ_HANDLED;
+}
+
+static int __init clint_timer_init_dt(struct device_node *np)
+{
+       int rc;
+       u32 i, nr_irqs;
+       void __iomem *base;
+       struct of_phandle_args oirq;
+
+       /*
+        * Ensure that CLINT device interrupts are either RV_IRQ_TIMER or
+        * RV_IRQ_SOFT. If it's anything else then we ignore the device.
+        */
+       nr_irqs = of_irq_count(np);
+       for (i = 0; i < nr_irqs; i++) {
+               if (of_irq_parse_one(np, i, &oirq)) {
+                       pr_err("%pOFP: failed to parse irq %d.\n", np, i);
+                       continue;
+               }
+
+               if ((oirq.args_count != 1) ||
+                   (oirq.args[0] != RV_IRQ_TIMER &&
+                    oirq.args[0] != RV_IRQ_SOFT)) {
+                       pr_err("%pOFP: invalid irq %d (hwirq %d)\n",
+                              np, i, oirq.args[0]);
+                       return -ENODEV;
+               }
+
+               /* Find parent irq domain and map timer irq */
+               if (!clint_timer_irq &&
+                   oirq.args[0] == RV_IRQ_TIMER &&
+                   irq_find_host(oirq.np))
+                       clint_timer_irq = irq_of_parse_and_map(np, i);
+       }
+
+       /* If CLINT timer irq not found then fail */
+       if (!clint_timer_irq) {
+               pr_err("%pOFP: timer irq not found\n", np);
+               return -ENODEV;
+       }
+
+       base = of_iomap(np, 0);
+       if (!base) {
+               pr_err("%pOFP: could not map registers\n", np);
+               return -ENODEV;
+       }
+
+       clint_ipi_base = base + CLINT_IPI_OFF;
+       clint_timer_cmp = base + CLINT_TIMER_CMP_OFF;
+       clint_timer_val = base + CLINT_TIMER_VAL_OFF;
+       clint_timer_freq = riscv_timebase;
+
+       pr_info("%pOFP: timer running at %ld Hz\n", np, clint_timer_freq);
+
+       rc = clocksource_register_hz(&clint_clocksource, clint_timer_freq);
+       if (rc) {
+               pr_err("%pOFP: clocksource register failed [%d]\n", np, rc);
+               goto fail_iounmap;
+       }
+
+       sched_clock_register(clint_get_cycles64, 64, clint_timer_freq);
+
+       rc = request_percpu_irq(clint_timer_irq, clint_timer_interrupt,
+                                "clint-timer", &clint_clock_event);
+       if (rc) {
+               pr_err("registering percpu irq failed [%d]\n", rc);
+               goto fail_iounmap;
+       }
+
+       rc = cpuhp_setup_state(CPUHP_AP_CLINT_TIMER_STARTING,
+                               "clockevents/clint/timer:starting",
+                               clint_timer_starting_cpu,
+                               clint_timer_dying_cpu);
+       if (rc) {
+               pr_err("%pOFP: cpuhp setup state failed [%d]\n", np, rc);
+               goto fail_free_irq;
+       }
+
+       riscv_set_ipi_ops(&clint_ipi_ops);
+       clint_clear_ipi();
+
+       return 0;
+
+fail_free_irq:
+       free_irq(clint_timer_irq, &clint_clock_event);
+fail_iounmap:
+       iounmap(base);
+       return rc;
+}
+
+TIMER_OF_DECLARE(clint_timer, "riscv,clint0", clint_timer_init_dt);
+TIMER_OF_DECLARE(clint_timer1, "sifive,clint0", clint_timer_init_dt);
index 9de1dab..c51c5ed 100644 (file)
 #include <linux/of_irq.h>
 #include <asm/smp.h>
 #include <asm/sbi.h>
-
-u64 __iomem *riscv_time_cmp;
-u64 __iomem *riscv_time_val;
-
-static inline void mmio_set_timer(u64 val)
-{
-       void __iomem *r;
-
-       r = riscv_time_cmp + cpuid_to_hartid_map(smp_processor_id());
-       writeq_relaxed(val, r);
-}
+#include <asm/timex.h>
 
 static int riscv_clock_next_event(unsigned long delta,
                struct clock_event_device *ce)
 {
        csr_set(CSR_IE, IE_TIE);
-       if (IS_ENABLED(CONFIG_RISCV_SBI))
-               sbi_set_timer(get_cycles64() + delta);
-       else
-               mmio_set_timer(get_cycles64() + delta);
+       sbi_set_timer(get_cycles64() + delta);
        return 0;
 }
 
index cb72fb5..6514a39 100644 (file)
@@ -196,7 +196,6 @@ config ARM_S3C24XX_CPUFREQ_DEBUGFS
 config ARM_S3C2410_CPUFREQ
        bool
        depends on ARM_S3C24XX_CPUFREQ && CPU_S3C2410
-       select S3C2410_CPUFREQ_UTILS
        help
          CPU Frequency scaling support for S3C2410
 
@@ -233,7 +232,6 @@ config ARM_S3C2416_CPUFREQ_VCORESCALE
 config ARM_S3C2440_CPUFREQ
        bool "S3C2440/S3C2442 CPU Frequency scaling support"
        depends on ARM_S3C24XX_CPUFREQ && (CPU_S3C2440 || CPU_S3C2442)
-       select S3C2410_CPUFREQ_UTILS
        default y
        help
          CPU Frequency scaling support for S3C2440 and S3C2442 SoC CPUs.
index 02ab56b..47aa90f 100644 (file)
@@ -703,8 +703,7 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf)
        freq = arch_freq_get_on_cpu(policy->cpu);
        if (freq)
                ret = sprintf(buf, "%u\n", freq);
-       else if (cpufreq_driver && cpufreq_driver->setpolicy &&
-                       cpufreq_driver->get)
+       else if (cpufreq_driver->setpolicy && cpufreq_driver->get)
                ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu));
        else
                ret = sprintf(buf, "%u\n", policy->cur);
index bb61677..ef0a321 100644 (file)
@@ -129,7 +129,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
                        return speedstep_get_frequency(SPEEDSTEP_CPU_PCORE);
                case 0x0D: /* Pentium M (Dothan) */
                        p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
-                       /* fall through */
+                       fallthrough;
                case 0x09: /* Pentium M (Banias) */
                        return speedstep_get_frequency(SPEEDSTEP_CPU_PM);
                }
index 0c4f2cc..5dcfbf0 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#define S3C2410_CLKDIVN_PDIVN       (1<<0)
+#define S3C2410_CLKDIVN_HDIVN       (1<<1)
 
 /* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */
 
@@ -37,7 +37,7 @@ static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
        if (cfg->divs.p_divisor != cfg->divs.h_divisor)
                clkdiv |= S3C2410_CLKDIVN_PDIVN;
 
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+       s3c24xx_write_clkdivn(clkdiv);
 }
 
 static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
index 53385a9..5945945 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-clock.h>
-#include <mach/s3c2412.h>
-
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#define S3C2412_CLKDIVN_PDIVN          (1<<2)
+#define S3C2412_CLKDIVN_HDIVN_MASK     (3<<0)
+#define S3C2412_CLKDIVN_ARMDIVN                (1<<3)
+#define S3C2412_CLKDIVN_DVSEN          (1<<4)
+#define S3C2412_CLKDIVN_HALFHCLK       (1<<5)
+#define S3C2412_CLKDIVN_USB48DIV       (1<<6)
+#define S3C2412_CLKDIVN_UARTDIV_MASK   (15<<8)
+#define S3C2412_CLKDIVN_UARTDIV_SHIFT  (8)
+#define S3C2412_CLKDIVN_I2SDIV_MASK    (15<<12)
+#define S3C2412_CLKDIVN_I2SDIV_SHIFT   (12)
+#define S3C2412_CLKDIVN_CAMDIV_MASK    (15<<16)
+#define S3C2412_CLKDIVN_CAMDIV_SHIFT   (16)
 
 /* our clock resources. */
 static struct clk *xtal;
@@ -117,7 +126,7 @@ static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
        unsigned long clkdiv;
        unsigned long olddiv;
 
-       olddiv = clkdiv = __raw_readl(S3C2410_CLKDIVN);
+       olddiv = clkdiv = s3c24xx_read_clkdivn();
 
        /* clear off current clock info */
 
@@ -134,32 +143,11 @@ static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
                clkdiv |= S3C2412_CLKDIVN_PDIVN;
 
        s3c_freq_dbg("%s: div %08lx => %08lx\n", __func__, olddiv, clkdiv);
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+       s3c24xx_write_clkdivn(clkdiv);
 
        clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
 }
 
-static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
-{
-       struct s3c_cpufreq_board *board = cfg->board;
-       unsigned long refresh;
-
-       s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__,
-                    board->refresh, cfg->freq.hclk);
-
-       /* Reduce both the refresh time (in ns) and the frequency (in MHz)
-        * by 10 each to ensure that we do not overflow 32 bit numbers. This
-        * should work for HCLK up to 133MHz and refresh period up to 30usec.
-        */
-
-       refresh = (board->refresh / 10);
-       refresh *= (cfg->freq.hclk / 100);
-       refresh /= (1 * 1000 * 1000);   /* 10^6 */
-
-       s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh);
-       __raw_writel(refresh, S3C2412_REFRESH);
-}
-
 /* set the default cpu frequency information, based on an 200MHz part
  * as we have no other way of detecting the speed rating in software.
  */
index 3f772ba..148e8ae 100644 (file)
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/regs-clock.h>
+#define S3C2440_CLKDIVN_PDIVN       (1<<0)
+#define S3C2440_CLKDIVN_HDIVN_MASK   (3<<1)
+#define S3C2440_CLKDIVN_HDIVN_1      (0<<1)
+#define S3C2440_CLKDIVN_HDIVN_2      (1<<1)
+#define S3C2440_CLKDIVN_HDIVN_4_8    (2<<1)
+#define S3C2440_CLKDIVN_HDIVN_3_6    (3<<1)
+#define S3C2440_CLKDIVN_UCLK         (1<<3)
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
+#define S3C2440_CAMDIVN_CAMCLK_MASK  (0xf<<0)
+#define S3C2440_CAMDIVN_CAMCLK_SEL   (1<<4)
+#define S3C2440_CAMDIVN_HCLK3_HALF   (1<<8)
+#define S3C2440_CAMDIVN_HCLK4_HALF   (1<<9)
+#define S3C2440_CAMDIVN_DVSEN        (1<<12)
+
+#define S3C2442_CAMDIVN_CAMCLK_DIV3  (1<<5)
 
 static struct clk *xtal;
 static struct clk *fclk;
@@ -143,8 +156,8 @@ static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
        s3c_freq_dbg("%s: divisors: h=%d, p=%d\n", __func__,
                     cfg->divs.h_divisor, cfg->divs.p_divisor);
 
-       clkdiv = __raw_readl(S3C2410_CLKDIVN);
-       camdiv = __raw_readl(S3C2440_CAMDIVN);
+       clkdiv = s3c24xx_read_clkdivn();
+       camdiv = s3c2440_read_camdivn();
 
        clkdiv &= ~(S3C2440_CLKDIVN_HDIVN_MASK | S3C2440_CLKDIVN_PDIVN);
        camdiv &= ~CAMDIVN_HCLK_HALF;
@@ -184,11 +197,11 @@ static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
         * then make a short delay and remove the hclk halving if necessary.
         */
 
-       __raw_writel(camdiv | CAMDIVN_HCLK_HALF, S3C2440_CAMDIVN);
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+       s3c2440_write_camdivn(camdiv | CAMDIVN_HCLK_HALF);
+       s3c24xx_write_clkdivn(clkdiv);
 
        ndelay(20);
-       __raw_writel(camdiv, S3C2440_CAMDIVN);
+       s3c2440_write_camdivn(camdiv);
 
        clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
 }
index 290e353..93971df 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/seq_file.h>
 #include <linux/err.h>
 
-#include <plat/cpu-freq-core.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
 
 static struct dentry *dbgfs_root;
 static struct dentry *dbgfs_file_io;
index ed0e713..37efc0d 100644 (file)
 #include <linux/device.h>
 #include <linux/sysfs.h>
 #include <linux/slab.h>
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/cpu.h>
-#include <plat/cpu-freq-core.h>
-
-#include <mach/regs-clock.h>
-
 /* note, cpufreq support deals in kHz, no Hz */
-
 static struct cpufreq_driver s3c24xx_driver;
 static struct s3c_cpufreq_config cpu_cur;
 static struct s3c_iotimings s3c24xx_iotiming;
@@ -68,7 +64,7 @@ static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg)
        cfg->freq.pclk = pclk = clk_get_rate(clk_pclk);
        cfg->freq.armclk = armclk = clk_get_rate(clk_arm);
 
-       cfg->pll.driver_data = __raw_readl(S3C2410_MPLLCON);
+       cfg->pll.driver_data = s3c24xx_read_mpllcon();
        cfg->pll.frequency = fclk;
 
        cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10);
@@ -386,7 +382,7 @@ static unsigned int suspend_freq;
 static int s3c_cpufreq_suspend(struct cpufreq_policy *policy)
 {
        suspend_pll.frequency = clk_get_rate(_clk_mpll);
-       suspend_pll.driver_data = __raw_readl(S3C2410_MPLLCON);
+       suspend_pll.driver_data = s3c24xx_read_mpllcon();
        suspend_freq = clk_get_rate(clk_arm);
 
        return 0;
@@ -547,7 +543,7 @@ static void s3c_cpufreq_update_loctkime(void)
        val |= calc_locktime(rate, cpu_cur.info->locktime_m);
 
        pr_info("%s: new locktime is 0x%08x\n", __func__, val);
-       __raw_writel(val, S3C2410_LOCKTIME);
+       s3c24xx_write_locktime(val);
 }
 
 static int s3c_cpufreq_build_freq(void)
index 5c4f8f0..a13a2d1 100644 (file)
@@ -366,7 +366,7 @@ enum speedstep_processor speedstep_detect_processor(void)
                        } else
                                return SPEEDSTEP_CPU_PIII_C;
                }
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index bae527e..e1d931c 100644 (file)
@@ -56,9 +56,11 @@ struct read_counters_work {
 
 static struct workqueue_struct *read_counters_wq;
 
-static enum cluster get_cpu_cluster(u8 cpu)
+static void get_cpu_cluster(void *cluster)
 {
-       return MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
+       u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
+
+       *((uint32_t *)cluster) = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 }
 
 /*
@@ -186,8 +188,10 @@ static unsigned int tegra194_get_speed(u32 cpu)
 static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
 {
        struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
-       int cl = get_cpu_cluster(policy->cpu);
        u32 cpu;
+       u32 cl;
+
+       smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
 
        if (cl >= data->num_clusters)
                return -EINVAL;
index ab0de27..8f9fdd8 100644 (file)
@@ -86,11 +86,11 @@ static unsigned long dra7_efuse_xlate(struct ti_cpufreq_data *opp_data,
        case DRA76_EFUSE_HAS_PLUS_MPU_OPP:
        case DRA76_EFUSE_HAS_ALL_MPU_OPP:
                calculated_efuse |= DRA76_EFUSE_PLUS_MPU_OPP;
-               /* Fall through */
+               fallthrough;
        case DRA7_EFUSE_HAS_ALL_MPU_OPP:
        case DRA7_EFUSE_HAS_HIGH_MPU_OPP:
                calculated_efuse |= DRA7_EFUSE_HIGH_MPU_OPP;
-               /* Fall through */
+               fallthrough;
        case DRA7_EFUSE_HAS_OD_MPU_OPP:
                calculated_efuse |= DRA7_EFUSE_OD_MPU_OPP;
        }
index 8719731..04becd7 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/suspend.h>
 #include <linux/tick.h>
+#include <linux/mmu_context.h>
 #include <trace/events/power.h>
 
 #include "cpuidle.h"
@@ -145,21 +146,24 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv,
         * executing it contains RCU usage regarded as invalid in the idle
         * context, so tell RCU about that.
         */
-       RCU_NONIDLE(tick_freeze());
+       tick_freeze();
        /*
         * The state used here cannot be a "coupled" one, because the "coupled"
         * cpuidle mechanism enables interrupts and doing that with timekeeping
         * suspended is generally unsafe.
         */
        stop_critical_timings();
+       rcu_idle_enter();
        drv->states[index].enter_s2idle(dev, drv, index);
-       WARN_ON(!irqs_disabled());
+       if (WARN_ON_ONCE(!irqs_disabled()))
+               local_irq_disable();
        /*
         * timekeeping_resume() that will be called by tick_unfreeze() for the
         * first CPU executing it calls functions containing RCU read-side
         * critical sections, so tell RCU about that.
         */
-       RCU_NONIDLE(tick_unfreeze());
+       rcu_idle_exit();
+       tick_unfreeze();
        start_critical_timings();
 
        time_end = ns_to_ktime(local_clock());
@@ -225,19 +229,24 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
                broadcast = false;
        }
 
+       if (target_state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
+               leave_mm(dev->cpu);
+
        /* Take note of the planned idle state. */
        sched_idle_set_state(target_state);
 
-       trace_cpu_idle_rcuidle(index, dev->cpu);
+       trace_cpu_idle(index, dev->cpu);
        time_start = ns_to_ktime(local_clock());
 
        stop_critical_timings();
+       rcu_idle_enter();
        entered_state = target_state->enter(dev, drv, index);
+       rcu_idle_exit();
        start_critical_timings();
 
        sched_clock_idle_wakeup_event();
        time_end = ns_to_ktime(local_clock());
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
+       trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
 
        /* The cpu is no longer idle or about to enter idle. */
        sched_idle_set_state(NULL);
index aa3a4ed..52a9b7c 100644 (file)
@@ -873,6 +873,9 @@ config CRYPTO_DEV_SA2UL
        select CRYPTO_AES
        select CRYPTO_AES_ARM64
        select CRYPTO_ALGAPI
+       select CRYPTO_SHA1
+       select CRYPTO_SHA256
+       select CRYPTO_SHA512
        select HW_RANDOM
        select SG_SPLIT
        help
index 1a46eed..809c303 100644 (file)
@@ -2310,7 +2310,7 @@ static int artpec6_crypto_prepare_submit_hash(struct ahash_request *req)
 
        case ARTPEC6_CRYPTO_PREPARE_HASH_NO_START:
                ret = 0;
-               /* Fallthrough */
+               fallthrough;
 
        default:
                artpec6_crypto_common_destroy(&req_ctx->common);
index dc5fda5..4fe7898 100644 (file)
@@ -90,11 +90,11 @@ static int setup_sgio_components(struct cpt_vf *cptvf, struct buf_ptr *list,
        case 3:
                sg_ptr->u.s.len2 = cpu_to_be16(list[i * 4 + 2].size);
                sg_ptr->ptr2 = cpu_to_be64(list[i * 4 + 2].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 2:
                sg_ptr->u.s.len1 = cpu_to_be16(list[i * 4 + 1].size);
                sg_ptr->ptr1 = cpu_to_be64(list[i * 4 + 1].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 1:
                sg_ptr->u.s.len0 = cpu_to_be16(list[i * 4 + 0].size);
                sg_ptr->ptr0 = cpu_to_be64(list[i * 4 + 0].dma_addr);
index 91dee61..c5cce02 100644 (file)
@@ -135,7 +135,7 @@ static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info,
                        break;
                /* update to the next state and also initialize TCB */
                tx_info->connection_state = new_state;
-               /* FALLTHRU */
+               fallthrough;
        case KTLS_CONN_ACT_OPEN_RPL:
                /* if we are stuck in this state, means tcb init might not
                 * received by HW, try sending it again.
@@ -150,7 +150,7 @@ static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info,
                        break;
                /* update to the next state and check if l2t_state is valid  */
                tx_info->connection_state = new_state;
-               /* FALLTHRU */
+               fallthrough;
        case KTLS_CONN_SET_TCB_RPL:
                /* Check if l2t state is valid, then move to ready state. */
                if (cxgb4_check_l2t_valid(tx_info->l2te)) {
index cbc3d78..c80baf1 100644 (file)
@@ -140,11 +140,11 @@ static inline int setup_sgio_components(struct pci_dev *pdev,
        case 3:
                sg_ptr->u.s.len2 = cpu_to_be16(list[i * 4 + 2].size);
                sg_ptr->ptr2 = cpu_to_be64(list[i * 4 + 2].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 2:
                sg_ptr->u.s.len1 = cpu_to_be16(list[i * 4 + 1].size);
                sg_ptr->ptr1 = cpu_to_be64(list[i * 4 + 1].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 1:
                sg_ptr->u.s.len0 = cpu_to_be16(list[i * 4 + 0].size);
                sg_ptr->ptr0 = cpu_to_be64(list[i * 4 + 0].dma_addr);
index 1c8ca15..ec9b390 100644 (file)
@@ -131,9 +131,10 @@ static int adf_put_admin_msg_sync(struct adf_accel_dev *accel_dev, u32 ae,
        memcpy(admin->virt_addr + offset, in, ADF_ADMINMSG_LEN);
        ADF_CSR_WR(mailbox, mb_offset, 1);
 
-       ret = readl_poll_timeout(mailbox + mb_offset, status,
-                                status == 0, ADF_ADMIN_POLL_DELAY_US,
-                                ADF_ADMIN_POLL_TIMEOUT_US);
+       ret = read_poll_timeout(ADF_CSR_RD, status, status == 0,
+                               ADF_ADMIN_POLL_DELAY_US,
+                               ADF_ADMIN_POLL_TIMEOUT_US, true,
+                               mailbox, mb_offset);
        if (ret < 0) {
                /* Response timeout */
                dev_err(&GET_DEV(accel_dev),
index 519fd5a..8b090b7 100644 (file)
@@ -340,7 +340,7 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
                /* VF is newer than PF and decides whether it is compatible */
                if (accel_dev->vf.pf_version >= hw_data->min_iov_compat_ver)
                        break;
-               /* fall through */
+               fallthrough;
        case ADF_PF2VF_VF_INCOMPATIBLE:
                dev_err(&GET_DEV(accel_dev),
                        "PF (vers %d) and VF (vers %d) are not compatible\n",
index bff759e..00c615f 100644 (file)
@@ -752,7 +752,7 @@ static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
        case ICP_GPA_ABS:
        case ICP_GPB_ABS:
                ctx_mask = 0;
-               /* fall through */
+               fallthrough;
        case ICP_GPA_REL:
        case ICP_GPB_REL:
                return qat_hal_init_gpr(handle, ae, ctx_mask, reg_type,
@@ -762,7 +762,7 @@ static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
        case ICP_SR_RD_ABS:
        case ICP_DR_RD_ABS:
                ctx_mask = 0;
-               /* fall through */
+               fallthrough;
        case ICP_SR_REL:
        case ICP_DR_REL:
        case ICP_SR_RD_REL:
@@ -772,7 +772,7 @@ static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
        case ICP_SR_WR_ABS:
        case ICP_DR_WR_ABS:
                ctx_mask = 0;
-               /* fall through */
+               fallthrough;
        case ICP_SR_WR_REL:
        case ICP_DR_WR_REL:
                return qat_hal_init_wr_xfer(handle, ae, ctx_mask, reg_type,
index f22f6fa..9866c2a 100644 (file)
@@ -314,17 +314,17 @@ void cryp_save_device_context(struct cryp_device_data *device_data,
        case CRYP_KEY_SIZE_256:
                ctx->key_4_l = readl_relaxed(&src_reg->key_4_l);
                ctx->key_4_r = readl_relaxed(&src_reg->key_4_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_192:
                ctx->key_3_l = readl_relaxed(&src_reg->key_3_l);
                ctx->key_3_r = readl_relaxed(&src_reg->key_3_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_128:
                ctx->key_2_l = readl_relaxed(&src_reg->key_2_l);
                ctx->key_2_r = readl_relaxed(&src_reg->key_2_r);
-               /* Fall through */
+               fallthrough;
 
        default:
                ctx->key_1_l = readl_relaxed(&src_reg->key_1_l);
@@ -364,17 +364,17 @@ void cryp_restore_device_context(struct cryp_device_data *device_data,
        case CRYP_KEY_SIZE_256:
                writel_relaxed(ctx->key_4_l, &reg->key_4_l);
                writel_relaxed(ctx->key_4_r, &reg->key_4_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_192:
                writel_relaxed(ctx->key_3_l, &reg->key_3_l);
                writel_relaxed(ctx->key_3_r, &reg->key_3_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_128:
                writel_relaxed(ctx->key_2_l, &reg->key_2_l);
                writel_relaxed(ctx->key_2_r, &reg->key_2_r);
-               /* Fall through */
+               fallthrough;
 
        default:
                writel_relaxed(ctx->key_1_l, &reg->key_1_l);
index c82cbcb..3264263 100644 (file)
@@ -100,6 +100,12 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
                return false;
        }
 
+       if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) {
+               pr_debug("%s: error: dax unsupported by block device\n",
+                               bdevname(bdev, buf));
+               return false;
+       }
+
        id = dax_read_lock();
        len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn);
        len2 = dax_direct_access(dax_dev, pgoff_end, 1, &end_kaddr, &end_pfn);
index 9adc7a2..a24882b 100644 (file)
@@ -1767,7 +1767,7 @@ static u32 pl08x_memcpy_cctl(struct pl08x_driver_data *pl08x)
        default:
                dev_err(&pl08x->adev->dev,
                        "illegal burst size for memcpy, set to 1\n");
-               /* Fall through */
+               fallthrough;
        case PL08X_BURST_SZ_1:
                cctl |= PL080_BSIZE_1 << PL080_CONTROL_SB_SIZE_SHIFT |
                        PL080_BSIZE_1 << PL080_CONTROL_DB_SIZE_SHIFT;
@@ -1806,7 +1806,7 @@ static u32 pl08x_memcpy_cctl(struct pl08x_driver_data *pl08x)
        default:
                dev_err(&pl08x->adev->dev,
                        "illegal bus width for memcpy, set to 8 bits\n");
-               /* Fall through */
+               fallthrough;
        case PL08X_BUS_WIDTH_8_BITS:
                cctl |= PL080_WIDTH_8BIT << PL080_CONTROL_SWIDTH_SHIFT |
                        PL080_WIDTH_8BIT << PL080_CONTROL_DWIDTH_SHIFT;
@@ -1850,7 +1850,7 @@ static u32 pl08x_ftdmac020_memcpy_cctl(struct pl08x_driver_data *pl08x)
        default:
                dev_err(&pl08x->adev->dev,
                        "illegal bus width for memcpy, set to 8 bits\n");
-               /* Fall through */
+               fallthrough;
        case PL08X_BUS_WIDTH_8_BITS:
                cctl |= PL080_WIDTH_8BIT << FTDMAC020_LLI_SRC_WIDTH_SHIFT |
                        PL080_WIDTH_8BIT << FTDMAC020_LLI_DST_WIDTH_SHIFT;
@@ -2612,7 +2612,7 @@ static int pl08x_of_probe(struct amba_device *adev,
        switch (val) {
        default:
                dev_err(&adev->dev, "illegal burst size for memcpy, set to 1\n");
-               /* Fall through */
+               fallthrough;
        case 1:
                pd->memcpy_burst_size = PL08X_BURST_SZ_1;
                break;
@@ -2647,7 +2647,7 @@ static int pl08x_of_probe(struct amba_device *adev,
        switch (val) {
        default:
                dev_err(&adev->dev, "illegal bus width for memcpy, set to 8 bits\n");
-               /* Fall through */
+               fallthrough;
        case 8:
                pd->memcpy_bus_width = PL08X_BUS_WIDTH_8_BITS;
                break;
index ad72b3f..e342cf5 100644 (file)
@@ -1163,7 +1163,7 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,
        switch (chan->feature & FSL_DMA_IP_MASK) {
        case FSL_DMA_IP_85XX:
                chan->toggle_ext_pause = fsl_chan_toggle_ext_pause;
-               /* Fall through */
+               fallthrough;
        case FSL_DMA_IP_83XX:
                chan->toggle_ext_start = fsl_chan_toggle_ext_start;
                chan->set_src_loop_size = fsl_chan_set_src_loop_size;
index 56f18ae..308bed0 100644 (file)
@@ -205,10 +205,10 @@ struct fsldma_chan {
 #else
 static u64 fsl_ioread64(const u64 __iomem *addr)
 {
-       u32 fsl_addr = lower_32_bits(addr);
-       u64 fsl_addr_hi = (u64)in_le32((u32 *)(fsl_addr + 1)) << 32;
+       u32 val_lo = in_le32((u32 __iomem *)addr);
+       u32 val_hi = in_le32((u32 __iomem *)addr + 1);
 
-       return fsl_addr_hi | in_le32((u32 *)fsl_addr);
+       return ((u64)val_hi << 32) + val_lo;
 }
 
 static void fsl_iowrite64(u64 val, u64 __iomem *addr)
@@ -219,10 +219,10 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr)
 
 static u64 fsl_ioread64be(const u64 __iomem *addr)
 {
-       u32 fsl_addr = lower_32_bits(addr);
-       u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32;
+       u32 val_hi = in_be32((u32 __iomem *)addr);
+       u32 val_lo = in_be32((u32 __iomem *)addr + 1);
 
-       return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1));
+       return ((u64)val_hi << 32) + val_lo;
 }
 
 static void fsl_iowrite64be(u64 val, u64 __iomem *addr)
index 5c0fb31..8871750 100644 (file)
@@ -556,7 +556,7 @@ static int imxdma_xfer_desc(struct imxdma_desc *d)
                 * We fall-through here intentionally, since a 2D transfer is
                 * similar to MEMCPY just adding the 2D slot configuration.
                 */
-               /* Fall through */
+               fallthrough;
        case IMXDMA_DESC_MEMCPY:
                imx_dmav1_writel(imxdma, d->src, DMA_SAR(imxdmac->channel));
                imx_dmav1_writel(imxdma, d->dest, DMA_DAR(imxdmac->channel));
index c499c95..d44eabb 100644 (file)
@@ -496,7 +496,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
                }
                hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = edcr;
                src_cnt = 24;
-               /* fall through */
+               fallthrough;
        case 17 ... 24:
                if (!u_desc_ctrl.field.blk_ctrl) {
                        hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
@@ -510,7 +510,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
                }
                hw_desc->src_edc[AAU_EDCR1_IDX].e_desc_ctrl = edcr;
                src_cnt = 16;
-               /* fall through */
+               fallthrough;
        case 9 ... 16:
                if (!u_desc_ctrl.field.blk_ctrl)
                        u_desc_ctrl.field.blk_ctrl = 0x2; /* use EDCR0 */
@@ -522,7 +522,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
                }
                hw_desc->src_edc[AAU_EDCR0_IDX].e_desc_ctrl = edcr;
                src_cnt = 8;
-               /* fall through */
+               fallthrough;
        case 2 ... 8:
                shift = 1;
                for (i = 0; i < src_cnt; i++) {
@@ -602,19 +602,19 @@ iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt,
        case 25 ... 32:
                u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
                hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
-               /* fall through */
+               fallthrough;
        case 17 ... 24:
                if (!u_desc_ctrl.field.blk_ctrl) {
                        hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
                        u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
                }
                hw_desc->src_edc[AAU_EDCR1_IDX].e_desc_ctrl = 0;
-               /* fall through */
+               fallthrough;
        case 9 ... 16:
                if (!u_desc_ctrl.field.blk_ctrl)
                        u_desc_ctrl.field.blk_ctrl = 0x2; /* use EDCR0 */
                hw_desc->src_edc[AAU_EDCR0_IDX].e_desc_ctrl = 0;
-               /* fall through */
+               fallthrough;
        case 1 ... 8:
                if (!u_desc_ctrl.field.blk_ctrl && src_cnt > 4)
                        u_desc_ctrl.field.blk_ctrl = 0x1; /* use mini-desc */
index 74df621..ca4e093 100644 (file)
@@ -483,7 +483,7 @@ static size_t nbpf_xfer_size(struct nbpf_device *nbpf,
 
        default:
                pr_warn("%s(): invalid bus width %u\n", __func__, width);
-               /* fall through */
+               fallthrough;
        case DMA_SLAVE_BUSWIDTH_1_BYTE:
                size = burst;
        }
index 2c508ee..9b69716 100644 (file)
@@ -1061,16 +1061,16 @@ static bool _start(struct pl330_thread *thrd)
 
                if (_state(thrd) == PL330_STATE_KILLING)
                        UNTIL(thrd, PL330_STATE_STOPPED)
-               /* fall through */
+               fallthrough;
 
        case PL330_STATE_FAULTING:
                _stop(thrd);
-               /* fall through */
+               fallthrough;
 
        case PL330_STATE_KILLING:
        case PL330_STATE_COMPLETING:
                UNTIL(thrd, PL330_STATE_STOPPED)
-               /* fall through */
+               fallthrough;
 
        case PL330_STATE_STOPPED:
                return _trigger(thrd);
@@ -1121,7 +1121,6 @@ static u32 _emit_load(unsigned int dry_run, u8 buf[],
 
        switch (direction) {
        case DMA_MEM_TO_MEM:
-               /* fall through */
        case DMA_MEM_TO_DEV:
                off += _emit_LD(dry_run, &buf[off], cond);
                break;
@@ -1155,7 +1154,6 @@ static inline u32 _emit_store(unsigned int dry_run, u8 buf[],
 
        switch (direction) {
        case DMA_MEM_TO_MEM:
-               /* fall through */
        case DMA_DEV_TO_MEM:
                off += _emit_ST(dry_run, &buf[off], cond);
                break;
@@ -1216,7 +1214,6 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
 
        switch (pxs->desc->rqtype) {
        case DMA_MEM_TO_DEV:
-               /* fall through */
        case DMA_DEV_TO_MEM:
                off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, cyc,
                        cond);
@@ -1266,7 +1263,6 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[],
 
        switch (pxs->desc->rqtype) {
        case DMA_MEM_TO_DEV:
-               /* fall through */
        case DMA_DEV_TO_MEM:
                off += _emit_MOV(dry_run, &buf[off], CCR, dregs_ccr);
                off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, 1,
index 2deeaab..788d696 100644 (file)
@@ -383,7 +383,7 @@ static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
                        switch (desc->mark) {
                        case DESC_COMPLETED:
                                desc->mark = DESC_WAITING;
-                               /* Fall through */
+                               fallthrough;
                        case DESC_WAITING:
                                if (head_acked)
                                        async_tx_ack(&desc->async_tx);
index 6262f63..fcc08bb 100644 (file)
@@ -3375,7 +3375,7 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
                        pvt->ops = &family_types[F17_M70H_CPUS].ops;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 0x18:
                fam_type        = &family_types[F17_CPUS];
                pvt->ops        = &family_types[F17_CPUS].ops;
index da60c29..54ebc8a 100644 (file)
@@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock);
 static bool __read_mostly force_load;
 module_param(force_load, bool, 0);
 
+static bool system_scanned;
+
 /* Memory Device - Type 17 of SMBIOS spec */
 struct memdev_dmi_entry {
        u8 type;
@@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg)
 
 static void ghes_scan_system(void)
 {
-       static bool scanned;
-
-       if (scanned)
+       if (system_scanned)
                return;
 
        dmi_walk(enumerate_dimms, &ghes_hw);
 
-       scanned = true;
+       system_scanned = true;
 }
 
 void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
@@ -631,6 +631,8 @@ void ghes_edac_unregister(struct ghes *ghes)
 
        mutex_lock(&ghes_reg_mutex);
 
+       system_scanned = false;
+
        if (!refcount_dec_and_test(&ghes_refcount))
                goto unlock;
 
index 5860ca4..2acd9f9 100644 (file)
@@ -1710,9 +1710,9 @@ static void i7core_mce_output_error(struct mem_ctl_info *mci,
        if (uncorrected_error) {
                core_err_cnt = 1;
                if (ripv)
-                       tp_event = HW_EVENT_ERR_FATAL;
-               else
                        tp_event = HW_EVENT_ERR_UNCORRECTED;
+               else
+                       tp_event = HW_EVENT_ERR_FATAL;
        } else {
                tp_event = HW_EVENT_ERR_CORRECTED;
        }
index fd36374..928f63a 100644 (file)
@@ -198,7 +198,7 @@ static int apl_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
        switch (sz) {
        case 8:
                ret = _apl_rd_reg(port, off + 4, op, (u32 *)(data + 4));
-               /* fall through */
+               fallthrough;
        case 4:
                ret |= _apl_rd_reg(port, off, op, (u32 *)data);
                pnd2_printk(KERN_DEBUG, "%s=%x%08x ret=%d\n", name,
@@ -1155,7 +1155,7 @@ static void pnd2_mce_output_error(struct mem_ctl_info *mci, const struct mce *m,
        u32 optypenum = GET_BITFIELD(m->status, 4, 6);
        int rc;
 
-       tp_event = uc_err ? (ripv ? HW_EVENT_ERR_FATAL : HW_EVENT_ERR_UNCORRECTED) :
+       tp_event = uc_err ? (ripv ? HW_EVENT_ERR_UNCORRECTED : HW_EVENT_ERR_FATAL) :
                                                 HW_EVENT_ERR_CORRECTED;
 
        /*
index d414698..c5ab634 100644 (file)
@@ -2982,9 +2982,9 @@ static void sbridge_mce_output_error(struct mem_ctl_info *mci,
        if (uncorrected_error) {
                core_err_cnt = 1;
                if (ripv) {
-                       tp_event = HW_EVENT_ERR_FATAL;
-               } else {
                        tp_event = HW_EVENT_ERR_UNCORRECTED;
+               } else {
+                       tp_event = HW_EVENT_ERR_FATAL;
                }
        } else {
                tp_event = HW_EVENT_ERR_CORRECTED;
index 6d8d6dc..2b4ce8e 100644 (file)
@@ -493,9 +493,9 @@ static void skx_mce_output_error(struct mem_ctl_info *mci,
        if (uncorrected_error) {
                core_err_cnt = 1;
                if (ripv) {
-                       tp_event = HW_EVENT_ERR_FATAL;
-               } else {
                        tp_event = HW_EVENT_ERR_UNCORRECTED;
+               } else {
+                       tp_event = HW_EVENT_ERR_FATAL;
                }
        } else {
                tp_event = HW_EVENT_ERR_CORRECTED;
index b785e93..80db43a 100644 (file)
@@ -957,7 +957,7 @@ static void set_broadcast_channel(struct fw_device *device, int generation)
                                device->bc_implemented = BC_IMPLEMENTED;
                                break;
                        }
-                       /* else, fall through - to case address error */
+                       fallthrough;    /* to case address error */
                case RCODE_ADDRESS_ERROR:
                        device->bc_implemented = BC_UNIMPLEMENTED;
                }
index 185b0b7..af70e74 100644 (file)
@@ -277,7 +277,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
                        if ((data[0] & bit) == (data[1] & bit))
                                continue;
 
-                       /* fall through - It's a 1394-1995 IRM, retry. */
+                       fallthrough;    /* It's a 1394-1995 IRM, retry */
                default:
                        if (retry) {
                                retry--;
index 94a13fc..ec68ed2 100644 (file)
@@ -54,7 +54,7 @@ static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count)
                switch (port_type) {
                case SELFID_PORT_CHILD:
                        (*child_port_count)++;
-                       /* fall through */
+                       fallthrough;
                case SELFID_PORT_PARENT:
                case SELFID_PORT_NCONN:
                        (*total_port_count)++;
index 439d918..ac487c9 100644 (file)
@@ -1097,14 +1097,14 @@ static void handle_registers(struct fw_card *card, struct fw_request *request,
                        rcode = RCODE_ADDRESS_ERROR;
                        break;
                }
-               /* else fall through */
+               fallthrough;
 
        case CSR_NODE_IDS:
                /*
                 * per IEEE 1394-2008 8.3.22.3, not IEEE 1394.1-2004 3.2.8
                 * and 9.6, but interoperable with IEEE 1394.1-2004 bridges
                 */
-               /* fall through */
+               fallthrough;
 
        case CSR_STATE_CLEAR:
        case CSR_STATE_SET:
index 7dde21b..020cb15 100644 (file)
@@ -1495,7 +1495,7 @@ static int handle_at_packet(struct context *context,
                        packet->ack = RCODE_GENERATION;
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        default:
                packet->ack = RCODE_SEND_ERROR;
@@ -3054,7 +3054,7 @@ static int ohci_start_iso(struct fw_iso_context *base,
 
        case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
                control |= IR_CONTEXT_BUFFER_FILL|IR_CONTEXT_MULTI_CHANNEL_MODE;
-               /* fall through */
+               fallthrough;
        case FW_ISO_CONTEXT_RECEIVE:
                index = ctx - ohci->ir_context_list;
                match = (tags << 28) | (sync << 8) | ctx->base.channel;
index fdd1db0..3aa07c3 100644 (file)
@@ -381,6 +381,7 @@ static int __init efisubsys_init(void)
        efi_kobj = kobject_create_and_add("efi", firmware_kobj);
        if (!efi_kobj) {
                pr_err("efi: Firmware registration failed.\n");
+               destroy_workqueue(efi_rts_wq);
                return -ENOMEM;
        }
 
@@ -424,6 +425,7 @@ err_unregister:
                generic_ops_unregister();
 err_put:
        kobject_put(efi_kobj);
+       destroy_workqueue(efi_rts_wq);
        return error;
 }
 
index 6bca70b..f735db5 100644 (file)
@@ -187,20 +187,28 @@ int efi_printk(const char *fmt, ...)
  */
 efi_status_t efi_parse_options(char const *cmdline)
 {
-       size_t len = strlen(cmdline) + 1;
+       size_t len;
        efi_status_t status;
        char *str, *buf;
 
+       if (!cmdline)
+               return EFI_SUCCESS;
+
+       len = strnlen(cmdline, COMMAND_LINE_SIZE - 1) + 1;
        status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, len, (void **)&buf);
        if (status != EFI_SUCCESS)
                return status;
 
-       str = skip_spaces(memcpy(buf, cmdline, len));
+       memcpy(buf, cmdline, len - 1);
+       buf[len - 1] = '\0';
+       str = skip_spaces(buf);
 
        while (*str) {
                char *param, *val;
 
                str = next_arg(str, &param, &val);
+               if (!val && !strcmp(param, "--"))
+                       break;
 
                if (!strcmp(param, "nokaslr")) {
                        efi_nokaslr = true;
index 53cee17..722af9e 100644 (file)
@@ -64,22 +64,6 @@ struct ti_sci_xfers_info {
        spinlock_t xfer_lock;
 };
 
-/**
- * struct ti_sci_rm_type_map - Structure representing TISCI Resource
- *                             management representation of dev_ids.
- * @dev_id:    TISCI device ID
- * @type:      Corresponding id as identified by TISCI RM.
- *
- * Note: This is used only as a work around for using RM range apis
- *     for AM654 SoC. For future SoCs dev_id will be used as type
- *     for RM range APIs. In order to maintain ABI backward compatibility
- *     type is not being changed for AM654 SoC.
- */
-struct ti_sci_rm_type_map {
-       u32 dev_id;
-       u16 type;
-};
-
 /**
  * struct ti_sci_desc - Description of SoC integration
  * @default_host_id:   Host identifier representing the compute entity
@@ -87,14 +71,12 @@ struct ti_sci_rm_type_map {
  * @max_msgs: Maximum number of messages that can be pending
  *               simultaneously in the system
  * @max_msg_size: Maximum size of data per message that can be handled.
- * @rm_type_map: RM resource type mapping structure.
  */
 struct ti_sci_desc {
        u8 default_host_id;
        int max_rx_timeout_ms;
        int max_msgs;
        int max_msg_size;
-       struct ti_sci_rm_type_map *rm_type_map;
 };
 
 /**
@@ -1710,33 +1692,6 @@ fail:
        return ret;
 }
 
-static int ti_sci_get_resource_type(struct ti_sci_info *info, u16 dev_id,
-                                   u16 *type)
-{
-       struct ti_sci_rm_type_map *rm_type_map = info->desc->rm_type_map;
-       bool found = false;
-       int i;
-
-       /* If map is not provided then assume dev_id is used as type */
-       if (!rm_type_map) {
-               *type = dev_id;
-               return 0;
-       }
-
-       for (i = 0; rm_type_map[i].dev_id; i++) {
-               if (rm_type_map[i].dev_id == dev_id) {
-                       *type = rm_type_map[i].type;
-                       found = true;
-                       break;
-               }
-       }
-
-       if (!found)
-               return -EINVAL;
-
-       return 0;
-}
-
 /**
  * ti_sci_get_resource_range - Helper to get a range of resources assigned
  *                            to a host. Resource is uniquely identified by
@@ -1760,7 +1715,6 @@ static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
        struct ti_sci_xfer *xfer;
        struct ti_sci_info *info;
        struct device *dev;
-       u16 type;
        int ret = 0;
 
        if (IS_ERR(handle))
@@ -1780,15 +1734,9 @@ static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
                return ret;
        }
 
-       ret = ti_sci_get_resource_type(info, dev_id, &type);
-       if (ret) {
-               dev_err(dev, "rm type lookup failed for %u\n", dev_id);
-               goto fail;
-       }
-
        req = (struct ti_sci_msg_req_get_resource_range *)xfer->xfer_buf;
        req->secondary_host = s_host;
-       req->type = type & MSG_RM_RESOURCE_TYPE_MASK;
+       req->type = dev_id & MSG_RM_RESOURCE_TYPE_MASK;
        req->subtype = subtype & MSG_RM_RESOURCE_SUBTYPE_MASK;
 
        ret = ti_sci_do_xfer(info, xfer);
@@ -3260,61 +3208,50 @@ u32 ti_sci_get_num_resources(struct ti_sci_resource *res)
 EXPORT_SYMBOL_GPL(ti_sci_get_num_resources);
 
 /**
- * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * devm_ti_sci_get_resource_sets() - Get a TISCI resources assigned to a device
  * @handle:    TISCI handle
  * @dev:       Device pointer to which the resource is assigned
  * @dev_id:    TISCI device id to which the resource is assigned
- * @of_prop:   property name by which the resource are represented
+ * @sub_types: Array of sub_types assigned corresponding to device
+ * @sets:      Number of sub_types
  *
  * Return: Pointer to ti_sci_resource if all went well else appropriate
  *        error pointer.
  */
-struct ti_sci_resource *
-devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
-                           struct device *dev, u32 dev_id, char *of_prop)
+static struct ti_sci_resource *
+devm_ti_sci_get_resource_sets(const struct ti_sci_handle *handle,
+                             struct device *dev, u32 dev_id, u32 *sub_types,
+                             u32 sets)
 {
        struct ti_sci_resource *res;
        bool valid_set = false;
-       u32 resource_subtype;
        int i, ret;
 
        res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL);
        if (!res)
                return ERR_PTR(-ENOMEM);
 
-       ret = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
-                                             sizeof(u32));
-       if (ret < 0) {
-               dev_err(dev, "%s resource type ids not available\n", of_prop);
-               return ERR_PTR(ret);
-       }
-       res->sets = ret;
-
+       res->sets = sets;
        res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
                                 GFP_KERNEL);
        if (!res->desc)
                return ERR_PTR(-ENOMEM);
 
        for (i = 0; i < res->sets; i++) {
-               ret = of_property_read_u32_index(dev_of_node(dev), of_prop, i,
-                                                &resource_subtype);
-               if (ret)
-                       return ERR_PTR(-EINVAL);
-
                ret = handle->ops.rm_core_ops.get_range(handle, dev_id,
-                                                       resource_subtype,
+                                                       sub_types[i],
                                                        &res->desc[i].start,
                                                        &res->desc[i].num);
                if (ret) {
                        dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
-                               dev_id, resource_subtype);
+                               dev_id, sub_types[i]);
                        res->desc[i].start = 0;
                        res->desc[i].num = 0;
                        continue;
                }
 
                dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
-                       dev_id, resource_subtype, res->desc[i].start,
+                       dev_id, sub_types[i], res->desc[i].start,
                        res->desc[i].num);
 
                valid_set = true;
@@ -3332,6 +3269,62 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
        return ERR_PTR(-EINVAL);
 }
 
+/**
+ * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * @handle:    TISCI handle
+ * @dev:       Device pointer to which the resource is assigned
+ * @dev_id:    TISCI device id to which the resource is assigned
+ * @of_prop:   property name by which the resource are represented
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *        error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
+                           struct device *dev, u32 dev_id, char *of_prop)
+{
+       struct ti_sci_resource *res;
+       u32 *sub_types;
+       int sets;
+
+       sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
+                                              sizeof(u32));
+       if (sets < 0) {
+               dev_err(dev, "%s resource type ids not available\n", of_prop);
+               return ERR_PTR(sets);
+       }
+
+       sub_types = kcalloc(sets, sizeof(*sub_types), GFP_KERNEL);
+       if (!sub_types)
+               return ERR_PTR(-ENOMEM);
+
+       of_property_read_u32_array(dev_of_node(dev), of_prop, sub_types, sets);
+       res = devm_ti_sci_get_resource_sets(handle, dev, dev_id, sub_types,
+                                           sets);
+
+       kfree(sub_types);
+       return res;
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_of_resource);
+
+/**
+ * devm_ti_sci_get_resource() - Get a resource range assigned to the device
+ * @handle:    TISCI handle
+ * @dev:       Device pointer to which the resource is assigned
+ * @dev_id:    TISCI device id to which the resource is assigned
+ * @suub_type: TISCI resource subytpe representing the resource.
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *        error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+                        u32 dev_id, u32 sub_type)
+{
+       return devm_ti_sci_get_resource_sets(handle, dev, dev_id, &sub_type, 1);
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
+
 static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
                                void *cmd)
 {
@@ -3352,17 +3345,6 @@ static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
        /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
        .max_msgs = 20,
        .max_msg_size = 64,
-       .rm_type_map = NULL,
-};
-
-static struct ti_sci_rm_type_map ti_sci_am654_rm_type_map[] = {
-       {.dev_id = 56, .type = 0x00b}, /* GIC_IRQ */
-       {.dev_id = 179, .type = 0x000}, /* MAIN_NAV_UDMASS_IA0 */
-       {.dev_id = 187, .type = 0x009}, /* MAIN_NAV_RA */
-       {.dev_id = 188, .type = 0x006}, /* MAIN_NAV_UDMAP */
-       {.dev_id = 194, .type = 0x007}, /* MCU_NAV_UDMAP */
-       {.dev_id = 195, .type = 0x00a}, /* MCU_NAV_RA */
-       {.dev_id = 0, .type = 0x000}, /* end of table */
 };
 
 /* Description for AM654 */
@@ -3373,7 +3355,6 @@ static const struct ti_sci_desc ti_sci_pmmc_am654_desc = {
        /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
        .max_msgs = 20,
        .max_msg_size = 60,
-       .rm_type_map = ti_sci_am654_rm_type_map,
 };
 
 static const struct of_device_id ti_sci_of_match[] = {
index d16645c..3aa4593 100644 (file)
@@ -303,16 +303,16 @@ static int aspeed_sgpio_set_type(struct irq_data *d, unsigned int type)
        switch (type & IRQ_TYPE_SENSE_MASK) {
        case IRQ_TYPE_EDGE_BOTH:
                type2 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_RISING:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_FALLING:
                handler = handle_edge_irq;
                break;
        case IRQ_TYPE_LEVEL_HIGH:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_LEVEL_LOW:
                type1 |= bit;
                handler = handle_level_irq;
index 879db23..bf08b45 100644 (file)
@@ -611,16 +611,16 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)
        switch (type & IRQ_TYPE_SENSE_MASK) {
        case IRQ_TYPE_EDGE_BOTH:
                type2 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_RISING:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_FALLING:
                handler = handle_edge_irq;
                break;
        case IRQ_TYPE_LEVEL_HIGH:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_LEVEL_LOW:
                type1 |= bit;
                handler = handle_level_irq;
index 53fae02..d535934 100644 (file)
@@ -129,7 +129,7 @@ static int ath79_gpio_irq_set_type(struct irq_data *data,
 
        case IRQ_TYPE_LEVEL_HIGH:
                polarity |= mask;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_LEVEL_LOW:
                type |= mask;
                break;
index 8c97577..ad61daf 100644 (file)
@@ -617,14 +617,12 @@ static int sprd_eic_probe(struct platform_device *pdev)
                sprd_eic->chip.free = sprd_eic_free;
                sprd_eic->chip.set_config = sprd_eic_set_config;
                sprd_eic->chip.set = sprd_eic_set;
-               /* fall-through */
+               fallthrough;
        case SPRD_EIC_ASYNC:
-               /* fall-through */
        case SPRD_EIC_SYNC:
                sprd_eic->chip.get = sprd_eic_get;
                break;
        case SPRD_EIC_LATCH:
-               /* fall-through */
        default:
                break;
        }
index 6c48809..b0155d6 100644 (file)
@@ -308,7 +308,7 @@ static void stmpe_dbg_show_one(struct seq_file *s,
                        if (ret < 0)
                                return;
                        edge_det = !!(ret & mask);
-                       /* fall through */
+                       fallthrough;
                case STMPE1801:
                        rise_reg = stmpe->regs[STMPE_IDX_GPRER_LSB + bank];
                        fall_reg = stmpe->regs[STMPE_IDX_GPFER_LSB + bank];
@@ -321,7 +321,7 @@ static void stmpe_dbg_show_one(struct seq_file *s,
                        if (ret < 0)
                                return;
                        fall = !!(ret & mask);
-                       /* fall through */
+                       fallthrough;
                case STMPE801:
                case STMPE1600:
                        irqen_reg = stmpe->regs[STMPE_IDX_IEGPIOR_LSB + bank];
index 9276051..54ca3c1 100644 (file)
@@ -1264,7 +1264,7 @@ static int acpi_gpio_package_count(const union acpi_object *obj)
                switch (element->type) {
                case ACPI_TYPE_LOCAL_REFERENCE:
                        element += 3;
-                       /* Fallthrough */
+                       fallthrough;
                case ACPI_TYPE_INTEGER:
                        element++;
                        count++;
index 7e59e47..cdea133 100644 (file)
@@ -152,7 +152,7 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,
                dev_warn(adev->dev,
                         "Invalid sdma engine id (%d), using engine id 0\n",
                         engine_id);
-               /* fall through */
+               fallthrough;
        case 0:
                sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
                                mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
index c7fd0c4..1102de7 100644 (file)
@@ -195,19 +195,32 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,
                                unsigned int engine_id,
                                unsigned int queue_id)
 {
-       uint32_t sdma_engine_reg_base[2] = {
-               SOC15_REG_OFFSET(SDMA0, 0,
-                                mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL,
-               SOC15_REG_OFFSET(SDMA1, 0,
-                                mmSDMA1_RLC0_RB_CNTL) - mmSDMA1_RLC0_RB_CNTL
-       };
-       uint32_t retval = sdma_engine_reg_base[engine_id]
+       uint32_t sdma_engine_reg_base = 0;
+       uint32_t sdma_rlc_reg_offset;
+
+       switch (engine_id) {
+       default:
+               dev_warn(adev->dev,
+                        "Invalid sdma engine id (%d), using engine id 0\n",
+                        engine_id);
+               fallthrough;
+       case 0:
+               sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
+                               mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
+               break;
+       case 1:
+               sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA1, 0,
+                               mmSDMA1_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
+               break;
+       }
+
+       sdma_rlc_reg_offset = sdma_engine_reg_base
                + queue_id * (mmSDMA0_RLC1_RB_CNTL - mmSDMA0_RLC0_RB_CNTL);
 
        pr_debug("RLC register offset for SDMA%d RLC%d: 0x%x\n", engine_id,
-                       queue_id, retval);
+                queue_id, sdma_rlc_reg_offset);
 
-       return retval;
+       return sdma_rlc_reg_offset;
 }
 
 static inline struct v9_mqd *get_mqd(void *mqd)
index 0047da0..4145480 100644 (file)
@@ -179,6 +179,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
                case CHIP_VEGA20:
                case CHIP_ARCTURUS:
                case CHIP_SIENNA_CICHLID:
+               case CHIP_NAVY_FLOUNDER:
                        /* enable runpm if runpm=1 */
                        if (amdgpu_runtime_pm > 0)
                                adev->runpm = true;
@@ -678,8 +679,12 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                 * in the bitfields */
                if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK)
                        se_num = 0xffffffff;
+               else if (se_num >= AMDGPU_GFX_MAX_SE)
+                       return -EINVAL;
                if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK)
                        sh_num = 0xffffffff;
+               else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE)
+                       return -EINVAL;
 
                if (info->read_mmr_reg.count > 128)
                        return -EINVAL;
index 7fe5642..d8c6520 100644 (file)
@@ -522,8 +522,7 @@ static int psp_asd_load(struct psp_context *psp)
         * add workaround to bypass it for sriov now.
         * TODO: add version check to make it common
         */
-       if (amdgpu_sriov_vf(psp->adev) ||
-           (psp->adev->asic_type == CHIP_NAVY_FLOUNDER))
+       if (amdgpu_sriov_vf(psp->adev) || !psp->asd_fw)
                return 0;
 
        cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
index bcce4c0..1bedb41 100644 (file)
@@ -1243,7 +1243,6 @@ void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev,
        if (!obj || !obj->ent)
                return;
 
-       debugfs_remove(obj->ent);
        obj->ent = NULL;
        put_obj(obj);
 }
@@ -1257,7 +1256,6 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
                amdgpu_ras_debugfs_remove(adev, &obj->head);
        }
 
-       debugfs_remove_recursive(con->dir);
        con->dir = NULL;
 }
 /* debugfs end */
index 134cc36..0739e25 100644 (file)
@@ -462,7 +462,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev,
        unsigned int pages;
        int i, r;
 
-       *sgt = kmalloc(sizeof(*sg), GFP_KERNEL);
+       *sgt = kmalloc(sizeof(**sgt), GFP_KERNEL);
        if (!*sgt)
                return -ENOMEM;
 
index 65997ff..037a187 100644 (file)
@@ -7263,10 +7263,8 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *ade
                def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
                data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |
                          RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |
-                         RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);
-
-               /* only for Vega10 & Raven1 */
-               data |= RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK;
+                         RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK |
+                         RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK);
 
                if (def != data)
                        WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data);
index 33f1c4a..88f63d7 100644 (file)
@@ -3250,7 +3250,7 @@ static void gfx_v8_0_tiling_mode_table_init(struct amdgpu_device *adev)
                dev_warn(adev->dev,
                         "Unknown chip type (%d) in function gfx_v8_0_tiling_mode_table_init() falling through to CHIP_CARRIZO\n",
                         adev->asic_type);
-               /* fall through */
+               fallthrough;
 
        case CHIP_CARRIZO:
                modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
index cb9d60a..b95f222 100644 (file)
@@ -691,6 +691,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_4_1_arct[] =
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_5_ARCT, 0x3ff, 0x135),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_CONFIG, 0xffffffff, 0x011A0000),
        SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_FIFO_SIZES, 0xffffffff, 0x00000f00),
+       SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_UTCL1_CNTL1, 0x30000000, 0x30000000)
 };
 
 static const struct soc15_reg_rlcg rlcg_access_gc_9_0[] = {
index fa0bca3..5d25059 100644 (file)
@@ -135,6 +135,12 @@ static void gfxhub_v2_1_init_cache_regs(struct amdgpu_device *adev)
 {
        uint32_t tmp;
 
+       /* These registers are not accessible to VF-SRIOV.
+        * The PF will program them instead.
+        */
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        /* Setup L2 cache */
        tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_CNTL);
        tmp = REG_SET_FIELD(tmp, GCVM_L2_CNTL, ENABLE_L2_CACHE, 1);
@@ -190,6 +196,12 @@ static void gfxhub_v2_1_enable_system_domain(struct amdgpu_device *adev)
 
 static void gfxhub_v2_1_disable_identity_aperture(struct amdgpu_device *adev)
 {
+       /* These registers are not accessible to VF-SRIOV.
+        * The PF will program them instead.
+        */
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,
                     0xFFFFFFFF);
        WREG32_SOC15(GC, 0, mmGCVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32,
@@ -326,6 +338,13 @@ void gfxhub_v2_1_set_fault_enable_default(struct amdgpu_device *adev,
                                          bool value)
 {
        u32 tmp;
+
+       /* These registers are not accessible to VF-SRIOV.
+        * The PF will program them instead.
+        */
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL);
        tmp = REG_SET_FIELD(tmp, GCVM_L2_PROTECTION_FAULT_CNTL,
                            RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
index 6e4f3ff..b67ba38 100644 (file)
@@ -1297,7 +1297,7 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
        case CHIP_VEGA10:
                if (amdgpu_sriov_vf(adev))
                        break;
-               /* fall through */
+               fallthrough;
        case CHIP_VEGA20:
                soc15_program_register_sequence(adev,
                                                golden_settings_mmhub_1_0_0,
index 757fa8e..c79fc54 100644 (file)
@@ -134,6 +134,12 @@ static void mmhub_v2_0_init_cache_regs(struct amdgpu_device *adev)
 {
        uint32_t tmp;
 
+       /* These registers are not accessible to VF-SRIOV.
+        * The PF will program them instead.
+        */
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        /* Setup L2 cache */
        tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_CNTL);
        tmp = REG_SET_FIELD(tmp, MMVM_L2_CNTL, ENABLE_L2_CACHE, 1);
@@ -189,6 +195,12 @@ static void mmhub_v2_0_enable_system_domain(struct amdgpu_device *adev)
 
 static void mmhub_v2_0_disable_identity_aperture(struct amdgpu_device *adev)
 {
+       /* These registers are not accessible to VF-SRIOV.
+        * The PF will program them instead.
+        */
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        WREG32_SOC15(MMHUB, 0,
                     mmMMVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,
                     0xFFFFFFFF);
@@ -318,6 +330,13 @@ void mmhub_v2_0_gart_disable(struct amdgpu_device *adev)
 void mmhub_v2_0_set_fault_enable_default(struct amdgpu_device *adev, bool value)
 {
        u32 tmp;
+
+       /* These registers are not accessible to VF-SRIOV.
+        * The PF will program them instead.
+        */
+       if (amdgpu_sriov_vf(adev))
+               return;
+
        tmp = RREG32_SOC15(MMHUB, 0, mmMMVM_L2_PROTECTION_FAULT_CNTL);
        tmp = REG_SET_FIELD(tmp, MMVM_L2_PROTECTION_FAULT_CNTL,
                            RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
index da8024c..ca11253 100644 (file)
@@ -364,6 +364,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)
 
        switch (adev->asic_type) {
        case CHIP_SIENNA_CICHLID:
+       case CHIP_NAVY_FLOUNDER:
                return AMD_RESET_METHOD_MODE1;
        default:
                if (smu_baco_is_support(smu))
index d488d25..e16874f 100644 (file)
@@ -179,12 +179,11 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
                }
                break;
        case CHIP_SIENNA_CICHLID:
+       case CHIP_NAVY_FLOUNDER:
                err = psp_init_ta_microcode(&adev->psp, chip_name);
                if (err)
                        return err;
                break;
-       case CHIP_NAVY_FLOUNDER:
-               break;
        default:
                BUG();
        }
index ea914b2..b5986d1 100644 (file)
@@ -6196,7 +6196,7 @@ static void si_request_link_speed_change_before_state_change(struct amdgpu_devic
                        si_pi->force_pcie_gen = AMDGPU_PCIE_GEN2;
                        if (current_link_speed == AMDGPU_PCIE_GEN2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case AMDGPU_PCIE_GEN2:
                        if (amdgpu_acpi_pcie_performance_request(adev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)
                                break;
index e4b33c6..b51c527 100644 (file)
@@ -2196,6 +2196,7 @@ void amdgpu_dm_update_connector_after_detect(
 
                        drm_connector_update_edid_property(connector,
                                                           aconnector->edid);
+                       drm_add_edid_modes(connector, aconnector->edid);
 
                        if (aconnector->dc_link->aux_mode)
                                drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
@@ -2833,12 +2834,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
                                    &dm_atomic_state_funcs);
 
        r = amdgpu_display_modeset_create_props(adev);
-       if (r)
+       if (r) {
+               dc_release_state(state->context);
+               kfree(state);
                return r;
+       }
 
        r = amdgpu_dm_audio_init(adev);
-       if (r)
+       if (r) {
+               dc_release_state(state->context);
+               kfree(state);
                return r;
+       }
 
        return 0;
 }
@@ -2855,6 +2862,8 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm)
 #if defined(CONFIG_ACPI)
        struct amdgpu_dm_backlight_caps caps;
 
+       memset(&caps, 0, sizeof(caps));
+
        if (dm->backlight_caps.caps_valid)
                return;
 
@@ -2893,51 +2902,50 @@ static int set_backlight_via_aux(struct dc_link *link, uint32_t brightness)
        return rc ? 0 : 1;
 }
 
-static u32 convert_brightness(const struct amdgpu_dm_backlight_caps *caps,
-                             const uint32_t user_brightness)
+static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
+                               unsigned *min, unsigned *max)
 {
-       u32 min, max, conversion_pace;
-       u32 brightness = user_brightness;
-
        if (!caps)
-               goto out;
+               return 0;
 
-       if (!caps->aux_support) {
-               max = caps->max_input_signal;
-               min = caps->min_input_signal;
-               /*
-                * The brightness input is in the range 0-255
-                * It needs to be rescaled to be between the
-                * requested min and max input signal
-                * It also needs to be scaled up by 0x101 to
-                * match the DC interface which has a range of
-                * 0 to 0xffff
-                */
-               conversion_pace = 0x101;
-               brightness =
-                       user_brightness
-                       * conversion_pace
-                       * (max - min)
-                       / AMDGPU_MAX_BL_LEVEL
-                       + min * conversion_pace;
+       if (caps->aux_support) {
+               // Firmware limits are in nits, DC API wants millinits.
+               *max = 1000 * caps->aux_max_input_signal;
+               *min = 1000 * caps->aux_min_input_signal;
        } else {
-               /* TODO
-                * We are doing a linear interpolation here, which is OK but
-                * does not provide the optimal result. We probably want
-                * something close to the Perceptual Quantizer (PQ) curve.
-                */
-               max = caps->aux_max_input_signal;
-               min = caps->aux_min_input_signal;
-
-               brightness = (AMDGPU_MAX_BL_LEVEL - user_brightness) * min
-                              + user_brightness * max;
-               // Multiple the value by 1000 since we use millinits
-               brightness *= 1000;
-               brightness = DIV_ROUND_CLOSEST(brightness, AMDGPU_MAX_BL_LEVEL);
+               // Firmware limits are 8-bit, PWM control is 16-bit.
+               *max = 0x101 * caps->max_input_signal;
+               *min = 0x101 * caps->min_input_signal;
        }
+       return 1;
+}
 
-out:
-       return brightness;
+static u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps,
+                                       uint32_t brightness)
+{
+       unsigned min, max;
+
+       if (!get_brightness_range(caps, &min, &max))
+               return brightness;
+
+       // Rescale 0..255 to min..max
+       return min + DIV_ROUND_CLOSEST((max - min) * brightness,
+                                      AMDGPU_MAX_BL_LEVEL);
+}
+
+static u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps,
+                                     uint32_t brightness)
+{
+       unsigned min, max;
+
+       if (!get_brightness_range(caps, &min, &max))
+               return brightness;
+
+       if (brightness < min)
+               return 0;
+       // Rescale min..max to 0..255
+       return DIV_ROUND_CLOSEST(AMDGPU_MAX_BL_LEVEL * (brightness - min),
+                                max - min);
 }
 
 static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
@@ -2953,7 +2961,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
 
        link = (struct dc_link *)dm->backlight_link;
 
-       brightness = convert_brightness(&caps, bd->props.brightness);
+       brightness = convert_brightness_from_user(&caps, bd->props.brightness);
        // Change brightness based on AUX property
        if (caps.aux_support)
                return set_backlight_via_aux(link, brightness);
@@ -2970,7 +2978,7 @@ static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
 
        if (ret == DC_ERROR_UNEXPECTED)
                return bd->props.brightness;
-       return ret;
+       return convert_brightness_to_user(&dm->backlight_caps, ret);
 }
 
 static const struct backlight_ops amdgpu_dm_backlight_ops = {
index e85b58f..336aaa0 100644 (file)
@@ -67,7 +67,7 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
        result = dc_link_aux_transfer_raw(TO_DM_AUX(aux)->ddc_service, &payload,
                                      &operation_result);
 
-       if (payload.write)
+       if (payload.write && result >= 0)
                result = msg->size;
 
        if (result < 0)
index 078b7e3..2d5c7da 100644 (file)
@@ -1108,6 +1108,18 @@ static enum bp_result bios_parser_enable_disp_power_gating(
                action);
 }
 
+static enum bp_result bios_parser_enable_lvtma_control(
+       struct dc_bios *dcb,
+       uint8_t uc_pwr_on)
+{
+       struct bios_parser *bp = BP_FROM_DCB(dcb);
+
+       if (!bp->cmd_tbl.enable_lvtma_control)
+               return BP_RESULT_FAILURE;
+
+       return bp->cmd_tbl.enable_lvtma_control(bp, uc_pwr_on);
+}
+
 static bool bios_parser_is_accelerated_mode(
        struct dc_bios *dcb)
 {
@@ -2208,7 +2220,9 @@ static const struct dc_vbios_funcs vbios_funcs = {
        .get_board_layout_info = bios_get_board_layout_info,
        .pack_data_tables = bios_parser_pack_data_tables,
 
-       .get_atom_dc_golden_table = bios_get_atom_dc_golden_table
+       .get_atom_dc_golden_table = bios_get_atom_dc_golden_table,
+
+       .enable_lvtma_control = bios_parser_enable_lvtma_control
 };
 
 static bool bios_parser2_construct(
index bed9157..eb3ae5c 100644 (file)
@@ -904,6 +904,33 @@ static unsigned int get_smu_clock_info_v3_1(struct bios_parser *bp, uint8_t id)
        return 0;
 }
 
+/******************************************************************************
+ ******************************************************************************
+ **
+ **                  LVTMA CONTROL
+ **
+ ******************************************************************************
+ *****************************************************************************/
+
+static enum bp_result enable_lvtma_control(
+       struct bios_parser *bp,
+       uint8_t uc_pwr_on);
+
+static void init_enable_lvtma_control(struct bios_parser *bp)
+{
+       /* TODO add switch for table vrsion */
+       bp->cmd_tbl.enable_lvtma_control = enable_lvtma_control;
+
+}
+
+static enum bp_result enable_lvtma_control(
+       struct bios_parser *bp,
+       uint8_t uc_pwr_on)
+{
+       enum bp_result result = BP_RESULT_FAILURE;
+       return result;
+}
+
 void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp)
 {
        init_dig_encoder_control(bp);
@@ -919,4 +946,5 @@ void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp)
        init_set_dce_clock(bp);
        init_get_smu_clock_info(bp);
 
+       init_enable_lvtma_control(bp);
 }
index 7a2af24..7bdce01 100644 (file)
@@ -94,7 +94,8 @@ struct cmd_tbl {
                struct bp_set_dce_clock_parameters *bp_params);
        unsigned int (*get_smu_clock_info)(
                        struct bios_parser *bp, uint8_t id);
-
+       enum bp_result (*enable_lvtma_control)(struct bios_parser *bp,
+                       uint8_t uc_pwr_on);
 };
 
 void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp);
index c664404..543afa3 100644 (file)
@@ -94,6 +94,15 @@ int rn_get_active_display_cnt_wa(
        return display_count;
 }
 
+void rn_set_low_power_state(struct clk_mgr *clk_mgr_base)
+{
+       struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+
+       rn_vbios_smu_set_dcn_low_power_state(clk_mgr, DCN_PWR_STATE_LOW_POWER);
+       /* update power state */
+       clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER;
+}
+
 void rn_update_clocks(struct clk_mgr *clk_mgr_base,
                        struct dc_state *context,
                        bool safe_to_lower)
@@ -516,6 +525,7 @@ static struct clk_mgr_funcs dcn21_funcs = {
        .init_clocks = rn_init_clocks,
        .enable_pme_wa = rn_enable_pme_wa,
        .are_clock_states_equal = rn_are_clock_states_equal,
+       .set_low_power_state = rn_set_low_power_state,
        .notify_wm_ranges = rn_notify_wm_ranges,
        .notify_link_rate_change = rn_notify_link_rate_change,
 };
index 4bd6e03..437d1a7 100644 (file)
@@ -763,6 +763,7 @@ static bool detect_dp(struct dc_link *link,
                sink_caps->signal = dp_passive_dongle_detection(link->ddc,
                                                                sink_caps,
                                                                audio_support);
+               link->dpcd_caps.dongle_type = sink_caps->dongle_type;
        }
 
        return true;
@@ -3289,7 +3290,6 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
 #if defined(CONFIG_DRM_AMD_DC_HDCP)
        update_psp_stream_config(pipe_ctx, true);
 #endif
-
        dc->hwss.blank_stream(pipe_ctx);
 
        if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
index 9bc03f2..b2be6ad 100644 (file)
@@ -4409,9 +4409,9 @@ bool dc_link_get_backlight_level_nits(struct dc_link *link,
                        link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))
                return false;
 
-       if (!core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_CURRENT_PEAK,
+       if (core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_CURRENT_PEAK,
                        dpcd_backlight_get.raw,
-                       sizeof(union dpcd_source_backlight_get)))
+                       sizeof(union dpcd_source_backlight_get)) != DC_OK)
                return false;
 
        *backlight_millinits_avg =
@@ -4450,9 +4450,9 @@ bool dc_link_read_default_bl_aux(struct dc_link *link, uint32_t *backlight_milli
                link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))
                return false;
 
-       if (!core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_LEVEL,
+       if (core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_LEVEL,
                (uint8_t *) backlight_millinits,
-               sizeof(uint32_t)))
+               sizeof(uint32_t)) != DC_OK)
                return false;
 
        return true;
index d06d070..0811f94 100644 (file)
@@ -136,6 +136,10 @@ struct dc_vbios_funcs {
 
        enum bp_result (*get_atom_dc_golden_table)(
                        struct dc_bios *dcb);
+
+       enum bp_result (*enable_lvtma_control)(
+               struct dc_bios *bios,
+               uint8_t uc_pwr_on);
 };
 
 struct bios_registers {
index 633442b..d9888f3 100644 (file)
@@ -233,7 +233,7 @@ struct dc_stream_state {
        union stream_update_flags update_flags;
 };
 
-#define ABM_LEVEL_IMMEDIATE_DISABLE 0xFFFFFFFF
+#define ABM_LEVEL_IMMEDIATE_DISABLE 255
 
 struct dc_stream_update {
        struct dc_stream_state *stream;
index 70ec691..99c68ca 100644 (file)
@@ -49,7 +49,7 @@
 #define DCN_PANEL_CNTL_REG_LIST()\
        DCN_PANEL_CNTL_SR(PWRSEQ_CNTL, LVTMA), \
        DCN_PANEL_CNTL_SR(PWRSEQ_STATE, LVTMA), \
-       DCE_PANEL_CNTL_SR(PWRSEQ_REF_DIV, LVTMA), \
+       DCN_PANEL_CNTL_SR(PWRSEQ_REF_DIV, LVTMA), \
        SR(BL_PWM_CNTL), \
        SR(BL_PWM_CNTL2), \
        SR(BL_PWM_PERIOD_CNTL), \
index 49380ed..45c9e90 100644 (file)
@@ -842,6 +842,17 @@ void dce110_edp_power_control(
                cntl.coherent = false;
                cntl.lanes_number = LANE_COUNT_FOUR;
                cntl.hpd_sel = link->link_enc->hpd_source;
+
+               if (ctx->dc->ctx->dmub_srv &&
+                               ctx->dc->debug.dmub_command_table) {
+                       if (cntl.action == TRANSMITTER_CONTROL_POWER_ON)
+                               bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
+                                               LVTMA_CONTROL_POWER_ON);
+                       else
+                               bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
+                                               LVTMA_CONTROL_POWER_OFF);
+               }
+
                bp_result = link_transmitter_control(ctx->dc_bios, &cntl);
 
                if (!power_up)
@@ -919,8 +930,21 @@ void dce110_edp_backlight_control(
                /*edp 1.2*/
        if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
                edp_receiver_ready_T7(link);
+
+       if (ctx->dc->ctx->dmub_srv &&
+                       ctx->dc->debug.dmub_command_table) {
+               if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
+                       ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
+                                       LVTMA_CONTROL_LCD_BLON);
+               else
+                       ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
+                                       LVTMA_CONTROL_LCD_BLOFF);
+       }
+
        link_transmitter_control(ctx->dc_bios, &cntl);
 
+
+
        if (enable && link->dpcd_sink_ext_caps.bits.oled)
                msleep(OLED_POST_T7_DELAY);
 
index a643927..fa643ec 100644 (file)
@@ -1450,33 +1450,42 @@ void dcn10_init_hw(struct dc *dc)
 void dcn10_power_down_on_boot(struct dc *dc)
 {
        int i = 0;
+       struct dc_link *edp_link;
 
-       if (dc->config.power_down_display_on_boot) {
-               struct dc_link *edp_link = get_edp_link(dc);
-
-               if (edp_link &&
-                               edp_link->link_enc->funcs->is_dig_enabled &&
-                               edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
-                               dc->hwseq->funcs.edp_backlight_control &&
-                               dc->hwss.power_down &&
-                               dc->hwss.edp_power_control) {
-                       dc->hwseq->funcs.edp_backlight_control(edp_link, false);
-                       dc->hwss.power_down(dc);
-                       dc->hwss.edp_power_control(edp_link, false);
-               } else {
-                       for (i = 0; i < dc->link_count; i++) {
-                               struct dc_link *link = dc->links[i];
-
-                               if (link->link_enc->funcs->is_dig_enabled &&
-                                               link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-                                               dc->hwss.power_down) {
-                                       dc->hwss.power_down(dc);
-                                       break;
-                               }
+       if (!dc->config.power_down_display_on_boot)
+               return;
+
+       edp_link = get_edp_link(dc);
+       if (edp_link &&
+                       edp_link->link_enc->funcs->is_dig_enabled &&
+                       edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
+                       dc->hwseq->funcs.edp_backlight_control &&
+                       dc->hwss.power_down &&
+                       dc->hwss.edp_power_control) {
+               dc->hwseq->funcs.edp_backlight_control(edp_link, false);
+               dc->hwss.power_down(dc);
+               dc->hwss.edp_power_control(edp_link, false);
+       } else {
+               for (i = 0; i < dc->link_count; i++) {
+                       struct dc_link *link = dc->links[i];
 
+                       if (link->link_enc->funcs->is_dig_enabled &&
+                                       link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
+                                       dc->hwss.power_down) {
+                               dc->hwss.power_down(dc);
+                               break;
                        }
+
                }
        }
+
+       /*
+        * Call update_clocks with empty context
+        * to send DISPLAY_OFF
+        * Otherwise DISPLAY_OFF may not be asserted
+        */
+       if (dc->clk_mgr->funcs->set_low_power_state)
+               dc->clk_mgr->funcs->set_low_power_state(dc->clk_mgr);
 }
 
 void dcn10_reset_hw_ctx_wrap(
index 17d5cb4..8939541 100644 (file)
@@ -1213,6 +1213,7 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont
        bool video_large = false;
        bool desktop_large = false;
        bool dcc_disabled = false;
+       bool mpo_enabled = false;
 
        for (i = 0; i < context->stream_count; i++) {
                if (context->stream_status[i].plane_count == 0)
@@ -1221,6 +1222,9 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont
                if (context->stream_status[i].plane_count > 2)
                        return DC_FAIL_UNSUPPORTED_1;
 
+               if (context->stream_status[i].plane_count > 1)
+                       mpo_enabled = true;
+
                for (j = 0; j < context->stream_status[i].plane_count; j++) {
                        struct dc_plane_state *plane =
                                context->stream_status[i].plane_states[j];
@@ -1244,6 +1248,10 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont
                }
        }
 
+       /* Disable MPO in multi-display configurations. */
+       if (context->stream_count > 1 && mpo_enabled)
+               return DC_FAIL_UNSUPPORTED_1;
+
        /*
         * Workaround: On DCN10 there is UMC issue that causes underflow when
         * playing 4k video on 4k desktop with video downscaled and single channel
index 07b2f93..842abb4 100644 (file)
@@ -121,35 +121,35 @@ void enc1_update_generic_info_packet(
        switch (packet_index) {
        case 0:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC0_FRAME_UPDATE, 1);
+                               AFMT_GENERIC0_IMMEDIATE_UPDATE, 1);
                break;
        case 1:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC1_FRAME_UPDATE, 1);
+                               AFMT_GENERIC1_IMMEDIATE_UPDATE, 1);
                break;
        case 2:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC2_FRAME_UPDATE, 1);
+                               AFMT_GENERIC2_IMMEDIATE_UPDATE, 1);
                break;
        case 3:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC3_FRAME_UPDATE, 1);
+                               AFMT_GENERIC3_IMMEDIATE_UPDATE, 1);
                break;
        case 4:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC4_FRAME_UPDATE, 1);
+                               AFMT_GENERIC4_IMMEDIATE_UPDATE, 1);
                break;
        case 5:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC5_FRAME_UPDATE, 1);
+                               AFMT_GENERIC5_IMMEDIATE_UPDATE, 1);
                break;
        case 6:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC6_FRAME_UPDATE, 1);
+                               AFMT_GENERIC6_IMMEDIATE_UPDATE, 1);
                break;
        case 7:
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL1,
-                               AFMT_GENERIC7_FRAME_UPDATE, 1);
+                               AFMT_GENERIC7_IMMEDIATE_UPDATE, 1);
                break;
        default:
                break;
index ed385b1..30eae74 100644 (file)
@@ -281,7 +281,14 @@ struct dcn10_stream_enc_registers {
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC2_FRAME_UPDATE, mask_sh),\
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC3_FRAME_UPDATE, mask_sh),\
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC4_FRAME_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC0_IMMEDIATE_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC1_IMMEDIATE_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC2_IMMEDIATE_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC3_IMMEDIATE_UPDATE, mask_sh),\
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC4_IMMEDIATE_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC5_IMMEDIATE_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC6_IMMEDIATE_UPDATE, mask_sh),\
+       SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC7_IMMEDIATE_UPDATE, mask_sh),\
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC5_FRAME_UPDATE, mask_sh),\
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC6_FRAME_UPDATE, mask_sh),\
        SE_SF(DIG0_AFMT_VBI_PACKET_CONTROL1, AFMT_GENERIC7_FRAME_UPDATE, mask_sh),\
@@ -345,7 +352,14 @@ struct dcn10_stream_enc_registers {
        type AFMT_GENERIC2_FRAME_UPDATE;\
        type AFMT_GENERIC3_FRAME_UPDATE;\
        type AFMT_GENERIC4_FRAME_UPDATE;\
+       type AFMT_GENERIC0_IMMEDIATE_UPDATE;\
+       type AFMT_GENERIC1_IMMEDIATE_UPDATE;\
+       type AFMT_GENERIC2_IMMEDIATE_UPDATE;\
+       type AFMT_GENERIC3_IMMEDIATE_UPDATE;\
        type AFMT_GENERIC4_IMMEDIATE_UPDATE;\
+       type AFMT_GENERIC5_IMMEDIATE_UPDATE;\
+       type AFMT_GENERIC6_IMMEDIATE_UPDATE;\
+       type AFMT_GENERIC7_IMMEDIATE_UPDATE;\
        type AFMT_GENERIC5_FRAME_UPDATE;\
        type AFMT_GENERIC6_FRAME_UPDATE;\
        type AFMT_GENERIC7_FRAME_UPDATE;\
index 66180b4..c8cfd3b 100644 (file)
@@ -1457,8 +1457,8 @@ static void dcn20_update_dchubp_dpp(
 
        /* Any updates are handled in dc interface, just need to apply existing for plane enable */
        if ((pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed ||
-                       pipe_ctx->update_flags.bits.scaler || pipe_ctx->update_flags.bits.viewport)
-                       && pipe_ctx->stream->cursor_attributes.address.quad_part != 0) {
+                       pipe_ctx->update_flags.bits.scaler || viewport_changed == true) &&
+                       pipe_ctx->stream->cursor_attributes.address.quad_part != 0) {
                dc->hwss.set_cursor_position(pipe_ctx);
                dc->hwss.set_cursor_attribute(pipe_ctx);
 
index bf0044f..dcbf28d 100644 (file)
        LE_SF(DCIO_SOFT_RESET, UNIPHYB_SOFT_RESET, mask_sh),\
        LE_SF(DCIO_SOFT_RESET, UNIPHYC_SOFT_RESET, mask_sh),\
        LE_SF(DCIO_SOFT_RESET, UNIPHYD_SOFT_RESET, mask_sh),\
-       LE_SF(DCIO_SOFT_RESET, UNIPHYE_SOFT_RESET, mask_sh)
+       LE_SF(DCIO_SOFT_RESET, UNIPHYE_SOFT_RESET, mask_sh),\
+       LE_SF(RDPCSTX0_RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, mask_sh),\
+       LE_SF(RDPCSTX0_RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE, mask_sh)
 
 #define LINK_ENCODER_MASK_SH_LIST_DCN20(mask_sh)\
        LINK_ENCODER_MASK_SH_LIST_DCN10(mask_sh),\
index 790baf5..9140b3f 100644 (file)
@@ -3141,7 +3141,7 @@ static bool dcn20_validate_bandwidth_internal(struct dc *dc, struct dc_state *co
        int vlevel = 0;
        int pipe_split_from[MAX_PIPES];
        int pipe_cnt = 0;
-       display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
+       display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);
        DC_LOGGER_INIT(dc->ctx->logger);
 
        BW_VAL_TRACE_COUNT();
index 8e9fd59..2fbf879 100644 (file)
        DPCS_DCN2_MASK_SH_LIST(mask_sh),\
        LE_SF(DPCSTX0_DPCSTX_TX_CNTL, DPCS_TX_DATA_ORDER_INVERT_18_BIT, mask_sh),\
        LE_SF(RDPCSTX0_RDPCSTX_PHY_CNTL0, RDPCS_PHY_TX_VBOOST_LVL, mask_sh),\
-       LE_SF(RDPCSTX0_RDPCSTX_CLOCK_CNTL, RDPCS_TX_CLK_EN, mask_sh)
+       LE_SF(RDPCSTX0_RDPCSTX_CLOCK_CNTL, RDPCS_TX_CLK_EN, mask_sh),\
+       LE_SF(RDPCSTX0_RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, mask_sh),\
+       LE_SF(RDPCSTX0_RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE, mask_sh)
+
 
 void dcn30_link_encoder_construct(
        struct dcn20_link_encoder *enc20,
index 653a571..ebe0cc5 100644 (file)
@@ -491,6 +491,7 @@ static const struct dcn10_link_enc_hpd_registers link_enc_hpd_regs[] = {
 [id] = {\
        LE_DCN3_REG_LIST(id), \
        UNIPHY_DCN2_REG_LIST(phyid), \
+       SRI(DP_DPHY_INTERNAL_CTRL, DP, id) \
 }
 
 static const struct dce110_aux_registers_shift aux_shift = {
index b54814f..2beb284 100644 (file)
@@ -63,6 +63,7 @@ typedef struct {
 
 #define BPP_INVALID 0
 #define BPP_BLENDED_PIPE 0xffffffff
+#define DCN30_MAX_DSC_IMAGE_WIDTH 5184
 
 static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib);
 static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
@@ -3984,6 +3985,9 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                } else if (v->PlaneRequiredDISPCLKWithoutODMCombine > v->MaxDispclkRoundedDownToDFSGranularity) {
                                        v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_2to1;
                                        v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine2To1;
+                               } else if (v->DSCEnabled[k] && (v->HActive[k] > DCN30_MAX_DSC_IMAGE_WIDTH)) {
+                                       v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_2to1;
+                                       v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine2To1;
                                } else {
                                        v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_disabled;
                                        v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithoutODMCombine;
index 5994d2a..947d610 100644 (file)
@@ -230,6 +230,8 @@ struct clk_mgr_funcs {
 
        int (*get_dp_ref_clk_frequency)(struct clk_mgr *clk_mgr);
 
+       void (*set_low_power_state)(struct clk_mgr *clk_mgr);
+
        void (*init_clocks)(struct clk_mgr *clk_mgr);
 
        void (*enable_pme_wa) (struct clk_mgr *clk_mgr);
index c30437a..21011ed 100644 (file)
@@ -101,6 +101,13 @@ enum bp_pipe_control_action {
        ASIC_PIPE_INIT
 };
 
+enum bp_lvtma_control_action {
+       LVTMA_CONTROL_LCD_BLOFF = 2,
+       LVTMA_CONTROL_LCD_BLON = 3,
+       LVTMA_CONTROL_POWER_ON = 12,
+       LVTMA_CONTROL_POWER_OFF = 13
+};
+
 struct bp_encoder_control {
        enum bp_encoder_control_action action;
        enum engine_id engine_id;
index 89ef9f6..16df2a4 100644 (file)
@@ -431,6 +431,9 @@ struct fixed31_32 dc_fixpt_log(struct fixed31_32 arg);
  */
 static inline struct fixed31_32 dc_fixpt_pow(struct fixed31_32 arg1, struct fixed31_32 arg2)
 {
+       if (arg1.value == 0)
+               return arg2.value == 0 ? dc_fixpt_one : dc_fixpt_zero;
+
        return dc_fixpt_exp(
                dc_fixpt_mul(
                        dc_fixpt_log(arg1),
index 81820f3..d988533 100644 (file)
@@ -324,22 +324,44 @@ static void apply_below_the_range(struct core_freesync *core_freesync,
 
                /* Choose number of frames to insert based on how close it
                 * can get to the mid point of the variable range.
+                *  - Delta for CEIL: delta_from_mid_point_in_us_1
+                *  - Delta for FLOOR: delta_from_mid_point_in_us_2
                 */
-               if ((frame_time_in_us / mid_point_frames_ceil) > in_out_vrr->min_duration_in_us &&
-                               (delta_from_mid_point_in_us_1 < delta_from_mid_point_in_us_2 ||
-                                               mid_point_frames_floor < 2)) {
+               if ((last_render_time_in_us / mid_point_frames_ceil) < in_out_vrr->min_duration_in_us) {
+                       /* Check for out of range.
+                        * If using CEIL produces a value that is out of range,
+                        * then we are forced to use FLOOR.
+                        */
+                       frames_to_insert = mid_point_frames_floor;
+               } else if (mid_point_frames_floor < 2) {
+                       /* Check if FLOOR would result in non-LFC. In this case
+                        * choose to use CEIL
+                        */
+                       frames_to_insert = mid_point_frames_ceil;
+               } else if (delta_from_mid_point_in_us_1 < delta_from_mid_point_in_us_2) {
+                       /* If choosing CEIL results in a frame duration that is
+                        * closer to the mid point of the range.
+                        * Choose CEIL
+                        */
                        frames_to_insert = mid_point_frames_ceil;
-                       delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_2 -
-                                       delta_from_mid_point_in_us_1;
                } else {
+                       /* If choosing FLOOR results in a frame duration that is
+                        * closer to the mid point of the range.
+                        * Choose FLOOR
+                        */
                        frames_to_insert = mid_point_frames_floor;
-                       delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_1 -
-                                       delta_from_mid_point_in_us_2;
                }
 
                /* Prefer current frame multiplier when BTR is enabled unless it drifts
                 * too far from the midpoint
                 */
+               if (delta_from_mid_point_in_us_1 < delta_from_mid_point_in_us_2) {
+                       delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_2 -
+                                       delta_from_mid_point_in_us_1;
+               } else {
+                       delta_from_mid_point_delta_in_us = delta_from_mid_point_in_us_1 -
+                                       delta_from_mid_point_in_us_2;
+               }
                if (in_out_vrr->btr.frames_to_insert != 0 &&
                                delta_from_mid_point_delta_in_us < BTR_DRIFT_MARGIN) {
                        if (((last_render_time_in_us / in_out_vrr->btr.frames_to_insert) <
index 6c991de..fb962b9 100644 (file)
@@ -2204,14 +2204,17 @@ static const struct throttling_logging_label {
 };
 static void arcturus_log_thermal_throttling_event(struct smu_context *smu)
 {
+       int ret;
        int throttler_idx, throtting_events = 0, buf_idx = 0;
        struct amdgpu_device *adev = smu->adev;
        uint32_t throttler_status;
        char log_buf[256];
 
-       arcturus_get_smu_metrics_data(smu,
-                                     METRICS_THROTTLER_STATUS,
-                                     &throttler_status);
+       ret = arcturus_get_smu_metrics_data(smu,
+                                           METRICS_THROTTLER_STATUS,
+                                           &throttler_status);
+       if (ret)
+               return;
 
        memset(log_buf, 0, sizeof(log_buf));
        for (throttler_idx = 0; throttler_idx < ARRAY_SIZE(logging_label);
index c9cfe90..9ee8cf8 100644 (file)
@@ -204,8 +204,7 @@ static int smu10_set_min_deep_sleep_dcefclk(struct pp_hwmgr *hwmgr, uint32_t clo
 {
        struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-       if (smu10_data->need_min_deep_sleep_dcefclk &&
-               smu10_data->deep_sleep_dcefclk != clock) {
+       if (clock && smu10_data->deep_sleep_dcefclk != clock) {
                smu10_data->deep_sleep_dcefclk = clock;
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_SetMinDeepSleepDcefclk,
@@ -219,8 +218,7 @@ static int smu10_set_hard_min_dcefclk_by_freq(struct pp_hwmgr *hwmgr, uint32_t c
 {
        struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-       if (smu10_data->dcf_actual_hard_min_freq &&
-               smu10_data->dcf_actual_hard_min_freq != clock) {
+       if (clock && smu10_data->dcf_actual_hard_min_freq != clock) {
                smu10_data->dcf_actual_hard_min_freq = clock;
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_SetHardMinDcefclkByFreq,
@@ -234,8 +232,7 @@ static int smu10_set_hard_min_fclk_by_freq(struct pp_hwmgr *hwmgr, uint32_t cloc
 {
        struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-       if (smu10_data->f_actual_hard_min_freq &&
-               smu10_data->f_actual_hard_min_freq != clock) {
+       if (clock && smu10_data->f_actual_hard_min_freq != clock) {
                smu10_data->f_actual_hard_min_freq = clock;
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_SetHardMinFclkByFreq,
index 468bdd6..d572ba4 100644 (file)
@@ -363,17 +363,19 @@ int vega10_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v2_information *pp_table_info =
+               (struct phm_ppt_v2_information *)(hwmgr->pptable);
+       struct phm_tdp_table *tdp_table = pp_table_info->tdp_table;
        struct amdgpu_device *adev = hwmgr->adev;
-       int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       int high = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP;
+       int high = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP;
        uint32_t val;
 
-       if (low < range->min)
-               low = range->min;
-       if (high > range->max)
-               high = range->max;
+       /* compare them in unit celsius degree */
+       if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
+               low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       if (high > tdp_table->usSoftwareShutdownTemp)
+               high = tdp_table->usSoftwareShutdownTemp;
 
        if (low > high)
                return -EINVAL;
@@ -382,8 +384,8 @@ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5);
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1);
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high);
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low);
        val &= (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK) &
                        (~THM_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK) &
                        (~THM_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK);
index c15b975..7ace439 100644 (file)
@@ -170,17 +170,18 @@ int vega12_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega12_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v3_information *pptable_information =
+               (struct phm_ppt_v3_information *)hwmgr->pptable;
        struct amdgpu_device *adev = hwmgr->adev;
-       int low = VEGA12_THERMAL_MINIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       int high = VEGA12_THERMAL_MAXIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       int low = VEGA12_THERMAL_MINIMUM_ALERT_TEMP;
+       int high = VEGA12_THERMAL_MAXIMUM_ALERT_TEMP;
        uint32_t val;
 
-       if (low < range->min)
-               low = range->min;
-       if (high > range->max)
-               high = range->max;
+       /* compare them in unit celsius degree */
+       if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
+               low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       if (high > pptable_information->us_software_shutdown_temp)
+               high = pptable_information->us_software_shutdown_temp;
 
        if (low > high)
                return -EINVAL;
@@ -189,8 +190,8 @@ static int vega12_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5);
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1);
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high);
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low);
        val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK);
 
        WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val);
index 3b88396..ea70d73 100644 (file)
@@ -979,10 +979,7 @@ static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr)
 {
        struct vega20_hwmgr *data =
                        (struct vega20_hwmgr *)(hwmgr->backend);
-       uint64_t features_enabled;
-       int i;
-       bool enabled;
-       int ret = 0;
+       int i, ret = 0;
 
        PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr,
                        PPSMC_MSG_DisableAllSmuFeatures,
@@ -990,17 +987,8 @@ static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr)
                        "[DisableAllSMUFeatures] Failed to disable all smu features!",
                        return ret);
 
-       ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled);
-       PP_ASSERT_WITH_CODE(!ret,
-                       "[DisableAllSMUFeatures] Failed to get enabled smc features!",
-                       return ret);
-
-       for (i = 0; i < GNLD_FEATURES_MAX; i++) {
-               enabled = (features_enabled & data->smu_features[i].smu_feature_bitmap) ?
-                       true : false;
-               data->smu_features[i].enabled = enabled;
-               data->smu_features[i].supported = enabled;
-       }
+       for (i = 0; i < GNLD_FEATURES_MAX; i++)
+               data->smu_features[i].enabled = 0;
 
        return 0;
 }
@@ -1652,12 +1640,6 @@ static void vega20_init_powergate_state(struct pp_hwmgr *hwmgr)
 
        data->uvd_power_gated = true;
        data->vce_power_gated = true;
-
-       if (data->smu_features[GNLD_DPM_UVD].enabled)
-               data->uvd_power_gated = false;
-
-       if (data->smu_features[GNLD_DPM_VCE].enabled)
-               data->vce_power_gated = false;
 }
 
 static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
@@ -3230,10 +3212,11 @@ static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf)
 
 static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfeature_masks)
 {
-       uint64_t features_enabled;
-       uint64_t features_to_enable;
-       uint64_t features_to_disable;
-       int ret = 0;
+       struct vega20_hwmgr *data =
+                       (struct vega20_hwmgr *)(hwmgr->backend);
+       uint64_t features_enabled, features_to_enable, features_to_disable;
+       int i, ret = 0;
+       bool enabled;
 
        if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX))
                return -EINVAL;
@@ -3262,6 +3245,17 @@ static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe
                        return ret;
        }
 
+       /* Update the cached feature enablement state */
+       ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled);
+       if (ret)
+               return ret;
+
+       for (i = 0; i < GNLD_FEATURES_MAX; i++) {
+               enabled = (features_enabled & data->smu_features[i].smu_feature_bitmap) ?
+                       true : false;
+               data->smu_features[i].enabled = enabled;
+       }
+
        return 0;
 }
 
index 7add2f6..364162d 100644 (file)
@@ -240,17 +240,18 @@ int vega20_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega20_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v3_information *pptable_information =
+               (struct phm_ppt_v3_information *)hwmgr->pptable;
        struct amdgpu_device *adev = hwmgr->adev;
-       int low = VEGA20_THERMAL_MINIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       int high = VEGA20_THERMAL_MAXIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       int low = VEGA20_THERMAL_MINIMUM_ALERT_TEMP;
+       int high = VEGA20_THERMAL_MAXIMUM_ALERT_TEMP;
        uint32_t val;
 
-       if (low < range->min)
-               low = range->min;
-       if (high > range->max)
-               high = range->max;
+       /* compare them in unit celsius degree */
+       if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
+               low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       if (high > pptable_information->us_software_shutdown_temp)
+               high = pptable_information->us_software_shutdown_temp;
 
        if (low > high)
                return -EINVAL;
@@ -259,8 +260,8 @@ static int vega20_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5);
        val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1);
-       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
-       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
+       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high);
+       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low);
        val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK);
 
        WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val);
index 3865dbe..6387608 100644 (file)
@@ -95,6 +95,7 @@ static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
        MSG_MAP(TransferTableSmu2Dram,          PPSMC_MSG_TransferTableSmu2Dram,       0),
        MSG_MAP(TransferTableDram2Smu,          PPSMC_MSG_TransferTableDram2Smu,       0),
        MSG_MAP(UseDefaultPPTable,              PPSMC_MSG_UseDefaultPPTable,           0),
+       MSG_MAP(RunDcBtc,                       PPSMC_MSG_RunDcBtc,                    0),
        MSG_MAP(EnterBaco,                      PPSMC_MSG_EnterBaco,                   0),
        MSG_MAP(SetSoftMinByFreq,               PPSMC_MSG_SetSoftMinByFreq,            0),
        MSG_MAP(SetSoftMaxByFreq,               PPSMC_MSG_SetSoftMaxByFreq,            0),
@@ -775,7 +776,7 @@ static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu, bool enabl
                        ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 0, NULL);
                        if (ret)
                                return ret;
-                       if (adev->asic_type == CHIP_SIENNA_CICHLID) {
+                       if (adev->vcn.num_vcn_inst > 1) {
                                ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn,
                                                                  0x10000, NULL);
                                if (ret)
@@ -787,7 +788,7 @@ static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu, bool enabl
                        ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownVcn, 0, NULL);
                        if (ret)
                                return ret;
-                       if (adev->asic_type == CHIP_SIENNA_CICHLID) {
+                       if (adev->vcn.num_vcn_inst > 1) {
                                ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownVcn,
                                                                  0x10000, NULL);
                                if (ret)
@@ -1732,6 +1733,11 @@ static int sienna_cichlid_get_dpm_ultimate_freq(struct smu_context *smu,
        return ret;
 }
 
+static int sienna_cichlid_run_btc(struct smu_context *smu)
+{
+       return smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL);
+}
+
 static bool sienna_cichlid_is_baco_supported(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
@@ -2719,6 +2725,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
        .mode1_reset = smu_v11_0_mode1_reset,
        .get_dpm_ultimate_freq = sienna_cichlid_get_dpm_ultimate_freq,
        .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range,
+       .run_btc = sienna_cichlid_run_btc,
        .get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
        .set_pp_feature_mask = smu_cmn_set_pp_feature_mask,
 };
index ca570b1..e9de542 100644 (file)
@@ -532,7 +532,7 @@ static int malidp500_enable_memwrite(struct malidp_hw_device *hwdev,
                malidp_hw_write(hwdev, lower_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_HIGH);
                malidp_hw_write(hwdev, pitches[1], base + MALIDP_MW_P2_STRIDE);
-               /* fall through */
+               fallthrough;
        case 1:
                malidp_hw_write(hwdev, lower_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_HIGH);
@@ -869,7 +869,7 @@ static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev,
                malidp_hw_write(hwdev, lower_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_HIGH);
                malidp_hw_write(hwdev, pitches[1], base + MALIDP_MW_P2_STRIDE);
-               /* fall through */
+               fallthrough;
        case 1:
                malidp_hw_write(hwdev, lower_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_HIGH);
@@ -1324,7 +1324,7 @@ static irqreturn_t malidp_se_irq(int irq, void *arg)
                        break;
                case MW_RESTART:
                        drm_writeback_signal_completion(&malidp->mw_connector, 0);
-                       /* fall through - to a new start */
+                       fallthrough;    /* to a new start */
                case MW_START:
                        /* writeback started, need to emulate one-shot mode */
                        hw->disable_memwrite(hwdev);
index dd12b55..6a9fba0 100644 (file)
@@ -238,7 +238,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
                                        ast->dp501_fw_addr = NULL;
                                }
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 0x0c:
                        ast->tx_chip_type = AST_TX_DP501;
                }
index ce94f79..66b6740 100644 (file)
@@ -409,7 +409,6 @@ static bool nwl_dsi_read_packet(struct nwl_dsi *dsi, u32 status)
 
                switch (data_type) {
                case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE:
-                       fallthrough;
                case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE:
                        if (xfer->msg->rx_len > 1) {
                                /* read second byte */
@@ -418,7 +417,6 @@ static bool nwl_dsi_read_packet(struct nwl_dsi *dsi, u32 status)
                        }
                        fallthrough;
                case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
-                       fallthrough;
                case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
                        if (xfer->msg->rx_len > 0) {
                                /* read first byte */
index d7e65c8..9fef641 100644 (file)
@@ -61,10 +61,10 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
        switch (hparms->channels) {
        case 7 ... 8:
                conf0 |= HDMI_AUD_CONF0_I2S_EN3;
-               /* Fall-thru */
+               fallthrough;
        case 5 ... 6:
                conf0 |= HDMI_AUD_CONF0_I2S_EN2;
-               /* Fall-thru */
+               fallthrough;
        case 3 ... 4:
                conf0 |= HDMI_AUD_CONF0_I2S_EN1;
                /* Fall-thru */
index 86b9f0f..5b6e19e 100644 (file)
@@ -604,13 +604,13 @@ static void ti_sn_bridge_read_valid_rates(struct ti_sn_bridge *pdata,
                DRM_DEV_ERROR(pdata->dev,
                              "Unexpected max rate (%#x); assuming 5.4 GHz\n",
                              (int)dpcd_val);
-               /* fall through */
+               fallthrough;
        case DP_LINK_BW_5_4:
                rate_valid[7] = 1;
-               /* fall through */
+               fallthrough;
        case DP_LINK_BW_2_7:
                rate_valid[4] = 1;
-               /* fall through */
+               fallthrough;
        case DP_LINK_BW_1_62:
                rate_valid[1] = 1;
                break;
index f68c69a..9e1ad49 100644 (file)
@@ -34,6 +34,7 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_self_refresh_helper.h>
@@ -3106,7 +3107,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
        if (ret)
                DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
 
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 }
 EXPORT_SYMBOL(drm_atomic_helper_shutdown);
 
@@ -3246,7 +3247,7 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
        }
 
 unlock:
-       DRM_MODESET_LOCK_ALL_END(ctx, err);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
        if (err)
                return ERR_PTR(err);
 
@@ -3327,7 +3328,7 @@ int drm_atomic_helper_resume(struct drm_device *dev,
 
        err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
 
-       DRM_MODESET_LOCK_ALL_END(ctx, err);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
        drm_atomic_state_put(state);
 
        return err;
index a0735fb..7a01d09 100644 (file)
@@ -537,7 +537,7 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
        switch (map->type) {
        case _DRM_REGISTERS:
                iounmap(map->handle);
-               /* FALLTHROUGH */
+               fallthrough;
        case _DRM_FRAME_BUFFER:
                arch_phys_wc_del(map->mtrr);
                break;
index c93123f..138ff34 100644 (file)
@@ -294,7 +294,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
                                     crtc->gamma_size, &ctx);
 
 out:
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
        return ret;
 
 }
index 283bcc4..aecdd7e 100644 (file)
@@ -588,7 +588,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id))
                return -EACCES;
 
-       mutex_lock(&crtc->dev->mode_config.mutex);
        DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx,
                                   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
 
@@ -756,8 +755,7 @@ out:
        fb = NULL;
        mode = NULL;
 
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
-       mutex_unlock(&crtc->dev->mode_config.mutex);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 
        return ret;
 }
index a3c82e7..092c8c9 100644 (file)
@@ -492,7 +492,7 @@ int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
                case DP_DS_16BPC:
                        return 16;
                }
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index b23cb2f..67dd72e 100644 (file)
@@ -5040,8 +5040,8 @@ int drm_dp_mst_add_affected_dsc_crtcs(struct drm_atomic_state *state, struct drm
 
                crtc = conn_state->crtc;
 
-               if (WARN_ON(!crtc))
-                       return -EINVAL;
+               if (!crtc)
+                       continue;
 
                if (!drm_dp_mst_dsc_aux_for_port(pos->port))
                        continue;
index 901b078..db05f38 100644 (file)
@@ -428,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
        drm_mode_object_put(obj);
 out:
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
        return ret;
 }
 
@@ -470,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
                break;
        }
        drm_property_change_valid_put(prop, ref);
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 
        return ret;
 }
index 14b6f76..501b4fe 100644 (file)
@@ -1930,7 +1930,7 @@ void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
        default:
                WARN(1, "Invalid aspect ratio (0%x) on mode\n",
                     in->picture_aspect_ratio);
-               /* fall through */
+               fallthrough;
        case HDMI_PICTURE_ASPECT_NONE:
                out->flags |= DRM_MODE_FLAG_PIC_AR_NONE;
                break;
index b7b90b3..affe1cf 100644 (file)
@@ -792,7 +792,7 @@ static int setplane_internal(struct drm_plane *plane,
                                          crtc_x, crtc_y, crtc_w, crtc_h,
                                          src_x, src_y, src_w, src_h, &ctx);
 
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(plane->dev, ctx, ret);
 
        return ret;
 }
index d5a4cd8..c6404b8 100644 (file)
@@ -337,9 +337,16 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
 
                gpu->identity.model = gpu_read(gpu, VIVS_HI_CHIP_MODEL);
                gpu->identity.revision = gpu_read(gpu, VIVS_HI_CHIP_REV);
-               gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID);
                gpu->identity.customer_id = gpu_read(gpu, VIVS_HI_CHIP_CUSTOMER_ID);
-               gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID);
+
+               /*
+                * Reading these two registers on GC600 rev 0x19 result in a
+                * unhandled fault: external abort on non-linefetch
+                */
+               if (!etnaviv_is_model_rev(gpu, GC600, 0x19)) {
+                       gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID);
+                       gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID);
+               }
 
                /*
                 * !!!! HACK ALERT !!!!
index 4e3e95d..cd46c88 100644 (file)
@@ -89,12 +89,15 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
        u32 dma_addr;
        int change;
 
+       /* block scheduler */
+       drm_sched_stop(&gpu->sched, sched_job);
+
        /*
         * If the GPU managed to complete this jobs fence, the timout is
         * spurious. Bail out.
         */
        if (dma_fence_is_signaled(submit->out_fence))
-               return;
+               goto out_no_timeout;
 
        /*
         * If the GPU is still making forward progress on the front-end (which
@@ -105,12 +108,9 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
        change = dma_addr - gpu->hangcheck_dma_addr;
        if (change < 0 || change > 16) {
                gpu->hangcheck_dma_addr = dma_addr;
-               return;
+               goto out_no_timeout;
        }
 
-       /* block scheduler */
-       drm_sched_stop(&gpu->sched, sched_job);
-
        if(sched_job)
                drm_sched_increase_karma(sched_job);
 
@@ -120,6 +120,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
 
        drm_sched_resubmit_jobs(&gpu->sched);
 
+out_no_timeout:
        /* restart scheduler after GPU is usable again */
        drm_sched_start(&gpu->sched, true);
 }
index 7a6f6df..b38e9b5 100644 (file)
@@ -987,10 +987,10 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi,
        switch (length) {
        case 3:
                reg |= payload[2] << 16;
-               /* Fall through */
+               fallthrough;
        case 2:
                reg |= payload[1] << 8;
-               /* Fall through */
+               fallthrough;
        case 1:
                reg |= payload[0];
                exynos_dsi_write(dsi, DSIM_PAYLOAD_REG, reg);
@@ -1038,7 +1038,7 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi,
                                payload[1] = reg >> 16;
                                ++xfer->rx_done;
                        }
-                       /* Fall through */
+                       fallthrough;
                case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
                case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
                        payload[0] = reg >> 8;
@@ -1082,10 +1082,10 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi,
                switch (length) {
                case 3:
                        payload[2] = (reg >> 16) & 0xff;
-                       /* Fall through */
+                       fallthrough;
                case 2:
                        payload[1] = (reg >> 8) & 0xff;
-                       /* Fall through */
+                       fallthrough;
                case 1:
                        payload[0] = reg & 0xff;
                }
index 56a2b47..5147f59 100644 (file)
@@ -92,7 +92,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
        offset = fbi->var.xoffset * fb->format->cpp[0];
        offset += fbi->var.yoffset * fb->pitches[0];
 
-       fbi->screen_base = exynos_gem->kvaddr + offset;
+       fbi->screen_buffer = exynos_gem->kvaddr + offset;
        fbi->screen_size = size;
        fbi->fix.smem_len = size;
 
index 7445748..74e926a 100644 (file)
@@ -40,7 +40,7 @@ struct exynos_drm_gem {
        unsigned int            flags;
        unsigned long           size;
        void                    *cookie;
-       void __iomem            *kvaddr;
+       void                    *kvaddr;
        dma_addr_t              dma_addr;
        unsigned long           dma_attrs;
        struct sg_table         *sgt;
index 86fac67..3c6d9f3 100644 (file)
@@ -101,19 +101,19 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,
                break;
        case DRM_FORMAT_ARGB8888:
                alpha = DCU_LAYER_AB_WHOLE_FRAME;
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_XRGB8888:
                bpp = FSL_DCU_ARGB8888;
                break;
        case DRM_FORMAT_ARGB4444:
                alpha = DCU_LAYER_AB_WHOLE_FRAME;
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_XRGB4444:
                bpp = FSL_DCU_ARGB4444;
                break;
        case DRM_FORMAT_ARGB1555:
                alpha = DCU_LAYER_AB_WHOLE_FRAME;
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_XRGB1555:
                bpp = FSL_DCU_ARGB1555;
                break;
index 8c55f5b..f4053dd 100644 (file)
@@ -712,7 +712,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
                        switch (intel_dsi->pixel_format) {
                        default:
                                MISSING_CASE(intel_dsi->pixel_format);
-                               /* fallthrough */
+                               fallthrough;
                        case MIPI_DSI_FMT_RGB565:
                                tmp |= PIX_FMT_RGB565;
                                break;
@@ -739,7 +739,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
                        switch (intel_dsi->video_mode_format) {
                        default:
                                MISSING_CASE(intel_dsi->video_mode_format);
-                               /* fallthrough */
+                               fallthrough;
                        case VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS:
                                tmp |= VIDEO_MODE_SYNC_EVENT;
                                break;
@@ -792,7 +792,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
                switch (pipe) {
                default:
                        MISSING_CASE(pipe);
-                       /* fallthrough */
+                       fallthrough;
                case PIPE_A:
                        tmp |= TRANS_DDI_EDP_INPUT_A_ON;
                        break;
index c53c85d..a0a41ec 100644 (file)
@@ -905,7 +905,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
                        drm_dbg_kms(&dev_priv->drm,
                                    "VBT tp1 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
                                    psr_table->tp1_wakeup_time);
-                       /* fallthrough */
+                       fallthrough;
                case 2:
                        dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
                        break;
@@ -925,7 +925,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
                        drm_dbg_kms(&dev_priv->drm,
                                    "VBT tp2_tp3 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
                                    psr_table->tp2_tp3_wakeup_time);
-                       /* fallthrough */
+                       fallthrough;
                case 2:
                        dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 2500;
                break;
@@ -1775,7 +1775,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv,
                switch (child->hdmi_max_data_rate) {
                default:
                        MISSING_CASE(child->hdmi_max_data_rate);
-                       /* fall through */
+                       fallthrough;
                case HDMI_MAX_DATA_RATE_PLATFORM:
                        max_tmds_clock = 0;
                        break;
index bb91dac..91a8161 100644 (file)
@@ -326,7 +326,7 @@ static void pnv_get_cdclk(struct drm_i915_private *dev_priv,
        default:
                drm_err(&dev_priv->drm,
                        "Unknown pnv display core clock 0x%04x\n", gcfgc);
-               /* fall through */
+               fallthrough;
        case GC_DISPLAY_CLOCK_133_MHZ_PNV:
                cdclk_config->cdclk = 133333;
                break;
@@ -766,7 +766,7 @@ static void bdw_set_cdclk(struct drm_i915_private *dev_priv,
        switch (cdclk) {
        default:
                MISSING_CASE(cdclk);
-               /* fall through */
+               fallthrough;
        case 337500:
                val |= LCPLL_CLK_FREQ_337_5_BDW;
                break;
@@ -1042,7 +1042,7 @@ static void skl_set_cdclk(struct drm_i915_private *dev_priv,
                drm_WARN_ON(&dev_priv->drm,
                            cdclk != dev_priv->cdclk.hw.bypass);
                drm_WARN_ON(&dev_priv->drm, vco != 0);
-               /* fall through */
+               fallthrough;
        case 308571:
        case 337500:
                freq_select = CDCLK_FREQ_337_308;
@@ -1333,7 +1333,7 @@ static void icl_readout_refclk(struct drm_i915_private *dev_priv,
        switch (dssm) {
        default:
                MISSING_CASE(dssm);
-               /* fall through */
+               fallthrough;
        case ICL_DSSM_CDCLK_PLL_REFCLK_24MHz:
                cdclk_config->ref = 24000;
                break;
@@ -1561,7 +1561,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
                drm_WARN_ON(&dev_priv->drm,
                            cdclk != dev_priv->cdclk.hw.bypass);
                drm_WARN_ON(&dev_priv->drm, vco != 0);
-               /* fall through */
+               fallthrough;
        case 2:
                divider = BXT_CDCLK_CD2X_DIV_SEL_1;
                break;
index eccaa79..6968de4 100644 (file)
@@ -52,7 +52,7 @@ cnl_get_procmon_ref_values(struct drm_i915_private *dev_priv, enum phy phy)
        switch (val & (PROCESS_INFO_MASK | VOLTAGE_INFO_MASK)) {
        default:
                MISSING_CASE(val);
-               /* fall through */
+               fallthrough;
        case VOLTAGE_INFO_0_85V | PROCESS_INFO_DOT_0:
                procmon = &cnl_procmon_values[PROCMON_0_85V_DOT_0];
                break;
@@ -320,7 +320,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv,
                        break;
                default:
                        MISSING_CASE(lane_count);
-                       /* fall-through */
+                       fallthrough;
                case 4:
                        lane_mask = PWR_UP_ALL_LANES;
                        break;
@@ -337,7 +337,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv,
                        break;
                default:
                        MISSING_CASE(lane_count);
-                       /* fall-through */
+                       fallthrough;
                case 4:
                        lane_mask = PWR_UP_ALL_LANES;
                        break;
index 2c484b5..a49ff3a 100644 (file)
@@ -1888,7 +1888,7 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder,
                switch (tmp & TRANS_DDI_EDP_INPUT_MASK) {
                default:
                        MISSING_CASE(tmp & TRANS_DDI_EDP_INPUT_MASK);
-                       /* fallthrough */
+                       fallthrough;
                case TRANS_DDI_EDP_INPUT_A_ON:
                case TRANS_DDI_EDP_INPUT_A_ONOFF:
                        *pipe_mask = BIT(PIPE_A);
@@ -4268,7 +4268,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
                        pipe_config->hdmi_scrambling = true;
                if (temp & TRANS_DDI_HIGH_TMDS_CHAR_RATE)
                        pipe_config->hdmi_high_tmds_clock_ratio = true;
-               /* fall through */
+               fallthrough;
        case TRANS_DDI_MODE_SELECT_DVI:
                pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
                pipe_config->lane_count = 4;
index 729ec6e..6832567 100644 (file)
@@ -2029,12 +2029,12 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane)
        case I915_FORMAT_MOD_Y_TILED_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 128;
-               /* fall through */
+               fallthrough;
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 64;
-               /* fall through */
+               fallthrough;
        case I915_FORMAT_MOD_Y_TILED:
                if (IS_GEN(dev_priv, 2) || HAS_128_BYTE_Y_TILING(dev_priv))
                        return 128;
@@ -2043,7 +2043,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane)
        case I915_FORMAT_MOD_Yf_TILED_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 128;
-               /* fall through */
+               fallthrough;
        case I915_FORMAT_MOD_Yf_TILED:
                switch (cpp) {
                case 1:
@@ -2185,7 +2185,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (is_semiplanar_uv_plane(fb, color_plane))
                        return intel_tile_row_size(fb, color_plane);
-               /* Fall-through */
+               fallthrough;
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
                return 16 * 1024;
        case I915_FORMAT_MOD_Y_TILED_CCS:
@@ -2194,7 +2194,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
                if (INTEL_GEN(dev_priv) >= 12 &&
                    is_semiplanar_uv_plane(fb, color_plane))
                        return intel_tile_row_size(fb, color_plane);
-               /* Fall-through */
+               fallthrough;
        case I915_FORMAT_MOD_Yf_TILED:
                return 1 * 1024 * 1024;
        default:
@@ -6211,7 +6211,7 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
        case DRM_FORMAT_ARGB16161616F:
                if (INTEL_GEN(dev_priv) >= 11)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                drm_dbg_kms(&dev_priv->drm,
                            "[PLANE:%d:%s] FB:%d unsupported scaling format 0x%x\n",
@@ -10896,7 +10896,7 @@ static void hsw_get_ddi_pll(struct drm_i915_private *dev_priv, enum port port,
                break;
        default:
                MISSING_CASE(ddi_pll_sel);
-               /* fall through */
+               fallthrough;
        case PORT_CLK_SEL_NONE:
                return;
        }
@@ -10956,10 +10956,10 @@ static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
                        drm_WARN(dev, 1,
                                 "unknown pipe linked to transcoder %s\n",
                                 transcoder_name(panel_transcoder));
-                       /* fall through */
+                       fallthrough;
                case TRANS_DDI_EDP_INPUT_A_ONOFF:
                        force_thru = true;
-                       /* fall through */
+                       fallthrough;
                case TRANS_DDI_EDP_INPUT_A_ON:
                        trans_pipe = PIPE_A;
                        break;
@@ -13183,7 +13183,7 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
                case INTEL_OUTPUT_DDI:
                        if (drm_WARN_ON(dev, !HAS_DDI(to_i915(dev))))
                                break;
-                       /* else, fall through */
+                       fallthrough;
                case INTEL_OUTPUT_DP:
                case INTEL_OUTPUT_HDMI:
                case INTEL_OUTPUT_EDP:
@@ -14930,7 +14930,7 @@ static int intel_atomic_check(struct drm_device *dev,
        if (any_ms && !check_digital_port_conflicts(state)) {
                drm_dbg_kms(&dev_priv->drm,
                            "rejecting conflicting digital port configuration\n");
-               ret = EINVAL;
+               ret = -EINVAL;
                goto fail;
        }
 
index 3644752..5a5cfe2 100644 (file)
@@ -2044,9 +2044,12 @@ DEFINE_SHOW_ATTRIBUTE(i915_hdcp_sink_capability);
 static int i915_lpsp_capability_show(struct seq_file *m, void *data)
 {
        struct drm_connector *connector = m->private;
-       struct intel_encoder *encoder =
-                       intel_attached_encoder(to_intel_connector(connector));
        struct drm_i915_private *i915 = to_i915(connector->dev);
+       struct intel_encoder *encoder;
+
+       encoder = intel_attached_encoder(to_intel_connector(connector));
+       if (!encoder)
+               return -ENODEV;
 
        if (connector->status != connector_status_connected)
                return -ENODEV;
index 0c713e8..e0fcb89 100644 (file)
@@ -4146,6 +4146,12 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
                        .hsw.idx = TGL_PW_CTL_IDX_DDI_TC6,
                },
        },
+       {
+               .name = "TC cold off",
+               .domains = TGL_TC_COLD_OFF_POWER_DOMAINS,
+               .ops = &tgl_tc_cold_off_ops,
+               .id = DISP_PW_ID_NONE,
+       },
        {
                .name = "AUX A",
                .domains = TGL_AUX_A_IO_POWER_DOMAINS,
@@ -4332,12 +4338,6 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
                        .hsw.irq_pipe_mask = BIT(PIPE_D),
                },
        },
-       {
-               .name = "TC cold off",
-               .domains = TGL_TC_COLD_OFF_POWER_DOMAINS,
-               .ops = &tgl_tc_cold_off_ops,
-               .id = DISP_PW_ID_NONE,
-       },
 };
 
 static const struct i915_power_well_desc rkl_power_wells[] = {
@@ -5240,10 +5240,10 @@ struct buddy_page_mask {
 };
 
 static const struct buddy_page_mask tgl_buddy_page_masks[] = {
-       { .num_channels = 1, .type = INTEL_DRAM_LPDDR4, .page_mask = 0xE },
        { .num_channels = 1, .type = INTEL_DRAM_DDR4,   .page_mask = 0xF },
        { .num_channels = 2, .type = INTEL_DRAM_LPDDR4, .page_mask = 0x1C },
        { .num_channels = 2, .type = INTEL_DRAM_DDR4,   .page_mask = 0x1F },
+       { .num_channels = 4, .type = INTEL_DRAM_LPDDR4, .page_mask = 0x38 },
        {}
 };
 
index aeb6ee3..afa7a37 100644 (file)
@@ -892,7 +892,7 @@ static int hsw_ddi_wrpll_get_freq(struct drm_i915_private *dev_priv,
                        refclk = dev_priv->dpll.ref_clks.nssc;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case WRPLL_REF_PCH_SSC:
                /*
                 * We could calculate spread here, but our checking
@@ -2977,7 +2977,7 @@ static bool icl_calc_tbt_pll(struct intel_crtc_state *crtc_state,
                switch (dev_priv->dpll.ref_clks.nssc) {
                default:
                        MISSING_CASE(dev_priv->dpll.ref_clks.nssc);
-                       /* fall-through */
+                       fallthrough;
                case 19200:
                        *pll_params = tgl_tbt_pll_19_2MHz_values;
                        break;
@@ -2992,7 +2992,7 @@ static bool icl_calc_tbt_pll(struct intel_crtc_state *crtc_state,
                switch (dev_priv->dpll.ref_clks.nssc) {
                default:
                        MISSING_CASE(dev_priv->dpll.ref_clks.nssc);
-                       /* fall-through */
+                       fallthrough;
                case 19200:
                case 38400:
                        *pll_params = icl_tbt_pll_19_2MHz_values;
@@ -3120,7 +3120,7 @@ static bool icl_mg_pll_find_divisors(int clock_khz, bool is_dp, bool use_ssc,
                        switch (div1) {
                        default:
                                MISSING_CASE(div1);
-                               /* fall through */
+                               fallthrough;
                        case 2:
                                hsdiv = MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_2;
                                break;
index bbde3b1..4072d70 100644 (file)
@@ -229,7 +229,7 @@ int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
        case DRM_MODE_SCALE_NONE:
                WARN_ON(adjusted_mode->crtc_hdisplay != crtc_state->pipe_src_w);
                WARN_ON(adjusted_mode->crtc_vdisplay != crtc_state->pipe_src_h);
-               /* fall through */
+               fallthrough;
        case DRM_MODE_SCALE_FULLSCREEN:
                x = y = 0;
                width = adjusted_mode->crtc_hdisplay;
index 2da4388..5e9fb34 100644 (file)
@@ -1531,7 +1531,7 @@ static void intel_sdvo_pre_enable(struct intel_atomic_state *state,
        default:
                drm_WARN(&dev_priv->drm, 1,
                         "unknown pixel multiplier specified\n");
-               /* fall through */
+               fallthrough;
        case 1: rate = SDVO_CLOCK_RATE_MULT_1X; break;
        case 2: rate = SDVO_CLOCK_RATE_MULT_2X; break;
        case 4: rate = SDVO_CLOCK_RATE_MULT_4X; break;
@@ -2549,19 +2549,19 @@ intel_sdvo_guess_ddc_bus(struct intel_sdvo *sdvo)
        switch (sdvo->controlled_output) {
        case SDVO_OUTPUT_LVDS1:
                mask |= SDVO_OUTPUT_LVDS1;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_LVDS0:
                mask |= SDVO_OUTPUT_LVDS0;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_TMDS1:
                mask |= SDVO_OUTPUT_TMDS1;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_TMDS0:
                mask |= SDVO_OUTPUT_TMDS0;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_RGB1:
                mask |= SDVO_OUTPUT_RGB1;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_RGB0:
                mask |= SDVO_OUTPUT_RGB0;
                break;
index d03860f..c89f5f7 100644 (file)
@@ -2147,7 +2147,7 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
                case DRM_FORMAT_RGB565:
                        if (INTEL_GEN(dev_priv) >= 11)
                                break;
-                       /* fall through */
+                       fallthrough;
                case DRM_FORMAT_C8:
                case DRM_FORMAT_XRGB16161616F:
                case DRM_FORMAT_XBGR16161616F:
@@ -2702,7 +2702,7 @@ static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane,
                if (modifier == DRM_FORMAT_MOD_LINEAR ||
                    modifier == I915_FORMAT_MOD_X_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2733,7 +2733,7 @@ static bool snb_sprite_format_mod_supported(struct drm_plane *_plane,
                if (modifier == DRM_FORMAT_MOD_LINEAR ||
                    modifier == I915_FORMAT_MOD_X_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2768,7 +2768,7 @@ static bool vlv_sprite_format_mod_supported(struct drm_plane *_plane,
                if (modifier == DRM_FORMAT_MOD_LINEAR ||
                    modifier == I915_FORMAT_MOD_X_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2801,7 +2801,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_ABGR8888:
                if (is_ccs_modifier(modifier))
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_RGB565:
        case DRM_FORMAT_XRGB2101010:
        case DRM_FORMAT_XBGR2101010:
@@ -2819,7 +2819,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_XVYU2101010:
                if (modifier == I915_FORMAT_MOD_Yf_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_C8:
        case DRM_FORMAT_XBGR16161616F:
        case DRM_FORMAT_ABGR16161616F:
@@ -2834,7 +2834,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
                    modifier == I915_FORMAT_MOD_X_TILED ||
                    modifier == I915_FORMAT_MOD_Y_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2860,7 +2860,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (!gen12_plane_supports_mc_ccs(dev_priv, plane->id))
                        return false;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_MOD_LINEAR:
        case I915_FORMAT_MOD_X_TILED:
        case I915_FORMAT_MOD_Y_TILED:
@@ -2877,7 +2877,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_ABGR8888:
                if (is_ccs_modifier(modifier))
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_YUYV:
        case DRM_FORMAT_YVYU:
        case DRM_FORMAT_UYVY:
@@ -2889,7 +2889,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_P016:
                if (modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS)
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_RGB565:
        case DRM_FORMAT_XRGB2101010:
        case DRM_FORMAT_XBGR2101010:
@@ -2910,7 +2910,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
                    modifier == I915_FORMAT_MOD_X_TILED ||
                    modifier == I915_FORMAT_MOD_Y_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 5b5dc86..8f67aef 100644 (file)
@@ -159,7 +159,7 @@ int intel_tc_port_fia_max_lane_count(struct intel_digital_port *dig_port)
        switch (lane_mask) {
        default:
                MISSING_CASE(lane_mask);
-               /* fall-through */
+               fallthrough;
        case 0x1:
        case 0x2:
        case 0x4:
index b233685..753f82d 100644 (file)
@@ -209,7 +209,7 @@ static vm_fault_t i915_error_to_vmf_fault(int err)
        switch (err) {
        default:
                WARN_ONCE(err, "unhandled error in %s: %i\n", __func__, err);
-               /* fallthrough */
+               fallthrough;
        case -EIO: /* shmemfs failure from swap device */
        case -EFAULT: /* purged object */
        case -ENODEV: /* bad object, how did you get here! */
index 7050519..d15ff67 100644 (file)
@@ -276,7 +276,7 @@ static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
        switch (type) {
        default:
                MISSING_CASE(type);
-               /* fallthrough - to use PAGE_KERNEL anyway */
+               fallthrough;    /* to use PAGE_KERNEL anyway */
        case I915_MAP_WB:
                pgprot = PAGE_KERNEL;
                break;
index e0f21f1..0be5e86 100644 (file)
@@ -249,7 +249,7 @@ static void vlv_get_stolen_reserved(struct drm_i915_private *i915,
        switch (reg_val & GEN7_STOLEN_RESERVED_SIZE_MASK) {
        default:
                MISSING_CASE(reg_val & GEN7_STOLEN_RESERVED_SIZE_MASK);
-               /* fall through */
+               fallthrough;
        case GEN7_STOLEN_RESERVED_1M:
                *size = 1024 * 1024;
                break;
@@ -416,7 +416,7 @@ static int i915_gem_init_stolen(struct drm_i915_private *i915)
        case 4:
                if (!IS_G4X(i915))
                        break;
-               /* fall through */
+               fallthrough;
        case 5:
                g4x_get_stolen_reserved(i915, uncore,
                                        &reserved_base, &reserved_size);
@@ -445,7 +445,7 @@ static int i915_gem_init_stolen(struct drm_i915_private *i915)
                break;
        default:
                MISSING_CASE(INTEL_GEN(i915));
-               /* fall-through */
+               fallthrough;
        case 11:
        case 12:
                icl_get_stolen_reserved(i915, uncore,
index dd1a42c..26087dd 100644 (file)
@@ -213,7 +213,7 @@ u32 intel_engine_context_size(struct intel_gt *gt, u8 class)
                break;
        default:
                MISSING_CASE(class);
-               /* fall through */
+               fallthrough;
        case VIDEO_DECODE_CLASS:
        case VIDEO_ENHANCEMENT_CLASS:
        case COPY_ENGINE_CLASS:
index 62979ea..99e28d9 100644 (file)
@@ -1437,7 +1437,7 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
        switch (vma->ggtt_view.type) {
        default:
                GEM_BUG_ON(vma->ggtt_view.type);
-               /* fall through */
+               fallthrough;
        case I915_GGTT_VIEW_NORMAL:
                vma->pages = vma->obj->mm.pages;
                return 0;
index 94915f6..898593c 100644 (file)
@@ -100,7 +100,7 @@ static void set_hwsp(struct intel_engine_cs *engine, u32 offset)
                 */
                default:
                        GEM_BUG_ON(engine->id);
-                       /* fallthrough */
+                       fallthrough;
                case RCS0:
                        hwsp = RENDER_HWS_PGA_GEN7;
                        break;
index 072725a..ad86c5e 100644 (file)
@@ -70,6 +70,7 @@ static void vgpu_pci_cfg_mem_write(struct intel_vgpu *vgpu, unsigned int off,
 {
        u8 *cfg_base = vgpu_cfg_space(vgpu);
        u8 mask, new, old;
+       pci_power_t pwr;
        int i = 0;
 
        for (; i < bytes && (off + i < sizeof(pci_cfg_space_rw_bmp)); i++) {
@@ -91,6 +92,15 @@ static void vgpu_pci_cfg_mem_write(struct intel_vgpu *vgpu, unsigned int off,
        /* For other configuration space directly copy as it is. */
        if (i < bytes)
                memcpy(cfg_base + off + i, src + i, bytes - i);
+
+       if (off == vgpu->cfg_space.pmcsr_off && vgpu->cfg_space.pmcsr_off) {
+               pwr = (pci_power_t __force)(*(u16*)(&vgpu_cfg_space(vgpu)[off])
+                       & PCI_PM_CTRL_STATE_MASK);
+               if (pwr == PCI_D3hot)
+                       vgpu->d3_entered = true;
+               gvt_dbg_core("vgpu-%d power status changed to %d\n",
+                            vgpu->id, pwr);
+       }
 }
 
 /**
@@ -366,6 +376,7 @@ void intel_vgpu_init_cfg_space(struct intel_vgpu *vgpu,
        struct intel_gvt *gvt = vgpu->gvt;
        const struct intel_gvt_device_info *info = &gvt->device_info;
        u16 *gmch_ctl;
+       u8 next;
 
        memcpy(vgpu_cfg_space(vgpu), gvt->firmware.cfg_space,
               info->cfg_space_size);
@@ -401,6 +412,19 @@ void intel_vgpu_init_cfg_space(struct intel_vgpu *vgpu,
                pci_resource_len(gvt->gt->i915->drm.pdev, 2);
 
        memset(vgpu_cfg_space(vgpu) + PCI_ROM_ADDRESS, 0, 4);
+
+       /* PM Support */
+       vgpu->cfg_space.pmcsr_off = 0;
+       if (vgpu_cfg_space(vgpu)[PCI_STATUS] & PCI_STATUS_CAP_LIST) {
+               next = vgpu_cfg_space(vgpu)[PCI_CAPABILITY_LIST];
+               do {
+                       if (vgpu_cfg_space(vgpu)[next + PCI_CAP_LIST_ID] == PCI_CAP_ID_PM) {
+                               vgpu->cfg_space.pmcsr_off = next + PCI_PM_CTRL;
+                               break;
+                       }
+                       next = vgpu_cfg_space(vgpu)[next + PCI_CAP_LIST_NEXT];
+               } while (next);
+       }
 }
 
 /**
index 2100161..a3a4305 100644 (file)
@@ -2501,7 +2501,7 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu)
        return create_scratch_page_tree(vgpu);
 }
 
-static void intel_vgpu_destroy_all_ppgtt_mm(struct intel_vgpu *vgpu)
+void intel_vgpu_destroy_all_ppgtt_mm(struct intel_vgpu *vgpu)
 {
        struct list_head *pos, *n;
        struct intel_vgpu_mm *mm;
index 320b8d6..52d0d88 100644 (file)
@@ -279,4 +279,6 @@ int intel_vgpu_emulate_ggtt_mmio_read(struct intel_vgpu *vgpu,
 int intel_vgpu_emulate_ggtt_mmio_write(struct intel_vgpu *vgpu,
        unsigned int off, void *p_data, unsigned int bytes);
 
+void intel_vgpu_destroy_all_ppgtt_mm(struct intel_vgpu *vgpu);
+
 #endif /* _GVT_GTT_H_ */
index a4a6db6..ff7f251 100644 (file)
@@ -106,6 +106,7 @@ struct intel_vgpu_pci_bar {
 struct intel_vgpu_cfg_space {
        unsigned char virtual_cfg_space[PCI_CFG_SPACE_EXP_SIZE];
        struct intel_vgpu_pci_bar bar[INTEL_GVT_MAX_BAR_NUM];
+       u32 pmcsr_off;
 };
 
 #define vgpu_cfg_space(vgpu) ((vgpu)->cfg_space.virtual_cfg_space)
@@ -198,6 +199,8 @@ struct intel_vgpu {
        struct intel_vgpu_submission submission;
        struct radix_tree_root page_track_tree;
        u32 hws_pga[I915_NUM_ENGINES];
+       /* Set on PCI_D3, reset on DMLR, not reflecting the actual PM state */
+       bool d3_entered;
 
        struct dentry *debugfs;
 
index 63bba7b..05f3bc9 100644 (file)
@@ -1226,7 +1226,7 @@ static int handle_g2v_notification(struct intel_vgpu *vgpu, int notification)
        switch (notification) {
        case VGT_G2V_PPGTT_L3_PAGE_TABLE_CREATE:
                root_entry_type = GTT_TYPE_PPGTT_ROOT_L3_ENTRY;
-               /* fall through */
+               fallthrough;
        case VGT_G2V_PPGTT_L4_PAGE_TABLE_CREATE:
                mm = intel_vgpu_get_ppgtt_mm(vgpu, root_entry_type, pdps);
                return PTR_ERR_OR_ZERO(mm);
index 7d36162..8fa9b31 100644 (file)
@@ -257,6 +257,7 @@ void intel_gvt_release_vgpu(struct intel_vgpu *vgpu)
        intel_gvt_deactivate_vgpu(vgpu);
 
        mutex_lock(&vgpu->vgpu_lock);
+       vgpu->d3_entered = false;
        intel_vgpu_clean_workloads(vgpu, ALL_ENGINES);
        intel_vgpu_dmabuf_cleanup(vgpu);
        mutex_unlock(&vgpu->vgpu_lock);
@@ -393,6 +394,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
        INIT_RADIX_TREE(&vgpu->page_track_tree, GFP_KERNEL);
        idr_init(&vgpu->object_idr);
        intel_vgpu_init_cfg_space(vgpu, param->primary);
+       vgpu->d3_entered = false;
 
        ret = intel_vgpu_init_mmio(vgpu);
        if (ret)
@@ -557,10 +559,15 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr,
        /* full GPU reset or device model level reset */
        if (engine_mask == ALL_ENGINES || dmlr) {
                intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0);
-               intel_vgpu_invalidate_ppgtt(vgpu);
+               if (engine_mask == ALL_ENGINES)
+                       intel_vgpu_invalidate_ppgtt(vgpu);
                /*fence will not be reset during virtual reset */
                if (dmlr) {
-                       intel_vgpu_reset_gtt(vgpu);
+                       if(!vgpu->d3_entered) {
+                               intel_vgpu_invalidate_ppgtt(vgpu);
+                               intel_vgpu_destroy_all_ppgtt_mm(vgpu);
+                       }
+                       intel_vgpu_reset_ggtt(vgpu, true);
                        intel_vgpu_reset_resource(vgpu);
                }
 
@@ -572,7 +579,14 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr,
                        intel_vgpu_reset_cfg_space(vgpu);
                        /* only reset the failsafe mode when dmlr reset */
                        vgpu->failsafe = false;
-                       vgpu->pv_notified = false;
+                       /*
+                        * PCI_D0 is set before dmlr, so reset d3_entered here
+                        * after done using.
+                        */
+                       if(vgpu->d3_entered)
+                               vgpu->d3_entered = false;
+                       else
+                               vgpu->pv_notified = false;
                }
        }
 
index 372354d..5ac4a99 100644 (file)
@@ -1204,6 +1204,12 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,
        return dst;
 }
 
+static inline bool cmd_desc_is(const struct drm_i915_cmd_descriptor * const desc,
+                              const u32 cmd)
+{
+       return desc->cmd.value == (cmd & desc->cmd.mask);
+}
+
 static bool check_cmd(const struct intel_engine_cs *engine,
                      const struct drm_i915_cmd_descriptor *desc,
                      const u32 *cmd, u32 length)
@@ -1242,19 +1248,19 @@ static bool check_cmd(const struct intel_engine_cs *engine,
                         * allowed mask/value pair given in the whitelist entry.
                         */
                        if (reg->mask) {
-                               if (desc->cmd.value == MI_LOAD_REGISTER_MEM) {
+                               if (cmd_desc_is(desc, MI_LOAD_REGISTER_MEM)) {
                                        DRM_DEBUG("CMD: Rejected LRM to masked register 0x%08X\n",
                                                  reg_addr);
                                        return false;
                                }
 
-                               if (desc->cmd.value == MI_LOAD_REGISTER_REG) {
+                               if (cmd_desc_is(desc, MI_LOAD_REGISTER_REG)) {
                                        DRM_DEBUG("CMD: Rejected LRR to masked register 0x%08X\n",
                                                  reg_addr);
                                        return false;
                                }
 
-                               if (desc->cmd.value == MI_LOAD_REGISTER_IMM(1) &&
+                               if (cmd_desc_is(desc, MI_LOAD_REGISTER_IMM(1)) &&
                                    (offset + 2 > length ||
                                     (cmd[offset + 1] & reg->mask) != reg->value)) {
                                        DRM_DEBUG("CMD: Rejected LRI to masked register 0x%08X\n",
@@ -1478,7 +1484,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
                        break;
                }
 
-               if (desc->cmd.value == MI_BATCH_BUFFER_START) {
+               if (cmd_desc_is(desc, MI_BATCH_BUFFER_START)) {
                        ret = check_bbstart(cmd, offset, length, batch_length,
                                            batch_addr, shadow_addr,
                                            jump_whitelist);
index 6a3a2ce..3e6cbb0 100644 (file)
@@ -1159,7 +1159,7 @@ static void engine_record_registers(struct intel_engine_coredump *ee)
                        switch (engine->id) {
                        default:
                                MISSING_CASE(engine->id);
-                               /* fall through */
+                               fallthrough;
                        case RCS0:
                                mmio = RENDER_HWS_PGA_GEN7;
                                break;
index 28bc5f1..69c0fa2 100644 (file)
@@ -445,8 +445,6 @@ static void i915_pmu_event_destroy(struct perf_event *event)
                container_of(event->pmu, typeof(*i915), pmu.base);
 
        drm_WARN_ON(&i915->drm, event->parent);
-
-       module_put(THIS_MODULE);
 }
 
 static int
@@ -476,7 +474,7 @@ config_status(struct drm_i915_private *i915, u64 config)
                if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
                        /* Requires a mutex for sampling! */
                        return -ENODEV;
-               /* Fall-through. */
+               fallthrough;
        case I915_PMU_REQUESTED_FREQUENCY:
                if (INTEL_GEN(i915) < 6)
                        return -ENODEV;
@@ -538,10 +536,8 @@ static int i915_pmu_event_init(struct perf_event *event)
        if (ret)
                return ret;
 
-       if (!event->parent) {
-               __module_get(THIS_MODULE);
+       if (!event->parent)
                event->destroy = i915_pmu_event_destroy;
-       }
 
        return 0;
 }
@@ -1130,6 +1126,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
        if (!pmu->base.attr_groups)
                goto err_attr;
 
+       pmu->base.module        = THIS_MODULE;
        pmu->base.task_ctx_nr   = perf_invalid_context;
        pmu->base.event_init    = i915_pmu_event_init;
        pmu->base.add           = i915_pmu_event_add;
index 939a6ca..632b912 100644 (file)
@@ -8,8 +8,6 @@
 #include "../i915_selftest.h"
 #include "i915_random.h"
 
-#define SZ_8G (1ULL << 33)
-
 static void __igt_dump_block(struct i915_buddy_mm *mm,
                             struct i915_buddy_block *block,
                             bool buddy)
@@ -281,18 +279,22 @@ static int igt_check_mm(struct i915_buddy_mm *mm)
 static void igt_mm_config(u64 *size, u64 *chunk_size)
 {
        I915_RND_STATE(prng);
-       u64 s, ms;
+       u32 s, ms;
 
        /* Nothing fancy, just try to get an interesting bit pattern */
 
        prandom_seed_state(&prng, i915_selftest.random_seed);
 
-       s = i915_prandom_u64_state(&prng) & (SZ_8G - 1);
-       ms = BIT_ULL(12 + (prandom_u32_state(&prng) % ilog2(s >> 12)));
-       s = max(s & -ms, ms);
+       /* Let size be a random number of pages up to 8 GB (2M pages) */
+       s = 1 + i915_prandom_u32_max_state((BIT(33 - 12)) - 1, &prng);
+       /* Let the chunk size be a random power of 2 less than size */
+       ms = BIT(i915_prandom_u32_max_state(ilog2(s), &prng));
+       /* Round size down to the chunk size */
+       s &= -ms;
 
-       *chunk_size = ms;
-       *size = s;
+       /* Convert from pages to bytes */
+       *chunk_size = (u64)ms << 12;
+       *size = (u64)s << 12;
 }
 
 static int igt_buddy_alloc_smoke(void *arg)
index b9810bf..f127e63 100644 (file)
@@ -78,6 +78,7 @@ static void mock_device_release(struct drm_device *dev)
        drm_mode_config_cleanup(&i915->drm);
 
 out:
+       i915_params_free(&i915->params);
        put_device(&i915->drm.pdev->dev);
        i915->drm.pdev = NULL;
 }
@@ -165,6 +166,8 @@ struct drm_i915_private *mock_gem_device(void)
        i915->drm.pdev = pdev;
        drmm_add_final_kfree(&i915->drm, i915);
 
+       i915_params_copy(&i915->params, &i915_modparams);
+
        intel_runtime_pm_init_early(&i915->runtime_pm);
 
        /* Using the global GTT may ask questions about KMS users, so prepare */
index 6776ebb..8a4235d 100644 (file)
@@ -447,7 +447,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
                if (fb->pitches[1] != fb->pitches[2])
                        return -EINVAL;
 
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_NV12:
        case DRM_FORMAT_NV16:
                ubo = drm_plane_state_to_ubo(state);
index f12e027..ffc6b58 100644 (file)
@@ -205,7 +205,7 @@ static int meson_g12a_afbcd_pixel_fmt(u64 modifier, uint32_t format)
                /* YTR is forbidden for non XBGR formats */
                if (modifier & AFBC_FORMAT_MOD_YTR)
                        return -EINVAL;
-       /* fall through */
+               fallthrough;
        case DRM_FORMAT_XBGR8888:
        case DRM_FORMAT_ABGR8888:
                return MAFBC_FMT_RGBA8888;
index a8bcc70..1ffbbec 100644 (file)
@@ -654,7 +654,7 @@ static void meson_overlay_atomic_update(struct drm_plane *plane,
                         priv->viu.vd1_addr2,
                         priv->viu.vd1_stride2,
                         priv->viu.vd1_height2);
-       /* fallthrough */
+               fallthrough;
        case 2:
                gem = drm_fb_cma_get_gem_obj(fb, 1);
                priv->viu.vd1_addr1 = gem->paddr + fb->offsets[1];
@@ -666,7 +666,7 @@ static void meson_overlay_atomic_update(struct drm_plane *plane,
                         priv->viu.vd1_addr1,
                         priv->viu.vd1_stride1,
                         priv->viu.vd1_height1);
-       /* fallthrough */
+               fallthrough;
        case 1:
                gem = drm_fb_cma_get_gem_obj(fb, 0);
                priv->viu.vd1_addr0 = gem->paddr + fb->offsets[0];
index 9e63a19..84a5d9c 100644 (file)
@@ -59,7 +59,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
                case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        /* copy commands into RB: */
                        obj = submit->bos[submit->cmd[i].idx].obj;
@@ -150,7 +150,7 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
                case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
                        OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
index b67b38c..e1c7bcd 100644 (file)
@@ -133,7 +133,7 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp)
 
        if (!gmu->legacy) {
                a6xx_hfi_set_freq(gmu, perf_index);
-               icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216));
+               dev_pm_opp_set_bw(&gpu->pdev->dev, opp);
                pm_runtime_put(gmu->dev);
                return;
        }
@@ -157,11 +157,7 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp)
        if (ret)
                dev_err(gmu->dev, "GMU set GPU frequency error: %d\n", ret);
 
-       /*
-        * Eventually we will want to scale the path vote with the frequency but
-        * for now leave it at max so that the performance is nominal.
-        */
-       icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216));
+       dev_pm_opp_set_bw(&gpu->pdev->dev, opp);
        pm_runtime_put(gmu->dev);
 }
 
@@ -204,6 +200,16 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu)
 {
        int ret;
        u32 val;
+       u32 mask, reset_val;
+
+       val = gmu_read(gmu, REG_A6XX_GMU_CM3_DTCM_START + 0xff8);
+       if (val <= 0x20010004) {
+               mask = 0xffffffff;
+               reset_val = 0xbabeface;
+       } else {
+               mask = 0x1ff;
+               reset_val = 0x100;
+       }
 
        gmu_write(gmu, REG_A6XX_GMU_CM3_SYSRESET, 1);
 
@@ -215,7 +221,7 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu)
        gmu_write(gmu, REG_A6XX_GMU_CM3_SYSRESET, 0);
 
        ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_CM3_FW_INIT_RESULT, val,
-               val == 0xbabeface, 100, 10000);
+               (val & mask) == reset_val, 100, 10000);
 
        if (ret)
                DRM_DEV_ERROR(gmu->dev, "GMU firmware initialization timed out\n");
@@ -602,7 +608,7 @@ static void a6xx_gmu_power_config(struct a6xx_gmu *gmu)
                gmu_rmw(gmu, REG_A6XX_GMU_PWR_COL_INTER_FRAME_CTRL, 0,
                        A6XX_GMU_PWR_COL_INTER_FRAME_CTRL_IFPC_ENABLE |
                        A6XX_GMU_PWR_COL_INTER_FRAME_CTRL_HM_POWER_COLLAPSE_ENABLE);
-               /* Fall through */
+               fallthrough;
        case GMU_IDLE_STATE_SPTP:
                gmu_write(gmu, REG_A6XX_GMU_PWR_COL_SPTPRAC_HYST,
                        GMU_PWR_COL_HYST);
@@ -845,10 +851,24 @@ static void a6xx_gmu_set_initial_freq(struct msm_gpu *gpu, struct a6xx_gmu *gmu)
        if (IS_ERR_OR_NULL(gpu_opp))
                return;
 
+       gmu->freq = 0; /* so a6xx_gmu_set_freq() doesn't exit early */
        a6xx_gmu_set_freq(gpu, gpu_opp);
        dev_pm_opp_put(gpu_opp);
 }
 
+static void a6xx_gmu_set_initial_bw(struct msm_gpu *gpu, struct a6xx_gmu *gmu)
+{
+       struct dev_pm_opp *gpu_opp;
+       unsigned long gpu_freq = gmu->gpu_freqs[gmu->current_perf_index];
+
+       gpu_opp = dev_pm_opp_find_freq_exact(&gpu->pdev->dev, gpu_freq, true);
+       if (IS_ERR_OR_NULL(gpu_opp))
+               return;
+
+       dev_pm_opp_set_bw(&gpu->pdev->dev, gpu_opp);
+       dev_pm_opp_put(gpu_opp);
+}
+
 int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 {
        struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
@@ -882,7 +902,7 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
        }
 
        /* Set the bus quota to a reasonable value for boot */
-       icc_set_bw(gpu->icc_path, 0, MBps_to_icc(3072));
+       a6xx_gmu_set_initial_bw(gpu, gmu);
 
        /* Enable the GMU interrupt */
        gmu_write(gmu, REG_A6XX_GMU_AO_HOST_INTERRUPT_CLR, ~0);
@@ -1051,7 +1071,7 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu)
                a6xx_gmu_shutdown(gmu);
 
        /* Remove the bus vote */
-       icc_set_bw(gpu->icc_path, 0, 0);
+       dev_pm_opp_set_bw(&gpu->pdev->dev, NULL);
 
        /*
         * Make sure the GX domain is off before turning off the GMU (CX)
index c5a3e4d..3966abd 100644 (file)
@@ -117,7 +117,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
                case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
                        OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
index 959656a..b12f5b4 100644 (file)
@@ -938,7 +938,8 @@ struct msm_gpu_state *a6xx_gpu_state_get(struct msm_gpu *gpu)
                msm_gem_kernel_put(dumper.bo, gpu->aspace, true);
        }
 
-       a6xx_get_debugbus(gpu, a6xx_state);
+       if (snapshot_debugbus)
+               a6xx_get_debugbus(gpu, a6xx_state);
 
        return  &a6xx_state->base;
 }
index 846fd5b..2fb58b7 100644 (file)
@@ -372,7 +372,7 @@ static const struct a6xx_indexed_registers {
        u32 data;
        u32 count;
 } a6xx_indexed_reglist[] = {
-       { "CP_SEQ_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
+       { "CP_SQE_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
                REG_A6XX_CP_SQE_STAT_DATA, 0x33 },
        { "CP_DRAW_STATE", REG_A6XX_CP_DRAW_STATE_ADDR,
                REG_A6XX_CP_DRAW_STATE_DATA, 0x100 },
index 4e84f3c..9eeb46b 100644 (file)
@@ -14,6 +14,10 @@ bool hang_debug = false;
 MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!)");
 module_param_named(hang_debug, hang_debug, bool, 0600);
 
+bool snapshot_debugbus = false;
+MODULE_PARM_DESC(snapshot_debugbus, "Include debugbus sections in GPU devcoredump (if not fused off)");
+module_param_named(snapshot_debugbus, snapshot_debugbus, bool, 0600);
+
 static const struct adreno_info gpulist[] = {
        {
                .rev   = ADRENO_REV(2, 0, 0, 0),
index e23641a..288141f 100644 (file)
@@ -396,7 +396,7 @@ int adreno_hw_init(struct msm_gpu *gpu)
                ring->next = ring->start;
 
                /* reset completed fence seqno: */
-               ring->memptrs->fence = ring->seqno;
+               ring->memptrs->fence = ring->fctx->completed_fence;
                ring->memptrs->rptr = 0;
        }
 
@@ -474,7 +474,7 @@ void adreno_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
                        /* ignore if there has not been a ctx switch: */
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        OUT_PKT3(ring, adreno_is_a4xx(adreno_gpu) ?
                                CP_INDIRECT_BUFFER_PFE : CP_INDIRECT_BUFFER_PFD, 2);
index 99bb468..e55abae 100644 (file)
@@ -21,6 +21,8 @@
 #define REG_SKIP ~0
 #define REG_ADRENO_SKIP(_offset) [_offset] = REG_SKIP
 
+extern bool snapshot_debugbus;
+
 /**
  * adreno_regs: List of registers that are used in across all
  * 3D devices. Each device type has different offset value for the same
index f272a8d..c2729f7 100644 (file)
@@ -827,7 +827,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 {
        struct dpu_crtc *dpu_crtc;
        struct drm_encoder *encoder;
-       bool request_bandwidth;
+       bool request_bandwidth = false;
 
        if (!crtc) {
                DPU_ERROR("invalid crtc\n");
index a97f6d2..bd6def4 100644 (file)
@@ -599,7 +599,10 @@ static int dpu_encoder_virt_atomic_check(
        dpu_kms = to_dpu_kms(priv->kms);
        mode = &crtc_state->mode;
        adj_mode = &crtc_state->adjusted_mode;
-       global_state = dpu_kms_get_existing_global_state(dpu_kms);
+       global_state = dpu_kms_get_global_state(crtc_state->state);
+       if (IS_ERR(global_state))
+               return PTR_ERR(global_state);
+
        trace_dpu_enc_atomic_check(DRMID(drm_enc));
 
        /* perform atomic check on the first physical encoder (master) */
@@ -625,12 +628,15 @@ static int dpu_encoder_virt_atomic_check(
        /* Reserve dynamic resources now. */
        if (!ret) {
                /*
-                * Avoid reserving resources when mode set is pending. Topology
-                * info may not be available to complete reservation.
+                * Release and Allocate resources on every modeset
+                * Dont allocate when active is false.
                 */
                if (drm_atomic_crtc_needs_modeset(crtc_state)) {
-                       ret = dpu_rm_reserve(&dpu_kms->rm, global_state,
-                                       drm_enc, crtc_state, topology);
+                       dpu_rm_release(global_state, drm_enc);
+
+                       if (!crtc_state->active_changed || crtc_state->active)
+                               ret = dpu_rm_reserve(&dpu_kms->rm, global_state,
+                                               drm_enc, crtc_state, topology);
                }
        }
 
@@ -1181,7 +1187,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
        struct dpu_encoder_virt *dpu_enc = NULL;
        struct msm_drm_private *priv;
        struct dpu_kms *dpu_kms;
-       struct dpu_global_state *global_state;
        int i = 0;
 
        if (!drm_enc) {
@@ -1200,7 +1205,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
 
        priv = drm_enc->dev->dev_private;
        dpu_kms = to_dpu_kms(priv->kms);
-       global_state = dpu_kms_get_existing_global_state(dpu_kms);
 
        trace_dpu_enc_disable(DRMID(drm_enc));
 
@@ -1230,8 +1234,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
 
        DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n");
 
-       dpu_rm_release(global_state, drm_enc);
-
        mutex_unlock(&dpu_enc->enc_lock);
 }
 
index 33f6c56..29e373d 100644 (file)
@@ -866,9 +866,9 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
                crtc_state = drm_atomic_get_new_crtc_state(state->state,
                                                           state->crtc);
 
-       min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxdwnscale);
+       min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxupscale);
        ret = drm_atomic_helper_check_plane_state(state, crtc_state, min_scale,
-                                         pdpu->pipe_sblk->maxupscale << 16,
+                                         pdpu->pipe_sblk->maxdwnscale << 16,
                                          true, true);
        if (ret) {
                DPU_DEBUG_PLANE(pdpu, "Check plane state failed (%d)\n", ret);
index 5ccfad7..561bfa4 100644 (file)
@@ -27,6 +27,34 @@ int msm_atomic_prepare_fb(struct drm_plane *plane,
        return msm_framebuffer_prepare(new_state->fb, kms->aspace);
 }
 
+/*
+ * Helpers to control vblanks while we flush.. basically just to ensure
+ * that vblank accounting is switched on, so we get valid seqn/timestamp
+ * on pageflip events (if requested)
+ */
+
+static void vblank_get(struct msm_kms *kms, unsigned crtc_mask)
+{
+       struct drm_crtc *crtc;
+
+       for_each_crtc_mask(kms->dev, crtc, crtc_mask) {
+               if (!crtc->state->active)
+                       continue;
+               drm_crtc_vblank_get(crtc);
+       }
+}
+
+static void vblank_put(struct msm_kms *kms, unsigned crtc_mask)
+{
+       struct drm_crtc *crtc;
+
+       for_each_crtc_mask(kms->dev, crtc, crtc_mask) {
+               if (!crtc->state->active)
+                       continue;
+               drm_crtc_vblank_put(crtc);
+       }
+}
+
 static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
 {
        unsigned crtc_mask = BIT(crtc_idx);
@@ -44,6 +72,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
 
        kms->funcs->enable_commit(kms);
 
+       vblank_get(kms, crtc_mask);
+
        /*
         * Flush hardware updates:
         */
@@ -58,6 +88,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
        kms->funcs->wait_flush(kms, crtc_mask);
        trace_msm_atomic_wait_flush_finish(crtc_mask);
 
+       vblank_put(kms, crtc_mask);
+
        mutex_lock(&kms->commit_lock);
        kms->funcs->complete_commit(kms, crtc_mask);
        mutex_unlock(&kms->commit_lock);
@@ -221,6 +253,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
         */
        kms->pending_crtc_mask &= ~crtc_mask;
 
+       vblank_get(kms, crtc_mask);
+
        /*
         * Flush hardware updates:
         */
@@ -235,6 +269,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
        kms->funcs->wait_flush(kms, crtc_mask);
        trace_msm_atomic_wait_flush_finish(crtc_mask);
 
+       vblank_put(kms, crtc_mask);
+
        mutex_lock(&kms->commit_lock);
        kms->funcs->complete_commit(kms, crtc_mask);
        mutex_unlock(&kms->commit_lock);
index 7d641c7..7933384 100644 (file)
@@ -1320,6 +1320,13 @@ static int msm_pdev_remove(struct platform_device *pdev)
        return 0;
 }
 
+static void msm_pdev_shutdown(struct platform_device *pdev)
+{
+       struct drm_device *drm = platform_get_drvdata(pdev);
+
+       drm_atomic_helper_shutdown(drm);
+}
+
 static const struct of_device_id dt_match[] = {
        { .compatible = "qcom,mdp4", .data = (void *)KMS_MDP4 },
        { .compatible = "qcom,mdss", .data = (void *)KMS_MDP5 },
@@ -1332,6 +1339,7 @@ MODULE_DEVICE_TABLE(of, dt_match);
 static struct platform_driver msm_platform_driver = {
        .probe      = msm_pdev_probe,
        .remove     = msm_pdev_remove,
+       .shutdown   = msm_pdev_shutdown,
        .driver     = {
                .name   = "msm",
                .of_match_table = dt_match,
index e397c44..39ecb5a 100644 (file)
@@ -27,7 +27,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
        ring->id = id;
 
        ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ,
-               MSM_BO_WC, gpu->aspace, &ring->bo, &ring->iova);
+               MSM_BO_WC | MSM_BO_GPU_READONLY, gpu->aspace, &ring->bo,
+               &ring->iova);
 
        if (IS_ERR(ring->start)) {
                ret = PTR_ERR(ring->start);
index e081793..bd12eae 100644 (file)
@@ -597,7 +597,7 @@ static void venc_bridge_mode_set(struct drm_bridge *bridge,
        switch (venc_mode) {
        default:
                WARN_ON_ONCE(1);
-               /* Fall-through */
+               fallthrough;
        case VENC_MODE_PAL:
                venc->config = &venc_config_pal_trm;
                break;
index 6d40914..328a4a7 100644 (file)
@@ -451,11 +451,12 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
        if (omap_state->manually_updated)
                return;
 
-       spin_lock_irq(&crtc->dev->event_lock);
        drm_crtc_vblank_on(crtc);
+
        ret = drm_crtc_vblank_get(crtc);
        WARN_ON(ret != 0);
 
+       spin_lock_irq(&crtc->dev->event_lock);
        omap_crtc_arm_event(crtc);
        spin_unlock_irq(&crtc->dev->event_lock);
 }
index ba20c6f..886e995 100644 (file)
@@ -4856,7 +4856,7 @@ static void ci_request_link_speed_change_before_state_change(struct radeon_devic
                        pi->force_pcie_gen = RADEON_PCIE_GEN2;
                        if (current_link_speed == RADEON_PCIE_GEN2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case RADEON_PCIE_GEN2:
                        if (radeon_acpi_pcie_performance_request(rdev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)
                                break;
index 3b7ead5..73f67bf 100644 (file)
@@ -820,7 +820,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                                          ((idx_value >> 21) & 0xF));
                                return -EINVAL;
                        }
-                       /* Fall through. */
+                       fallthrough;
                case 6:
                        track->cb[i].cpp = 4;
                        break;
@@ -971,7 +971,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                                return -EINVAL;
                        }
                        /* The same rules apply as for DXT3/5. */
-                       /* Fall through. */
+                       fallthrough;
                case R300_TX_FORMAT_DXT3:
                case R300_TX_FORMAT_DXT5:
                        track->textures[i].cpp = 1;
index 1d4c04e..50b89b6 100644 (file)
@@ -115,7 +115,7 @@ void r420_pipes_init(struct radeon_device *rdev)
        default:
                /* force to 1 pipe */
                num_pipes = 1;
-               /* fall through */
+               fallthrough;
        case 1:
                tmp = (0 << 1);
                break;
index 49e8266..390a962 100644 (file)
@@ -487,7 +487,7 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
                                return -EINVAL;
                        }
                }
-               /* fall through */
+               fallthrough;
        case V_0280A0_CLEAR_ENABLE:
        {
                uint32_t block_max = G_028100_CMASK_BLOCK_MAX(track->cb_color_mask[i]);
@@ -1535,7 +1535,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p,  u32 idx,
                break;
        case V_038000_SQ_TEX_DIM_2D_ARRAY_MSAA:
                is_array = true;
-               /* fall through */
+               fallthrough;
        case V_038000_SQ_TEX_DIM_2D_MSAA:
                array_check.nsamples = 1 << llevel;
                llevel = 0;
index 1ad5c3b..57fb3eb 100644 (file)
@@ -454,7 +454,7 @@ static int radeon_uvd_validate_codec(struct radeon_cs_parser *p,
                if (p->rdev->family >= CHIP_PALM)
                        return 0;
 
-               /* fall through */
+               fallthrough;
        default:
                DRM_ERROR("UVD codec not supported by hardware %d!\n",
                          stream_type);
index a167e1c..d1c73e9 100644 (file)
@@ -5744,7 +5744,7 @@ static void si_request_link_speed_change_before_state_change(struct radeon_devic
                        si_pi->force_pcie_gen = RADEON_PCIE_GEN2;
                        if (current_link_speed == RADEON_PCIE_GEN2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case RADEON_PCIE_GEN2:
                        if (radeon_acpi_pcie_performance_request(rdev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)
                                break;
index f858d8d..8007211 100644 (file)
@@ -219,7 +219,7 @@ done:
                        WREG32(RS_DQ_RD_RET_CONF, 0x3f);
                        WREG32(MC_CONFIG, 0x1f);
 
-                       /* fall through */
+                       fallthrough;
                case CHIP_RV670:
                case CHIP_RV635:
 
index a2ac25c..e0d40ae 100644 (file)
@@ -306,7 +306,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of vertices %u in TRILIST\n",
@@ -444,7 +444,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of vertices %u in TRILIST\n",
@@ -566,7 +566,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of indices %u in TRILIST\n", n);
@@ -705,7 +705,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of indices %u in TRILIST\n", n);
@@ -1066,7 +1066,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
                                ret = -EINVAL;
                                goto done;
                        }
-                       /* fall through */
+                       fallthrough;
                case SAVAGE_CMD_DMA_PRIM:
                case SAVAGE_CMD_VB_PRIM:
                        if (!first_draw_cmd)
index 008f079..38a5587 100644 (file)
@@ -850,13 +850,13 @@ static int hdmi_audio_configure(struct sti_hdmi *hdmi)
        switch (info->channels) {
        case 8:
                audio_cfg |= HDMI_AUD_CFG_CH78_VALID;
-               /* fall through */
+               fallthrough;
        case 6:
                audio_cfg |= HDMI_AUD_CFG_CH56_VALID;
-               /* fall through */
+               fallthrough;
        case 4:
                audio_cfg |= HDMI_AUD_CFG_CH34_VALID | HDMI_AUD_CFG_8CH;
-               /* fall through */
+               fallthrough;
        case 2:
                audio_cfg |= HDMI_AUD_CFG_CH12_VALID;
                break;
index 359b56e..ced9a82 100644 (file)
@@ -195,7 +195,7 @@ void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
        switch (encoder->encoder_type) {
        case DRM_MODE_ENCODER_LVDS:
                is_lvds = true;
-               /* Fallthrough */
+               fallthrough;
        case DRM_MODE_ENCODER_DSI:
        case DRM_MODE_ENCODER_NONE:
                channel = 0;
@@ -342,7 +342,7 @@ static void sun4i_tcon0_mode_set_dithering(struct sun4i_tcon *tcon,
                /* R and B components are only 5 bits deep */
                val |= SUN4I_TCON0_FRM_CTL_MODE_R;
                val |= SUN4I_TCON0_FRM_CTL_MODE_B;
-               /* Fall through */
+               fallthrough;
        case MEDIA_BUS_FMT_RGB666_1X18:
        case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
                /* Fall through: enable dithering */
index aa67cb0..7f13f4d 100644 (file)
@@ -1027,7 +1027,7 @@ static ssize_t sun6i_dsi_transfer(struct mipi_dsi_host *host,
                        ret = sun6i_dsi_dcs_read(dsi, msg);
                        break;
                }
-               /* Else, fall through */
+               fallthrough;
 
        default:
                ret = -EINVAL;
index 9a0b324..424ad60 100644 (file)
@@ -135,7 +135,7 @@ static inline u32 compute_dda_inc(unsigned int in, unsigned int out, bool v,
 
                default:
                        WARN_ON_ONCE(1);
-                       /* fallthrough */
+                       fallthrough;
                case 4:
                        max = 4;
                        break;
index 1856962..518220b 100644 (file)
@@ -386,7 +386,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
                case DRM_FORMAT_XBGR8888:
                case DRM_FORMAT_XRGB8888:
                        reg |= LCDC_V2_TFT_24BPP_UNPACK;
-                       /* fallthrough */
+                       fallthrough;
                case DRM_FORMAT_BGR888:
                case DRM_FORMAT_RGB888:
                        reg |= LCDC_V2_TFT_24BPP_MODE;
index 33526c5..4732dcc 100644 (file)
@@ -525,7 +525,7 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
                        if (unlikely(ret != 0))
                                return ret;
                }
-               /* fall through */
+               fallthrough;
        case TTM_PL_TT:
                ret = ttm_bo_vm_access_kmap(bo, offset, buf, len, write);
                break;
index 551fa31..5771bb5 100644 (file)
@@ -179,21 +179,21 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
        switch (vsg->state) {
        case dr_via_device_mapped:
                via_unmap_blit_from_device(pdev, vsg);
-               /* fall through */
+               fallthrough;
        case dr_via_desc_pages_alloc:
                for (i = 0; i < vsg->num_desc_pages; ++i) {
                        if (vsg->desc_pages[i] != NULL)
                                free_page((unsigned long)vsg->desc_pages[i]);
                }
                kfree(vsg->desc_pages);
-               /* fall through */
+               fallthrough;
        case dr_via_pages_locked:
                unpin_user_pages_dirty_lock(vsg->pages, vsg->num_pages,
                                           (vsg->direction == DMA_FROM_DEVICE));
-               /* fall through */
+               fallthrough;
        case dr_via_pages_alloc:
                vfree(vsg->pages);
-               /* fall through */
+               fallthrough;
        default:
                vsg->state = dr_via_sg_init;
        }
index 7a2430e..c8da7ad 100644 (file)
@@ -179,6 +179,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
 
        virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
                              vfpriv->ctx_id, buflist, out_fence);
+       dma_fence_put(&out_fence->f);
        virtio_gpu_notify(vgdev);
        return 0;
 
index 2cdd3cd..e83651b 100644 (file)
@@ -79,6 +79,7 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object *bo)
                        }
 
                        sg_free_table(shmem->pages);
+                       kfree(shmem->pages);
                        shmem->pages = NULL;
                        drm_gem_shmem_unpin(&bo->base.base);
                }
index 013c9e0..cc93a8c 100644 (file)
@@ -649,9 +649,7 @@ static void displback_changed(struct xenbus_device *xb_dev,
 
        switch (backend_state) {
        case XenbusStateReconfiguring:
-               /* fall through */
        case XenbusStateReconfigured:
-               /* fall through */
        case XenbusStateInitialised:
                break;
 
@@ -701,7 +699,6 @@ static void displback_changed(struct xenbus_device *xb_dev,
                break;
 
        case XenbusStateUnknown:
-               /* fall through */
        case XenbusStateClosed:
                if (xb_dev->state == XenbusStateClosed)
                        break;
index dbcc167..34b4075 100644 (file)
@@ -141,7 +141,7 @@ static int ipu_bus_format_to_map(u32 fmt)
        switch (fmt) {
        default:
                WARN_ON(1);
-               /* fall-through */
+               fallthrough;
        case MEDIA_BUS_FMT_RGB888_1X24:
                return IPU_DC_MAP_RGB24;
        case MEDIA_BUS_FMT_RGB565_1X16:
index 4ff3bc1..28d671c 100644 (file)
@@ -321,7 +321,7 @@ static const struct kernel_param_ops cougar_g6_is_space_ops = {
 };
 module_param_cb(g6_is_space, &cougar_g6_is_space_ops, &g6_is_space, 0644);
 
-static struct hid_device_id cougar_id_table[] = {
+static const struct hid_device_id cougar_id_table[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
                         USB_DEVICE_ID_COUGAR_500K_GAMING_KEYBOARD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
index 6221888..a8e3b27 100644 (file)
 #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
 #define USB_DEVICE_ID_LENOVO_X1_COVER  0x6085
 #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D     0x608d
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019     0x6019
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E     0x602e
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6093     0x6093
 
 #define USB_VENDOR_ID_LG               0x1fd2
 #define USB_DEVICE_ID_LG_MULTITOUCH    0x0064
index ef0cbcd..fcaf846 100644 (file)
@@ -680,7 +680,7 @@ static int lg_g15_register_led(struct lg_g15_data *g15, int i)
                         * but it does have a separate power-on (reset) value.
                         */
                        g15->leds[i].cdev.name = "g15::power_on_backlight_val";
-                       /* fall through */
+                       fallthrough;
                case LG_G15_KBD_BRIGHTNESS:
                        g15->leds[i].cdev.brightness_set_blocking =
                                lg_g510_kbd_led_set;
index a78c13c..38ee25a 100644 (file)
@@ -844,7 +844,7 @@ static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev,
                        workitem.type = WORKITEM_TYPE_EMPTY;
                        break;
                }
-               /* fall-through */
+               fallthrough;
        case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED:
                workitem.quad_id_msb =
                        dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB];
index 9a4fc7d..aea46e5 100644 (file)
@@ -29,7 +29,7 @@ static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
        return rdesc;
 }
 
-static struct hid_device_id macally_id_table[] = {
+static const struct hid_device_id macally_id_table[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
                         USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) },
        { }
index 2d8b589..5576fed 100644 (file)
@@ -163,16 +163,13 @@ static int ms_surface_dial_quirk(struct hid_input *hi, struct hid_field *field,
 {
        switch (usage->hid & HID_USAGE_PAGE) {
        case 0xff070000:
-               /* fall-through */
        case HID_UP_DIGITIZER:
                /* ignore those axis */
                return -1;
        case HID_UP_GENDESK:
                switch (usage->hid) {
                case HID_GD_X:
-                       /* fall-through */
                case HID_GD_Y:
-                       /* fall-through */
                case HID_GD_RFKILL_BTN:
                        /* ignore those axis */
                        return -1;
index c242150..a65aef6 100644 (file)
@@ -105,6 +105,9 @@ static const struct hid_device_id hid_quirks[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6093), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET },
index 8cffa84..7f41213 100644 (file)
@@ -428,7 +428,6 @@ static void rmi_report(struct hid_device *hid, struct hid_report *report)
 
        switch (report->id) {
        case RMI_READ_DATA_REPORT_ID:
-               /* fall-through */
        case RMI_ATTN_REPORT_ID:
                return;
        }
index 1a6e600..2ff4c8e 100644 (file)
@@ -780,7 +780,7 @@ static void kone_keep_values_up_to_date(struct kone_device *kone,
        case kone_mouse_event_switch_profile:
                kone->actual_dpi = kone->profiles[event->value - 1].
                                startup_dpi;
-               /* fall through */
+               fallthrough;
        case kone_mouse_event_osd_profile:
                kone->actual_profile = event->value;
                break;
index 78a364a..7d20d1f 100644 (file)
@@ -974,7 +974,7 @@ int uclogic_params_init(struct uclogic_params *params,
                        }
                        break;
                }
-               /* FALL THROUGH */
+               fallthrough;
        case VID_PID(USB_VENDOR_ID_HUION,
                     USB_DEVICE_ID_HUION_TABLET):
        case VID_PID(USB_VENDOR_ID_HUION,
index 679e142..e484c36 100644 (file)
@@ -1672,7 +1672,6 @@ static ssize_t wiimote_ext_show(struct device *dev,
        case WIIMOTE_EXT_GUITAR:
                return sprintf(buf, "guitar\n");
        case WIIMOTE_EXT_UNKNOWN:
-               /* fallthrough */
        default:
                return sprintf(buf, "unknown\n");
        }
@@ -1722,7 +1721,6 @@ static ssize_t wiimote_dev_show(struct device *dev,
        case WIIMOTE_DEV_PENDING:
                return sprintf(buf, "pending\n");
        case WIIMOTE_DEV_UNKNOWN:
-               /* fallthrough */
        default:
                return sprintf(buf, "unknown\n");
        }
index 294c84e..dbd0449 100644 (file)
@@ -420,6 +420,19 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
                dev_err(&client->dev, "failed to change power setting.\n");
 
 set_pwr_exit:
+
+       /*
+        * The HID over I2C specification states that if a DEVICE needs time
+        * after the PWR_ON request, it should utilise CLOCK stretching.
+        * However, it has been observered that the Windows driver provides a
+        * 1ms sleep between the PWR_ON and RESET requests.
+        * According to Goodix Windows even waits 60 ms after (other?)
+        * PWR_ON requests. Testing has confirmed that several devices
+        * will not work properly without a delay after a PWR_ON request.
+        */
+       if (!ret && power_state == I2C_HID_PWR_ON)
+               msleep(60);
+
        return ret;
 }
 
@@ -441,15 +454,6 @@ static int i2c_hid_hwreset(struct i2c_client *client)
        if (ret)
                goto out_unlock;
 
-       /*
-        * The HID over I2C specification states that if a DEVICE needs time
-        * after the PWR_ON request, it should utilise CLOCK stretching.
-        * However, it has been observered that the Windows driver provides a
-        * 1ms sleep between the PWR_ON and RESET requests and that some devices
-        * rely on this.
-        */
-       usleep_range(1000, 5000);
-
        i2c_hid_dbg(ihid, "resetting...\n");
 
        ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0);
index 492dd64..17a29ee 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/string.h>
-#include <linux/timekeeping.h>
 
 #include <linux/usb.h>
 
@@ -96,18 +95,6 @@ static int hid_start_in(struct hid_device *hid)
                                set_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
                } else {
                        clear_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
-
-                       if (test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
-                               /*
-                                * In case events are generated while nobody was
-                                * listening, some are released when the device
-                                * is re-opened. Wait 50 msec for the queue to
-                                * empty before allowing events to go through
-                                * hid.
-                                */
-                               usbhid->input_start_time =
-                                       ktime_add_ms(ktime_get_coarse(), 50);
-                       }
                }
        }
        spin_unlock_irqrestore(&usbhid->lock, flags);
@@ -293,23 +280,20 @@ static void hid_irq_in(struct urb *urb)
                if (!test_bit(HID_OPENED, &usbhid->iofl))
                        break;
                usbhid_mark_busy(usbhid);
-               if (test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
-                       if (ktime_before(ktime_get_coarse(),
-                                        usbhid->input_start_time))
-                               break;
-                       clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
+               if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
+                       hid_input_report(urb->context, HID_INPUT_REPORT,
+                                        urb->transfer_buffer,
+                                        urb->actual_length, 1);
+                       /*
+                        * autosuspend refused while keys are pressed
+                        * because most keyboards don't wake up when
+                        * a key is released
+                        */
+                       if (hid_check_keys_pressed(hid))
+                               set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
+                       else
+                               clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
                }
-               hid_input_report(urb->context, HID_INPUT_REPORT,
-                                urb->transfer_buffer, urb->actual_length, 1);
-               /*
-                * autosuspend refused while keys are pressed
-                * because most keyboards don't wake up when
-                * a key is released
-                */
-               if (hid_check_keys_pressed(hid))
-                       set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
-               else
-                       clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
                break;
        case -EPIPE:            /* stall */
                usbhid_mark_busy(usbhid);
@@ -736,6 +720,17 @@ static int usbhid_open(struct hid_device *hid)
 
        usb_autopm_put_interface(usbhid->intf);
 
+       /*
+        * In case events are generated while nobody was listening,
+        * some are released when the device is re-opened.
+        * Wait 50 msec for the queue to empty before allowing events
+        * to go through hid.
+        */
+       if (res == 0)
+               msleep(50);
+
+       clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
+
  Done:
        mutex_unlock(&usbhid->mutex);
        return res;
index 4140dea..45e0b1c 100644 (file)
@@ -519,12 +519,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
 
                switch (cmd) {
                case HIDIOCGUSAGE:
+                       if (uref->usage_index >= field->report_count)
+                               goto inval;
                        uref->value = field->value[uref->usage_index];
                        if (copy_to_user(user_arg, uref, sizeof(*uref)))
                                goto fault;
                        goto goodreturn;
 
                case HIDIOCSUSAGE:
+                       if (uref->usage_index >= field->report_count)
+                               goto inval;
                        field->value[uref->usage_index] = uref->value;
                        goto goodreturn;
 
@@ -781,7 +785,6 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                break;
 
        case HIDIOCGUCODE:
-               /* fall through */
        case HIDIOCGUSAGE:
        case HIDIOCSUSAGE:
        case HIDIOCGUSAGES:
index c6ad684..75fe85d 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/types.h>
 #include <linux/slab.h>
-#include <linux/ktime.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/timer.h>
@@ -84,7 +83,6 @@ struct usbhid_device {
        struct mutex mutex;                                             /* start/stop/open/close */
        spinlock_t lock;                                                /* fifo spinlock */
        unsigned long iofl;                                             /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
-       ktime_t input_start_time;                                       /* When to start handling input */
        struct timer_list io_retry;                                     /* Retry timer */
        unsigned long stop_retry;                                       /* Time to give up, in jiffies */
        unsigned int retry_delay;                                       /* Delay length in ms */
index 1c96809..83dfec3 100644 (file)
@@ -341,7 +341,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
 
                        case 2: /* Mouse with wheel */
                                input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
-                               /* fall through */
+                               fallthrough;
 
                        case 3: /* Mouse without wheel */
                                wacom->tool[0] = BTN_TOOL_MOUSE;
@@ -1201,7 +1201,7 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
        case 0x04:
                wacom_intuos_bt_process_data(wacom, data + i);
                i += 10;
-               /* fall through */
+               fallthrough;
        case 0x03:
                wacom_intuos_bt_process_data(wacom, data + i);
                i += 10;
@@ -2148,7 +2148,7 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
                for (i = 0; i < wacom->led.count; i++)
                        wacom_update_led(wacom, features->numbered_buttons,
                                         value, i);
-                /* fall through*/
+               fallthrough;
        default:
                do_report = true;
                break;
@@ -3602,14 +3602,14 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        switch (features->type) {
        case GRAPHIRE_BT:
                __clear_bit(ABS_MISC, input_dev->absbit);
-               /* fall through */
+               fallthrough;
 
        case WACOM_MO:
        case WACOM_G4:
                input_set_abs_params(input_dev, ABS_DISTANCE, 0,
                                              features->distance_max,
                                              features->distance_fuzz, 0);
-               /* fall through */
+               fallthrough;
 
        case GRAPHIRE:
                input_set_capability(input_dev, EV_REL, REL_WHEEL);
@@ -3649,7 +3649,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        case INTUOS4S:
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
                input_abs_set_res(input_dev, ABS_Z, 287);
-               /* fall through */
+               fallthrough;
 
        case INTUOS:
                wacom_setup_intuos(wacom_wac);
@@ -3682,7 +3682,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        case TABLETPC:
        case TABLETPCE:
                __clear_bit(ABS_MISC, input_dev->absbit);
-               /* fall through */
+               fallthrough;
 
        case DTUS:
        case DTUSX:
@@ -3696,7 +3696,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 
        case PTU:
                __set_bit(BTN_STYLUS2, input_dev->keybit);
-               /* fall through */
+               fallthrough;
 
        case PENPARTNER:
                __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -3799,7 +3799,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
                input_abs_set_res(input_dev, ABS_MT_POSITION_X, 40);
                input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 40);
 
-               /* fall through */
+               fallthrough;
 
        case INTUOS5:
        case INTUOS5L:
@@ -3817,7 +3817,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
                input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
                input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
                input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
-               /* fall through */
+               fallthrough;
 
        case WACOM_27QHDT:
                if (wacom_wac->shared->touch->product == 0x32C ||
@@ -3826,14 +3826,14 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
                        __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
                        wacom_wac->shared->has_mute_touch_switch = true;
                }
-               /* fall through */
+               fallthrough;
 
        case MTSCREEN:
        case MTTPC:
        case MTTPC_B:
        case TABLETPC2FG:
                input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT);
-               /*fall through */
+               fallthrough;
 
        case TABLETPC:
        case TABLETPCE:
@@ -3843,7 +3843,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
        case INTUOSHT2:
                input_dev->evbit[0] |= BIT_MASK(EV_SW);
                __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
-               /* fall through */
+               fallthrough;
 
        case BAMBOO_PT:
        case BAMBOO_TOUCH:
@@ -4099,7 +4099,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
 
                __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
                __set_bit(KEY_INFO, input_dev->keybit);
-               /* fall through */
+               fallthrough;
 
        case WACOM_21UX2:
        case WACOM_BEE:
@@ -4115,7 +4115,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
        case INTUOS3:
        case INTUOS3L:
                input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
-               /* fall through */
+               fallthrough;
 
        case INTUOS3S:
                input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
@@ -4139,7 +4139,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
                 * ID_INPUT_TABLET to be set.
                 */
                __set_bit(BTN_STYLUS, input_dev->keybit);
-               /* fall through */
+               fallthrough;
 
        case INTUOS4:
        case INTUOS4L:
index 365b5d5..96d0ecc 100644 (file)
@@ -291,7 +291,7 @@ static void ssip_set_rxstate(struct ssi_protocol *ssi, unsigned int state)
                /* CMT speech workaround */
                if (atomic_read(&ssi->tx_usecnt))
                        break;
-               /* Else, fall through */
+               fallthrough;
        case RECEIVING:
                mod_timer(&ssi->keep_alive, jiffies +
                                                msecs_to_jiffies(SSIP_KATOUT));
@@ -466,7 +466,7 @@ static void ssip_keep_alive(struct timer_list *t)
                case SEND_READY:
                        if (atomic_read(&ssi->tx_usecnt) == 0)
                                break;
-                       /* Fall through */
+                       fallthrough;
                        /*
                         * Workaround for cmt-speech in that case
                         * we relay on audio timers.
@@ -668,7 +668,7 @@ static void ssip_rx_bootinforeq(struct hsi_client *cl, u32 cmd)
        case ACTIVE:
                dev_err(&cl->device, "Boot info req on active state\n");
                ssip_error(cl);
-               /* Fall through */
+               fallthrough;
        case INIT:
        case HANDSHAKE:
                spin_lock_bh(&ssi->lock);
index 4bc4a20..fa69b94 100644 (file)
@@ -296,7 +296,7 @@ static int ssi_clk_event(struct notifier_block *nb, unsigned long event,
                break;
        case ABORT_RATE_CHANGE:
                dev_dbg(&ssi->device, "abort rate change\n");
-               /* Fall through */
+               fallthrough;
        case POST_RATE_CHANGE:
                dev_dbg(&ssi->device, "post rate change (%lu -> %lu)\n",
                        clk_data->old_rate, clk_data->new_rate);
index e74b144..754d35a 100644 (file)
@@ -354,7 +354,7 @@ static void process_ib_ipinfo(void *in_msg, void *out_msg, int op)
 
                out->body.kvp_ip_val.dhcp_enabled = in->kvp_ip_val.dhcp_enabled;
 
-               /* fallthrough */
+               fallthrough;
 
        case KVP_OP_GET_IP_INFO:
                utf16s_to_utf8s((wchar_t *)in->kvp_ip_val.adapter_id,
index 92ee0fe..a4e8d96 100644 (file)
@@ -282,26 +282,52 @@ static struct {
        spinlock_t                      lock;
 } host_ts;
 
-static struct timespec64 hv_get_adj_host_time(void)
+static inline u64 reftime_to_ns(u64 reftime)
 {
-       struct timespec64 ts;
-       u64 newtime, reftime;
+       return (reftime - WLTIMEDELTA) * 100;
+}
+
+/*
+ * Hard coded threshold for host timesync delay: 600 seconds
+ */
+static const u64 HOST_TIMESYNC_DELAY_THRESH = 600 * (u64)NSEC_PER_SEC;
+
+static int hv_get_adj_host_time(struct timespec64 *ts)
+{
+       u64 newtime, reftime, timediff_adj;
        unsigned long flags;
+       int ret = 0;
 
        spin_lock_irqsave(&host_ts.lock, flags);
        reftime = hv_read_reference_counter();
-       newtime = host_ts.host_time + (reftime - host_ts.ref_time);
-       ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100);
+
+       /*
+        * We need to let the caller know that last update from host
+        * is older than the max allowable threshold. clock_gettime()
+        * and PTP ioctl do not have a documented error that we could
+        * return for this specific case. Use ESTALE to report this.
+        */
+       timediff_adj = reftime - host_ts.ref_time;
+       if (timediff_adj * 100 > HOST_TIMESYNC_DELAY_THRESH) {
+               pr_warn_once("TIMESYNC IC: Stale time stamp, %llu nsecs old\n",
+                            (timediff_adj * 100));
+               ret = -ESTALE;
+       }
+
+       newtime = host_ts.host_time + timediff_adj;
+       *ts = ns_to_timespec64(reftime_to_ns(newtime));
        spin_unlock_irqrestore(&host_ts.lock, flags);
 
-       return ts;
+       return ret;
 }
 
 static void hv_set_host_time(struct work_struct *work)
 {
-       struct timespec64 ts = hv_get_adj_host_time();
 
-       do_settimeofday64(&ts);
+       struct timespec64 ts;
+
+       if (!hv_get_adj_host_time(&ts))
+               do_settimeofday64(&ts);
 }
 
 /*
@@ -361,10 +387,23 @@ static void timesync_onchannelcallback(void *context)
        struct ictimesync_ref_data *refdata;
        u8 *time_txf_buf = util_timesynch.recv_buffer;
 
-       vmbus_recvpacket(channel, time_txf_buf,
-                        HV_HYP_PAGE_SIZE, &recvlen, &requestid);
+       /*
+        * Drain the ring buffer and use the last packet to update
+        * host_ts
+        */
+       while (1) {
+               int ret = vmbus_recvpacket(channel, time_txf_buf,
+                                          HV_HYP_PAGE_SIZE, &recvlen,
+                                          &requestid);
+               if (ret) {
+                       pr_warn_once("TimeSync IC pkt recv failed (Err: %d)\n",
+                                    ret);
+                       break;
+               }
+
+               if (!recvlen)
+                       break;
 
-       if (recvlen > 0) {
                icmsghdrp = (struct icmsg_hdr *)&time_txf_buf[
                                sizeof(struct vmbuspipe_hdr)];
 
@@ -622,9 +661,7 @@ static int hv_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
 
 static int hv_ptp_gettime(struct ptp_clock_info *info, struct timespec64 *ts)
 {
-       *ts = hv_get_adj_host_time();
-
-       return 0;
+       return hv_get_adj_host_time(ts);
 }
 
 static struct ptp_clock_info ptp_hyperv_info = {
index 319a051..2088131 100644 (file)
@@ -435,7 +435,7 @@ static const char *voltage_label(struct adt7462_data *data, int which)
                case 3:
                        return "+1.5V";
                }
-               /* fall through */
+               fallthrough;
        case 2:
                if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
                        return "+12V3";
@@ -493,7 +493,7 @@ static const char *voltage_label(struct adt7462_data *data, int which)
                case 3:
                        return "+1.5";
                }
-               /* fall through */
+               fallthrough;
        case 11:
                if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
                                        ADT7462_PIN28_VOLT &&
@@ -531,7 +531,7 @@ static int voltage_multiplier(struct adt7462_data *data, int which)
                case 3:
                        return 7800;
                }
-               /* fall through */
+               fallthrough;
        case 2:
                if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
                        return 62500;
@@ -589,7 +589,7 @@ static int voltage_multiplier(struct adt7462_data *data, int which)
                case 3:
                        return 7800;
                }
-               /* fall through */
+               fallthrough;
        case 11:
        case 12:
                if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
index 3166184..a188879 100644 (file)
@@ -753,15 +753,18 @@ static ssize_t applesmc_light_show(struct device *dev,
        }
 
        ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
+       if (ret)
+               goto out;
        /* newer macbooks report a single 10-bit bigendian value */
        if (data_length == 10) {
                left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
                goto out;
        }
        left = buffer[2];
+
+       ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
        if (ret)
                goto out;
-       ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
        right = buffer[2];
 
 out:
@@ -810,12 +813,11 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
                  to_index(attr));
 
        ret = applesmc_read_key(newkey, buffer, 2);
-       speed = ((buffer[0] << 8 | buffer[1]) >> 2);
-
        if (ret)
                return ret;
-       else
-               return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
+
+       speed = ((buffer[0] << 8 | buffer[1]) >> 2);
+       return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
 }
 
 static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -851,12 +853,11 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,
        u8 buffer[2];
 
        ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
-       manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
-
        if (ret)
                return ret;
-       else
-               return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
+
+       manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
+       return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
 }
 
 static ssize_t applesmc_store_fan_manual(struct device *dev,
@@ -872,10 +873,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,
                return -EINVAL;
 
        ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
-       val = (buffer[0] << 8 | buffer[1]);
        if (ret)
                goto out;
 
+       val = (buffer[0] << 8 | buffer[1]);
+
        if (input)
                val = val | (0x01 << to_index(attr));
        else
@@ -951,13 +953,12 @@ static ssize_t applesmc_key_count_show(struct device *dev,
        u32 count;
 
        ret = applesmc_read_key(KEY_COUNT_KEY, buffer, 4);
-       count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
-                                               ((u32)buffer[2]<<8) + buffer[3];
-
        if (ret)
                return ret;
-       else
-               return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
+
+       count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
+                                               ((u32)buffer[2]<<8) + buffer[3];
+       return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
 }
 
 static ssize_t applesmc_key_at_index_read_show(struct device *dev,
index cf0962f..e9c0bbc 100644 (file)
@@ -406,10 +406,10 @@ static int emc1403_probe(struct i2c_client *client,
        switch (id->driver_data) {
        case emc1404:
                data->groups[2] = &emc1404_group;
-               /* fall through */
+               fallthrough;
        case emc1403:
                data->groups[1] = &emc1403_group;
-               /* fall through */
+               fallthrough;
        case emc1402:
                data->groups[0] = &emc1402_group;
        }
index d09deb4..4dec793 100644 (file)
@@ -1285,7 +1285,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
                                data->pwm_auto_point_pwm[nr][0] =
                                        f71882fg_read8(data,
                                                F71882FG_REG_POINT_PWM(nr, 0));
-                               /* Fall through */
+                               fallthrough;
                        case f71862fg:
                                data->pwm_auto_point_pwm[nr][1] =
                                        f71882fg_read8(data,
@@ -2442,7 +2442,7 @@ static int f71882fg_probe(struct platform_device *pdev)
                case f71869a:
                        /* These always have signed auto point temps */
                        data->auto_point_temp_signed = 1;
-                       /* Fall through - to select correct fan/pwm reg bank! */
+                       fallthrough;    /* to select correct fan/pwm reg bank! */
                case f71889fg:
                case f71889ed:
                case f71889a:
index 3dfe2ca..c6d4567 100644 (file)
@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
        case mode_temperature:
                if (tmp > 0x8000)
                        tmp -= 0xffff;
+               tmp *= 100; /* convert to millidegrees celsius */
                break;
        case mode_voltage_raw:
                tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
index eb72e39..6d1175a 100644 (file)
@@ -96,7 +96,7 @@ int vid_from_reg(int val, u8 vrm)
                val &= 0x1f;
                if (val == 0x1f)
                        return 0;
-                               /* fall through */
+               fallthrough;
        case 25:                /* AMD NPT 0Fh */
                val &= 0x3f;
                return (val < 32) ? 1550 - 25 * val
@@ -122,7 +122,7 @@ int vid_from_reg(int val, u8 vrm)
 
        case 84:                /* VRM 8.4 */
                val &= 0x0f;
-                               /* fall through */
+               fallthrough;
        case 82:                /* VRM 8.2 */
                val &= 0x1f;
                return val == 0x1f ? 0 :
index 7fc5b06..81e1556 100644 (file)
@@ -352,7 +352,7 @@ static int ina3221_read_curr(struct device *dev, u32 attr,
                if (ret)
                        return ret;
 
-               /* fall through */
+               fallthrough;
        case hwmon_curr_crit:
        case hwmon_curr_max:
                if (!resistance_uo)
index 750b087..5bd1562 100644 (file)
@@ -2669,7 +2669,7 @@ static void pwm_update_registers(struct nct6775_data *data, int nr)
        case thermal_cruise:
                nct6775_write_value(data, data->REG_TARGET[nr],
                                    data->target_temp[nr]);
-               /* fall through  */
+               fallthrough;
        default:
                reg = nct6775_read_value(data, data->REG_FAN_MODE[nr]);
                reg = (reg & ~data->tolerance_mask) |
index b042569..242ff8b 100644 (file)
@@ -231,7 +231,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
                if (ret < 0)
                        return ret;
                cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
-               if (cnt == 0x1fff)
+               if (cnt == 0 || cnt == 0x1fff)
                        rpm = 0;
                else
                        rpm = 1350000 / cnt;
@@ -243,7 +243,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
                if (ret < 0)
                        return ret;
                cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
-               if (cnt == 0x1fff)
+               if (cnt == 0 || cnt == 0x1fff)
                        rpm = 0;
                else
                        rpm = 1350000 / cnt;
index 30e18eb..a717779 100644 (file)
@@ -752,7 +752,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
        switch (sensors->freq.version) {
        case 2:
                show_freq = occ_show_freq_2;
-               /* fall through */
+               fallthrough;
        case 1:
                num_attrs += (sensors->freq.num_sensors * 2);
                break;
@@ -763,7 +763,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
        switch (sensors->power.version) {
        case 2:
                show_power = occ_show_power_2;
-               /* fall through */
+               fallthrough;
        case 1:
                num_attrs += (sensors->power.num_sensors * 4);
                break;
@@ -781,7 +781,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
                break;
        case 3:
                show_caps = occ_show_caps_3;
-               /* fall through */
+               fallthrough;
        case 2:
                num_attrs += (sensors->caps.num_sensors * 8);
                break;
index 0c62271..58aa95a 100644 (file)
@@ -67,6 +67,7 @@ enum variants {
        raa_dmpvr1_2rail,
        raa_dmpvr2_1rail,
        raa_dmpvr2_2rail,
+       raa_dmpvr2_2rail_nontc,
        raa_dmpvr2_3rail,
        raa_dmpvr2_hv,
 };
@@ -241,6 +242,10 @@ static int isl68137_probe(struct i2c_client *client,
                info->pages = 1;
                info->read_word_data = raa_dmpvr2_read_word_data;
                break;
+       case raa_dmpvr2_2rail_nontc:
+               info->func[0] &= ~PMBUS_HAVE_TEMP;
+               info->func[1] &= ~PMBUS_HAVE_TEMP;
+               fallthrough;
        case raa_dmpvr2_2rail:
                info->pages = 2;
                info->read_word_data = raa_dmpvr2_read_word_data;
@@ -304,7 +309,7 @@ static const struct i2c_device_id raa_dmpvr_id[] = {
        {"raa228000", raa_dmpvr2_hv},
        {"raa228004", raa_dmpvr2_hv},
        {"raa228006", raa_dmpvr2_hv},
-       {"raa228228", raa_dmpvr2_2rail},
+       {"raa228228", raa_dmpvr2_2rail_nontc},
        {"raa229001", raa_dmpvr2_2rail},
        {"raa229004", raa_dmpvr2_2rail},
        {}
index b490fe3..f2703c5 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 
-#include <plat/adc.h>
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/hwmon-s3c.h>
 
 struct s3c_hwmon_attr {
index e1d10a6..a07b974 100644 (file)
@@ -1213,7 +1213,7 @@ temp_type_store(struct device *dev, struct device_attribute *devattr,
        case W83781D_DEFAULT_BETA:
                dev_warn(dev, "Sensor type %d is deprecated, please use 4 "
                         "instead\n", W83781D_DEFAULT_BETA);
-               /* fall through */
+               fallthrough;
        case 4:         /* thermistor */
                tmp = w83627hf_read_value(data, W83781D_REG_SCFG1);
                w83627hf_write_value(data, W83781D_REG_SCFG1,
index 015f1ea..d833a4f 100644 (file)
@@ -814,7 +814,7 @@ store_sensor(struct device *dev, struct device_attribute *da,
                dev_warn(dev,
                         "Sensor type %d is deprecated, please use 4 instead\n",
                         W83781D_DEFAULT_BETA);
-               /* fall through */
+               fallthrough;
        case 4:         /* thermistor */
                tmp = w83781d_read_value(data, W83781D_REG_SCFG1);
                w83781d_write_value(data, W83781D_REG_SCFG1,
index 44f68b9..6d52b53 100644 (file)
@@ -2127,7 +2127,7 @@ static void w83795_apply_temp_config(struct w83795_data *data, u8 config,
                if (temp_chan >= 4)
                        break;
                data->temp_mode |= 1 << temp_chan;
-               /* fall through */
+               fallthrough;
        case 0x3: /* Thermistor */
                data->has_temp |= 1 << temp_chan;
                break;
index 96544b3..7e642fb 100644 (file)
@@ -346,10 +346,10 @@ static void debug_init_arch_data(void *info)
        switch (mode) {
        case EDDEVID_IMPL_FULL:
                drvdata->edvidsr_present = true;
-               /* Fall through */
+               fallthrough;
        case EDDEVID_IMPL_EDPCSR_EDCIDSR:
                drvdata->edcidsr_present = true;
-               /* Fall through */
+               fallthrough;
        case EDDEVID_IMPL_EDPCSR:
                /*
                 * In ARM DDI 0487A.k, the EDDEVID1.PCSROffset is used to
index 6d7d216..96425e8 100644 (file)
@@ -1382,7 +1382,6 @@ static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,
                                return NOTIFY_BAD;
                break;
        case CPU_PM_EXIT:
-               /* fallthrough */
        case CPU_PM_ENTER_FAILED:
                if (drvdata->state_needs_restore)
                        etm4_cpu_restore(drvdata);
index 7040d58..9ca3aaa 100644 (file)
@@ -84,9 +84,7 @@ u32 tmc_get_memwidth_mask(struct tmc_drvdata *drvdata)
         */
        switch (drvdata->memwidth) {
        case TMC_MEM_INTF_WIDTH_32BITS:
-       /* fallthrough */
        case TMC_MEM_INTF_WIDTH_64BITS:
-       /* fallthrough */
        case TMC_MEM_INTF_WIDTH_128BITS:
                mask = GENMASK(31, 4);
                break;
index a1529f5..9ca8c4e 100644 (file)
@@ -84,11 +84,11 @@ static ssize_t notrace sth_stm_packet(struct stm_data *stm_data,
        /* Global packets (GERR, XSYNC, TRIG) are sent with register writes */
        case STP_PACKET_GERR:
                reg += 4;
-               /* fall through */
+               fallthrough;
 
        case STP_PACKET_XSYNC:
                reg += 8;
-               /* fall through */
+               fallthrough;
 
        case STP_PACKET_TRIG:
                if (flags & STP_PACKET_TIMESTAMPED)
index 688e928..d8295b1 100644 (file)
@@ -720,7 +720,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,
 
                        /* mark the last byte */
                        if (!process_call && (i == msg->len - 1))
-                               val |= 1 << M_TX_WR_STATUS_SHIFT;
+                               val |= BIT(M_TX_WR_STATUS_SHIFT);
 
                        iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val);
                }
@@ -738,7 +738,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,
                 */
                addr = i2c_8bit_addr_from_msg(msg);
                /* mark it the last byte out */
-               val = addr | (1 << M_TX_WR_STATUS_SHIFT);
+               val = addr | BIT(M_TX_WR_STATUS_SHIFT);
                iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val);
        }
 
index 175c590..12ac421 100644 (file)
@@ -1425,7 +1425,6 @@ omap_i2c_probe(struct platform_device *pdev)
                major = OMAP_I2C_REV_SCHEME_0_MAJOR(omap->rev);
                break;
        case OMAP_I2C_SCHEME_1:
-               /* FALLTHROUGH */
        default:
                omap->regs = (u8 *)reg_map_ip_v2;
                rev = (rev << 16) |
index 1c4c9bb..6eb0f50 100644 (file)
@@ -125,7 +125,7 @@ static int i2c_opal_smbus_xfer(struct i2c_adapter *adap, u16 addr,
        case I2C_SMBUS_BYTE:
                req.buffer_ra = cpu_to_be64(__pa(&data->byte));
                req.size = cpu_to_be32(1);
-               /* Fall through */
+               fallthrough;
        case I2C_SMBUS_QUICK:
                req.type = (read_write == I2C_SMBUS_READ) ?
                        OPAL_I2C_RAW_READ : OPAL_I2C_RAW_WRITE;
index 9e88347..c7c5434 100644 (file)
@@ -590,6 +590,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
        /* master sent stop */
        if (ssr_filtered & SSR) {
                i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
+               rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */
                rcar_i2c_write(priv, ICSIER, SAR);
                rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
        }
index 2ade99b..e627d7b 100644 (file)
@@ -276,16 +276,6 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap)
                dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
 }
 
-const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-                     struct i2c_client *client)
-{
-       if (!(client && matches))
-               return NULL;
-
-       return acpi_match_device(matches, &client->dev);
-}
-
 static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
        /*
         * These Silead touchscreen controllers only work at 400KHz, for
index 34a9609..5ec082e 100644 (file)
@@ -480,7 +480,7 @@ static int i2c_device_probe(struct device *dev)
         * or ACPI ID table is supplied for the probing device.
         */
        if (!driver->id_table &&
-           !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
+           !acpi_driver_match_device(dev, dev->driver) &&
            !i2c_of_match_device(dev->driver->of_match_table, client)) {
                status = -ENODEV;
                goto put_sync_adapter;
index 94ff169..8ce2611 100644 (file)
@@ -59,20 +59,11 @@ static inline int __i2c_check_suspended(struct i2c_adapter *adap)
 }
 
 #ifdef CONFIG_ACPI
-const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-                     struct i2c_client *client);
 void i2c_acpi_register_devices(struct i2c_adapter *adap);
 
 int i2c_acpi_get_irq(struct i2c_client *client);
 #else /* CONFIG_ACPI */
 static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { }
-static inline const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-                     struct i2c_client *client)
-{
-       return NULL;
-}
 
 static inline int i2c_acpi_get_irq(struct i2c_client *client)
 {
index 5c5306c..8513bd3 100644 (file)
@@ -603,7 +603,7 @@ static int dw_i3c_master_bus_init(struct i3c_master_controller *m)
                ret = dw_i2c_clk_cfg(master);
                if (ret)
                        return ret;
-               /* fall through */
+               fallthrough;
        case I3C_BUS_MODE_PURE:
                ret = dw_i3c_clk_cfg(master);
                if (ret)
index fd3b5da..50c9a41 100644 (file)
@@ -575,14 +575,14 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive)
                if (!HPT370_ALLOW_ATA100_5 ||
                    check_in_drive_list(drive, bad_ata100_5))
                        return ATA_UDMA4;
-               /* fall through */
+               fallthrough;
        case HPT372 :
        case HPT372A:
        case HPT372N:
        case HPT374 :
                if (ata_id_is_sata(drive->id))
                        mask &= ~0x0e;
-               /* fall through */
+               fallthrough;
        default:
                return mask;
        }
@@ -602,7 +602,7 @@ static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
        case HPT374 :
                if (ata_id_is_sata(drive->id))
                        return 0x00;
-               /* fall through */
+               fallthrough;
        default:
                return 0x07;
        }
index 7f17f83..212bb2d 100644 (file)
@@ -350,7 +350,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
                 */
                if (scsi_req(rq)->cmd[0] == GPCMD_START_STOP_UNIT)
                        break;
-               /* fall-through */
+               fallthrough;
        case DATA_PROTECT:
                /*
                 * No point in retrying after an illegal request or data
@@ -750,7 +750,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
        case REQ_OP_DRV_IN:
        case REQ_OP_DRV_OUT:
                expiry = ide_cd_expiry;
-               /*FALLTHRU*/
+               fallthrough;
        default:
                timeout = ATAPI_WAIT_PC;
                break;
index 1fe1f9d..af7503b 100644 (file)
@@ -428,7 +428,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
                                 * (maintains previous driver behaviour)
                                 */
                                break;
-                       /* fall through */
+                       fallthrough;
                case CAPACITY_CURRENT:
                        /* Normal Zip/LS-120 disks */
                        if (memcmp(cap_desc, &floppy->cap_desc, 8))
index e867129..1ddc45a 100644 (file)
@@ -143,7 +143,7 @@ static void ide_classify_atapi_dev(ide_drive_t *drive)
                }
                /* Early cdrom models used zero */
                type = ide_cdrom;
-               /* fall through */
+               fallthrough;
        case ide_cdrom:
                drive->dev_flags |= IDE_DFLAG_REMOVABLE;
 #ifdef CONFIG_PPC
index a26f85a..d016cbe 100644 (file)
@@ -129,7 +129,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
                        return pre_task_out_intr(drive, cmd);
                }
                handler = task_pio_intr;
-               /* fall through */
+               fallthrough;
        case ATA_PROT_NODATA:
                if (handler == NULL)
                        handler = task_no_data_intr;
@@ -141,7 +141,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
                hwif->expiry = dma_ops->dma_timer_expiry;
                ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD);
                dma_ops->dma_start(drive);
-               /* fall through */
+               fallthrough;
        default:
                return ide_started;
        }
@@ -579,10 +579,10 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
                        goto abort;
                }
                cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_OUT:
                cmd.protocol = ATA_PROT_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_OUT_DMAQ:
        case TASKFILE_OUT_DMA:
                cmd.tf_flags |= IDE_TFLAG_WRITE;
@@ -598,10 +598,10 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
                        goto abort;
                }
                cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_IN:
                cmd.protocol = ATA_PROT_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_IN_DMAQ:
        case TASKFILE_IN_DMA:
                nsect = taskin / SECTOR_SIZE;
index 024bc7b..1a700be 100644 (file)
@@ -494,7 +494,7 @@ static int init_chipset_sis5513(struct pci_dev *dev)
                pci_read_config_byte(dev, 0x09, &reg);
                if ((reg & 0x0f) != 0x00)
                        pci_write_config_byte(dev, 0x09, reg&0xf0);
-               /* fall through */
+               fallthrough;
        case ATA_16:
                /* force per drive recovery and active timings
                   needed on ATA_33 and below chips */
index 8e0fb1a..9a810e4 100644 (file)
@@ -89,14 +89,6 @@ static unsigned int mwait_substates __initdata;
  */
 #define CPUIDLE_FLAG_ALWAYS_ENABLE     BIT(15)
 
-/*
- * Set this flag for states where the HW flushes the TLB for us
- * and so we don't need cross-calls to keep it consistent.
- * If this flag is set, SW flushes the TLB, so even if the
- * HW doesn't do the flushing, this flag is safe to use.
- */
-#define CPUIDLE_FLAG_TLB_FLUSHED       BIT(16)
-
 /*
  * MWAIT takes an 8-bit "hint" in EAX "suggesting"
  * the C-state (top nibble) and sub-state (bottom nibble)
@@ -131,14 +123,6 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
        unsigned long eax = flg2MWAIT(state->flags);
        unsigned long ecx = 1; /* break on interrupt flag */
        bool tick;
-       int cpu = smp_processor_id();
-
-       /*
-        * leave_mm() to avoid costly and often unnecessary wakeups
-        * for flushing the user TLB's associated with the active mm.
-        */
-       if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
-               leave_mm(cpu);
 
        if (!static_cpu_has(X86_FEATURE_ARAT)) {
                /*
index ba27f86..4e6e702 100644 (file)
@@ -1580,7 +1580,7 @@ static int mma8452_probe(struct i2c_client *client,
        case FXLS8471_DEVICE_ID:
                if (ret == data->chip_info->chip_id)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                ret = -ENODEV;
                goto disable_regulators;
index 7fdc5d2..1bb987a 100644 (file)
@@ -484,7 +484,7 @@ static int ab8500_gpadc_read(struct ab8500_gpadc *gpadc,
                        delay_max = 10000; /* large range optimises sleepmode */
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                ctrl1 |= AB8500_GPADC_CTRL1_BUF_ENA;
                break;
index 84a1733..64c3cc3 100644 (file)
@@ -690,7 +690,7 @@ static void cpcap_adc_phase(struct cpcap_adc_request *req)
                break;
        case CPCAP_ADC_BATTI_PI17:
                index = req->bank_index;
-               /* fallthrough */
+               fallthrough;
        default:
                req->result += conv_tbl[index].cal_offset;
                req->result += conv_tbl[index].align_offset;
index 5a29e32..2ea9a5c 100644 (file)
@@ -118,7 +118,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
        case SPS30_READ_AUTO_CLEANING_PERIOD:
                buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8;
                buf[1] = (u8)(SPS30_AUTO_CLEANING_PERIOD & 0xff);
-               /* fall through */
+               fallthrough;
        case SPS30_READ_DATA_READY_FLAG:
        case SPS30_READ_DATA:
        case SPS30_READ_SERIAL:
index cc48756..1fd75c0 100644 (file)
@@ -220,7 +220,6 @@ static int ad5592r_set_channel_modes(struct ad5592r_state *st)
                        break;
 
                case CH_MODE_UNUSED:
-                       /* fall-through */
                default:
                        switch (st->channel_offstate[i]) {
                        case CH_OFFSTATE_OUT_TRISTATE:
@@ -237,7 +236,6 @@ static int ad5592r_set_channel_modes(struct ad5592r_state *st)
                                break;
 
                        case CH_OFFSTATE_PULLDOWN:
-                               /* fall-through */
                        default:
                                pulldown |= BIT(i);
                                break;
index b3835fb..1a9609e 100644 (file)
@@ -74,11 +74,12 @@ static int dpot_dac_read_raw(struct iio_dev *indio_dev,
                case IIO_VAL_INT:
                        /*
                         * Convert integer scale to fractional scale by
-                        * setting the denominator (val2) to one, and...
+                        * setting the denominator (val2) to one...
                         */
                        *val2 = 1;
                        ret = IIO_VAL_FRACTIONAL;
-                       /* fall through */
+                       /* ...and fall through. Say it again for GCC. */
+                       fallthrough;
                case IIO_VAL_FRACTIONAL:
                        *val *= regulator_get_voltage(dac->vref) / 1000;
                        *val2 *= dac->max_ohms;
index 9b47d94..d9b2ed8 100644 (file)
@@ -273,10 +273,10 @@ static int max30102_read_measurement(struct max30102_data *data,
        switch (measurements) {
        case 3:
                MAX30102_COPY_DATA(2);
-               /* fall through */
+               fallthrough;
        case 2:
                MAX30102_COPY_DATA(1);
-               /* fall through */
+               fallthrough;
        case 1:
                MAX30102_COPY_DATA(0);
                break;
index c539dfa..319b64b 100644 (file)
@@ -97,11 +97,11 @@ int __adis_write_reg(struct adis *adis, unsigned int reg,
                adis->tx[9] = (value >> 24) & 0xff;
                adis->tx[6] = ADIS_WRITE_REG(reg + 2);
                adis->tx[7] = (value >> 16) & 0xff;
-               /* fall through */
+               fallthrough;
        case 2:
                adis->tx[4] = ADIS_WRITE_REG(reg + 1);
                adis->tx[5] = (value >> 8) & 0xff;
-               /* fall through */
+               fallthrough;
        case 1:
                adis->tx[2] = ADIS_WRITE_REG(reg);
                adis->tx[3] = value & 0xff;
@@ -191,7 +191,7 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,
                adis->tx[2] = ADIS_READ_REG(reg + 2);
                adis->tx[3] = 0;
                spi_message_add_tail(&xfers[1], &msg);
-               /* fall through */
+               fallthrough;
        case 2:
                adis->tx[4] = ADIS_READ_REG(reg);
                adis->tx[5] = 0;
index 606d5e6..cdcd16f 100644 (file)
@@ -599,7 +599,7 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
                return scnprintf(buf, len, "%d", vals[0]);
        case IIO_VAL_INT_PLUS_MICRO_DB:
                scale_db = true;
-               /* fall through */
+               fallthrough;
        case IIO_VAL_INT_PLUS_MICRO:
                if (vals[1] < 0)
                        return scnprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
@@ -918,7 +918,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
                        break;
                case IIO_VAL_INT_PLUS_MICRO_DB:
                        scale_db = true;
-                       /* fall through */
+                       fallthrough;
                case IIO_VAL_INT_PLUS_MICRO:
                        fract_mult = 100000;
                        break;
index 155faae..8f5f857 100644 (file)
@@ -1042,7 +1042,7 @@ static int si1145_initialize(struct si1145_data *data)
                                                SI1145_LED_CURRENT_45mA);
                if (ret < 0)
                        return ret;
-               /* fallthrough */
+               fallthrough;
        case 2:
                ret = i2c_smbus_write_byte_data(client,
                                                SI1145_REG_PS_LED21,
index 6a8ae14..cbb44e4 100644 (file)
@@ -499,7 +499,7 @@ static int ak8974_detect(struct ak8974 *ak8974)
        switch (whoami) {
        case AK8974_WHOAMI_VALUE_AMI306:
                name = "ami306";
-               /* fall-through */
+               fallthrough;
        case AK8974_WHOAMI_VALUE_AMI305:
                ret = regmap_read(ak8974->map, AMI305_VER, &fw);
                if (ret)
index dc0558b..fbc28f1 100644 (file)
@@ -3034,7 +3034,7 @@ static int cm_rej_handler(struct cm_work *work)
        case IB_CM_REP_SENT:
        case IB_CM_MRA_REP_RCVD:
                ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
-               /* fall through */
+               fallthrough;
        case IB_CM_REQ_RCVD:
        case IB_CM_MRA_REQ_SENT:
                if (IBA_GET(CM_REJ_REASON, rej_msg) == IB_CM_REJ_STALE_CONN)
@@ -3044,7 +3044,7 @@ static int cm_rej_handler(struct cm_work *work)
                break;
        case IB_CM_DREQ_SENT:
                ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
-               /* fall through */
+               fallthrough;
        case IB_CM_REP_RCVD:
        case IB_CM_MRA_REP_SENT:
                cm_enter_timewait(cm_id_priv);
@@ -3058,7 +3058,7 @@ static int cm_rej_handler(struct cm_work *work)
                        cm_enter_timewait(cm_id_priv);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
                         __func__, be32_to_cpu(cm_id_priv->id.local_id),
@@ -3116,7 +3116,7 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,
                        msg_response = CM_MSG_RESPONSE_OTHER;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
                         __func__, be32_to_cpu(cm_id_priv->id.local_id),
@@ -3227,7 +3227,7 @@ static int cm_mra_handler(struct cm_work *work)
        case IB_CM_MRA_REP_RCVD:
                atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
                                counter[CM_MRA_COUNTER]);
-               /* fall through */
+               fallthrough;
        default:
                pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n",
                         __func__, be32_to_cpu(cm_id_priv->id.local_id),
@@ -4214,7 +4214,7 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
                                qp_attr->retry_cnt = cm_id_priv->retry_count;
                                qp_attr->rnr_retry = cm_id_priv->rnr_retry_count;
                                qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
-                               /* fall through */
+                               fallthrough;
                        case IB_QPT_XRC_TGT:
                                *qp_attr_mask |= IB_QP_TIMEOUT;
                                qp_attr->timeout = cm_id_priv->av.timeout;
index 26de0da..7f0e91e 100644 (file)
@@ -1985,7 +1985,8 @@ static int cma_ib_handler(struct ib_cm_id *cm_id,
                event.event = RDMA_CM_EVENT_ESTABLISHED;
                break;
        case IB_CM_DREQ_ERROR:
-               event.status = -ETIMEDOUT; /* fall through */
+               event.status = -ETIMEDOUT;
+               fallthrough;
        case IB_CM_DREQ_RECEIVED:
        case IB_CM_DREP_RECEIVED:
                if (!cma_comp_exch(id_priv, RDMA_CM_CONNECT,
index ef0cd29..c36b4d2 100644 (file)
@@ -2751,7 +2751,7 @@ static int __init ib_core_init(void)
 
        ret = addr_init();
        if (ret) {
-               pr_warn("Could't init IB address resolution\n");
+               pr_warn("Couldn't init IB address resolution\n");
                goto err_ibnl;
        }
 
index 614cff8..13f43ab 100644 (file)
@@ -510,7 +510,6 @@ struct ib_send_wr *rdma_rw_ctx_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
        switch (ctx->type) {
        case RDMA_RW_SIG_MR:
        case RDMA_RW_MR:
-               /* fallthrough */
                for (i = 0; i < ctx->nr_ops; i++) {
                        rdma_rw_update_lkey(&ctx->reg[i],
                                ctx->reg[i].wr.wr.opcode !=
index d03daca..1d184ea 100644 (file)
@@ -794,7 +794,7 @@ static void ucma_copy_ib_route(struct rdma_ucm_query_route_resp *resp,
        case 2:
                ib_copy_path_rec_to_user(&resp->ib_route[1],
                                         &route->path_rec[1]);
-               /* fall through */
+               fallthrough;
        case 1:
                ib_copy_path_rec_to_user(&resp->ib_route[0],
                                         &route->path_rec[0]);
@@ -820,7 +820,7 @@ static void ucma_copy_iboe_route(struct rdma_ucm_query_route_resp *resp,
        case 2:
                ib_copy_path_rec_to_user(&resp->ib_route[1],
                                         &route->path_rec[1]);
-               /* fall through */
+               fallthrough;
        case 1:
                ib_copy_path_rec_to_user(&resp->ib_route[0],
                                         &route->path_rec[0]);
index ef04a26..e47c594 100644 (file)
@@ -259,7 +259,7 @@ static int uverbs_process_attr(struct bundle_priv *pbundle,
                        return -EOPNOTSUPP;
 
                e->ptr_attr.enum_id = uattr->attr_data.enum_data.elem_id;
-       /* fall through */
+               fallthrough;
        case UVERBS_ATTR_TYPE_PTR_IN:
                /* Ensure that any data provided by userspace beyond the known
                 * struct is zero. Userspace that knows how to use some future
@@ -271,7 +271,7 @@ static int uverbs_process_attr(struct bundle_priv *pbundle,
                    !uverbs_is_attr_cleared(uattr, val_spec->u.ptr.len))
                        return -EOPNOTSUPP;
 
-       /* fall through */
+               fallthrough;
        case UVERBS_ATTR_TYPE_PTR_OUT:
                if (uattr->len < val_spec->u.ptr.min_len ||
                    (!val_spec->zero_trailing &&
index 3f18efc..5ee272d 100644 (file)
@@ -2657,7 +2657,7 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr,
                        default:
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case IB_WR_SEND_WITH_INV:
                        rc = bnxt_re_build_send_wqe(qp, wr, &wqe);
                        break;
index dad0df8..17ac8b7 100644 (file)
@@ -821,7 +821,8 @@ static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event,
        struct ib_event event;
        unsigned int flags;
 
-       if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR) {
+       if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR &&
+           rdma_is_kernel_res(&qp->ib_qp.res)) {
                flags = bnxt_re_lock_cqs(qp);
                bnxt_qplib_add_flush_qp(&qp->qplib_qp);
                bnxt_re_unlock_cqs(qp, flags);
index 117b423..d60e3dc 100644 (file)
@@ -1779,7 +1779,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
 
                        break;
                }
-               /* fall thru */
+               fallthrough;
        case BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM:
        case BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV:
        {
index 77bc02a..1f288c7 100644 (file)
@@ -2885,7 +2885,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
        case MORIBUND:
        case CLOSING:
                stop_ep_timer(ep);
-               /*FALLTHROUGH*/
+               fallthrough;
        case FPDU_MODE:
                if (ep->com.qp && ep->com.qp->srq) {
                        srqidx = ABORT_RSS_SRQIDX_G(
@@ -3759,7 +3759,7 @@ static void active_ofld_conn_reply(struct c4iw_dev *dev, struct sk_buff *skb,
                        send_fw_act_open_req(ep, atid);
                        return;
                }
-               /* fall through */
+               fallthrough;
        case FW_EADDRINUSE:
                set_bit(ACT_RETRY_INUSE, &ep->com.history);
                if (ep->retry_count++ < ACT_OPEN_RETRY_COUNT) {
index ac48012..cbddb20 100644 (file)
@@ -1165,7 +1165,7 @@ int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                                break;
                        }
                        fw_flags |= FW_RI_RDMA_WRITE_WITH_IMMEDIATE;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case IB_WR_RDMA_WRITE:
                        fw_opcode = FW_RI_RDMA_WRITE_WR;
                        swsqe->opcode = FW_RI_RDMA_WRITE;
index b12e466..4a4ec23 100644 (file)
@@ -209,7 +209,6 @@ static inline void jcopy(u8 *dest, const u8 *src, u32 n)
                fallthrough;
        case 1:
                *dest++ = *src++;
-               /* fall through */
        }
 }
 
index 9af82ff..73d197e 100644 (file)
@@ -3215,6 +3215,7 @@ bool hfi1_tid_rdma_wqe_interlock(struct rvt_qp *qp, struct rvt_swqe *wqe)
        case IB_WR_ATOMIC_CMP_AND_SWP:
        case IB_WR_ATOMIC_FETCH_AND_ADD:
        case IB_WR_RDMA_WRITE:
+       case IB_WR_RDMA_WRITE_WITH_IMM:
                switch (prev->wr.opcode) {
                case IB_WR_TID_RDMA_WRITE:
                        req = wqe_to_tid_req(prev);
index da9888d..6edcbdc 100644 (file)
@@ -65,8 +65,6 @@
 #define HNS_ROCE_CQE_WCMD_EMPTY_BIT            0x2
 #define HNS_ROCE_MIN_CQE_CNT                   16
 
-#define HNS_ROCE_RESERVED_SGE                  1
-
 #define HNS_ROCE_MAX_IRQ_NUM                   128
 
 #define HNS_ROCE_SGE_IN_WQE                    2
index 07b4c85..aeb3a6f 100644 (file)
@@ -535,7 +535,7 @@ static void hns_roce_set_sdb_ext(struct hns_roce_dev *hr_dev, u32 ext_sdb_alept,
        roce_write(hr_dev, ROCEE_EXT_DB_SQ_H_REG, val);
 
        dev_dbg(dev, "ext SDB depth: 0x%x\n", db->ext_db->esdb_dep);
-       dev_dbg(dev, "ext SDB threshold: epmty: 0x%x, ful: 0x%x\n",
+       dev_dbg(dev, "ext SDB threshold: empty: 0x%x, ful: 0x%x\n",
                ext_sdb_alept, ext_sdb_alful);
 }
 
index d296859..4cda95e 100644 (file)
@@ -633,7 +633,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
 
                wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt - 1);
 
-               if (unlikely(wr->num_sge >= hr_qp->rq.max_gs)) {
+               if (unlikely(wr->num_sge > hr_qp->rq.max_gs)) {
                        ibdev_err(ibdev, "rq:num_sge=%d >= qp->sq.max_gs=%d\n",
                                  wr->num_sge, hr_qp->rq.max_gs);
                        ret = -EINVAL;
@@ -653,7 +653,6 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
                if (wr->num_sge < hr_qp->rq.max_gs) {
                        dseg->lkey = cpu_to_le32(HNS_ROCE_INVALID_LKEY);
                        dseg->addr = 0;
-                       dseg->len = cpu_to_le32(HNS_ROCE_INVALID_SGE_LENGTH);
                }
 
                /* rq support inline data */
@@ -787,8 +786,8 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,
                }
 
                if (wr->num_sge < srq->max_gs) {
-                       dseg[i].len = cpu_to_le32(HNS_ROCE_INVALID_SGE_LENGTH);
-                       dseg[i].lkey = cpu_to_le32(HNS_ROCE_INVALID_LKEY);
+                       dseg[i].len = 0;
+                       dseg[i].lkey = cpu_to_le32(0x100);
                        dseg[i].addr = 0;
                }
 
@@ -5070,7 +5069,7 @@ static int hns_roce_v2_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
 
        attr->srq_limit = limit_wl;
        attr->max_wr = srq->wqe_cnt - 1;
-       attr->max_sge = srq->max_gs - HNS_ROCE_RESERVED_SGE;
+       attr->max_sge = srq->max_gs;
 
 out:
        hns_roce_free_cmd_mailbox(hr_dev, mailbox);
index 1fb1c58..ac29be4 100644 (file)
@@ -92,9 +92,7 @@
 #define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ         PAGE_SIZE
 #define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED                0xFFFFF000
 #define HNS_ROCE_V2_MAX_INNER_MTPT_NUM         2
-#define HNS_ROCE_INVALID_LKEY                  0x0
-#define HNS_ROCE_INVALID_SGE_LENGTH            0x80000000
-
+#define HNS_ROCE_INVALID_LKEY                  0x100
 #define HNS_ROCE_CMQ_TX_TIMEOUT                        30000
 #define HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE       2
 #define HNS_ROCE_V2_RSV_QPS                    8
index e94ca13..c063c45 100644 (file)
@@ -386,8 +386,7 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap,
                return -EINVAL;
        }
 
-       hr_qp->rq.max_gs = roundup_pow_of_two(max(1U, cap->max_recv_sge) +
-                                             HNS_ROCE_RESERVED_SGE);
+       hr_qp->rq.max_gs = roundup_pow_of_two(max(1U, cap->max_recv_sge));
 
        if (hr_dev->caps.max_rq_sg <= HNS_ROCE_SGE_IN_WQE)
                hr_qp->rq.wqe_shift = ilog2(hr_dev->caps.max_rq_desc_sz);
@@ -402,7 +401,7 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap,
                hr_qp->rq_inl_buf.wqe_cnt = 0;
 
        cap->max_recv_wr = cnt;
-       cap->max_recv_sge = hr_qp->rq.max_gs - HNS_ROCE_RESERVED_SGE;
+       cap->max_recv_sge = hr_qp->rq.max_gs;
 
        return 0;
 }
index f40a000..b9e2dbd 100644 (file)
@@ -297,7 +297,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,
        spin_lock_init(&srq->lock);
 
        srq->wqe_cnt = roundup_pow_of_two(init_attr->attr.max_wr + 1);
-       srq->max_gs = init_attr->attr.max_sge + HNS_ROCE_RESERVED_SGE;
+       srq->max_gs = init_attr->attr.max_sge;
 
        if (udata) {
                ret = ib_copy_from_udata(&ucmd, udata, sizeof(ucmd));
index fa7a5ff..a3b9580 100644 (file)
@@ -2443,7 +2443,7 @@ static void i40iw_handle_rst_pkt(struct i40iw_cm_node *cm_node,
        case I40IW_CM_STATE_FIN_WAIT1:
        case I40IW_CM_STATE_LAST_ACK:
                cm_node->cm_id->rem_ref(cm_node->cm_id);
-               /* fall through */
+               fallthrough;
        case I40IW_CM_STATE_TIME_WAIT:
                cm_node->state = I40IW_CM_STATE_CLOSED;
                i40iw_rem_ref_cm_node(cm_node);
index 688f196..86d3f8a 100644 (file)
@@ -1964,7 +1964,6 @@ static enum i40iw_status_code i40iw_sc_get_next_aeqe(struct i40iw_sc_aeq *aeq,
                info->out_rdrsp = true;
                break;
        case I40IW_AE_SOURCE_RSVD:
-               /* fallthrough */
        default:
                break;
        }
@@ -3762,14 +3761,14 @@ static enum i40iw_status_code cqp_sds_wqe_fill(struct i40iw_sc_cqp *cqp,
                                        LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID)));
 
                set_64bit_val(wqe, 56, info->entry[2].data);
-               /* fallthrough */
+               fallthrough;
        case 2:
                set_64bit_val(wqe, 32,
                              (LS_64(info->entry[1].cmd, I40IW_CQPSQ_UPESD_SDCMD) |
                                        LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID)));
 
                set_64bit_val(wqe, 40, info->entry[1].data);
-               /* fallthrough */
+               fallthrough;
        case 1:
                set_64bit_val(wqe, 0,
                              LS_64(info->entry[0].cmd, I40IW_CQPSQ_UPESD_SDCMD));
index ae8b97c..e108563 100644 (file)
@@ -353,7 +353,6 @@ void i40iw_process_aeq(struct i40iw_device *iwdev)
                                i40iw_cm_disconn(iwqp);
                        break;
                case I40IW_AE_BAD_CLOSE:
-                       /* fall through */
                case I40IW_AE_RESET_SENT:
                        i40iw_next_iw_state(iwqp, I40IW_QP_STATE_ERROR, 1, 0, 0);
                        i40iw_cm_disconn(iwqp);
@@ -413,7 +412,7 @@ void i40iw_process_aeq(struct i40iw_device *iwdev)
                case I40IW_AE_UDA_XMIT_DGRAM_TOO_LONG:
                case I40IW_AE_UDA_XMIT_DGRAM_TOO_SHORT:
                        ctx_info->err_rq_idx_valid = false;
-                       /* fall through */
+                       fallthrough;
                default:
                        if (!info->sq && ctx_info->err_rq_idx_valid) {
                                ctx_info->err_rq_idx = info->wqe_idx;
index 9c96ece..58a4331 100644 (file)
@@ -1489,36 +1489,35 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev)
                iwdev->iw_status = 0;
                i40iw_port_ibevent(iwdev);
                i40iw_destroy_rdma_device(iwdev->iwibdev);
-               /* fallthrough */
+               fallthrough;
        case IP_ADDR_REGISTERED:
                if (!iwdev->reset)
                        i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx);
-               /* fallthrough */
-               /* fallthrough */
+               fallthrough;
        case PBLE_CHUNK_MEM:
                i40iw_destroy_pble_pool(dev, iwdev->pble_rsrc);
-               /* fallthrough */
+               fallthrough;
        case CEQ_CREATED:
                i40iw_dele_ceqs(iwdev);
-               /* fallthrough */
+               fallthrough;
        case AEQ_CREATED:
                i40iw_destroy_aeq(iwdev);
-               /* fallthrough */
+               fallthrough;
        case IEQ_CREATED:
                i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, iwdev->reset);
-               /* fallthrough */
+               fallthrough;
        case ILQ_CREATED:
                i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, iwdev->reset);
-               /* fallthrough */
+               fallthrough;
        case CCQ_CREATED:
                i40iw_destroy_ccq(iwdev);
-               /* fallthrough */
+               fallthrough;
        case HMC_OBJS_CREATED:
                i40iw_del_hmc_objects(dev, dev->hmc_info, true, iwdev->reset);
-               /* fallthrough */
+               fallthrough;
        case CQP_CREATED:
                i40iw_destroy_cqp(iwdev, true);
-               /* fallthrough */
+               fallthrough;
        case INITIAL_STATE:
                i40iw_cleanup_cm_core(&iwdev->cm_core);
                if (iwdev->vsi.pestat) {
@@ -1528,7 +1527,6 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev)
                i40iw_del_init_mem(iwdev);
                break;
        case INVALID_STATE:
-               /* fallthrough */
        default:
                i40iw_pr_err("bad init_state = %d\n", iwdev->init_state);
                break;
index d9c7ae6..924be4b 100644 (file)
@@ -814,13 +814,13 @@ void i40iw_puda_dele_resources(struct i40iw_sc_vsi *vsi,
        switch (rsrc->completion) {
        case PUDA_HASH_CRC_COMPLETE:
                i40iw_free_hash_desc(rsrc->hash_desc);
-               /* fall through */
+               fallthrough;
        case PUDA_QP_CREATED:
                if (!reset)
                        i40iw_puda_free_qp(rsrc);
 
                i40iw_free_dma_mem(dev->hw, &rsrc->qpmem);
-               /* fallthrough */
+               fallthrough;
        case PUDA_CQ_CREATED:
                if (!reset)
                        i40iw_puda_free_cq(rsrc);
index 0165246..e07fb37 100644 (file)
@@ -190,9 +190,8 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,
        switch (event) {
        case NETDEV_DOWN:
                action = I40IW_ARP_DELETE;
-               /* Fall through */
+               fallthrough;
        case NETDEV_UP:
-               /* Fall through */
        case NETDEV_CHANGEADDR:
 
                /* Just skip if no need to handle ARP cache */
@@ -247,9 +246,8 @@ int i40iw_inet6addr_event(struct notifier_block *notifier,
        switch (event) {
        case NETDEV_DOWN:
                action = I40IW_ARP_DELETE;
-               /* Fall through */
+               fallthrough;
        case NETDEV_UP:
-               /* Fall through */
        case NETDEV_CHANGEADDR:
                i40iw_manage_arp_cache(iwdev,
                                       netdev->dev_addr,
@@ -344,7 +342,7 @@ int i40iw_netdevice_event(struct notifier_block *notifier,
        switch (event) {
        case NETDEV_DOWN:
                iwdev->iw_status = 0;
-               /* Fall through */
+               fallthrough;
        case NETDEV_UP:
                i40iw_port_ibevent(iwdev);
                break;
index 6957e4f..b513393 100644 (file)
@@ -810,7 +810,7 @@ void i40iw_hw_modify_qp(struct i40iw_device *iwdev, struct i40iw_qp *iwqp,
        case I40IW_QP_STATE_RTS:
                if (iwqp->iwarp_state == I40IW_QP_STATE_IDLE)
                        i40iw_send_reset(iwqp->cm_node);
-               /* fall through */
+               fallthrough;
        case I40IW_QP_STATE_IDLE:
        case I40IW_QP_STATE_TERMINATE:
        case I40IW_QP_STATE_CLOSING:
@@ -2144,7 +2144,6 @@ static int i40iw_post_send(struct ib_qp *ibqp,
 
                switch (ib_wr->opcode) {
                case IB_WR_SEND:
-                       /* fall-through */
                case IB_WR_SEND_WITH_INV:
                        if (ib_wr->opcode == IB_WR_SEND) {
                                if (ib_wr->send_flags & IB_SEND_SOLICITED)
@@ -2201,7 +2200,7 @@ static int i40iw_post_send(struct ib_qp *ibqp,
                        break;
                case IB_WR_RDMA_READ_WITH_INV:
                        inv_stag = true;
-                       /* fall-through*/
+                       fallthrough;
                case IB_WR_RDMA_READ:
                        if (ib_wr->num_sge > I40IW_MAX_SGE_RD) {
                                err = -EINVAL;
index f8b936b..8a34369 100644 (file)
@@ -765,13 +765,13 @@ repoll:
                switch (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) {
                case MLX4_OPCODE_RDMA_WRITE_IMM:
                        wc->wc_flags |= IB_WC_WITH_IMM;
-                       /* fall through */
+                       fallthrough;
                case MLX4_OPCODE_RDMA_WRITE:
                        wc->opcode    = IB_WC_RDMA_WRITE;
                        break;
                case MLX4_OPCODE_SEND_IMM:
                        wc->wc_flags |= IB_WC_WITH_IMM;
-                       /* fall through */
+                       fallthrough;
                case MLX4_OPCODE_SEND:
                case MLX4_OPCODE_SEND_INVAL:
                        wc->opcode    = IB_WC_SEND;
index d844831..5e4ec97 100644 (file)
@@ -944,7 +944,7 @@ int mlx4_ib_mcg_multiplex_handler(struct ib_device *ibdev, int port,
        switch (sa_mad->mad_hdr.method) {
        case IB_MGMT_METHOD_SET:
                may_create = 1;
-               /* fall through */
+               fallthrough;
        case IB_SA_METHOD_DELETE:
                req = kzalloc(sizeof *req, GFP_KERNEL);
                if (!req)
index f9ca6e0..2975f35 100644 (file)
@@ -1578,12 +1578,12 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
                pd = to_mxrcd(init_attr->xrcd)->pd;
                xrcdn = to_mxrcd(init_attr->xrcd)->xrcdn;
                init_attr->send_cq = to_mxrcd(init_attr->xrcd)->cq;
-               /* fall through */
+               fallthrough;
        case IB_QPT_XRC_INI:
                if (!(to_mdev(pd->device)->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC))
                        return ERR_PTR(-ENOSYS);
                init_attr->recv_cq = init_attr->send_cq;
-               /* fall through */
+               fallthrough;
        case IB_QPT_RC:
        case IB_QPT_UC:
        case IB_QPT_RAW_PACKET:
@@ -1592,7 +1592,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
                        return ERR_PTR(-ENOMEM);
                qp->pri.vid = 0xFFFF;
                qp->alt.vid = 0xFFFF;
-               /* fall through */
+               fallthrough;
        case IB_QPT_UD:
        {
                err = create_qp_common(pd, init_attr, udata, 0, &qp);
index 0133ebb..dceb0eb 100644 (file)
@@ -121,13 +121,13 @@ static void handle_good_req(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
        switch (be32_to_cpu(cqe->sop_drop_qpn) >> 24) {
        case MLX5_OPCODE_RDMA_WRITE_IMM:
                wc->wc_flags |= IB_WC_WITH_IMM;
-               /* fall through */
+               fallthrough;
        case MLX5_OPCODE_RDMA_WRITE:
                wc->opcode    = IB_WC_RDMA_WRITE;
                break;
        case MLX5_OPCODE_SEND_IMM:
                wc->wc_flags |= IB_WC_WITH_IMM;
-               /* fall through */
+               fallthrough;
        case MLX5_OPCODE_SEND:
        case MLX5_OPCODE_SEND_INVAL:
                wc->opcode    = IB_WC_SEND;
index 454ce5d..9bb9bb0 100644 (file)
@@ -250,9 +250,8 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
                if (MLX5_CAP_GEN(dev->mdev, vport_counters) &&
                    method == IB_MGMT_METHOD_GET)
                        return process_pma_cmd(dev, port_num, in, out);
-               /* fallthrough */
+               fallthrough;
        case MLX5_IB_VENDOR_CLASS1:
-               /* fallthrough */
        case MLX5_IB_VENDOR_CLASS2:
        case IB_MGMT_CLASS_CONG_MGMT: {
                if (method != IB_MGMT_METHOD_GET &&
index fbc45a5..d60d632 100644 (file)
@@ -2872,7 +2872,7 @@ static void mlx5_ib_handle_event(struct work_struct *_work)
                break;
        case MLX5_EVENT_TYPE_GENERAL_EVENT:
                handle_general_event(ibdev, work->param, &ibev);
-               /* fall through */
+               fallthrough;
        default:
                goto out;
        }
index 59fce5f..5758dbe 100644 (file)
@@ -416,7 +416,7 @@ static int sq_overhead(struct ib_qp_init_attr *attr)
        switch (attr->qp_type) {
        case IB_QPT_XRC_INI:
                size += sizeof(struct mlx5_wqe_xrc_seg);
-               /* fall through */
+               fallthrough;
        case IB_QPT_RC:
                size += sizeof(struct mlx5_wqe_ctrl_seg) +
                        max(sizeof(struct mlx5_wqe_atomic_seg) +
@@ -441,7 +441,7 @@ static int sq_overhead(struct ib_qp_init_attr *attr)
                if (attr->create_flags & IB_QP_CREATE_IPOIB_UD_LSO)
                        size += sizeof(struct mlx5_wqe_eth_pad) +
                                sizeof(struct mlx5_wqe_eth_seg);
-               /* fall through */
+               fallthrough;
        case IB_QPT_SMI:
        case MLX5_IB_QPT_HW_GSI:
                size += sizeof(struct mlx5_wqe_ctrl_seg) +
index 0823c0b..f051f4e 100644 (file)
@@ -115,7 +115,7 @@ static u8 ib_rate_to_memfree(u8 req_rate, u8 cur_rate)
        switch ((cur_rate - 1) / req_rate) {
        case 0:  return MTHCA_RATE_MEMFREE_FULL;
        case 1:  return MTHCA_RATE_MEMFREE_HALF;
-       case 2:  /* fall through */
+       case 2:
        case 3:  return MTHCA_RATE_MEMFREE_QUARTER;
        default: return MTHCA_RATE_MEMFREE_EIGHTH;
        }
index 6cdbec1..c1751c9 100644 (file)
@@ -2134,7 +2134,7 @@ int ocrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                case IB_WR_SEND_WITH_IMM:
                        hdr->cw |= (OCRDMA_FLAG_IMM << OCRDMA_WQE_FLAGS_SHIFT);
                        hdr->immdt = ntohl(wr->ex.imm_data);
-                       /* fall through */
+                       fallthrough;
                case IB_WR_SEND:
                        hdr->cw |= (OCRDMA_SEND << OCRDMA_WQE_OPCODE_SHIFT);
                        ocrdma_build_send(qp, hdr, wr);
@@ -2148,7 +2148,7 @@ int ocrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                case IB_WR_RDMA_WRITE_WITH_IMM:
                        hdr->cw |= (OCRDMA_FLAG_IMM << OCRDMA_WQE_FLAGS_SHIFT);
                        hdr->immdt = ntohl(wr->ex.imm_data);
-                       /* fall through */
+                       fallthrough;
                case IB_WR_RDMA_WRITE:
                        hdr->cw |= (OCRDMA_WRITE << OCRDMA_WQE_OPCODE_SHIFT);
                        status = ocrdma_build_write(qp, hdr, wr);
index 4ce4e2e..b49bef9 100644 (file)
@@ -3528,7 +3528,7 @@ static int __qedr_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                break;
        case IB_WR_RDMA_READ_WITH_INV:
                SET_FIELD2(wqe->flags, RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG, 1);
-               /* fallthrough -- same is identical to RDMA READ */
+               fallthrough;    /* same is identical to RDMA READ */
 
        case IB_WR_RDMA_READ:
                wqe->req_type = RDMA_SQ_REQ_TYPE_RDMA_RD;
index ca5ea73..44150be 100644 (file)
@@ -2973,11 +2973,11 @@ static u32 qib_6120_iblink_state(u64 ibcs)
                state = IB_PORT_ARMED;
                break;
        case IB_6120_L_STATE_ACTIVE:
-               /* fall through */
        case IB_6120_L_STATE_ACT_DEFER:
                state = IB_PORT_ACTIVE;
                break;
-       default: /* fall through */
+       default:
+               fallthrough;
        case IB_6120_L_STATE_DOWN:
                state = IB_PORT_DOWN;
                break;
index ea3ddb0..0a6f26d 100644 (file)
@@ -3586,11 +3586,11 @@ static u32 qib_7220_iblink_state(u64 ibcs)
                state = IB_PORT_ARMED;
                break;
        case IB_7220_L_STATE_ACTIVE:
-               /* fall through */
        case IB_7220_L_STATE_ACT_DEFER:
                state = IB_PORT_ACTIVE;
                break;
-       default: /* fall through */
+       default:
+               fallthrough;
        case IB_7220_L_STATE_DOWN:
                state = IB_PORT_DOWN;
                break;
index 8bcbc88..a10eab8 100644 (file)
@@ -5508,11 +5508,11 @@ static u32 qib_7322_iblink_state(u64 ibcs)
                state = IB_PORT_ARMED;
                break;
        case IB_7322_L_STATE_ACTIVE:
-               /* fall through */
        case IB_7322_L_STATE_ACT_DEFER:
                state = IB_PORT_ACTIVE;
                break;
-       default: /* fall through */
+       default:
+               fallthrough;
        case IB_7322_L_STATE_DOWN:
                state = IB_PORT_DOWN;
                break;
@@ -6533,7 +6533,7 @@ static int qib_init_7322_variables(struct qib_devdata *dd)
                                    "Invalid num_vls %u, using 4 VLs\n",
                                    qib_num_cfg_vls);
                        qib_num_cfg_vls = 4;
-                       /* fall through */
+                       fallthrough;
                case 4:
                        ppd->vls_supported = IB_VL_VL0_3;
                        break;
index 79bb832..e7789e7 100644 (file)
@@ -433,7 +433,7 @@ static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags)
                        /* Bad mkey not a violation below level 2 */
                        if (ibp->rvp.mkeyprot < 2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case IB_MGMT_METHOD_SET:
                case IB_MGMT_METHOD_TRAP_REPRESS:
                        if (ibp->rvp.mkey_violations != 0xFFFF)
@@ -828,7 +828,7 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
        case IB_PORT_NOP:
                if (lstate == 0)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case IB_PORT_DOWN:
                if (lstate == 0)
                        lstate = QIB_IB_LINKDOWN_ONLY;
@@ -1928,7 +1928,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags,
                                ret = IB_MAD_RESULT_SUCCESS;
                                goto bail;
                        }
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        smp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply(smp);
@@ -1962,7 +1962,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags,
                                ret = IB_MAD_RESULT_SUCCESS;
                                goto bail;
                        }
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        smp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply(smp);
@@ -2322,7 +2322,7 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
                        ret = cc_get_congestion_control_table(ccp, ibdev, port);
                        goto bail;
 
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        ccp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply((struct ib_smp *) ccp);
@@ -2339,7 +2339,7 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
                        ret = cc_set_congestion_control_table(ccp, ibdev, port);
                        goto bail;
 
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        ccp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply((struct ib_smp *) ccp);
index aaf7438..3915e5b 100644 (file)
@@ -83,7 +83,7 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
                        rvt_put_mr(e->rdma_sge.mr);
                        e->rdma_sge.mr = NULL;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(ATOMIC_ACKNOWLEDGE):
                /*
                 * We can increment the tail pointer now that the last
@@ -92,7 +92,7 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
                 */
                if (++qp->s_tail_ack_queue > QIB_MAX_RDMA_ATOMIC)
                        qp->s_tail_ack_queue = 0;
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_ONLY):
        case OP(ACKNOWLEDGE):
                /* Check for no next entry in the queue. */
@@ -149,7 +149,7 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
 
        case OP(RDMA_READ_RESPONSE_FIRST):
                qp->s_ack_state = OP(RDMA_READ_RESPONSE_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_READ_RESPONSE_MIDDLE):
                qp->s_cur_sge = &qp->s_ack_rdma_sge;
                qp->s_rdma_mr = qp->s_ack_rdma_sge.sge.mr;
@@ -471,10 +471,10 @@ no_flow_control:
                 * See qib_restart_rc().
                 */
                qp->s_len = restart_sge(&qp->s_sge, wqe, qp->s_psn, pmtu);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_FIRST):
                qp->s_state = OP(SEND_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
                bth2 = qp->s_psn++ & QIB_PSN_MASK;
                ss = &qp->s_sge;
@@ -510,10 +510,10 @@ no_flow_control:
                 * See qib_restart_rc().
                 */
                qp->s_len = restart_sge(&qp->s_sge, wqe, qp->s_psn, pmtu);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_FIRST):
                qp->s_state = OP(RDMA_WRITE_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_MIDDLE):
                bth2 = qp->s_psn++ & QIB_PSN_MASK;
                ss = &qp->s_sge;
@@ -1807,7 +1807,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,
                if (!ret)
                        goto rnr_nak;
                qp->r_rcv_len = 0;
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
        case OP(RDMA_WRITE_MIDDLE):
 send_middle:
@@ -1839,7 +1839,7 @@ send_middle:
                qp->r_rcv_len = 0;
                if (opcode == OP(SEND_ONLY))
                        goto no_immediate_data;
-               /* fall through -- for SEND_ONLY_WITH_IMMEDIATE */
+               fallthrough;    /* for SEND_ONLY_WITH_IMMEDIATE */
        case OP(SEND_LAST_WITH_IMMEDIATE):
 send_last_imm:
                wc.ex.imm_data = ohdr->u.imm_data;
index 99e11c3..8f8d617 100644 (file)
@@ -763,7 +763,7 @@ void __qib_sdma_process_event(struct qib_pportdata *ppd,
                         * bringing the link up with traffic active on
                         * 7220, e.g. */
                        ss->go_s99_running = 1;
-                       /* fall through -- and start dma engine */
+                       fallthrough;    /* and start dma engine */
                case qib_sdma_event_e10_go_hw_start:
                        /* This reference means the state machine is started */
                        sdma_get(&ppd->sdma_state);
index e17b91e..554af42 100644 (file)
@@ -161,7 +161,7 @@ int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags)
 
        case OP(SEND_FIRST):
                qp->s_state = OP(SEND_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
                len = qp->s_len;
                if (len > pmtu) {
@@ -185,7 +185,7 @@ int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags)
 
        case OP(RDMA_WRITE_FIRST):
                qp->s_state = OP(RDMA_WRITE_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_MIDDLE):
                len = qp->s_len;
                if (len > pmtu) {
@@ -351,7 +351,7 @@ send_first:
                        goto no_immediate_data;
                else if (opcode == OP(SEND_ONLY_WITH_IMMEDIATE))
                        goto send_last_imm;
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
                /* Check for invalid length PMTU or posted rwqe len. */
                if (unlikely(tlen != (hdrsize + pmtu + 4)))
@@ -440,7 +440,7 @@ rdma_first:
                        wc.ex.imm_data = ohdr->u.rc.imm_data;
                        goto rdma_last_imm;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_MIDDLE):
                /* Check for invalid length PMTU or posted rwqe len. */
                if (unlikely(tlen != (hdrsize + pmtu + 4)))
index 7acf9ba..f6c01ba 100644 (file)
@@ -237,7 +237,7 @@ static void qib_qp_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,
        case IB_QPT_GSI:
                if (ib_qib_disable_sma)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case IB_QPT_UD:
                qib_ud_rcv(ibp, hdr, has_grh, data, tlen, qp);
                break;
index c9abe1c..662e7fc 100644 (file)
@@ -120,7 +120,7 @@ static void usnic_ib_qp_grp_modify_active_to_err(struct usnic_ib_dev *us_ibdev)
                                                                IB_QPS_ERR,
                                                                NULL);
                                if (status) {
-                                       usnic_err("Failed to transistion qp grp %u from %s to %s\n",
+                                       usnic_err("Failed to transition qp grp %u from %s to %s\n",
                                                qp_grp->grp_id,
                                                usnic_ib_qp_grp_state_to_string
                                                (cur_state),
index afcc2ab..9a8f2a9 100644 (file)
@@ -238,7 +238,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                        ret = -EINVAL;
                        goto err_qp;
                }
-               /* fall through */
+               fallthrough;
        case IB_QPT_RC:
        case IB_QPT_UD:
                qp = kzalloc(sizeof(*qp), GFP_KERNEL);
index 332a8ba..ee48bef 100644 (file)
@@ -1111,7 +1111,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                if (init_attr->port_num == 0 ||
                    init_attr->port_num > ibpd->device->phys_port_cnt)
                        return ERR_PTR(-EINVAL);
-               /* fall through */
+               fallthrough;
        case IB_QPT_UC:
        case IB_QPT_RC:
        case IB_QPT_UD:
index 4bc8870..7b4df00 100644 (file)
@@ -282,7 +282,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
                if ((syn & AETH_TYPE_MASK) != AETH_ACK)
                        return COMPST_ERROR;
 
-               /* fall through */
+               fallthrough;
                /* (IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE doesn't have an AETH)
                 */
        case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE:
index 08f05ac..ecdac3f 100644 (file)
@@ -71,7 +71,7 @@ void rxe_do_task(unsigned long data)
 
        case TASK_STATE_BUSY:
                task->state = TASK_STATE_ARMED;
-               /* fall through */
+               fallthrough;
        case TASK_STATE_ARMED:
                spin_unlock_irqrestore(&task->state_lock, flags);
                return;
index bb61e53..658939e 100644 (file)
@@ -540,7 +540,7 @@ static void init_send_wr(struct rxe_qp *qp, struct rxe_send_wr *wr,
                switch (wr->opcode) {
                case IB_WR_RDMA_WRITE_WITH_IMM:
                        wr->ex.imm_data = ibwr->ex.imm_data;
-                       /* fall through */
+                       fallthrough;
                case IB_WR_RDMA_READ:
                case IB_WR_RDMA_WRITE:
                        wr->wr.rdma.remote_addr = rdma_wr(ibwr)->remote_addr;
index 1662216..66764f7 100644 (file)
@@ -1224,12 +1224,10 @@ static void siw_cm_llp_data_ready(struct sock *sk)
 
        switch (cep->state) {
        case SIW_EPSTATE_RDMA_MODE:
-               /* fall through */
        case SIW_EPSTATE_LISTENING:
                break;
 
        case SIW_EPSTATE_AWAIT_MPAREQ:
-               /* fall through */
        case SIW_EPSTATE_AWAIT_MPAREP:
                siw_cm_queue_work(cep, SIW_CM_WORK_READ_MPAHDR);
                break;
index 857be5a..4bd1f1f 100644 (file)
@@ -1215,7 +1215,7 @@ static int siw_rdmap_complete(struct siw_qp *qp, int error)
        case RDMAP_SEND_SE:
        case RDMAP_SEND_SE_INVAL:
                wqe->rqe.flags |= SIW_WQE_SOLICITED;
-               /* Fall through */
+               fallthrough;
 
        case RDMAP_SEND:
        case RDMAP_SEND_INVAL:
@@ -1386,7 +1386,7 @@ int siw_tcp_rx_data(read_descriptor_t *rd_desc, struct sk_buff *skb,
                         * DDP segment.
                         */
                        qp->rx_fpdu->first_ddp_seg = 0;
-                       /* Fall through */
+                       fallthrough;
 
                case SIW_GET_DATA_START:
                        /*
index 9f53aa4..d19d832 100644 (file)
@@ -1042,7 +1042,7 @@ next_wqe:
                case SIW_OP_SEND_REMOTE_INV:
                case SIW_OP_WRITE:
                        siw_wqe_put_mem(wqe, tx_type);
-                       /* Fall through */
+                       fallthrough;
 
                case SIW_OP_INVAL_STAG:
                case SIW_OP_REG_MR:
@@ -1128,7 +1128,7 @@ next_wqe:
                case SIW_OP_READ:
                case SIW_OP_READ_LOCAL_INV:
                        siw_wqe_put_mem(wqe, tx_type);
-                       /* Fall through */
+                       fallthrough;
 
                case SIW_OP_INVAL_STAG:
                case SIW_OP_REG_MR:
index 9bf0fa3..7c41fb0 100644 (file)
@@ -512,13 +512,13 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id,
                return ipoib_cm_req_handler(cm_id, event);
        case IB_CM_DREQ_RECEIVED:
                ib_send_cm_drep(cm_id, NULL, 0);
-               /* Fall through */
+               fallthrough;
        case IB_CM_REJ_RECEIVED:
                p = cm_id->context;
                priv = ipoib_priv(p->dev);
                if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE))
                        ipoib_warn(priv, "unable to move qp to error state\n");
-               /* Fall through */
+               fallthrough;
        default:
                return 0;
        }
index 752581a..ab75b7f 100644 (file)
@@ -502,7 +502,7 @@ static struct net_device *ipoib_get_net_dev_by_params(
        default:
                dev_warn_ratelimited(&dev->dev,
                                     "duplicate IP address detected\n");
-               /* Fall through */
+               fallthrough;
        case 1:
                return net_dev;
        }
index 699e075..2f3ebc0 100644 (file)
@@ -711,7 +711,7 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
        case RDMA_CM_EVENT_REJECTED:
                iser_info("Connection rejected: %s\n",
                         rdma_reject_msg(cma_id, event->status));
-               /* FALLTHROUGH */
+               fallthrough;
        case RDMA_CM_EVENT_ADDR_ERROR:
        case RDMA_CM_EVENT_ROUTE_ERROR:
        case RDMA_CM_EVENT_CONNECT_ERROR:
index 61e2f7f..e86acda 100644 (file)
@@ -664,8 +664,8 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_ESTABLISHED:
                isert_connected_handler(cma_id);
                break;
-       case RDMA_CM_EVENT_ADDR_CHANGE:    /* FALLTHRU */
-       case RDMA_CM_EVENT_DISCONNECTED:   /* FALLTHRU */
+       case RDMA_CM_EVENT_ADDR_CHANGE:
+       case RDMA_CM_EVENT_DISCONNECTED:
        case RDMA_CM_EVENT_TIMEWAIT_EXIT:  /* FALLTHRU */
                ret = isert_disconnected_handler(cma_id, event->event);
                break;
@@ -684,7 +684,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_REJECTED:
                isert_info("Connection rejected: %s\n",
                           rdma_reject_msg(cma_id, event->status));
-               /* fall through */
+               fallthrough;
        case RDMA_CM_EVENT_UNREACHABLE:
        case RDMA_CM_EVENT_CONNECT_ERROR:
                ret = isert_connect_error(cma_id);
@@ -1470,7 +1470,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd, bool comp_err)
                        transport_generic_free_cmd(&cmd->se_cmd, 0);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                iscsit_release_cmd(cmd);
                break;
@@ -1648,7 +1648,7 @@ isert_do_control_comp(struct work_struct *work)
        switch (cmd->i_state) {
        case ISTATE_SEND_TASKMGTRSP:
                iscsit_tmr_post_handler(cmd, cmd->conn);
-               /* fall through */
+               fallthrough;
        case ISTATE_SEND_REJECT:
        case ISTATE_SEND_TEXTRSP:
                cmd->i_state = ISTATE_SENT_STATUS;
index 874a8eb..4933085 100644 (file)
@@ -547,7 +547,6 @@ static void vema_get(struct opa_vnic_vema_port *port,
                vema_get_mac_entries(port, recvd_mad, rsp_mad);
                break;
        case OPA_EM_ATTR_IFACE_UCAST_MACS:
-               /* fall through */
        case OPA_EM_ATTR_IFACE_MCAST_MACS:
                vema_get_mac_list(port, recvd_mad, rsp_mad, attr_id);
                break;
index e78c4c7..76ffdec 100644 (file)
@@ -102,12 +102,12 @@ static irqreturn_t fsia6b_serio_irq(struct serio *serio,
                                        input_report_key(fsia6b->dev,
                                                         sw_id++,
                                                         sw_state == 0);
-                                       /* fall-through */
+                                       fallthrough;
                                case '2':
                                        input_report_key(fsia6b->dev,
                                                         sw_id++,
                                                         sw_state == 1);
-                                       /* fall-through */
+                                       fallthrough;
                                case '1':
                                        input_report_key(fsia6b->dev,
                                                         sw_id++,
index 88df68c..d37645e 100644 (file)
@@ -885,7 +885,6 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type)
 
        case GC_MULTI:
                input_set_capability(input_dev, EV_KEY, BTN_TRIGGER);
-               /* fall through */
                break;
 
        case GC_PSX:
index 959c1d8..1cedb45 100644 (file)
@@ -213,7 +213,7 @@ static void wacom_handle_model_response(struct wacom *wacom)
                case 0x3731: /* PL-710 */
                        wacom->res_x = 2540;
                        wacom->res_y = 2540;
-                       /* fall through */
+                       fallthrough;
                case 0x3535: /* PL-550 */
                case 0x3830: /* PL-800 */
                        wacom->extra_z_bits = 2;
index 6b71b0a..98f17fa 100644 (file)
@@ -477,7 +477,7 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data, bool retry)
                        bootloader = appmode - 0x24;
                        break;
                }
-               /* Fall through - for normal case */
+               fallthrough;    /* for normal case */
        case 0x4c:
        case 0x4d:
        case 0x5a:
index 82920ff..2e70c0b 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#include <plat/adc.h>
-#include <plat/regs-adc.h>
+#include <linux/soc/samsung/s3c-adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
+#define        S3C2410_ADCCON                  (0x00)
+#define        S3C2410_ADCTSC                  (0x04)
+#define        S3C2410_ADCDLY                  (0x08)
+#define        S3C2410_ADCDAT0                 (0x0C)
+#define        S3C2410_ADCDAT1                 (0x10)
+#define        S3C64XX_ADCUPDN                 (0x14)
+#define        S3C2443_ADCMUX                  (0x18)
+#define        S3C64XX_ADCCLRINT               (0x18)
+#define        S5P_ADCMUX                      (0x1C)
+#define        S3C64XX_ADCCLRINTPNDNUP         (0x20)
+
+/* ADCTSC Register Bits */
+#define S3C2443_ADCTSC_UD_SEN          (1 << 8)
+#define S3C2410_ADCTSC_YM_SEN          (1<<7)
+#define S3C2410_ADCTSC_YP_SEN          (1<<6)
+#define S3C2410_ADCTSC_XM_SEN          (1<<5)
+#define S3C2410_ADCTSC_XP_SEN          (1<<4)
+#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
+#define S3C2410_ADCTSC_AUTO_PST                (1<<2)
+#define S3C2410_ADCTSC_XY_PST(x)       (((x)&0x3)<<0)
+
+/* ADCDAT0 Bits */
+#define S3C2410_ADCDAT0_UPDOWN         (1<<15)
+#define S3C2410_ADCDAT0_AUTO_PST       (1<<14)
+#define S3C2410_ADCDAT0_XY_PST         (0x3<<12)
+#define S3C2410_ADCDAT0_XPDATA_MASK    (0x03FF)
+
+/* ADCDAT1 Bits */
+#define S3C2410_ADCDAT1_UPDOWN         (1<<15)
+#define S3C2410_ADCDAT1_AUTO_PST       (1<<14)
+#define S3C2410_ADCDAT1_XY_PST         (0x3<<12)
+#define S3C2410_ADCDAT1_YPDATA_MASK    (0x03FF)
+
+
 #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
 #define INT_DOWN       (0)
index 607d1ae..bb1699e 100644 (file)
@@ -290,7 +290,7 @@ static int wm831x_ts_probe(struct platform_device *pdev)
                default:
                        dev_err(&pdev->dev, "Unsupported ISEL setting: %d\n",
                                pdata->isel);
-                       /* Fall through */
+                       fallthrough;
                case 200:
                case 0:
                        wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_2,
index 958050c..c652f16 100644 (file)
@@ -2258,7 +2258,7 @@ static void iommu_enable_ga(struct amd_iommu *iommu)
        switch (amd_iommu_guest_ir) {
        case AMD_IOMMU_GUEST_IR_VAPIC:
                iommu_feature_enable(iommu, CONTROL_GAM_EN);
-               /* Fall through */
+               fallthrough;
        case AMD_IOMMU_GUEST_IR_LEGACY_GA:
                iommu_feature_enable(iommu, CONTROL_GA_EN);
                iommu->irte_ops = &irte_128_ops;
index 7196207..c192544 100644 (file)
@@ -903,7 +903,7 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent)
                break;
        case CMDQ_OP_CFGI_CD:
                cmd[0] |= FIELD_PREP(CMDQ_CFGI_0_SSID, ent->cfgi.ssid);
-               /* Fallthrough */
+               fallthrough;
        case CMDQ_OP_CFGI_STE:
                cmd[0] |= FIELD_PREP(CMDQ_CFGI_0_SID, ent->cfgi.sid);
                cmd[1] |= FIELD_PREP(CMDQ_CFGI_1_LEAF, ent->cfgi.leaf);
@@ -936,7 +936,7 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent)
                break;
        case CMDQ_OP_TLBI_NH_ASID:
                cmd[0] |= FIELD_PREP(CMDQ_TLBI_0_ASID, ent->tlbi.asid);
-               /* Fallthrough */
+               fallthrough;
        case CMDQ_OP_TLBI_S12_VMALL:
                cmd[0] |= FIELD_PREP(CMDQ_TLBI_0_VMID, ent->tlbi.vmid);
                break;
@@ -1036,7 +1036,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
                 */
                return;
        case CMDQ_ERR_CERROR_ILL_IDX:
-               /* Fallthrough */
        default:
                break;
        }
@@ -3758,7 +3757,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
        switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
        case IDR0_STALL_MODEL_FORCE:
                smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
-               /* Fallthrough */
+               fallthrough;
        case IDR0_STALL_MODEL_STALL:
                smmu->features |= ARM_SMMU_FEAT_STALLS;
        }
@@ -3778,7 +3777,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
        switch (FIELD_GET(IDR0_TTF, reg)) {
        case IDR0_TTF_AARCH32_64:
                smmu->ias = 40;
-               /* Fallthrough */
+               fallthrough;
        case IDR0_TTF_AARCH64:
                break;
        default:
@@ -3875,7 +3874,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
        default:
                dev_info(smmu->dev,
                        "unknown output address size. Truncating to 48-bit\n");
-               /* Fallthrough */
+               fallthrough;
        case IDR5_OAS_48_BIT:
                smmu->oas = 48;
        }
index 4959f5d..5141d49 100644 (file)
@@ -1035,8 +1035,8 @@ static void *iommu_dma_alloc(struct device *dev, size_t size,
 
        if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) &&
            !gfpflags_allow_blocking(gfp) && !coherent)
-               cpu_addr = dma_alloc_from_pool(dev, PAGE_ALIGN(size), &page,
-                                              gfp);
+               page = dma_alloc_from_pool(dev, PAGE_ALIGN(size), &cpu_addr,
+                                              gfp, NULL);
        else
                cpu_addr = iommu_dma_alloc_pages(dev, size, &page, gfp, attrs);
        if (!cpu_addr)
index e9864e5..f8177c5 100644 (file)
@@ -5070,7 +5070,6 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
 
        switch (type) {
        case IOMMU_DOMAIN_DMA:
-       /* fallthrough */
        case IOMMU_DOMAIN_UNMANAGED:
                dmar_domain = alloc_domain(0);
                if (!dmar_domain) {
index b4da396..2bfdd57 100644 (file)
@@ -440,7 +440,7 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
        default:
                dev_warn(vdev->dev, "unknown resv mem subtype 0x%x\n",
                         mem->subtype);
-               /* Fall-through */
+               fallthrough;
        case VIRTIO_IOMMU_RESV_MEM_T_RESERVED:
                region = iommu_alloc_resv_region(start, size, 0,
                                                 IOMMU_RESV_RESERVED);
index bb70b71..bfc9719 100644 (file)
@@ -425,7 +425,7 @@ config GOLDFISH_PIC
          for Goldfish based virtual platforms.
 
 config QCOM_PDC
-       tristate "QCOM PDC"
+       bool "QCOM PDC"
        depends on ARCH_QCOM
        select IRQ_DOMAIN_HIERARCHY
        help
index 133f9c4..8c983ad 100644 (file)
@@ -16,7 +16,6 @@ obj-$(CONFIG_ARCH_LPC32XX)            += irq-lpc32xx.o
 obj-$(CONFIG_ARCH_MMP)                 += irq-mmp.o
 obj-$(CONFIG_IRQ_MXS)                  += irq-mxs.o
 obj-$(CONFIG_ARCH_TEGRA)               += irq-tegra.o
-obj-$(CONFIG_ARCH_S3C24XX)             += irq-s3c24xx.o
 obj-$(CONFIG_DW_APB_ICTL)              += irq-dw-apb-ictl.o
 obj-$(CONFIG_CLPS711X_IRQCHIP)         += irq-clps711x.o
 obj-$(CONFIG_OMPIC)                    += irq-ompic.o
index 95f0974..548de75 100644 (file)
@@ -2737,7 +2737,7 @@ static bool allocate_vpe_l2_table(int cpu, u32 id)
        switch (gpsz) {
        default:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        case GIC_PAGE_SIZE_4K:
                psz = SZ_4K;
                break;
@@ -2832,7 +2832,7 @@ static int allocate_vpe_l1_table(void)
        switch (gpsz) {
        default:
                gpsz = GIC_PAGE_SIZE_4K;
-               /* fall through */
+               fallthrough;
        case GIC_PAGE_SIZE_4K:
                psz = SZ_4K;
                break;
index 324f280..850842f 100644 (file)
@@ -965,10 +965,10 @@ static void gic_cpu_sys_reg_init(void)
                case 7:
                        write_gicreg(0, ICC_AP0R3_EL1);
                        write_gicreg(0, ICC_AP0R2_EL1);
-               /* Fall through */
+                       fallthrough;
                case 6:
                        write_gicreg(0, ICC_AP0R1_EL1);
-               /* Fall through */
+                       fallthrough;
                case 5:
                case 4:
                        write_gicreg(0, ICC_AP0R0_EL1);
@@ -982,10 +982,10 @@ static void gic_cpu_sys_reg_init(void)
        case 7:
                write_gicreg(0, ICC_AP1R3_EL1);
                write_gicreg(0, ICC_AP1R2_EL1);
-               /* Fall through */
+               fallthrough;
        case 6:
                write_gicreg(0, ICC_AP1R1_EL1);
-               /* Fall through */
+               fallthrough;
        case 5:
        case 4:
                write_gicreg(0, ICC_AP1R0_EL1);
index 4f74c15..7031ef4 100644 (file)
@@ -259,7 +259,7 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
                case 4:
                        writel_relaxed(~0, reg + GPC_IMR1_CORE2);
                        writel_relaxed(~0, reg + GPC_IMR1_CORE3);
-                       /* fall through */
+                       fallthrough;
                case 2:
                        writel_relaxed(~0, reg + GPC_IMR1_CORE0);
                        writel_relaxed(~0, reg + GPC_IMR1_CORE1);
index 9f3da42..b61a890 100644 (file)
@@ -125,7 +125,7 @@ static int __init ingenic_intc_of_init(struct device_node *node,
                irq_reg_writel(gc, IRQ_MSK(32), JZ_REG_INTC_SET_MASK);
        }
 
-       if (request_irq(parent_irq, intc_cascade, 0,
+       if (request_irq(parent_irq, intc_cascade, IRQF_NO_SUSPEND,
                        "SoC intc cascade interrupt", NULL))
                pr_err("Failed to register SoC intc cascade interrupt\n");
        return 0;
index aacfa01..2158859 100644 (file)
@@ -480,7 +480,7 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq,
        case GIC_LOCAL_INT_TIMER:
                /* CONFIG_MIPS_CMP workaround (see __gic_init) */
                map = GIC_MAP_PIN_MAP_TO_PIN | timer_cpu_pin;
-               /* fall-through */
+               fallthrough;
        case GIC_LOCAL_INT_PERFCTR:
        case GIC_LOCAL_INT_FDC:
                /*
index 62a6127..69ba8ce 100644 (file)
@@ -295,6 +295,4 @@ out_free:
        return ret;
 }
 
-IRQCHIP_PLATFORM_DRIVER_BEGIN(mtk_cirq)
-IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init)
-IRQCHIP_PLATFORM_DRIVER_END(mtk_cirq)
+IRQCHIP_DECLARE(mtk_cirq, "mediatek,mtk-cirq", mtk_cirq_of_init);
index 7299c5a..6ff98b8 100644 (file)
@@ -231,6 +231,4 @@ out_free_chip:
        kfree(chip_data);
        return ret;
 }
-IRQCHIP_PLATFORM_DRIVER_BEGIN(mtk_sysirq)
-IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init)
-IRQCHIP_PLATFORM_DRIVER_END(mtk_sysirq)
+IRQCHIP_DECLARE(mtk_sysirq, "mediatek,mt6577-sysirq", mtk_sysirq_of_init);
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
deleted file mode 100644 (file)
index d2031fe..0000000
+++ /dev/null
@@ -1,1330 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * S3C24XX IRQ handling
- *
- * Copyright (c) 2003-2004 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
-*/
-
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/io.h>
-#include <linux/err.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/device.h>
-#include <linux/irqdomain.h>
-#include <linux/irqchip.h>
-#include <linux/irqchip/chained_irq.h>
-#include <linux/of.h>
-#include <linux/of_irq.h>
-#include <linux/of_address.h>
-
-#include <asm/exception.h>
-#include <asm/mach/irq.h>
-
-#include <mach/regs-irq.h>
-#include <mach/regs-gpio.h>
-
-#include <plat/cpu.h>
-#include <plat/regs-irqtype.h>
-#include <plat/pm.h>
-
-#define S3C_IRQTYPE_NONE       0
-#define S3C_IRQTYPE_EINT       1
-#define S3C_IRQTYPE_EDGE       2
-#define S3C_IRQTYPE_LEVEL      3
-
-struct s3c_irq_data {
-       unsigned int type;
-       unsigned long offset;
-       unsigned long parent_irq;
-
-       /* data gets filled during init */
-       struct s3c_irq_intc *intc;
-       unsigned long sub_bits;
-       struct s3c_irq_intc *sub_intc;
-};
-
-/*
- * Structure holding the controller data
- * @reg_pending                register holding pending irqs
- * @reg_intpnd         special register intpnd in main intc
- * @reg_mask           mask register
- * @domain             irq_domain of the controller
- * @parent             parent controller for ext and sub irqs
- * @irqs               irq-data, always s3c_irq_data[32]
- */
-struct s3c_irq_intc {
-       void __iomem            *reg_pending;
-       void __iomem            *reg_intpnd;
-       void __iomem            *reg_mask;
-       struct irq_domain       *domain;
-       struct s3c_irq_intc     *parent;
-       struct s3c_irq_data     *irqs;
-};
-
-/*
- * Array holding pointers to the global controller structs
- * [0] ... main_intc
- * [1] ... sub_intc
- * [2] ... main_intc2 on s3c2416
- */
-static struct s3c_irq_intc *s3c_intc[3];
-
-static void s3c_irq_mask(struct irq_data *data)
-{
-       struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
-       struct s3c_irq_intc *intc = irq_data->intc;
-       struct s3c_irq_intc *parent_intc = intc->parent;
-       struct s3c_irq_data *parent_data;
-       unsigned long mask;
-       unsigned int irqno;
-
-       mask = readl_relaxed(intc->reg_mask);
-       mask |= (1UL << irq_data->offset);
-       writel_relaxed(mask, intc->reg_mask);
-
-       if (parent_intc) {
-               parent_data = &parent_intc->irqs[irq_data->parent_irq];
-
-               /* check to see if we need to mask the parent IRQ
-                * The parent_irq is always in main_intc, so the hwirq
-                * for find_mapping does not need an offset in any case.
-                */
-               if ((mask & parent_data->sub_bits) == parent_data->sub_bits) {
-                       irqno = irq_find_mapping(parent_intc->domain,
-                                        irq_data->parent_irq);
-                       s3c_irq_mask(irq_get_irq_data(irqno));
-               }
-       }
-}
-
-static void s3c_irq_unmask(struct irq_data *data)
-{
-       struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
-       struct s3c_irq_intc *intc = irq_data->intc;
-       struct s3c_irq_intc *parent_intc = intc->parent;
-       unsigned long mask;
-       unsigned int irqno;
-
-       mask = readl_relaxed(intc->reg_mask);
-       mask &= ~(1UL << irq_data->offset);
-       writel_relaxed(mask, intc->reg_mask);
-
-       if (parent_intc) {
-               irqno = irq_find_mapping(parent_intc->domain,
-                                        irq_data->parent_irq);
-               s3c_irq_unmask(irq_get_irq_data(irqno));
-       }
-}
-
-static inline void s3c_irq_ack(struct irq_data *data)
-{
-       struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
-       struct s3c_irq_intc *intc = irq_data->intc;
-       unsigned long bitval = 1UL << irq_data->offset;
-
-       writel_relaxed(bitval, intc->reg_pending);
-       if (intc->reg_intpnd)
-               writel_relaxed(bitval, intc->reg_intpnd);
-}
-
-static int s3c_irq_type(struct irq_data *data, unsigned int type)
-{
-       switch (type) {
-       case IRQ_TYPE_NONE:
-               break;
-       case IRQ_TYPE_EDGE_RISING:
-       case IRQ_TYPE_EDGE_FALLING:
-       case IRQ_TYPE_EDGE_BOTH:
-               irq_set_handler(data->irq, handle_edge_irq);
-               break;
-       case IRQ_TYPE_LEVEL_LOW:
-       case IRQ_TYPE_LEVEL_HIGH:
-               irq_set_handler(data->irq, handle_level_irq);
-               break;
-       default:
-               pr_err("No such irq type %d\n", type);
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
-static int s3c_irqext_type_set(void __iomem *gpcon_reg,
-                              void __iomem *extint_reg,
-                              unsigned long gpcon_offset,
-                              unsigned long extint_offset,
-                              unsigned int type)
-{
-       unsigned long newvalue = 0, value;
-
-       /* Set the GPIO to external interrupt mode */
-       value = readl_relaxed(gpcon_reg);
-       value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset);
-       writel_relaxed(value, gpcon_reg);
-
-       /* Set the external interrupt to pointed trigger type */
-       switch (type)
-       {
-               case IRQ_TYPE_NONE:
-                       pr_warn("No edge setting!\n");
-                       break;
-
-               case IRQ_TYPE_EDGE_RISING:
-                       newvalue = S3C2410_EXTINT_RISEEDGE;
-                       break;
-
-               case IRQ_TYPE_EDGE_FALLING:
-                       newvalue = S3C2410_EXTINT_FALLEDGE;
-                       break;
-
-               case IRQ_TYPE_EDGE_BOTH:
-                       newvalue = S3C2410_EXTINT_BOTHEDGE;
-                       break;
-
-               case IRQ_TYPE_LEVEL_LOW:
-                       newvalue = S3C2410_EXTINT_LOWLEV;
-                       break;
-
-               case IRQ_TYPE_LEVEL_HIGH:
-                       newvalue = S3C2410_EXTINT_HILEV;
-                       break;
-
-               default:
-                       pr_err("No such irq type %d\n", type);
-                       return -EINVAL;
-       }
-
-       value = readl_relaxed(extint_reg);
-       value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
-       writel_relaxed(value, extint_reg);
-
-       return 0;
-}
-
-static int s3c_irqext_type(struct irq_data *data, unsigned int type)
-{
-       void __iomem *extint_reg;
-       void __iomem *gpcon_reg;
-       unsigned long gpcon_offset, extint_offset;
-
-       if ((data->hwirq >= 4) && (data->hwirq <= 7)) {
-               gpcon_reg = S3C2410_GPFCON;
-               extint_reg = S3C24XX_EXTINT0;
-               gpcon_offset = (data->hwirq) * 2;
-               extint_offset = (data->hwirq) * 4;
-       } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) {
-               gpcon_reg = S3C2410_GPGCON;
-               extint_reg = S3C24XX_EXTINT1;
-               gpcon_offset = (data->hwirq - 8) * 2;
-               extint_offset = (data->hwirq - 8) * 4;
-       } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) {
-               gpcon_reg = S3C2410_GPGCON;
-               extint_reg = S3C24XX_EXTINT2;
-               gpcon_offset = (data->hwirq - 8) * 2;
-               extint_offset = (data->hwirq - 16) * 4;
-       } else {
-               return -EINVAL;
-       }
-
-       return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
-                                  extint_offset, type);
-}
-
-static int s3c_irqext0_type(struct irq_data *data, unsigned int type)
-{
-       void __iomem *extint_reg;
-       void __iomem *gpcon_reg;
-       unsigned long gpcon_offset, extint_offset;
-
-       if (data->hwirq <= 3) {
-               gpcon_reg = S3C2410_GPFCON;
-               extint_reg = S3C24XX_EXTINT0;
-               gpcon_offset = (data->hwirq) * 2;
-               extint_offset = (data->hwirq) * 4;
-       } else {
-               return -EINVAL;
-       }
-
-       return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
-                                  extint_offset, type);
-}
-
-static struct irq_chip s3c_irq_chip = {
-       .name           = "s3c",
-       .irq_ack        = s3c_irq_ack,
-       .irq_mask       = s3c_irq_mask,
-       .irq_unmask     = s3c_irq_unmask,
-       .irq_set_type   = s3c_irq_type,
-       .irq_set_wake   = s3c_irq_wake
-};
-
-static struct irq_chip s3c_irq_level_chip = {
-       .name           = "s3c-level",
-       .irq_mask       = s3c_irq_mask,
-       .irq_unmask     = s3c_irq_unmask,
-       .irq_ack        = s3c_irq_ack,
-       .irq_set_type   = s3c_irq_type,
-};
-
-static struct irq_chip s3c_irqext_chip = {
-       .name           = "s3c-ext",
-       .irq_mask       = s3c_irq_mask,
-       .irq_unmask     = s3c_irq_unmask,
-       .irq_ack        = s3c_irq_ack,
-       .irq_set_type   = s3c_irqext_type,
-       .irq_set_wake   = s3c_irqext_wake
-};
-
-static struct irq_chip s3c_irq_eint0t4 = {
-       .name           = "s3c-ext0",
-       .irq_ack        = s3c_irq_ack,
-       .irq_mask       = s3c_irq_mask,
-       .irq_unmask     = s3c_irq_unmask,
-       .irq_set_wake   = s3c_irq_wake,
-       .irq_set_type   = s3c_irqext0_type,
-};
-
-static void s3c_irq_demux(struct irq_desc *desc)
-{
-       struct irq_chip *chip = irq_desc_get_chip(desc);
-       struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc);
-       struct s3c_irq_intc *intc = irq_data->intc;
-       struct s3c_irq_intc *sub_intc = irq_data->sub_intc;
-       unsigned int n, offset, irq;
-       unsigned long src, msk;
-
-       /* we're using individual domains for the non-dt case
-        * and one big domain for the dt case where the subintc
-        * starts at hwirq number 32.
-        */
-       offset = irq_domain_get_of_node(intc->domain) ? 32 : 0;
-
-       chained_irq_enter(chip, desc);
-
-       src = readl_relaxed(sub_intc->reg_pending);
-       msk = readl_relaxed(sub_intc->reg_mask);
-
-       src &= ~msk;
-       src &= irq_data->sub_bits;
-
-       while (src) {
-               n = __ffs(src);
-               src &= ~(1 << n);
-               irq = irq_find_mapping(sub_intc->domain, offset + n);
-               generic_handle_irq(irq);
-       }
-
-       chained_irq_exit(chip, desc);
-}
-
-static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
-                                     struct pt_regs *regs, int intc_offset)
-{
-       int pnd;
-       int offset;
-
-       pnd = readl_relaxed(intc->reg_intpnd);
-       if (!pnd)
-               return false;
-
-       /* non-dt machines use individual domains */
-       if (!irq_domain_get_of_node(intc->domain))
-               intc_offset = 0;
-
-       /* We have a problem that the INTOFFSET register does not always
-        * show one interrupt. Occasionally we get two interrupts through
-        * the prioritiser, and this causes the INTOFFSET register to show
-        * what looks like the logical-or of the two interrupt numbers.
-        *
-        * Thanks to Klaus, Shannon, et al for helping to debug this problem
-        */
-       offset = readl_relaxed(intc->reg_intpnd + 4);
-
-       /* Find the bit manually, when the offset is wrong.
-        * The pending register only ever contains the one bit of the next
-        * interrupt to handle.
-        */
-       if (!(pnd & (1 << offset)))
-               offset =  __ffs(pnd);
-
-       handle_domain_irq(intc->domain, intc_offset + offset, regs);
-       return true;
-}
-
-asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
-{
-       do {
-               if (likely(s3c_intc[0]))
-                       if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
-                               continue;
-
-               if (s3c_intc[2])
-                       if (s3c24xx_handle_intc(s3c_intc[2], regs, 64))
-                               continue;
-
-               break;
-       } while (1);
-}
-
-#ifdef CONFIG_FIQ
-/**
- * s3c24xx_set_fiq - set the FIQ routing
- * @irq: IRQ number to route to FIQ on processor.
- * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing.
- *
- * Change the state of the IRQ to FIQ routing depending on @irq and @on. If
- * @on is true, the @irq is checked to see if it can be routed and the
- * interrupt controller updated to route the IRQ. If @on is false, the FIQ
- * routing is cleared, regardless of which @irq is specified.
- */
-int s3c24xx_set_fiq(unsigned int irq, bool on)
-{
-       u32 intmod;
-       unsigned offs;
-
-       if (on) {
-               offs = irq - FIQ_START;
-               if (offs > 31)
-                       return -EINVAL;
-
-               intmod = 1 << offs;
-       } else {
-               intmod = 0;
-       }
-
-       writel_relaxed(intmod, S3C2410_INTMOD);
-       return 0;
-}
-
-EXPORT_SYMBOL_GPL(s3c24xx_set_fiq);
-#endif
-
-static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
-                                                       irq_hw_number_t hw)
-{
-       struct s3c_irq_intc *intc = h->host_data;
-       struct s3c_irq_data *irq_data = &intc->irqs[hw];
-       struct s3c_irq_intc *parent_intc;
-       struct s3c_irq_data *parent_irq_data;
-       unsigned int irqno;
-
-       /* attach controller pointer to irq_data */
-       irq_data->intc = intc;
-       irq_data->offset = hw;
-
-       parent_intc = intc->parent;
-
-       /* set handler and flags */
-       switch (irq_data->type) {
-       case S3C_IRQTYPE_NONE:
-               return 0;
-       case S3C_IRQTYPE_EINT:
-               /* On the S3C2412, the EINT0to3 have a parent irq
-                * but need the s3c_irq_eint0t4 chip
-                */
-               if (parent_intc && (!soc_is_s3c2412() || hw >= 4))
-                       irq_set_chip_and_handler(virq, &s3c_irqext_chip,
-                                                handle_edge_irq);
-               else
-                       irq_set_chip_and_handler(virq, &s3c_irq_eint0t4,
-                                                handle_edge_irq);
-               break;
-       case S3C_IRQTYPE_EDGE:
-               if (parent_intc || intc->reg_pending == S3C2416_SRCPND2)
-                       irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
-                                                handle_edge_irq);
-               else
-                       irq_set_chip_and_handler(virq, &s3c_irq_chip,
-                                                handle_edge_irq);
-               break;
-       case S3C_IRQTYPE_LEVEL:
-               if (parent_intc)
-                       irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
-                                                handle_level_irq);
-               else
-                       irq_set_chip_and_handler(virq, &s3c_irq_chip,
-                                                handle_level_irq);
-               break;
-       default:
-               pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type);
-               return -EINVAL;
-       }
-
-       irq_set_chip_data(virq, irq_data);
-
-       if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) {
-               if (irq_data->parent_irq > 31) {
-                       pr_err("irq-s3c24xx: parent irq %lu is out of range\n",
-                              irq_data->parent_irq);
-                       return -EINVAL;
-               }
-
-               parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
-               parent_irq_data->sub_intc = intc;
-               parent_irq_data->sub_bits |= (1UL << hw);
-
-               /* attach the demuxer to the parent irq */
-               irqno = irq_find_mapping(parent_intc->domain,
-                                        irq_data->parent_irq);
-               if (!irqno) {
-                       pr_err("irq-s3c24xx: could not find mapping for parent irq %lu\n",
-                              irq_data->parent_irq);
-                       return -EINVAL;
-               }
-               irq_set_chained_handler(irqno, s3c_irq_demux);
-       }
-
-       return 0;
-}
-
-static const struct irq_domain_ops s3c24xx_irq_ops = {
-       .map = s3c24xx_irq_map,
-       .xlate = irq_domain_xlate_twocell,
-};
-
-static void s3c24xx_clear_intc(struct s3c_irq_intc *intc)
-{
-       void __iomem *reg_source;
-       unsigned long pend;
-       unsigned long last;
-       int i;
-
-       /* if intpnd is set, read the next pending irq from there */
-       reg_source = intc->reg_intpnd ? intc->reg_intpnd : intc->reg_pending;
-
-       last = 0;
-       for (i = 0; i < 4; i++) {
-               pend = readl_relaxed(reg_source);
-
-               if (pend == 0 || pend == last)
-                       break;
-
-               writel_relaxed(pend, intc->reg_pending);
-               if (intc->reg_intpnd)
-                       writel_relaxed(pend, intc->reg_intpnd);
-
-               pr_info("irq: clearing pending status %08x\n", (int)pend);
-               last = pend;
-       }
-}
-
-static struct s3c_irq_intc * __init s3c24xx_init_intc(struct device_node *np,
-                                      struct s3c_irq_data *irq_data,
-                                      struct s3c_irq_intc *parent,
-                                      unsigned long address)
-{
-       struct s3c_irq_intc *intc;
-       void __iomem *base = (void *)0xf6000000; /* static mapping */
-       int irq_num;
-       int irq_start;
-       int ret;
-
-       intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
-       if (!intc)
-               return ERR_PTR(-ENOMEM);
-
-       intc->irqs = irq_data;
-
-       if (parent)
-               intc->parent = parent;
-
-       /* select the correct data for the controller.
-        * Need to hard code the irq num start and offset
-        * to preserve the static mapping for now
-        */
-       switch (address) {
-       case 0x4a000000:
-               pr_debug("irq: found main intc\n");
-               intc->reg_pending = base;
-               intc->reg_mask = base + 0x08;
-               intc->reg_intpnd = base + 0x10;
-               irq_num = 32;
-               irq_start = S3C2410_IRQ(0);
-               break;
-       case 0x4a000018:
-               pr_debug("irq: found subintc\n");
-               intc->reg_pending = base + 0x18;
-               intc->reg_mask = base + 0x1c;
-               irq_num = 29;
-               irq_start = S3C2410_IRQSUB(0);
-               break;
-       case 0x4a000040:
-               pr_debug("irq: found intc2\n");
-               intc->reg_pending = base + 0x40;
-               intc->reg_mask = base + 0x48;
-               intc->reg_intpnd = base + 0x50;
-               irq_num = 8;
-               irq_start = S3C2416_IRQ(0);
-               break;
-       case 0x560000a4:
-               pr_debug("irq: found eintc\n");
-               base = (void *)0xfd000000;
-
-               intc->reg_mask = base + 0xa4;
-               intc->reg_pending = base + 0xa8;
-               irq_num = 24;
-               irq_start = S3C2410_IRQ(32);
-               break;
-       default:
-               pr_err("irq: unsupported controller address\n");
-               ret = -EINVAL;
-               goto err;
-       }
-
-       /* now that all the data is complete, init the irq-domain */
-       s3c24xx_clear_intc(intc);
-       intc->domain = irq_domain_add_legacy(np, irq_num, irq_start,
-                                            0, &s3c24xx_irq_ops,
-                                            intc);
-       if (!intc->domain) {
-               pr_err("irq: could not create irq-domain\n");
-               ret = -EINVAL;
-               goto err;
-       }
-
-       set_handle_irq(s3c24xx_handle_irq);
-
-       return intc;
-
-err:
-       kfree(intc);
-       return ERR_PTR(ret);
-}
-
-static struct s3c_irq_data __maybe_unused init_eint[32] = {
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */
-};
-
-#ifdef CONFIG_CPU_S3C2410
-static struct s3c_irq_data init_s3c2410base[32] = {
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
-       { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
-       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
-};
-
-static struct s3c_irq_data init_s3c2410subint[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
-};
-
-void __init s3c2410_init_irq(void)
-{
-#ifdef CONFIG_FIQ
-       init_FIQ(FIQ_START);
-#endif
-
-       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2410base[0], NULL,
-                                       0x4a000000);
-       if (IS_ERR(s3c_intc[0])) {
-               pr_err("irq: could not create main interrupt controller\n");
-               return;
-       }
-
-       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2410subint[0],
-                                       s3c_intc[0], 0x4a000018);
-       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2412
-static struct s3c_irq_data init_s3c2412base[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT1 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT2 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
-       { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
-       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
-};
-
-static struct s3c_irq_data init_s3c2412eint[32] = {
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 0 }, /* EINT0 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 1 }, /* EINT1 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 2 }, /* EINT2 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 3 }, /* EINT3 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */
-       { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */
-};
-
-static struct s3c_irq_data init_s3c2412subint[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
-       { .type = S3C_IRQTYPE_NONE, },
-       { .type = S3C_IRQTYPE_NONE, },
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */
-};
-
-void __init s3c2412_init_irq(void)
-{
-       pr_info("S3C2412: IRQ Support\n");
-
-#ifdef CONFIG_FIQ
-       init_FIQ(FIQ_START);
-#endif
-
-       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL,
-                                       0x4a000000);
-       if (IS_ERR(s3c_intc[0])) {
-               pr_err("irq: could not create main interrupt controller\n");
-               return;
-       }
-
-       s3c24xx_init_intc(NULL, &init_s3c2412eint[0], s3c_intc[0], 0x560000a4);
-       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2412subint[0],
-                                       s3c_intc[0], 0x4a000018);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2416
-static struct s3c_irq_data init_s3c2416base[32] = {
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
-       { .type = S3C_IRQTYPE_NONE, }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
-       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
-       { .type = S3C_IRQTYPE_NONE, },
-       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
-};
-
-static struct s3c_irq_data init_s3c2416subint[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
-};
-
-static struct s3c_irq_data init_s3c2416_second[32] = {
-       { .type = S3C_IRQTYPE_EDGE }, /* 2D */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */
-};
-
-void __init s3c2416_init_irq(void)
-{
-       pr_info("S3C2416: IRQ Support\n");
-
-#ifdef CONFIG_FIQ
-       init_FIQ(FIQ_START);
-#endif
-
-       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL,
-                                       0x4a000000);
-       if (IS_ERR(s3c_intc[0])) {
-               pr_err("irq: could not create main interrupt controller\n");
-               return;
-       }
-
-       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
-       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2416subint[0],
-                                       s3c_intc[0], 0x4a000018);
-
-       s3c_intc[2] = s3c24xx_init_intc(NULL, &init_s3c2416_second[0],
-                                       NULL, 0x4a000040);
-}
-
-#endif
-
-#ifdef CONFIG_CPU_S3C2440
-static struct s3c_irq_data init_s3c2440base[32] = {
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
-       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
-       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
-};
-
-static struct s3c_irq_data init_s3c2440subint[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
-};
-
-void __init s3c2440_init_irq(void)
-{
-       pr_info("S3C2440: IRQ Support\n");
-
-#ifdef CONFIG_FIQ
-       init_FIQ(FIQ_START);
-#endif
-
-       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL,
-                                       0x4a000000);
-       if (IS_ERR(s3c_intc[0])) {
-               pr_err("irq: could not create main interrupt controller\n");
-               return;
-       }
-
-       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
-       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2440subint[0],
-                                       s3c_intc[0], 0x4a000018);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2442
-static struct s3c_irq_data init_s3c2442base[32] = {
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
-       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
-       { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
-       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
-};
-
-static struct s3c_irq_data init_s3c2442subint[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
-};
-
-void __init s3c2442_init_irq(void)
-{
-       pr_info("S3C2442: IRQ Support\n");
-
-#ifdef CONFIG_FIQ
-       init_FIQ(FIQ_START);
-#endif
-
-       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL,
-                                       0x4a000000);
-       if (IS_ERR(s3c_intc[0])) {
-               pr_err("irq: could not create main interrupt controller\n");
-               return;
-       }
-
-       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
-       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2442subint[0],
-                                       s3c_intc[0], 0x4a000018);
-}
-#endif
-
-#ifdef CONFIG_CPU_S3C2443
-static struct s3c_irq_data init_s3c2443base[32] = {
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
-       { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
-       { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* CFON */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
-       { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
-       { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
-       { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
-       { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
-};
-
-
-static struct s3c_irq_data init_s3c2443subint[32] = {
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
-       { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
-       { .type = S3C_IRQTYPE_NONE }, /* reserved */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD1 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
-       { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
-};
-
-void __init s3c2443_init_irq(void)
-{
-       pr_info("S3C2443: IRQ Support\n");
-
-#ifdef CONFIG_FIQ
-       init_FIQ(FIQ_START);
-#endif
-
-       s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL,
-                                       0x4a000000);
-       if (IS_ERR(s3c_intc[0])) {
-               pr_err("irq: could not create main interrupt controller\n");
-               return;
-       }
-
-       s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4);
-       s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2443subint[0],
-                                       s3c_intc[0], 0x4a000018);
-}
-#endif
-
-#ifdef CONFIG_OF
-static int s3c24xx_irq_map_of(struct irq_domain *h, unsigned int virq,
-                                                       irq_hw_number_t hw)
-{
-       unsigned int ctrl_num = hw / 32;
-       unsigned int intc_hw = hw % 32;
-       struct s3c_irq_intc *intc = s3c_intc[ctrl_num];
-       struct s3c_irq_intc *parent_intc = intc->parent;
-       struct s3c_irq_data *irq_data = &intc->irqs[intc_hw];
-
-       /* attach controller pointer to irq_data */
-       irq_data->intc = intc;
-       irq_data->offset = intc_hw;
-
-       if (!parent_intc)
-               irq_set_chip_and_handler(virq, &s3c_irq_chip, handle_edge_irq);
-       else
-               irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
-                                        handle_edge_irq);
-
-       irq_set_chip_data(virq, irq_data);
-
-       return 0;
-}
-
-/* Translate our of irq notation
- * format: <ctrl_num ctrl_irq parent_irq type>
- */
-static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n,
-                       const u32 *intspec, unsigned int intsize,
-                       irq_hw_number_t *out_hwirq, unsigned int *out_type)
-{
-       struct s3c_irq_intc *intc;
-       struct s3c_irq_intc *parent_intc;
-       struct s3c_irq_data *irq_data;
-       struct s3c_irq_data *parent_irq_data;
-       int irqno;
-
-       if (WARN_ON(intsize < 4))
-               return -EINVAL;
-
-       if (intspec[0] > 2 || !s3c_intc[intspec[0]]) {
-               pr_err("controller number %d invalid\n", intspec[0]);
-               return -EINVAL;
-       }
-       intc = s3c_intc[intspec[0]];
-
-       *out_hwirq = intspec[0] * 32 + intspec[2];
-       *out_type = intspec[3] & IRQ_TYPE_SENSE_MASK;
-
-       parent_intc = intc->parent;
-       if (parent_intc) {
-               irq_data = &intc->irqs[intspec[2]];
-               irq_data->parent_irq = intspec[1];
-               parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
-               parent_irq_data->sub_intc = intc;
-               parent_irq_data->sub_bits |= (1UL << intspec[2]);
-
-               /* parent_intc is always s3c_intc[0], so no offset */
-               irqno = irq_create_mapping(parent_intc->domain, intspec[1]);
-               if (irqno < 0) {
-                       pr_err("irq: could not map parent interrupt\n");
-                       return irqno;
-               }
-
-               irq_set_chained_handler(irqno, s3c_irq_demux);
-       }
-
-       return 0;
-}
-
-static const struct irq_domain_ops s3c24xx_irq_ops_of = {
-       .map = s3c24xx_irq_map_of,
-       .xlate = s3c24xx_irq_xlate_of,
-};
-
-struct s3c24xx_irq_of_ctrl {
-       char                    *name;
-       unsigned long           offset;
-       struct s3c_irq_intc     **handle;
-       struct s3c_irq_intc     **parent;
-       struct irq_domain_ops   *ops;
-};
-
-static int __init s3c_init_intc_of(struct device_node *np,
-                       struct device_node *interrupt_parent,
-                       struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl)
-{
-       struct s3c_irq_intc *intc;
-       struct s3c24xx_irq_of_ctrl *ctrl;
-       struct irq_domain *domain;
-       void __iomem *reg_base;
-       int i;
-
-       reg_base = of_iomap(np, 0);
-       if (!reg_base) {
-               pr_err("irq-s3c24xx: could not map irq registers\n");
-               return -EINVAL;
-       }
-
-       domain = irq_domain_add_linear(np, num_ctrl * 32,
-                                                    &s3c24xx_irq_ops_of, NULL);
-       if (!domain) {
-               pr_err("irq: could not create irq-domain\n");
-               return -EINVAL;
-       }
-
-       for (i = 0; i < num_ctrl; i++) {
-               ctrl = &s3c_ctrl[i];
-
-               pr_debug("irq: found controller %s\n", ctrl->name);
-
-               intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
-               if (!intc)
-                       return -ENOMEM;
-
-               intc->domain = domain;
-               intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data),
-                                    GFP_KERNEL);
-               if (!intc->irqs) {
-                       kfree(intc);
-                       return -ENOMEM;
-               }
-
-               if (ctrl->parent) {
-                       intc->reg_pending = reg_base + ctrl->offset;
-                       intc->reg_mask = reg_base + ctrl->offset + 0x4;
-
-                       if (*(ctrl->parent)) {
-                               intc->parent = *(ctrl->parent);
-                       } else {
-                               pr_warn("irq: parent of %s missing\n",
-                                       ctrl->name);
-                               kfree(intc->irqs);
-                               kfree(intc);
-                               continue;
-                       }
-               } else {
-                       intc->reg_pending = reg_base + ctrl->offset;
-                       intc->reg_mask = reg_base + ctrl->offset + 0x08;
-                       intc->reg_intpnd = reg_base + ctrl->offset + 0x10;
-               }
-
-               s3c24xx_clear_intc(intc);
-               s3c_intc[i] = intc;
-       }
-
-       set_handle_irq(s3c24xx_handle_irq);
-
-       return 0;
-}
-
-static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = {
-       {
-               .name = "intc",
-               .offset = 0,
-       }, {
-               .name = "subintc",
-               .offset = 0x18,
-               .parent = &s3c_intc[0],
-       }
-};
-
-int __init s3c2410_init_intc_of(struct device_node *np,
-                       struct device_node *interrupt_parent)
-{
-       return s3c_init_intc_of(np, interrupt_parent,
-                               s3c2410_ctrl, ARRAY_SIZE(s3c2410_ctrl));
-}
-IRQCHIP_DECLARE(s3c2410_irq, "samsung,s3c2410-irq", s3c2410_init_intc_of);
-
-static struct s3c24xx_irq_of_ctrl s3c2416_ctrl[] = {
-       {
-               .name = "intc",
-               .offset = 0,
-       }, {
-               .name = "subintc",
-               .offset = 0x18,
-               .parent = &s3c_intc[0],
-       }, {
-               .name = "intc2",
-               .offset = 0x40,
-       }
-};
-
-int __init s3c2416_init_intc_of(struct device_node *np,
-                       struct device_node *interrupt_parent)
-{
-       return s3c_init_intc_of(np, interrupt_parent,
-                               s3c2416_ctrl, ARRAY_SIZE(s3c2416_ctrl));
-}
-IRQCHIP_DECLARE(s3c2416_irq, "samsung,s3c2416-irq", s3c2416_init_intc_of);
-#endif
index 03a36be..0c2c61d 100644 (file)
@@ -416,6 +416,16 @@ static void stm32_irq_ack(struct irq_data *d)
        irq_gc_unlock(gc);
 }
 
+/* directly set the target bit without reading first. */
+static inline void stm32_exti_write_bit(struct irq_data *d, u32 reg)
+{
+       struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
+       void __iomem *base = chip_data->host_data->base;
+       u32 val = BIT(d->hwirq % IRQS_PER_BANK);
+
+       writel_relaxed(val, base + reg);
+}
+
 static inline u32 stm32_exti_set_bit(struct irq_data *d, u32 reg)
 {
        struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
@@ -449,9 +459,9 @@ static void stm32_exti_h_eoi(struct irq_data *d)
 
        raw_spin_lock(&chip_data->rlock);
 
-       stm32_exti_set_bit(d, stm32_bank->rpr_ofst);
+       stm32_exti_write_bit(d, stm32_bank->rpr_ofst);
        if (stm32_bank->fpr_ofst != UNDEF_REG)
-               stm32_exti_set_bit(d, stm32_bank->fpr_ofst);
+               stm32_exti_write_bit(d, stm32_bank->fpr_ofst);
 
        raw_spin_unlock(&chip_data->rlock);
 
index b7cc5d6..d4e9760 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/irqdomain.h>
 #include <linux/interrupt.h>
@@ -83,6 +84,7 @@ struct ti_sci_inta_vint_desc {
  * @vint_mutex:                Mutex to protect vint_list
  * @base:              Base address of the memory mapped IO registers
  * @pdev:              Pointer to platform device.
+ * @ti_sci_id:         TI-SCI device identifier
  */
 struct ti_sci_inta_irq_domain {
        const struct ti_sci_handle *sci;
@@ -93,6 +95,7 @@ struct ti_sci_inta_irq_domain {
        struct mutex vint_mutex;
        void __iomem *base;
        struct platform_device *pdev;
+       u32 ti_sci_id;
 };
 
 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \
@@ -128,6 +131,37 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
        chained_irq_exit(irq_desc_get_chip(desc), desc);
 }
 
+/**
+ * ti_sci_inta_xlate_irq() - Translate hwirq to parent's hwirq.
+ * @inta:      IRQ domain corresponding to Interrupt Aggregator
+ * @irq:       Hardware irq corresponding to the above irq domain
+ *
+ * Return parent irq number if translation is available else -ENOENT.
+ */
+static int ti_sci_inta_xlate_irq(struct ti_sci_inta_irq_domain *inta,
+                                u16 vint_id)
+{
+       struct device_node *np = dev_of_node(&inta->pdev->dev);
+       u32 base, parent_base, size;
+       const __be32 *range;
+       int len;
+
+       range = of_get_property(np, "ti,interrupt-ranges", &len);
+       if (!range)
+               return vint_id;
+
+       for (len /= sizeof(*range); len >= 3; len -= 3) {
+               base = be32_to_cpu(*range++);
+               parent_base = be32_to_cpu(*range++);
+               size = be32_to_cpu(*range++);
+
+               if (base <= vint_id && vint_id < base + size)
+                       return vint_id - base + parent_base;
+       }
+
+       return -ENOENT;
+}
+
 /**
  * ti_sci_inta_alloc_parent_irq() - Allocate parent irq to Interrupt aggregator
  * @domain:    IRQ domain corresponding to Interrupt Aggregator
@@ -139,30 +173,52 @@ static struct ti_sci_inta_vint_desc *ti_sci_inta_alloc_parent_irq(struct irq_dom
        struct ti_sci_inta_irq_domain *inta = domain->host_data;
        struct ti_sci_inta_vint_desc *vint_desc;
        struct irq_fwspec parent_fwspec;
+       struct device_node *parent_node;
        unsigned int parent_virq;
-       u16 vint_id;
+       u16 vint_id, p_hwirq;
+       int ret;
 
        vint_id = ti_sci_get_free_resource(inta->vint);
        if (vint_id == TI_SCI_RESOURCE_NULL)
                return ERR_PTR(-EINVAL);
 
+       p_hwirq = ti_sci_inta_xlate_irq(inta, vint_id);
+       if (p_hwirq < 0) {
+               ret = p_hwirq;
+               goto free_vint;
+       }
+
        vint_desc = kzalloc(sizeof(*vint_desc), GFP_KERNEL);
-       if (!vint_desc)
-               return ERR_PTR(-ENOMEM);
+       if (!vint_desc) {
+               ret = -ENOMEM;
+               goto free_vint;
+       }
 
        vint_desc->domain = domain;
        vint_desc->vint_id = vint_id;
        INIT_LIST_HEAD(&vint_desc->list);
 
-       parent_fwspec.fwnode = of_node_to_fwnode(of_irq_find_parent(dev_of_node(&inta->pdev->dev)));
-       parent_fwspec.param_count = 2;
-       parent_fwspec.param[0] = inta->pdev->id;
-       parent_fwspec.param[1] = vint_desc->vint_id;
+       parent_node = of_irq_find_parent(dev_of_node(&inta->pdev->dev));
+       parent_fwspec.fwnode = of_node_to_fwnode(parent_node);
+
+       if (of_device_is_compatible(parent_node, "arm,gic-v3")) {
+               /* Parent is GIC */
+               parent_fwspec.param_count = 3;
+               parent_fwspec.param[0] = 0;
+               parent_fwspec.param[1] = p_hwirq - 32;
+               parent_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
+       } else {
+               /* Parent is Interrupt Router */
+               parent_fwspec.param_count = 1;
+               parent_fwspec.param[0] = p_hwirq;
+       }
 
        parent_virq = irq_create_fwspec_mapping(&parent_fwspec);
        if (parent_virq == 0) {
-               kfree(vint_desc);
-               return ERR_PTR(-EINVAL);
+               dev_err(&inta->pdev->dev, "Parent IRQ allocation failed\n");
+               ret = -EINVAL;
+               goto free_vint_desc;
+
        }
        vint_desc->parent_virq = parent_virq;
 
@@ -171,6 +227,11 @@ static struct ti_sci_inta_vint_desc *ti_sci_inta_alloc_parent_irq(struct irq_dom
                                         ti_sci_inta_irq_handler, vint_desc);
 
        return vint_desc;
+free_vint_desc:
+       kfree(vint_desc);
+free_vint:
+       ti_sci_release_resource(inta->vint, vint_id);
+       return ERR_PTR(ret);
 }
 
 /**
@@ -202,7 +263,7 @@ static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta
 
        err = inta->sci->ops.rm_irq_ops.set_event_map(inta->sci,
                                                      dev_id, dev_index,
-                                                     inta->pdev->id,
+                                                     inta->ti_sci_id,
                                                      vint_desc->vint_id,
                                                      event_desc->global_event,
                                                      free_bit);
@@ -299,7 +360,7 @@ static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc,
        inta->sci->ops.rm_irq_ops.free_event_map(inta->sci,
                                                 HWIRQ_TO_DEVID(hwirq),
                                                 HWIRQ_TO_IRQID(hwirq),
-                                                inta->pdev->id,
+                                                inta->ti_sci_id,
                                                 vint_desc->vint_id,
                                                 event_desc->global_event,
                                                 event_desc->vint_bit);
@@ -547,21 +608,21 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &pdev->id);
+       ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &inta->ti_sci_id);
        if (ret) {
                dev_err(dev, "missing 'ti,sci-dev-id' property\n");
                return -EINVAL;
        }
 
-       inta->vint = devm_ti_sci_get_of_resource(inta->sci, dev, pdev->id,
-                                                "ti,sci-rm-range-vint");
+       inta->vint = devm_ti_sci_get_resource(inta->sci, dev, inta->ti_sci_id,
+                                             TI_SCI_RESASG_SUBTYPE_IA_VINT);
        if (IS_ERR(inta->vint)) {
                dev_err(dev, "VINT resource allocation failed\n");
                return PTR_ERR(inta->vint);
        }
 
-       inta->global_event = devm_ti_sci_get_of_resource(inta->sci, dev, pdev->id,
-                                               "ti,sci-rm-range-global-event");
+       inta->global_event = devm_ti_sci_get_resource(inta->sci, dev, inta->ti_sci_id,
+                                                     TI_SCI_RESASG_SUBTYPE_GLOBAL_EVENT_SEVT);
        if (IS_ERR(inta->global_event)) {
                dev_err(dev, "Global event resource allocation failed\n");
                return PTR_ERR(inta->global_event);
@@ -592,6 +653,8 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&inta->vint_list);
        mutex_init(&inta->vint_mutex);
 
+       dev_info(dev, "Interrupt Aggregator domain %d created\n", pdev->id);
+
        return 0;
 }
 
index 5ea148f..cbc1758 100644 (file)
 #include <linux/of_irq.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 
-#define TI_SCI_DEV_ID_MASK     0xffff
-#define TI_SCI_DEV_ID_SHIFT    16
-#define TI_SCI_IRQ_ID_MASK     0xffff
-#define TI_SCI_IRQ_ID_SHIFT    0
-#define HWIRQ_TO_DEVID(hwirq)  (((hwirq) >> (TI_SCI_DEV_ID_SHIFT)) & \
-                                (TI_SCI_DEV_ID_MASK))
-#define HWIRQ_TO_IRQID(hwirq)  ((hwirq) & (TI_SCI_IRQ_ID_MASK))
-#define TO_HWIRQ(dev, index)   ((((dev) & TI_SCI_DEV_ID_MASK) << \
-                                TI_SCI_DEV_ID_SHIFT) | \
-                               ((index) & TI_SCI_IRQ_ID_MASK))
-
 /**
  * struct ti_sci_intr_irq_domain - Structure representing a TISCI based
  *                                Interrupt Router IRQ domain.
  * @sci:       Pointer to TISCI handle
- * @dst_irq:   TISCI resource pointer representing GIC irq controller.
- * @dst_id:    TISCI device ID of the GIC irq controller.
+ * @out_irqs:  TISCI resource pointer representing INTR irqs.
+ * @dev:       Struct device pointer.
+ * @ti_sci_id: TI-SCI device identifier
  * @type:      Specifies the trigger type supported by this Interrupt Router
  */
 struct ti_sci_intr_irq_domain {
        const struct ti_sci_handle *sci;
-       struct ti_sci_resource *dst_irq;
-       u32 dst_id;
+       struct ti_sci_resource *out_irqs;
+       struct device *dev;
+       u32 ti_sci_id;
        u32 type;
 };
 
@@ -70,15 +61,44 @@ static int ti_sci_intr_irq_domain_translate(struct irq_domain *domain,
 {
        struct ti_sci_intr_irq_domain *intr = domain->host_data;
 
-       if (fwspec->param_count != 2)
+       if (fwspec->param_count != 1)
                return -EINVAL;
 
-       *hwirq = TO_HWIRQ(fwspec->param[0], fwspec->param[1]);
+       *hwirq = fwspec->param[0];
        *type = intr->type;
 
        return 0;
 }
 
+/**
+ * ti_sci_intr_xlate_irq() - Translate hwirq to parent's hwirq.
+ * @intr:      IRQ domain corresponding to Interrupt Router
+ * @irq:       Hardware irq corresponding to the above irq domain
+ *
+ * Return parent irq number if translation is available else -ENOENT.
+ */
+static int ti_sci_intr_xlate_irq(struct ti_sci_intr_irq_domain *intr, u32 irq)
+{
+       struct device_node *np = dev_of_node(intr->dev);
+       u32 base, pbase, size, len;
+       const __be32 *range;
+
+       range = of_get_property(np, "ti,interrupt-ranges", &len);
+       if (!range)
+               return irq;
+
+       for (len /= sizeof(*range); len >= 3; len -= 3) {
+               base = be32_to_cpu(*range++);
+               pbase = be32_to_cpu(*range++);
+               size = be32_to_cpu(*range++);
+
+               if (base <= irq && irq < base + size)
+                       return irq - base + pbase;
+       }
+
+       return -ENOENT;
+}
+
 /**
  * ti_sci_intr_irq_domain_free() - Free the specified IRQs from the domain.
  * @domain:    Domain to which the irqs belong
@@ -89,66 +109,76 @@ static void ti_sci_intr_irq_domain_free(struct irq_domain *domain,
                                        unsigned int virq, unsigned int nr_irqs)
 {
        struct ti_sci_intr_irq_domain *intr = domain->host_data;
-       struct irq_data *data, *parent_data;
-       u16 dev_id, irq_index;
+       struct irq_data *data;
+       int out_irq;
 
-       parent_data = irq_domain_get_irq_data(domain->parent, virq);
        data = irq_domain_get_irq_data(domain, virq);
-       irq_index = HWIRQ_TO_IRQID(data->hwirq);
-       dev_id = HWIRQ_TO_DEVID(data->hwirq);
+       out_irq = (uintptr_t)data->chip_data;
 
-       intr->sci->ops.rm_irq_ops.free_irq(intr->sci, dev_id, irq_index,
-                                          intr->dst_id, parent_data->hwirq);
-       ti_sci_release_resource(intr->dst_irq, parent_data->hwirq);
+       intr->sci->ops.rm_irq_ops.free_irq(intr->sci,
+                                          intr->ti_sci_id, data->hwirq,
+                                          intr->ti_sci_id, out_irq);
+       ti_sci_release_resource(intr->out_irqs, out_irq);
        irq_domain_free_irqs_parent(domain, virq, 1);
        irq_domain_reset_irq_data(data);
 }
 
 /**
- * ti_sci_intr_alloc_gic_irq() - Allocate GIC specific IRQ
+ * ti_sci_intr_alloc_parent_irq() - Allocate parent IRQ
  * @domain:    Pointer to the interrupt router IRQ domain
  * @virq:      Corresponding Linux virtual IRQ number
  * @hwirq:     Corresponding hwirq for the IRQ within this IRQ domain
  *
- * Returns 0 if all went well else appropriate error pointer.
+ * Returns parent irq if all went well else appropriate error pointer.
  */
-static int ti_sci_intr_alloc_gic_irq(struct irq_domain *domain,
-                                    unsigned int virq, u32 hwirq)
+static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,
+                                       unsigned int virq, u32 hwirq)
 {
        struct ti_sci_intr_irq_domain *intr = domain->host_data;
+       struct device_node *parent_node;
        struct irq_fwspec fwspec;
-       u16 dev_id, irq_index;
-       u16 dst_irq;
-       int err;
-
-       dev_id = HWIRQ_TO_DEVID(hwirq);
-       irq_index = HWIRQ_TO_IRQID(hwirq);
+       u16 out_irq, p_hwirq;
+       int err = 0;
 
-       dst_irq = ti_sci_get_free_resource(intr->dst_irq);
-       if (dst_irq == TI_SCI_RESOURCE_NULL)
+       out_irq = ti_sci_get_free_resource(intr->out_irqs);
+       if (out_irq == TI_SCI_RESOURCE_NULL)
                return -EINVAL;
 
-       fwspec.fwnode = domain->parent->fwnode;
-       fwspec.param_count = 3;
-       fwspec.param[0] = 0;    /* SPI */
-       fwspec.param[1] = dst_irq - 32; /* SPI offset */
-       fwspec.param[2] = intr->type;
+       p_hwirq = ti_sci_intr_xlate_irq(intr, out_irq);
+       if (p_hwirq < 0)
+               goto err_irqs;
+
+       parent_node = of_irq_find_parent(dev_of_node(intr->dev));
+       fwspec.fwnode = of_node_to_fwnode(parent_node);
+
+       if (of_device_is_compatible(parent_node, "arm,gic-v3")) {
+               /* Parent is GIC */
+               fwspec.param_count = 3;
+               fwspec.param[0] = 0;    /* SPI */
+               fwspec.param[1] = p_hwirq - 32; /* SPI offset */
+               fwspec.param[2] = intr->type;
+       } else {
+               /* Parent is Interrupt Router */
+               fwspec.param_count = 1;
+               fwspec.param[0] = p_hwirq;
+       }
 
        err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
        if (err)
                goto err_irqs;
 
-       err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci, dev_id, irq_index,
-                                               intr->dst_id, dst_irq);
+       err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci,
+                                               intr->ti_sci_id, hwirq,
+                                               intr->ti_sci_id, out_irq);
        if (err)
                goto err_msg;
 
-       return 0;
+       return p_hwirq;
 
 err_msg:
        irq_domain_free_irqs_parent(domain, virq, 1);
 err_irqs:
-       ti_sci_release_resource(intr->dst_irq, dst_irq);
+       ti_sci_release_resource(intr->out_irqs, out_irq);
        return err;
 }
 
@@ -168,18 +198,19 @@ static int ti_sci_intr_irq_domain_alloc(struct irq_domain *domain,
        struct irq_fwspec *fwspec = data;
        unsigned long hwirq;
        unsigned int flags;
-       int err;
+       int err, p_hwirq;
 
        err = ti_sci_intr_irq_domain_translate(domain, fwspec, &hwirq, &flags);
        if (err)
                return err;
 
-       err = ti_sci_intr_alloc_gic_irq(domain, virq, hwirq);
-       if (err)
-               return err;
+       p_hwirq = ti_sci_intr_alloc_parent_irq(domain, virq, hwirq);
+       if (p_hwirq < 0)
+               return p_hwirq;
 
        irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
-                                     &ti_sci_intr_irq_chip, NULL);
+                                     &ti_sci_intr_irq_chip,
+                                     (void *)(uintptr_t)p_hwirq);
 
        return 0;
 }
@@ -214,6 +245,7 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
        if (!intr)
                return -ENOMEM;
 
+       intr->dev = dev;
        ret = of_property_read_u32(dev_of_node(dev), "ti,intr-trigger-type",
                                   &intr->type);
        if (ret) {
@@ -230,19 +262,19 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dst-id",
-                                  &intr->dst_id);
+       ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dev-id",
+                                  &intr->ti_sci_id);
        if (ret) {
-               dev_err(dev, "missing 'ti,sci-dst-id' property\n");
+               dev_err(dev, "missing 'ti,sci-dev-id' property\n");
                return -EINVAL;
        }
 
-       intr->dst_irq = devm_ti_sci_get_of_resource(intr->sci, dev,
-                                                   intr->dst_id,
-                                                   "ti,sci-rm-range-girq");
-       if (IS_ERR(intr->dst_irq)) {
+       intr->out_irqs = devm_ti_sci_get_resource(intr->sci, dev,
+                                                 intr->ti_sci_id,
+                                                 TI_SCI_RESASG_SUBTYPE_IR_OUTPUT);
+       if (IS_ERR(intr->out_irqs)) {
                dev_err(dev, "Destination irq resource allocation failed\n");
-               return PTR_ERR(intr->dst_irq);
+               return PTR_ERR(intr->out_irqs);
        }
 
        domain = irq_domain_add_hierarchy(parent_domain, 0, 0, dev_of_node(dev),
@@ -252,6 +284,8 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
+       dev_info(dev, "Interrupt Router %d domain created\n", intr->ti_sci_id);
+
        return 0;
 }
 
index bc235db..e460363 100644 (file)
@@ -455,7 +455,7 @@ static void __init __vic_init(void __iomem *base, int parent_irq, int irq_start,
                return;
        default:
                printk(KERN_WARNING "VIC: unknown vendor, continuing anyways\n");
-               /* fall through */
+               fallthrough;
        case AMBA_VENDOR_ARM:
                break;
        }
index 1bb0e36..d234115 100644 (file)
@@ -52,7 +52,7 @@ int platform_irqchip_probe(struct platform_device *pdev)
         * interrupt controller. The actual initialization callback of this
         * interrupt controller can check for specific domains as necessary.
         */
-       if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY))
+       if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY))
                return -EPROBE_DEFER;
 
        return irq_init_cb(np, par_np);
index c1c5dfa..6ae9e1f 100644 (file)
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
-#include <linux/of_irq.h>
 #include <linux/soc/qcom/irq.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
@@ -432,8 +430,4 @@ fail:
        return ret;
 }
 
-IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
-IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
-IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
-MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
-MODULE_LICENSE("GPL v2");
+IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
index ecc1ef6..f68569b 100644 (file)
@@ -348,7 +348,7 @@ modehdlc(struct bchannel *bch, int protocol)
        switch (protocol) {
        case -1: /* used for init */
                bch->state = -1;
-               /* fall through */
+               fallthrough;
        case ISDN_P_NONE:
                if (bch->state == ISDN_P_NONE)
                        break;
index b0d7723..448ded8 100644 (file)
@@ -121,7 +121,6 @@ setup_embedded(struct hfc_multi *hc, struct hm_map *m)
        case HFC_IO_MODE_EMBSD:
                test_and_set_bit(HFC_CHIP_EMBSD, &hc->chip);
                hc->slots = 128; /* required */
-               /* fall through */
                hc->HFC_outb = HFC_outb_embsd;
                hc->HFC_inb = HFC_inb_embsd;
                hc->HFC_inw = HFC_inw_embsd;
index 904a4f4..56bd2e9 100644 (file)
@@ -1280,7 +1280,7 @@ mode_hfcpci(struct bchannel *bch, int bc, int protocol)
        case (-1): /* used for init */
                bch->state = -1;
                bch->nr = bc;
-               /* fall through */
+               fallthrough;
        case (ISDN_P_NONE):
                if (bch->state == ISDN_P_NONE)
                        return 0;
index 4274906..7006199 100644 (file)
@@ -695,7 +695,7 @@ hfcsusb_setup_bch(struct bchannel *bch, int protocol)
        switch (protocol) {
        case (-1):      /* used for init */
                bch->state = -1;
-               /* fall through */
+               fallthrough;
        case (ISDN_P_NONE):
                if (bch->state == ISDN_P_NONE)
                        return 0; /* already in idle state */
index 9fea16e..985367e 100644 (file)
@@ -397,7 +397,7 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen,
                                dsize--;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case HDLC_SENDFLAG_ONE:
                        if (hdlc->bit_shift == 8) {
                                hdlc->cbin = hdlc->ffvalue >>
index f4cb297..a16c7a2 100644 (file)
@@ -875,7 +875,7 @@ release_card(struct inf_hw *card) {
                                release_card(card->sc[i]);
                        card->sc[i] = NULL;
                }
-               /* fall through */
+               fallthrough;
        default:
                pci_disable_device(card->pdev);
                pci_set_drvdata(card->pdev, NULL);
index 11e8c7d..5694340 100644 (file)
@@ -957,7 +957,7 @@ isar_pump_statev_fax(struct isar_ch *ch, u8 devt) {
                                break;
                        case PCTRL_CMD_FTM:
                                p1 = 2;
-                               /* fall through */
+                               fallthrough;
                        case PCTRL_CMD_FTH:
                                send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL,
                                          PCTRL_CMD_SILON, 1, &p1);
@@ -1163,7 +1163,7 @@ setup_pump(struct isar_ch *ch) {
                        send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG,
                                  PMOD_DTMF, 1, param);
                }
-               /* fall through */
+               fallthrough;
        case ISDN_P_B_MODEM_ASYNC:
                ctrl = PMOD_DATAMODEM;
                if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) {
@@ -1255,7 +1255,7 @@ setup_iom2(struct isar_ch *ch) {
        case ISDN_P_B_MODEM_ASYNC:
        case ISDN_P_B_T30_FAX:
                cmsb |= IOM_CTRL_RCV;
-               /* fall through */
+               fallthrough;
        case ISDN_P_B_L2DTMF:
                if (test_bit(FLG_DTMFSEND, &ch->bch.Flags))
                        cmsb |= IOM_CTRL_RCV;
@@ -1548,7 +1548,7 @@ isar_l2l1(struct mISDNchannel *ch, struct sk_buff *skb)
                                ich->is->name, hh->id);
                        ret = -EINVAL;
                }
-               /* fall through */
+               fallthrough;
        default:
                pr_info("%s: %s unknown prim(%x,%x)\n",
                        ich->is->name, __func__, hh->prim, hh->id);
index 27aa329..c2f76f3 100644 (file)
@@ -528,7 +528,7 @@ create_l2entity(struct mISDNdevice *dev, struct mISDNchannel *ch,
                rq.protocol = ISDN_P_NT_S0;
                if (dev->Dprotocols & (1 << ISDN_P_NT_E1))
                        rq.protocol = ISDN_P_NT_E1;
-               /* fall through */
+               fallthrough;
        case ISDN_P_LAPD_TE:
                ch->recv = mISDN_queue_message;
                ch->peer = &dev->D.st->own;
index 9b5e676..3c0c7aa 100644 (file)
@@ -16,8 +16,6 @@
 #include <linux/module.h>
 #include <linux/platform_data/leds-s3c24xx.h>
 
-#include <mach/regs-gpio.h>
-
 /* our context */
 
 struct s3c24xx_gpio_led {
index b413baf..97c6873 100644 (file)
@@ -301,7 +301,7 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type)
        switch (type) {
        case PBLK_WRITE:
                kfree(((struct pblk_c_ctx *)nvm_rq_to_pdu(rqd))->lun_bitmap);
-               /* fall through */
+               fallthrough;
        case PBLK_WRITE_INT:
                pool = &pblk->w_rq_pool;
                break;
index 75482ee..994ba5c 100644 (file)
@@ -881,7 +881,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
                }
                if (hid->name[0])
                        break;
-               /* else fall through */
+               fallthrough;
 
        default:
                pr_info("Trying to register unknown ADB device to input layer.\n");
index 23f1f41..9668458 100644 (file)
@@ -852,7 +852,7 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd)
                break;
        case SMU_I2C_TRANSFER_COMBINED:
                cmd->info.devaddr &= 0xfe;
-               /* fall through */
+               fallthrough;
        case SMU_I2C_TRANSFER_STDSUB:
                if (cmd->info.sublen > 3)
                        return -EINVAL;
index 77fbfd5..c1227bd 100644 (file)
@@ -608,7 +608,7 @@ static void do_journal_discard(struct cache *ca)
                        ca->sb.njournal_buckets;
 
                atomic_set(&ja->discard_in_flight, DISCARD_READY);
-               /* fallthrough */
+               fallthrough;
 
        case DISCARD_READY:
                if (ja->discard_idx == ja->last_idx)
index 62fb917..ae380bc 100644 (file)
@@ -33,27 +33,27 @@ int bch_ ## name ## _h(const char *cp, type *res)           \
        case 'y':                                               \
        case 'z':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'e':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'p':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 't':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'g':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'm':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'k':                                               \
                u++;                                            \
                if (e++ == cp)                                  \
                        return -EINVAL;                         \
-               /* fall through */                              \
+               fallthrough;                                    \
        case '\n':                                              \
        case '\0':                                              \
                if (*e == '\n')                                 \
index 1489607..238cd80 100644 (file)
@@ -1552,7 +1552,7 @@ static blk_status_t crypt_convert(struct crypt_config *cc,
                case -EBUSY:
                        wait_for_completion(&ctx->restart);
                        reinit_completion(&ctx->restart);
-                       /* fall through */
+                       fallthrough;
                /*
                 * The request is queued and processed asynchronously,
                 * completion function kcryptd_async_done() will be called.
index 53645a6..e3283d3 100644 (file)
@@ -1554,7 +1554,7 @@ static void pg_init_done(void *data, int errors)
        case SCSI_DH_RETRY:
                /* Wait before retrying. */
                delay_retry = true;
-               /* fall through */
+               fallthrough;
        case SCSI_DH_IMM_RETRY:
        case SCSI_DH_RES_TEMP_UNAVAIL:
                if (pg_init_limit_reached(m, pgpath))
index 32fa649..fb0255d 100644 (file)
@@ -1021,7 +1021,7 @@ static void clone_endio(struct bio *bio)
                switch (r) {
                case DM_ENDIO_REQUEUE:
                        error = BLK_STS_DM_REQUEUE;
-                       /*FALLTHRU*/
+                       fallthrough;
                case DM_ENDIO_DONE:
                        break;
                case DM_ENDIO_INCOMPLETE:
index 6bbec89..2cf9737 100644 (file)
@@ -102,10 +102,10 @@ static int __init md_setup(char *str)
                                pername = "raid0";
                        break;
                }
-               /* FALL THROUGH */
+               fallthrough;
        case 1: /* the first device is numeric */
                str = str1;
-               /* FALL THROUGH */
+               fallthrough;
        case 0:
                md_setup_args[ent].level = LEVEL_NONE;
                pername="super-block";
index d61b524..b10c519 100644 (file)
@@ -1433,7 +1433,7 @@ int md_bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long s
                case 0:
                        md_bitmap_file_set_bit(bitmap, offset);
                        md_bitmap_count_page(&bitmap->counts, offset, 1);
-                       /* fall through */
+                       fallthrough;
                case 1:
                        *bmc = 2;
                }
index ef0fd48..225380e 100644 (file)
@@ -4083,7 +4083,7 @@ static void handle_parity_checks5(struct r5conf *conf, struct stripe_head *sh,
                        break;
                }
                dev = &sh->dev[s->failed_num[0]];
-               /* fall through */
+               fallthrough;
        case check_state_compute_result:
                sh->check_state = check_state_idle;
                if (!dev)
@@ -4214,7 +4214,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
 
                /* we have 2-disk failure */
                BUG_ON(s->failed != 2);
-               /* fall through */
+               fallthrough;
        case check_state_compute_result:
                sh->check_state = check_state_idle;
 
@@ -6514,9 +6514,12 @@ raid5_store_stripe_size(struct mddev  *mddev, const char *page, size_t len)
 
        /*
         * The value should not be bigger than PAGE_SIZE. It requires to
-        * be multiple of DEFAULT_STRIPE_SIZE.
+        * be multiple of DEFAULT_STRIPE_SIZE and the value should be power
+        * of two.
         */
-       if (new % DEFAULT_STRIPE_SIZE != 0 || new > PAGE_SIZE || new == 0)
+       if (new % DEFAULT_STRIPE_SIZE != 0 ||
+                       new > PAGE_SIZE || new == 0 ||
+                       new != roundup_pow_of_two(new))
                return -EINVAL;
 
        err = mddev_lock(mddev);
index 630a75e..7607b51 100644 (file)
@@ -210,7 +210,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
                tpg->vdownsampling[1] = 1;
                tpg->hdownsampling[1] = 1;
                tpg->planes = 2;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGB332:
        case V4L2_PIX_FMT_RGB565:
        case V4L2_PIX_FMT_RGB565X:
@@ -271,7 +271,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_YUV420M:
        case V4L2_PIX_FMT_YVU420M:
                tpg->buffers = 3;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV420:
        case V4L2_PIX_FMT_YVU420:
                tpg->vdownsampling[1] = 2;
@@ -284,7 +284,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_YUV422M:
        case V4L2_PIX_FMT_YVU422M:
                tpg->buffers = 3;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV422P:
                tpg->vdownsampling[1] = 1;
                tpg->vdownsampling[2] = 1;
@@ -296,7 +296,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_NV16M:
        case V4L2_PIX_FMT_NV61M:
                tpg->buffers = 2;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                tpg->vdownsampling[1] = 1;
@@ -308,7 +308,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_NV12M:
        case V4L2_PIX_FMT_NV21M:
                tpg->buffers = 2;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21:
                tpg->vdownsampling[1] = 2;
@@ -1275,7 +1275,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_RGB444:
        case V4L2_PIX_FMT_XRGB444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV444:
        case V4L2_PIX_FMT_ARGB444:
                buf[0][offset] = (g_u_s << 4) | b_v;
@@ -1283,21 +1283,21 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_RGBX444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGBA444:
                buf[0][offset] = (b_v << 4) | (alpha >> 4);
                buf[0][offset + 1] = (r_y_h << 4) | g_u_s;
                break;
        case V4L2_PIX_FMT_XBGR444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ABGR444:
                buf[0][offset] = (g_u_s << 4) | r_y_h;
                buf[0][offset + 1] = (alpha & 0xf0) | b_v;
                break;
        case V4L2_PIX_FMT_BGRX444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_BGRA444:
                buf[0][offset] = (r_y_h << 4) | (alpha >> 4);
                buf[0][offset + 1] = (b_v << 4) | g_u_s;
@@ -1305,7 +1305,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_RGB555:
        case V4L2_PIX_FMT_XRGB555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV555:
        case V4L2_PIX_FMT_ARGB555:
                buf[0][offset] = (g_u_s << 5) | b_v;
@@ -1314,7 +1314,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_RGBX555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGBA555:
                buf[0][offset] = (g_u_s << 6) | (b_v << 1) |
                                 ((alpha & 0x80) >> 7);
@@ -1322,7 +1322,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_XBGR555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ABGR555:
                buf[0][offset] = (g_u_s << 5) | r_y_h;
                buf[0][offset + 1] = (alpha & 0x80) | (b_v << 2)
@@ -1330,7 +1330,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_BGRX555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_BGRA555:
                buf[0][offset] = (g_u_s << 6) | (r_y_h << 1) |
                                 ((alpha & 0x80) >> 7);
@@ -1339,7 +1339,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_RGB555X:
        case V4L2_PIX_FMT_XRGB555X:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ARGB555X:
                buf[0][offset] = (alpha & 0x80) | (r_y_h << 2) | (g_u_s >> 3);
                buf[0][offset + 1] = (g_u_s << 5) | b_v;
@@ -1366,7 +1366,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_HSV32:
        case V4L2_PIX_FMT_XYUV32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV32:
        case V4L2_PIX_FMT_ARGB32:
        case V4L2_PIX_FMT_AYUV32:
@@ -1377,7 +1377,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_RGBX32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGBA32:
                buf[0][offset] = r_y_h;
                buf[0][offset + 1] = g_u_s;
@@ -1388,7 +1388,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_XBGR32:
        case V4L2_PIX_FMT_VUYX32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ABGR32:
        case V4L2_PIX_FMT_VUYA32:
                buf[0][offset] = b_v;
@@ -1398,7 +1398,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_BGRX32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_BGRA32:
                buf[0][offset] = alpha;
                buf[0][offset + 1] = b_v;
index 630509e..89620da 100644 (file)
@@ -546,7 +546,7 @@ static int dvb_net_ule_new_payload(struct dvb_net_ule_handle *h)
                h->priv->ule_sndu_type_1 = 1;
                h->ts_remain -= 1;
                h->from_where += 1;
-               /* fallthrough */
+               fallthrough;
        case 0:
                h->new_ts = 1;
                h->ts += TS_SZ;
index e92542b..da0ff7b 100644 (file)
@@ -773,7 +773,7 @@ static int bcm3510_init(struct dvb_frontend* fe)
                        deb_info("attempting to download firmware\n");
                        if ((ret = bcm3510_init_cold(st)) < 0)
                                return ret;
-                       /* fall-through */
+                       fallthrough;
                case JDEC_EEPROM_LOAD_WAIT:
                        deb_info("firmware is loaded\n");
                        bcm3510_check_firmware_version(st);
index bc37475..08a8583 100644 (file)
@@ -1693,7 +1693,7 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front
                if (state->identity.p1g)
                        state->dc = dc_p1g_table;
 
-               /* fall through */
+               fallthrough;
        case CT_TUNER_STEP_0:
                dprintk("Start/continue DC calibration for %s path\n",
                        (state->dc->i == 1) ? "I" : "Q");
index 0f0480d..a6c2fc4 100644 (file)
@@ -224,7 +224,7 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)
        switch (c->hierarchy) {
                case HIERARCHY_NONE:
                        deb_setf("hierarchy: none\n");
-                       /* fall through */
+                       fallthrough;
                case HIERARCHY_1:
                        deb_setf("hierarchy: alpha=1\n");
                        wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_1);
index 0a7790c..55bee50 100644 (file)
@@ -276,7 +276,7 @@ static int dib7000p_set_power_mode(struct dib7000p_state *state, enum dib7000p_p
                if (state->version != SOC7090)
                        reg_1280 &= ~((1 << 11));
                reg_1280 &= ~(1 << 6);
-               /* fall-through */
+               fallthrough;
        case DIB7000P_POWER_INTERFACE_ONLY:
                /* just leave power on the control-interfaces: GPIO and (I2C or SDIO) */
                /* TODO power up either SDIO or I2C */
index 5de0164..237b9d0 100644 (file)
@@ -2306,7 +2306,7 @@ hi_command(struct i2c_device_addr *dev_addr, const struct drxj_hi_cmd *cmd, u16
                        pr_err("error %d\n", rc);
                        goto rw_error;
                }
-               /* fallthrough */
+               fallthrough;
        case SIO_HI_RA_RAM_CMD_BRDCTRL:
                rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_2__A, cmd->param2, 0);
                if (rc != 0) {
@@ -2318,7 +2318,7 @@ hi_command(struct i2c_device_addr *dev_addr, const struct drxj_hi_cmd *cmd, u16
                        pr_err("error %d\n", rc);
                        goto rw_error;
                }
-               /* fallthrough */
+               fallthrough;
        case SIO_HI_RA_RAM_CMD_NULL:
                /* No parameters */
                break;
@@ -2841,7 +2841,7 @@ ctrl_set_cfg_mpeg_output(struct drx_demod_instance *demod, struct drx_cfg_mpeg_o
                        /* coef = 188/204                          */
                        max_bit_rate =
                            (ext_attr->curr_symbol_rate / 8) * nr_bits * 188;
-                       /* fall-through - as b/c Annex A/C need following settings */
+                       fallthrough;    /* as b/c Annex A/C need following settings */
                case DRX_STANDARD_ITU_B:
                        rc = drxj_dap_write_reg16(dev_addr, FEC_OC_FCT_USAGE__A, FEC_OC_FCT_USAGE__PRE, 0);
                        if (rc != 0) {
@@ -3555,8 +3555,8 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                if (!ext_attr->has_smatx)
                        return -EIO;
                switch (uio_cfg->mode) {
-               case DRX_UIO_MODE_FIRMWARE_SMA: /* fall through */
-               case DRX_UIO_MODE_FIRMWARE_SAW: /* fall through */
+               case DRX_UIO_MODE_FIRMWARE_SMA:
+               case DRX_UIO_MODE_FIRMWARE_SAW:
                case DRX_UIO_MODE_READWRITE:
                        ext_attr->uio_sma_tx_mode = uio_cfg->mode;
                        break;
@@ -3579,7 +3579,7 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                if (!ext_attr->has_smarx)
                        return -EIO;
                switch (uio_cfg->mode) {
-               case DRX_UIO_MODE_FIRMWARE0:    /* fall through */
+               case DRX_UIO_MODE_FIRMWARE0:
                case DRX_UIO_MODE_READWRITE:
                        ext_attr->uio_sma_rx_mode = uio_cfg->mode;
                        break;
@@ -3603,7 +3603,7 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                if (!ext_attr->has_gpio)
                        return -EIO;
                switch (uio_cfg->mode) {
-               case DRX_UIO_MODE_FIRMWARE0:    /* fall through */
+               case DRX_UIO_MODE_FIRMWARE0:
                case DRX_UIO_MODE_READWRITE:
                        ext_attr->uio_gpio_mode = uio_cfg->mode;
                        break;
@@ -3639,7 +3639,7 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                        }
                        ext_attr->uio_irqn_mode = uio_cfg->mode;
                        break;
-               case DRX_UIO_MODE_FIRMWARE0:    /* fall through */
+               case DRX_UIO_MODE_FIRMWARE0:
                default:
                        return -EINVAL;
                        break;
@@ -4004,31 +4004,36 @@ static int scu_command(struct i2c_device_addr *dev_addr, struct drxjscu_cmd *cmd
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 4:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_3__A, *(cmd->parameter + 3), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 3:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_2__A, *(cmd->parameter + 2), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 2:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_1__A, *(cmd->parameter + 1), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 1:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_0__A, *(cmd->parameter + 0), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 0:
                /* do nothing */
                break;
@@ -4068,25 +4073,29 @@ static int scu_command(struct i2c_device_addr *dev_addr, struct drxjscu_cmd *cmd
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 3:
                        rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_2__A, cmd->result + 2, 0);
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 2:
                        rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_1__A, cmd->result + 1, 0);
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 1:
                        rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_0__A, cmd->result + 0, 0);
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 0:
                        /* do nothing */
                        break;
@@ -4791,7 +4800,7 @@ set_frequency(struct drx_demod_instance *demod,
                   Sound carrier is already 3Mhz above centre frequency due
                   to tuner setting so now add an extra shift of 1MHz... */
                fm_frequency_shift = 1000;
-               /*fall through */
+               fallthrough;
        case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_NTSC:
        case DRX_STANDARD_PAL_SECAM_BG:
@@ -10475,11 +10484,11 @@ ctrl_set_channel(struct drx_demod_instance *demod, struct drx_channel *channel)
            (standard == DRX_STANDARD_NTSC)) {
                switch (channel->bandwidth) {
                case DRX_BANDWIDTH_6MHZ:
-               case DRX_BANDWIDTH_UNKNOWN:     /* fall through */
+               case DRX_BANDWIDTH_UNKNOWN:
                        channel->bandwidth = DRX_BANDWIDTH_6MHZ;
                        break;
-               case DRX_BANDWIDTH_8MHZ:        /* fall through */
-               case DRX_BANDWIDTH_7MHZ:        /* fall through */
+               case DRX_BANDWIDTH_8MHZ:
+               case DRX_BANDWIDTH_7MHZ:
                default:
                        return -EINVAL;
                }
@@ -10511,10 +10520,10 @@ ctrl_set_channel(struct drx_demod_instance *demod, struct drx_channel *channel)
                }
 
                switch (channel->constellation) {
-               case DRX_CONSTELLATION_QAM16:   /* fall through */
-               case DRX_CONSTELLATION_QAM32:   /* fall through */
-               case DRX_CONSTELLATION_QAM64:   /* fall through */
-               case DRX_CONSTELLATION_QAM128:  /* fall through */
+               case DRX_CONSTELLATION_QAM16:
+               case DRX_CONSTELLATION_QAM32:
+               case DRX_CONSTELLATION_QAM64:
+               case DRX_CONSTELLATION_QAM128:
                case DRX_CONSTELLATION_QAM256:
                        bandwidth_temp = channel->symbolrate * bw_rolloff_factor;
                        bandwidth = bandwidth_temp / 100;
@@ -10628,8 +10637,8 @@ ctrl_set_channel(struct drx_demod_instance *demod, struct drx_channel *channel)
                }
                break;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                rc = set_qam_channel(demod, channel, tuner_freq_offset);
                if (rc != 0) {
@@ -10820,7 +10829,7 @@ ctrl_lock_status(struct drx_demod_instance *demod, enum drx_lock_status *lock_st
                    SCU_RAM_COMMAND_CMD_DEMOD_GET_LOCK;
                break;
 #endif
-       case DRX_STANDARD_UNKNOWN:      /* fallthrough */
+       case DRX_STANDARD_UNKNOWN:
        default:
                return -EIO;
        }
@@ -10888,8 +10897,8 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
         */
        switch (prev_standard) {
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                rc = power_down_qam(demod, false);
                if (rc != 0) {
@@ -10908,7 +10917,7 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
        case DRX_STANDARD_UNKNOWN:
                /* Do nothing */
                break;
-       case DRX_STANDARD_AUTO: /* fallthrough */
+       case DRX_STANDARD_AUTO:
        default:
                return -EINVAL;
        }
@@ -10921,8 +10930,8 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
 
        switch (*standard) {
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                do {
                        u16 dummy;
@@ -11111,12 +11120,12 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
                                goto rw_error;
                        }
                        break;
-               case DRX_STANDARD_PAL_SECAM_BG: /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_DK: /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_I:  /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_L:  /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_LP: /* fallthrough */
-               case DRX_STANDARD_NTSC: /* fallthrough */
+               case DRX_STANDARD_PAL_SECAM_BG:
+               case DRX_STANDARD_PAL_SECAM_DK:
+               case DRX_STANDARD_PAL_SECAM_I:
+               case DRX_STANDARD_PAL_SECAM_L:
+               case DRX_STANDARD_PAL_SECAM_LP:
+               case DRX_STANDARD_NTSC:
                case DRX_STANDARD_FM:
                        rc = power_down_atv(demod, ext_attr->standard, true);
                        if (rc != 0) {
@@ -11127,7 +11136,7 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
                case DRX_STANDARD_UNKNOWN:
                        /* Do nothing */
                        break;
-               case DRX_STANDARD_AUTO: /* fallthrough */
+               case DRX_STANDARD_AUTO:
                default:
                        return -EIO;
                }
@@ -11220,8 +11229,8 @@ ctrl_set_cfg_pre_saw(struct drx_demod_instance *demod, struct drxj_cfg_pre_saw *
                ext_attr->vsb_pre_saw_cfg = *pre_saw;
                break;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                ext_attr->qam_pre_saw_cfg = *pre_saw;
                break;
@@ -11264,10 +11273,10 @@ ctrl_set_cfg_afe_gain(struct drx_demod_instance *demod, struct drxj_cfg_afe_gain
        ext_attr = (struct drxj_data *) demod->my_ext_attr;
 
        switch (afe_gain->standard) {
-       case DRX_STANDARD_8VSB: /* fallthrough */
+       case DRX_STANDARD_8VSB: fallthrough;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
 #endif
                /* Do nothing */
@@ -11301,8 +11310,8 @@ ctrl_set_cfg_afe_gain(struct drx_demod_instance *demod, struct drxj_cfg_afe_gain
                ext_attr->vsb_pga_cfg = gain * 13 + 140;
                break;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                ext_attr->qam_pga_cfg = gain * 13 + 140;
                break;
index fae6f37..45f9828 100644 (file)
@@ -1512,14 +1512,14 @@ static int SetDeviceTypeId(struct drxd_state *state)
                        switch (deviceId) {
                        case 4:
                                state->diversity = 1;
-                               /* fall through */
+                               fallthrough;
                        case 3:
                        case 7:
                                state->PGA = 1;
                                break;
                        case 6:
                                state->diversity = 1;
-                               /* fall through */
+                               fallthrough;
                        case 5:
                        case 8:
                                break;
@@ -1966,7 +1966,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                switch (p->transmission_mode) {
                default:        /* Not set, detect it automatically */
                        operationMode |= SC_RA_RAM_OP_AUTO_MODE__M;
-                       /* fall through - try first guess DRX_FFTMODE_8K */
+                       fallthrough;    /* try first guess DRX_FFTMODE_8K */
                case TRANSMISSION_MODE_8K:
                        transmissionParams |= SC_RA_RAM_OP_PARAM_MODE_8K;
                        if (state->type_A) {
@@ -2139,7 +2139,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                switch (p->modulation) {
                default:
                        operationMode |= SC_RA_RAM_OP_AUTO_CONST__M;
-                       /* fall through - try first guess DRX_CONSTELLATION_QAM64 */
+                       fallthrough;    /* try first guess DRX_CONSTELLATION_QAM64 */
                case QAM_64:
                        transmissionParams |= SC_RA_RAM_OP_PARAM_CONST_QAM64;
                        if (state->type_A) {
@@ -2266,7 +2266,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                        break;
                default:
                        operationMode |= SC_RA_RAM_OP_AUTO_RATE__M;
-                       /* fall through */
+                       fallthrough;
                case FEC_2_3:
                        transmissionParams |= SC_RA_RAM_OP_PARAM_RATE_2_3;
                        if (state->type_A)
@@ -2301,7 +2301,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                switch (p->bandwidth_hz) {
                case 0:
                        p->bandwidth_hz = 8000000;
-                       /* fall through */
+                       fallthrough;
                case 8000000:
                        /* (64/7)*(8/8)*1000000 */
                        bandwidth = DRXD_BANDWIDTH_8MHZ_IN_HZ;
index 0ae9d8c..32f9346 100644 (file)
@@ -1756,7 +1756,7 @@ static int setoperation_mode(struct drxk_state *state,
                        goto error;
                state->m_operation_mode = OM_NONE;
                break;
-       case OM_QAM_ITU_A:      /* fallthrough */
+       case OM_QAM_ITU_A:
        case OM_QAM_ITU_C:
                status = mpegts_stop(state);
                if (status < 0)
@@ -1783,7 +1783,7 @@ static int setoperation_mode(struct drxk_state *state,
                if (status < 0)
                        goto error;
                break;
-       case OM_QAM_ITU_A:      /* fallthrough */
+       case OM_QAM_ITU_A:
        case OM_QAM_ITU_C:
                dprintk(1, ": DVB-C Annex %c\n",
                        (state->m_operation_mode == OM_QAM_ITU_A) ? 'A' : 'C');
@@ -2012,7 +2012,7 @@ static int mpegts_dto_setup(struct drxk_state *state,
                fec_oc_rcn_ctl_rate = 0xC00000;
                static_clk = state->m_dvbt_static_clk;
                break;
-       case OM_QAM_ITU_A:      /* fallthrough */
+       case OM_QAM_ITU_A:
        case OM_QAM_ITU_C:
                fec_oc_tmd_mode = 0x0004;
                fec_oc_rcn_ctl_rate = 0xD2B4EE; /* good for >63 Mb/s */
@@ -3249,11 +3249,11 @@ static int dvbt_sc_command(struct drxk_state *state,
        case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM:
        case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM:
                status |= write16(state, OFDM_SC_RA_RAM_PARAM1__A, param1);
-               /* fall through - All commands using 1 parameters */
+               fallthrough;    /* All commands using 1 parameters */
        case OFDM_SC_RA_RAM_CMD_SET_ECHO_TIMING:
        case OFDM_SC_RA_RAM_CMD_USER_IO:
                status |= write16(state, OFDM_SC_RA_RAM_PARAM0__A, param0);
-               /* fall through - All commands using 0 parameters */
+               fallthrough;    /* All commands using 0 parameters */
        case OFDM_SC_RA_RAM_CMD_GET_OP_PARAM:
        case OFDM_SC_RA_RAM_CMD_NULL:
                /* Write command */
@@ -3761,7 +3761,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        case TRANSMISSION_MODE_AUTO:
        default:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_MODE__M;
-               /* fall through - try first guess DRX_FFTMODE_8K */
+               fallthrough;    /* try first guess DRX_FFTMODE_8K */
        case TRANSMISSION_MODE_8K:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_MODE_8K;
                break;
@@ -3775,7 +3775,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        default:
        case GUARD_INTERVAL_AUTO:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_GUARD__M;
-               /* fall through - try first guess DRX_GUARD_1DIV4 */
+               fallthrough;    /* try first guess DRX_GUARD_1DIV4 */
        case GUARD_INTERVAL_1_4:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_4;
                break;
@@ -3798,7 +3798,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_HIER__M;
                /* try first guess SC_RA_RAM_OP_PARAM_HIER_NO */
                /* transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_NO; */
-               /* fall through */
+               fallthrough;
        case HIERARCHY_1:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_A1;
                break;
@@ -3816,7 +3816,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        case QAM_AUTO:
        default:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_CONST__M;
-               /* fall through - try first guess DRX_CONSTELLATION_QAM64 */
+               fallthrough;    /* try first guess DRX_CONSTELLATION_QAM64 */
        case QAM_64:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_CONST_QAM64;
                break;
@@ -3841,7 +3841,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
                WR16(dev_addr, OFDM_EC_SB_PRIOR__A,
                        OFDM_EC_SB_PRIOR_HI));
                break;
-       case DRX_PRIORITY_UNKNOWN:      /* fall through */
+       case DRX_PRIORITY_UNKNOWN:
        default:
                status = -EINVAL;
                goto error;
@@ -3859,7 +3859,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        case FEC_AUTO:
        default:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_RATE__M;
-               /* fall through - try first guess DRX_CODERATE_2DIV3 */
+               fallthrough;    /* try first guess DRX_CODERATE_2DIV3 */
        case FEC_2_3:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_2_3;
                break;
@@ -3893,7 +3893,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        switch (state->props.bandwidth_hz) {
        case 0:
                state->props.bandwidth_hz = 8000000;
-               /* fall through */
+               fallthrough;
        case 8000000:
                bandwidth = DRXK_BANDWIDTH_8MHZ_IN_HZ;
                status = write16(state, OFDM_SC_RA_RAM_SRMM_FIX_FACT_8K__A,
index d3c330e..722576f 100644 (file)
@@ -768,7 +768,7 @@ static int lgdt3306a_set_if(struct lgdt3306a_state *state,
        default:
                pr_warn("IF=%d KHz is not supported, 3250 assumed\n",
                        if_freq_khz);
-               /* fallthrough */
+               fallthrough;
        case 3250: /* 3.25Mhz */
                nco1 = 0x34;
                nco2 = 0x00;
index 8818975..399d5c5 100644 (file)
@@ -201,7 +201,7 @@ static int mt352_set_parameters(struct dvb_frontend *fe)
                        if (op->hierarchy == HIERARCHY_AUTO ||
                            op->hierarchy == HIERARCHY_NONE)
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
        }
index 290b9ea..4404ace 100644 (file)
@@ -739,7 +739,7 @@ static int get_frontend(struct dvb_frontend *fe,
                default:
                        break;
                }
-               /* Fall through */
+               fallthrough;
        case SYS_DVBS:
                switch ((enum MXL_HYDRA_MODULATION_E)
                        reg_data[DMD_MODULATION_SCHEME_ADDR]) {
index 35a3e47..24de1b1 100644 (file)
@@ -482,7 +482,7 @@ start:
        switch (reg&0xff) {
        case 0x06:
                if (reg & 0x1000) usK = 3 << 24;
-               /* fall through */
+               fallthrough;
        case 0x43: /* QAM64 */
                c = 150204167;
                break;
index 8940291..c1334d7 100644 (file)
@@ -398,7 +398,7 @@ static int s5h1411_set_if_freq(struct dvb_frontend *fe, int KHz)
        default:
                dprintk("%s(%d KHz) Invalid, defaulting to 5380\n",
                        __func__, KHz);
-               /* fall through */
+               fallthrough;
        case 5380:
        case 44000:
                s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x1be4);
index 2fc6aea..2a2cf20 100644 (file)
@@ -201,7 +201,7 @@ static int zl10353_set_parameters(struct dvb_frontend *fe)
                break;
        default:
                c->bandwidth_hz = 8000000;
-               /* fall through */
+               fallthrough;
        case 8000000:
                zl10353_single_write(fe, MCLK_RATIO, 0x75);
                zl10353_single_write(fe, 0x64, 0x36);
@@ -258,7 +258,7 @@ static int zl10353_set_parameters(struct dvb_frontend *fe)
                if (c->hierarchy == HIERARCHY_AUTO ||
                    c->hierarchy == HIERARCHY_NONE)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 570a4a0..03eee60 100644 (file)
@@ -2209,7 +2209,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                ts2->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
                ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
                ts2->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
-               /* fall-through */
+               fallthrough;
        case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
                ts1->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
                ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
@@ -2370,7 +2370,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                /* Currently only enabled for the integrated IR controller */
                if (!enable_885_ir)
                        break;
-               /* fall-through */
+               fallthrough;
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
        case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
index 7cabb9e..92fe051 100644 (file)
@@ -1310,7 +1310,7 @@ static void dvb_input_detach(struct ddb_input *input)
                        dvb_unregister_frontend(dvb->fe2);
                if (dvb->fe)
                        dvb_unregister_frontend(dvb->fe);
-               /* fallthrough */
+               fallthrough;
        case 0x30:
                dvb_module_release(dvb->i2c_client[0]);
                dvb->i2c_client[0] = NULL;
@@ -1321,22 +1321,22 @@ static void dvb_input_detach(struct ddb_input *input)
                        dvb_frontend_detach(dvb->fe);
                dvb->fe = NULL;
                dvb->fe2 = NULL;
-               /* fallthrough */
+               fallthrough;
        case 0x20:
                dvb_net_release(&dvb->dvbnet);
-               /* fallthrough */
+               fallthrough;
        case 0x12:
                dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
                                              &dvb->hw_frontend);
                dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
                                              &dvb->mem_frontend);
-               /* fallthrough */
+               fallthrough;
        case 0x11:
                dvb_dmxdev_release(&dvb->dmxdev);
-               /* fallthrough */
+               fallthrough;
        case 0x10:
                dvb_dmx_release(&dvb->demux);
-               /* fallthrough */
+               fallthrough;
        case 0x01:
                break;
        }
@@ -1559,7 +1559,7 @@ static int dvb_input_attach(struct ddb_input *input)
                        osc24 = 0;
                else
                        osc24 = 1;
-               /* fall-through */
+               fallthrough;
        case DDB_TUNER_DVBCT2_SONY_P:
        case DDB_TUNER_DVBC2T2_SONY_P:
        case DDB_TUNER_ISDBT_SONY_P:
@@ -1575,7 +1575,7 @@ static int dvb_input_attach(struct ddb_input *input)
                break;
        case DDB_TUNER_DVBC2T2I_SONY:
                osc24 = 1;
-               /* fall-through */
+               fallthrough;
        case DDB_TUNER_DVBCT2_SONY:
        case DDB_TUNER_DVBC2T2_SONY:
        case DDB_TUNER_ISDBT_SONY:
@@ -2036,7 +2036,7 @@ static int ddb_port_attach(struct ddb_port *port)
                ret = ddb_ci_attach(port, ci_bitrate);
                if (ret < 0)
                        break;
-               /* fall-through */
+               fallthrough;
        case DDB_PORT_LOOP:
                ret = dvb_register_device(port->dvb[0].adap,
                                          &port->dvb[0].dev,
@@ -2432,7 +2432,8 @@ void ddb_ports_init(struct ddb *dev)
                                        ddb_input_init(port, 4 + i, 1, 4 + i);
                                        ddb_output_init(port, i);
                                        break;
-                               } /* fallthrough */
+                               }
+                               fallthrough;
                        case DDB_OCTOPUS:
                                ddb_input_init(port, 2 * i, 0, 2 * i);
                                ddb_input_init(port, 2 * i + 1, 1, 2 * i + 1);
@@ -3417,7 +3418,7 @@ int ddb_exit_ddbridge(int stage, int error)
        default:
        case 2:
                destroy_workqueue(ddb_wq);
-               /* fall-through */
+               fallthrough;
        case 1:
                ddb_class_destroy();
                break;
index 7fb3b18..8944e4b 100644 (file)
@@ -952,7 +952,7 @@ static int meyeioc_sync(struct file *file, void *fh, int *i)
                        mutex_unlock(&meye.lock);
                        return -EINTR;
                }
-               /* fall through */
+               fallthrough;
        case MEYE_BUF_DONE:
                meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
                if (kfifo_out_locked(&meye.doneq, (unsigned char *)&unused,
index bf36b1e..45228f4 100644 (file)
@@ -637,7 +637,7 @@ static void gpioirq(unsigned long cookie)
                        iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case DATA_TS_RECORD:
        case DATA_PES_RECORD:
@@ -2176,7 +2176,7 @@ static int frontend_init(struct av7110 *av7110)
                                break;
                        }
                }
-               /* fall-thru */
+                       fallthrough;
 
                case 0x0008: // Hauppauge/TT DVB-T
                        // Grundig 29504-401
index e8a8ec5..93ca31e 100644 (file)
@@ -1107,7 +1107,7 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
                break;
        case OSD_SetRow:
                dc->y1 = dc->y0;
-               /* fall through */
+               fallthrough;
        case OSD_SetBlock:
                ret = OSDSetBlock(av7110, dc->x0, dc->y0, dc->x1, dc->y1, dc->color, dc->data);
                break;
index ec528fa..30330ed 100644 (file)
@@ -182,7 +182,7 @@ int av7110_ipack_instant_repack (const u8 *buf, int count, struct ipack *p)
                        case DSM_CC_STREAM  :
                        case ISO13522_STREAM:
                                p->done = 1;
-                               /* fall through */
+                               fallthrough;
                        case PRIVATE_STREAM1:
                        case VIDEO_STREAM_S ... VIDEO_STREAM_E:
                        case AUDIO_STREAM_S ... AUDIO_STREAM_E:
index 38cac50..3cb8300 100644 (file)
@@ -1226,7 +1226,7 @@ static void frontend_init(struct budget_av *budget_av)
                 * but so far it has been only confirmed for this type
                 */
                budget_av->reinitialise_demod = 1;
-               /* fall through */
+               fallthrough;
        case SUBID_DVBS_KNC1_PLUS:
        case SUBID_DVBS_EASYWATCH_1:
                if (saa->pci->subsystem_vendor == 0x1894) {
index 9c81127..a88711a 100644 (file)
@@ -613,7 +613,7 @@ static void frontend_init(struct budget *budget)
                        break;
                }
        }
-       /* fall through */
+               fallthrough;
        case 0x1018: // TT Budget-S-1401 (philips tda10086/philips tda8262)
        {
                struct dvb_frontend *fe;
@@ -638,7 +638,7 @@ static void frontend_init(struct budget *budget)
                        break;
                }
        }
-       /* fall through */
+               fallthrough;
 
        case 0x101c: { /* TT S2-1600 */
                        const struct stv6110x_devctl *ctl;
index 36e5f2f..b22dc1d 100644 (file)
@@ -220,7 +220,7 @@ static void sh_vou_stream_config(struct sh_vou_device *vou_dev)
                break;
        case V4L2_PIX_FMT_RGB565:
                dataswap ^= 1;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGB565X:
                row_coeff = 2;
                break;
@@ -802,7 +802,7 @@ static u32 sh_vou_ntsc_mode(enum sh_vou_bus_fmt bus_fmt)
        default:
                pr_warn("%s(): Invalid bus-format code %d, using default 8-bit\n",
                        __func__, bus_fmt);
-               /* fall through */
+               fallthrough;
        case SH_VOU_BUS_8BIT:
                return 1;
        case SH_VOU_BUS_16BIT:
index b203296..7e24602 100644 (file)
@@ -105,7 +105,8 @@ static inline enum phase_diversity_modes_idx
 si476x_phase_diversity_mode_to_idx(enum si476x_phase_diversity_mode mode)
 {
        switch (mode) {
-       default:                /* FALLTHROUGH */
+       default:
+               fallthrough;
        case SI476X_PHDIV_DISABLED:
                return SI476X_IDX_PHDIV_DISABLED;
        case SI476X_PHDIV_PRIMARY_COMBINING:
index b0303cf..c373152 100644 (file)
@@ -249,7 +249,7 @@ int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
                        index = BAND_AM;
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 5bb1444..3fe3edd 100644 (file)
@@ -112,7 +112,7 @@ lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
        case BPF_FUNC_trace_printk:
                if (perfmon_capable())
                        return bpf_get_trace_printk_proto();
-               /* fall through */
+               fallthrough;
        default:
                return NULL;
        }
index 95727ca..0cda78f 100644 (file)
@@ -64,7 +64,7 @@ static enum rc6_mode rc6_mode(struct rc6_dec *data)
        case 6:
                if (!data->toggle)
                        return RC6_MODE_6A;
-               /* fall through */
+               fallthrough;
        default:
                return RC6_MODE_UNKNOWN;
        }
index 9fa58d9..7d9a7c0 100644 (file)
@@ -102,7 +102,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
                }
 
                data->state = STATE_FINISHED;
-               /* Fall through */
+               fallthrough;
 
        case STATE_FINISHED:
                if (ev.pulse)
index 734a92c..7b7d9fe 100644 (file)
@@ -756,7 +756,7 @@ static int xc5000_set_digital_params(struct dvb_frontend *fe)
                if (!bw)
                        bw = 6000000;
                /* fall to OFDM handling */
-               /* fall through */
+               fallthrough;
        case SYS_DMBTH:
        case SYS_DVBT:
        case SYS_DVBT2:
index 198ddfb..e3234d1 100644 (file)
@@ -525,7 +525,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
        case USB_SPEED_HIGH:
                info("running at HIGH speed.");
                break;
-       case USB_SPEED_UNKNOWN: /* fall through */
+       case USB_SPEED_UNKNOWN:
        default:
                err("cannot handle USB speed because it is unknown.");
                return -ENODEV;
index 20c50c2..e747548 100644 (file)
@@ -165,7 +165,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_BRIGHTNESS:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_BRIGHTNESS:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -176,7 +176,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_CONTRAST:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_CONTRAST:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -184,7 +184,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_SATURATION:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_SATURATION:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -195,7 +195,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_GPIO_DATA:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_GPIO_DATA:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -203,7 +203,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_GPIO_DIRECTION:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_GPIO_DIRECTION:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -211,7 +211,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VC_MP_GPIO_DATA:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VC_MP_GPIO_DATA:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -219,7 +219,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VC_MP_GPIO_DIRECTION:
                cmd.buffer.block_data[0] = param;
-               /*fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VC_MP_GPIO_DIRECTION:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -234,7 +234,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_FLICKER_MODES:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_FLICKER_MODES:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -281,7 +281,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_USER_MODE:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_USER_MODE:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -301,7 +301,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_WAKEUP:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_WAKEUP:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -309,7 +309,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_PW_CONTROL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_PW_CONTROL:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -322,7 +322,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_SYSTEM_CTRL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_SYSTEM_CTRL:
                cmd.req_mode =
                    CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_SYSTEM;
@@ -331,7 +331,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_SYSTEM_CTRL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_SYSTEM_CTRL:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -339,7 +339,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_EXP_MODES:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_EXP_MODES:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -347,7 +347,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_DEVICE_CONFIG:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_DEVICE_CONFIG:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -368,7 +368,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VC_CONTROL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VC_CONTROL:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -403,7 +403,7 @@ int cpia2_do_command(struct camera_data *cam,
                                             this register can also affect
                                             flicker modes */
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_USER_EFFECTS:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -1751,7 +1751,7 @@ int cpia2_set_fps(struct camera_data *cam, int framerate)
                                                    CPIA2_VP_SENSOR_FLAGS_500) {
                                return -EINVAL;
                        }
-                       /* Fall through */
+                       fallthrough;
                case CPIA2_VP_FRAMERATE_15:
                case CPIA2_VP_FRAMERATE_12_5:
                case CPIA2_VP_FRAMERATE_7_5:
index d9f953f..425e470 100644 (file)
@@ -996,7 +996,7 @@ void cx231xx_v4l2_create_entities(struct cx231xx *dev)
                        /* The DVB core will handle it */
                        if (dev->tuner_type == TUNER_ABSENT)
                                continue;
-                       /* fall through */
+                       fallthrough;
                default: /* just to shut up a gcc warning */
                        ent->function = MEDIA_ENT_F_CONN_RF;
                        break;
index 4ef3fa9..52e648e 100644 (file)
@@ -1659,14 +1659,14 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
 
        switch (band) {
        default:
-                       deb_info("Warning : Rf frequency  (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
-                       /* fall through */
+               deb_info("Warning : Rf frequency  (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
+               fallthrough;
        case BAND_VHF:
-                       state->dib8000_ops.set_gpio(fe, 3, 0, 1);
-                       break;
+               state->dib8000_ops.set_gpio(fe, 3, 0, 1);
+               break;
        case BAND_UHF:
-                       state->dib8000_ops.set_gpio(fe, 3, 0, 0);
-                       break;
+               state->dib8000_ops.set_gpio(fe, 3, 0, 0);
+               break;
        }
 
        ret = state->set_param_save(fe);
index f96626f..a27a684 100644 (file)
@@ -1886,12 +1886,12 @@ static int dw2102_load_firmware(struct usb_device *dev,
                switch (le16_to_cpu(dev->descriptor.idProduct)) {
                case USB_PID_TEVII_S650:
                        dw2104_properties.rc.core.rc_codes = RC_MAP_TEVII_NEC;
-                       /* fall through */
+                       fallthrough;
                case USB_PID_DW2104:
                        reset = 1;
                        dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
                                        DW210X_WRITE_MSG);
-                       /* fall through */
+                       fallthrough;
                case USB_PID_DW3101:
                        reset = 0;
                        dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
@@ -1924,7 +1924,7 @@ static int dw2102_load_firmware(struct usb_device *dev,
                                        break;
                                }
                        }
-                       /* fall through */
+                       fallthrough;
                case 0x2101:
                        dw210x_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2,
                                        DW210X_READ_MSG);
index 3f3fbcd..45a2403 100644 (file)
@@ -2200,7 +2200,7 @@ static int check_range(enum v4l2_ctrl_type type,
        case V4L2_CTRL_TYPE_BOOLEAN:
                if (step != 1 || max > 1 || min < 0)
                        return -ERANGE;
-               /* fall through */
+               fallthrough;
        case V4L2_CTRL_TYPE_U8:
        case V4L2_CTRL_TYPE_U16:
        case V4L2_CTRL_TYPE_U32:
index a556880..2a22e13 100644 (file)
@@ -782,7 +782,6 @@ static void v4l_print_frmsizeenum(const void *arg, bool write_only)
                                p->stepwise.step_height);
                break;
        case V4L2_FRMSIZE_TYPE_CONTINUOUS:
-               /* fall through */
        default:
                pr_cont("\n");
                break;
@@ -816,7 +815,6 @@ static void v4l_print_frmivalenum(const void *arg, bool write_only)
                                p->stepwise.step.denominator);
                break;
        case V4L2_FRMIVAL_TYPE_CONTINUOUS:
-               /* fall through */
        default:
                pr_cont("\n");
                break;
index 5c91fc3..606a271 100644 (file)
@@ -354,7 +354,7 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
                break;
        case VIDEOBUF_ERROR:
                b->flags |= V4L2_BUF_FLAG_ERROR;
-               /* fall through */
+               fallthrough;
        case VIDEOBUF_DONE:
                b->flags |= V4L2_BUF_FLAG_DONE;
                break;
index f512cbc..ca00976 100644 (file)
@@ -313,7 +313,6 @@ static unsigned long gpmc_get_clk_period(int cs, enum gpmc_clk_domain cd)
                tick_ps *= div;
                break;
        case GPMC_CD_FCLK:
-               /* FALL-THROUGH */
        default:
                break;
        }
index d9ee8e3..1789542 100644 (file)
@@ -371,7 +371,7 @@ again:
                        serial mode), then just fall through */
                if (msb_read_int_reg(msb, -1))
                        return 0;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_RP_RECEIVE_INT_REQ_RESULT:
                intreg = mrq->data[0];
@@ -403,7 +403,7 @@ again:
        case MSB_RP_RECEIVE_STATUS_REG:
                msb->regs.status = *(struct ms_status_register *)mrq->data;
                msb->state = MSB_RP_SEND_OOB_READ;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_RP_SEND_OOB_READ:
                if (!msb_read_regs(msb,
@@ -418,7 +418,7 @@ again:
                msb->regs.extra_data =
                        *(struct ms_extra_data_register *) mrq->data;
                msb->state = MSB_RP_SEND_READ_DATA;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_RP_SEND_READ_DATA:
                /* Skip that state if we only read the oob */
@@ -518,7 +518,7 @@ again:
                msb->state = MSB_WB_RECEIVE_INT_REQ;
                if (msb_read_int_reg(msb, -1))
                        return 0;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_WB_RECEIVE_INT_REQ:
                intreg = mrq->data[0];
@@ -549,7 +549,7 @@ again:
 
                msb->int_polling = false;
                msb->state = MSB_WB_SEND_WRITE_DATA;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_WB_SEND_WRITE_DATA:
                sg_init_table(sg, ARRAY_SIZE(sg));
@@ -628,7 +628,7 @@ again:
                msb->state = MSB_SC_RECEIVE_INT_REQ;
                if (msb_read_int_reg(msb, -1))
                        return 0;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_SC_RECEIVE_INT_REQ:
                intreg = mrq->data[0];
index 4a6b866..e83c3ad 100644 (file)
@@ -255,11 +255,11 @@ static unsigned int jmb38x_ms_write_data(struct jmb38x_ms_host *host,
        case 3:
                host->io_word[0] |= buf[off + 2] << 16;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 2:
                host->io_word[0] |= buf[off + 1] << 8;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 1:
                host->io_word[0] |= buf[off];
                host->io_pos++;
index fc35c74..786e467 100644 (file)
@@ -162,11 +162,11 @@ static unsigned int tifm_ms_write_data(struct tifm_ms *host,
        case 3:
                host->io_word |= buf[off + 2] << 16;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 2:
                host->io_word |= buf[off + 1] << 8;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 1:
                host->io_word |= buf[off];
                host->io_pos++;
index 5216487..9903e96 100644 (file)
@@ -642,7 +642,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
                        freereq = 0;
                if (event != MPI_EVENT_EVENT_CHANGE)
                        break;
-               /* fall through */
+               fallthrough;
        case MPI_FUNCTION_CONFIG:
        case MPI_FUNCTION_SAS_IO_UNIT_CONTROL:
                ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
@@ -1887,7 +1887,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        case MPI_MANUFACTPAGE_DEVICEID_FC939X:
        case MPI_MANUFACTPAGE_DEVICEID_FC949X:
                ioc->errata_flag_1064 = 1;
-               /* fall through */
+               fallthrough;
        case MPI_MANUFACTPAGE_DEVICEID_FC909:
        case MPI_MANUFACTPAGE_DEVICEID_FC929:
        case MPI_MANUFACTPAGE_DEVICEID_FC919:
@@ -1932,7 +1932,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                        pcixcmd &= 0x8F;
                        pci_write_config_byte(pdev, 0x6a, pcixcmd);
                }
-               /* fall through */
+               fallthrough;
 
        case MPI_MANUFACTPAGE_DEVID_1030_53C1035:
                ioc->bus_type = SPI;
index 6a79cd0..18b91ea 100644 (file)
@@ -4326,7 +4326,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
                        }
                }
                mpt_findImVolumes(ioc);
-               /* fall through */
+               fallthrough;
 
        case MPTSAS_ADD_DEVICE:
                memset(&sas_device, 0, sizeof(struct mptsas_devinfo));
index 1491561..8543f03 100644 (file)
@@ -784,7 +784,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                        /*
                         * Allow non-SAS & non-NEXUS_LOSS to drop into below code
                         */
-                       /* Fall through */
+                       fallthrough;
 
                case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:        /* 0x0048 */
                        /* Linux handles an unsolicited DID_RESET better
@@ -881,7 +881,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 
                case MPI_IOCSTATUS_SCSI_DATA_OVERRUN:           /* 0x0044 */
                        scsi_set_resid(sc, 0);
-                       /* Fall through */
+                       fallthrough;
                case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR:        /* 0x0040 */
                case MPI_IOCSTATUS_SUCCESS:                     /* 0x0000 */
                        sc->result = (DID_OK << 16) | scsi_status;
index a9d9c1c..a5983d5 100644 (file)
@@ -1515,10 +1515,10 @@ static unsigned long dsiclk_rate(u8 n)
        switch (divsel) {
        case PRCM_DSI_PLLOUT_SEL_PHI_4:
                div *= 2;
-               /* Fall through */
+               fallthrough;
        case PRCM_DSI_PLLOUT_SEL_PHI_2:
                div *= 2;
-               /* Fall through */
+               fallthrough;
        case PRCM_DSI_PLLOUT_SEL_PHI:
                return pll_rate(PRCM_PLLDSI_FREQ, clock_rate(PRCMU_HDMICLK),
                        PLL_RAW) / div;
index af764bc..761b4ef 100644 (file)
@@ -136,7 +136,7 @@ static int iqs62x_dev_init(struct iqs62x_core *iqs62x)
                if (val & IQS620_PROX_SETTINGS_4_SAR_EN)
                        iqs62x->ui_sel = IQS62X_UI_SAR1;
 
-               /* fall through */
+               fallthrough;
 
        case IQS621_PROD_NUM:
                ret = regmap_write(iqs62x->regmap, IQS620_GLBL_EVENT_MASK,
@@ -470,7 +470,7 @@ static irqreturn_t iqs62x_irq(int irq, void *context)
                case IQS62X_EVENT_UI_LO:
                        event_data.ui_data = get_unaligned_le16(&event_map[i]);
 
-                       /* fall through */
+                       fallthrough;
 
                case IQS62X_EVENT_UI_HI:
                case IQS62X_EVENT_NONE:
@@ -491,7 +491,7 @@ static irqreturn_t iqs62x_irq(int irq, void *context)
                case IQS62X_EVENT_HYST:
                        event_map[i] <<= iqs62x->dev_desc->hyst_shift;
 
-                       /* fall through */
+                       fallthrough;
 
                case IQS62X_EVENT_WHEEL:
                case IQS62X_EVENT_HALL:
index c3651f0..fc00aac 100644 (file)
@@ -126,10 +126,6 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
        const __be32 *reg;
        u64 of_node_addr;
 
-       /* Skip devices 'disabled' by Device Tree */
-       if (!of_device_is_available(np))
-               return -ENODEV;
-
        /* Skip if OF node has previously been allocated to a device */
        list_for_each_entry(of_entry, &mfd_of_node_list, list)
                if (of_entry->np == np)
@@ -212,6 +208,12 @@ static int mfd_add_device(struct device *parent, int id,
        if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
                for_each_child_of_node(parent->of_node, np) {
                        if (of_device_is_compatible(np, cell->of_compatible)) {
+                               /* Ignore 'disabled' devices error free */
+                               if (!of_device_is_available(np)) {
+                                       ret = 0;
+                                       goto fail_alias;
+                               }
+
                                ret = mfd_match_of_node_to_dev(pdev, np, cell);
                                if (ret == -EAGAIN)
                                        continue;
@@ -370,8 +372,6 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)
        regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies,
                                               cell->num_parent_supplies);
 
-       kfree(cell);
-
        platform_device_unregister(pdev);
        return 0;
 }
index 5bef142..111d11f 100644 (file)
@@ -172,7 +172,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
                                        MXS_LRADC_TOUCHSCREEN_5WIRE;
                                break;
                        }
-                       /* fall through - to an error message for i.MX23 */
+                       fallthrough;    /* to an error message for i.MX23 */
                default:
                        dev_err(&pdev->dev,
                                "Unsupported number of touchscreen wires (%d)\n"
index 1e6431c..2a3a240 100644 (file)
@@ -308,7 +308,7 @@ static int usbhs_runtime_resume(struct device *dev)
                                         i, r);
                                }
                        }
-               /* Fall through - as HSIC mode needs utmi_clk */
+                       fallthrough;    /* as HSIC mode needs utmi_clk */
 
                case OMAP_EHCI_PORT_MODE_TLL:
                        if (!IS_ERR(omap->utmi_clk[i])) {
@@ -344,7 +344,7 @@ static int usbhs_runtime_suspend(struct device *dev)
 
                        if (!IS_ERR(omap->hsic480m_clk[i]))
                                clk_disable_unprepare(omap->hsic480m_clk[i]);
-               /* Fall through - as utmi_clks were used in HSIC mode */
+                       fallthrough;    /* as utmi_clks were used in HSIC mode */
 
                case OMAP_EHCI_PORT_MODE_TLL:
                        if (!IS_ERR(omap->utmi_clk[i]))
index abaab54..545196c 100644 (file)
@@ -270,7 +270,7 @@ static void *stuff(unsigned char *dest, const unsigned char *src, size_t n)
                case RAVE_SP_ETX:
                case RAVE_SP_DLE:
                        *dest++ = RAVE_SP_DLE;
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        *dest++ = byte;
                }
@@ -541,7 +541,7 @@ static int rave_sp_receive_buf(struct serdev_device *serdev,
                         * deframer buffer
                         */
 
-                       /* FALLTHROUGH */
+                       fallthrough;
 
                case RAVE_SP_EXPECT_ESCAPED_DATA:
                        if (deframer->length == sizeof(deframer->data)) {
index 75859e4..df5cebb 100644 (file)
@@ -95,7 +95,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
                        break;
                default:
                        pr_err("Failed to retrieve valid hwlock: %d\n", ret);
-                       /* fall-through */
+                       fallthrough;
                case -EPROBE_DEFER:
                        goto err_regmap;
                }
index cde9a2f..ed8d38b 100644 (file)
@@ -90,10 +90,10 @@ static int at25_ee_read(void *priv, unsigned int offset,
        switch (at25->addrlen) {
        default:        /* case 3 */
                *cp++ = offset >> 16;
-               /* fall through */
+               fallthrough;
        case 2:
                *cp++ = offset >> 8;
-               /* fall through */
+               fallthrough;
        case 1:
        case 0: /* can't happen: for better codegen */
                *cp++ = offset >> 0;
@@ -178,10 +178,10 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
                switch (at25->addrlen) {
                default:        /* case 3 */
                        *cp++ = offset >> 16;
-                       /* fall through */
+                       fallthrough;
                case 2:
                        *cp++ = offset >> 8;
-                       /* fall through */
+                       fallthrough;
                case 1:
                case 0: /* can't happen: for better codegen */
                        *cp++ = offset >> 0;
@@ -278,7 +278,7 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
                switch (val) {
                case 9:
                        chip->flags |= EE_INSTR_BIT3_IS_ADDR;
-                       /* fall through */
+                       fallthrough;
                case 8:
                        chip->flags |= EE_ADDR1;
                        break;
index 7c38c4f..a800491 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/uaccess.h>
 #include <linux/genalloc.h>
 
 static void cb_fini(struct hl_device *hdev, struct hl_cb *cb)
@@ -300,7 +301,7 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
        struct hl_device *hdev = hpriv->hdev;
        struct hl_cb *cb;
        phys_addr_t address;
-       u32 handle;
+       u32 handle, user_cb_size;
        int rc;
 
        handle = vma->vm_pgoff;
@@ -314,7 +315,8 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
        }
 
        /* Validation check */
-       if ((vma->vm_end - vma->vm_start) != ALIGN(cb->size, PAGE_SIZE)) {
+       user_cb_size = vma->vm_end - vma->vm_start;
+       if (user_cb_size != ALIGN(cb->size, PAGE_SIZE)) {
                dev_err(hdev->dev,
                        "CB mmap failed, mmap size 0x%lx != 0x%x cb size\n",
                        vma->vm_end - vma->vm_start, cb->size);
@@ -322,6 +324,16 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
                goto put_cb;
        }
 
+       if (!access_ok((void __user *) (uintptr_t) vma->vm_start,
+                                                       user_cb_size)) {
+               dev_err(hdev->dev,
+                       "user pointer is invalid - 0x%lx\n",
+                       vma->vm_start);
+
+               rc = -EINVAL;
+               goto put_cb;
+       }
+
        spin_lock(&cb->lock);
 
        if (cb->mmap) {
index b9840e3..2e3fcbc 100644 (file)
@@ -808,6 +808,14 @@ static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type,
 
        /* currently it is guaranteed to have only one chunk */
        chunk = &cs_chunk_array[0];
+
+       if (chunk->queue_index >= hdev->asic_prop.max_queues) {
+               dev_err(hdev->dev, "Queue index %d is invalid\n",
+                       chunk->queue_index);
+               rc = -EINVAL;
+               goto free_cs_chunk_array;
+       }
+
        q_idx = chunk->queue_index;
        hw_queue_prop = &hdev->asic_prop.hw_queues_props[q_idx];
        q_type = hw_queue_prop->type;
index c50c6fc..37701e4 100644 (file)
@@ -19,7 +19,7 @@
 static struct dentry *hl_debug_root;
 
 static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
-                               u8 i2c_reg, u32 *val)
+                               u8 i2c_reg, long *val)
 {
        struct armcp_packet pkt;
        int rc;
@@ -36,7 +36,7 @@ static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
        pkt.i2c_reg = i2c_reg;
 
        rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
-                                               0, (long *) val);
+                                               0, val);
 
        if (rc)
                dev_err(hdev->dev, "Failed to read from I2C, error %d\n", rc);
@@ -827,7 +827,7 @@ static ssize_t hl_i2c_data_read(struct file *f, char __user *buf,
        struct hl_dbg_device_entry *entry = file_inode(f)->i_private;
        struct hl_device *hdev = entry->hdev;
        char tmp_buf[32];
-       u32 val;
+       long val;
        ssize_t rc;
 
        if (*ppos)
@@ -842,7 +842,7 @@ static ssize_t hl_i2c_data_read(struct file *f, char __user *buf,
                return rc;
        }
 
-       sprintf(tmp_buf, "0x%02x\n", val);
+       sprintf(tmp_buf, "0x%02lx\n", val);
        rc = simple_read_from_buffer(buf, count, ppos, tmp_buf,
                        strlen(tmp_buf));
 
index be16b75..24b01cc 100644 (file)
@@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
        for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
                snprintf(workq_name, 32, "hl-free-jobs-%u", i);
                hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
-               if (hdev->cq_wq == NULL) {
+               if (hdev->cq_wq[i] == NULL) {
                        dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
                        rc = -ENOMEM;
                        goto free_cq_wq;
@@ -1069,7 +1069,7 @@ again:
                        goto out_err;
                }
 
-               hl_set_max_power(hdev, hdev->max_power);
+               hl_set_max_power(hdev);
        } else {
                rc = hdev->asic_funcs->soft_reset_late_init(hdev);
                if (rc) {
@@ -1318,6 +1318,11 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
                goto out_disabled;
        }
 
+       /* Need to call this again because the max power might change,
+        * depending on card type for certain ASICs
+        */
+       hl_set_max_power(hdev);
+
        /*
         * hl_hwmon_init() must be called after device_late_init(), because only
         * there we get the information from the device about which
index f70302c..f52bc69 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/slab.h>
 
+#define FW_FILE_MAX_SIZE       0x1400000 /* maximum size of 20MB */
 /**
  * hl_fw_load_fw_to_device() - Load F/W code to device's memory.
  *
@@ -48,6 +49,14 @@ int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name,
 
        dev_dbg(hdev->dev, "%s firmware size == %zu\n", fw_name, fw_size);
 
+       if (fw_size > FW_FILE_MAX_SIZE) {
+               dev_err(hdev->dev,
+                       "FW file size %zu exceeds maximum of %u bytes\n",
+                       fw_size, FW_FILE_MAX_SIZE);
+               rc = -EINVAL;
+               goto out;
+       }
+
        fw_data = (const u64 *) fw->data;
 
        memcpy_toio(dst, fw_data, fw_size);
index 018d9d6..edbd627 100644 (file)
@@ -1462,6 +1462,8 @@ struct hl_device_idle_busy_ts {
  *                     details.
  * @in_reset: is device in reset flow.
  * @curr_pll_profile: current PLL profile.
+ * @card_type: Various ASICs have several card types. This indicates the card
+ *             type of the current device.
  * @cs_active_cnt: number of active command submissions on this device (active
  *                 means already in H/W queues)
  * @major: habanalabs kernel driver major.
@@ -1566,6 +1568,7 @@ struct hl_device {
        u64                             clock_gating_mask;
        atomic_t                        in_reset;
        enum hl_pll_frequency           curr_pll_profile;
+       enum armcp_card_types           card_type;
        int                             cs_active_cnt;
        u32                             major;
        u32                             high_pll;
@@ -1651,7 +1654,7 @@ struct hl_ioctl_desc {
  *
  * Return: true if the area is inside the valid range, false otherwise.
  */
-static inline bool hl_mem_area_inside_range(u64 address, u32 size,
+static inline bool hl_mem_area_inside_range(u64 address, u64 size,
                                u64 range_start_address, u64 range_end_address)
 {
        u64 end_address = address + size;
@@ -1858,7 +1861,7 @@ int hl_get_pwm_info(struct hl_device *hdev,
 void hl_set_pwm_info(struct hl_device *hdev, int sensor_index, u32 attr,
                        long value);
 u64 hl_get_max_power(struct hl_device *hdev);
-void hl_set_max_power(struct hl_device *hdev, u64 value);
+void hl_set_max_power(struct hl_device *hdev);
 int hl_set_voltage(struct hl_device *hdev,
                        int sensor_index, u32 attr, long value);
 int hl_set_current(struct hl_device *hdev,
index dce9273..5ff4688 100644 (file)
@@ -66,6 +66,11 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
        num_pgs = (args->alloc.mem_size + (page_size - 1)) >> page_shift;
        total_size = num_pgs << page_shift;
 
+       if (!total_size) {
+               dev_err(hdev->dev, "Cannot allocate 0 bytes\n");
+               return -EINVAL;
+       }
+
        contiguous = args->flags & HL_MEM_CONTIGUOUS;
 
        if (contiguous) {
@@ -93,7 +98,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
        phys_pg_pack->contiguous = contiguous;
 
        phys_pg_pack->pages = kvmalloc_array(num_pgs, sizeof(u64), GFP_KERNEL);
-       if (!phys_pg_pack->pages) {
+       if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) {
                rc = -ENOMEM;
                goto pages_arr_err;
        }
@@ -683,7 +688,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx,
 
        phys_pg_pack->pages = kvmalloc_array(total_npages, sizeof(u64),
                                                GFP_KERNEL);
-       if (!phys_pg_pack->pages) {
+       if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) {
                rc = -ENOMEM;
                goto page_pack_arr_mem_err;
        }
index edcc11d..3fc0f49 100644 (file)
@@ -450,7 +450,7 @@ int hl_mmu_init(struct hl_device *hdev)
        hdev->mmu_shadow_hop0 = kvmalloc_array(prop->max_asid,
                                        prop->mmu_hop_table_size,
                                        GFP_KERNEL | __GFP_ZERO);
-       if (!hdev->mmu_shadow_hop0) {
+       if (ZERO_OR_NULL_PTR(hdev->mmu_shadow_hop0)) {
                rc = -ENOMEM;
                goto err_pool_add;
        }
index 7bd3737..2770f03 100644 (file)
@@ -227,7 +227,7 @@ int hl_pci_set_inbound_region(struct hl_device *hdev, u8 region,
        }
 
        /* Point to the specified address */
-       rc = hl_pci_iatu_write(hdev, offset + 0x14,
+       rc |= hl_pci_iatu_write(hdev, offset + 0x14,
                        lower_32_bits(pci_region->addr));
        rc |= hl_pci_iatu_write(hdev, offset + 0x18,
                        upper_32_bits(pci_region->addr));
@@ -369,15 +369,17 @@ int hl_pci_init(struct hl_device *hdev)
        rc = hdev->asic_funcs->init_iatu(hdev);
        if (rc) {
                dev_err(hdev->dev, "Failed to initialize iATU\n");
-               goto disable_device;
+               goto unmap_pci_bars;
        }
 
        rc = hl_pci_set_dma_mask(hdev);
        if (rc)
-               goto disable_device;
+               goto unmap_pci_bars;
 
        return 0;
 
+unmap_pci_bars:
+       hl_pci_bars_unmap(hdev);
 disable_device:
        pci_clear_master(pdev);
        pci_disable_device(pdev);
index b3cb0ac..5ae484c 100644 (file)
@@ -81,7 +81,7 @@ u64 hl_get_max_power(struct hl_device *hdev)
        return result;
 }
 
-void hl_set_max_power(struct hl_device *hdev, u64 value)
+void hl_set_max_power(struct hl_device *hdev)
 {
        struct armcp_packet pkt;
        int rc;
@@ -90,7 +90,7 @@ void hl_set_max_power(struct hl_device *hdev, u64 value)
 
        pkt.ctl = cpu_to_le32(ARMCP_PACKET_MAX_POWER_SET <<
                                ARMCP_PKT_CTL_OPCODE_SHIFT);
-       pkt.value = cpu_to_le64(value);
+       pkt.value = cpu_to_le64(hdev->max_power);
 
        rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
                                                0, NULL);
@@ -316,7 +316,7 @@ static ssize_t max_power_store(struct device *dev,
        }
 
        hdev->max_power = value;
-       hl_set_max_power(hdev, value);
+       hl_set_max_power(hdev);
 
 out:
        return count;
@@ -422,6 +422,7 @@ int hl_sysfs_init(struct hl_device *hdev)
                hdev->pm_mng_profile = PM_AUTO;
        else
                hdev->pm_mng_profile = PM_MANUAL;
+
        hdev->max_power = hdev->asic_prop.max_power_default;
 
        hdev->asic_funcs->add_device_attr(hdev, &hl_dev_clks_attr_group);
index 00a0a72..4009b7d 100644 (file)
@@ -154,6 +154,29 @@ static const u16 gaudi_packet_sizes[MAX_PACKET_ID] = {
        [PACKET_LOAD_AND_EXE]   = sizeof(struct packet_load_and_exe)
 };
 
+static inline bool validate_packet_id(enum packet_id id)
+{
+       switch (id) {
+       case PACKET_WREG_32:
+       case PACKET_WREG_BULK:
+       case PACKET_MSG_LONG:
+       case PACKET_MSG_SHORT:
+       case PACKET_CP_DMA:
+       case PACKET_REPEAT:
+       case PACKET_MSG_PROT:
+       case PACKET_FENCE:
+       case PACKET_LIN_DMA:
+       case PACKET_NOP:
+       case PACKET_STOP:
+       case PACKET_ARB_POINT:
+       case PACKET_WAIT:
+       case PACKET_LOAD_AND_EXE:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static const char * const
 gaudi_tpc_interrupts_cause[GAUDI_NUM_OF_TPC_INTR_CAUSE] = {
        "tpc_address_exceed_slm",
@@ -433,7 +456,7 @@ static int gaudi_get_fixed_properties(struct hl_device *hdev)
        prop->num_of_events = GAUDI_EVENT_SIZE;
        prop->tpc_enabled_mask = TPC_ENABLED_MASK;
 
-       prop->max_power_default = MAX_POWER_DEFAULT;
+       prop->max_power_default = MAX_POWER_DEFAULT_PCI;
 
        prop->cb_pool_cb_cnt = GAUDI_CB_POOL_CB_CNT;
        prop->cb_pool_cb_size = GAUDI_CB_POOL_CB_SIZE;
@@ -2485,6 +2508,7 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)
 {
        struct gaudi_device *gaudi = hdev->asic_specific;
        u32 qman_offset;
+       bool enable;
        int i;
 
        /* In case we are during debug session, don't enable the clock gate
@@ -2494,46 +2518,43 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)
                return;
 
        for (i = GAUDI_PCI_DMA_1, qman_offset = 0 ; i < GAUDI_HBM_DMA_1 ; i++) {
-               if (!(hdev->clock_gating_mask &
-                                       (BIT_ULL(gaudi_dma_assignment[i]))))
-                       continue;
+               enable = !!(hdev->clock_gating_mask &
+                               (BIT_ULL(gaudi_dma_assignment[i])));
 
                qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
-               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset, QMAN_CGM1_PWR_GATE_EN);
+               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset,
+                               enable ? QMAN_CGM1_PWR_GATE_EN : 0);
                WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
-                               QMAN_UPPER_CP_CGM_PWR_GATE_EN);
+                               enable ? QMAN_UPPER_CP_CGM_PWR_GATE_EN : 0);
        }
 
        for (i = GAUDI_HBM_DMA_1 ; i < GAUDI_DMA_MAX ; i++) {
-               if (!(hdev->clock_gating_mask &
-                                       (BIT_ULL(gaudi_dma_assignment[i]))))
-                       continue;
+               enable = !!(hdev->clock_gating_mask &
+                               (BIT_ULL(gaudi_dma_assignment[i])));
 
                qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
-               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset, QMAN_CGM1_PWR_GATE_EN);
+               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset,
+                               enable ? QMAN_CGM1_PWR_GATE_EN : 0);
                WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
-                               QMAN_COMMON_CP_CGM_PWR_GATE_EN);
+                               enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
        }
 
-       if (hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_0))) {
-               WREG32(mmMME0_QM_CGM_CFG1, QMAN_CGM1_PWR_GATE_EN);
-               WREG32(mmMME0_QM_CGM_CFG, QMAN_COMMON_CP_CGM_PWR_GATE_EN);
-       }
+       enable = !!(hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_0)));
+       WREG32(mmMME0_QM_CGM_CFG1, enable ? QMAN_CGM1_PWR_GATE_EN : 0);
+       WREG32(mmMME0_QM_CGM_CFG, enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
 
-       if (hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_2))) {
-               WREG32(mmMME2_QM_CGM_CFG1, QMAN_CGM1_PWR_GATE_EN);
-               WREG32(mmMME2_QM_CGM_CFG, QMAN_COMMON_CP_CGM_PWR_GATE_EN);
-       }
+       enable = !!(hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_2)));
+       WREG32(mmMME2_QM_CGM_CFG1, enable ? QMAN_CGM1_PWR_GATE_EN : 0);
+       WREG32(mmMME2_QM_CGM_CFG, enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
 
        for (i = 0, qman_offset = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
-               if (!(hdev->clock_gating_mask &
-                                       (BIT_ULL(GAUDI_ENGINE_ID_TPC_0 + i))))
-                       continue;
+               enable = !!(hdev->clock_gating_mask &
+                               (BIT_ULL(GAUDI_ENGINE_ID_TPC_0 + i)));
 
                WREG32(mmTPC0_QM_CGM_CFG1 + qman_offset,
-                               QMAN_CGM1_PWR_GATE_EN);
+                               enable ? QMAN_CGM1_PWR_GATE_EN : 0);
                WREG32(mmTPC0_QM_CGM_CFG + qman_offset,
-                               QMAN_COMMON_CP_CGM_PWR_GATE_EN);
+                               enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
 
                qman_offset += TPC_QMAN_OFFSET;
        }
@@ -3772,6 +3793,12 @@ static int gaudi_validate_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = gaudi_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
@@ -3995,6 +4022,12 @@ static int gaudi_patch_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = gaudi_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
@@ -5215,7 +5248,7 @@ static int gaudi_extract_ecc_info(struct hl_device *hdev,
        *memory_wrapper_idx = 0xFF;
 
        /* Iterate through memory wrappers, a single bit must be set */
-       for (i = 0 ; i > num_mem_regs ; i++) {
+       for (i = 0 ; i < num_mem_regs ; i++) {
                err_addr += i * 4;
                err_word = RREG32(err_addr);
                if (err_word) {
@@ -6022,6 +6055,15 @@ static int gaudi_armcp_info_get(struct hl_device *hdev)
                strncpy(prop->armcp_info.card_name, GAUDI_DEFAULT_CARD_NAME,
                                CARD_NAME_MAX_LEN);
 
+       hdev->card_type = le32_to_cpu(hdev->asic_prop.armcp_info.card_type);
+
+       if (hdev->card_type == armcp_card_type_pci)
+               prop->max_power_default = MAX_POWER_DEFAULT_PCI;
+       else if (hdev->card_type == armcp_card_type_pmc)
+               prop->max_power_default = MAX_POWER_DEFAULT_PMC;
+
+       hdev->max_power = prop->max_power_default;
+
        return 0;
 }
 
index 5dc99f6..82137c3 100644 (file)
@@ -41,7 +41,8 @@
 
 #define GAUDI_MAX_CLK_FREQ             2200000000ull   /* 2200 MHz */
 
-#define MAX_POWER_DEFAULT              200000          /* 200W */
+#define MAX_POWER_DEFAULT_PCI          200000          /* 200W */
+#define MAX_POWER_DEFAULT_PMC          350000          /* 350W */
 
 #define GAUDI_CPU_TIMEOUT_USEC         15000000        /* 15s */
 
index 5673ee4..881531d 100644 (file)
@@ -527,7 +527,7 @@ static int gaudi_config_etf(struct hl_device *hdev,
 }
 
 static bool gaudi_etr_validate_address(struct hl_device *hdev, u64 addr,
-                                       u32 size, bool *is_host)
+                                       u64 size, bool *is_host)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        struct gaudi_device *gaudi = hdev->asic_specific;
@@ -539,6 +539,12 @@ static bool gaudi_etr_validate_address(struct hl_device *hdev, u64 addr,
                return false;
        }
 
+       if (addr > (addr + size)) {
+               dev_err(hdev->dev,
+                       "ETR buffer size %llu overflow\n", size);
+               return false;
+       }
+
        /* PMMU and HPMMU addresses are equal, check only one of them */
        if ((gaudi->hw_cap_initialized & HW_CAP_MMU) &&
                hl_mem_area_inside_range(addr, size,
index 8503075..33cd2ae 100644 (file)
@@ -139,6 +139,25 @@ static u16 goya_packet_sizes[MAX_PACKET_ID] = {
        [PACKET_STOP]           = sizeof(struct packet_stop)
 };
 
+static inline bool validate_packet_id(enum packet_id id)
+{
+       switch (id) {
+       case PACKET_WREG_32:
+       case PACKET_WREG_BULK:
+       case PACKET_MSG_LONG:
+       case PACKET_MSG_SHORT:
+       case PACKET_CP_DMA:
+       case PACKET_MSG_PROT:
+       case PACKET_FENCE:
+       case PACKET_LIN_DMA:
+       case PACKET_NOP:
+       case PACKET_STOP:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static u64 goya_mmu_regs[GOYA_MMU_REGS_NUM] = {
        mmDMA_QM_0_GLBL_NON_SECURE_PROPS,
        mmDMA_QM_1_GLBL_NON_SECURE_PROPS,
@@ -3455,6 +3474,12 @@ static int goya_validate_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = goya_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
@@ -3690,6 +3715,12 @@ static int goya_patch_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = goya_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
index b039124..4027a6a 100644 (file)
@@ -362,11 +362,17 @@ static int goya_config_etf(struct hl_device *hdev,
 }
 
 static int goya_etr_validate_address(struct hl_device *hdev, u64 addr,
-               u32 size)
+               u64 size)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        u64 range_start, range_end;
 
+       if (addr > (addr + size)) {
+               dev_err(hdev->dev,
+                       "ETR buffer size %llu overflow\n", size);
+               return false;
+       }
+
        if (hdev->mmu_enable) {
                range_start = prop->dmmu.start_addr;
                range_end = prop->dmmu.end_addr;
index d1d3e02..9ae9669 100644 (file)
@@ -546,38 +546,46 @@ static int mei_hdcp_verify_mprime(struct device *dev,
                                  struct hdcp_port_data *data,
                                  struct hdcp2_rep_stream_ready *stream_ready)
 {
-       struct wired_cmd_repeater_auth_stream_req_in
-                                       verify_mprime_in = { { 0 } };
+       struct wired_cmd_repeater_auth_stream_req_in *verify_mprime_in;
        struct wired_cmd_repeater_auth_stream_req_out
                                        verify_mprime_out = { { 0 } };
        struct mei_cl_device *cldev;
        ssize_t byte;
+       size_t cmd_size;
 
        if (!dev || !stream_ready || !data)
                return -EINVAL;
 
        cldev = to_mei_cl_device(dev);
 
-       verify_mprime_in.header.api_version = HDCP_API_VERSION;
-       verify_mprime_in.header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
-       verify_mprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
-       verify_mprime_in.header.buffer_len =
+       cmd_size = struct_size(verify_mprime_in, streams, data->k);
+       if (cmd_size == SIZE_MAX)
+               return -EINVAL;
+
+       verify_mprime_in = kzalloc(cmd_size, GFP_KERNEL);
+       if (!verify_mprime_in)
+               return -ENOMEM;
+
+       verify_mprime_in->header.api_version = HDCP_API_VERSION;
+       verify_mprime_in->header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
+       verify_mprime_in->header.status = ME_HDCP_STATUS_SUCCESS;
+       verify_mprime_in->header.buffer_len =
                        WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN;
 
-       verify_mprime_in.port.integrated_port_type = data->port_type;
-       verify_mprime_in.port.physical_port = (u8)data->fw_ddi;
-       verify_mprime_in.port.attached_transcoder = (u8)data->fw_tc;
+       verify_mprime_in->port.integrated_port_type = data->port_type;
+       verify_mprime_in->port.physical_port = (u8)data->fw_ddi;
+       verify_mprime_in->port.attached_transcoder = (u8)data->fw_tc;
+
+       memcpy(verify_mprime_in->m_prime, stream_ready->m_prime, HDCP_2_2_MPRIME_LEN);
+       drm_hdcp_cpu_to_be24(verify_mprime_in->seq_num_m, data->seq_num_m);
 
-       memcpy(verify_mprime_in.m_prime, stream_ready->m_prime,
-              HDCP_2_2_MPRIME_LEN);
-       drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
-       memcpy(verify_mprime_in.streams, data->streams,
+       memcpy(verify_mprime_in->streams, data->streams,
               array_size(data->k, sizeof(*data->streams)));
 
-       verify_mprime_in.k = cpu_to_be16(data->k);
+       verify_mprime_in->k = cpu_to_be16(data->k);
 
-       byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+       byte = mei_cldev_send(cldev, (u8 *)verify_mprime_in, cmd_size);
+       kfree(verify_mprime_in);
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;
index 9cc6b2a..304d6c8 100644 (file)
@@ -178,7 +178,7 @@ int scif_close(scif_epd_t epd)
        case SCIFEP_ZOMBIE:
                dev_err(scif_info.mdev.this_device,
                        "SCIFAPI close: zombie state unexpected\n");
-               /* fall through */
+               fallthrough;
        case SCIFEP_DISCONNECTED:
                spin_unlock(&ep->lock);
                scif_unregister_all_windows(epd);
@@ -645,7 +645,7 @@ int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block)
                ep->port.port = err;
                ep->port.node = scif_info.nodeid;
                ep->conn_async_state = ASYNC_CONN_IDLE;
-               /* Fall through */
+               fallthrough;
        case SCIFEP_BOUND:
                /*
                 * If a non-blocking connect has been already initiated
index de8f61e..2da3b47 100644 (file)
@@ -657,7 +657,7 @@ int scif_unregister_window(struct scif_window *window)
                window->unreg_state = OP_IN_PROGRESS;
                send_msg = true;
        }
-               /* fall through */
+               fallthrough;
        case OP_IN_PROGRESS:
        {
                scif_get_window(window, 1);
index f6e600b..0ea923f 100644 (file)
@@ -622,7 +622,7 @@ static int send_noop_message(void *cb, struct gru_message_queue_desc *mqd,
                        break;
                case CBSS_PAGE_OVERFLOW:
                        STAT(mesq_noop_page_overflow);
-                       /* fall through */
+                       fallthrough;
                default:
                        BUG();
                }
@@ -780,7 +780,7 @@ static int send_message_failure(void *cb, struct gru_message_queue_desc *mqd,
                break;
        case CBSS_PAGE_OVERFLOW:
                STAT(mesq_page_overflow);
-               /* fall through */
+               fallthrough;
        default:
                BUG();
        }
index d5e097c..8a495dc 100644 (file)
@@ -1173,7 +1173,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args)
                if (!xpc_kdebug_ignore)
                        break;
 
-               /* fall through */
+               fallthrough;
        case DIE_MCA_MONARCH_ENTER:
        case DIE_INIT_MONARCH_ENTER:
                xpc_arch_ops.offline_heartbeat();
@@ -1184,7 +1184,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args)
                if (!xpc_kdebug_ignore)
                        break;
 
-               /* fall through */
+               fallthrough;
        case DIE_MCA_MONARCH_LEAVE:
        case DIE_INIT_MONARCH_LEAVE:
                xpc_arch_ops.online_heartbeat();
index 21a04bc..099a53b 100644 (file)
@@ -441,10 +441,10 @@ xpc_discovery(void)
                switch (region_size) {
                case 128:
                        max_regions *= 2;
-                       /* fall through */
+                       fallthrough;
                case 64:
                        max_regions *= 2;
-                       /* fall through */
+                       fallthrough;
                case 32:
                        max_regions *= 2;
                        region_size = 16;
index 98c60f1..7791bde 100644 (file)
@@ -574,7 +574,7 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
 
                xpc_wakeup_channel_mgr(part);
        }
-               /* fall through */
+               fallthrough;
        case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV:
                spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
                part_uv->flags |= XPC_P_ENGAGED_UV;
index ce43f75..c8fae66 100644 (file)
@@ -191,7 +191,7 @@ int mmc_of_parse(struct mmc_host *host)
        switch (bus_width) {
        case 8:
                host->caps |= MMC_CAP_8_BIT_DATA;
-               /* fall through - Hosts capable of 8-bit can also do 4 bits */
+               fallthrough;    /* Hosts capable of 8-bit can also do 4 bits */
        case 4:
                host->caps |= MMC_CAP_4_BIT_DATA;
                break;
index 9c89a5b..9f387da 100644 (file)
@@ -289,7 +289,7 @@ config MMC_SDHCI_TEGRA
 
 config MMC_SDHCI_S3C
        tristate "SDHCI support on Samsung S3C SoC"
-       depends on MMC_SDHCI && PLAT_SAMSUNG
+       depends on MMC_SDHCI && (PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS)
        help
          This selects the Secure Digital Host Controller Interface (SDHCI)
          often referrered to as the HSMMC block in some of the Samsung S3C
index 3009014..3fc3bbe 100644 (file)
@@ -2418,7 +2418,7 @@ static void atmci_get_cap(struct atmel_mci *host)
        case 0x600:
        case 0x500:
                host->caps.has_odd_clk_div = 1;
-               /* Fall through */
+               fallthrough;
        case 0x400:
        case 0x300:
                host->caps.has_dma_conf_reg = 1;
@@ -2426,16 +2426,16 @@ static void atmci_get_cap(struct atmel_mci *host)
                host->caps.has_cfg_reg = 1;
                host->caps.has_cstor_reg = 1;
                host->caps.has_highspeed = 1;
-               /* Fall through */
+               fallthrough;
        case 0x200:
                host->caps.has_rwproof = 1;
                host->caps.need_blksz_mul_4 = 0;
                host->caps.need_notbusy_for_read_ops = 1;
-               /* Fall through */
+               fallthrough;
        case 0x100:
                host->caps.has_bad_data_ordering = 0;
                host->caps.need_reset_after_xfer = 0;
-               /* Fall through */
+               fallthrough;
        case 0x0:
                break;
        default:
index f01fecd..e50a08b 100644 (file)
@@ -300,7 +300,7 @@ static void mmc_davinci_start_command(struct mmc_davinci_host *host,
                 * then it's harmless for us to allow it.
                 */
                cmd_reg |= MMCCMD_BSYEXP;
-               /* FALLTHROUGH */
+               fallthrough;
        case MMC_RSP_R1:                /* 48 bits, CRC */
                cmd_reg |= MMCCMD_RSPFMT_R1456;
                break;
index 50977ff..db1a84b 100644 (file)
@@ -238,7 +238,7 @@ static void dw_mci_hs_set_timing(struct dw_mci *host, int timing,
                if (smpl_phase >= USE_DLY_MIN_SMPL &&
                                smpl_phase <= USE_DLY_MAX_SMPL)
                        use_smpl_dly = 1;
-                       /* fallthrough */
+               fallthrough;
        case MMC_TIMING_UHS_SDR50:
                if (smpl_phase >= ENABLE_SHIFT_MIN_SMPL &&
                                smpl_phase <= ENABLE_SHIFT_MAX_SMPL)
index 35ae573..0fba940 100644 (file)
@@ -2030,7 +2030,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
                        }
 
                        prev_state = state = STATE_SENDING_DATA;
-                       /* fall through */
+                       fallthrough;
 
                case STATE_SENDING_DATA:
                        /*
@@ -2088,7 +2088,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
                        }
                        prev_state = state = STATE_DATA_BUSY;
 
-                       /* fall through */
+                       fallthrough;
 
                case STATE_DATA_BUSY:
                        if (!dw_mci_clear_pending_data_complete(host)) {
@@ -2141,7 +2141,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
                         */
                        prev_state = state = STATE_SENDING_STOP;
 
-                       /* fall through */
+                       fallthrough;
 
                case STATE_SENDING_STOP:
                        if (!dw_mci_clear_pending_cmd_complete(host))
index 447552a..81d7101 100644 (file)
@@ -739,7 +739,7 @@ static irqreturn_t jz_mmc_irq_worker(int irq, void *devid)
                        break;
 
                jz_mmc_prepare_data_transfer(host);
-               /* fall through */
+               fallthrough;
 
        case JZ4740_MMC_STATE_TRANSFER_DATA:
                if (host->use_dma) {
@@ -774,7 +774,7 @@ static irqreturn_t jz_mmc_irq_worker(int irq, void *devid)
                        break;
                }
                jz4740_mmc_write_irq_reg(host, JZ_MMC_IRQ_DATA_TRAN_DONE);
-               /* fall through */
+               fallthrough;
 
        case JZ4740_MMC_STATE_SEND_STOP:
                if (!req->stop)
index 9b2cf7a..703d583 100644 (file)
@@ -294,7 +294,7 @@ static void meson_mx_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        switch (ios->power_mode) {
        case MMC_POWER_OFF:
                vdd = 0;
-               /* fall through */
+               fallthrough;
        case MMC_POWER_UP:
                if (!IS_ERR(mmc->supply.vmmc)) {
                        host->error = mmc_regulator_set_ocr(mmc,
index 15e2189..904f523 100644 (file)
@@ -685,7 +685,7 @@ static int renesas_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
        case HOST_MODE:
                if (host->pdata->flags & TMIO_MMC_HAVE_CBSY)
                        bit = TMIO_STAT_CMD_BUSY;
-               /* fallthrough */
+               fallthrough;
        case CTL_SD_CARD_CLK_CTL:
                return renesas_sdhi_wait_idle(host, bit);
        }
index 444b276..52d1f5e 100644 (file)
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/mmc/slot-gpio.h>
-
-#include <plat/gpio-cfg.h>
-#include <mach/dma.h>
-#include <mach/gpio-samsung.h>
-
 #include <linux/platform_data/mmc-s3cmci.h>
 
 #include "s3cmci.h"
@@ -307,7 +302,8 @@ static inline void clear_imask(struct s3cmci_host *host)
 static void s3cmci_check_sdio_irq(struct s3cmci_host *host)
 {
        if (host->sdio_irqen) {
-               if (gpio_get_value(S3C2410_GPE(8)) == 0) {
+               if (host->pdata->bus[3] &&
+                   gpiod_get_value(host->pdata->bus[3]) == 0) {
                        pr_debug("%s: signalling irq\n", __func__);
                        mmc_signal_sdio_irq(host->mmc);
                }
@@ -1206,33 +1202,20 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        switch (ios->power_mode) {
        case MMC_POWER_ON:
        case MMC_POWER_UP:
-               /* Configure GPE5...GPE10 pins in SD mode */
-               if (!host->pdev->dev.of_node)
-                       s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2),
-                                             S3C_GPIO_PULL_NONE);
-
-               if (host->pdata->set_power)
-                       host->pdata->set_power(ios->power_mode, ios->vdd);
-
                if (!host->is2440)
                        mci_con |= S3C2410_SDICON_FIFORESET;
-
                break;
 
        case MMC_POWER_OFF:
        default:
-               if (!host->pdev->dev.of_node)
-                       gpio_direction_output(S3C2410_GPE(5), 0);
-
                if (host->is2440)
                        mci_con |= S3C2440_SDICON_SDRESET;
-
-               if (host->pdata->set_power)
-                       host->pdata->set_power(ios->power_mode, ios->vdd);
-
                break;
        }
 
+       if (host->pdata->set_power)
+               host->pdata->set_power(ios->power_mode, ios->vdd);
+
        s3cmci_set_clk(host, ios);
 
        /* Set CLOCK_ENABLE */
@@ -1310,13 +1293,6 @@ static const struct mmc_host_ops s3cmci_ops = {
        .enable_sdio_irq = s3cmci_enable_sdio_irq,
 };
 
-static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
-       /* This is currently here to avoid a number of if (host->pdata)
-        * checks. Any zero fields to ensure reasonable defaults are picked. */
-        .no_wprotect = 1,
-        .no_detect = 1,
-};
-
 #ifdef CONFIG_ARM_S3C24XX_CPUFREQ
 
 static int s3cmci_cpufreq_transition(struct notifier_block *nb,
@@ -1470,24 +1446,21 @@ static int s3cmci_probe_pdata(struct s3cmci_host *host)
        int i, ret;
 
        host->is2440 = platform_get_device_id(pdev)->driver_data;
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_err(&pdev->dev, "need platform data");
+               return -ENXIO;
+       }
 
-       for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) {
-               ret = gpio_request(i, dev_name(&pdev->dev));
-               if (ret) {
+       for (i = 0; i < 6; i++) {
+               pdata->bus[i] = devm_gpiod_get_index(&pdev->dev, "bus", i,
+                                                    GPIOD_OUT_LOW);
+               if (IS_ERR(pdata->bus[i])) {
                        dev_err(&pdev->dev, "failed to get gpio %d\n", i);
-
-                       for (i--; i >= S3C2410_GPE(5); i--)
-                               gpio_free(i);
-
-                       return ret;
+                       return PTR_ERR(pdata->bus[i]);
                }
        }
 
-       if (!pdev->dev.platform_data)
-               pdev->dev.platform_data = &s3cmci_def_pdata;
-
-       pdata = pdev->dev.platform_data;
-
        if (pdata->no_wprotect)
                mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 
@@ -1542,7 +1515,6 @@ static int s3cmci_probe(struct platform_device *pdev)
        struct s3cmci_host *host;
        struct mmc_host *mmc;
        int ret;
-       int i;
 
        mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev);
        if (!mmc) {
@@ -1586,7 +1558,7 @@ static int s3cmci_probe(struct platform_device *pdev)
                        "failed to get io memory region resource.\n");
 
                ret = -ENOENT;
-               goto probe_free_gpio;
+               goto probe_free_host;
        }
 
        host->mem = request_mem_region(host->mem->start,
@@ -1595,7 +1567,7 @@ static int s3cmci_probe(struct platform_device *pdev)
        if (!host->mem) {
                dev_err(&pdev->dev, "failed to request io memory region.\n");
                ret = -ENOENT;
-               goto probe_free_gpio;
+               goto probe_free_host;
        }
 
        host->base = ioremap(host->mem->start, resource_size(host->mem));
@@ -1719,11 +1691,6 @@ static int s3cmci_probe(struct platform_device *pdev)
  probe_free_mem_region:
        release_mem_region(host->mem->start, resource_size(host->mem));
 
- probe_free_gpio:
-       if (!pdev->dev.of_node)
-               for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++)
-                       gpio_free(i);
-
  probe_free_host:
        mmc_free_host(mmc);
 
@@ -1749,7 +1716,6 @@ static int s3cmci_remove(struct platform_device *pdev)
 {
        struct mmc_host         *mmc  = platform_get_drvdata(pdev);
        struct s3cmci_host      *host = mmc_priv(mmc);
-       int i;
 
        s3cmci_shutdown(pdev);
 
@@ -1762,10 +1728,6 @@ static int s3cmci_remove(struct platform_device *pdev)
 
        free_irq(host->irq, host);
 
-       if (!pdev->dev.of_node)
-               for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++)
-                       gpio_free(i);
-
        iounmap(host->base);
        release_mem_region(host->mem->start, resource_size(host->mem));
 
index a76b451..d738907 100644 (file)
@@ -1556,7 +1556,7 @@ static int sdhci_esdhc_imx_probe_nondt(struct platform_device *pdev,
                                "failed to request card-detect gpio!\n");
                        return err;
                }
-               /* fall through */
+               fallthrough;
 
        case ESDHC_CD_CONTROLLER:
                /* we have a working card_detect back */
index 9194bb7..080ced1 100644 (file)
@@ -609,7 +609,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
        switch (pdata->max_width) {
        case 8:
                host->mmc->caps |= MMC_CAP_8_BIT_DATA;
-               /* Fall through */
+               fallthrough;
        case 4:
                host->mmc->caps |= MMC_CAP_4_BIT_DATA;
                break;
index a910cb4..bafa2e4 100644 (file)
@@ -470,7 +470,7 @@ static int sdhci_sprd_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
                break;
 
        default:
-               /* fall-through */
+               fallthrough;
        case MMC_SIGNAL_VOLTAGE_330:
                ret = pinctrl_select_state(sprd_host->pinctrl,
                                           sprd_host->pins_default);
index e6e9e28..03ce57e 100644 (file)
@@ -527,7 +527,7 @@ static bool xenon_emmc_phy_slow_mode(struct sdhci_host *host,
                        ret = true;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                reg &= ~XENON_TIMING_ADJUST_SLOW_MODE;
                ret = false;
index 3ad394b..592a55a 100644 (file)
@@ -2825,7 +2825,7 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
        case MMC_TIMING_UHS_SDR50:
                if (host->flags & SDHCI_SDR50_NEEDS_TUNING)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
 
        default:
                goto out;
index 5987656..fd8b72d 100644 (file)
@@ -335,7 +335,7 @@ static unsigned int tifm_sd_op_flags(struct mmc_command *cmd)
                break;
        case MMC_RSP_R1B:
                rc |= TIFM_MMCSD_RSP_BUSY;
-               /* fall-through */
+               fallthrough;
        case MMC_RSP_R1:
                rc |= TIFM_MMCSD_RSP_R1;
                break;
index 369b8de..7666c90 100644 (file)
@@ -1343,7 +1343,7 @@ static int usdhi6_stop_cmd(struct usdhi6_host *host)
                        host->wait = USDHI6_WAIT_FOR_STOP;
                        return 0;
                }
-               /* fall through - Unsupported STOP command. */
+               fallthrough;    /* Unsupported STOP command */
        default:
                dev_err(mmc_dev(host->mmc),
                        "unsupported stop CMD%d for CMD%d\n",
@@ -1691,7 +1691,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
        switch (host->wait) {
        default:
                dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
-               /* fall through - mrq can be NULL, but is impossible. */
+               fallthrough;    /* mrq can be NULL, but is impossible */
        case USDHI6_WAIT_FOR_CMD:
                usdhi6_error_code(host);
                if (mrq)
@@ -1713,7 +1713,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
                        host->offset, data->blocks, data->blksz, data->sg_len,
                        sg_dma_len(sg), sg->offset);
                usdhi6_sg_unmap(host, true);
-               /* fall through - page unmapped in USDHI6_WAIT_FOR_DATA_END. */
+               fallthrough;    /* page unmapped in USDHI6_WAIT_FOR_DATA_END */
        case USDHI6_WAIT_FOR_DATA_END:
                usdhi6_error_code(host);
                data->error = -ETIMEDOUT;
index 12466b0..22ed051 100644 (file)
@@ -93,7 +93,7 @@ static int adgs1408_probe(struct spi_device *spi)
                        mux->idle_state = idle_state;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                dev_err(dev, "invalid idle-state %d\n", idle_state);
                return -EINVAL;
index 18428e1..1c6c27f 100644 (file)
@@ -301,7 +301,7 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
                        dev->irq = cops_irq(ioaddr, board);
                        if (dev->irq)
                                break;
-                       /* fall through - Once no IRQ found on this port. */
+                       fallthrough;    /* Once no IRQ found on this port */
                case 1:
                        retval = -EINVAL;
                        goto err_out;
index 14a5fb3..98df38f 100644 (file)
@@ -363,13 +363,13 @@ static int __init arcrimi_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_err("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 3:         /* Node ID */
                node = ints[3];
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index cd27fdc..f983c4c 100644 (file)
@@ -197,22 +197,22 @@ static int __init com20020isa_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_info("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 6:         /* Timeout */
                timeout = ints[6];
-               /* Fall through */
+               fallthrough;
        case 5:         /* CKP value */
                clockp = ints[5];
-               /* Fall through */
+               fallthrough;
        case 4:         /* Backplane flag */
                backplane = ints[4];
-               /* Fall through */
+               fallthrough;
        case 3:         /* Node ID */
                node = ints[3];
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index 186bbf8..cf214b7 100644 (file)
@@ -363,10 +363,10 @@ static int __init com90io_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_err("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index bd75d06..3dc3d53 100644 (file)
@@ -693,13 +693,13 @@ static int __init com90xx_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_err("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 3:         /* Mem address */
                shmem = ints[3];
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index 31e43a2..aa001b1 100644 (file)
@@ -130,7 +130,7 @@ static inline struct bonding *__get_bond_by_port(struct port *port)
 
 /**
  * __get_first_agg - get the first aggregator in the bond
- * @bond: the bond we're looking at
+ * @port: the port we're looking at
  *
  * Return the aggregator of the first slave in @bond, or %NULL if it can't be
  * found.
@@ -1149,7 +1149,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
                        port->actor_oper_port_state &= ~LACP_STATE_EXPIRED;
                        port->sm_rx_state = AD_RX_PORT_DISABLED;
 
-                       /* Fall Through */
+                       fallthrough;
                case AD_RX_PORT_DISABLED:
                        port->sm_vars &= ~AD_PORT_MATCHED;
                        break;
@@ -1588,7 +1588,7 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
                if (__agg_active_ports(curr) < __agg_active_ports(best))
                        return best;
 
-               /*FALLTHROUGH*/
+               fallthrough;
        case BOND_AD_STABLE:
        case BOND_AD_BANDWIDTH:
                if (__get_agg_bandwidth(curr) > __get_agg_bandwidth(best))
@@ -1626,7 +1626,7 @@ static int agg_device_up(const struct aggregator *agg)
 
 /**
  * ad_agg_selection_logic - select an aggregation group for a team
- * @aggregator: the aggregator we're looking at
+ * @agg: the aggregator we're looking at
  * @update_slave_arr: Does slave array need update?
  *
  * It is assumed that only one aggregator may be selected for a team.
@@ -1810,7 +1810,7 @@ static void ad_initialize_agg(struct aggregator *aggregator)
 
 /**
  * ad_initialize_port - initialize a given port's parameters
- * @aggregator: the aggregator we're looking at
+ * @port: the port we're looking at
  * @lacp_fast: boolean. whether fast periodic should be used
  */
 static void ad_initialize_port(struct port *port, int lacp_fast)
@@ -1967,6 +1967,7 @@ static void ad_marker_response_received(struct bond_marker *marker,
 /**
  * bond_3ad_initiate_agg_selection - initate aggregator selection
  * @bond: bonding struct
+ * @timeout: timeout value to set
  *
  * Set the aggregation selection timer, to initiate an agg selection in
  * the very near future.  Called during first initialization, and during
@@ -2259,7 +2260,7 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond)
 
 /**
  * bond_3ad_state_machine_handler - handle state machines timeout
- * @bond: bonding struct to work on
+ * @work: work context to fetch bonding struct to work on from
  *
  * The state machine handling concept in this module is to check every tick
  * which state machine should operate any function. The execution order is
@@ -2500,7 +2501,7 @@ void bond_3ad_adapter_speed_duplex_changed(struct slave *slave)
 /**
  * bond_3ad_handle_link_change - handle a slave's link status change indication
  * @slave: slave struct to work on
- * @status: whether the link is now up or down
+ * @link: whether the link is now up or down
  *
  * Handle reselection of aggregator (if needed) for this port.
  */
@@ -2551,7 +2552,7 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)
 
 /**
  * bond_3ad_set_carrier - set link state for bonding master
- * @bond - bonding structure
+ * @bond: bonding structure
  *
  * if we have an active aggregator, we're up, if not, we're down.
  * Presumes that we cannot have an active aggregator if there are
@@ -2664,7 +2665,7 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
 
 /**
  * bond_3ad_update_lacp_rate - change the lacp rate
- * @bond - bonding struct
+ * @bond: bonding struct
  *
  * When modify lacp_rate parameter via sysfs,
  * update actor_oper_port_state of each port.
index 095ea51..4e1b7de 100644 (file)
@@ -1206,8 +1206,8 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
 
 /**
  * alb_set_mac_address
- * @bond:
- * @addr:
+ * @bond: bonding we're working on
+ * @addr: MAC address to set
  *
  * In TLB mode all slaves are configured to the bond's hw address, but set
  * their dev_addr field to different addresses (based on their permanent hw
index 5ad43aa..42ef25e 100644 (file)
@@ -322,6 +322,7 @@ netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
 /**
  * bond_vlan_rx_add_vid - Propagates adding an id to slaves
  * @bond_dev: bonding net device that got called
+ * @proto: network protocol ID
  * @vid: vlan id being added
  */
 static int bond_vlan_rx_add_vid(struct net_device *bond_dev,
@@ -355,6 +356,7 @@ unwind:
 /**
  * bond_vlan_rx_kill_vid - Propagates deleting an id to slaves
  * @bond_dev: bonding net device that got called
+ * @proto: network protocol ID
  * @vid: vlan id being removed
  */
 static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
@@ -948,7 +950,7 @@ static bool bond_should_notify_peers(struct bonding *bond)
 /**
  * change_active_interface - change the active slave into the specified one
  * @bond: our bonding struct
- * @new: the new slave to make the active one
+ * @new_active: the new slave to make the active one
  *
  * Set the new slave to the bond's settings and unset them on the old
  * curr_active_slave.
@@ -2205,7 +2207,8 @@ static int bond_release_and_destroy(struct net_device *bond_dev,
        int ret;
 
        ret = __bond_release_one(bond_dev, slave_dev, false, true);
-       if (ret == 0 && !bond_has_slaves(bond)) {
+       if (ret == 0 && !bond_has_slaves(bond) &&
+           bond_dev->reg_state != NETREG_UNREGISTERING) {
                bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
                netdev_info(bond_dev, "Destroying bond\n");
                bond_remove_proc_entry(bond);
@@ -2271,7 +2274,7 @@ static int bond_miimon_inspect(struct bonding *bond)
                                             "active " : "backup ") : "",
                                           bond->params.downdelay * bond->params.miimon);
                        }
-                       /*FALLTHRU*/
+                       fallthrough;
                case BOND_LINK_FAIL:
                        if (link_state) {
                                /* recovered before downdelay expired */
@@ -2307,7 +2310,7 @@ static int bond_miimon_inspect(struct bonding *bond)
                                           bond->params.updelay *
                                           bond->params.miimon);
                        }
-                       /*FALLTHRU*/
+                       fallthrough;
                case BOND_LINK_BACK:
                        if (!link_state) {
                                bond_propose_link_state(slave, BOND_LINK_DOWN);
@@ -2945,6 +2948,9 @@ static int bond_ab_arp_inspect(struct bonding *bond)
                        if (bond_time_in_interval(bond, last_rx, 1)) {
                                bond_propose_link_state(slave, BOND_LINK_UP);
                                commit++;
+                       } else if (slave->link == BOND_LINK_BACK) {
+                               bond_propose_link_state(slave, BOND_LINK_FAIL);
+                               commit++;
                        }
                        continue;
                }
@@ -3053,6 +3059,19 @@ static void bond_ab_arp_commit(struct bonding *bond)
 
                        continue;
 
+               case BOND_LINK_FAIL:
+                       bond_set_slave_link_state(slave, BOND_LINK_FAIL,
+                                                 BOND_SLAVE_NOTIFY_NOW);
+                       bond_set_slave_inactive_flags(slave,
+                                                     BOND_SLAVE_NOTIFY_NOW);
+
+                       /* A slave has just been enslaved and has become
+                        * the current active slave.
+                        */
+                       if (rtnl_dereference(bond->curr_active_slave))
+                               RCU_INIT_POINTER(bond->current_arp_slave, NULL);
+                       continue;
+
                default:
                        slave_err(bond->dev, slave->dev,
                                  "impossible: link_new_state %d on slave\n",
@@ -3103,8 +3122,6 @@ static bool bond_ab_arp_probe(struct bonding *bond)
                        return should_notify_rtnl;
        }
 
-       bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER);
-
        bond_for_each_slave_rcu(bond, slave, iter) {
                if (!found && !before && bond_slave_is_up(slave))
                        before = slave;
@@ -3305,7 +3322,7 @@ static int bond_slave_netdev_event(unsigned long event,
 
                if (BOND_MODE(bond) == BOND_MODE_8023AD)
                        bond_3ad_adapter_speed_duplex_changed(slave);
-               /* Fallthrough */
+               fallthrough;
        case NETDEV_DOWN:
                /* Refresh slave-array if applicable!
                 * If the setup does not use miimon or arpmon (mode-specific!),
@@ -3743,7 +3760,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
                        return -EINVAL;
 
                mii->phy_id = 0;
-               /* Fall Through */
+               fallthrough;
        case SIOCGMIIREG:
                /* We do this again just in case we were called by SIOCGMIIREG
                 * instead of SIOCGMIIPHY.
@@ -4552,13 +4569,23 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
        return ret;
 }
 
+static u32 bond_mode_bcast_speed(struct slave *slave, u32 speed)
+{
+       if (speed == 0 || speed == SPEED_UNKNOWN)
+               speed = slave->speed;
+       else
+               speed = min(speed, slave->speed);
+
+       return speed;
+}
+
 static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
                                           struct ethtool_link_ksettings *cmd)
 {
        struct bonding *bond = netdev_priv(bond_dev);
-       unsigned long speed = 0;
        struct list_head *iter;
        struct slave *slave;
+       u32 speed = 0;
 
        cmd->base.duplex = DUPLEX_UNKNOWN;
        cmd->base.port = PORT_OTHER;
@@ -4570,8 +4597,13 @@ static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
         */
        bond_for_each_slave(bond, slave, iter) {
                if (bond_slave_can_tx(slave)) {
-                       if (slave->speed != SPEED_UNKNOWN)
-                               speed += slave->speed;
+                       if (slave->speed != SPEED_UNKNOWN) {
+                               if (BOND_MODE(bond) == BOND_MODE_BROADCAST)
+                                       speed = bond_mode_bcast_speed(slave,
+                                                                     speed);
+                               else
+                                       speed += slave->speed;
+                       }
                        if (cmd->base.duplex == DUPLEX_UNKNOWN &&
                            slave->duplex != DUPLEX_UNKNOWN)
                                cmd->base.duplex = slave->duplex;
index 9df2007..38e9f80 100644 (file)
@@ -898,7 +898,7 @@ static void at91_irq_err_state(struct net_device *dev,
                                CAN_ERR_CRTL_TX_WARNING :
                                CAN_ERR_CRTL_RX_WARNING;
                }
-               /* fall through */
+               fallthrough;
        case CAN_STATE_ERROR_WARNING:
                /*
                 * from: ERROR_ACTIVE, ERROR_WARNING
@@ -948,7 +948,7 @@ static void at91_irq_err_state(struct net_device *dev,
                netdev_dbg(dev, "Error Active\n");
                cf->can_id |= CAN_ERR_PROT;
                cf->data[2] = CAN_ERR_PROT_ACTIVE;
-               /* fall through */
+               fallthrough;
        case CAN_STATE_ERROR_WARNING:
                reg_idr = AT91_IRQ_ERRA | AT91_IRQ_WARN | AT91_IRQ_BOFF;
                reg_ier = AT91_IRQ_ERRP;
index 6ad83a8..9469d44 100644 (file)
@@ -659,7 +659,7 @@ static int pciefd_can_probe(struct pciefd_board *pciefd)
                pciefd_can_writereg(priv, CANFD_CLK_SEL_80MHZ,
                                    PCIEFD_REG_CAN_CLK_SEL);
 
-               /* fall through */
+               fallthrough;
        case CANFD_CLK_SEL_80MHZ:
                priv->ucan.can.clock.freq = 80 * 1000 * 1000;
                break;
index d7222ba..d7c2ec5 100644 (file)
@@ -150,7 +150,7 @@ static void sp_populate_of(struct sja1000_priv *priv, struct device_node *of)
                priv->read_reg = sp_read_reg16;
                priv->write_reg = sp_write_reg16;
                break;
-       case 1: /* fallthrough */
+       case 1:
        default:
                priv->read_reg = sp_read_reg8;
                priv->write_reg = sp_write_reg8;
index 91cdc0a..b4a39f0 100644 (file)
@@ -153,7 +153,7 @@ static void slc_bump(struct slcan *sl)
        switch (*cmd) {
        case 'r':
                cf.can_id = CAN_RTR_FLAG;
-               /* fallthrough */
+               fallthrough;
        case 't':
                /* store dlc ASCII value and terminate SFF CAN ID string */
                cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN];
@@ -163,7 +163,7 @@ static void slc_bump(struct slcan *sl)
                break;
        case 'R':
                cf.can_id = CAN_RTR_FLAG;
-               /* fallthrough */
+               fallthrough;
        case 'T':
                cf.can_id |= CAN_EFF_FLAG;
                /* store dlc ASCII value and terminate EFF CAN ID string */
index 5009ff2..d176088 100644 (file)
@@ -864,7 +864,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
                        if (new_state >= CAN_STATE_ERROR_WARNING &&
                            new_state <= CAN_STATE_BUS_OFF)
                                priv->can.can_stats.error_warning++;
-                       /* fall through */
+                       fallthrough;
                case CAN_STATE_ERROR_WARNING:
                        if (new_state >= CAN_STATE_ERROR_PASSIVE &&
                            new_state <= CAN_STATE_BUS_OFF)
index d2539c9..66d0198 100644 (file)
@@ -415,7 +415,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
                        new_state = CAN_STATE_ERROR_WARNING;
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case CAN_STATE_ERROR_WARNING:
                if (n & PCAN_USB_ERROR_BUS_HEAVY) {
index 0b7766b..d91df34 100644 (file)
@@ -345,7 +345,7 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb,
                default:
                        netdev_warn(netdev, "tx urb submitting failed err=%d\n",
                                    err);
-                       /* fall through */
+                       fallthrough;
                case -ENOENT:
                        /* cable unplugged */
                        stats->tx_dropped++;
index 53cb2f7..1689ab3 100644 (file)
@@ -133,10 +133,10 @@ static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...)
        switch (id) {
        case PCAN_USBPRO_TXMSG8:
                i += 4;
-               /* fall through */
+               fallthrough;
        case PCAN_USBPRO_TXMSG4:
                i += 4;
-               /* fall through */
+               fallthrough;
        case PCAN_USBPRO_TXMSG0:
                *pc++ = va_arg(ap, int);
                *pc++ = va_arg(ap, int);
index 6500179..e731db9 100644 (file)
@@ -1061,7 +1061,7 @@ static void b53_force_port_config(struct b53_device *dev, int port,
        switch (speed) {
        case 2000:
                reg |= PORT_OVERRIDE_SPEED_2000M;
-               /* fallthrough */
+               fallthrough;
        case SPEED_1000:
                reg |= PORT_OVERRIDE_SPEED_1000M;
                break;
@@ -1554,6 +1554,8 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
                return ret;
 
        switch (ret) {
+       case -ETIMEDOUT:
+               return ret;
        case -ENOSPC:
                dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n",
                        addr, vid);
index 629bf14..5ae3d97 100644 (file)
@@ -170,7 +170,7 @@ void b53_serdes_phylink_validate(struct b53_device *dev, int port,
        switch (lane) {
        case 0:
                phylink_set(supported, 2500baseX_Full);
-               /* fallthrough */
+               fallthrough;
        case 1:
                phylink_set(supported, 1000baseX_Full);
                break;
index bafddb3..5ebff98 100644 (file)
@@ -566,7 +566,7 @@ static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,
        switch (state->interface) {
        case PHY_INTERFACE_MODE_RGMII:
                id_mode_dis = 1;
-               /* fallthrough */
+               fallthrough;
        case PHY_INTERFACE_MODE_RGMII_TXID:
                port_mode = EXT_GPHY;
                break;
index dc99940..3cb22d1 100644 (file)
@@ -1083,7 +1083,7 @@ static phy_interface_t ksz9477_get_interface(struct ksz_device *dev, int port)
                interface = PHY_INTERFACE_MODE_GMII;
                if (gbit)
                        break;
-               /* fall through */
+               fallthrough;
        case 0:
                interface = PHY_INTERFACE_MODE_MII;
                break;
index 8dcb8a4..0c37ddb 100644 (file)
@@ -566,7 +566,7 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
        case P5_INTF_SEL_PHY_P0:
                /* MT7530_P5_MODE_GPHY_P0: 2nd GMAC -> P5 -> P0 */
                val |= MHWTRAP_PHY0_SEL;
-               /* fall through */
+               fallthrough;
        case P5_INTF_SEL_PHY_P4:
                /* MT7530_P5_MODE_GPHY_P4: 2nd GMAC -> P5 -> P4 */
                val &= ~MHWTRAP_P5_MAC_SEL & ~MHWTRAP_P5_DIS;
index 7a71c99..f0dbc05 100644 (file)
@@ -875,7 +875,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip,
                break;
        case STATS_TYPE_BANK1:
                reg = bank1_select;
-               /* fall through */
+               fallthrough;
        case STATS_TYPE_BANK0:
                reg |= s->reg | histogram;
                mv88e6xxx_g1_stats_read(chip, reg, &low);
index f121619..2d23cce 100644 (file)
@@ -9,7 +9,7 @@ config NET_DSA_MSCC_FELIX
        select NET_DSA_TAG_OCELOT
        select FSL_ENETC_MDIO
        help
-         This driver supports network switches from the the Vitesse /
+         This driver supports network switches from the Vitesse /
          Microsemi / Microchip Ocelot family of switching cores that are
          connected to their host CPU via Ethernet.
          The following switches are supported:
index 139d012..667f38c 100644 (file)
@@ -1259,14 +1259,14 @@ el3_up(struct net_device *dev)
                                        pr_cont("Forcing 3c5x9b full-duplex mode");
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case 8:
                                /* set full-duplex mode based on eeprom config setting */
                                if ((sw_info & 0x000f) && (sw_info & 0x8000)) {
                                        pr_cont("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* xcvr=(0 || 4) OR user has an old 3c5x9 non "B" model */
                                pr_cont("Setting 3c5x9/3c5x9B half-duplex mode");
index ef1c315..f66e7fb 100644 (file)
@@ -951,7 +951,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
 static void update_stats(struct net_device *dev)
 {
        unsigned int ioaddr = dev->base_addr;
-       u8 rx, tx, up;
+       u8 up;
 
        pr_debug("%s: updating the statistics.\n", dev->name);
 
@@ -972,8 +972,8 @@ static void update_stats(struct net_device *dev)
        dev->stats.tx_packets                   += (up&0x30) << 4;
        /* Rx packets   */                         inb(ioaddr + 7);
        /* Tx deferrals */                         inb(ioaddr + 8);
-       rx                                       = inw(ioaddr + 10);
-       tx                                       = inw(ioaddr + 12);
+       /* rx */                                   inw(ioaddr + 10);
+       /* tx */                                   inw(ioaddr + 12);
 
        EL3WINDOW(4);
        /* BadSSD */                               inb(ioaddr + 12);
@@ -1046,7 +1046,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get the address of the PHY in use. */
                data->phy_id = phy;
-               /* fall through */
+               fallthrough;
        case SIOCGMIIREG:               /* Read the specified MII register. */
                {
                        int saved_window;
index aeae796..a00b36f 100644 (file)
@@ -610,7 +610,7 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
     switch (cmd) {
     case SIOCGMIIPHY:
        data->phy_id = info->phy_id;
-       /* Fall through */
+       fallthrough;
     case SIOCGMIIREG:          /* Read MII PHY register. */
        data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
        return 0;
@@ -898,6 +898,7 @@ static int ax_close(struct net_device *dev)
 /**
  * axnet_tx_timeout - handle transmit time out condition
  * @dev: network device which has apparently fallen asleep
+ * @txqueue: unused
  *
  * Called by kernel when device never acknowledges a transmit has
  * completed (or failed) - i.e. never posted a Tx related interrupt.
index 645efac..164c3ed 100644 (file)
@@ -1108,7 +1108,7 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
     switch (cmd) {
     case SIOCGMIIPHY:
        data->phy_id = info->phy_id;
-       /* fall through */
+       fallthrough;
     case SIOCGMIIREG:          /* Read MII PHY register. */
        data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
        return 0;
index 6234fcd..696517e 100644 (file)
@@ -1712,13 +1712,13 @@ static bool slic_is_fiber(unsigned short subdev)
 {
        switch (subdev) {
        /* Mojave */
-       case PCI_SUBDEVICE_ID_ALACRITECH_1000X1F: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SES1001F: /* fallthrough */
+       case PCI_SUBDEVICE_ID_ALACRITECH_1000X1F:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SES1001F: fallthrough;
        /* Oasis */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2002XF: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2001XF: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2104EF: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2102EF: /* fallthrough */
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2002XF:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2001XF:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2104EF:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2102EF:
                return true;
        }
        return false;
index ac86fca..8470c83 100644 (file)
@@ -547,7 +547,7 @@ static int acenic_probe_one(struct pci_dev *pdev,
                               ap->name);
                        break;
                }
-               /* Fall through */
+               fallthrough;
        case PCI_VENDOR_ID_SGI:
                printk(KERN_INFO "%s: SGI AceNIC ", ap->name);
                break;
index 2a6c972..a3a8edf 100644 (file)
@@ -2180,13 +2180,10 @@ static void ena_del_napi_in_range(struct ena_adapter *adapter,
        int i;
 
        for (i = first_index; i < first_index + count; i++) {
-               /* Check if napi was initialized before */
-               if (!ENA_IS_XDP_INDEX(adapter, i) ||
-                   adapter->ena_napi[i].xdp_ring)
-                       netif_napi_del(&adapter->ena_napi[i].napi);
-               else
-                       WARN_ON(ENA_IS_XDP_INDEX(adapter, i) &&
-                               adapter->ena_napi[i].xdp_ring);
+               netif_napi_del(&adapter->ena_napi[i].napi);
+
+               WARN_ON(!ENA_IS_XDP_INDEX(adapter, i) &&
+                       adapter->ena_napi[i].xdp_ring);
        }
 }
 
@@ -3601,16 +3598,14 @@ static void ena_fw_reset_device(struct work_struct *work)
 {
        struct ena_adapter *adapter =
                container_of(work, struct ena_adapter, reset_task);
-       struct pci_dev *pdev = adapter->pdev;
 
-       if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
-               dev_err(&pdev->dev,
-                       "device reset schedule while reset bit is off\n");
-               return;
-       }
        rtnl_lock();
-       ena_destroy_device(adapter, false);
-       ena_restore_device(adapter);
+
+       if (likely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
+               ena_destroy_device(adapter, false);
+               ena_restore_device(adapter);
+       }
+
        rtnl_unlock();
 }
 
@@ -3692,7 +3687,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
        }
 
        u64_stats_update_begin(&tx_ring->syncp);
-       tx_ring->tx_stats.missed_tx = missed_tx;
+       tx_ring->tx_stats.missed_tx += missed_tx;
        u64_stats_update_end(&tx_ring->syncp);
 
        return rc;
@@ -4389,8 +4384,11 @@ static void __ena_shutoff(struct pci_dev *pdev, bool shutdown)
                netdev->rx_cpu_rmap = NULL;
        }
 #endif /* CONFIG_RFS_ACCEL */
-       del_timer_sync(&adapter->timer_service);
 
+       /* Make sure timer and reset routine won't be called after
+        * freeing device resources.
+        */
+       del_timer_sync(&adapter->timer_service);
        cancel_work_sync(&adapter->reset_task);
 
        rtnl_lock(); /* lock released inside the below if-else block */
@@ -4558,6 +4556,9 @@ static void ena_keep_alive_wd(void *adapter_data,
        tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low;
 
        u64_stats_update_begin(&adapter->syncp);
+       /* These stats are accumulated by the device, so the counters indicate
+        * all drops since last reset.
+        */
        adapter->dev_stats.rx_drops = rx_drops;
        adapter->dev_stats.tx_drops = tx_drops;
        u64_stats_update_end(&adapter->syncp);
index b6c43b5..960d483 100644 (file)
@@ -1475,7 +1475,7 @@ static int amd8111e_ioctl(struct net_device *dev , struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = lp->ext_phy_addr;
 
-       /* fallthru */
+               fallthrough;
        case SIOCGMIIREG:
 
                spin_lock_irq(&lp->lock);
index 43294a1..4ba7555 100644 (file)
@@ -1538,7 +1538,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        /* PTP v2, UDP, any kind of event packet */
        case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
-               /* Fall through - to PTP v1, UDP, any kind of event packet */
+               fallthrough;    /* to PTP v1, UDP, any kind of event packet */
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
@@ -1549,7 +1549,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        /* PTP v2, UDP, Sync packet */
        case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
-               /* Fall through - to PTP v1, UDP, Sync packet */
+               fallthrough;    /* to PTP v1, UDP, Sync packet */
        case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
@@ -1560,7 +1560,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        /* PTP v2, UDP, Delay_req packet */
        case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
-               /* Fall through - to PTP v1, UDP, Delay_req packet */
+               fallthrough;    /* to PTP v1, UDP, Delay_req packet */
        case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
index 16a9447..8941ac4 100644 (file)
@@ -1631,8 +1631,8 @@ static int hw_atl_b0_get_mac_temp(struct aq_hw_s *self, u32 *temp)
                hw_atl_ts_reset_set(self, 0);
        }
 
-       err = readx_poll_timeout_atomic(hw_atl_b0_ts_ready_and_latch_high_get,
-                                       self, val, val == 1, 10000U, 500000U);
+       err = readx_poll_timeout(hw_atl_b0_ts_ready_and_latch_high_get, self,
+                                val, val == 1, 10000U, 500000U);
        if (err)
                return err;
 
index 34d1830..a5fd161 100644 (file)
@@ -217,7 +217,7 @@ static int bgmac_probe(struct bcma_device *core)
        /* BCM 471X/535X family */
        case BCMA_CHIP_ID_BCM4716:
                bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-               /* fallthrough */
+               fallthrough;
        case BCMA_CHIP_ID_BCM47162:
                bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
                bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
index 6795b6d..f37f1c5 100644 (file)
@@ -131,7 +131,7 @@ static void bgmac_nicpm_speed_set(struct net_device *net_dev)
        switch (bgmac->net_dev->phydev->speed) {
        default:
                netdev_err(net_dev, "Unsupported speed. Defaulting to 1000Mb\n");
-               /* fall through */
+               fallthrough;
        case SPEED_1000:
                val |= NICPM_IOMUX_CTRL_SPD_1000M << NICPM_IOMUX_CTRL_SPD_SHIFT;
                break;
index c8cc14e..3e8a179 100644 (file)
@@ -1337,13 +1337,13 @@ bnx2_set_mac_link(struct bnx2 *bp)
                                        val |= BNX2_EMAC_MODE_PORT_MII_10M;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case SPEED_100:
                                val |= BNX2_EMAC_MODE_PORT_MII;
                                break;
                        case SPEED_2500:
                                val |= BNX2_EMAC_MODE_25G_MODE;
-                               /* fall through */
+                               fallthrough;
                        case SPEED_1000:
                                val |= BNX2_EMAC_MODE_PORT_GMII;
                                break;
@@ -1995,26 +1995,26 @@ bnx2_remote_phy_event(struct bnx2 *bp)
                switch (speed) {
                        case BNX2_LINK_STATUS_10HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_10FULL:
                                bp->line_speed = SPEED_10;
                                break;
                        case BNX2_LINK_STATUS_100HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_100BASE_T4:
                        case BNX2_LINK_STATUS_100FULL:
                                bp->line_speed = SPEED_100;
                                break;
                        case BNX2_LINK_STATUS_1000HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_1000FULL:
                                bp->line_speed = SPEED_1000;
                                break;
                        case BNX2_LINK_STATUS_2500HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_2500FULL:
                                bp->line_speed = SPEED_2500;
                                break;
@@ -7856,7 +7856,7 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = bp->phy_addr;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u32 mii_regval;
 
index 1426c69..4e85e7d 100644 (file)
@@ -4712,14 +4712,14 @@ static void bnx2x_sync_link(struct link_params *params,
                        LINK_STATUS_SPEED_AND_DUPLEX_MASK) {
                case LINK_10THD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_10TFD:
                        vars->line_speed = SPEED_10;
                        break;
 
                case LINK_100TXHD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_100T4:
                case LINK_100TXFD:
                        vars->line_speed = SPEED_100;
@@ -4727,14 +4727,14 @@ static void bnx2x_sync_link(struct link_params *params,
 
                case LINK_1000THD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_1000TFD:
                        vars->line_speed = SPEED_1000;
                        break;
 
                case LINK_2500THD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_2500TFD:
                        vars->line_speed = SPEED_2500;
                        break;
@@ -6339,7 +6339,7 @@ int bnx2x_set_led(struct link_params *params,
                 */
                if (!vars->link_up)
                        break;
-               /* fall through */
+               fallthrough;
        case LED_MODE_ON:
                if (((params->phy[EXT_PHY1].type ==
                          PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) ||
@@ -12508,13 +12508,13 @@ static void bnx2x_phy_def_cfg(struct link_params *params,
        switch (link_config  & PORT_FEATURE_LINK_SPEED_MASK) {
        case PORT_FEATURE_LINK_SPEED_10M_HALF:
                phy->req_duplex = DUPLEX_HALF;
-               /* fall through */
+               fallthrough;
        case PORT_FEATURE_LINK_SPEED_10M_FULL:
                phy->req_line_speed = SPEED_10;
                break;
        case PORT_FEATURE_LINK_SPEED_100M_HALF:
                phy->req_duplex = DUPLEX_HALF;
-               /* fall through */
+               fallthrough;
        case PORT_FEATURE_LINK_SPEED_100M_FULL:
                phy->req_line_speed = SPEED_100;
                break;
index 7f24d26..3c543dd 100644 (file)
@@ -8600,11 +8600,11 @@ int bnx2x_set_int_mode(struct bnx2x *bp)
                               bp->num_queues,
                               1 + bp->num_cnic_queues);
 
-               /* fall through */
+               fallthrough;
        case BNX2X_INT_MODE_MSI:
                bnx2x_enable_msi(bp);
 
-               /* fall through */
+               fallthrough;
        case BNX2X_INT_MODE_INTX:
                bp->num_ethernet_queues = 1;
                bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues;
index 80d250a..e26f4da 100644 (file)
@@ -3258,7 +3258,7 @@ static int bnx2x_mcast_validate_e2(struct bnx2x *bp,
        /* DEL command deletes all currently configured MACs */
        case BNX2X_MCAST_CMD_DEL:
                o->set_registry_size(o, 0);
-               /* fall through */
+               fallthrough;
 
        /* RESTORE command will restore the entire multicast configuration */
        case BNX2X_MCAST_CMD_RESTORE:
@@ -3592,7 +3592,7 @@ static int bnx2x_mcast_validate_e1(struct bnx2x *bp,
        /* DEL command deletes all currently configured MACs */
        case BNX2X_MCAST_CMD_DEL:
                o->set_registry_size(o, 0);
-               /* fall through */
+               fallthrough;
 
        /* RESTORE command will restore the entire multicast configuration */
        case BNX2X_MCAST_CMD_RESTORE:
index b4476f4..9c2f51f 100644 (file)
@@ -1809,7 +1809,7 @@ get_vf:
                DP(BNX2X_MSG_IOV, "got VF [%d:%d] RSS update ramrod\n",
                   vf->abs_vfid, qidx);
                bnx2x_vf_handle_rss_update_eqe(bp, vf);
-               /* fall through */
+               fallthrough;
        case EVENT_RING_OPCODE_VF_FLR:
                /* Do nothing for now */
                return 0;
@@ -2207,7 +2207,7 @@ int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf)
                rc = bnx2x_vf_close(bp, vf);
                if (rc)
                        goto op_err;
-               /* Fall through - to release resources */
+               fallthrough;    /* to release resources */
        case VF_ACQUIRED:
                DP(BNX2X_MSG_IOV, "about to free resources\n");
                bnx2x_vf_free_resc(bp, vf);
index 31fb5a2..f92fd88 100644 (file)
@@ -1923,7 +1923,7 @@ u32 bnxt_fw_health_readl(struct bnxt *bp, int reg_idx)
                break;
        case BNXT_FW_HEALTH_REG_TYPE_GRC:
                reg_off = fw_health->mapped_regs[reg_idx];
-               /* fall through */
+               fallthrough;
        case BNXT_FW_HEALTH_REG_TYPE_BAR0:
                val = readl(bp->bar0 + reg_off);
                break;
@@ -1966,11 +1966,11 @@ static int bnxt_async_event_process(struct bnxt *bp,
                }
                set_bit(BNXT_LINK_SPEED_CHNG_SP_EVENT, &bp->sp_event);
        }
-       /* fall through */
+               fallthrough;
        case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
        case ASYNC_EVENT_CMPL_EVENT_ID_PORT_PHY_CFG_CHANGE:
                set_bit(BNXT_LINK_CFG_CHANGE_SP_EVENT, &bp->sp_event);
-               /* fall through */
+               fallthrough;
        case ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
                set_bit(BNXT_LINK_CHNG_SP_EVENT, &bp->sp_event);
                break;
@@ -9765,7 +9765,7 @@ static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                mdio->phy_id = bp->link_info.phy_addr;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u16 mii_regval = 0;
 
@@ -11022,7 +11022,7 @@ static void bnxt_fw_reset_writel(struct bnxt *bp, int reg_idx)
                writel(reg_off & BNXT_GRC_BASE_MASK,
                       bp->bar0 + BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
                reg_off = (reg_off & BNXT_GRC_OFFSET_MASK) + 0x2000;
-               /* fall through */
+               fallthrough;
        case BNXT_FW_HEALTH_REG_TYPE_BAR0:
                writel(val, bp->bar0 + reg_off);
                break;
@@ -11135,7 +11135,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                }
                bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW;
        }
-       /* fall through */
+               fallthrough;
        case BNXT_FW_RESET_STATE_RESET_FW:
                bnxt_reset_all(bp);
                bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
@@ -11158,7 +11158,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                }
                pci_set_master(bp->pdev);
                bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW;
-               /* fall through */
+               fallthrough;
        case BNXT_FW_RESET_STATE_POLL_FW:
                bp->hwrm_cmd_timeout = SHORT_HWRM_CMD_TIMEOUT;
                rc = __bnxt_hwrm_ver_get(bp, true);
@@ -11173,7 +11173,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                }
                bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
                bp->fw_reset_state = BNXT_FW_RESET_STATE_OPENING;
-               /* fall through */
+               fallthrough;
        case BNXT_FW_RESET_STATE_OPENING:
                while (!rtnl_trylock()) {
                        bnxt_queue_fw_reset_work(bp, HZ / 10);
index 64da654..17934cd 100644 (file)
@@ -1073,7 +1073,7 @@ static int bnxt_grxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
                if (bp->rss_hash_cfg & VNIC_RSS_CFG_REQ_HASH_TYPE_UDP_IPV4)
                        cmd->data |= RXH_IP_SRC | RXH_IP_DST |
                                     RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* fall through */
+               fallthrough;
        case SCTP_V4_FLOW:
        case AH_ESP_V4_FLOW:
        case AH_V4_FLOW:
@@ -1092,7 +1092,7 @@ static int bnxt_grxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
                if (bp->rss_hash_cfg & VNIC_RSS_CFG_REQ_HASH_TYPE_UDP_IPV6)
                        cmd->data |= RXH_IP_SRC | RXH_IP_DST |
                                     RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* fall through */
+               fallthrough;
        case SCTP_V6_FLOW:
        case AH_ESP_V6_FLOW:
        case AH_V6_FLOW:
index 2704a47..fcc2620 100644 (file)
@@ -201,10 +201,10 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* Fall thru */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(bp->dev, xdp_prog, act);
-               /* Fall thru */
+               fallthrough;
        case XDP_DROP:
                bnxt_reuse_rx_data(rxr, cons, page);
                break;
index c5cca63..8453629 100644 (file)
@@ -3311,7 +3311,7 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info)
        }
        case CNIC_CTL_FCOE_STATS_GET_CMD:
                ulp_type = CNIC_ULP_FCOE;
-               /* fall through */
+               fallthrough;
        case CNIC_CTL_ISCSI_STATS_GET_CMD:
                cnic_hold(dev);
                cnic_copy_ulp_stats(dev, ulp_type);
@@ -4044,7 +4044,7 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe)
                            l4kcqe->status, l5kcqe->completion_status);
                opcode = L4_KCQE_OPCODE_VALUE_CLOSE_COMP;
        }
-               /* Fall through */
+               fallthrough;
        case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
        case L4_KCQE_OPCODE_VALUE_CLOSE_COMP:
        case L4_KCQE_OPCODE_VALUE_RESET_COMP:
index 1fecc25..0ca8436 100644 (file)
@@ -1185,10 +1185,10 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv)
                        continue;
                case BCMGENET_STAT_RUNT:
                        offset += BCMGENET_STAT_OFFSET;
-                       /* fall through */
+                       fallthrough;
                case BCMGENET_STAT_MIB_TX:
                        offset += BCMGENET_STAT_OFFSET;
-                       /* fall through */
+                       fallthrough;
                case BCMGENET_STAT_MIB_RX:
                        val = bcmgenet_umac_readl(priv,
                                                  UMAC_MIB_START + j + offset);
index 511d553..6fb6c35 100644 (file)
@@ -192,7 +192,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
                phy_name = "internal PHY";
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_MOCA:
                /* Irrespective of the actually configured PHY speed (100 or
                 * 1000) GENETv4 only has an internal GPHY so we will just end
index ebff1fc..9894594 100644 (file)
@@ -715,7 +715,7 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
        case TG3_APE_LOCK_GPIO:
                if (tg3_asic_rev(tp) == ASIC_REV_5761)
                        return 0;
-               /* fall through */
+               fallthrough;
        case TG3_APE_LOCK_GRC:
        case TG3_APE_LOCK_MEM:
                if (!tp->pci_fn)
@@ -776,7 +776,7 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
        case TG3_APE_LOCK_GPIO:
                if (tg3_asic_rev(tp) == ASIC_REV_5761)
                        return;
-               /* fall through */
+               fallthrough;
        case TG3_APE_LOCK_GRC:
        case TG3_APE_LOCK_MEM:
                if (!tp->pci_fn)
@@ -1586,7 +1586,7 @@ static int tg3_mdio_init(struct tg3 *tp)
                        phydev->dev_flags |= PHY_BRCM_EXT_IBND_RX_ENABLE;
                if (tg3_flag(tp, RGMII_EXT_IBND_TX_EN))
                        phydev->dev_flags |= PHY_BRCM_EXT_IBND_TX_ENABLE;
-               /* fall through */
+               fallthrough;
        case PHY_ID_RTL8211C:
                phydev->interface = PHY_INTERFACE_MODE_RGMII;
                break;
@@ -2114,7 +2114,7 @@ static int tg3_phy_init(struct tg3 *tp)
                        phy_support_asym_pause(phydev);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
                phy_set_max_speed(phydev, SPEED_100);
                phy_support_asym_pause(phydev);
@@ -4390,7 +4390,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
                                      MII_TG3_DSP_TAP26_RMRXSTO |
                                      MII_TG3_DSP_TAP26_OPCSINPT;
                        tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
-                       /* Fall through */
+                       fallthrough;
                case ASIC_REV_5720:
                case ASIC_REV_5762:
                        if (!tg3_phydsp_read(tp, MII_TG3_DSP_CH34TP2, &val))
@@ -4538,7 +4538,7 @@ static int tg3_phy_pull_config(struct tg3 *tp)
                                tp->link_config.speed = SPEED_1000;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                default:
                        goto done;
                }
@@ -5209,7 +5209,7 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
                if (ap->flags & (MR_AN_ENABLE | MR_RESTART_AN))
                        ap->state = ANEG_STATE_AN_ENABLE;
 
-               /* fall through */
+               fallthrough;
        case ANEG_STATE_AN_ENABLE:
                ap->flags &= ~(MR_AN_COMPLETE | MR_PAGE_RX);
                if (ap->flags & MR_AN_ENABLE) {
@@ -5239,7 +5239,7 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
                ret = ANEG_TIMER_ENAB;
                ap->state = ANEG_STATE_RESTART;
 
-               /* fall through */
+               fallthrough;
        case ANEG_STATE_RESTART:
                delta = ap->cur_time - ap->link_time;
                if (delta > ANEG_STATE_SETTLE_TIME)
@@ -5282,7 +5282,7 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
 
                ap->state = ANEG_STATE_ACK_DETECT;
 
-               /* fall through */
+               fallthrough;
        case ANEG_STATE_ACK_DETECT:
                if (ap->ack_match != 0) {
                        if ((ap->rxconfig & ~ANEG_CFG_ACK) ==
@@ -10720,40 +10720,40 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
        switch (limit) {
        case 16:
                tw32(MAC_RCV_RULE_15,  0); tw32(MAC_RCV_VALUE_15,  0);
-               /* fall through */
+               fallthrough;
        case 15:
                tw32(MAC_RCV_RULE_14,  0); tw32(MAC_RCV_VALUE_14,  0);
-               /* fall through */
+               fallthrough;
        case 14:
                tw32(MAC_RCV_RULE_13,  0); tw32(MAC_RCV_VALUE_13,  0);
-               /* fall through */
+               fallthrough;
        case 13:
                tw32(MAC_RCV_RULE_12,  0); tw32(MAC_RCV_VALUE_12,  0);
-               /* fall through */
+               fallthrough;
        case 12:
                tw32(MAC_RCV_RULE_11,  0); tw32(MAC_RCV_VALUE_11,  0);
-               /* fall through */
+               fallthrough;
        case 11:
                tw32(MAC_RCV_RULE_10,  0); tw32(MAC_RCV_VALUE_10,  0);
-               /* fall through */
+               fallthrough;
        case 10:
                tw32(MAC_RCV_RULE_9,  0); tw32(MAC_RCV_VALUE_9,  0);
-               /* fall through */
+               fallthrough;
        case 9:
                tw32(MAC_RCV_RULE_8,  0); tw32(MAC_RCV_VALUE_8,  0);
-               /* fall through */
+               fallthrough;
        case 8:
                tw32(MAC_RCV_RULE_7,  0); tw32(MAC_RCV_VALUE_7,  0);
-               /* fall through */
+               fallthrough;
        case 7:
                tw32(MAC_RCV_RULE_6,  0); tw32(MAC_RCV_VALUE_6,  0);
-               /* fall through */
+               fallthrough;
        case 6:
                tw32(MAC_RCV_RULE_5,  0); tw32(MAC_RCV_VALUE_5,  0);
-               /* fall through */
+               fallthrough;
        case 5:
                tw32(MAC_RCV_RULE_4,  0); tw32(MAC_RCV_VALUE_4,  0);
-               /* fall through */
+               fallthrough;
        case 4:
                /* tw32(MAC_RCV_RULE_3,  0); tw32(MAC_RCV_VALUE_3,  0); */
        case 3:
@@ -13998,7 +13998,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = tp->phy_addr;
 
-               /* fall through */
+               fallthrough;
        case SIOCGMIIREG: {
                u32 mii_regval;
 
@@ -17136,7 +17136,7 @@ static u32 tg3_calc_dma_bndry(struct tg3 *tp, u32 val)
                                val |= DMA_RWCTRL_WRITE_BNDRY_64_PCIE;
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 128:
                default:
                        val &= ~DMA_RWCTRL_WRITE_BNDRY_DISAB_PCIE;
@@ -17151,28 +17151,28 @@ static u32 tg3_calc_dma_bndry(struct tg3 *tp, u32 val)
                                        DMA_RWCTRL_WRITE_BNDRY_16);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 32:
                        if (goal == BOUNDARY_SINGLE_CACHELINE) {
                                val |= (DMA_RWCTRL_READ_BNDRY_32 |
                                        DMA_RWCTRL_WRITE_BNDRY_32);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 64:
                        if (goal == BOUNDARY_SINGLE_CACHELINE) {
                                val |= (DMA_RWCTRL_READ_BNDRY_64 |
                                        DMA_RWCTRL_WRITE_BNDRY_64);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 128:
                        if (goal == BOUNDARY_SINGLE_CACHELINE) {
                                val |= (DMA_RWCTRL_READ_BNDRY_128 |
                                        DMA_RWCTRL_WRITE_BNDRY_128);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 256:
                        val |= (DMA_RWCTRL_READ_BNDRY_256 |
                                DMA_RWCTRL_WRITE_BNDRY_256);
index 49358d4..b9dd06b 100644 (file)
@@ -321,7 +321,7 @@ bfa_ioc_sm_getattr(struct bfa_ioc *ioc, enum ioc_event event)
        case IOC_E_PFFAILED:
        case IOC_E_HWERROR:
                del_timer(&ioc->ioc_timer);
-               /* fall through */
+               fallthrough;
        case IOC_E_TIMEOUT:
                ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE);
                bfa_fsm_set_state(ioc, bfa_ioc_sm_fail);
@@ -780,7 +780,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf *iocpf, enum iocpf_event event)
 
        case IOCPF_E_INITFAIL:
                del_timer(&ioc->iocpf_timer);
-               /* fall through */
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                bfa_nw_ioc_hw_sem_release(ioc);
@@ -849,7 +849,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf *iocpf, enum iocpf_event event)
 
        case IOCPF_E_FAIL:
                del_timer(&ioc->iocpf_timer);
-               /* fall through*/
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL);
index 40107a9..a2c983f 100644 (file)
@@ -1084,7 +1084,7 @@ bna_enet_sm_cfg_wait(struct bna_enet *enet,
 
        case ENET_E_CHLD_STOPPED:
                bna_enet_rx_start(enet);
-               /* Fall through */
+               fallthrough;
        case ENET_E_FWRESP_PAUSE:
                if (enet->flags & BNA_ENET_F_PAUSE_CHANGED) {
                        enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED;
index b5ecbfe..2623a0d 100644 (file)
@@ -1636,7 +1636,7 @@ bna_bfi_rx_enet_start(struct bna_rx *rx)
                                                &q1->qpt);
                        cfg_req->q_cfg[i].qs.rx_buffer_size =
                                htons((u16)q1->buffer_size);
-                       /* Fall through */
+                       fallthrough;
 
                case BNA_RXP_SINGLE:
                        /* Large/Single RxQ */
index 31ebf3e..283918a 100644 (file)
@@ -460,7 +460,7 @@ int gem_set_hwtst(struct net_device *dev, struct ifreq *ifr, int cmd)
        case HWTSTAMP_TX_ONESTEP_SYNC:
                if (gem_ptp_set_one_step_sync(bp, 1) != 0)
                        return -ERANGE;
-               /* fall through */
+               fallthrough;
        case HWTSTAMP_TX_ON:
                tx_bd_control = TSTAMP_ALL_FRAMES;
                break;
index e73bc21..8e0ed01 100644 (file)
@@ -977,15 +977,14 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 
                schedule_timeout_uninterruptible(HZ / 10);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_HOST_OK:
 
-               /* fallthrough */
        case OCT_DEV_CONSOLE_INIT_DONE:
                /* Remove any consoles */
                octeon_remove_consoles(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_IO_QUEUES_DONE:
                if (lio_wait_for_instr_fetch(oct))
                        dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n");
@@ -1027,7 +1026,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                octeon_free_sc_done_list(oct);
                octeon_free_sc_zombie_list(oct);
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_INTR_SET_DONE:
                /* Disable interrupts  */
                oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
@@ -1062,17 +1061,17 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                kfree(oct->irq_name_storage);
                oct->irq_name_storage = NULL;
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_MSIX_ALLOC_VECTOR_DONE:
                if (OCTEON_CN23XX_PF(oct))
                        octeon_free_ioq_vector(oct);
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_MBOX_SETUP_DONE:
                if (OCTEON_CN23XX_PF(oct))
                        oct->fn_list.free_mbox(oct);
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_IN_RESET:
        case OCT_DEV_DROQ_INIT_DONE:
                /* Wait for any pending operations */
@@ -1095,11 +1094,11 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                        }
                }
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_RESP_LIST_INIT_DONE:
                octeon_delete_response_list(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_INSTR_QUEUE_INIT_DONE:
                for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
                        if (!(oct->io_qmask.iq & BIT_ULL(i)))
@@ -1110,16 +1109,16 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                if (oct->sriov_info.sriov_enabled)
                        pci_disable_sriov(oct->pci_dev);
 #endif
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_SC_BUFF_POOL_INIT_DONE:
                octeon_free_sc_buffer_pool(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_DISPATCH_INIT_DONE:
                octeon_delete_dispatch_list(oct);
                cancel_delayed_work_sync(&oct->nic_poll_work.work);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_MAP_DONE:
                refcount = octeon_deregister_device(oct);
 
@@ -1137,13 +1136,13 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                octeon_unmap_pci_barx(oct, 0);
                octeon_unmap_pci_barx(oct, 1);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_ENABLE_DONE:
                pci_clear_master(oct->pci_dev);
                /* Disable the device, releasing the PCI INT */
                pci_disable_device(oct->pci_dev);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_BEGIN_STATE:
                /* Nothing to be done here either */
                break;
@@ -2168,7 +2167,7 @@ static int liquidio_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (lio->oct_dev->ptp_enable)
                        return hwtstamp_ioctl(netdev, ifr);
-               /* fall through */
+               fallthrough;
        default:
                return -EOPNOTSUPP;
        }
index 90ef210..8c5879e 100644 (file)
@@ -460,9 +460,8 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 
                schedule_timeout_uninterruptible(HZ / 10);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_HOST_OK:
-               /* fallthrough */
        case OCT_DEV_IO_QUEUES_DONE:
                if (lio_wait_for_instr_fetch(oct))
                        dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n");
@@ -504,7 +503,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                octeon_free_sc_done_list(oct);
                octeon_free_sc_zombie_list(oct);
 
-       /* fall through */
+               fallthrough;
        case OCT_DEV_INTR_SET_DONE:
                /* Disable interrupts  */
                oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
@@ -533,15 +532,15 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                else
                        cn23xx_vf_ask_pf_to_do_flr(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_MSIX_ALLOC_VECTOR_DONE:
                octeon_free_ioq_vector(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_MBOX_SETUP_DONE:
                oct->fn_list.free_mbox(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_IN_RESET:
        case OCT_DEV_DROQ_INIT_DONE:
                mdelay(100);
@@ -551,11 +550,11 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                        octeon_delete_droq(oct, i);
                }
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_RESP_LIST_INIT_DONE:
                octeon_delete_response_list(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_INSTR_QUEUE_INIT_DONE:
                for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
                        if (!(oct->io_qmask.iq & BIT_ULL(i)))
@@ -563,27 +562,27 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                        octeon_delete_instr_queue(oct, i);
                }
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_SC_BUFF_POOL_INIT_DONE:
                octeon_free_sc_buffer_pool(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_DISPATCH_INIT_DONE:
                octeon_delete_dispatch_list(oct);
                cancel_delayed_work_sync(&oct->nic_poll_work.work);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_MAP_DONE:
                octeon_unmap_pci_barx(oct, 0);
                octeon_unmap_pci_barx(oct, 1);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_ENABLE_DONE:
                pci_clear_master(oct->pci_dev);
                /* Disable the device, releasing the PCI INT */
                pci_disable_device(oct->pci_dev);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_BEGIN_STATE:
                /* Nothing to be done here either */
                break;
index 83dabcf..c7bdac7 100644 (file)
@@ -522,7 +522,7 @@ static int nicvf_get_rss_hash_opts(struct nicvf *nic,
        case SCTP_V4_FLOW:
        case SCTP_V6_FLOW:
                info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case IPV4_FLOW:
        case IPV6_FLOW:
                info->data |= RXH_IP_SRC | RXH_IP_DST;
index c1378b5..063e560 100644 (file)
@@ -594,10 +594,10 @@ static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog,
                return true;
        default:
                bpf_warn_invalid_xdp_action(action);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(nic->netdev, prog, action);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                /* Check if it's a recycled page, if not
                 * unmap the DMA mapping.
index 42c6e93..387c357 100644 (file)
@@ -2543,7 +2543,7 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                    !(data->phy_id & 0xe0e0))
                        data->phy_id = mdio_phy_id_c45(data->phy_id >> 8,
                                                       data->phy_id & 0x1f);
-               /* FALLTHRU */
+               fallthrough;
        case SIOCGMIIPHY:
                return mdio_mii_ioctl(&pi->phy.mdio, data, cmd);
        case SIOCCHIOCTL:
index b3e4118..9749d12 100644 (file)
@@ -136,7 +136,7 @@ again:
                if (e->state == L2T_STATE_STALE)
                        e->state = L2T_STATE_VALID;
                spin_unlock_bh(&e->lock);
-               /* fall through */
+               fallthrough;
        case L2T_STATE_VALID:   /* fast-path, send the packet on */
                return cxgb3_ofld_send(dev, skb);
        case L2T_STATE_RESOLVING:
index c486412..a10a686 100644 (file)
@@ -231,7 +231,7 @@ again:
                if (e->state == L2T_STATE_STALE)
                        e->state = L2T_STATE_VALID;
                spin_unlock_bh(&e->lock);
-               /* fall through */
+               fallthrough;
        case L2T_STATE_VALID:     /* fast-path, send the packet on */
                return t4_ofld_send(adap, skb);
        case L2T_STATE_RESOLVING:
index d2b587d..869431a 100644 (file)
@@ -2553,19 +2553,22 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev)
 
        pkt_len = ETH_HLEN + sizeof(CXGB4_SELFTEST_LB_STR);
 
-       flits = DIV_ROUND_UP(pkt_len + sizeof(struct cpl_tx_pkt) +
-                            sizeof(*wr), sizeof(__be64));
+       flits = DIV_ROUND_UP(pkt_len + sizeof(*cpl) + sizeof(*wr),
+                            sizeof(__be64));
        ndesc = flits_to_desc(flits);
 
        lb = &pi->ethtool_lb;
        lb->loopback = 1;
 
        q = &adap->sge.ethtxq[pi->first_qset];
+       __netif_tx_lock(q->txq, smp_processor_id());
 
        reclaim_completed_tx(adap, &q->q, -1, true);
        credits = txq_avail(&q->q) - ndesc;
-       if (unlikely(credits < 0))
+       if (unlikely(credits < 0)) {
+               __netif_tx_unlock(q->txq);
                return -ENOMEM;
+       }
 
        wr = (void *)&q->q.desc[q->q.pidx];
        memset(wr, 0, sizeof(struct tx_desc));
@@ -2598,6 +2601,7 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev)
        init_completion(&lb->completion);
        txq_advance(&q->q, ndesc);
        cxgb4_ring_tx_db(adap, &q->q, ndesc);
+       __netif_tx_unlock(q->txq);
 
        /* wait for the pkt to return */
        ret = wait_for_completion_timeout(&lb->completion, 10 * HZ);
index 8a56491..fa33679 100644 (file)
@@ -7656,13 +7656,13 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
                switch (nmac) {
                case 5:
                        memcpy(mac + 24, c.nmac3, sizeof(c.nmac3));
-                       /* Fall through */
+                       fallthrough;
                case 4:
                        memcpy(mac + 18, c.nmac2, sizeof(c.nmac2));
-                       /* Fall through */
+                       fallthrough;
                case 3:
                        memcpy(mac + 12, c.nmac1, sizeof(c.nmac1));
-                       /* Fall through */
+                       fallthrough;
                case 2:
                        memcpy(mac + 6,  c.nmac0, sizeof(c.nmac0));
                }
index dbe8ee7..e2fe78e 100644 (file)
@@ -517,7 +517,7 @@ static int fwevtq_handler(struct sge_rspq *rspq, const __be64 *rsp,
                }
                cpl = (void *)p;
        }
-               /* Fall through */
+               fallthrough;
 
        case CPL_SGE_EGR_UPDATE: {
                /*
index 6bc7e7b..552d89f 100644 (file)
@@ -272,7 +272,7 @@ static netdev_features_t enic_features_check(struct sk_buff *skb,
        case ntohs(ETH_P_IPV6):
                if (!(enic->vxlan.flags & ENIC_VXLAN_INNER_IPV6))
                        goto out;
-               /* Fall through */
+               fallthrough;
        case ntohs(ETH_P_IP):
                break;
        default:
index 66e67b2..62e271a 100644 (file)
@@ -2389,7 +2389,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
 
        dev_info(dev, "probe %s ID %d\n", dev_name(dev), id);
 
-       netdev = alloc_etherdev_mq(sizeof(*port), TX_QUEUE_NUM);
+       netdev = devm_alloc_etherdev_mqs(dev, sizeof(*port), TX_QUEUE_NUM, TX_QUEUE_NUM);
        if (!netdev) {
                dev_err(dev, "Can't allocate ethernet device #%d\n", id);
                return -ENOMEM;
@@ -2521,7 +2521,6 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
        }
 
        port->netdev = NULL;
-       free_netdev(netdev);
        return ret;
 }
 
@@ -2530,7 +2529,6 @@ static int gemini_ethernet_port_remove(struct platform_device *pdev)
        struct gemini_ethernet_port *port = platform_get_drvdata(pdev);
 
        gemini_port_remove(port);
-       free_netdev(port->netdev);
        return 0;
 }
 
index 7f77051..5c6c8c5 100644 (file)
@@ -385,7 +385,7 @@ static void dm9000_set_io(struct board_info *db, int byte_width)
 
        case 3:
                dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n");
-               /* fall through */
+               fallthrough;
        case 2:
                db->dumpblk = dm9000_dumpblk_16bit;
                db->outblk  = dm9000_outblk_16bit;
index 0ccd999..f9dd1aa 100644 (file)
@@ -3203,7 +3203,7 @@ srom_map_media(struct net_device *dev)
       case SROM_10BASETF:
        if (!lp->params.fdx) return -1;
        lp->fdx = true;
-       /* fall through */
+       fallthrough;
 
       case SROM_10BASET:
        if (lp->params.fdx && !lp->fdx) return -1;
@@ -3225,7 +3225,7 @@ srom_map_media(struct net_device *dev)
       case SROM_100BASETF:
         if (!lp->params.fdx) return -1;
        lp->fdx = true;
-       /* fall through */
+       fallthrough;
 
       case SROM_100BASET:
        if (lp->params.fdx && !lp->fdx) return -1;
@@ -3239,7 +3239,7 @@ srom_map_media(struct net_device *dev)
       case SROM_100BASEFF:
        if (!lp->params.fdx) return -1;
        lp->fdx = true;
-       /* fall through */
+       fallthrough;
 
       case SROM_100BASEF:
        if (lp->params.fdx && !lp->fdx) return -1;
index 9db2352..3a8659c 100644 (file)
@@ -911,7 +911,7 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
                        data->phy_id = 1;
                else
                        return -ENODEV;
-               /* Fall through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                if (data->phy_id == 32 && (tp->flags & HAS_NWAY)) {
index 5dcc66f..5a43be3 100644 (file)
@@ -1443,7 +1443,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = ((struct netdev_private *)netdev_priv(dev))->phys[0] & 0x1f;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                spin_lock_irq(&np->lock);
index d6ed1d9..99cc1c4 100644 (file)
@@ -571,7 +571,7 @@ static u32 convert_to_et_setting(struct be_adapter *adapter, u32 if_speeds)
                                break;
                        }
                }
-               /* fall through */
+               fallthrough;
        case PHY_TYPE_SFP_PLUS_10GB:
        case PHY_TYPE_XFP_10GB:
        case PHY_TYPE_SFP_1GB:
index 43570f4..fdff3b4 100644 (file)
@@ -945,7 +945,7 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
                        break;
                case FQ_TYPE_TX_CONF_MQ:
                        priv->conf_fqs[conf_cnt++] = &fq->fq_base;
-                       /* fall through */
+                       fallthrough;
                case FQ_TYPE_TX_CONFIRM:
                        dpaa_setup_ingress(priv, fq, &fq_cbs->tx_defq);
                        break;
index 9db2a02..1268996 100644 (file)
@@ -375,7 +375,7 @@ static int dpaa_get_hash_opts(struct net_device *dev,
        case UDP_V6_FLOW:
                if (priv->keygen_in_use)
                        cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case IPV4_FLOW:
        case IPV6_FLOW:
        case SCTP_V4_FLOW:
index 457106e..cf5383b 100644 (file)
@@ -376,10 +376,10 @@ static u32 run_xdp(struct dpaa2_eth_priv *priv,
                break;
        default:
                bpf_warn_invalid_xdp_action(xdp_act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(priv->net_dev, xdp_prog, xdp_act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                xdp_release_buf(priv, ch, addr);
                ch->stats.xdp_drop++;
index 9934421..fb37816 100644 (file)
@@ -3715,11 +3715,11 @@ failed_mii_init:
 failed_irq:
 failed_init:
        fec_ptp_stop(pdev);
-       if (fep->reg_phy)
-               regulator_disable(fep->reg_phy);
 failed_reset:
        pm_runtime_put_noidle(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+       if (fep->reg_phy)
+               regulator_disable(fep->reg_phy);
 failed_regulator:
        clk_disable_unprepare(fep->clk_ahb);
 failed_clk_ahb:
index 645764a..bb9887f 100644 (file)
@@ -528,7 +528,7 @@ static void setup_sgmii_internal_phy(struct fman_mac *memac,
                case 100:
                        tmp_reg16 |= IF_MODE_SGMII_SPEED_100M;
                break;
-               case 1000: /* fallthrough */
+               case 1000:
                default:
                        tmp_reg16 |= IF_MODE_SGMII_SPEED_1G;
                break;
index c27df15..624b2eb 100644 (file)
@@ -1344,10 +1344,10 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params)
        switch (port->port_type) {
        case FMAN_PORT_TYPE_RX:
                set_rx_dflt_cfg(port, params);
-               /* fall through */
+               fallthrough;
        case FMAN_PORT_TYPE_TX:
                set_tx_dflt_cfg(port, params, &port->dts_params);
-               /* fall through */
+               fallthrough;
        default:
                set_dflt_cfg(port, params);
        }
index b513b8c..41dd3d0 100644 (file)
@@ -750,8 +750,10 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
                                continue;
 
                        err = gfar_parse_group(child, priv, model);
-                       if (err)
+                       if (err) {
+                               of_node_put(child);
                                goto err_grp_init;
+                       }
                }
        } else { /* SQ_SG_MODE */
                err = gfar_parse_group(np, priv, model);
index db791f6..714b501 100644 (file)
@@ -1348,7 +1348,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
                switch (ugeth->max_speed) {
                case SPEED_10:
                        upsmr |= UCC_GETH_UPSMR_R10M;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case SPEED_100:
                        if (ugeth->phy_interface != PHY_INTERFACE_MODE_RTBI)
                                upsmr |= UCC_GETH_UPSMR_RMM;
index 49624ac..4eb5029 100644 (file)
@@ -305,7 +305,7 @@ static int __lb_setup(struct net_device *ndev,
                break;
        case MAC_LOOP_PHY_NONE:
                ret = hns_nic_config_phy_loopback(phy_dev, 0x0);
-               /* fall through */
+               fallthrough;
        case MAC_LOOP_NONE:
                if (!ret && h->dev->ops->set_loopback) {
                        if (priv->ae_handle->phy_if != PHY_INTERFACE_MODE_XGMII)
index 87776ce..c2ea034 100644 (file)
@@ -2746,7 +2746,7 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
        case HNS3_OL4_TYPE_MAC_IN_UDP:
        case HNS3_OL4_TYPE_NVGRE:
                skb->csum_level = 1;
-               /* fall through */
+               fallthrough;
        case HNS3_OL4_TYPE_NO_TUN:
                l3_type = hnae3_get_field(l234info, HNS3_RXD_L3ID_M,
                                          HNS3_RXD_L3ID_S);
index 36575e7..d553ed7 100644 (file)
@@ -3061,7 +3061,7 @@ static irqreturn_t hclge_misc_irq_handle(int irq, void *data)
                 *    by first decoding the types of errors.
                 */
                set_bit(HNAE3_UNKNOWN_RESET, &hdev->reset_request);
-               /* fall through */
+               fallthrough;
        case HCLGE_VECTOR0_EVENT_RST:
                hclge_reset_task_schedule(hdev);
                break;
@@ -3686,12 +3686,10 @@ static int hclge_reset_prepare_up(struct hclge_dev *hdev)
 
        switch (hdev->reset_type) {
        case HNAE3_FUNC_RESET:
-               /* fall through */
        case HNAE3_FLR_RESET:
                ret = hclge_set_all_vf_rst(hdev, false);
                break;
        case HNAE3_GLOBAL_RESET:
-               /* fall through */
        case HNAE3_IMP_RESET:
                ret = hclge_set_rst_done(hdev);
                break;
index 0273fb7..3153d62 100644 (file)
@@ -3247,7 +3247,7 @@ static int ehea_mem_notifier(struct notifier_block *nb,
        switch (action) {
        case MEM_CANCEL_OFFLINE:
                pr_info("memory offlining canceled");
-               /* Fall through - re-add canceled memory block */
+               fallthrough;    /* re-add canceled memory block */
 
        case MEM_ONLINE:
                pr_info("memory is going online");
index 06248a7..c00b909 100644 (file)
@@ -2319,7 +2319,7 @@ static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:
                data->phy_id = dev->phy.address;
-               /* Fall through */
+               fallthrough;
        case SIOCGMIIREG:
                data->val_out = emac_mdio_read(ndev, dev->phy.address,
                                               data->reg_num);
index 63dde3b..664e8cc 100644 (file)
@@ -4079,7 +4079,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
        case e1000_pch_lpt:
        case e1000_pch_spt:
        case e1000_pch_cnp:
-               fallthrough;
        case e1000_pch_tgp:
        case e1000_pch_adp:
                fc->refresh_time = 0xFFFF;
index a62ddd6..c0c8efe 100644 (file)
@@ -981,7 +981,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
 #define I40E_AQC_SET_VSI_PROMISC_BROADCAST     0x04
 #define I40E_AQC_SET_VSI_DEFAULT               0x08
 #define I40E_AQC_SET_VSI_PROMISC_VLAN          0x10
-#define I40E_AQC_SET_VSI_PROMISC_TX            0x8000
+#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY       0x8000
        __le16  seid;
        __le16  vlan_tag;
 #define I40E_AQC_SET_VSI_VLAN_VALID            0x8000
index afad5e9..6ab52cb 100644 (file)
@@ -1966,6 +1966,21 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
        return status;
 }
 
+/**
+ * i40e_is_aq_api_ver_ge
+ * @aq: pointer to AdminQ info containing HW API version to compare
+ * @maj: API major value
+ * @min: API minor value
+ *
+ * Assert whether current HW API version is greater/equal than provided.
+ **/
+static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj,
+                                 u16 min)
+{
+       return (aq->api_maj_ver > maj ||
+               (aq->api_maj_ver == maj && aq->api_min_ver >= min));
+}
+
 /**
  * i40e_aq_add_vsi
  * @hw: pointer to the hw struct
@@ -2091,18 +2106,16 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
 
        if (set) {
                flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
-               if (rx_only_promisc &&
-                   (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
-                    (hw->aq.api_maj_ver > 1)))
-                       flags |= I40E_AQC_SET_VSI_PROMISC_TX;
+               if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
+                       flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
        }
 
        cmd->promiscuous_flags = cpu_to_le16(flags);
 
        cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
-       if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) ||
-           (hw->aq.api_maj_ver > 1))
-               cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_TX);
+       if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
+               cmd->valid_flags |=
+                       cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
 
        cmd->seid = cpu_to_le16(seid);
        status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
@@ -2199,11 +2212,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
        i40e_fill_default_direct_cmd_desc(&desc,
                                          i40e_aqc_opc_set_vsi_promiscuous_modes);
 
-       if (enable)
+       if (enable) {
                flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
+               if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
+                       flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
+       }
 
        cmd->promiscuous_flags = cpu_to_le16(flags);
        cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
+       if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
+               cmd->valid_flags |=
+                       cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
        cmd->seid = cpu_to_le16(seid);
        cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID);
 
index b539935..2e433fd 100644 (file)
@@ -15463,6 +15463,9 @@ static void i40e_remove(struct pci_dev *pdev)
        i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0);
        i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0);
 
+       while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
+               usleep_range(1000, 2000);
+
        /* no more scheduling of any task */
        set_bit(__I40E_SUSPENDED, pf->state);
        set_bit(__I40E_DOWN, pf->state);
index 4f05f6e..d9c3a6b 100644 (file)
@@ -718,7 +718,6 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
        case e1000_i354:
        case e1000_i210:
        case e1000_i211:
-               fallthrough;
        default:
                for (; i < adapter->num_rx_queues; i++)
                        adapter->rx_ring[i]->reg_idx = rbase_offset + i;
index 7a6f2a0..9593aa4 100644 (file)
@@ -5142,6 +5142,8 @@ static int igc_probe(struct pci_dev *pdev,
        device_set_wakeup_enable(&adapter->pdev->dev,
                                 adapter->flags & IGC_FLAG_WOL_SUPPORTED);
 
+       igc_ptp_init(adapter);
+
        /* reset the hardware with the new settings */
        igc_reset(adapter);
 
@@ -5158,9 +5160,6 @@ static int igc_probe(struct pci_dev *pdev,
         /* carrier off reporting is important to ethtool even BEFORE open */
        netif_carrier_off(netdev);
 
-       /* do hw tstamp init after resetting */
-       igc_ptp_init(adapter);
-
        /* Check if Media Autosense is enabled */
        adapter->ei = *ei;
 
index e67d465..36c9992 100644 (file)
@@ -496,8 +496,6 @@ void igc_ptp_init(struct igc_adapter *adapter)
        adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
        adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
 
-       igc_ptp_reset(adapter);
-
        adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
                                                &adapter->pdev->dev);
        if (IS_ERR(adapter->ptp_clock)) {
index e67b1a5..0fcd820 100644 (file)
@@ -193,7 +193,7 @@ static int ixgbe_fcoe_ddp_setup(struct net_device *netdev, u16 xid,
        }
 
        /* alloc the udl from per cpu ddp pool */
-       ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_KERNEL, &ddp->udp);
+       ddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp);
        if (!ddp->udl) {
                e_err(drv, "failed allocated ddp context\n");
                goto out_noddp_unmap;
index 832bbb8..dfcb176 100644 (file)
@@ -2205,10 +2205,10 @@ mvneta_run_xdp(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(pp->dev, prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                mvneta_xdp_put_buff(pp, rxq, xdp, sync, true);
                ret = MVNETA_XDP_DROPPED;
index d4a4e24..41d935d 100644 (file)
@@ -1638,7 +1638,7 @@ int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info)
                        hash_opts |= MVPP22_CLS_HEK_OPT_L4SIP;
                if (info->data & RXH_L4_B_2_3)
                        hash_opts |= MVPP22_CLS_HEK_OPT_L4DIP;
-               /* Fallthrough */
+               fallthrough;
        case MVPP22_FLOW_IP4:
        case MVPP22_FLOW_IP6:
                if (info->data & RXH_L2DA)
index 2a8a584..6e140d1 100644 (file)
@@ -5437,7 +5437,7 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                }
                if (state->interface != PHY_INTERFACE_MODE_NA)
                        break;
-               /* Fall-through */
+               fallthrough;
        case PHY_INTERFACE_MODE_RGMII:
        case PHY_INTERFACE_MODE_RGMII_ID:
        case PHY_INTERFACE_MODE_RGMII_RXID:
@@ -5451,7 +5451,7 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                phylink_set(mask, 1000baseX_Full);
                if (state->interface != PHY_INTERFACE_MODE_NA)
                        break;
-               /* Fall-through */
+               fallthrough;
        case PHY_INTERFACE_MODE_1000BASEX:
        case PHY_INTERFACE_MODE_2500BASEX:
                if (port->comphy ||
index 36953d4..01a7931 100644 (file)
@@ -737,7 +737,7 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
                else if (req->ctype == NIX_AQ_CTYPE_MCE)
                        memcpy(mask, &req->mce_mask,
                               sizeof(struct nix_rx_mce_s));
-               /* Fall through */
+               fallthrough;
        case NIX_AQ_INSTOP_INIT:
                if (req->ctype == NIX_AQ_CTYPE_RQ)
                        memcpy(ctx, &req->rq, sizeof(struct nix_rq_ctx_s));
index 5975521..93c4cf7 100644 (file)
@@ -1226,8 +1226,8 @@ int otx2_config_npa(struct otx2_nic *pfvf)
        if (!hw->pool_cnt)
                return -EINVAL;
 
-       qset->pool = devm_kzalloc(pfvf->dev, sizeof(struct otx2_pool) *
-                                 hw->pool_cnt, GFP_KERNEL);
+       qset->pool = devm_kcalloc(pfvf->dev, hw->pool_cnt,
+                                 sizeof(struct otx2_pool), GFP_KERNEL);
        if (!qset->pool)
                return -ENOMEM;
 
index b792f63..6a93035 100644 (file)
@@ -2448,7 +2448,7 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = hw->phy_addr;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u16 val = 0;
                spin_lock_bh(&hw->phy_lock);
index cec8124..3448642 100644 (file)
@@ -1376,7 +1376,7 @@ static int sky2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = PHY_ADDR_MARV;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u16 val = 0;
 
@@ -2764,7 +2764,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
 
                case OP_RXCHKSVLAN:
                        sky2_rx_tag(sky2, length);
-                       /* fall through */
+                       fallthrough;
                case OP_RXCHKS:
                        if (likely(dev->features & NETIF_F_RXCSUM))
                                sky2_rx_checksum(sky2, status);
index 0870fe7..6d2d606 100644 (file)
@@ -228,7 +228,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
                        if (!MTK_HAS_CAPS(mac->hw->soc->caps,
                                          MTK_GMAC1_TRGMII))
                                goto err_phy;
-                       /* fall through */
+                       fallthrough;
                case PHY_INTERFACE_MODE_RGMII_TXID:
                case PHY_INTERFACE_MODE_RGMII_RXID:
                case PHY_INTERFACE_MODE_RGMII_ID:
@@ -501,11 +501,11 @@ static void mtk_validate(struct phylink_config *config,
        case PHY_INTERFACE_MODE_RGMII_RXID:
        case PHY_INTERFACE_MODE_RGMII_TXID:
                phylink_set(mask, 1000baseT_Half);
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_SGMII:
                phylink_set(mask, 1000baseT_Full);
                phylink_set(mask, 1000baseX_Full);
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
        case PHY_INTERFACE_MODE_RMII:
        case PHY_INTERFACE_MODE_REVMII:
index 7a04c62..bcd1669 100644 (file)
@@ -72,7 +72,7 @@ static int mlxfw_fsm_state_err(struct mlxfw_dev *mlxfw_dev,
        case MLXFW_FSM_STATE_ERR_BLOCKED_PENDING_RESET:
                MLXFW_ERR_MSG(mlxfw_dev, extack, "pending reset", err);
                break;
-       case MLXFW_FSM_STATE_ERR_OK: /* fall through */
+       case MLXFW_FSM_STATE_ERR_OK:
        case MLXFW_FSM_STATE_ERR_MAX:
                MLXFW_ERR_MSG(mlxfw_dev, extack, "unknown error", err);
                break;
@@ -155,7 +155,7 @@ mlxfw_fsm_reactivate_err(struct mlxfw_dev *mlxfw_dev,
        case MLXFW_FSM_REACTIVATE_STATUS_FW_ALREADY_ACTIVATED:
                MLXFW_REACT_ERR("fw already activated", err);
                break;
-       case MLXFW_FSM_REACTIVATE_STATUS_OK: /* fall through */
+       case MLXFW_FSM_REACTIVATE_STATUS_OK:
        case MLXFW_FSM_REACTIVATE_STATUS_MAX:
                MLXFW_REACT_ERR("unexpected error", err);
                break;
index 08d1011..ec45a03 100644 (file)
@@ -2289,21 +2289,21 @@ int mlxsw_core_module_max_width(struct mlxsw_core *mlxsw_core, u8 module)
        /* Here we need to get the module width according to the module type. */
 
        switch (module_type) {
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C8X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C8X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD:
        case MLXSW_REG_PMTM_MODULE_TYPE_OSFP:
                return 8;
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C4X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_BP_4X: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C4X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_BP_4X:
        case MLXSW_REG_PMTM_MODULE_TYPE_QSFP:
                return 4;
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C2X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_BP_2X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C2X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_BP_2X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD:
        case MLXSW_REG_PMTM_MODULE_TYPE_DSFP:
                return 2;
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C1X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_BP_1X: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C1X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_BP_1X:
        case MLXSW_REG_PMTM_MODULE_TYPE_SFP:
                return 1;
        default:
index 44fa02c..056eeb8 100644 (file)
@@ -30,8 +30,8 @@ static int mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id,
        case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_SFP:
                *qsfp = false;
                break;
-       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP: /* fall-through */
-       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS: /* fall-through */
+       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP:
+       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS:
        case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28:
                *qsfp = true;
                break;
@@ -205,7 +205,7 @@ int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
                modinfo->type       = ETH_MODULE_SFF_8436;
                modinfo->eeprom_len = ETH_MODULE_SFF_8436_MAX_LEN;
                break;
-       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS: /* fall-through */
+       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS:
        case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28:
                if (module_id == MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28 ||
                    module_rev_id >=
index 3fe878d..61719ec 100644 (file)
@@ -259,8 +259,8 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev,
                 */
                fault = 1;
                break;
-       case MLXSW_REG_MTBR_NO_CONN: /* fall-through */
-       case MLXSW_REG_MTBR_NO_TEMP_SENS: /* fall-through */
+       case MLXSW_REG_MTBR_NO_CONN:
+       case MLXSW_REG_MTBR_NO_TEMP_SENS:
        case MLXSW_REG_MTBR_INDEX_NA:
        default:
                fault = 0;
index fdf9aa8..4186e29 100644 (file)
@@ -517,8 +517,8 @@ enum mlxsw_reg_spms_state mlxsw_sp_stp_spms_state(u8 state)
                return MLXSW_REG_SPMS_STATE_FORWARDING;
        case BR_STATE_LEARNING:
                return MLXSW_REG_SPMS_STATE_LEARNING;
-       case BR_STATE_LISTENING: /* fall-through */
-       case BR_STATE_DISABLED: /* fall-through */
+       case BR_STATE_LISTENING:
+       case BR_STATE_DISABLED:
        case BR_STATE_BLOCKING:
                return MLXSW_REG_SPMS_STATE_DISCARDING;
        default:
index f9ba596..5240bf1 100644 (file)
@@ -636,11 +636,11 @@ static inline unsigned int
 mlxsw_sp_kvdl_entry_size(enum mlxsw_sp_kvdl_entry_type type)
 {
        switch (type) {
-       case MLXSW_SP_KVDL_ENTRY_TYPE_ADJ: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_PBS: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT: /* fall through */
+       case MLXSW_SP_KVDL_ENTRY_TYPE_ADJ:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_PBS:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT:
        default:
                return 1;
        }
index 0521e9d..24f1fd1 100644 (file)
@@ -1164,7 +1164,7 @@ mlxsw_sp_router_ip2me_fib_entry_find(struct mlxsw_sp *mlxsw_sp, u32 tb_id,
                addr_len = 4;
                addr_prefix_len = 32;
                break;
-       case MLXSW_SP_L3_PROTO_IPV6: /* fall through */
+       case MLXSW_SP_L3_PROTO_IPV6:
        default:
                WARN_ON(1);
                return NULL;
@@ -4555,14 +4555,14 @@ mlxsw_sp_fib4_entry_type_set(struct mlxsw_sp *mlxsw_sp,
                        fib_entry->type = MLXSW_SP_FIB_ENTRY_TYPE_NVE_DECAP;
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case RTN_BROADCAST:
                fib_entry->type = MLXSW_SP_FIB_ENTRY_TYPE_TRAP;
                return 0;
        case RTN_BLACKHOLE:
                fib_entry->type = MLXSW_SP_FIB_ENTRY_TYPE_BLACKHOLE;
                return 0;
-       case RTN_UNREACHABLE: /* fall through */
+       case RTN_UNREACHABLE:
        case RTN_PROHIBIT:
                /* Packets hitting these routes need to be trapped, but
                 * can do so with a lower priority than packets directed
@@ -5990,7 +5990,7 @@ static void mlxsw_sp_router_fib4_event_work(struct work_struct *work)
                mlxsw_sp_router_fib4_del(mlxsw_sp, &fib_work->fen_info);
                fib_info_put(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_NH_ADD: /* fall through */
+       case FIB_EVENT_NH_ADD:
        case FIB_EVENT_NH_DEL:
                mlxsw_sp_nexthop4_event(mlxsw_sp, fib_work->event,
                                        fib_work->fnh_info.fib_nh);
@@ -6050,7 +6050,7 @@ static void mlxsw_sp_router_fibmr_event_work(struct work_struct *work)
        rtnl_lock();
        mutex_lock(&mlxsw_sp->router->lock);
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_ADD:
                replace = fib_work->event == FIB_EVENT_ENTRY_REPLACE;
 
@@ -6089,7 +6089,7 @@ static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work,
        struct fib_nh_notifier_info *fnh_info;
 
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_DEL:
                fen_info = container_of(info, struct fib_entry_notifier_info,
                                        info);
@@ -6099,7 +6099,7 @@ static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work,
                 */
                fib_info_hold(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_NH_ADD: /* fall through */
+       case FIB_EVENT_NH_ADD:
        case FIB_EVENT_NH_DEL:
                fnh_info = container_of(info, struct fib_nh_notifier_info,
                                        info);
@@ -6116,8 +6116,8 @@ static int mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work,
        int err;
 
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
-       case FIB_EVENT_ENTRY_APPEND: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
+       case FIB_EVENT_ENTRY_APPEND:
        case FIB_EVENT_ENTRY_DEL:
                fen6_info = container_of(info, struct fib6_entry_notifier_info,
                                         info);
@@ -6136,13 +6136,13 @@ mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event_work *fib_work,
                            struct fib_notifier_info *info)
 {
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
-       case FIB_EVENT_ENTRY_ADD: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
+       case FIB_EVENT_ENTRY_ADD:
        case FIB_EVENT_ENTRY_DEL:
                memcpy(&fib_work->men_info, info, sizeof(fib_work->men_info));
                mr_cache_hold(fib_work->men_info.mfc);
                break;
-       case FIB_EVENT_VIF_ADD: /* fall through */
+       case FIB_EVENT_VIF_ADD:
        case FIB_EVENT_VIF_DEL:
                memcpy(&fib_work->ven_info, info, sizeof(fib_work->ven_info));
                dev_hold(fib_work->ven_info.dev);
@@ -6215,13 +6215,13 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
        router = container_of(nb, struct mlxsw_sp_router, fib_nb);
 
        switch (event) {
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                err = mlxsw_sp_router_fib_rule_event(event, info,
                                                     router->mlxsw_sp);
                return notifier_from_errno(err);
-       case FIB_EVENT_ENTRY_ADD: /* fall through */
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_ADD:
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_APPEND:
                if (router->aborted) {
                        NL_SET_ERR_MSG_MOD(info->extack, "FIB offload was aborted. Not configuring route");
@@ -7277,7 +7277,7 @@ int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
                goto out;
 
        switch (event) {
-       case NETDEV_CHANGEMTU: /* fall through */
+       case NETDEV_CHANGEMTU:
        case NETDEV_CHANGEADDR:
                err = mlxsw_sp_router_port_change_event(mlxsw_sp, rif);
                break;
index 5c959a9..1d18e41 100644 (file)
@@ -1523,12 +1523,12 @@ mlxsw_sp_span_trigger_ops_set(struct mlxsw_sp_span_trigger_entry *trigger_entry)
        enum mlxsw_sp_span_trigger_type type;
 
        switch (trigger_entry->trigger) {
-       case MLXSW_SP_SPAN_TRIGGER_INGRESS: /* fall-through */
+       case MLXSW_SP_SPAN_TRIGGER_INGRESS:
        case MLXSW_SP_SPAN_TRIGGER_EGRESS:
                type = MLXSW_SP_SPAN_TRIGGER_TYPE_PORT;
                break;
-       case MLXSW_SP_SPAN_TRIGGER_TAIL_DROP: /* fall-through */
-       case MLXSW_SP_SPAN_TRIGGER_EARLY_DROP: /* fall-through */
+       case MLXSW_SP_SPAN_TRIGGER_TAIL_DROP:
+       case MLXSW_SP_SPAN_TRIGGER_EARLY_DROP:
        case MLXSW_SP_SPAN_TRIGGER_ECN:
                type = MLXSW_SP_SPAN_TRIGGER_TYPE_GLOBAL;
                break;
index a26162b..72912af 100644 (file)
@@ -1297,7 +1297,7 @@ static int mlxsw_sp_port_fdb_tunnel_uc_op(struct mlxsw_sp *mlxsw_sp,
                uip = be32_to_cpu(addr->addr4);
                sfd_proto = MLXSW_REG_SFD_UC_TUNNEL_PROTOCOL_IPV4;
                break;
-       case MLXSW_SP_L3_PROTO_IPV6: /* fall through */
+       case MLXSW_SP_L3_PROTO_IPV6:
        default:
                WARN_ON(1);
                return -EOPNOTSUPP;
@@ -2870,7 +2870,7 @@ static void mlxsw_sp_switchdev_bridge_fdb_event_work(struct work_struct *work)
                fdb_info = &switchdev_work->fdb_info;
                mlxsw_sp_port_fdb_set(mlxsw_sp_port, fdb_info, false);
                break;
-       case SWITCHDEV_FDB_ADD_TO_BRIDGE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_BRIDGE:
        case SWITCHDEV_FDB_DEL_TO_BRIDGE:
                /* These events are only used to potentially update an existing
                 * SPAN mirror.
@@ -3116,9 +3116,9 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused,
        switchdev_work->event = event;
 
        switch (event) {
-       case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
-       case SWITCHDEV_FDB_DEL_TO_DEVICE: /* fall through */
-       case SWITCHDEV_FDB_ADD_TO_BRIDGE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_DEVICE:
+       case SWITCHDEV_FDB_DEL_TO_DEVICE:
+       case SWITCHDEV_FDB_ADD_TO_BRIDGE:
        case SWITCHDEV_FDB_DEL_TO_BRIDGE:
                fdb_info = container_of(info,
                                        struct switchdev_notifier_fdb_info,
@@ -3138,7 +3138,7 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused,
                 */
                dev_hold(dev);
                break;
-       case SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE: /* fall through */
+       case SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE:
                INIT_WORK(&switchdev_work->work,
                          mlxsw_sp_switchdev_vxlan_fdb_event_work);
index c533d06..dcde496 100644 (file)
@@ -548,7 +548,7 @@ static int lan743x_ethtool_get_rxnfc(struct net_device *netdev,
                case TCP_V4_FLOW:case UDP_V4_FLOW:
                case TCP_V6_FLOW:case UDP_V6_FLOW:
                        rxnfc->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       /* fall through */
+                       fallthrough;
                case IPV4_FLOW: case IPV6_FLOW:
                        rxnfc->data |= RXH_IP_SRC | RXH_IP_DST;
                        return 0;
index 867c680..5abb7d2 100644 (file)
@@ -859,7 +859,7 @@ void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state)
        switch (state) {
        case BR_STATE_FORWARDING:
                ocelot->bridge_fwd_mask |= BIT(port);
-               /* Fallthrough */
+               fallthrough;
        case BR_STATE_LEARNING:
                port_cfg |= ANA_PORT_PORT_CFG_LEARN_ENA;
                break;
index c2867fe..3de8430 100644 (file)
@@ -3081,7 +3081,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = np->phy_addr_external;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                /* The phy_id is not enough to uniquely identify
index 4f1f90f..78eba10 100644 (file)
@@ -3768,20 +3768,20 @@ vxge_hw_rts_rth_data0_data1_get(u32 j, u64 *data0, u64 *data1,
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM0_ENTRY_EN |
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM0_BUCKET_DATA(
                        itable[j]);
-               /* fall through */
+               fallthrough;
        case 2:
                *data0 |=
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM1_BUCKET_NUM(j)|
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM1_ENTRY_EN |
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM1_BUCKET_DATA(
                        itable[j]);
-               /* fall through */
+               fallthrough;
        case 3:
                *data1 = VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM0_BUCKET_NUM(j)|
                        VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM0_ENTRY_EN |
                        VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM0_BUCKET_DATA(
                        itable[j]);
-               /* fall through */
+               fallthrough;
        case 4:
                *data1 |=
                        VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM1_BUCKET_NUM(j)|
index 7c50e3d..76c51da 100644 (file)
@@ -296,7 +296,7 @@ nfp_net_tls_add(struct net_device *netdev, struct sock *sk,
                        break;
                }
 #endif
-               /* fall through */
+               fallthrough;
        case AF_INET:
                req_sz = sizeof(struct nfp_crypto_req_add_v4);
                ipv6 = false;
index ff844e5..1cbe2c9 100644 (file)
@@ -297,7 +297,7 @@ nfp_fl_get_tun_from_act(struct nfp_app *app,
        case htons(GENEVE_UDP_PORT):
                if (priv->flower_ext_feats & NFP_FL_FEATS_GENEVE)
                        return NFP_FL_TUNNEL_GENEVE;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                return NFP_FL_TUNNEL_NONE;
        }
index a050cb8..f21cf1f 100644 (file)
@@ -289,7 +289,7 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb)
                        skb_stored = nfp_flower_lag_unprocessed_msg(app, skb);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
 err_default:
                nfp_flower_cmsg_warn(app, "Cannot handle invalid repr control type %u\n",
index 4651fe4..36356f9 100644 (file)
@@ -784,7 +784,7 @@ nfp_flower_copy_pre_actions(char *act_dst, char *act_src, int len,
                case NFP_FL_ACTION_OPCODE_PRE_TUNNEL:
                        if (tunnel_act)
                                *tunnel_act = true;
-                       /* fall through */
+                       fallthrough;
                case NFP_FL_ACTION_OPCODE_PRE_LAG:
                        memcpy(act_dst + act_off, act_src + act_off, act_len);
                        break;
index b04b836..2643ea5 100644 (file)
@@ -137,7 +137,7 @@ static u16 nfp_swreg_to_unreg(swreg reg, bool is_dst)
                                val;
                case NN_LM_MOD_DEC:
                        lm_dec = true;
-                       /* fall through */
+                       fallthrough;
                case NN_LM_MOD_INC:
                        if (val) {
                                pr_err("LM offset in inc/dev mode\n");
index 39ee23e..21ea226 100644 (file)
@@ -1940,10 +1940,10 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
                                continue;
                        default:
                                bpf_warn_invalid_xdp_action(act);
-                               /* fall through */
+                               fallthrough;
                        case XDP_ABORTED:
                                trace_xdp_exception(dp->netdev, xdp_prog, act);
-                               /* fall through */
+                               fallthrough;
                        case XDP_DROP:
                                nfp_net_rx_give_one(dp, rx_ring, rxbuf->frag,
                                                    rxbuf->dma_addr);
index a486008..252fe06 100644 (file)
@@ -340,12 +340,12 @@ static int matching_bar(struct nfp_bar *bar, u32 tgt, u32 act, u32 tok,
        switch (maptype) {
        case NFP_PCIE_BAR_PCIE2CPP_MapType_TARGET:
                bartok = -1;
-               /* FALLTHROUGH */
+               fallthrough;
        case NFP_PCIE_BAR_PCIE2CPP_MapType_BULK:
                baract = NFP_CPP_ACTION_RW;
                if (act == 0)
                        act = NFP_CPP_ACTION_RW;
-               /* FALLTHROUGH */
+               fallthrough;
        case NFP_PCIE_BAR_PCIE2CPP_MapType_FIXED:
                break;
        default:
index 75f0124..2260c24 100644 (file)
@@ -213,7 +213,7 @@ u64 nfp_rtsym_size(const struct nfp_rtsym *sym)
                return 0;
        default:
                pr_warn("rtsym '%s': unknown type: %d\n", sym->name, sym->type);
-               /* fall through */
+               fallthrough;
        case NFP_RTSYM_TYPE_OBJECT:
        case NFP_RTSYM_TYPE_FUNCTION:
                return sym->size;
index a26966f..dceec80 100644 (file)
@@ -410,7 +410,7 @@ static void pch_gbe_check_copper_options(struct pch_gbe_adapter *adapter)
        case SPEED_1000 + HALF_DUPLEX:
                netdev_dbg(adapter->netdev,
                           "Half Duplex is not supported at 1000 Mbps\n");
-               /* fall through */
+               fallthrough;
        case SPEED_1000 + FULL_DUPLEX:
 full_duplex_only:
                netdev_dbg(adapter->netdev,
index 647a143..3da0753 100644 (file)
@@ -1356,7 +1356,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = np->phys[0] & 0x1f;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f, data->reg_num & 0x1f);
index 66f45fc..c3f50dd 100644 (file)
@@ -153,7 +153,7 @@ skip:
        case NETXEN_BRDTYPE_P3_4_GB_MM:
                supported |= SUPPORTED_Autoneg;
                advertising |= ADVERTISED_Autoneg;
-               /* fall through */
+               fallthrough;
        case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
        case NETXEN_BRDTYPE_P3_10G_CX4:
        case NETXEN_BRDTYPE_P3_10G_CX4_LP:
@@ -182,7 +182,7 @@ skip:
                supported |= SUPPORTED_TP;
                check_sfp_module = netif_running(dev) &&
                        adapter->has_link_events;
-               /* fall through */
+               fallthrough;
        case NETXEN_BRDTYPE_P2_SB31_10G:
        case NETXEN_BRDTYPE_P3_10G_XFP:
                supported |= SUPPORTED_FIBRE;
index 876743a..0e4cd88 100644 (file)
@@ -2046,7 +2046,7 @@ int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn, u32 rdma_tasks)
                                               rdma_tasks);
                /* no need for break since RoCE coexist with Ethernet */
        }
-       /* fall through */
+               fallthrough;
        case QED_PCI_ETH:
        {
                struct qed_eth_pf_params *p_params =
index b3c9eba..b8f076e 100644 (file)
@@ -3109,14 +3109,14 @@ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params)
                                                p_hwfn->hw_info.hw_mode);
                        if (rc)
                                break;
-               /* Fall through */
+                       fallthrough;
                case FW_MSG_CODE_DRV_LOAD_PORT:
                        rc = qed_hw_init_port(p_hwfn, p_hwfn->p_main_ptt,
                                              p_hwfn->hw_info.hw_mode);
                        if (rc)
                                break;
 
-               /* Fall through */
+                       fallthrough;
                case FW_MSG_CODE_DRV_LOAD_FUNCTION:
                        rc = qed_hw_init_pf(p_hwfn, p_hwfn->p_main_ptt,
                                            p_params->p_tunn,
index 2558cb6..f39f629 100644 (file)
@@ -761,7 +761,7 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
                kfree(int_params->msix_table);
                if (force_mode)
                        goto out;
-               /* Fallthrough */
+               fallthrough;
 
        case QED_INT_MODE_MSI:
                if (cdev->num_hwfns == 1) {
@@ -775,7 +775,7 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
                        if (force_mode)
                                goto out;
                }
-               /* Fallthrough */
+               fallthrough;
 
        case QED_INT_MODE_INTA:
                        int_params->out.int_mode = QED_INT_MODE_INTA;
index 5be08f8..cd882c4 100644 (file)
@@ -1085,7 +1085,7 @@ int qed_mcp_unload_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
                DP_NOTICE(p_hwfn,
                          "Unknown WoL configuration %02x\n",
                          p_hwfn->cdev->wol_config);
-               /* Fallthrough */
+               fallthrough;
        case QED_OV_WOL_DEFAULT:
                wol_param = DRV_MB_PARAM_UNLOAD_WOL_MCP;
        }
@@ -1365,7 +1365,7 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
                break;
        case LINK_STATUS_SPEED_AND_DUPLEX_1000THD:
                p_link->full_duplex = false;
-       /* Fall-through */
+               fallthrough;
        case LINK_STATUS_SPEED_AND_DUPLEX_1000TFD:
                p_link->speed = 1000;
                break;
@@ -2451,7 +2451,7 @@ qed_mcp_get_shmem_proto(struct qed_hwfn *p_hwfn,
                break;
        case FUNC_MF_CFG_PROTOCOL_ROCE:
                DP_NOTICE(p_hwfn, "RoCE personality is not a valid value!\n");
-       /* Fallthrough */
+               fallthrough;
        default:
                rc = -EINVAL;
        }
@@ -3546,7 +3546,7 @@ qed_mcp_resc_allocation_msg(struct qed_hwfn *p_hwfn,
        switch (p_in_params->cmd) {
        case DRV_MSG_SET_RESOURCE_VALUE_MSG:
                mfw_resc_info.size = p_in_params->resc_max_val;
-               /* Fallthrough */
+               fallthrough;
        case DRV_MSG_GET_RESOURCE_ALLOC_MSG:
                break;
        default:
@@ -3823,7 +3823,7 @@ qed_mcp_resc_unlock(struct qed_hwfn *p_hwfn,
                DP_INFO(p_hwfn,
                        "Resource unlock request for an already released resource [%d]\n",
                        p_params->resource);
-               /* Fallthrough */
+               fallthrough;
        case RESOURCE_OPCODE_RELEASED:
                p_params->b_released = true;
                break;
index 0d0e38d..569e2a7 100644 (file)
@@ -1542,7 +1542,7 @@ static void ql_link_state_machine_work(struct work_struct *work)
                if (test_bit(QL_LINK_MASTER, &qdev->flags))
                        ql_port_start(qdev);
                qdev->port_link_state = LS_DOWN;
-               /* Fall Through */
+               fallthrough;
 
        case LS_DOWN:
                if (curr_link_state == LS_UP) {
index 5c2a3ac..b9894d5 100644 (file)
@@ -353,7 +353,7 @@ skip:
        case QLCNIC_BRDTYPE_P3P_4_GB_MM:
                supported |= SUPPORTED_Autoneg;
                advertising |= ADVERTISED_Autoneg;
-               /* fall through */
+               fallthrough;
        case QLCNIC_BRDTYPE_P3P_10G_CX4:
        case QLCNIC_BRDTYPE_P3P_10G_CX4_LP:
        case QLCNIC_BRDTYPE_P3P_10000_BASE_T:
@@ -377,7 +377,7 @@ skip:
                supported |= SUPPORTED_TP;
                check_sfp_module = netif_running(adapter->netdev) &&
                                   ahw->has_link_events;
-               /* fall through */
+               fallthrough;
        case QLCNIC_BRDTYPE_P3P_10G_XFP:
                supported |= SUPPORTED_FIBRE;
                advertising |= ADVERTISED_FIBRE;
index d1da92a..fc9e662 100644 (file)
@@ -4994,7 +4994,7 @@ static int rtl_alloc_irq(struct rtl8169_private *tp)
                rtl_unlock_config_regs(tp);
                RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable);
                rtl_lock_config_regs(tp);
-               /* fall through */
+               fallthrough;
        case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_17:
                flags = PCI_IRQ_LEGACY;
                break;
@@ -5137,7 +5137,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
        switch (tp->mac_version) {
        case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52:
                rtl8168ep_stop_cmac(tp);
-               /* fall through */
+               fallthrough;
        case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48:
                rtl_hw_init_8168g(tp);
                break;
index fc99e71..42458a4 100644 (file)
@@ -2169,7 +2169,7 @@ static void rocker_router_fib_event_work(struct work_struct *work)
                rocker_world_fib4_del(rocker, &fib_work->fen_info);
                fib_info_put(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                rule = fib_work->fr_info.rule;
                if (!fib4_rule_default(rule))
@@ -2201,7 +2201,7 @@ static int rocker_router_fib_event(struct notifier_block *nb,
        fib_work->event = event;
 
        switch (event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_DEL:
                if (info->family == AF_INET) {
                        struct fib_entry_notifier_info *fen_info = ptr;
@@ -2224,7 +2224,7 @@ static int rocker_router_fib_event(struct notifier_block *nb,
                 */
                fib_info_hold(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                memcpy(&fib_work->fr_info, ptr, sizeof(fib_work->fr_info));
                fib_rule_get(fib_work->fr_info.rule);
@@ -2811,7 +2811,7 @@ static int rocker_switchdev_event(struct notifier_block *unused,
        switchdev_work->event = event;
 
        switch (event) {
-       case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_FDB_DEL_TO_DEVICE:
                memcpy(&switchdev_work->fdb_info, ptr,
                       sizeof(switchdev_work->fdb_info));
index 21465cb..7f8b10c 100644 (file)
@@ -316,7 +316,7 @@ static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv,
        case TCP_V4_FLOW:
        case UDP_V4_FLOW:
                cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case SCTP_V4_FLOW:
        case AH_ESP_V4_FLOW:
        case AH_V4_FLOW:
@@ -327,7 +327,7 @@ static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv,
        case TCP_V6_FLOW:
        case UDP_V6_FLOW:
                cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case SCTP_V6_FLOW:
        case AH_ESP_V6_FLOW:
        case AH_V6_FLOW:
index 9729983..c54b7f8 100644 (file)
@@ -142,7 +142,7 @@ static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_locatio
 
                /* Temporarily map new BAR. */
                rc = efx_init_io(efx, bar,
-                                DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+                                (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
                                 pci_resource_len(efx->pci_dev, bar));
                if (rc) {
                        netif_err(efx, probe, efx->net_dev,
@@ -160,7 +160,7 @@ static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_locatio
 
                /* Put old BAR back. */
                rc = efx_init_io(efx, previous_bar,
-                                DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+                                (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
                                 pci_resource_len(efx->pci_dev, previous_bar));
                if (rc) {
                        netif_err(efx, probe, efx->net_dev,
@@ -334,7 +334,7 @@ static int ef100_pci_parse_xilinx_cap(struct efx_nic *efx, int vndr_cap,
 
        /* Temporarily map BAR. */
        rc = efx_init_io(efx, bar,
-                        DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+                        (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
                         pci_resource_len(efx->pci_dev, bar));
        if (rc) {
                netif_err(efx, probe, efx->net_dev,
@@ -495,7 +495,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
 
        /* Set up basic I/O (BAR mappings etc) */
        rc = efx_init_io(efx, fcw.bar,
-                        DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
+                        (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH),
                         pci_resource_len(efx->pci_dev, fcw.bar));
        if (rc)
                goto fail;
index 206d70f..19fe86b 100644 (file)
@@ -431,18 +431,18 @@ static int ef100_reset(struct efx_nic *efx, enum reset_type reset_type)
                /* A RESET_TYPE_ALL will cause filters to be removed, so we remove filters
                 * and reprobe after reset to avoid removing filters twice
                 */
-               down_read(&efx->filter_sem);
+               down_write(&efx->filter_sem);
                ef100_filter_table_down(efx);
-               up_read(&efx->filter_sem);
+               up_write(&efx->filter_sem);
                rc = efx_mcdi_reset(efx, reset_type);
                if (rc)
                        return rc;
 
                netif_device_attach(efx->net_dev);
 
-               down_read(&efx->filter_sem);
+               down_write(&efx->filter_sem);
                rc = ef100_filter_table_up(efx);
-               up_read(&efx->filter_sem);
+               up_write(&efx->filter_sem);
                if (rc)
                        return rc;
 
@@ -739,6 +739,7 @@ const struct efx_nic_type ef100_pf_nic_type = {
        .rx_remove = efx_mcdi_rx_remove,
        .rx_write = ef100_rx_write,
        .rx_packet = __ef100_rx_packet,
+       .rx_buf_hash_valid = ef100_rx_buf_hash_valid,
        .fini_dmaq = efx_fini_dmaq,
        .max_rx_ip_filters = EFX_MCDI_FILTER_TBL_ROWS,
        .filter_table_probe = ef100_filter_table_up,
@@ -820,6 +821,7 @@ const struct efx_nic_type ef100_vf_nic_type = {
        .rx_remove = efx_mcdi_rx_remove,
        .rx_write = ef100_rx_write,
        .rx_packet = __ef100_rx_packet,
+       .rx_buf_hash_valid = ef100_rx_buf_hash_valid,
        .fini_dmaq = efx_fini_dmaq,
        .max_rx_ip_filters = EFX_MCDI_FILTER_TBL_ROWS,
        .filter_table_probe = ef100_filter_table_up,
index 13ba1a4..012925e 100644 (file)
 #define ESF_GZ_RX_PREFIX_NT_OR_INNER_L3_CLASS_WIDTH    \
                ESF_GZ_RX_PREFIX_HCLASS_NT_OR_INNER_L3_CLASS_WIDTH
 
+bool ef100_rx_buf_hash_valid(const u8 *prefix)
+{
+       return PREFIX_FIELD(prefix, RSS_HASH_VALID);
+}
+
 static bool check_fcs(struct efx_channel *channel, u32 *prefix)
 {
        u16 rxclass;
index f2f2668..fe45b36 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "net_driver.h"
 
+bool ef100_rx_buf_hash_valid(const u8 *prefix);
 void efx_ef100_ev_rx(struct efx_channel *channel, const efx_qword_t *p_event);
 void ef100_rx_write(struct efx_rx_queue *rx_queue);
 void __ef100_rx_packet(struct efx_channel *channel);
index a9808e8..daf0c00 100644 (file)
@@ -45,6 +45,14 @@ static inline void efx_rx_flush_packet(struct efx_channel *channel)
                                __ef100_rx_packet, __efx_rx_packet,
                                channel);
 }
+static inline bool efx_rx_buf_hash_valid(struct efx_nic *efx, const u8 *prefix)
+{
+       if (efx->type->rx_buf_hash_valid)
+               return INDIRECT_CALL_1(efx->type->rx_buf_hash_valid,
+                                      ef100_rx_buf_hash_valid,
+                                      prefix);
+       return true;
+}
 
 /* Maximum number of TCP segments we support for soft-TSO */
 #define EFX_TSO_MAX_SEGS       100
index db90d94..a6bae6a 100644 (file)
@@ -957,7 +957,7 @@ ef4_ethtool_get_rxnfc(struct net_device *net_dev,
                switch (info->flow_type) {
                case TCP_V4_FLOW:
                        info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       /* Fall through */
+                       fallthrough;
                case UDP_V4_FLOW:
                case SCTP_V4_FLOW:
                case AH_ESP_V4_FLOW:
index 3321832..fa1ade8 100644 (file)
@@ -1049,10 +1049,10 @@ ef4_farch_handle_rx_event(struct ef4_channel *channel, const ef4_qword_t *event)
                switch (rx_ev_hdr_type) {
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP:
                        flags |= EF4_RX_PKT_TCP;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP:
                        flags |= EF4_RX_PKT_CSUMMED;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_OTHER:
                case FSE_AZ_RX_EV_HDR_TYPE_OTHER:
                        break;
@@ -1310,7 +1310,7 @@ int ef4_farch_ev_process(struct ef4_channel *channel, int budget)
                        if (efx->type->handle_global_event &&
                            efx->type->handle_global_event(channel, &event))
                                break;
-                       /* else fall through */
+                       fallthrough;
                default:
                        netif_err(channel->efx, hw, channel->efx->net_dev,
                                  "channel %d unknown event type %d (data "
@@ -1983,7 +1983,7 @@ ef4_farch_filter_from_gen_spec(struct ef4_farch_filter_spec *spec,
              EF4_FILTER_MATCH_LOC_HOST | EF4_FILTER_MATCH_LOC_PORT |
              EF4_FILTER_MATCH_REM_HOST | EF4_FILTER_MATCH_REM_PORT):
                is_full = true;
-               /* fall through */
+               fallthrough;
        case (EF4_FILTER_MATCH_ETHER_TYPE | EF4_FILTER_MATCH_IP_PROTO |
              EF4_FILTER_MATCH_LOC_HOST | EF4_FILTER_MATCH_LOC_PORT): {
                __be32 rhost, host1, host2;
@@ -2034,7 +2034,7 @@ ef4_farch_filter_from_gen_spec(struct ef4_farch_filter_spec *spec,
 
        case EF4_FILTER_MATCH_LOC_MAC | EF4_FILTER_MATCH_OUTER_VID:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EF4_FILTER_MATCH_LOC_MAC:
                spec->type = (is_full ? EF4_FARCH_FILTER_MAC_FULL :
                              EF4_FARCH_FILTER_MAC_WILD);
@@ -2081,7 +2081,7 @@ ef4_farch_filter_to_gen_spec(struct ef4_filter_spec *gen_spec,
        case EF4_FARCH_FILTER_TCP_FULL:
        case EF4_FARCH_FILTER_UDP_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EF4_FARCH_FILTER_TCP_WILD:
        case EF4_FARCH_FILTER_UDP_WILD: {
                __be32 host1, host2;
@@ -2125,7 +2125,7 @@ ef4_farch_filter_to_gen_spec(struct ef4_filter_spec *gen_spec,
 
        case EF4_FARCH_FILTER_MAC_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EF4_FARCH_FILTER_MAC_WILD:
                gen_spec->match_flags = EF4_FILTER_MATCH_LOC_MAC;
                if (is_full)
index d07eeaa..4002f9a 100644 (file)
@@ -1038,10 +1038,10 @@ efx_farch_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event)
                switch (rx_ev_hdr_type) {
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP:
                        flags |= EFX_RX_PKT_TCP;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP:
                        flags |= EFX_RX_PKT_CSUMMED;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_OTHER:
                case FSE_AZ_RX_EV_HDR_TYPE_OTHER:
                        break;
@@ -1316,7 +1316,7 @@ int efx_farch_ev_process(struct efx_channel *channel, int budget)
                        if (efx->type->handle_global_event &&
                            efx->type->handle_global_event(channel, &event))
                                break;
-                       /* else fall through */
+                       fallthrough;
                default:
                        netif_err(channel->efx, hw, channel->efx->net_dev,
                                  "channel %d unknown event type %d (data "
@@ -2043,7 +2043,7 @@ efx_farch_filter_from_gen_spec(struct efx_farch_filter_spec *spec,
              EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT |
              EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT):
                is_full = true;
-               /* fall through */
+               fallthrough;
        case (EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
              EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT): {
                __be32 rhost, host1, host2;
@@ -2094,7 +2094,7 @@ efx_farch_filter_from_gen_spec(struct efx_farch_filter_spec *spec,
 
        case EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_OUTER_VID:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EFX_FILTER_MATCH_LOC_MAC:
                spec->type = (is_full ? EFX_FARCH_FILTER_MAC_FULL :
                              EFX_FARCH_FILTER_MAC_WILD);
@@ -2141,7 +2141,7 @@ efx_farch_filter_to_gen_spec(struct efx_filter_spec *gen_spec,
        case EFX_FARCH_FILTER_TCP_FULL:
        case EFX_FARCH_FILTER_UDP_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EFX_FARCH_FILTER_TCP_WILD:
        case EFX_FARCH_FILTER_UDP_WILD: {
                __be32 host1, host2;
@@ -2185,7 +2185,7 @@ efx_farch_filter_to_gen_spec(struct efx_filter_spec *gen_spec,
 
        case EFX_FARCH_FILTER_MAC_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EFX_FARCH_FILTER_MAC_WILD:
                gen_spec->match_flags = EFX_FILTER_MATCH_LOC_MAC;
                if (is_full)
index 5a74d88..1523be7 100644 (file)
@@ -140,7 +140,7 @@ efx_mcdi_filter_push_prep_set_match_fields(struct efx_nic *efx,
                switch (encap_type & EFX_ENCAP_TYPES_MASK) {
                case EFX_ENCAP_TYPE_VXLAN:
                        vni_type = MC_CMD_FILTER_OP_EXT_IN_VNI_TYPE_VXLAN;
-                       /* fallthrough */
+                       fallthrough;
                case EFX_ENCAP_TYPE_GENEVE:
                        COPY_VALUE(ether_type, ETHER_TYPE);
                        outer_ip_proto = IPPROTO_UDP;
index 56af8b5..714d7f9 100644 (file)
@@ -282,7 +282,7 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx,
                break;
        default:
                WARN_ON(1);
-               /* Fall through */
+               fallthrough;
        case MC_CMD_FCNTL_OFF:
                link_state->fc = 0;
                break;
index 7bb7ecb..062462a 100644 (file)
@@ -846,6 +846,7 @@ struct efx_async_filter_insertion {
  * @timer_quantum_ns: Interrupt timer quantum, in nanoseconds
  * @timer_max_ns: Interrupt timer maximum value, in nanoseconds
  * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
+ * @irqs_hooked: Channel interrupts are hooked
  * @irq_rx_mod_step_us: Step size for IRQ moderation for RX event queues
  * @irq_rx_moderation_us: IRQ moderation time for RX event queues
  * @msg_enable: Log message enable flags
@@ -1004,6 +1005,7 @@ struct efx_nic {
        unsigned int timer_quantum_ns;
        unsigned int timer_max_ns;
        bool irq_rx_adaptive;
+       bool irqs_hooked;
        unsigned int irq_mod_step_us;
        unsigned int irq_rx_moderation_us;
        u32 msg_enable;
@@ -1265,6 +1267,7 @@ struct efx_udp_tunnel {
  * @rx_write: Write RX descriptors and doorbell
  * @rx_defer_refill: Generate a refill reminder event
  * @rx_packet: Receive the queued RX buffer on a channel
+ * @rx_buf_hash_valid: Determine whether the RX prefix contains a valid hash
  * @ev_probe: Allocate resources for event queue
  * @ev_init: Initialise event queue on the NIC
  * @ev_fini: Deinitialise event queue on the NIC
@@ -1409,6 +1412,7 @@ struct efx_nic_type {
        void (*rx_write)(struct efx_rx_queue *rx_queue);
        void (*rx_defer_refill)(struct efx_rx_queue *rx_queue);
        void (*rx_packet)(struct efx_channel *channel);
+       bool (*rx_buf_hash_valid)(const u8 *prefix);
        int (*ev_probe)(struct efx_channel *channel);
        int (*ev_init)(struct efx_channel *channel);
        void (*ev_fini)(struct efx_channel *channel);
index d994d13..d1e9088 100644 (file)
@@ -129,6 +129,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx)
 #endif
        }
 
+       efx->irqs_hooked = true;
        return 0;
 
  fail2:
@@ -154,6 +155,8 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
        efx->net_dev->rx_cpu_rmap = NULL;
 #endif
 
+       if (!efx->irqs_hooked)
+               return;
        if (EFX_INT_MODE_USE_MSI(efx)) {
                /* Disable MSI/MSI-X interrupts */
                efx_for_each_channel(channel, efx)
@@ -163,6 +166,7 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
                /* Disable legacy interrupt */
                free_irq(efx->legacy_irq, efx);
        }
+       efx->irqs_hooked = false;
 }
 
 /* Register dump */
index 59a43d5..aaa1128 100644 (file)
@@ -358,7 +358,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
 
        case XDP_ABORTED:
                trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
-               /* Fall through */
+               fallthrough;
        case XDP_DROP:
                efx_free_rx_buffers(rx_queue, rx_buf, 1);
                channel->n_rx_xdp_drops++;
index fb77c7b..5e29284 100644 (file)
@@ -525,7 +525,8 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
                return;
        }
 
-       if (efx->net_dev->features & NETIF_F_RXHASH)
+       if (efx->net_dev->features & NETIF_F_RXHASH &&
+           efx_rx_buf_hash_valid(efx, eh))
                skb_set_hash(skb, efx_rx_buf_hash(efx, eh),
                             PKT_HASH_TYPE_L3);
        if (csum) {
@@ -848,6 +849,7 @@ void efx_remove_filters(struct efx_nic *efx)
        efx_for_each_channel(channel, efx) {
                cancel_delayed_work_sync(&channel->filter_work);
                kfree(channel->rps_flow_id);
+               channel->rps_flow_id = NULL;
        }
 #endif
        down_write(&efx->filter_sem);
index 336105f..cfa460c 100644 (file)
@@ -2228,7 +2228,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = sis_priv->mii->phy_addr;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                data->val_out = mdio_read(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f);
index 186c0bd..01069df 100644 (file)
@@ -712,7 +712,7 @@ static void smc911x_phy_detect(struct net_device *dev)
                                        /* Found an external PHY */
                                        break;
                        }
-                       /* Else, fall through */
+                       fallthrough;
                default:
                        /* Internal media only */
                        SMC_GET_PHY_ID1(lp, 1, id1);
index 25db667..806eb65 100644 (file)
@@ -919,10 +919,10 @@ static u32 netsec_run_xdp(struct netsec_priv *priv, struct bpf_prog *prog,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(priv->ndev, prog, act);
-               /* fall through -- handle aborts by dropping packet */
+               fallthrough;    /* handle aborts by dropping packet */
        case XDP_DROP:
                ret = NETSEC_XDP_CONSUMED;
                page = virt_to_head_page(xdp->data);
index d0d2d0f..08c7663 100644 (file)
@@ -84,9 +84,10 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
                return ERR_PTR(err);
 
        switch (phy_mode) {
-       case PHY_INTERFACE_MODE_RGMII:          /* Fall through */
-       case PHY_INTERFACE_MODE_RGMII_ID        /* Fall through */:
-       case PHY_INTERFACE_MODE_RGMII_RXID:     /* Fall through */
+       case PHY_INTERFACE_MODE_RGMII:
+               fallthrough;
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_RGMII_RXID:
        case PHY_INTERFACE_MODE_RGMII_TXID:
                gmac->phy_intf_sel = GMAC_CONFIG_INTF_RGMII;
                break;
index e113b13..bf195ad 100644 (file)
@@ -1985,7 +1985,7 @@ void stmmac_selftest_run(struct net_device *dev,
                                ret = phy_loopback(dev->phydev, true);
                        if (!ret)
                                break;
-                       /* Fallthrough */
+                       fallthrough;
                case STMMAC_LOOPBACK_MAC:
                        ret = stmmac_set_mac_loopback(priv, priv->ioaddr, true);
                        break;
@@ -2018,7 +2018,7 @@ void stmmac_selftest_run(struct net_device *dev,
                                ret = phy_loopback(dev->phydev, false);
                        if (!ret)
                                break;
-                       /* Fallthrough */
+                       fallthrough;
                case STMMAC_LOOPBACK_MAC:
                        stmmac_set_mac_loopback(priv, priv->ioaddr, false);
                        break;
index 3d74784..cc27d66 100644 (file)
@@ -228,7 +228,7 @@ static int tc_setup_cls_u32(struct stmmac_priv *priv,
        switch (cls->command) {
        case TC_CLSU32_REPLACE_KNODE:
                tc_unfill_entry(priv, cls);
-               /* Fall through */
+               fallthrough;
        case TC_CLSU32_NEW_KNODE:
                return tc_config_knode(priv, cls);
        case TC_CLSU32_DELETE_KNODE:
index e2bc7a2..b624e17 100644 (file)
@@ -4759,7 +4759,7 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = cp->phy_addr;
-               /* Fallthrough... */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                spin_lock_irqsave(&cp->lock, flags);
index 9b5effb..68695d4 100644 (file)
@@ -8835,7 +8835,7 @@ static int walk_phys(struct niu *np, struct niu_parent *parent)
                        else
                                goto unknown_vg_1g_port;
 
-                       /* fallthru */
+                       fallthrough;
                case 0x22:
                        val = (phy_encode(PORT_TYPE_10G, 0) |
                               phy_encode(PORT_TYPE_10G, 1) |
@@ -8860,7 +8860,7 @@ static int walk_phys(struct niu *np, struct niu_parent *parent)
                        else
                                goto unknown_vg_1g_port;
 
-                       /* fallthru */
+                       fallthrough;
                case 0x13:
                        if ((lowest_10g & 0x7) == 0)
                                val = (phy_encode(PORT_TYPE_10G, 0) |
index eeb8518..8deb943 100644 (file)
@@ -2712,7 +2712,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = gp->mii_phy_addr;
-               /* Fallthrough... */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                data->val_out = __sungem_phy_read(gp, data->phy_id & 0x1f,
index 4e184ee..6e72ecb 100644 (file)
@@ -67,7 +67,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv,
                dev_warn(priv->dev,
                         "Unsupported PHY mode: \"%s\". Defaulting to MII.\n",
                        phy_modes(phy_mode));
-               /* fallthrough */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
                mode = AM33XX_GMII_SEL_MODE_MII;
                break;
@@ -122,7 +122,7 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv,
                dev_warn(priv->dev,
                         "Unsupported PHY mode: \"%s\". Defaulting to MII.\n",
                        phy_modes(phy_mode));
-               /* fallthrough */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
                mode = AM33XX_GMII_SEL_MODE_MII;
                break;
index d6d7a7d..482a1a4 100644 (file)
@@ -1371,10 +1371,10 @@ int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(ndev, prog, act);
-               /* fall through -- handle aborts by dropping packet */
+               fallthrough;    /* handle aborts by dropping packet */
        case XDP_DROP:
                goto drop;
        }
index 58623e9..76a342e 100644 (file)
@@ -948,7 +948,7 @@ static int tlan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:               /* get address of MII PHY in use. */
                data->phy_id = phy;
-               /* fall through */
+               fallthrough;
 
 
        case SIOCGMIIREG:               /* read MII PHY register. */
index 2db546b..dc14a66 100644 (file)
@@ -877,7 +877,7 @@ static int gelic_wl_set_auth(struct net_device *netdev,
        case IW_AUTH_KEY_MGMT:
                if (param->value & IW_AUTH_KEY_MGMT_PSK)
                        break;
-               /* intentionally fall through */
+               fallthrough;
        default:
                ret = -EOPNOTSUPP;
                break;
index 0738970..5f5b33e 100644 (file)
@@ -786,7 +786,7 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
                        /* fallthrough, if we release the descriptors
                         * brutally (then we don't care about
                         * SPIDER_NET_DESCR_CARDOWNED) */
-                       /* Fall through */
+                       fallthrough;
 
                case SPIDER_NET_DESCR_RESPONSE_ERROR:
                case SPIDER_NET_DESCR_PROTECTION_ERROR:
@@ -1397,9 +1397,9 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                show_error = 0;
                break;
 
-       case SPIDER_NET_GDDDEN0INT: /* fallthrough */
-       case SPIDER_NET_GDCDEN0INT: /* fallthrough */
-       case SPIDER_NET_GDBDEN0INT: /* fallthrough */
+       case SPIDER_NET_GDDDEN0INT:
+       case SPIDER_NET_GDCDEN0INT:
+       case SPIDER_NET_GDBDEN0INT:
        case SPIDER_NET_GDADEN0INT:
                /* someone has set RX_DMA_EN to 0 */
                show_error = 0;
@@ -1449,10 +1449,10 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                 * Logging is not needed. */
                show_error = 0;
                break;
-       case SPIDER_NET_GRFDFLLINT: /* fallthrough */
-       case SPIDER_NET_GRFCFLLINT: /* fallthrough */
-       case SPIDER_NET_GRFBFLLINT: /* fallthrough */
-       case SPIDER_NET_GRFAFLLINT: /* fallthrough */
+       case SPIDER_NET_GRFDFLLINT:
+       case SPIDER_NET_GRFCFLLINT:
+       case SPIDER_NET_GRFBFLLINT:
+       case SPIDER_NET_GRFAFLLINT:
        case SPIDER_NET_GRMFLLINT:
                /* Could happen when rx chain is full */
                if (card->ignore_rx_ramfull == 0) {
@@ -1473,9 +1473,9 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                break;
 
        /* chain end */
-       case SPIDER_NET_GDDDCEINT: /* fallthrough */
-       case SPIDER_NET_GDCDCEINT: /* fallthrough */
-       case SPIDER_NET_GDBDCEINT: /* fallthrough */
+       case SPIDER_NET_GDDDCEINT:
+       case SPIDER_NET_GDCDCEINT:
+       case SPIDER_NET_GDBDCEINT:
        case SPIDER_NET_GDADCEINT:
                spider_net_resync_head_ptr(card);
                spider_net_refill_rx_chain(card);
@@ -1486,9 +1486,9 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                break;
 
        /* invalid descriptor */
-       case SPIDER_NET_GDDINVDINT: /* fallthrough */
-       case SPIDER_NET_GDCINVDINT: /* fallthrough */
-       case SPIDER_NET_GDBINVDINT: /* fallthrough */
+       case SPIDER_NET_GDDINVDINT:
+       case SPIDER_NET_GDCINVDINT:
+       case SPIDER_NET_GDBINVDINT:
        case SPIDER_NET_GDAINVDINT:
                /* Could happen when rx chain is full */
                spider_net_resync_head_ptr(card);
index 3e3883a..3e33714 100644 (file)
@@ -1434,7 +1434,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
     switch(cmd) {
       case SIOCGMIIPHY:                /* Get the address of the PHY in use. */
        data->phy_id = 0;       /* we have only this address */
-       /* fall through */
+       fallthrough;
       case SIOCGMIIREG:                /* Read the specified MII register. */
        data->val_out = mii_rd(ioaddr, data->phy_id & 0x1f,
                               data->reg_num & 0x1f);
index e9bf429..4eea340 100644 (file)
 #define KERNEL
 #include "h/smtstate.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)cfm.c       2.18 98/10/06 (C) SK " ;
-#endif
-
 /*
  * FSM Macros
  */
@@ -208,7 +204,6 @@ void cfm(struct s_smc *smc, int event)
 {
        int     state ;         /* remember last state */
        int     cond ;
-       int     oldstate ;
 
        /* We will do the following: */
        /*  - compute the variable WC_Flag for every port (This is where */
@@ -222,7 +217,6 @@ void cfm(struct s_smc *smc, int event)
        /*  - change the portstates */
        cem_priv_state (smc, event);
 
-       oldstate = smc->mib.fddiSMTCF_State ;
        do {
                DB_CFM("CFM : state %s%s event %s",
                       smc->mib.fddiSMTCF_State & AFLAG ? "ACTIONS " : "",
@@ -250,18 +244,11 @@ void cfm(struct s_smc *smc, int event)
        if (cond != smc->mib.fddiSMTPeerWrapFlag)
                smt_srf_event(smc,SMT_COND_SMT_PEER_WRAP,0,cond) ;
 
-#if    0
        /*
-        * Don't send ever MAC_PATH_CHANGE events. Our MAC is hard-wired
+        * Don't ever send MAC_PATH_CHANGE events. Our MAC is hard-wired
         * to the primary path.
         */
-       /*
-        * path change
-        */
-       if (smc->mib.fddiSMTCF_State != oldstate) {
-               smt_srf_event(smc,SMT_EVENT_MAC_PATH_CHANGE,INDEX_MAC,0) ;
-       }
-#endif
+
 #endif /* no SLIM_SMT */
 
        /*
index 02966d1..4cbb145 100644 (file)
 #include <linux/bitrev.h>
 #include <linux/etherdevice.h>
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)fplustm.c   1.32 99/02/23 (C) SK " ;
-#endif
-
 #ifndef UNUSED
 #ifdef  lint
 #define UNUSED(x)      (x) = (x)
index 3412e0f..1070390 100644 (file)
  *
  ******************************************************************************/
 
-#ifndef        lint
-static char const ID_sccs[] = "@(#)hwmtm.c     1.40 99/05/31 (C) SK" ;
-#endif
-
 #define        HWMTM
 
 #ifndef FDDI
index 1be0395..554cde8 100644 (file)
@@ -847,7 +847,7 @@ static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd)
 
        case ACTIONS(PC5_SIGNAL) :
                ACTIONS_DONE() ;
-               /* fall through */
+               fallthrough;
        case PC5_SIGNAL :
                if ((cmd != PC_SIGNAL) && (cmd != PC_TIMEOUT_LCT))
                        break ;
@@ -946,7 +946,7 @@ static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd)
                SETMASK(PLC(np,PL_CNTRL_B),PL_PC_JOIN,PL_PC_JOIN) ;
                ACTIONS_DONE() ;
                cmd = 0 ;
-               /* fall thru */
+               fallthrough;
        case PC6_JOIN :
                switch (plc->p_state) {
                case PS_ACTIVE:
index b8c59d8..774a6e3 100644 (file)
 #define KERNEL
 #include "h/smtstate.h"
 
-#ifndef        lint
-static const char ID_sccs[] = "@(#)smt.c       2.43 98/11/23 (C) SK " ;
-#endif
-
 /*
  * FC in SMbuf
  */
@@ -1561,7 +1557,7 @@ u_long smt_get_tid(struct s_smc *smc)
        return tid & 0x3fffffffL;
 }
 
-
+#ifdef LITTLE_ENDIAN
 /*
  * table of parameter lengths
  */
@@ -1641,6 +1637,7 @@ static const struct smt_pdef {
 } ;
 
 #define N_SMT_PLEN     ARRAY_SIZE(smt_pdef)
+#endif
 
 int smt_check_para(struct s_smc *smc, struct smt_header        *sm,
                   const u_short list[])
index 8c810ed..4666226 100644 (file)
@@ -974,7 +974,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
                                FJES_RX_STOP_REQ_DONE;
                spin_unlock_irqrestore(&hw->rx_status_lock, flags);
                clear_bit(src_epid, &hw->txrx_stop_req_bit);
-               /* fall through */
+               fallthrough;
        case EP_PARTNER_UNSHARE:
        case EP_PARTNER_COMPLETE:
        default:
index 4476491..e4e4981 100644 (file)
@@ -500,7 +500,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
                                }
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
 
                default:
                        if (bc->hdlctx.calibrate <= 0)
index deef142..17be2bb 100644 (file)
@@ -482,7 +482,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
                case CRC_MODE_SMACK_TEST:
                        ax->crcmode  = CRC_MODE_FLEX_TEST;
                        printk(KERN_INFO "mkiss: %s: Trying crc-smack\n", ax->dev->name);
-                       // fall through
+                       fallthrough;
                case CRC_MODE_SMACK:
                        *p |= 0x80;
                        crc = swab16(crc16(0, p, len));
@@ -491,7 +491,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
                case CRC_MODE_FLEX_TEST:
                        ax->crcmode = CRC_MODE_NONE;
                        printk(KERN_INFO "mkiss: %s: Trying crc-flexnet\n", ax->dev->name);
-                       // fall through
+                       fallthrough;
                case CRC_MODE_FLEX:
                        *p |= 0x20;
                        crc = calc_crc_flex(p, len);
@@ -744,7 +744,6 @@ static int mkiss_open(struct tty_struct *tty)
                       ax->dev->name);
                break;
        case 0:
-               /* fall through */
        default:
                crc_force = 0;
                printk(KERN_INFO "mkiss: %s: crc mode is auto.\n",
index 787f17e..64b0a74 100644 (file)
@@ -367,7 +367,7 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
        }
        rcu_read_unlock();
 
-       while (unlikely(txq >= ndev->real_num_tx_queues))
+       while (txq >= ndev->real_num_tx_queues)
                txq -= ndev->real_num_tx_queues;
 
        return txq;
@@ -502,7 +502,7 @@ static int netvsc_vf_xmit(struct net_device *net, struct net_device *vf_netdev,
        int rc;
 
        skb->dev = vf_netdev;
-       skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping;
+       skb_record_rx_queue(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping);
 
        rc = dev_queue_xmit(skb);
        if (likely(rc == NET_XMIT_SUCCESS || rc == NET_XMIT_CN)) {
index 15e87c0..5bca94c 100644 (file)
@@ -106,12 +106,21 @@ static void ipvlan_port_destroy(struct net_device *dev)
        kfree(port);
 }
 
+#define IPVLAN_ALWAYS_ON_OFLOADS \
+       (NETIF_F_SG | NETIF_F_HW_CSUM | \
+        NETIF_F_GSO_ROBUST | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL)
+
+#define IPVLAN_ALWAYS_ON \
+       (IPVLAN_ALWAYS_ON_OFLOADS | NETIF_F_LLTX | NETIF_F_VLAN_CHALLENGED)
+
 #define IPVLAN_FEATURES \
-       (NETIF_F_SG | NETIF_F_CSUM_MASK | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
+       (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
         NETIF_F_GSO | NETIF_F_ALL_TSO | NETIF_F_GSO_ROBUST | \
         NETIF_F_GRO | NETIF_F_RXCSUM | \
         NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
 
+       /* NETIF_F_GSO_ENCAP_ALL NETIF_F_GSO_SOFTWARE Newly added */
+
 #define IPVLAN_STATE_MASK \
        ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
 
@@ -125,7 +134,9 @@ static int ipvlan_init(struct net_device *dev)
        dev->state = (dev->state & ~IPVLAN_STATE_MASK) |
                     (phy_dev->state & IPVLAN_STATE_MASK);
        dev->features = phy_dev->features & IPVLAN_FEATURES;
-       dev->features |= NETIF_F_LLTX | NETIF_F_VLAN_CHALLENGED;
+       dev->features |= IPVLAN_ALWAYS_ON;
+       dev->vlan_features = phy_dev->vlan_features & IPVLAN_FEATURES;
+       dev->vlan_features |= IPVLAN_ALWAYS_ON_OFLOADS;
        dev->hw_enc_features |= dev->features;
        dev->gso_max_size = phy_dev->gso_max_size;
        dev->gso_max_segs = phy_dev->gso_max_segs;
@@ -227,7 +238,14 @@ static netdev_features_t ipvlan_fix_features(struct net_device *dev,
 {
        struct ipvl_dev *ipvlan = netdev_priv(dev);
 
-       return features & (ipvlan->sfeatures | ~IPVLAN_FEATURES);
+       features |= NETIF_F_ALL_FOR_ALL;
+       features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES);
+       features = netdev_increment_features(ipvlan->phy_dev->features,
+                                            features, features);
+       features |= IPVLAN_ALWAYS_ON;
+       features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON);
+
+       return features;
 }
 
 static void ipvlan_change_rx_flags(struct net_device *dev, int change)
@@ -734,10 +752,9 @@ static int ipvlan_device_event(struct notifier_block *unused,
 
        case NETDEV_FEAT_CHANGE:
                list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
-                       ipvlan->dev->features = dev->features & IPVLAN_FEATURES;
                        ipvlan->dev->gso_max_size = dev->gso_max_size;
                        ipvlan->dev->gso_max_segs = dev->gso_max_segs;
-                       netdev_features_change(ipvlan->dev);
+                       netdev_update_features(ipvlan->dev);
                }
                break;
 
index 4942f61..c8d803d 100644 (file)
@@ -842,7 +842,7 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (!net_eq(dev_net(dev), &init_net))
                        break;
-               /* fall through */
+               fallthrough;
        case SIOCGHWTSTAMP:
                if (netif_device_present(real_dev) && ops->ndo_do_ioctl)
                        err = ops->ndo_do_ioctl(real_dev, &ifrr, cmd);
@@ -1269,6 +1269,9 @@ static void macvlan_port_destroy(struct net_device *dev)
 static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[],
                            struct netlink_ext_ack *extack)
 {
+       struct nlattr *nla, *head;
+       int rem, len;
+
        if (tb[IFLA_ADDRESS]) {
                if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
                        return -EINVAL;
@@ -1316,6 +1319,20 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[],
                        return -EADDRNOTAVAIL;
        }
 
+       if (data[IFLA_MACVLAN_MACADDR_DATA]) {
+               head = nla_data(data[IFLA_MACVLAN_MACADDR_DATA]);
+               len = nla_len(data[IFLA_MACVLAN_MACADDR_DATA]);
+
+               nla_for_each_attr(nla, head, len, rem) {
+                       if (nla_type(nla) != IFLA_MACVLAN_MACADDR ||
+                           nla_len(nla) != ETH_ALEN)
+                               return -EINVAL;
+
+                       if (!is_valid_ether_addr(nla_data(nla)))
+                               return -EADDRNOTAVAIL;
+               }
+       }
+
        if (data[IFLA_MACVLAN_MACADDR_COUNT])
                return -EINVAL;
 
@@ -1372,10 +1389,6 @@ static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode,
                len = nla_len(data[IFLA_MACVLAN_MACADDR_DATA]);
 
                nla_for_each_attr(nla, head, len, rem) {
-                       if (nla_type(nla) != IFLA_MACVLAN_MACADDR ||
-                           nla_len(nla) != ETH_ALEN)
-                               continue;
-
                        addr = nla_data(nla);
                        ret = macvlan_hash_add_source(vlan, addr);
                        if (ret)
index 4461212..f6a97c8 100644 (file)
@@ -597,7 +597,7 @@ int generic_mii_ioctl(struct mii_if_info *mii_if,
        switch(cmd) {
        case SIOCGMIIPHY:
                mii_data->phy_id = mii_if->phy_id;
-               /* fall through */
+               fallthrough;
 
        case SIOCGMIIREG:
                mii_data->val_out =
index 7971dc4..0e95116 100644 (file)
@@ -193,7 +193,7 @@ new_device_store(struct bus_type *bus, const char *buf, size_t count)
        switch (err) {
        case 1:
                port_count = 1;
-               /* fall through */
+               fallthrough;
        case 2:
                if (id > INT_MAX) {
                        pr_err("Value of \"id\" is too big.\n");
index f32d56a..deea17a 100644 (file)
@@ -760,14 +760,14 @@ static int nsim_fib_event_nb(struct notifier_block *nb, unsigned long event,
        spin_lock_bh(&data->fib_lock);
 
        switch (event) {
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                err = nsim_fib_rule_event(data, info,
                                          event == FIB_EVENT_RULE_ADD);
                break;
 
-       case FIB_EVENT_ENTRY_REPLACE:  /* fall through */
-       case FIB_EVENT_ENTRY_APPEND:  /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
+       case FIB_EVENT_ENTRY_APPEND:
        case FIB_EVENT_ENTRY_DEL:
                err = nsim_fib_event(data, info, event);
                break;
index 7471a8b..307f0ac 100644 (file)
@@ -366,10 +366,10 @@ static int adin_set_edpd(struct phy_device *phydev, u16 tx_interval)
 
        switch (tx_interval) {
        case 1000: /* 1 second */
-               /* fallthrough */
+               fallthrough;
        case ETHTOOL_PHY_EDPD_DFLT_TX_MSECS:
                val |= ADIN1300_NRG_PD_TX_EN;
-               /* fallthrough */
+               fallthrough;
        case ETHTOOL_PHY_EDPD_NO_TX:
                break;
        default:
index 50fb7d1..79e67f2 100644 (file)
@@ -766,13 +766,13 @@ static int decode_evnt(struct dp83640_private *dp83640,
        switch (words) {
        case 3:
                dp83640->edata.sec_hi = phy_txts->sec_hi;
-               /* fall through */
+               fallthrough;
        case 2:
                dp83640->edata.sec_lo = phy_txts->sec_lo;
-               /* fall through */
+               fallthrough;
        case 1:
                dp83640->edata.ns_hi = phy_txts->ns_hi;
-               /* fall through */
+               fallthrough;
        case 0:
                dp83640->edata.ns_lo = phy_txts->ns_lo;
        }
@@ -1409,7 +1409,7 @@ static void dp83640_txtstamp(struct mii_timestamper *mii_ts,
                        kfree_skb(skb);
                        return;
                }
-               /* fall through */
+               fallthrough;
        case HWTSTAMP_TX_ON:
                skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
                skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT;
index c4641b1..18d81f4 100644 (file)
@@ -279,13 +279,13 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
                                 phy->supported);
                linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
                                 phy->supported);
-               /* fall through */
+               fallthrough;
        case SPEED_100:
                linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
                                 phy->supported);
                linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
                                 phy->supported);
-               /* fall through */
+               fallthrough;
        case SPEED_10:
        default:
                linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
index a4fbf3a..6bc7406 100644 (file)
@@ -1738,13 +1738,13 @@ static int __phy_write_mcb_s6g(struct phy_device *phydev, u32 reg, u8 mcb,
        return 0;
 }
 
-/* Trigger a read to the spcified MCB */
+/* Trigger a read to the specified MCB */
 static int phy_update_mcb_s6g(struct phy_device *phydev, u32 reg, u8 mcb)
 {
        return __phy_write_mcb_s6g(phydev, reg, mcb, PHY_MCB_S6G_READ);
 }
 
-/* Trigger a write to the spcified MCB */
+/* Trigger a write to the specified MCB */
 static int phy_commit_mcb_s6g(struct phy_device *phydev, u32 reg, u8 mcb)
 {
        return __phy_write_mcb_s6g(phydev, reg, mcb, PHY_MCB_S6G_WRITE);
index 79b4f35..735a806 100644 (file)
@@ -355,7 +355,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:
                mii_data->phy_id = phydev->mdio.addr;
-               /* fall through */
+               fallthrough;
 
        case SIOCGMIIREG:
                if (mdio_phy_id_is_c45(mii_data->phy_id)) {
@@ -433,7 +433,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (phydev->mii_ts && phydev->mii_ts->hwtstamp)
                        return phydev->mii_ts->hwtstamp(phydev->mii_ts, ifr);
-               /* fall through */
+               fallthrough;
 
        default:
                return -EOPNOTSUPP;
index 57d4464..8adfbad 100644 (file)
@@ -1979,7 +1979,7 @@ static int genphy_setup_master_slave(struct phy_device *phydev)
                break;
        case MASTER_SLAVE_CFG_MASTER_FORCE:
                ctl |= CTL1000_AS_MASTER;
-               /* fallthrough */
+               fallthrough;
        case MASTER_SLAVE_CFG_SLAVE_FORCE:
                ctl |= CTL1000_ENABLE_MASTER;
                break;
index 32b4bd6..32f4e8e 100644 (file)
@@ -1905,7 +1905,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
                switch (cmd) {
                case SIOCGMIIPHY:
                        mii->phy_id = pl->phydev->mdio.addr;
-                       /* fall through */
+                       fallthrough;
 
                case SIOCGMIIREG:
                        ret = phylink_phy_read(pl, mii->phy_id, mii->reg_num);
@@ -1928,7 +1928,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
                switch (cmd) {
                case SIOCGMIIPHY:
                        mii->phy_id = 0;
-                       /* fall through */
+                       fallthrough;
 
                case SIOCGMIIREG:
                        ret = phylink_mii_read(pl, mii->phy_id, mii->reg_num);
index 6900c68..58014fe 100644 (file)
@@ -149,7 +149,7 @@ int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
                        port = PORT_TP;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case SFF8024_CONNECTOR_SG: /* guess */
        case SFF8024_CONNECTOR_HSSDC_II:
        case SFF8024_CONNECTOR_NOSEPARATE:
@@ -301,7 +301,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
                break;
        case SFF8024_ECC_100GBASE_CR4:
                phylink_set(modes, 100000baseCR4_Full);
-               /* fallthrough */
+               fallthrough;
        case SFF8024_ECC_25GBASE_CR_S:
        case SFF8024_ECC_25GBASE_CR_N:
                phylink_set(modes, 25000baseCR_Full);
index c24b0e8..cf83314 100644 (file)
@@ -552,7 +552,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_temp_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_temp_input:
                case hwmon_temp_label:
                        return 0444;
@@ -571,7 +571,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_in_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_in_input:
                case hwmon_in_label:
                        return 0444;
@@ -590,7 +590,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_curr_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_curr_input:
                case hwmon_curr_label:
                        return 0444;
@@ -618,7 +618,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_power_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_power_input:
                case hwmon_power_label:
                        return 0444;
@@ -1872,7 +1872,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
                        dev_warn(sfp->dev, "hwmon probe failed: %d\n", err);
 
                sfp_sm_mod_next(sfp, SFP_MOD_WAITDEV, 0);
-               /* fall through */
+               fallthrough;
        case SFP_MOD_WAITDEV:
                /* Ensure that the device is attached before proceeding */
                if (sfp->sm_dev_state < SFP_DEV_DOWN)
@@ -1890,7 +1890,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
                        goto insert;
 
                sfp_sm_mod_next(sfp, SFP_MOD_HPOWER, 0);
-               /* fall through */
+               fallthrough;
        case SFP_MOD_HPOWER:
                /* Enable high power mode */
                err = sfp_sm_mod_hpower(sfp, true);
index d82016d..4406b35 100644 (file)
@@ -498,7 +498,7 @@ plip_receive(unsigned short nibble_timeout, struct net_device *dev,
                *data_p = (c0 >> 3) & 0x0f;
                write_data (dev, 0x10); /* send ACK */
                *ns_p = PLIP_NB_1;
-               /* fall through */
+               fallthrough;
 
        case PLIP_NB_1:
                cx = nibble_timeout;
@@ -594,7 +594,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                        printk(KERN_DEBUG "%s: receive start\n", dev->name);
                rcv->state = PLIP_PK_LENGTH_LSB;
                rcv->nibble = PLIP_NB_BEGIN;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_LENGTH_LSB:
                if (snd->state != PLIP_PK_DONE) {
@@ -615,7 +615,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                                return TIMEOUT;
                }
                rcv->state = PLIP_PK_LENGTH_MSB;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_LENGTH_MSB:
                if (plip_receive(nibble_timeout, dev,
@@ -638,7 +638,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                rcv->state = PLIP_PK_DATA;
                rcv->byte = 0;
                rcv->checksum = 0;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DATA:
                lbuf = rcv->skb->data;
@@ -651,7 +651,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                        rcv->checksum += lbuf[--rcv->byte];
                } while (rcv->byte);
                rcv->state = PLIP_PK_CHECKSUM;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_CHECKSUM:
                if (plip_receive(nibble_timeout, dev,
@@ -664,7 +664,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                        return ERROR;
                }
                rcv->state = PLIP_PK_DONE;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DONE:
                /* Inform the upper layer for the arrival of a packet. */
@@ -710,7 +710,7 @@ plip_send(unsigned short nibble_timeout, struct net_device *dev,
        case PLIP_NB_BEGIN:
                write_data (dev, data & 0x0f);
                *ns_p = PLIP_NB_1;
-               /* fall through */
+               fallthrough;
 
        case PLIP_NB_1:
                write_data (dev, 0x10 | (data & 0x0f));
@@ -725,7 +725,7 @@ plip_send(unsigned short nibble_timeout, struct net_device *dev,
                }
                write_data (dev, 0x10 | (data >> 4));
                *ns_p = PLIP_NB_2;
-               /* fall through */
+               fallthrough;
 
        case PLIP_NB_2:
                write_data (dev, (data >> 4));
@@ -814,7 +814,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                              &snd->nibble, snd->length.b.lsb))
                        return TIMEOUT;
                snd->state = PLIP_PK_LENGTH_MSB;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_LENGTH_MSB:
                if (plip_send(nibble_timeout, dev,
@@ -823,7 +823,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                snd->state = PLIP_PK_DATA;
                snd->byte = 0;
                snd->checksum = 0;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DATA:
                do {
@@ -835,7 +835,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                        snd->checksum += lbuf[--snd->byte];
                } while (snd->byte);
                snd->state = PLIP_PK_CHECKSUM;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_CHECKSUM:
                if (plip_send(nibble_timeout, dev,
@@ -846,7 +846,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                dev_kfree_skb(snd->skb);
                dev->stats.tx_packets++;
                snd->state = PLIP_PK_DONE;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DONE:
                /* Close the connection */
@@ -935,7 +935,7 @@ plip_interrupt(void *dev_id)
        switch (nl->connection) {
        case PLIP_CN_CLOSING:
                netif_wake_queue (dev);
-               /* fall through */
+               fallthrough;
        case PLIP_CN_NONE:
        case PLIP_CN_SEND:
                rcv->state = PLIP_PK_TRIGGER;
index 3c11a77..7959b5c 100644 (file)
@@ -1590,10 +1590,10 @@ static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(tun->dev, xdp_prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                this_cpu_inc(tun->pcpu_stats->rx_dropped);
                break;
@@ -2417,7 +2417,7 @@ static int tun_xdp_one(struct tun_struct *tun,
                switch (err) {
                case XDP_REDIRECT:
                        *flush = true;
-                       /* fall through */
+                       fallthrough;
                case XDP_TX:
                        return 0;
                case XDP_PASS:
index 7e44110..0717c18 100644 (file)
@@ -333,13 +333,13 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
                switch (speed) {
                case SPEED_5000:
                        aqc111_data->phy_cfg |= AQ_ADV_5G;
-                       /* fall-through */
+                       fallthrough;
                case SPEED_2500:
                        aqc111_data->phy_cfg |= AQ_ADV_2G5;
-                       /* fall-through */
+                       fallthrough;
                case SPEED_1000:
                        aqc111_data->phy_cfg |= AQ_ADV_1G;
-                       /* fall-through */
+                       fallthrough;
                case SPEED_100:
                        aqc111_data->phy_cfg |= AQ_ADV_100M;
                        /* fall-through */
index d387bc7..97ba670 100644 (file)
@@ -858,7 +858,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
                default:
                        dev_warn(&intf->dev,
                                 "Couldn't detect memory size, assuming 32k\n");
-                       /* fall through */
+                       fallthrough;
                case 0x87654321:
                        catc_set_reg(catc, TxBufCount, 4);
                        catc_set_reg(catc, RxBufCount, 16);
index 9bdbd7b..dba847f 100644 (file)
@@ -97,7 +97,7 @@ static void tx_complete(struct urb *req)
        case -ECONNRESET:
        case -ESHUTDOWN:
                dev->stats.tx_aborted_errors++;
-               /* fall through */
+               fallthrough;
        default:
                dev->stats.tx_errors++;
                dev_dbg(&dev->dev, "TX error (%d)\n", status);
index 442507f..65b315b 100644 (file)
@@ -3192,7 +3192,7 @@ static void rx_complete(struct urb *urb)
        case -EPIPE:
                dev->net->stats.rx_errors++;
                lan78xx_defer_kevent(dev, EVENT_RX_HALT);
-               /* FALLTHROUGH */
+               fallthrough;
        case -ECONNRESET:                               /* async unlink */
        case -ESHUTDOWN:                                /* hardware gone */
                netif_dbg(dev, ifdown, dev->net,
@@ -3213,7 +3213,7 @@ static void rx_complete(struct urb *urb)
        /* data overrun ... flush fifo? */
        case -EOVERFLOW:
                dev->net->stats.rx_over_errors++;
-               /* FALLTHROUGH */
+               fallthrough;
 
        default:
                state = rx_cleanup;
index 0ef7e1f..e92cb51 100644 (file)
@@ -629,7 +629,7 @@ static void write_bulk_callback(struct urb *urb)
                return;
        default:
                netif_info(pegasus, tx_err, net, "TX status %d\n", status);
-               /* FALL THROUGH */
+               fallthrough;
        case 0:
                break;
        }
@@ -1009,7 +1009,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCDEVPRIVATE:
                data[0] = pegasus->phy;
-               /* fall through */
+               fallthrough;
        case SIOCDEVPRIVATE + 1:
                read_mii_word(pegasus, data[0], data[1] & 0x1f, &data[3]);
                res = 0;
index 2b02fef..b177048 100644 (file)
@@ -1682,7 +1682,7 @@ static void intr_callback(struct urb *urb)
        case -ECONNRESET:       /* unlink */
        case -ESHUTDOWN:
                netif_device_detach(tp->netdev);
-               /* fall through */
+               fallthrough;
        case -ENOENT:
        case -EPROTO:
                netif_info(tp, intr, tp->netdev,
@@ -3251,7 +3251,7 @@ static void r8153b_ups_en(struct r8152 *tp, bool enable)
                        r8152_mdio_write(tp, MII_BMCR, data);
 
                        data = r8153_phy_status(tp, PHY_STAT_LAN_ON);
-                       /* fall through */
+                       fallthrough;
 
                default:
                        if (data != PHY_STAT_LAN_ON)
@@ -4849,7 +4849,7 @@ static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u32 speed, u8 duplex,
                                tp->ups_info.speed_duplex = NWAY_1000M_FULL;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        ret = -EINVAL;
                        goto out;
index e7c630d..733f120 100644 (file)
@@ -843,7 +843,7 @@ static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCDEVPRIVATE:
                data[0] = dev->phy;
-               /* fall through */
+               fallthrough;
        case SIOCDEVPRIVATE + 1:
                read_mii_word(dev, dev->phy, (data[1] & 0x1f), &data[3]);
                break;
index e45935a..2b2a841 100644 (file)
@@ -110,7 +110,7 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
                                if (!usb_endpoint_dir_in(&e->desc))
                                        continue;
                                intr = 1;
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case USB_ENDPOINT_XFER_BULK:
                                break;
                        default:
@@ -628,7 +628,7 @@ block:
        /* data overrun ... flush fifo? */
        case -EOVERFLOW:
                dev->net->stats.rx_over_errors++;
-               // FALLTHROUGH
+               fallthrough;
 
        default:
                state = rx_cleanup;
@@ -1530,7 +1530,7 @@ static void usbnet_bh (struct timer_list *t)
                        continue;
                case tx_done:
                        kfree(entry->urb->sg);
-                       /* fall through */
+                       fallthrough;
                case rx_cleanup:
                        usb_free_urb (entry->urb);
                        dev_kfree_skb (skb);
index e56cd56..a475f48 100644 (file)
@@ -610,10 +610,10 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,
                        goto xdp_xmit;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fall through */
+                       fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(rq->dev, xdp_prog, act);
-                       /* fall through */
+                       fallthrough;
                case XDP_DROP:
                        stats->xdp_drops++;
                        goto err_xdp;
@@ -745,10 +745,10 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq,
                goto xdp_xmit;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(rq->dev, xdp_prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                stats->xdp_drops++;
                goto xdp_drop;
index 0ada48e..263b005 100644 (file)
@@ -724,7 +724,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
                        goto xdp_xmit;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fall through */
+                       fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(vi->dev, xdp_prog, act);
                case XDP_DROP:
@@ -922,10 +922,10 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
                        goto xdp_xmit;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fall through */
+                       fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(vi->dev, xdp_prog, act);
-                       /* fall through */
+                       fallthrough;
                case XDP_DROP:
                        if (unlikely(xdp_page != page))
                                __free_pages(xdp_page, 0);
index def27af..1014693 100644 (file)
@@ -743,7 +743,7 @@ vmxnet3_get_rss_hash_opts(struct vmxnet3_adapter *adapter,
        case ESP_V4_FLOW:
                if (rss_fields & VMXNET3_RSS_FIELDS_ESPIP4)
                        info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       /* fallthrough */
+               fallthrough;
        case SCTP_V4_FLOW:
        case IPV4_FLOW:
                info->data |= RXH_IP_SRC | RXH_IP_DST;
index 7bcee41..3ca4daf 100644 (file)
@@ -295,14 +295,13 @@ static int dlci_close(struct net_device *dev)
 {
        struct dlci_local       *dlp;
        struct frad_local       *flp;
-       int                     err;
 
        netif_stop_queue(dev);
 
        dlp = netdev_priv(dev);
 
        flp = netdev_priv(dlp->slave);
-       err = (*flp->deactivate)(dlp->slave, dev);
+       (*flp->deactivate)(dlp->slave, dev);
 
        return 0;
 }
index dfc1677..386ed2a 100644 (file)
@@ -230,6 +230,7 @@ static void hdlc_setup_dev(struct net_device *dev)
        dev->max_mtu             = HDLC_MAX_MTU;
        dev->type                = ARPHRD_RAWHDLC;
        dev->hard_header_len     = 16;
+       dev->needed_headroom     = 0;
        dev->addr_len            = 0;
        dev->header_ops          = &hdlc_null_ops;
 }
index f70336b..f52b9fe 100644 (file)
@@ -107,8 +107,14 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        int result;
 
+       /* There should be a pseudo header of 1 byte added by upper layers.
+        * Check to make sure it is there before reading it.
+        */
+       if (skb->len < 1) {
+               kfree_skb(skb);
+               return NETDEV_TX_OK;
+       }
 
-       /* X.25 to LAPB */
        switch (skb->data[0]) {
        case X25_IFACE_DATA:    /* Data to be transmitted */
                skb_pull(skb, 1);
@@ -294,6 +300,15 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
                        return result;
 
                memcpy(&state(hdlc)->settings, &new_settings, size);
+
+               /* There's no header_ops so hard_header_len should be 0. */
+               dev->hard_header_len = 0;
+               /* When transmitting data:
+                * first we'll remove a pseudo header of 1 byte,
+                * then we'll prepend an LAPB header of at most 3 bytes.
+                */
+               dev->needed_headroom = 3 - 1;
+
                dev->type = ARPHRD_X25;
                call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
                netif_dormant_off(dev);
index 1ea15f2..8ccd086 100644 (file)
@@ -173,7 +173,7 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb,
        case X25_IFACE_DISCONNECT:
                if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
                        pr_err("lapb_disconnect_request err: %d\n", err);
-               /* Fall thru */
+               fallthrough;
        default:
                goto drop;
        }
index 77ccf36..bc2c1c7 100644 (file)
@@ -413,7 +413,7 @@ static void sdla_errors(struct net_device *dev, int cmd, int dlci, int ret, int
                case SDLA_RET_NO_BUFS:
                        if (cmd == SDLA_INFORMATION_WRITE)
                                break;
-                       /* Else, fall through */
+                       fallthrough;
 
                default: 
                        netdev_dbg(dev, "Cmd 0x%02X generated return code 0x%02X\n",
index de79844..7ee9805 100644 (file)
@@ -330,7 +330,7 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
                if (err != LAPB_OK)
                        netdev_err(dev, "lapb_disconnect_request error: %d\n",
                                   err);
-               /* fall through */
+               fallthrough;
        default:
                kfree_skb(skb);
                return NETDEV_TX_OK;
index 4fe7c7e..9afed3b 100644 (file)
@@ -352,7 +352,7 @@ void i2400m_report_tlv_system_state(struct i2400m *i2400m,
 
        case I2400M_SS_IDLE:
                d_printf(1, dev, "entering BS-negotiated idle mode\n");
-               /* Fall through */
+               fallthrough;
        case I2400M_SS_DISCONNECTING:
        case I2400M_SS_DATA_PATH_CONNECTED:
                wimax_state_change(wimax_dev, WIMAX_ST_CONNECTED);
index 1f7709d..27ab233 100644 (file)
@@ -135,7 +135,7 @@ retry:
                        msleep(10);     /* give the device some time */
                        goto retry;
                }
-               /* fall through */
+               fallthrough;
        case -EINVAL:                   /* while removing driver */
        case -ENODEV:                   /* dev disconnect ... */
        case -ENOENT:                   /* just ignore it */
index 3a0e722..3ba9d70 100644 (file)
@@ -136,7 +136,7 @@ retry:
                        msleep(10);     /* give the device some time */
                        goto retry;
                }
-               /* fall through */
+               fallthrough;
        case -EINVAL:                   /* while removing driver */
        case -ENODEV:                   /* dev disconnect ... */
        case -ENOENT:                   /* just ignore it */
index 9659f9e..b684e97 100644 (file)
@@ -195,7 +195,7 @@ retry:
                        msleep(10);     /* give the device some time */
                        goto retry;
                }
-               /* fall through */
+               fallthrough;
        case -EINVAL:                   /* while removing driver */
        case -ENODEV:                   /* dev disconnect ... */
        case -ENOENT:                   /* just ignore it */
index 6b7532f..ff96f22 100644 (file)
@@ -393,7 +393,7 @@ void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m)
 
        case XEN_NETIF_CTRL_HASH_ALGORITHM_NONE:
                seq_puts(m, "Hash Algorithm: NONE\n");
-               /* FALLTHRU */
+               fallthrough;
        default:
                return;
        }
index 7e62a6e..f1c1624 100644 (file)
@@ -448,7 +448,7 @@ static void frontend_changed(struct xenbus_device *dev,
                set_backend_state(be, XenbusStateClosed);
                if (xenbus_dev_is_online(dev))
                        break;
-               /* fall through - if not online */
+               fallthrough;    /* if not online */
        case XenbusStateUnknown:
                set_backend_state(be, XenbusStateClosed);
                device_unregister(&dev->dev);
index 458be68..3e9895b 100644 (file)
@@ -2341,7 +2341,7 @@ static void netback_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* Fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 346e084..f7464bd 100644 (file)
@@ -2321,7 +2321,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,
 
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                /* jumbo frame ? */
                if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
@@ -2448,7 +2448,7 @@ static void pn533_wq_mi_recv(struct work_struct *work)
 
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                skb_put_u8(skb, 1); /*TG*/
 
index 0b9ca6d..8874d60 100644 (file)
@@ -611,7 +611,7 @@ static void st21nfca_im_recv_dep_res_cb(void *context, struct sk_buff *skb,
                switch (ST21NFCA_NFC_DEP_PFB_TYPE(dep_res->pfb)) {
                case ST21NFCA_NFC_DEP_PFB_ACK_NACK_PDU:
                        pr_err("Received a ACK/NACK PDU\n");
-                       /* fall through */
+                       fallthrough;
                case ST21NFCA_NFC_DEP_PFB_I_PDU:
                        info->dep_info.curr_nfc_dep_pni =
                            ST21NFCA_NFC_DEP_PFB_PNI(dep_res->pfb + 1);
index e46adaa..3bd97c7 100644 (file)
@@ -1153,7 +1153,7 @@ static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on)
                        dev_err(trf->dev, "%s - Invalid request: %d %d\n",
                                __func__, trf->state, on);
                        ret = -EINVAL;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case TRF7970A_ST_IDLE:
                case TRF7970A_ST_IDLE_RX_BLOCKED:
                case TRF7970A_ST_WAIT_FOR_RX_DATA:
@@ -1960,7 +1960,7 @@ static void trf7970a_shutdown(struct trf7970a *trf)
        case TRF7970A_ST_WAIT_TO_ISSUE_EOF:
        case TRF7970A_ST_LISTENING:
                trf7970a_send_err_upstream(trf, -ECANCELED);
-               /* FALLTHROUGH */
+               fallthrough;
        case TRF7970A_ST_IDLE:
        case TRF7970A_ST_IDLE_RX_BLOCKED:
                trf7970a_switch_rf_off(trf);
index e6d1f5b..4a02561 100644 (file)
@@ -1483,7 +1483,7 @@ static void ntb_rx_copy_callback(void *data,
                case DMA_TRANS_READ_FAILED:
                case DMA_TRANS_WRITE_FAILED:
                        entry->errors++;
-                       /* fall through */
+                       fallthrough;
                case DMA_TRANS_ABORTED:
                {
                        struct ntb_transport_qp *qp = entry->qp;
@@ -1739,7 +1739,7 @@ static void ntb_tx_copy_callback(void *data,
                case DMA_TRANS_READ_FAILED:
                case DMA_TRANS_WRITE_FAILED:
                        entry->errors++;
-                       /* fall through */
+                       fallthrough;
                case DMA_TRANS_ABORTED:
                {
                        void __iomem *offset =
index 61374de..b59032e 100644 (file)
@@ -529,6 +529,7 @@ static DEVICE_ATTR_ADMIN_RW(activate);
 static struct attribute *nvdimm_firmware_attributes[] = {
        &dev_attr_activate.attr,
        &dev_attr_result.attr,
+       NULL,
 };
 
 static umode_t nvdimm_firmware_visible(struct kobject *kobj, struct attribute *a, int n)
index 88cff30..154942f 100644 (file)
@@ -241,17 +241,6 @@ static blk_status_t nvme_error_status(u16 status)
        }
 }
 
-static inline bool nvme_req_needs_retry(struct request *req)
-{
-       if (blk_noretry_request(req))
-               return false;
-       if (nvme_req(req)->status & NVME_SC_DNR)
-               return false;
-       if (nvme_req(req)->retries >= nvme_max_retries)
-               return false;
-       return true;
-}
-
 static void nvme_retry_req(struct request *req)
 {
        struct nvme_ns *ns = req->q->queuedata;
@@ -268,34 +257,67 @@ static void nvme_retry_req(struct request *req)
        blk_mq_delay_kick_requeue_list(req->q, delay);
 }
 
-void nvme_complete_rq(struct request *req)
+enum nvme_disposition {
+       COMPLETE,
+       RETRY,
+       FAILOVER,
+};
+
+static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
 {
-       blk_status_t status = nvme_error_status(nvme_req(req)->status);
+       if (likely(nvme_req(req)->status == 0))
+               return COMPLETE;
 
-       trace_nvme_complete_rq(req);
+       if (blk_noretry_request(req) ||
+           (nvme_req(req)->status & NVME_SC_DNR) ||
+           nvme_req(req)->retries >= nvme_max_retries)
+               return COMPLETE;
 
-       nvme_cleanup_cmd(req);
+       if (req->cmd_flags & REQ_NVME_MPATH) {
+               if (nvme_is_path_error(nvme_req(req)->status) ||
+                   blk_queue_dying(req->q))
+                       return FAILOVER;
+       } else {
+               if (blk_queue_dying(req->q))
+                       return COMPLETE;
+       }
 
-       if (nvme_req(req)->ctrl->kas)
-               nvme_req(req)->ctrl->comp_seen = true;
+       return RETRY;
+}
 
-       if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) {
-               if ((req->cmd_flags & REQ_NVME_MPATH) && nvme_failover_req(req))
-                       return;
+static inline void nvme_end_req(struct request *req)
+{
+       blk_status_t status = nvme_error_status(nvme_req(req)->status);
 
-               if (!blk_queue_dying(req->q)) {
-                       nvme_retry_req(req);
-                       return;
-               }
-       } else if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
-                  req_op(req) == REQ_OP_ZONE_APPEND) {
+       if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
+           req_op(req) == REQ_OP_ZONE_APPEND)
                req->__sector = nvme_lba_to_sect(req->q->queuedata,
                        le64_to_cpu(nvme_req(req)->result.u64));
-       }
 
        nvme_trace_bio_complete(req, status);
        blk_mq_end_request(req, status);
 }
+
+void nvme_complete_rq(struct request *req)
+{
+       trace_nvme_complete_rq(req);
+       nvme_cleanup_cmd(req);
+
+       if (nvme_req(req)->ctrl->kas)
+               nvme_req(req)->ctrl->comp_seen = true;
+
+       switch (nvme_decide_disposition(req)) {
+       case COMPLETE:
+               nvme_end_req(req);
+               return;
+       case RETRY:
+               nvme_retry_req(req);
+               return;
+       case FAILOVER:
+               nvme_failover_req(req);
+               return;
+       }
+}
 EXPORT_SYMBOL_GPL(nvme_complete_rq);
 
 bool nvme_cancel_request(struct request *req, void *data, bool reserved)
@@ -330,7 +352,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_RESETTING:
                case NVME_CTRL_CONNECTING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -340,7 +362,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_NEW:
                case NVME_CTRL_LIVE:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -350,7 +372,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_NEW:
                case NVME_CTRL_RESETTING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -361,7 +383,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_RESETTING:
                case NVME_CTRL_CONNECTING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -371,7 +393,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_DELETING:
                case NVME_CTRL_DEAD:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -380,7 +402,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                switch (old_state) {
                case NVME_CTRL_DELETING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -2075,7 +2097,7 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
                }
        }
 
-       if (iob)
+       if (iob && !blk_queue_is_zoned(ns->queue))
                blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(iob));
        nvme_update_disk_info(disk, ns, id);
 #ifdef CONFIG_NVME_MULTIPATH
@@ -2965,14 +2987,14 @@ static struct nvme_cel *nvme_find_cel(struct nvme_ctrl *ctrl, u8 csi)
 {
        struct nvme_cel *cel, *ret = NULL;
 
-       spin_lock(&ctrl->lock);
+       spin_lock_irq(&ctrl->lock);
        list_for_each_entry(cel, &ctrl->cels, entry) {
                if (cel->csi == csi) {
                        ret = cel;
                        break;
                }
        }
-       spin_unlock(&ctrl->lock);
+       spin_unlock_irq(&ctrl->lock);
 
        return ret;
 }
@@ -2999,9 +3021,9 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
 
        cel->csi = csi;
 
-       spin_lock(&ctrl->lock);
+       spin_lock_irq(&ctrl->lock);
        list_add_tail(&cel->entry, &ctrl->cels);
-       spin_unlock(&ctrl->lock);
+       spin_unlock_irq(&ctrl->lock);
 out:
        *log = &cel->log;
        return 0;
index eae43bb..a7f474d 100644 (file)
@@ -2035,7 +2035,7 @@ done:
        }
 
        __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
-       if (!nvme_end_request(rq, status, result))
+       if (!nvme_try_complete_req(rq, status, result))
                nvme_fc_complete_rq(rq);
 
 check_error:
@@ -2078,7 +2078,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
        if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) {
                dev_err(ctrl->dev,
                        "FCP Op failed - cmdiu dma mapping failed.\n");
-               ret = EFAULT;
+               ret = -EFAULT;
                goto out_on_error;
        }
 
@@ -2088,7 +2088,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
        if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) {
                dev_err(ctrl->dev,
                        "FCP Op failed - rspiu dma mapping failed.\n");
-               ret = EFAULT;
+               ret = -EFAULT;
        }
 
        atomic_set(&op->state, FCPOP_STATE_IDLE);
index 3ded54d..d4ba736 100644 (file)
@@ -65,51 +65,30 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
        }
 }
 
-bool nvme_failover_req(struct request *req)
+void nvme_failover_req(struct request *req)
 {
        struct nvme_ns *ns = req->q->queuedata;
-       u16 status = nvme_req(req)->status;
+       u16 status = nvme_req(req)->status & 0x7ff;
        unsigned long flags;
 
-       switch (status & 0x7ff) {
-       case NVME_SC_ANA_TRANSITION:
-       case NVME_SC_ANA_INACCESSIBLE:
-       case NVME_SC_ANA_PERSISTENT_LOSS:
-               /*
-                * If we got back an ANA error we know the controller is alive,
-                * but not ready to serve this namespaces.  The spec suggests
-                * we should update our general state here, but due to the fact
-                * that the admin and I/O queues are not serialized that is
-                * fundamentally racy.  So instead just clear the current path,
-                * mark the the path as pending and kick of a re-read of the ANA
-                * log page ASAP.
-                */
-               nvme_mpath_clear_current_path(ns);
-               if (ns->ctrl->ana_log_buf) {
-                       set_bit(NVME_NS_ANA_PENDING, &ns->flags);
-                       queue_work(nvme_wq, &ns->ctrl->ana_work);
-               }
-               break;
-       case NVME_SC_HOST_PATH_ERROR:
-       case NVME_SC_HOST_ABORTED_CMD:
-               /*
-                * Temporary transport disruption in talking to the controller.
-                * Try to send on a new path.
-                */
-               nvme_mpath_clear_current_path(ns);
-               break;
-       default:
-               /* This was a non-ANA error so follow the normal error path. */
-               return false;
+       nvme_mpath_clear_current_path(ns);
+
+       /*
+        * If we got back an ANA error, we know the controller is alive but not
+        * ready to serve this namespace.  Kick of a re-read of the ANA
+        * information page, and just try any other available path for now.
+        */
+       if (nvme_is_ana_error(status) && ns->ctrl->ana_log_buf) {
+               set_bit(NVME_NS_ANA_PENDING, &ns->flags);
+               queue_work(nvme_wq, &ns->ctrl->ana_work);
        }
 
        spin_lock_irqsave(&ns->head->requeue_lock, flags);
        blk_steal_bios(&ns->head->requeue_list, req);
        spin_unlock_irqrestore(&ns->head->requeue_lock, flags);
-       blk_mq_end_request(req, 0);
 
+       blk_mq_end_request(req, 0);
        kblockd_schedule_work(&ns->head->requeue_work);
-       return true;
 }
 
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
@@ -233,7 +212,7 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head,
 static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
                int node, struct nvme_ns *old)
 {
-       struct nvme_ns *ns, *found, *fallback = NULL;
+       struct nvme_ns *ns, *found = NULL;
 
        if (list_is_singular(&head->list)) {
                if (nvme_path_is_disabled(old))
@@ -252,18 +231,22 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
                        goto out;
                }
                if (ns->ana_state == NVME_ANA_NONOPTIMIZED)
-                       fallback = ns;
+                       found = ns;
        }
 
-       /* No optimized path found, re-check the current path */
+       /*
+        * The loop above skips the current path for round-robin semantics.
+        * Fall back to the current path if either:
+        *  - no other optimized path found and current is optimized,
+        *  - no other usable path found and current is usable.
+        */
        if (!nvme_path_is_disabled(old) &&
-           old->ana_state == NVME_ANA_OPTIMIZED) {
-               found = old;
-               goto out;
-       }
-       if (!fallback)
+           (old->ana_state == NVME_ANA_OPTIMIZED ||
+            (!found && old->ana_state == NVME_ANA_NONOPTIMIZED)))
+               return old;
+
+       if (!found)
                return NULL;
-       found = fallback;
 out:
        rcu_assign_pointer(head->current_path[node], found);
        return found;
index ebb8c3e..e9cf294 100644 (file)
@@ -523,7 +523,31 @@ static inline u32 nvme_bytes_to_numd(size_t len)
        return (len >> 2) - 1;
 }
 
-static inline bool nvme_end_request(struct request *req, __le16 status,
+static inline bool nvme_is_ana_error(u16 status)
+{
+       switch (status & 0x7ff) {
+       case NVME_SC_ANA_TRANSITION:
+       case NVME_SC_ANA_INACCESSIBLE:
+       case NVME_SC_ANA_PERSISTENT_LOSS:
+               return true;
+       default:
+               return false;
+       }
+}
+
+static inline bool nvme_is_path_error(u16 status)
+{
+       /* check for a status code type of 'path related status' */
+       return (status & 0x700) == 0x300;
+}
+
+/*
+ * Fill in the status and result information from the CQE, and then figure out
+ * if blk-mq will need to use IPI magic to complete the request, and if yes do
+ * so.  If not let the caller complete the request without an indirect function
+ * call.
+ */
+static inline bool nvme_try_complete_req(struct request *req, __le16 status,
                union nvme_result result)
 {
        struct nvme_request *rq = nvme_req(req);
@@ -629,7 +653,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys);
 void nvme_mpath_start_freeze(struct nvme_subsystem *subsys);
 void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
                        struct nvme_ctrl *ctrl, int *flags);
-bool nvme_failover_req(struct request *req);
+void nvme_failover_req(struct request *req);
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
 int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
 void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id);
@@ -688,9 +712,8 @@ static inline void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
        sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
 }
 
-static inline bool nvme_failover_req(struct request *req)
+static inline void nvme_failover_req(struct request *req)
 {
-       return false;
 }
 static inline void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
 {
index ba725ae..9aa9487 100644 (file)
@@ -120,7 +120,7 @@ struct nvme_dev {
        unsigned max_qid;
        unsigned io_queues[HCTX_MAX_TYPES];
        unsigned int num_vecs;
-       u16 q_depth;
+       u32 q_depth;
        int io_sqes;
        u32 db_stride;
        void __iomem *bar;
@@ -157,13 +157,13 @@ struct nvme_dev {
 static int io_queue_depth_set(const char *val, const struct kernel_param *kp)
 {
        int ret;
-       u16 n;
+       u32 n;
 
-       ret = kstrtou16(val, 10, &n);
+       ret = kstrtou32(val, 10, &n);
        if (ret != 0 || n < 2)
                return -EINVAL;
 
-       return param_set_ushort(val, kp);
+       return param_set_uint(val, kp);
 }
 
 static inline unsigned int sq_idx(unsigned int qid, u32 stride)
@@ -195,7 +195,7 @@ struct nvme_queue {
        dma_addr_t sq_dma_addr;
        dma_addr_t cq_dma_addr;
        u32 __iomem *q_db;
-       u16 q_depth;
+       u32 q_depth;
        u16 cq_vector;
        u16 sq_tail;
        u16 cq_head;
@@ -961,7 +961,7 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
 
        req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
        trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail);
-       if (!nvme_end_request(req, cqe->status, cqe->result))
+       if (!nvme_try_complete_req(req, cqe->status, cqe->result))
                nvme_pci_complete_rq(req);
 }
 
@@ -1244,7 +1244,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
        switch (dev->ctrl.state) {
        case NVME_CTRL_CONNECTING:
                nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
-               /* fall through */
+               fallthrough;
        case NVME_CTRL_DELETING:
                dev_warn_ratelimited(dev->ctrl.device,
                         "I/O %d QID %d timeout, disable controller\n",
@@ -2320,7 +2320,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
 
        dev->ctrl.cap = lo_hi_readq(dev->bar + NVME_REG_CAP);
 
-       dev->q_depth = min_t(u16, NVME_CAP_MQES(dev->ctrl.cap) + 1,
+       dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1,
                                io_queue_depth);
        dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
        dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap);
@@ -2460,7 +2460,8 @@ static int nvme_disable_prepare_reset(struct nvme_dev *dev, bool shutdown)
 static int nvme_setup_prp_pools(struct nvme_dev *dev)
 {
        dev->prp_page_pool = dma_pool_create("prp list page", dev->dev,
-                                               PAGE_SIZE, PAGE_SIZE, 0);
+                                               NVME_CTRL_PAGE_SIZE,
+                                               NVME_CTRL_PAGE_SIZE, 0);
        if (!dev->prp_page_pool)
                return -ENOMEM;
 
index 44c76ff..eb1d54a 100644 (file)
@@ -1189,7 +1189,7 @@ static void nvme_rdma_end_request(struct nvme_rdma_request *req)
 
        if (!refcount_dec_and_test(&req->ref))
                return;
-       if (!nvme_end_request(rq, req->status, req->result))
+       if (!nvme_try_complete_req(rq, req->status, req->result))
                nvme_rdma_complete_rq(rq);
 }
 
@@ -1915,7 +1915,7 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
        case RDMA_CM_EVENT_CONNECT_ERROR:
        case RDMA_CM_EVENT_UNREACHABLE:
                nvme_rdma_destroy_queue_ib(queue);
-               /* fall through */
+               fallthrough;
        case RDMA_CM_EVENT_ADDR_ERROR:
                dev_dbg(queue->ctrl->ctrl.device,
                        "CM error event %d\n", ev->event);
index 62fbaec..a44d8ac 100644 (file)
@@ -481,7 +481,7 @@ static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,
                return -EINVAL;
        }
 
-       if (!nvme_end_request(rq, cqe->status, cqe->result))
+       if (!nvme_try_complete_req(rq, cqe->status, cqe->result))
                nvme_complete_rq(rq);
        queue->nr_cqe++;
 
@@ -672,7 +672,7 @@ static inline void nvme_tcp_end_request(struct request *rq, u16 status)
 {
        union nvme_result res = {};
 
-       if (!nvme_end_request(rq, cpu_to_le16(status << 1), res))
+       if (!nvme_try_complete_req(rq, cpu_to_le16(status << 1), res))
                nvme_complete_rq(rq);
 }
 
@@ -866,7 +866,6 @@ static void nvme_tcp_state_change(struct sock *sk)
        case TCP_LAST_ACK:
        case TCP_FIN_WAIT1:
        case TCP_FIN_WAIT2:
-               /* fallthrough */
                nvme_tcp_error_recovery(&queue->ctrl->ctrl);
                break;
        default:
index 74b2b61..37e1d77 100644 (file)
@@ -1136,6 +1136,7 @@ static ssize_t nvmet_subsys_attr_model_store(struct config_item *item,
        up_write(&nvmet_config_sem);
 
        kfree_rcu(new_model, rcuhead);
+       kfree(new_model_number);
 
        return count;
 }
index b92f45f..b7b6333 100644 (file)
@@ -73,7 +73,7 @@ inline u16 errno_to_nvme_status(struct nvmet_req *req, int errno)
                status = NVME_SC_ACCESS_DENIED;
                break;
        case -EIO:
-               /* FALLTHRU */
+               fallthrough;
        default:
                req->error_loc = offsetof(struct nvme_common_command, opcode);
                status = NVME_SC_INTERNAL | NVME_SC_DNR;
@@ -397,6 +397,9 @@ static void nvmet_keep_alive_timer(struct work_struct *work)
 
 static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
 {
+       if (unlikely(ctrl->kato == 0))
+               return;
+
        pr_debug("ctrl %d start keep-alive timer for %d secs\n",
                ctrl->cntlid, ctrl->kato);
 
@@ -406,6 +409,9 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
 
 static void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl)
 {
+       if (unlikely(ctrl->kato == 0))
+               return;
+
        pr_debug("ctrl %d stop keep-alive\n", ctrl->cntlid);
 
        cancel_delayed_work_sync(&ctrl->ka_work);
index c97e60b..3da067a 100644 (file)
@@ -812,7 +812,7 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,
                        break;
 
                /* Fall-Thru to RSP handling */
-               /* FALLTHRU */
+               fallthrough;
 
        case NVMET_FCOP_RSP:
                if (fcpreq) {
index 3dd6f56..125dde3 100644 (file)
@@ -139,7 +139,6 @@ static u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
                req->error_loc = offsetof(struct nvme_rw_command, nsid);
                break;
        case BLK_STS_IOERR:
-               /* fallthru */
        default:
                status = NVME_SC_INTERNAL | NVME_SC_DNR;
                req->error_loc = offsetof(struct nvme_common_command, opcode);
index 4884ef1..0d6008c 100644 (file)
@@ -115,7 +115,7 @@ static void nvme_loop_queue_response(struct nvmet_req *req)
                        return;
                }
 
-               if (!nvme_end_request(rq, cqe->status, cqe->result))
+               if (!nvme_try_complete_req(rq, cqe->status, cqe->result))
                        nvme_loop_complete_rq(rq);
        }
 }
index 89d91dc..8bd7f65 100644 (file)
@@ -165,7 +165,7 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w)
 
        req->cqe->result = nvme_req(rq)->result;
        nvmet_req_complete(req, status);
-       blk_put_request(rq);
+       blk_mq_free_request(rq);
 }
 
 static void nvmet_passthru_req_done(struct request *rq,
@@ -175,7 +175,7 @@ static void nvmet_passthru_req_done(struct request *rq,
 
        req->cqe->result = nvme_req(rq)->result;
        nvmet_req_complete(req, nvme_req(rq)->status);
-       blk_put_request(rq);
+       blk_mq_free_request(rq);
 }
 
 static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq)
@@ -230,7 +230,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
                if (unlikely(!ns)) {
                        pr_err("failed to get passthru ns nsid:%u\n", nsid);
                        status = NVME_SC_INVALID_NS | NVME_SC_DNR;
-                       goto fail_out;
+                       goto out;
                }
 
                q = ns->queue;
@@ -238,16 +238,15 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
 
        rq = nvme_alloc_request(q, req->cmd, BLK_MQ_REQ_NOWAIT, NVME_QID_ANY);
        if (IS_ERR(rq)) {
-               rq = NULL;
                status = NVME_SC_INTERNAL;
-               goto fail_out;
+               goto out_put_ns;
        }
 
        if (req->sg_cnt) {
                ret = nvmet_passthru_map_sg(req, rq);
                if (unlikely(ret)) {
                        status = NVME_SC_INTERNAL;
-                       goto fail_out;
+                       goto out_put_req;
                }
        }
 
@@ -274,11 +273,13 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
 
        return;
 
-fail_out:
+out_put_req:
+       blk_mq_free_request(rq);
+out_put_ns:
        if (ns)
                nvme_put_ns(ns);
+out:
        nvmet_req_complete(req, status);
-       blk_put_request(rq);
 }
 
 /*
@@ -326,6 +327,10 @@ static u16 nvmet_setup_passthru_command(struct nvmet_req *req)
 
 u16 nvmet_parse_passthru_io_cmd(struct nvmet_req *req)
 {
+       /* Reject any commands with non-sgl flags set (ie. fused commands) */
+       if (req->cmd->common.flags & ~NVME_CMD_SGL_ALL)
+               return NVME_SC_INVALID_FIELD;
+
        switch (req->cmd->common.opcode) {
        case nvme_cmd_resv_register:
        case nvme_cmd_resv_report:
@@ -396,6 +401,10 @@ static u16 nvmet_passthru_get_set_features(struct nvmet_req *req)
 
 u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
 {
+       /* Reject any commands with non-sgl flags set (ie. fused commands) */
+       if (req->cmd->common.flags & ~NVME_CMD_SGL_ALL)
+               return NVME_SC_INVALID_FIELD;
+
        /*
         * Passthru all vendor specific commands
         */
index 3ccb592..ae66204 100644 (file)
@@ -1758,7 +1758,7 @@ static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,
                        schedule_delayed_work(&port->repair_work, 0);
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case RDMA_CM_EVENT_DISCONNECTED:
        case RDMA_CM_EVENT_TIMEWAIT_EXIT:
                nvmet_rdma_queue_disconnect(queue);
@@ -1769,7 +1769,7 @@ static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,
        case RDMA_CM_EVENT_REJECTED:
                pr_debug("Connection rejected: %s\n",
                         rdma_reject_msg(cm_id, event->status));
-               /* FALLTHROUGH */
+               fallthrough;
        case RDMA_CM_EVENT_UNREACHABLE:
        case RDMA_CM_EVENT_CONNECT_ERROR:
                nvmet_rdma_queue_connect_fail(cm_id, queue);
index 590493e..da4f734 100644 (file)
@@ -128,15 +128,29 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr)
  * PCI bus specific translator
  */
 
+static bool of_node_is_pcie(struct device_node *np)
+{
+       bool is_pcie = of_node_name_eq(np, "pcie");
+
+       if (is_pcie)
+               pr_warn_once("%pOF: Missing device_type\n", np);
+
+       return is_pcie;
+}
+
 static int of_bus_pci_match(struct device_node *np)
 {
        /*
         * "pciex" is PCI Express
         * "vci" is for the /chaos bridge on 1st-gen PCI powermacs
         * "ht" is hypertransport
+        *
+        * If none of the device_type match, and that the node name is
+        * "pcie", accept the device as PCI (with a warning).
         */
        return of_node_is_type(np, "pci") || of_node_is_type(np, "pciex") ||
-               of_node_is_type(np, "vci") || of_node_is_type(np, "ht");
+               of_node_is_type(np, "vci") || of_node_is_type(np, "ht") ||
+               of_node_is_pcie(np);
 }
 
 static void of_bus_pci_count_cells(struct device_node *np,
@@ -985,6 +999,11 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
                        /* Don't error out as we'd break some existing DTs */
                        continue;
                }
+               if (range.cpu_addr == OF_BAD_ADDR) {
+                       pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
+                              range.bus_addr, node);
+                       continue;
+               }
                dma_offset = range.cpu_addr - range.bus_addr;
 
                /* Take lower and upper limits */
index 9d7fb45..9668ea0 100644 (file)
@@ -893,8 +893,10 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
                 * have OPP table for the device, while others don't and
                 * opp_set_rate() just needs to behave like clk_set_rate().
                 */
-               if (!_get_opp_count(opp_table))
-                       return 0;
+               if (!_get_opp_count(opp_table)) {
+                       ret = 0;
+                       goto put_opp_table;
+               }
 
                if (!opp_table->required_opp_tables && !opp_table->regulators &&
                    !opp_table->paths) {
@@ -905,7 +907,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 
                ret = _set_opp_bw(opp_table, NULL, dev, true);
                if (ret)
-                       return ret;
+                       goto put_opp_table;
 
                if (opp_table->regulator_enabled) {
                        regulator_disable(opp_table->regulators[0]);
@@ -932,10 +934,13 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 
        /* Return early if nothing to do */
        if (old_freq == freq) {
-               dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
-                       __func__, freq);
-               ret = 0;
-               goto put_opp_table;
+               if (!opp_table->required_opp_tables && !opp_table->regulators &&
+                   !opp_table->paths) {
+                       dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
+                               __func__, freq);
+                       ret = 0;
+                       goto put_opp_table;
+               }
        }
 
        /*
index f28d6a3..4547ac4 100644 (file)
@@ -260,7 +260,7 @@ static void parport_ieee1284_terminate (struct parport *port)
                        port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
                }
 
-               /* fall through */
+               fallthrough;
 
        default:
                /* Terminate from all other modes. */
@@ -598,7 +598,7 @@ ssize_t parport_write (struct parport *port, const void *buffer, size_t len)
        case IEEE1284_MODE_NIBBLE:
        case IEEE1284_MODE_BYTE:
                parport_negotiate (port, IEEE1284_MODE_COMPAT);
-               /* fall through */
+               fallthrough;
        case IEEE1284_MODE_COMPAT:
                pr_debug("%s: Using compatibility mode\n", port->name);
                fn = port->ops->compat_write_data;
@@ -702,7 +702,7 @@ ssize_t parport_read (struct parport *port, void *buffer, size_t len)
                if (parport_negotiate (port, IEEE1284_MODE_NIBBLE)) {
                        return -EIO;
                }
-               /* fall through - to NIBBLE */
+               fallthrough;    /* to NIBBLE */
        case IEEE1284_MODE_NIBBLE:
                pr_debug("%s: Using nibble mode\n", port->name);
                fn = port->ops->nibble_read_data;
index 77e37e3..eda4ded 100644 (file)
@@ -1647,7 +1647,7 @@ static int parport_ECP_supported(struct parport *pb)
                break;
        default:
                pr_warn("0x%lx: Unknown implementation ID\n", pb->base);
-               /* Fall through - Assume 1 */
+               fallthrough;    /* Assume 1 */
        case 1:
                pword = 1;
        }
index 90df28c..5fef261 100644 (file)
@@ -439,7 +439,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0);
                break;
-       case IMX6QP:            /* FALLTHROUGH */
+       case IMX6QP:
        case IMX6Q:
                /* power up core phy and enable ref clock */
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
@@ -642,7 +642,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6SX_GPR12_PCIE_RX_EQ_MASK,
                                   IMX6SX_GPR12_PCIE_RX_EQ_2);
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6Q_GPR12_PCIE_CTL_2, 0 << 10);
@@ -1105,7 +1105,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
                        dev_err(dev, "pcie_aux clock source missing or invalid\n");
                        return PTR_ERR(imx6_pcie->pcie_aux);
                }
-               /* fall through */
+               fallthrough;
        case IMX7D:
                if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
                        imx6_pcie->controller_id = 1;
index c953003..afde4aa 100644 (file)
@@ -223,7 +223,7 @@ static void rcar_pci_setup(struct rcar_pci_priv *priv)
                pr_warn("unknown window size %ld - defaulting to 256M\n",
                        window_size);
                window_size = SZ_256M;
-               /* fall-through */
+               fallthrough;
        case SZ_256M:
                val |= RCAR_USBCTR_PCIAHB_WIN1_256M;
                break;
index 5c93aa1..ae9acc7 100644 (file)
@@ -1941,7 +1941,7 @@ static int __init update_bridge_ranges(struct bus_node **bus)
                                                break;
                                        case PCI_HEADER_TYPE_BRIDGE:
                                                function = 0x8;
-                                               /* fall through */
+                                               fallthrough;
                                        case PCI_HEADER_TYPE_MULTIBRIDGE:
                                                /* We assume here that only 1 bus behind the bridge
                                                   TO DO: add functionality for several:
index 6503d15..9f85815 100644 (file)
@@ -236,7 +236,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
        switch (ctrl->state) {
        case BLINKINGOFF_STATE:
                cancel_delayed_work(&ctrl->button_work);
-               /* fall through */
+               fallthrough;
        case ON_STATE:
                ctrl->state = POWEROFF_STATE;
                mutex_unlock(&ctrl->state_lock);
@@ -265,7 +265,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
        switch (ctrl->state) {
        case BLINKINGON_STATE:
                cancel_delayed_work(&ctrl->button_work);
-               /* fall through */
+               fallthrough;
        case OFF_STATE:
                ctrl->state = POWERON_STATE;
                mutex_unlock(&ctrl->state_lock);
index b59f849..c9e790c 100644 (file)
@@ -83,21 +83,19 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
        struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev,
                                             hotplug_slot);
        struct pci_dev *pdev;
-       struct zpci_bus *zbus = zdev->zbus;
        int rc;
 
        if (!zpci_fn_configured(zdev->state))
                return -EIO;
 
-       pdev = pci_get_slot(zbus->bus, zdev->devfn);
-       if (pdev) {
-               if (pci_num_vf(pdev))
-                       return -EBUSY;
-
-               pci_stop_and_remove_bus_device_locked(pdev);
+       pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
+       if (pdev && pci_num_vf(pdev)) {
                pci_dev_put(pdev);
+               return -EBUSY;
        }
 
+       zpci_remove_device(zdev);
+
        rc = zpci_disable_device(zdev);
        if (rc)
                return rc;
index afdc52d..65502e3 100644 (file)
@@ -642,7 +642,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
        switch (p_slot->state) {
        case BLINKINGON_STATE:
                cancel_delayed_work(&p_slot->work);
-               /* fall through */
+               fallthrough;
        case STATIC_STATE:
                p_slot->state = POWERON_STATE;
                mutex_unlock(&p_slot->lock);
@@ -678,7 +678,7 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot)
        switch (p_slot->state) {
        case BLINKINGOFF_STATE:
                cancel_delayed_work(&p_slot->work);
-               /* fall through */
+               fallthrough;
        case STATIC_STATE:
                p_slot->state = POWEROFF_STATE;
                mutex_unlock(&p_slot->lock);
index 64ebed1..f357f9a 100644 (file)
@@ -556,13 +556,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,
                return -1;
 
        for (i = 0; i < num_clients; i++) {
-               if (IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
-                   clients[i]->dma_ops == &dma_virt_ops) {
+#ifdef CONFIG_DMA_VIRT_OPS
+               if (clients[i]->dma_ops == &dma_virt_ops) {
                        if (verbose)
                                dev_warn(clients[i],
                                         "cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n");
                        return -1;
                }
+#endif
 
                pci_client = find_parent_pci_dev(clients[i]);
                if (!pci_client) {
@@ -842,9 +843,10 @@ static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap,
         * this should never happen because it will be prevented
         * by the check in pci_p2pdma_distance_many()
         */
-       if (WARN_ON_ONCE(IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
-                        dev->dma_ops == &dma_virt_ops))
+#ifdef CONFIG_DMA_VIRT_OPS
+       if (WARN_ON_ONCE(dev->dma_ops == &dma_virt_ops))
                return 0;
+#endif
 
        for_each_sg(sg, s, nents, i) {
                paddr = sg_phys(s);
index a458c46..e39c549 100644 (file)
@@ -1049,7 +1049,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
                if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
                 && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
                        need_restore = true;
-               /* Fall-through - force to D0 */
+               fallthrough;    /* force to D0 */
        default:
                pmcsr = 0;
                break;
@@ -2541,7 +2541,7 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup)
                case PCI_D2:
                        if (pci_no_d1d2(dev))
                                break;
-                       /* else, fall through */
+                       fallthrough;
                default:
                        target_state = state;
                }
index bd2b691..d35186b 100644 (file)
@@ -231,7 +231,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
                }
                /* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
-               /* fall through */
+               fallthrough;
        default:
                ret = -EINVAL;
                break;
index bdf9b52..2a589b6 100644 (file)
@@ -1730,7 +1730,7 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
        case PCI_DEVICE_ID_JMICRON_JMB366:
                /* Redirect IDE second PATA port to the right spot */
                conf5 |= (1 << 24);
-               /* Fall through */
+               fallthrough;
        case PCI_DEVICE_ID_JMICRON_JMB361:
        case PCI_DEVICE_ID_JMICRON_JMB363:
        case PCI_DEVICE_ID_JMICRON_JMB369:
@@ -2224,7 +2224,7 @@ static void quirk_netmos(struct pci_dev *dev)
                if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
                                dev->subsystem_device == 0x0299)
                        return;
-               /* else, fall through */
+               fallthrough;
        case PCI_DEVICE_ID_NETMOS_9735:
        case PCI_DEVICE_ID_NETMOS_9745:
        case PCI_DEVICE_ID_NETMOS_9845:
index 3951e02..2ce6369 100644 (file)
@@ -1253,7 +1253,7 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
                        additional_mmio_size = pci_hotplug_mmio_size;
                        additional_mmio_pref_size = pci_hotplug_mmio_pref_size;
                }
-               /* Fall through */
+               fallthrough;
        default:
                pbus_size_io(bus, realloc_head ? 0 : additional_io_size,
                             additional_io_size, realloc_head);
index fab267e..c0e85be 100644 (file)
@@ -1096,7 +1096,7 @@ static void __ref pcifront_backend_changed(struct xenbus_device *xdev,
        case XenbusStateClosed:
                if (xdev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                dev_warn(&xdev->dev, "backend going away!\n");
                pcifront_try_disconnect(pdev);
index 590e594..a7c7c7c 100644 (file)
@@ -255,10 +255,10 @@ static int db1x_pcmcia_configure(struct pcmcia_socket *skt,
        switch (state->Vcc) {
        case 50:
                ++v;
-               /* fall through */
+               fallthrough;
        case 33:
                ++v;
-               /* fall through */
+               fallthrough;
        case 0:
                break;
        default:
@@ -269,11 +269,11 @@ static int db1x_pcmcia_configure(struct pcmcia_socket *skt,
        switch (state->Vpp) {
        case 12:
                ++p;
-               /* fall through */
+               fallthrough;
        case 33:
        case 50:
                ++p;
-               /* fall through */
+               fallthrough;
        case 0:
                break;
        default:
index 7b7d23f..a0a71c1 100644 (file)
@@ -1404,7 +1404,7 @@ static int arm_ccn_init_nodes(struct arm_ccn *ccn, int region,
                break;
        case CCN_TYPE_SBAS:
                ccn->sbas_present = 1;
-               /* Fall-through */
+               fallthrough;
        default:
                component = &ccn->node[id];
                break;
index e51ddb6..cc00915 100644 (file)
@@ -1002,7 +1002,7 @@ static void __arm_spe_pmu_dev_probe(void *info)
        default:
                dev_warn(dev, "unknown PMSIDR_EL1.Interval [%d]; assuming 8\n",
                         fld);
-               /* Fallthrough */
+               fallthrough;
        case 8:
                spe_pmu->min_period = 4096;
        }
@@ -1021,7 +1021,7 @@ static void __arm_spe_pmu_dev_probe(void *info)
        default:
                dev_warn(dev, "unknown PMSIDR_EL1.CountSize [%d]; assuming 2\n",
                         fld);
-               /* Fallthrough */
+               fallthrough;
        case 2:
                spe_pmu->counter_sz = 12;
        }
index 6105427..327df1a 100644 (file)
@@ -53,7 +53,7 @@ static int qcom_usb_hs_phy_set_mode(struct phy *phy,
                case PHY_MODE_USB_OTG:
                case PHY_MODE_USB_HOST:
                        val |= ULPI_INT_IDGRD;
-                       /* fall through */
+                       fallthrough;
                case PHY_MODE_USB_DEVICE:
                        val |= ULPI_INT_SESS_VALID;
                default:
index a84e9f0..46ebdb1 100644 (file)
@@ -546,7 +546,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
                rport->state = OTG_STATE_B_IDLE;
                if (!vbus_attach)
                        rockchip_usb2phy_power_off(rport->phy);
-               /* fall through */
+               fallthrough;
        case OTG_STATE_B_IDLE:
                if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) {
                        dev_dbg(&rport->phy->dev, "usb otg host connect\n");
@@ -754,11 +754,11 @@ static void rockchip_chg_detect_work(struct work_struct *work)
                        rphy->chg_type = POWER_SUPPLY_TYPE_USB_DCP;
                else
                        rphy->chg_type = POWER_SUPPLY_TYPE_USB_CDP;
-               /* fall through */
+               fallthrough;
        case USB_CHG_STATE_SECONDARY_DONE:
                rphy->chg_state = USB_CHG_STATE_DETECTED;
                delay = 0;
-               /* fall through */
+               fallthrough;
        case USB_CHG_STATE_DETECTED:
                /* put the controller in normal mode */
                property_enable(base, &rphy->phy_cfg->chg_det.opmode, true);
@@ -835,7 +835,7 @@ static void rockchip_usb2phy_sm_work(struct work_struct *work)
                        dev_dbg(&rport->phy->dev, "FS/LS online\n");
                        break;
                }
-               /* fall through */
+               fallthrough;
        case PHY_STATE_CONNECT:
                if (rport->suspended) {
                        dev_dbg(&rport->phy->dev, "Connected\n");
index 5e1d14e..0d46706 100644 (file)
@@ -431,7 +431,7 @@ static void olpc_xo175_ec_complete(void *arg)
                        input_sync(priv->pwrbtn);
                        input_report_key(priv->pwrbtn, KEY_POWER, 0);
                        input_sync(priv->pwrbtn);
-                       /* fall through */
+                       fallthrough;
                case EVENT_POWER_PRESS_WAKE:
                case EVENT_TIMED_HOST_WAKE:
                        pm_wakeup_event(priv->pwrbtn->dev.parent,
index 60c18f2..49f4b73 100644 (file)
@@ -1001,7 +1001,7 @@ static acpi_status WMID_get_u32(u32 *value, u32 cap)
                        *value = tmp & 0x1;
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        default:
                return AE_ERROR;
        }
@@ -1328,7 +1328,7 @@ static acpi_status get_u32(u32 *value, u32 cap)
                        status = AMW0_get_u32(value, cap);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case ACER_WMID:
                status = WMID_get_u32(value, cap);
                break;
@@ -1371,7 +1371,7 @@ static acpi_status set_u32(u32 value, u32 cap)
 
                                return AMW0_set_u32(value, cap);
                        }
-                       /* fall through */
+                       fallthrough;
                case ACER_WMID:
                        return WMID_set_u32(value, cap);
                case ACER_WMID_v2:
@@ -1381,7 +1381,7 @@ static acpi_status set_u32(u32 value, u32 cap)
                                return wmid_v2_set_u32(value, cap);
                        else if (wmi_has_guid(WMID_GUID2))
                                return WMID_set_u32(value, cap);
-                       /* fall through */
+                       fallthrough;
                default:
                        return AE_BAD_PARAMETER;
                }
index 5e9c229..70edc5b 100644 (file)
@@ -1587,10 +1587,10 @@ static ssize_t kbd_led_timeout_store(struct device *dev,
                switch (unit) {
                case KBD_TIMEOUT_DAYS:
                        value *= 24;
-                       /* fall through */
+                       fallthrough;
                case KBD_TIMEOUT_HOURS:
                        value *= 60;
-                       /* fall through */
+                       fallthrough;
                case KBD_TIMEOUT_MINUTES:
                        value *= 60;
                        unit = KBD_TIMEOUT_SECONDS;
index ec51522..d8afed5 100644 (file)
@@ -84,28 +84,28 @@ static void surface_button_notify(struct acpi_device *device, u32 event)
        /* Power button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_POWER:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_POWER:
                key_code = KEY_POWER;
                break;
        /* Home button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_HOME:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_HOME:
                key_code = KEY_LEFTMETA;
                break;
        /* Volume up button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP:
                key_code = KEY_VOLUMEUP;
                break;
        /* Volume down button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN:
                key_code = KEY_VOLUMEDOWN;
                break;
index 4864a5c..9c4df41 100644 (file)
@@ -4060,7 +4060,7 @@ static bool hotkey_notify_6xxx(const u32 hkey,
                 * AC status changed; can be triggered by plugging or
                 * unplugging AC adapter, docking or undocking. */
 
-               /* fallthrough */
+               fallthrough;
 
        case TP_HKEY_EV_KEY_NUMLOCK:
        case TP_HKEY_EV_KEY_FN:
@@ -4176,7 +4176,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
                                known_ev = true;
                                break;
                        }
-                       /* fallthrough - to default */
+                       fallthrough;    /* to default */
                default:
                        known_ev = false;
                }
@@ -6266,7 +6266,7 @@ static int thermal_get_sensor(int idx, s32 *value)
                        idx -= 8;
                }
 #endif
-               /* fallthrough */
+               fallthrough;
        case TPACPI_THERMAL_TPEC_8:
                if (idx <= 7) {
                        if (!acpi_ec_read(t + idx, &tmp))
index 36fff00..e557d75 100644 (file)
@@ -2748,7 +2748,7 @@ static void toshiba_acpi_process_hotkeys(struct toshiba_acpi_dev *dev)
                                result = hci_write(dev, HCI_SYSTEM_EVENT, 1);
                                if (result == TOS_SUCCESS)
                                        pr_notice("Re-enabled hotkeys\n");
-                               /* Fall through */
+                               fallthrough;
                        default:
                                retries--;
                                break;
index 9469fe1..db65be0 100644 (file)
@@ -748,7 +748,7 @@ static int ab8500_charger_max_usb_curr(struct ab8500_charger *di,
                                                USB_CH_IP_CUR_LVL_1P5;
                        break;
                }
-               /* else, fall through */
+               fallthrough;
        case USB_STAT_HM_IDGND:
                dev_err(di->dev, "USB Type - Charging not allowed\n");
                di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
@@ -2410,7 +2410,7 @@ static void ab8500_charger_usb_state_changed_work(struct work_struct *work)
                 * of 1sec for enabling charging
                 */
                msleep(1000);
-               /* Intentional fall through */
+               fallthrough;
        case AB8500_BM_USB_STATE_CONFIGURED:
                /*
                 * USB is configured, enable charging with the charging
index 751c4f6..7eec415 100644 (file)
@@ -1542,7 +1542,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di)
                ab8500_fg_discharge_state_to(di,
                        AB8500_FG_DISCHARGE_INITMEASURING);
 
-               /* Intentional fallthrough */
+               fallthrough;
        case AB8500_FG_DISCHARGE_INITMEASURING:
                /*
                 * Discard a number of samples during startup.
@@ -1572,7 +1572,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di)
                ab8500_fg_discharge_state_to(di,
                        AB8500_FG_DISCHARGE_RECOVERY);
 
-               /* Intentional fallthrough */
+               fallthrough;
 
        case AB8500_FG_DISCHARGE_RECOVERY:
                sleep_time = di->bm->fg_params->recovery_sleep_timer;
index 2fb33a0..175c4f3 100644 (file)
@@ -1419,7 +1419,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                abx500_chargalg_stop_charging(di);
                di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING;
                abx500_chargalg_state_to(di, STATE_HANDHELD);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_HANDHELD:
                break;
@@ -1435,7 +1435,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                di->maintenance_chg = false;
                abx500_chargalg_state_to(di, STATE_SUSPENDED);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_SUSPENDED:
                /* CHARGING is suspended */
@@ -1444,7 +1444,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_BATT_REMOVED_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_BATT_REMOVED);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_BATT_REMOVED:
                if (!di->events.batt_rem)
@@ -1454,7 +1454,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_HW_TEMP_PROTECT_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_HW_TEMP_PROTECT);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_HW_TEMP_PROTECT:
                if (!di->events.main_thermal_prot &&
@@ -1465,7 +1465,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_OVV_PROTECT_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_OVV_PROTECT);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_OVV_PROTECT:
                if (!di->events.vbus_ovv &&
@@ -1479,7 +1479,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_CHG_NOT_OK_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_CHG_NOT_OK);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_CHG_NOT_OK:
                if (!di->events.mainextchnotok &&
@@ -1490,7 +1490,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_SAFETY_TIMER_EXPIRED_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_SAFETY_TIMER_EXPIRED);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_SAFETY_TIMER_EXPIRED:
                /* We exit this state when charger is removed */
@@ -1537,7 +1537,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_WAIT_FOR_RECHARGE_INIT:
                abx500_chargalg_hold_charging(di);
                abx500_chargalg_state_to(di, STATE_WAIT_FOR_RECHARGE);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_WAIT_FOR_RECHARGE:
                if (di->batt_data.percent <=
@@ -1558,7 +1558,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                                di->bm->batt_id].maint_a_cur_lvl);
                abx500_chargalg_state_to(di, STATE_MAINTENANCE_A);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough*/
+               fallthrough;
 
        case STATE_MAINTENANCE_A:
                if (di->events.maintenance_timer_expired) {
@@ -1578,7 +1578,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                                di->bm->batt_id].maint_b_cur_lvl);
                abx500_chargalg_state_to(di, STATE_MAINTENANCE_B);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough*/
+               fallthrough;
 
        case STATE_MAINTENANCE_B:
                if (di->events.maintenance_timer_expired) {
@@ -1597,7 +1597,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                di->charge_status = POWER_SUPPLY_STATUS_CHARGING;
                abx500_chargalg_state_to(di, STATE_TEMP_LOWHIGH);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_TEMP_LOWHIGH:
                if (!di->events.btemp_lowhigh)
@@ -1607,7 +1607,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_WD_EXPIRED_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_WD_EXPIRED);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_WD_EXPIRED:
                if (!di->events.ac_wd_expired &&
@@ -1618,7 +1618,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_TEMP_UNDEROVER_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_TEMP_UNDEROVER);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_TEMP_UNDEROVER:
                if (!di->events.btemp_underover)
index d01dc03..0eaa86c 100644 (file)
@@ -349,7 +349,7 @@ static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
        case 100000:
                if (power->axp20x_id == AXP221_ID)
                        return -EINVAL;
-               /* fall through */
+               fallthrough;
        case 500000:
        case 900000:
                val = (900000 - intval) / 400000;
index 2a45e84..d89e08e 100644 (file)
@@ -383,7 +383,7 @@ static int cros_usbpd_charger_get_prop(struct power_supply *psy,
                 */
                if (ec_device->mkbp_event_supported || port->psy_online)
                        break;
-               /* fall through */
+               fallthrough;
        case POWER_SUPPLY_PROP_CURRENT_MAX:
        case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
        case POWER_SUPPLY_PROP_VOLTAGE_NOW:
index 5fca496..8878f91 100644 (file)
@@ -121,7 +121,7 @@ static irqreturn_t max8925_charger_handler(int irq, void *data)
        case MAX8925_IRQ_VCHG_THM_OK_F:
                /* Battery is not ready yet */
                dev_dbg(chip->dev, "Battery temperature is out of range\n");
-               /* Fall through */
+               fallthrough;
        case MAX8925_IRQ_VCHG_DC_OVP:
                dev_dbg(chip->dev, "Error detection\n");
                __set_charger(info, 0);
index 3d00b35..60b7f41 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 
-#include <plat/adc.h>
+#include <linux/soc/samsung/s3c-adc.h>
 
 #define BAT_POLL_INTERVAL              10000 /* ms */
 #define JITTER_DELAY                   500 /* ms */
index 65832bc..18b33f1 100644 (file)
@@ -665,7 +665,7 @@ static int wm831x_power_probe(struct platform_device *pdev)
                break;
        default:
                dev_err(&pdev->dev, "Failed to find USB phy: %d\n", ret);
-               /* fall-through */
+               fallthrough;
        case -EPROBE_DEFER:
                goto err_bat_irq;
                break;
index 26923af..e05cee4 100644 (file)
@@ -227,7 +227,7 @@ static irqreturn_t wm8350_charger_handler(int irq, void *data)
        case WM8350_IRQ_EXT_USB_FB:
        case WM8350_IRQ_EXT_WALL_FB:
                wm8350_charger_config(wm8350, policy);
-               /* Fall through */
+               fallthrough;
        case WM8350_IRQ_EXT_BAT_FB:
                power_supply_changed(power->battery);
                power_supply_changed(power->usb);
index 24f04ff..9d66257 100644 (file)
@@ -769,7 +769,7 @@ static int ps3av_auto_videomode(struct ps3av_pkt_av_get_hw_conf *av_hw_conf)
                switch (info->monitor_type) {
                case PS3AV_MONITOR_TYPE_DVI:
                        dvi = PS3AV_MODE_DVI;
-                       /* fall through */
+                       fallthrough;
                case PS3AV_MONITOR_TYPE_HDMI:
                        id = ps3av_hdmi_get_id(info);
                        break;
index f0e650c..c222066 100644 (file)
@@ -693,11 +693,11 @@ void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *audio, u32 avport,
        switch (ch) {
        case PS3AV_CMD_AUDIO_NUM_OF_CH_8:
                audio->audio_enable[3] = 1;
-               /* fall through */
+               fallthrough;
        case PS3AV_CMD_AUDIO_NUM_OF_CH_6:
                audio->audio_enable[2] = 1;
                audio->audio_enable[1] = 1;
-               /* fall through */
+               fallthrough;
        case PS3AV_CMD_AUDIO_NUM_OF_CH_2:
        default:
                audio->audio_enable[0] = 1;
index 73aaae5..e020faf 100644 (file)
@@ -142,16 +142,15 @@ static int idtcm_strverscmp(const char *ver1, const char *ver2)
        return result;
 }
 
-static int idtcm_xfer(struct idtcm *idtcm,
-                     u8 regaddr,
-                     u8 *buf,
-                     u16 count,
-                     bool write)
+static int idtcm_xfer_read(struct idtcm *idtcm,
+                          u8 regaddr,
+                          u8 *buf,
+                          u16 count)
 {
        struct i2c_client *client = idtcm->client;
        struct i2c_msg msg[2];
        int cnt;
-       char *fmt = "i2c_transfer failed at %d in %s for %s, at addr: %04X!\n";
+       char *fmt = "i2c_transfer failed at %d in %s, at addr: %04X!\n";
 
        msg[0].addr = client->addr;
        msg[0].flags = 0;
@@ -159,7 +158,7 @@ static int idtcm_xfer(struct idtcm *idtcm,
        msg[0].buf = &regaddr;
 
        msg[1].addr = client->addr;
-       msg[1].flags = write ? 0 : I2C_M_RD;
+       msg[1].flags = I2C_M_RD;
        msg[1].len = count;
        msg[1].buf = buf;
 
@@ -170,7 +169,6 @@ static int idtcm_xfer(struct idtcm *idtcm,
                        fmt,
                        __LINE__,
                        __func__,
-                       write ? "write" : "read",
                        regaddr);
                return cnt;
        } else if (cnt != 2) {
@@ -182,6 +180,37 @@ static int idtcm_xfer(struct idtcm *idtcm,
        return 0;
 }
 
+static int idtcm_xfer_write(struct idtcm *idtcm,
+                           u8 regaddr,
+                           u8 *buf,
+                           u16 count)
+{
+       struct i2c_client *client = idtcm->client;
+       /* we add 1 byte for device register */
+       u8 msg[IDTCM_MAX_WRITE_COUNT + 1];
+       int cnt;
+       char *fmt = "i2c_master_send failed at %d in %s, at addr: %04X!\n";
+
+       if (count > IDTCM_MAX_WRITE_COUNT)
+               return -EINVAL;
+
+       msg[0] = regaddr;
+       memcpy(&msg[1], buf, count);
+
+       cnt = i2c_master_send(client, msg, count + 1);
+
+       if (cnt < 0) {
+               dev_err(&client->dev,
+                       fmt,
+                       __LINE__,
+                       __func__,
+                       regaddr);
+               return cnt;
+       }
+
+       return 0;
+}
+
 static int idtcm_page_offset(struct idtcm *idtcm, u8 val)
 {
        u8 buf[4];
@@ -195,7 +224,7 @@ static int idtcm_page_offset(struct idtcm *idtcm, u8 val)
        buf[2] = 0x10;
        buf[3] = 0x20;
 
-       err = idtcm_xfer(idtcm, PAGE_ADDR, buf, sizeof(buf), 1);
+       err = idtcm_xfer_write(idtcm, PAGE_ADDR, buf, sizeof(buf));
 
        if (err) {
                idtcm->page_offset = 0xff;
@@ -223,11 +252,12 @@ static int _idtcm_rdwr(struct idtcm *idtcm,
        err = idtcm_page_offset(idtcm, hi);
 
        if (err)
-               goto out;
+               return err;
 
-       err = idtcm_xfer(idtcm, lo, buf, count, write);
-out:
-       return err;
+       if (write)
+               return idtcm_xfer_write(idtcm, lo, buf, count);
+
+       return idtcm_xfer_read(idtcm, lo, buf, count);
 }
 
 static int idtcm_read(struct idtcm *idtcm,
index ffae56c..82840d7 100644 (file)
@@ -55,6 +55,8 @@
 
 #define PEROUT_ENABLE_OUTPUT_MASK              (0xdeadbeef)
 
+#define IDTCM_MAX_WRITE_COUNT                  (512)
+
 /* Values of DPLL_N.DPLL_MODE.PLL_MODE */
 enum pll_mode {
        PLL_MODE_MIN = 0,
index 7dbcf69..9448e4c 100644 (file)
@@ -410,7 +410,7 @@ config PWM_ROCKCHIP
 
 config PWM_SAMSUNG
        tristate "Samsung PWM support"
-       depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        help
          Generic PWM framework driver for Samsung.
 
index c07ceec..a303429 100644 (file)
@@ -2150,7 +2150,7 @@ static void mport_release_mapping(struct kref *ref)
        switch (map->dir) {
        case MAP_INBOUND:
                rio_unmap_inb_region(mport, map->phys_addr);
-               /* fall through */
+               fallthrough;
        case MAP_DMA:
                dma_free_coherent(mport->dev.parent, map->size,
                                  map->virt_addr, map->phys_addr);
index fbc95ca..1bacb37 100644 (file)
@@ -399,7 +399,7 @@ static int axp20x_set_ramp_delay(struct regulator_dev *rdev, int ramp)
                if (rate_count > 0)
                        break;
 
-               /* fall through */
+               fallthrough;
        default:
                /* Not supported for this regulator */
                return -ENOTSUPP;
@@ -1022,7 +1022,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
                 * (See include/linux/mfd/axp20x.h)
                 */
                reg = AXP803_DCDC_FREQ_CTRL;
-               /* Fall through - to the check below.*/
+               fallthrough;    /* to the check below */
        case AXP806_ID:
                /*
                 * AXP806 also have DCDC work frequency setting register at a
@@ -1030,7 +1030,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
                 */
                if (axp20x->variant == AXP806_ID)
                        reg = AXP806_DCDC_FREQ_CTRL;
-               /* Fall through */
+               fallthrough;
        case AXP221_ID:
        case AXP223_ID:
        case AXP809_ID:
@@ -1118,7 +1118,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
                 * (See include/linux/mfd/axp20x.h)
                 */
                reg = AXP806_DCDC_MODE_CTRL2;
-                /* Fall through - to the check below. */
+               fallthrough;    /* to the check below */
        case AXP221_ID:
        case AXP223_ID:
        case AXP809_ID:
index 75ff7c5..3fd3599 100644 (file)
@@ -1895,7 +1895,7 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
                case EXCLUSIVE_GET:
                        dev_warn(dev,
                                 "dummy supplies not allowed for exclusive requests\n");
-                       /* fall through */
+                       fallthrough;
 
                default:
                        return ERR_PTR(-ENODEV);
index 44e4cec..87b020d 100644 (file)
@@ -319,7 +319,7 @@ static int slg51000_regulator_init(struct slg51000 *chip)
                                rdesc->linear_min_sel = 0;
                                break;
                        }
-                       /* Fall through - to the check below.*/
+                       fallthrough;    /* to the check below */
 
                default:
                        rdesc->linear_min_sel = vsel_range[0];
index f7db250..430265c 100644 (file)
@@ -312,7 +312,7 @@ static int twl6030smps_list_voltage(struct regulator_dev *rdev, unsigned index)
        switch (info->flags) {
        case SMPS_OFFSET_EN:
                voltage = 100000;
-               /* fall through */
+               fallthrough;
        case 0:
                switch (index) {
                case 0:
index 6955fab..d94b739 100644 (file)
@@ -511,7 +511,6 @@ static void omap_rproc_mbox_callback(struct mbox_client *client, void *data)
                dev_info(dev, "received echo reply from %s\n", name);
                break;
        case RP_MBOX_SUSPEND_ACK:
-               /* Fall through */
        case RP_MBOX_SUSPEND_CANCEL:
                oproc->suspend_acked = msg == RP_MBOX_SUSPEND_ACK;
                complete(&oproc->pm_comp);
index d170fe6..e8aa869 100644 (file)
@@ -222,7 +222,7 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
 
        switch (id) {
        case IMX8MQ_RESET_PCIEPHY:
-       case IMX8MQ_RESET_PCIEPHY2: /* fallthrough */
+       case IMX8MQ_RESET_PCIEPHY2:
                /*
                 * wait for more than 10us to release phy g_rst and
                 * btnrst
@@ -232,12 +232,12 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
                break;
 
        case IMX8MQ_RESET_PCIE_CTRL_APPS_EN:
-       case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN:   /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N:        /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N: /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N: /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_RESET_N:     /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N:        /* fallthrough */
+       case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN:
+       case IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N:
                value = assert ? 0 : bit;
                break;
        }
index 1995f5b..f40312b 100644 (file)
@@ -553,7 +553,7 @@ static void qcom_glink_receive_version(struct qcom_glink *glink,
                break;
        case GLINK_VERSION_1:
                glink->features &= features;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                qcom_glink_send_version_ack(glink);
                break;
@@ -584,7 +584,7 @@ static void qcom_glink_receive_version_ack(struct qcom_glink *glink,
                        break;
 
                glink->features &= features;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                qcom_glink_send_version(glink);
                break;
index 9b70b37..8a89bc5 100644 (file)
@@ -740,7 +740,7 @@ static int wdt_ioctl(struct file *file, unsigned int cmd,
                        return -EINVAL;
                wdt_margin = new_margin;
                wdt_ping();
-               /* Fall through */
+               fallthrough;
        case WDIOC_GETTIMEOUT:
                return put_user(wdt_margin, (int __user *)arg);
 
index ca55ba9..f8b99cb 100644 (file)
@@ -353,7 +353,7 @@ static int pcf85063_load_capacitance(struct pcf85063 *pcf85063,
        default:
                dev_warn(&pcf85063->rtc->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 7000",
                         load);
-               /* fall through */
+               fallthrough;
        case 7000:
                break;
        case 12500:
index 47e0f41..57d351d 100644 (file)
@@ -108,7 +108,7 @@ static int pcf8523_load_capacitance(struct i2c_client *client)
        default:
                dev_warn(&client->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 12500",
                         load);
-               /* fall through */
+               fallthrough;
        case 12500:
                value |= REG_CONTROL1_CAP_SEL;
                break;
index c9bc3d4..0a969af 100644 (file)
@@ -331,7 +331,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
        default:
                dev_warn(&pdev->dev,
                         "invalid crystal-freq specified in device-tree. Assuming no crystal\n");
-               /* fall-through */
+               fallthrough;
        case 0:
                /* keep XTAL on in low-power mode */
                pers0_set = STMP3XXX_RTC_PERSISTENT0_XTAL24MHZ_PWRUP;
index 94edbb3..aca0222 100644 (file)
@@ -677,6 +677,11 @@ static int slow_eval_known_fn(struct subchannel *sch, void *data)
                rc = css_evaluate_known_subchannel(sch, 1);
                if (rc == -EAGAIN)
                        css_schedule_eval(sch->schid);
+               /*
+                * The loop might take long time for platforms with lots of
+                * known devices. Allow scheduling here.
+                */
+               cond_resched();
        }
        return 0;
 }
index 3ce99e4..661d2a4 100644 (file)
@@ -1695,7 +1695,7 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg)
                        grp->changed_side = 2;
                        break;
                }
-               /* Else, fall through */
+               fallthrough;
        case MPCG_STATE_XID0IOWAIX:
        case MPCG_STATE_XID7INITW:
        case MPCG_STATE_XID7INITX:
index ab316ba..85a1a45 100644 (file)
@@ -357,7 +357,7 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int))
                /*fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW);*/
                if (callback)
                        grp->send_qllc_disc = 1;
-               /* Else, fall through */
+               fallthrough;
        case MPCG_STATE_XID0IOWAIT:
                fsm_deltimer(&grp->timer);
                grp->outstanding_xid2 = 0;
@@ -1470,7 +1470,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg)
                if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
                   (fsm_getstate(wch->fsm) == CH_XID0_PENDING))
                        break;
-               /* Else, fall through */
+               fallthrough;
        default:
                fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
        }
@@ -2089,7 +2089,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev)
                        grp->estconnfunc = NULL;
                        break;
                }
-               /* Else, fall through */
+               fallthrough;
        case MPCG_STATE_FLOWC:
        case MPCG_STATE_READY:
                grp->send_qllc_disc = 2;
index bba1b54..6a73982 100644 (file)
@@ -1071,7 +1071,7 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
                break;
        case -EIO:
                qeth_schedule_recovery(card);
-               /* fall through */
+               fallthrough;
        default:
                qeth_clear_ipacmd_list(card);
                goto err_idx;
@@ -2886,7 +2886,7 @@ void qeth_print_status_message(struct qeth_card *card)
                                card->info.mcl_level[3]);
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case QETH_CARD_TYPE_IQD:
                if (IS_VM_NIC(card) || (card->info.mcl_level[0] & 0x80)) {
                        card->info.mcl_level[0] = (char) _ebcasc[(__u8)
index ebdc032..f870c53 100644 (file)
@@ -356,7 +356,7 @@ static void qeth_set_cmd_adv_sup(struct ethtool_link_ksettings *cmd,
                                                     10000baseT_Full);
                ethtool_link_ksettings_add_link_mode(cmd, advertising,
                                                     10000baseT_Full);
-               /* fall through */
+               fallthrough;
        case SPEED_1000:
                ethtool_link_ksettings_add_link_mode(cmd, supported,
                                                     1000baseT_Full);
@@ -366,7 +366,7 @@ static void qeth_set_cmd_adv_sup(struct ethtool_link_ksettings *cmd,
                                                     1000baseT_Half);
                ethtool_link_ksettings_add_link_mode(cmd, advertising,
                                                     1000baseT_Half);
-               /* fall through */
+               fallthrough;
        case SPEED_100:
                ethtool_link_ksettings_add_link_mode(cmd, supported,
                                                     100baseT_Full);
@@ -376,7 +376,7 @@ static void qeth_set_cmd_adv_sup(struct ethtool_link_ksettings *cmd,
                                                     100baseT_Half);
                ethtool_link_ksettings_add_link_mode(cmd, advertising,
                                                     100baseT_Half);
-               /* fall through */
+               fallthrough;
        case SPEED_10:
                ethtool_link_ksettings_add_link_mode(cmd, supported,
                                                     10baseT_Full);
index 8b342a8..3a94f6c 100644 (file)
@@ -488,7 +488,7 @@ static void qeth_l2_rx_mode_work(struct work_struct *work)
                                kfree(mac);
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        /* for next call to set_rx_mode(): */
                        mac->disp_flag = QETH_DISP_ADDR_DELETE;
index fe44b02..4d46196 100644 (file)
@@ -1235,7 +1235,7 @@ static void qeth_l3_rx_mode_work(struct work_struct *work)
                                        break;
                                }
                                addr->ref_counter = 1;
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* for next call to set_rx_mode(): */
                                addr->disp_flag = QETH_DISP_ADDR_DELETE;
index c795f22..140186f 100644 (file)
@@ -434,7 +434,7 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
                return;
        }
 
-       del_timer(&req->timer);
+       del_timer_sync(&req->timer);
        zfcp_fsf_protstatus_eval(req);
        zfcp_fsf_fsfstatus_eval(req);
        req->handler(req);
@@ -867,7 +867,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
        req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free);
        req->issued = get_tod_clock();
        if (zfcp_qdio_send(qdio, &req->qdio_req)) {
-               del_timer(&req->timer);
+               del_timer_sync(&req->timer);
                /* lookup request again, list might have changed */
                zfcp_reqlist_find_rm(adapter->req_list, req_id);
                zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1");
index 461b3ba..84b57a8 100644 (file)
@@ -1832,7 +1832,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
        case REQUEST_SENSE:
                /* clear the internal sense magic */
                SCp->cmnd[6] = 0;
-               /* fall through */
+               fallthrough;
        default:
                /* OK, get it from the command */
                switch(SCp->sc_data_direction) {
index bb49d83..ccb061a 100644 (file)
@@ -2635,7 +2635,7 @@ static int blogic_resultcode(struct blogic_adapter *adapter,
        case BLOGIC_BAD_CMD_PARAM:
                blogic_warn("BusLogic Driver Protocol Error 0x%02X\n",
                                adapter, adapter_status);
-               /* fall through */
+               fallthrough;
        case BLOGIC_DATA_UNDERRUN:
        case BLOGIC_DATA_OVERRUN:
        case BLOGIC_NOEXPECT_BUSFREE:
index 0f17bd5..24ace18 100644 (file)
@@ -1034,11 +1034,14 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)
                        temp6 >>= 1;
                        switch (temp & 0x3) {
                        case AUTO_RATE_20:      /* Synchronous, 20 mega-transfers/second */
-                               temp6 |= 0x8000;        /* Fall through */
+                               temp6 |= 0x8000;
+                               fallthrough;
                        case AUTO_RATE_10:      /* Synchronous, 10 mega-transfers/second */
-                               temp5 |= 0x8000;        /* Fall through */
+                               temp5 |= 0x8000;
+                               fallthrough;
                        case AUTO_RATE_05:      /* Synchronous, 5 mega-transfers/second */
-                               temp2 |= 0x8000;        /* Fall through */
+                               temp2 |= 0x8000;
+                               fallthrough;
                        case AUTO_RATE_00:      /* Asynchronous */
                                break;
                        }
index f2f7e6e..d654a6c 100644 (file)
@@ -1943,7 +1943,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                                return;
 
                                        /* Reject message */
-                                       /* Fall through */
+                                       fallthrough;
                                default:
                                        /*
                                         * If we get something weird that we aren't expecting,
index 769af4c..fd6ae5c 100644 (file)
@@ -2809,7 +2809,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                                            !(dev->raw_io_64) ||
                                            ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
                                                break;
-                                       /* fall through */
+                                       fallthrough;
                                case INQUIRY:
                                case READ_CAPACITY:
                                case TEST_UNIT_READY:
@@ -2884,7 +2884,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                /* Issue FIB to tell Firmware to flush it's cache */
                if ((aac_cache & 6) != 2)
                        return aac_synchronize(scsicmd);
-               /* fall through */
+               fallthrough;
        case INQUIRY:
        {
                struct inquiry_data inq_data;
@@ -3240,7 +3240,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                                     SCSI_SENSE_BUFFERSIZE));
                        break;
                }
-               /* fall through */
+               fallthrough;
        case RESERVE:
        case RELEASE:
        case REZERO_UNIT:
@@ -3253,7 +3253,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
        case START_STOP:
                return aac_start_stop(scsicmd);
 
-       /* FALLTHRU */
+               fallthrough;
        default:
        /*
         *      Unhandled commands
index adbdc3b..383e74f 100644 (file)
@@ -1431,7 +1431,7 @@ retry_next:
                                                "enclosure services event");
                                scsi_device_set_state(device, SDEV_RUNNING);
                        }
-                       /* FALLTHRU */
+                       fallthrough;
                case CHANGE:
                        if ((channel == CONTAINER_CHANNEL)
                         && (!dev->fsa_dev[container].valid)) {
index 8588da0..a3aee14 100644 (file)
@@ -765,7 +765,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
                            !(aac->raw_io_64) ||
                            ((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
                                break;
-                       /* fall through */
+                       fallthrough;
                case INQUIRY:
                case READ_CAPACITY:
                        /*
index c912d29..1c617c0 100644 (file)
@@ -2274,7 +2274,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
                        switch (scb->hscb->task_management) {
                        case SIU_TASKMGMT_ABORT_TASK:
                                tag = SCB_GET_TAG(scb);
-                               /* fall through */
+                               fallthrough;
                        case SIU_TASKMGMT_ABORT_TASK_SET:
                        case SIU_TASKMGMT_CLEAR_TASK_SET:
                                lun = scb->hscb->lun;
@@ -2285,7 +2285,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
                                break;
                        case SIU_TASKMGMT_LUN_RESET:
                                lun = scb->hscb->lun;
-                               /* fall through */
+                               fallthrough;
                        case SIU_TASKMGMT_TARGET_RESET:
                        {
                                struct ahd_devinfo devinfo;
@@ -3791,7 +3791,7 @@ ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo,
                        *bus_width = MSG_EXT_WDTR_BUS_16_BIT;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_EXT_WDTR_BUS_8_BIT:
                *bus_width = MSG_EXT_WDTR_BUS_8_BIT;
                break;
@@ -5104,7 +5104,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
                break;
        case MSG_MESSAGE_REJECT:
                response = ahd_handle_msg_reject(ahd, devinfo);
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_NOOP:
                done = MSGLOOP_MSGCOMPLETE;
                break;
@@ -5454,7 +5454,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
                               ahd_name(ahd), ahd_inb(ahd, SCSISIGI));
 #endif
                ahd->msg_flags |= MSG_FLAG_EXPECT_QASREJ_BUSFREE;
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_TERM_IO_PROC:
        default:
                reject = TRUE;
@@ -6117,17 +6117,17 @@ ahd_free(struct ahd_softc *ahd)
        default:
        case 5:
                ahd_shutdown(ahd);
-               /* FALLTHROUGH */
+               fallthrough;
        case 4:
                ahd_dmamap_unload(ahd, ahd->shared_data_dmat,
                                  ahd->shared_data_map.dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 3:
                ahd_dmamem_free(ahd, ahd->shared_data_dmat, ahd->qoutfifo,
                                ahd->shared_data_map.dmamap);
                ahd_dmamap_destroy(ahd, ahd->shared_data_dmat,
                                   ahd->shared_data_map.dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 2:
                ahd_dma_tag_destroy(ahd, ahd->shared_data_dmat);
        case 1:
@@ -6513,7 +6513,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd)
                }
                ahd_dma_tag_destroy(ahd, scb_data->sense_dmat);
        }
-               /* fall through */
+               fallthrough;
        case 6:
        {
                struct map_node *sg_map;
@@ -6528,7 +6528,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd)
                }
                ahd_dma_tag_destroy(ahd, scb_data->sg_dmat);
        }
-               /* fall through */
+               fallthrough;
        case 5:
        {
                struct map_node *hscb_map;
@@ -7171,7 +7171,7 @@ ahd_init(struct ahd_softc *ahd)
                case FLX_CSTAT_OVER:
                case FLX_CSTAT_UNDER:
                        warn_user++;
-                       /* fall through */
+                       fallthrough;
                case FLX_CSTAT_INVALID:
                case FLX_CSTAT_OKAY:
                        if (warn_user == 0 && bootverbose == 0)
@@ -8175,12 +8175,12 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
                                if ((scb->flags & SCB_ACTIVE) == 0)
                                        printk("Inactive SCB in qinfifo\n");
                                ahd_done_with_status(ahd, scb, status);
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_REMOVE:
                                break;
                        case SEARCH_PRINT:
                                printk(" 0x%x", ahd->qinfifo[qinpos]);
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_COUNT:
                                ahd_qinfifo_requeue(ahd, prev_scb, scb);
                                prev_scb = scb;
@@ -8271,7 +8271,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
                                if ((mk_msg_scb->flags & SCB_ACTIVE) == 0)
                                        printk("Inactive SCB pending MK_MSG\n");
                                ahd_done_with_status(ahd, mk_msg_scb, status);
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_REMOVE:
                        {
                                u_int tail_offset;
@@ -8295,7 +8295,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
                        }
                        case SEARCH_PRINT:
                                printk(" 0x%x", SCB_GET_TAG(scb));
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_COUNT:
                                break;
                        }
@@ -8376,7 +8376,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
                        if ((scb->flags & SCB_ACTIVE) == 0)
                                printk("Inactive SCB in Waiting List\n");
                        ahd_done_with_status(ahd, scb, status);
-                       /* fall through */
+                       fallthrough;
                case SEARCH_REMOVE:
                        ahd_rem_wscb(ahd, scbid, prev, next, tid);
                        *list_tail = prev;
@@ -8385,7 +8385,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
                        break;
                case SEARCH_PRINT:
                        printk("0x%x ", scbid);
-                       /* fall through */
+                       fallthrough;
                case SEARCH_COUNT:
                        prev = scbid;
                        break;
@@ -9023,7 +9023,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
        case SCSI_STATUS_OK:
                printk("%s: Interrupted for status of 0???\n",
                       ahd_name(ahd));
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                ahd_done(ahd, scb);
                break;
@@ -9512,7 +9512,7 @@ ahd_download_instr(struct ahd_softc *ahd, u_int instrptr, uint8_t *dconsts)
                fmt3_ins = &instr.format3;
                fmt3_ins->address = ahd_resolve_seqaddr(ahd, fmt3_ins->address);
        }
-               /* fall through */
+               fallthrough;
        case AIC_OP_OR:
        case AIC_OP_AND:
        case AIC_OP_XOR:
@@ -9523,7 +9523,7 @@ ahd_download_instr(struct ahd_softc *ahd, u_int instrptr, uint8_t *dconsts)
                        fmt1_ins->immediate = dconsts[fmt1_ins->immediate];
                }
                fmt1_ins->parity = 0;
-               /* fall through */
+               fallthrough;
        case AIC_OP_ROL:
        {
                int i, count;
index d019e3f..7c32130 100644 (file)
@@ -2035,7 +2035,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
                break;
        case CAM_AUTOSENSE_FAIL:
                new_status = DID_ERROR;
-               /* Fallthrough */
+               fallthrough;
        case CAM_SCSI_STATUS_ERROR:
                scsi_status = ahd_cmd_get_scsi_status(cmd);
 
index 3d4df90..2231c4a 100644 (file)
@@ -2404,7 +2404,7 @@ ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo,
                        *bus_width = MSG_EXT_WDTR_BUS_16_BIT;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_EXT_WDTR_BUS_8_BIT:
                *bus_width = MSG_EXT_WDTR_BUS_8_BIT;
                break;
@@ -3599,7 +3599,7 @@ ahc_parse_msg(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
                break;
        case MSG_MESSAGE_REJECT:
                response = ahc_handle_msg_reject(ahc, devinfo);
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_NOOP:
                done = MSGLOOP_MSGCOMPLETE;
                break;
@@ -4465,17 +4465,17 @@ ahc_free(struct ahc_softc *ahc)
        default:
        case 5:
                ahc_shutdown(ahc);
-               /* FALLTHROUGH */
+               fallthrough;
        case 4:
                ahc_dmamap_unload(ahc, ahc->shared_data_dmat,
                                  ahc->shared_data_dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 3:
                ahc_dmamem_free(ahc, ahc->shared_data_dmat, ahc->qoutfifo,
                                ahc->shared_data_dmamap);
                ahc_dmamap_destroy(ahc, ahc->shared_data_dmat,
                                   ahc->shared_data_dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 2:
                ahc_dma_tag_destroy(ahc, ahc->shared_data_dmat);
        case 1:
@@ -4893,30 +4893,30 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
                }
                ahc_dma_tag_destroy(ahc, scb_data->sg_dmat);
        }
-               /* fall through */
+               fallthrough;
        case 6:
                ahc_dmamap_unload(ahc, scb_data->sense_dmat,
                                  scb_data->sense_dmamap);
-               /* fall through */
+               fallthrough;
        case 5:
                ahc_dmamem_free(ahc, scb_data->sense_dmat, scb_data->sense,
                                scb_data->sense_dmamap);
                ahc_dmamap_destroy(ahc, scb_data->sense_dmat,
                                   scb_data->sense_dmamap);
-               /* fall through */
+               fallthrough;
        case 4:
                ahc_dma_tag_destroy(ahc, scb_data->sense_dmat);
-               /* fall through */
+               fallthrough;
        case 3:
                ahc_dmamap_unload(ahc, scb_data->hscb_dmat,
                                  scb_data->hscb_dmamap);
-               /* fall through */
+               fallthrough;
        case 2:
                ahc_dmamem_free(ahc, scb_data->hscb_dmat, scb_data->hscbs,
                                scb_data->hscb_dmamap);
                ahc_dmamap_destroy(ahc, scb_data->hscb_dmat,
                                   scb_data->hscb_dmamap);
-               /* fall through */
+               fallthrough;
        case 1:
                ahc_dma_tag_destroy(ahc, scb_data->hscb_dmat);
                break;
@@ -5981,7 +5981,7 @@ ahc_search_qinfifo(struct ahc_softc *ahc, int target, char channel,
                                        printk("Inactive SCB in Waiting List\n");
                                ahc_done(ahc, scb);
                        }
-                               /* fall through */
+                               fallthrough;
                        case SEARCH_REMOVE:
                                next = ahc_rem_wscb(ahc, next, prev);
                                break;
@@ -6987,7 +6987,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
                address -= address_offset;
                fmt3_ins->address = address;
        }
-               /* fall through */
+               fallthrough;
        case AIC_OP_OR:
        case AIC_OP_AND:
        case AIC_OP_XOR:
@@ -7013,7 +7013,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
                        fmt1_ins->opcode = AIC_OP_AND;
                        fmt1_ins->immediate = 0xff;
                }
-               /* fall through */
+               fallthrough;
        case AIC_OP_ROL:
                if ((ahc->features & AHC_ULTRA2) != 0) {
                        int i, count;
index c264b4b..e2d880a 100644 (file)
@@ -706,11 +706,11 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
        switch (pd->max_sas_lrate) {
        case SAS_LINK_RATE_6_0_GBPS:
                *speed_mask &= ~SAS_SPEED_60_DIS;
-               /* fall through*/
+               fallthrough;
        default:
        case SAS_LINK_RATE_3_0_GBPS:
                *speed_mask &= ~SAS_SPEED_30_DIS;
-               /* fall through*/
+               fallthrough;
        case SAS_LINK_RATE_1_5_GBPS:
                *speed_mask &= ~SAS_SPEED_15_DIS;
        }
@@ -718,7 +718,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
        switch (pd->min_sas_lrate) {
        case SAS_LINK_RATE_6_0_GBPS:
                *speed_mask |= SAS_SPEED_30_DIS;
-               /* fall through*/
+               fallthrough;
        case SAS_LINK_RATE_3_0_GBPS:
                *speed_mask |= SAS_SPEED_15_DIS;
        default:
@@ -730,7 +730,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
        switch (pd->max_sata_lrate) {
        case SAS_LINK_RATE_3_0_GBPS:
                *speed_mask &= ~SATA_SPEED_30_DIS;
-               /* fall through*/
+               fallthrough;
        default:
        case SAS_LINK_RATE_1_5_GBPS:
                *speed_mask &= ~SATA_SPEED_15_DIS;
@@ -789,7 +789,7 @@ void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc)
 
                /* link reset retries, this should be nominal */
                control_phy->link_reset_retries = 10;
-               /* fall through */
+               fallthrough;
 
        case RELEASE_SPINUP_HOLD: /* 0x02 */
                /* decide the func_mask */
index 1fcee65..0eb6e20 100644 (file)
@@ -490,7 +490,7 @@ int asd_abort_task(struct sas_task *task)
                switch (tcs.dl_opcode) {
                default:
                        res = asd_clear_nexus(task);
-                       /* fallthrough */
+                       fallthrough;
                case TC_NO_ERROR:
                        break;
                        /* The task hasn't been sent to the device xor
index fa562a0..ec895d0 100644 (file)
@@ -4470,7 +4470,7 @@ static const char *arcmsr_info(struct Scsi_Host *host)
        case PCI_DEVICE_ID_ARECA_1202:
        case PCI_DEVICE_ID_ARECA_1210:
                raid6 = 0;
-               /*FALLTHRU*/
+               fallthrough;
        case PCI_DEVICE_ID_ARECA_1120:
        case PCI_DEVICE_ID_ARECA_1130:
        case PCI_DEVICE_ID_ARECA_1160:
index 6c68c23..2e687ce 100644 (file)
@@ -603,7 +603,7 @@ static void fas216_handlesync(FAS216_Info *info, char *msg)
                msgqueue_flush(&info->scsi.msgs);
                msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT);
                info->scsi.phase = PHASE_MSGOUT_EXPECT;
-               /* fall through */
+               fallthrough;
 
        case async:
                dev->period = info->ifcfg.asyncperiod / 4;
@@ -916,7 +916,7 @@ static void fas216_disconnect_intr(FAS216_Info *info)
                        fas216_done(info, DID_ABORT);
                        break;
                }
-               /* else, fall through */
+               fallthrough;
 
        default:                                /* huh?                                 */
                printk(KERN_ERR "scsi%d.%c: unexpected disconnect in phase %s\n",
@@ -1413,7 +1413,7 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
        case STATE(STAT_STATUS, PHASE_DATAOUT): /* Data Out     -> Status       */
        case STATE(STAT_STATUS, PHASE_DATAIN):  /* Data In      -> Status       */
                fas216_stoptransfer(info);
-               /* fall through */
+               fallthrough;
 
        case STATE(STAT_STATUS, PHASE_SELSTEPS):/* Sel w/ steps -> Status       */
        case STATE(STAT_STATUS, PHASE_MSGOUT):  /* Message Out  -> Status       */
@@ -1426,7 +1426,7 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
        case STATE(STAT_MESGIN, PHASE_DATAOUT): /* Data Out     -> Message In   */
        case STATE(STAT_MESGIN, PHASE_DATAIN):  /* Data In      -> Message In   */
                fas216_stoptransfer(info);
-               /* fall through */
+               fallthrough;
 
        case STATE(STAT_MESGIN, PHASE_COMMAND): /* Command      -> Message In   */
        case STATE(STAT_MESGIN, PHASE_SELSTEPS):/* Sel w/ steps -> Message In   */
@@ -1581,7 +1581,7 @@ static void fas216_funcdone_intr(FAS216_Info *info, unsigned int stat, unsigned
                        fas216_message(info);
                        break;
                }
-               /* else, fall through */
+               fallthrough;
 
        default:
                fas216_log(info, 0, "internal phase %s for function done?"
@@ -1964,7 +1964,7 @@ static void fas216_kick(FAS216_Info *info)
        switch (where_from) {
        case TYPE_QUEUE:
                fas216_allocate_tag(info, SCpnt);
-               /* fall through */
+               fallthrough;
        case TYPE_OTHER:
                fas216_start_command(info, SCpnt);
                break;
index 93da634..a13c203 100644 (file)
@@ -677,7 +677,7 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
        case ISCSI_PARAM_MAX_XMIT_DLENGTH:
                if (conn->max_xmit_dlength > 65536)
                        conn->max_xmit_dlength = 65536;
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index 8dc2e08..5c3513a 100644 (file)
@@ -1532,7 +1532,7 @@ beiscsi_hdl_get_handle(struct beiscsi_conn *beiscsi_conn,
                break;
        case UNSOL_DATA_DIGEST_ERROR_NOTIFY:
                error = 1;
-               /* fall through */
+               fallthrough;
        case UNSOL_DATA_NOTIFY:
                pasync_handle = pasync_ctx->async_entry[ci].data;
                break;
index 29f9956..38d1c45 100644 (file)
@@ -2572,7 +2572,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
        case FCP_IODIR_RW:
                bfa_stats(itnim, input_reqs);
                bfa_stats(itnim, output_reqs);
-               /* fall through */
+               fallthrough;
        default:
                bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_fn_lpu(ioim->bfa));
        }
@@ -2807,7 +2807,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
 
        case BFI_IOIM_STS_TIMEDOUT:
                bfa_stats(ioim->itnim, iocomp_timedout);
-               /* fall through */
+               fallthrough;
        case BFI_IOIM_STS_ABORTED:
                rsp->io_status = BFI_IOIM_STS_ABORTED;
                bfa_stats(ioim->itnim, iocomp_aborted);
@@ -3203,7 +3203,7 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
        switch (event) {
        case BFA_TSKIM_SM_DONE:
                bfa_reqq_wcancel(&tskim->reqq_wait);
-               /* fall through */
+               fallthrough;
        case BFA_TSKIM_SM_QRESUME:
                bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup);
                bfa_tskim_send_abort(tskim);
index 297a77f..3486e40 100644 (file)
@@ -6422,7 +6422,7 @@ bfa_fcs_vport_sm_logo_for_stop(struct bfa_fcs_vport_s *vport,
        switch (event) {
        case BFA_FCS_VPORT_SM_OFFLINE:
                bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
-               /* fall through */
+               fallthrough;
 
        case BFA_FCS_VPORT_SM_RSP_OK:
        case BFA_FCS_VPORT_SM_RSP_ERROR:
@@ -6448,7 +6448,7 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport,
        switch (event) {
        case BFA_FCS_VPORT_SM_OFFLINE:
                bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
-               /* fall through */
+               fallthrough;
 
        case BFA_FCS_VPORT_SM_RSP_OK:
        case BFA_FCS_VPORT_SM_RSP_ERROR:
index 143c35b..c21aa37 100644 (file)
@@ -419,13 +419,13 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
 
                bfa_fcxp_discard(rport->fcxp);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_FAILED:
                if (rport->plogi_retries < BFA_FCS_RPORT_MAX_RETRIES) {
                        rport->plogi_retries++;
@@ -856,7 +856,7 @@ bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport,
                 * At least go offline when a PLOGI is received.
                 */
                bfa_fcxp_discard(rport->fcxp);
-               /* fall through */
+               fallthrough;
 
        case RPSM_EVENT_FAILED:
        case RPSM_EVENT_ADDRESS_CHANGE:
@@ -1042,7 +1042,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
@@ -1131,7 +1131,7 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
                        bfa_fcs_rport_send_plogiacc(rport, NULL);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case RPSM_EVENT_ADDRESS_CHANGE:
                if (!bfa_fcs_lport_is_online(rport->port)) {
@@ -1288,7 +1288,7 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
@@ -1332,7 +1332,7 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
index dd5821d..325ad8a 100644 (file)
@@ -969,7 +969,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event)
 
        case IOCPF_E_INITFAIL:
                bfa_iocpf_timer_stop(ioc);
-               /* fall through */
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                writel(1, ioc->ioc_regs.ioc_sem_reg);
@@ -1045,7 +1045,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event)
 
        case IOCPF_E_FAIL:
                bfa_iocpf_timer_stop(ioc);
-               /* fall through */
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL);
@@ -5988,7 +5988,7 @@ bfa_dconf_sm_final_sync(struct bfa_dconf_mod_s *dconf,
        case BFA_DCONF_SM_IOCDISABLE:
        case BFA_DCONF_SM_FLASH_COMP:
                bfa_timer_stop(&dconf->timer);
-               /* fall through */
+               fallthrough;
        case BFA_DCONF_SM_TIMEOUT:
                bfa_sm_set_state(dconf, bfa_dconf_sm_uninit);
                bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE);
index 1e266c1..11c0c3e 100644 (file)
@@ -6397,7 +6397,7 @@ bfa_dport_sm_starting(struct bfa_dport_s *dport, enum bfa_dport_sm_event event)
                        dport->test_state = BFA_DPORT_ST_INP;
                        bfa_dport_result_start(dport, BFA_DPORT_OPMODE_MANU);
                }
-               /* fall thru */
+               fallthrough;
 
        case BFA_DPORT_SM_REQFAIL:
                bfa_sm_set_state(dport, bfa_dport_sm_enabled);
index e72d7bb..0899209 100644 (file)
@@ -1404,7 +1404,6 @@ void bnx2fc_indicate_kcqe(void *context, struct kcqe *kcq[],
                        break;
 
                case FCOE_KCQE_OPCODE_FCOE_ERROR:
-                       /* fall thru */
                default:
                        printk(KERN_ERR PFX "unknown opcode 0x%x\n",
                                                                kcqe->op_code);
index 98d4d39..7fa2060 100644 (file)
@@ -2939,7 +2939,7 @@ csio_hws_quiescing(struct csio_hw *hw, enum csio_hw_ev evt)
                case CSIO_HWE_FW_DLOAD:
                        csio_set_state(&hw->sm, csio_hws_resetting);
                        /* Download firmware */
-                       /* Fall through */
+                       fallthrough;
 
                case CSIO_HWE_HBA_RESET:
                        csio_set_state(&hw->sm, csio_hws_resetting);
index 61cf542..dc98f51 100644 (file)
@@ -1187,7 +1187,6 @@ csio_lns_online(struct csio_lnode *ln, enum csio_ln_ev evt)
                break;
 
        case CSIO_LNE_LINK_DOWN:
-               /* Fall through */
        case CSIO_LNE_DOWN_LINK:
                csio_set_state(&ln->sm, csio_lns_uninit);
                if (csio_is_phys_ln(ln)) {
index 0ca6951..9010cb6 100644 (file)
@@ -808,7 +808,7 @@ csio_wr_destroy_queues(struct csio_hw *hw, bool cmd)
 
                                csio_q_eqid(hw, i) = CSIO_MAX_QID;
                        }
-                       /* fall through */
+                       fallthrough;
                case CSIO_INGRESS:
                        if (csio_q_iqid(hw, i) != CSIO_MAX_QID) {
                                csio_wr_cleanup_iq_ftr(hw, i);
index 2b48954..37d9935 100644 (file)
@@ -643,7 +643,7 @@ static int abort_status_to_errno(struct cxgbi_sock *csk, int abort_reason,
                                 int *need_rst)
 {
        switch (abort_reason) {
-       case CPL_ERR_BAD_SYN: /* fall through */
+       case CPL_ERR_BAD_SYN:
        case CPL_ERR_CONN_RESET:
                return csk->state > CTP_ESTABLISHED ? -EPIPE : -ECONNRESET;
        case CPL_ERR_XMIT_TIMEDOUT:
index 4e82c14..2c34915 100644 (file)
@@ -1133,7 +1133,7 @@ static int abort_status_to_errno(struct cxgbi_sock *csk, int abort_reason,
                                                                int *need_rst)
 {
        switch (abort_reason) {
-       case CPL_ERR_BAD_SYN: /* fall through */
+       case CPL_ERR_BAD_SYN:
        case CPL_ERR_CONN_RESET:
                return csk->state > CTP_ESTABLISHED ?
                        -EPIPE : -ECONNRESET;
index 94250eb..e72440d 100644 (file)
@@ -748,16 +748,16 @@ static void term_intr(struct cxlflash_cfg *cfg, enum undo_level level,
                /* SISL_MSI_ASYNC_ERROR is setup only for the primary HWQ */
                if (index == PRIMARY_HWQ)
                        cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 3, hwq);
-               /* fall through */
+               fallthrough;
        case UNMAP_TWO:
                cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
-               /* fall through */
+               fallthrough;
        case UNMAP_ONE:
                cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
-               /* fall through */
+               fallthrough;
        case FREE_IRQ:
                cfg->ops->free_afu_irqs(hwq->ctx_cookie);
-               /* fall through */
+               fallthrough;
        case UNDO_NOOP:
                /* No action required */
                break;
@@ -971,18 +971,18 @@ static void cxlflash_remove(struct pci_dev *pdev)
        switch (cfg->init_state) {
        case INIT_STATE_CDEV:
                cxlflash_release_chrdev(cfg);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_SCSI:
                cxlflash_term_local_luns(cfg);
                scsi_remove_host(cfg->host);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_AFU:
                term_afu(cfg);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_PCI:
                cfg->ops->destroy_afu(cfg->afu_cookie);
                pci_disable_device(pdev);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_NONE:
                free_mem(cfg);
                scsi_host_put(cfg->host);
@@ -2355,11 +2355,11 @@ retry:
                        cxlflash_schedule_async_reset(cfg);
                        break;
                }
-               /* fall through - to retry */
+               fallthrough;    /* to retry */
        case -EAGAIN:
                if (++nretry < 2)
                        goto retry;
-               /* fall through - to exit */
+               fallthrough;    /* to exit */
        default:
                break;
        }
@@ -2533,12 +2533,12 @@ static int cxlflash_eh_host_reset_handler(struct scsi_cmnd *scp)
                        cfg->state = STATE_NORMAL;
                wake_up_all(&cfg->reset_waitq);
                ssleep(1);
-               /* fall through */
+               fallthrough;
        case STATE_RESET:
                wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
                if (cfg->state == STATE_NORMAL)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                rc = FAILED;
                break;
@@ -3019,7 +3019,7 @@ retry:
                wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
                if (cfg->state == STATE_NORMAL)
                        goto retry;
-               /* else, fall through */
+               fallthrough;
        default:
                /* Ideally should not happen */
                dev_err(dev, "%s: Device is not ready, state=%d\n",
@@ -3531,7 +3531,7 @@ static long cxlflash_chr_ioctl(struct file *file, unsigned int cmd,
                if (likely(do_ioctl))
                        break;
 
-               /* fall through */
+               fallthrough;
        default:
                rc = -EINVAL;
                goto out;
index 593669a..5dddf67 100644 (file)
@@ -375,14 +375,13 @@ retry:
                        switch (sshdr.sense_key) {
                        case NO_SENSE:
                        case RECOVERED_ERROR:
-                               /* fall through */
                        case NOT_READY:
                                result &= ~SAM_STAT_CHECK_CONDITION;
                                break;
                        case UNIT_ATTENTION:
                                switch (sshdr.asc) {
                                case 0x29: /* Power on Reset or Device Reset */
-                                       /* fall through */
+                                       fallthrough;
                                case 0x2A: /* Device capacity changed */
                                case 0x3F: /* Report LUNs changed */
                                        /* Retry the command once more */
@@ -1791,13 +1790,12 @@ static int process_sense(struct scsi_device *sdev,
        switch (sshdr.sense_key) {
        case NO_SENSE:
        case RECOVERED_ERROR:
-               /* fall through */
        case NOT_READY:
                break;
        case UNIT_ATTENTION:
                switch (sshdr.asc) {
                case 0x29: /* Power on Reset or Device Reset */
-                       /* fall through */
+                       fallthrough;
                case 0x2A: /* Device settings/capacity changed */
                        rc = read_cap16(sdev, lli);
                        if (rc) {
@@ -2157,7 +2155,7 @@ int cxlflash_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg)
                if (unlikely(rc))
                        goto cxlflash_ioctl_exit;
 
-               /* fall through */
+               fallthrough;
 
        case DK_CXLFLASH_MANAGE_LUN:
                known_ioctl = true;
@@ -2168,7 +2166,7 @@ int cxlflash_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg)
                if (likely(do_ioctl))
                        break;
 
-               /* fall through */
+               fallthrough;
        default:
                rc = -EINVAL;
                goto cxlflash_ioctl_exit;
index 8acd4bb..4a3f783 100644 (file)
@@ -60,7 +60,7 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h,
                        ret = SCSI_DH_OK;
                        break;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                sdev_printk(KERN_WARNING, sdev,
                           "%s: sending tur failed, sense %x/%x/%x\n",
@@ -147,7 +147,7 @@ retry:
                                rc = SCSI_DH_RETRY;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        sdev_printk(KERN_WARNING, sdev,
                                    "%s: sending start_stop_unit failed, "
index b02ac38..429d642 100644 (file)
@@ -1500,7 +1500,7 @@ bool esas2r_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi,
                        return complete_fmapi_req(a, rq, FI_STAT_SUCCESS);
                }
 
-       /* fall through */
+               fallthrough;
 
        case FI_ACT_UP: /* Upload the components */
        default:
index eb7d139..09c5c24 100644 (file)
@@ -1236,7 +1236,7 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a,
                        a->init_msg = ESAS2R_INIT_MSG_GET_INIT;
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case ESAS2R_INIT_MSG_GET_INIT:
                if (msg == ESAS2R_INIT_MSG_GET_INIT) {
@@ -1250,7 +1250,7 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a,
                                esas2r_hdebug("FAILED");
                        }
                }
-               /* fall through */
+               fallthrough;
 
        default:
                rq->req_stat = RS_SUCCESS;
index 89afa31..43a1fd1 100644 (file)
@@ -307,7 +307,7 @@ static void esp_reset_esp(struct esp *esp)
 
        case FASHME:
                esp->config2 |= (ESP_CONFIG2_HME32 | ESP_CONFIG2_HMEFENAB);
-               /* fallthrough... */
+               fallthrough;
 
        case FAS236:
        case PCSCSI:
@@ -1741,7 +1741,7 @@ again:
 
        case ESP_EVENT_DATA_IN:
                write = 1;
-               /* fallthru */
+               fallthrough;
 
        case ESP_EVENT_DATA_OUT: {
                struct esp_cmd_entry *ent = esp->active_cmd;
index 1409c76..5ea426e 100644 (file)
@@ -450,10 +450,10 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
                switch (fip->mode) {
                default:
                        LIBFCOE_FIP_DBG(fip, "invalid mode %d\n", fip->mode);
-                       /* fall-through */
+                       fallthrough;
                case FIP_MODE_AUTO:
                        LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n");
-                       /* fall-through */
+                       fallthrough;
                case FIP_MODE_FABRIC:
                case FIP_MODE_NON_FIP:
                        mutex_unlock(&fip->ctlr_mutex);
@@ -773,7 +773,7 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport,
                        fc_fcoe_set_mac(mac, fh->fh_d_id);
                        fip->update_mac(lport, mac);
                }
-               /* fall through */
+               fallthrough;
        case ELS_LS_RJT:
                op = fr_encaps(fp);
                if (op)
@@ -2439,7 +2439,7 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip,
                                          frport->enode_mac, 0);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case FIP_ST_VNMP_START:
                LIBFCOE_FIP_DBG(fip, "vn_probe_req: "
                                "restart VN2VN negotiation\n");
index 2cc676e..29e4cdc 100644 (file)
@@ -340,7 +340,7 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
                        break;
                case BOARD_DTC3181E:
                        hostdata->io_width = 2; /* 16-bit PDMA */
-                       /* fall through */
+                       fallthrough;
                case BOARD_NCR53C400A:
                case BOARD_HP_C2502:
                        hostdata->c400_ctl_status = 9;
index 11caa4b..d9d21d2 100644 (file)
@@ -1144,7 +1144,7 @@ static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func,
                        hisi_hba->hw->get_events(hisi_hba, phy_no);
                        break;
                }
-               /* fallthru */
+               fallthrough;
        case PHY_FUNC_RELEASE_SPINUP_HOLD:
        default:
                return -EOPNOTSUPP;
index 91794a5..48d5da5 100644 (file)
@@ -4697,7 +4697,7 @@ static int fixup_ioaccel_cdb(u8 *cdb, int *cdb_len)
        case WRITE_6:
        case WRITE_12:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_6:
        case READ_12:
                if (*cdb_len == 6) {
@@ -5147,7 +5147,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
        switch (cmd->cmnd[0]) {
        case WRITE_6:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_6:
                first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
                                (cmd->cmnd[2] << 8) |
@@ -5158,7 +5158,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
                break;
        case WRITE_10:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_10:
                first_block =
                        (((u64) cmd->cmnd[2]) << 24) |
@@ -5171,7 +5171,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
                break;
        case WRITE_12:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_12:
                first_block =
                        (((u64) cmd->cmnd[2]) << 24) |
@@ -5186,7 +5186,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
                break;
        case WRITE_16:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_16:
                first_block =
                        (((u64) cmd->cmnd[2]) << 56) |
index 77f4d37..ea7c893 100644 (file)
@@ -1866,7 +1866,7 @@ static int ibmvfc_bsg_request(struct bsg_job *job)
                port_id = (bsg_request->rqst_data.h_els.port_id[0] << 16) |
                        (bsg_request->rqst_data.h_els.port_id[1] << 8) |
                        bsg_request->rqst_data.h_els.port_id[2];
-               /* fall through */
+               fallthrough;
        case FC_BSG_RPT_ELS:
                fc_flags = IBMVFC_FC_ELS;
                break;
@@ -1875,7 +1875,7 @@ static int ibmvfc_bsg_request(struct bsg_job *job)
                port_id = (bsg_request->rqst_data.h_ct.port_id[0] << 16) |
                        (bsg_request->rqst_data.h_ct.port_id[1] << 8) |
                        bsg_request->rqst_data.h_ct.port_id[2];
-               /* fall through */
+               fallthrough;
        case FC_BSG_RPT_CT:
                fc_flags = IBMVFC_FC_CT_IU;
                break;
@@ -4122,7 +4122,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt)
                return;
        case IBMVFC_MAD_CRQ_ERROR:
                ibmvfc_retry_host_init(vhost);
-               /* fall through */
+               fallthrough;
        case IBMVFC_MAD_DRIVER_FAILED:
                ibmvfc_free_event(evt);
                return;
index d9e94e8..cc3908c 100644 (file)
@@ -1581,7 +1581,7 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
        case H_PERMISSION:
                if (connection_broken(vscsi))
                        flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
-               /* Fall through */
+               fallthrough;
        default:
                dev_err(&vscsi->dev, "adapter_info: h_copy_rdma to client failed, rc %ld\n",
                        rc);
@@ -2489,10 +2489,10 @@ static long ibmvscsis_ping_response(struct scsi_info *vscsi)
                break;
        case H_CLOSED:
                vscsi->flags |= CLIENT_FAILED;
-               /* Fall through */
+               fallthrough;
        case H_DROPPED:
                vscsi->flags |= RESPONSE_Q_DOWN;
-               /* Fall through */
+               fallthrough;
        case H_REMOTE_PARM:
                dev_err(&vscsi->dev, "ping_response: h_send_crq failed, rc %ld\n",
                        rc);
index 1459b14..862d35a 100644 (file)
@@ -801,7 +801,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
        case 1:         /* Phase 1 - Connected */
                imm_connect(dev, CONNECT_EPP_MAYBE);
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 2:         /* Phase 2 - We are now talking to the scsi bus */
                if (!imm_select(dev, scmd_id(cmd))) {
@@ -809,7 +809,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                        return 0;
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 3:         /* Phase 3 - Ready to accept a command */
                w_ctr(ppb, 0x0c);
@@ -819,7 +819,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                if (!imm_send_command(cmd))
                        return 0;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 4:         /* Phase 4 - Setup scatter/gather buffers */
                if (scsi_bufflen(cmd)) {
@@ -835,7 +835,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                cmd->SCp.phase++;
                if (cmd->SCp.this_residual & 0x01)
                        cmd->SCp.this_residual++;
-               /* fall through */
+               fallthrough;
 
        case 5:         /* Phase 5 - Pre-Data transfer stage */
                /* Spin lock for BUSY */
@@ -852,7 +852,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                        if (imm_negotiate(dev))
                                return 0;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 6:         /* Phase 6 - Data transfer stage */
                /* Spin lock for BUSY */
@@ -868,7 +868,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                                return 1;
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 7:         /* Phase 7 - Post data transfer stage */
                if ((dev->dp) && (dev->rd)) {
@@ -880,7 +880,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                        }
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 8:         /* Phase 8 - Read status/message */
                /* Check for data overrun */
index 7f9b3f2..4cacb80 100644 (file)
@@ -778,7 +778,7 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
                        break;
                case SCU_EVENT_LINK_FAILURE:
                        scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
-                       /* fall through */
+                       fallthrough;
                case SCU_EVENT_HARD_RESET_RECEIVED:
                        /* Start the oob/sn state machine over again */
                        sci_change_state(&iphy->sm, SCI_PHY_STARTING);
index cd1e4b4..c3f540b 100644 (file)
@@ -310,7 +310,7 @@ static void isci_remote_device_not_ready(struct isci_host *ihost,
                /* Kill all outstanding requests for the device. */
                sci_remote_device_terminate_requests(idev);
 
-               /* Fall through - into the default case... */
+               fallthrough;    /* into the default case */
        default:
                clear_bit(IDEV_IO_READY, &idev->flags);
                break;
@@ -593,7 +593,7 @@ enum sci_status sci_remote_device_event_handler(struct isci_remote_device *idev,
 
                        break;
                }
-               /* fall through - and treat as unhandled... */
+               fallthrough;    /* and treat as unhandled */
        default:
                dev_dbg(scirdev_to_dev(idev),
                        "%s: device: %p event code: %x: %s\n",
index 474a434..68333f5 100644 (file)
@@ -225,7 +225,7 @@ static void sci_remote_node_context_continue_state_transitions(struct sci_remote
        case RNC_DEST_READY:
        case RNC_DEST_SUSPENDED_RESUME:
                rnc->destination_state = RNC_DEST_READY;
-               /* Fall through... */
+               fallthrough;
        case RNC_DEST_FINAL:
                sci_remote_node_context_resume(rnc, rnc->user_callback,
                                               rnc->user_cookie);
@@ -601,9 +601,9 @@ enum sci_status sci_remote_node_context_suspend(
                                 __func__, sci_rnc);
                        return SCI_FAILURE_INVALID_STATE;
                }
-               /* Fall through - and handle like SCI_RNC_POSTING */
+               fallthrough;    /* and handle like SCI_RNC_POSTING */
        case SCI_RNC_RESUMING:
-               /* Fall through - and handle like SCI_RNC_POSTING */
+               fallthrough;    /* and handle like SCI_RNC_POSTING */
        case SCI_RNC_POSTING:
                /* Set the destination state to AWAIT - this signals the
                 * entry into the SCI_RNC_READY state that a suspension
index 6561a07..6e08179 100644 (file)
@@ -894,7 +894,7 @@ sci_io_request_terminate(struct isci_request *ireq)
                 * and don't wait for the task response.
                 */
                sci_change_state(&ireq->sm, SCI_REQ_ABORTING);
-               /* Fall through - and handle like ABORTING... */
+               fallthrough;    /* and handle like ABORTING */
        case SCI_REQ_ABORTING:
                if (!isci_remote_device_is_safe_to_abort(ireq->target_device))
                        set_bit(IREQ_PENDING_ABORT, &ireq->flags);
index 16eb3b6..96a2952 100644 (file)
@@ -2108,7 +2108,7 @@ static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg)
        switch (op) {
        case ELS_LS_RJT:
                FC_EXCH_DBG(aborted_ep, "LS_RJT for RRQ\n");
-               /* fall through */
+               fallthrough;
        case ELS_LS_ACC:
                goto cleanup;
        default:
@@ -2622,7 +2622,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
        case FC_EOF_T:
                if (f_ctl & FC_FC_END_SEQ)
                        skb_trim(fp_skb(fp), fr_len(fp) - FC_FC_FILL(f_ctl));
-               /* fall through */
+               fallthrough;
        case FC_EOF_N:
                if (fh->fh_type == FC_TYPE_BLS)
                        fc_exch_recv_bls(ema->mp, fp);
index e11d4f0..7cfeb68 100644 (file)
@@ -752,7 +752,7 @@ static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
                brp = fc_frame_payload_get(fp, sizeof(*brp));
                if (brp && brp->br_reason == FC_BA_RJT_LOG_ERR)
                        break;
-               /* fall thru */
+               fallthrough;
        default:
                /*
                 * we will let the command timeout
@@ -1536,7 +1536,7 @@ static void fc_fcp_rec_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
                                   "device %x invalid REC reject %d/%d\n",
                                   fsp->rport->port_id, rjt->er_reason,
                                   rjt->er_explan);
-                       /* fall through */
+                       fallthrough;
                case ELS_RJT_UNSUP:
                        FC_FCP_DBG(fsp, "device does not support REC\n");
                        rpriv = fsp->rport->dd_data;
@@ -1668,7 +1668,7 @@ static void fc_fcp_rec_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
                FC_FCP_DBG(fsp, "REC %p fid %6.6x error unexpected error %d\n",
                           fsp, fsp->rport->port_id, error);
                fsp->status_code = FC_CMD_PLOGO;
-               /* fall through */
+               fallthrough;
 
        case -FC_EX_TIMEOUT:
                /*
@@ -1830,7 +1830,7 @@ static void fc_fcp_srr_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
                break;
        case -FC_EX_CLOSED:                     /* e.g., link failure */
                FC_FCP_DBG(fsp, "SRR error, exchange closed\n");
-               /* fall through */
+               fallthrough;
        default:
                fc_fcp_retry_cmd(fsp, FC_ERROR);
                break;
index b84dbc3..6557fda 100644 (file)
@@ -1578,7 +1578,7 @@ static void fc_lport_timeout(struct work_struct *work)
        case LPORT_ST_DPRT:
                FC_LPORT_DBG(lport, "Skipping lport state %s to SCR\n",
                             fc_lport_state(lport));
-               /* fall thru */
+               fallthrough;
        case LPORT_ST_SCR:
                fc_lport_enter_scr(lport);
                break;
index 18663a8..a60b228 100644 (file)
@@ -1723,7 +1723,7 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp)
                        kref_put(&rdata->kref, fc_rport_destroy);
                        goto busy;
                }
-               /* fall through */
+               fallthrough;
        default:
                FC_RPORT_DBG(rdata,
                             "Reject ELS 0x%02x while in state %s\n",
index 49c8a18..1e9c317 100644 (file)
@@ -248,7 +248,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)
                hdr_lun = scsilun_to_int(&tmf->lun);
                if (hdr_lun != task->sc->device->lun)
                        return 0;
-               /* fall through */
+               fallthrough;
        case ISCSI_TM_FUNC_TARGET_WARM_RESET:
                /*
                 * Fail all SCSI cmd PDUs
@@ -1674,7 +1674,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
                                sc->result = DID_NO_CONNECT << 16;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case ISCSI_STATE_IN_RECOVERY:
                        reason = FAILURE_SESSION_IN_RECOVERY;
                        sc->result = DID_IMM_RETRY << 16;
@@ -2239,7 +2239,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
                                              "progress\n");
                        goto success;
                }
-               /* fall through */
+               fallthrough;
        default:
                conn->tmf_state = TMF_INITIAL;
                goto failed;
index 6ef93c7..37e5d4e 100644 (file)
@@ -772,7 +772,7 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
                        iscsi_tcp_data_recv_prep(tcp_conn);
                        return 0;
                }
-       /* fall through */
+               fallthrough;
        case ISCSI_OP_LOGOUT_RSP:
        case ISCSI_OP_NOOP_IN:
        case ISCSI_OP_SCSI_TMFUNC_RSP:
index 1b93332..6a521ba 100644 (file)
@@ -324,7 +324,7 @@ static int smp_ata_check_ready(struct ata_link *link)
        case SAS_END_DEVICE:
                if (ex_phy->attached_sata_dev)
                        return sas_ata_clear_pending(dev, ex_phy);
-               /* fall through */
+               fallthrough;
        default:
                return -ENODEV;
        }
index daf951b..cd7c7d2 100644 (file)
@@ -108,7 +108,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
                        rphy = NULL;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case SAS_END_DEVICE:
                rphy = sas_end_device_alloc(port->port);
                break;
index b7d1b1e..8d6bcc1 100644 (file)
@@ -1096,7 +1096,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
                } else
                        memcpy(dev->port->disc.fanout_sas_addr,
                               ex_phy->attached_sas_addr, SAS_ADDR_SIZE);
-               /* fallthrough */
+               fallthrough;
        case SAS_EDGE_EXPANDER_DEVICE:
                child = sas_ex_discover_expander(dev, phy_id);
                break;
index 9e0975e..1bf9398 100644 (file)
@@ -622,7 +622,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
                                sas_scsi_clear_queue_lu(work_q, cmd);
                                goto Again;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case TASK_IS_NOT_AT_LU:
                case TASK_ABORT_FAILED:
                        pr_notice("task 0x%p is not at LU: I_T recover\n",
index ef2015f..d0141a2 100644 (file)
@@ -3202,7 +3202,7 @@ port_out:
        case SLI_MGMT_GHAT:
        case SLI_MGMT_GRPL:
                rsp_size = FC_MAX_NS_RSP;
-               /* fall through */
+               fallthrough;
        case SLI_MGMT_DHBA:
        case SLI_MGMT_DHAT:
                pe = (struct lpfc_fdmi_port_entry *)&CtReq->un.PortID;
@@ -3215,7 +3215,7 @@ port_out:
        case SLI_MGMT_GPAT:
        case SLI_MGMT_GPAS:
                rsp_size = FC_MAX_NS_RSP;
-               /* fall through */
+               fallthrough;
        case SLI_MGMT_DPRT:
        case SLI_MGMT_DPA:
                pe = (struct lpfc_fdmi_port_entry *)&CtReq->un.PortID;
index 48dc63f..6aae61d 100644 (file)
@@ -9134,7 +9134,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                                lpfc_nlp_put(ndlp);
                                return;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        /* Try to recover from this error */
                        if (phba->sli_rev == LPFC_SLI_REV4)
index 142a021..d32c7e7 100644 (file)
@@ -4728,15 +4728,14 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,
                case CMD_GEN_REQUEST64_CR:
                        if (iocb->context_un.ndlp == ndlp)
                                return 1;
-                       /* fall through */
+                       fallthrough;
                case CMD_ELS_REQUEST64_CR:
                        if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID)
                                return 1;
-                       /* fall through */
+                       fallthrough;
                case CMD_XMIT_ELS_RSP64_CX:
                        if (iocb->context1 == (uint8_t *) ndlp)
                                return 1;
-                       /* fall through */
                }
        } else if (pring->ringno == LPFC_FCP_RING) {
                /* Skip match check if waiting to relogin to FCP target */
@@ -6055,7 +6054,7 @@ restart_disc:
 
        case LPFC_LINK_UP:
                lpfc_issue_clear_la(phba, vport);
-               /* fall through */
+               fallthrough;
        case LPFC_LINK_UNKNOWN:
        case LPFC_WARM_START:
        case LPFC_INIT_START:
index cad53d1..92d6e7b 100644 (file)
@@ -464,7 +464,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        case  NLP_STE_NPR_NODE:
                if (!(ndlp->nlp_flag & NLP_NPR_ADISC))
                        break;
-               /* fall through */
+               fallthrough;
        case  NLP_STE_REG_LOGIN_ISSUE:
        case  NLP_STE_PRLI_ISSUE:
        case  NLP_STE_UNMAPPED_NODE:
index e5be334..0c39ed5 100644 (file)
@@ -1225,7 +1225,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,
                                         lpfc_ncmd, nCmd,
                                         lpfc_ncmd->cur_iocbq.sli4_xritag,
                                         bf_get(lpfc_wcqe_c_xb, wcqe));
-                       /* fall through */
+                       fallthrough;
                default:
 out_err:
                        lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR,
index 5e802c8..983eeb0 100644 (file)
@@ -1093,7 +1093,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case SCSI_PROT_WRITE_INSERT:
                                /*
                                 * For WRITE_INSERT, force the error
@@ -1213,7 +1213,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
                                        rc = BG_ERR_TGT | BG_ERR_CHECK;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case SCSI_PROT_WRITE_INSERT:
                                /*
                                 * For WRITE_INSERT, force the
@@ -1295,7 +1295,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
                        switch (op) {
                        case SCSI_PROT_WRITE_PASS:
                                rc = BG_ERR_CHECK;
-                               /* fall through */
+                               fallthrough;
 
                        case SCSI_PROT_WRITE_INSERT:
                                /*
@@ -3980,7 +3980,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                                        lpfc_cmd->cur_iocbq.sli4_lxritag,
                                        0, 0);
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        cmd->result = DID_ERROR << 16;
                        break;
index 4cd7ded..e158cd7 100644 (file)
@@ -9339,7 +9339,7 @@ __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uint32_t ring_number,
                         */
                        if (piocb->iocb_cmpl)
                                piocb->iocb_cmpl = NULL;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case CMD_CREATE_XRI_CR:
                case CMD_CLOSE_XRI_CN:
                case CMD_CLOSE_XRI_CX:
@@ -9653,7 +9653,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                cmnd = CMD_XMIT_SEQUENCE64_CR;
                if (phba->link_flag & LS_LOOPBACK_MODE)
                        bf_set(wqe_xo, &wqe->xmit_sequence.wge_ctl, 1);
-               /* fall through */
+               fallthrough;
        case CMD_XMIT_SEQUENCE64_CR:
                /* word3 iocb=io_tag32 wqe=reserved */
                wqe->xmit_sequence.rsvd3 = 0;
@@ -13630,7 +13630,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
        case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                "2537 Receive Frame Truncated!!\n");
-               /* fall through */
+               fallthrough;
        case FC_STATUS_RQ_SUCCESS:
                spin_lock_irqsave(&phba->hbalock, iflags);
                lpfc_sli4_rq_release(hrq, drq);
@@ -13678,7 +13678,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
                                        atomic_read(&tgtp->rcv_fcp_cmd_out),
                                        atomic_read(&tgtp->xmt_fcp_release));
                }
-               /* fallthrough */
+               fallthrough;
 
        case FC_STATUS_INSUFF_BUF_NEED_BUF:
                hrq->RQ_no_posted_buf++;
@@ -14162,7 +14162,7 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
        case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                "6126 Receive Frame Truncated!!\n");
-               /* fall through */
+               fallthrough;
        case FC_STATUS_RQ_SUCCESS:
                spin_lock_irqsave(&phba->hbalock, iflags);
                lpfc_sli4_rq_release(hrq, drq);
@@ -14209,7 +14209,7 @@ drop:
                                        atomic_read(&tgtp->rcv_fcp_cmd_out),
                                        atomic_read(&tgtp->xmt_fcp_release));
                }
-               /* fallthrough */
+               fallthrough;
 
        case FC_STATUS_INSUFF_BUF_NEED_BUF:
                hrq->RQ_no_posted_buf++;
@@ -15096,7 +15096,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
                        status = -EINVAL;
                        goto out;
                }
-               /* fall through - otherwise default to smallest count */
+               fallthrough;    /* otherwise default to smallest count */
        case 256:
                bf_set(lpfc_eq_context_count, &eq_create->u.request.context,
                       LPFC_EQ_CNT_256);
@@ -15238,7 +15238,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
                               LPFC_CQ_CNT_WORD7);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                "0361 Unsupported CQ count: "
@@ -15249,7 +15249,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
                        status = -EINVAL;
                        goto out;
                }
-               /* fall through - otherwise default to smallest count */
+               fallthrough;    /* otherwise default to smallest count */
        case 256:
                bf_set(lpfc_cq_context_count, &cq_create->u.request.context,
                       LPFC_CQ_CNT_256);
@@ -15417,7 +15417,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
                                               LPFC_CQ_CNT_WORD7);
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                                "3118 Bad CQ count. (%d)\n",
@@ -15426,7 +15426,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
                                        status = -EINVAL;
                                        goto out;
                                }
-                               /* fall through - otherwise default to smallest */
+                               fallthrough;    /* otherwise default to smallest */
                        case 256:
                                bf_set(lpfc_mbx_cq_create_set_cqe_cnt,
                                       &cq_set->u.request, LPFC_CQ_CNT_256);
@@ -15702,7 +15702,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
                        status = -EINVAL;
                        goto out;
                }
-               /* fall through - otherwise default to smallest count */
+               fallthrough;    /* otherwise default to smallest count */
        case 16:
                bf_set(lpfc_mq_context_ring_size,
                       &mq_create_ext->u.request.context,
@@ -16123,7 +16123,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
                                status = -EINVAL;
                                goto out;
                        }
-                       /* fall through - otherwise default to smallest count */
+                       fallthrough;    /* otherwise default to smallest count */
                case 512:
                        bf_set(lpfc_rq_context_rqe_count,
                               &rq_create->u.request.context,
@@ -16260,7 +16260,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
                                status = -EINVAL;
                                goto out;
                        }
-                       /* fall through - otherwise default to smallest count */
+                       fallthrough;    /* otherwise default to smallest count */
                case 512:
                        bf_set(lpfc_rq_context_rqe_count,
                               &rq_create->u.request.context,
index 0484ee5..ac40604 100644 (file)
@@ -491,9 +491,9 @@ mega_get_ldrv_num(adapter_t *adapter, struct scsi_cmnd *cmd, int channel)
 
        if (adapter->support_random_del && adapter->read_ldidmap )
                switch (cmd->cmnd[0]) {
-               case READ_6:    /* fall through */
-               case WRITE_6:   /* fall through */
-               case READ_10:   /* fall through */
+               case READ_6:
+               case WRITE_6:
+               case READ_10:
                case WRITE_10:
                        ldrv_num += 0x80;
                }
@@ -852,7 +852,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                        return scb;
 
 #if MEGA_HAVE_CLUSTERING
-               case RESERVE:   /* Fall through */
+               case RESERVE:
                case RELEASE:
 
                        /*
@@ -987,7 +987,7 @@ mega_prepare_passthru(adapter_t *adapter, scb_t *scb, struct scsi_cmnd *cmd,
 
                        adapter->flag |= (1L << cmd->device->channel);
                }
-               /* Fall through */
+               fallthrough;
        default:
                pthru->numsgelements = mega_build_sglist(adapter, scb,
                                &pthru->dataxferaddr, &pthru->dataxferlen);
@@ -1050,7 +1050,7 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb,
 
                        adapter->flag |= (1L << cmd->device->channel);
                }
-               /* Fall through */
+               fallthrough;
        default:
                epthru->numsgelements = mega_build_sglist(adapter, scb,
                                &epthru->dataxferaddr, &epthru->dataxferlen);
index 19469a2..4a27ac8 100644 (file)
@@ -1581,7 +1581,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
                                return NULL;
                        }
 
-                       /* Fall through */
+                       fallthrough;
 
                case READ_CAPACITY:
                        /*
index 861f714..2b7e7b5 100644 (file)
@@ -3522,7 +3522,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
                        megasas_complete_int_cmd(instance, cmd);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case MFI_CMD_LD_READ:
        case MFI_CMD_LD_WRITE:
index 0824410..883cccb 100644 (file)
@@ -3534,7 +3534,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
                                atomic_dec(&lbinfo->scsi_pending_cmds[cmd_fusion->pd_r1_lb]);
                                cmd_fusion->scmd->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG;
                        }
-                       /* Fall through - and complete IO */
+                       fallthrough;    /* and complete IO */
                case MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST: /* LD-IO Path */
                        atomic_dec(&instance->fw_outstanding);
                        if (cmd_fusion->r1_alt_dev_handle == MR_DEVHANDLE_INVALID) {
index fd1d030..0a9f4e4 100644 (file)
@@ -1457,7 +1457,7 @@ static void cmd_complete(struct mesh_state *ms)
                /* huh?  we expected a phase mismatch */
                ms->n_msgin = 0;
                ms->msgphase = msg_in;
-               /* fall through */
+               fallthrough;
 
        case msg_in:
                /* should have some message bytes in fifo */
index 1d64524..5730f32 100644 (file)
@@ -4681,7 +4681,7 @@ _base_update_ioc_page1_inlinewith_perf_mode(struct MPT3SAS_ADAPTER *ioc)
                        ioc_info(ioc, "performance mode: balanced\n");
                        return;
                }
-               /* Fall through */
+               fallthrough;
        case MPT_PERF_MODE_LATENCY:
                /*
                 * Enable interrupt coalescing on all reply queues
index 4326030..7c119b9 100644 (file)
@@ -1002,7 +1002,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
                }
                /* drop to default case for posting the request */
        }
-               /* fall through */
+               fallthrough;
        default:
                ioc->build_sg_mpi(ioc, psge, data_out_dma, data_out_sz,
                    data_in_dma, data_in_sz);
index 08fc4b3..2e2756d 100644 (file)
@@ -5470,7 +5470,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 
        case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN:
                scsi_set_resid(scmd, 0);
-               /* fall through */
+               fallthrough;
        case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR:
        case MPI2_IOCSTATUS_SUCCESS:
                scmd->result = (DID_OK << 16) | scsi_status;
@@ -6480,7 +6480,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc,
                        if (!test_bit(handle, ioc->pend_os_device_add))
                                break;
 
-                       /* fall through */
+                       fallthrough;
 
                case MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED:
 
@@ -7208,7 +7208,7 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,
                        event_data->PortEntry[i].PortStatus &= 0xF0;
                        event_data->PortEntry[i].PortStatus |=
                                MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED;
-                       /* fall through */
+                       fallthrough;
                case MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED:
                        if (ioc->shost_recovery)
                                break;
@@ -10653,7 +10653,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                case MPI26_MFGPAGE_DEVID_CFG_SEC_3916:
                        dev_info(&pdev->dev,
                            "HBA is in Configurable Secure mode\n");
-                       /* fall through */
+                       fallthrough;
                case MPI26_MFGPAGE_DEVID_HARD_SEC_3816:
                case MPI26_MFGPAGE_DEVID_HARD_SEC_3916:
                        ioc->is_aero_ioc = ioc->is_gen35_ioc = 1;
index d4bd31a..b2869c5 100644 (file)
@@ -650,7 +650,7 @@ static void myrb_bgi_control(struct myrb_hba *cb)
                if (sdev && cb->bgi_status.status == MYRB_BGI_INPROGRESS)
                        sdev_printk(KERN_INFO, sdev,
                                    "Background Initialization Aborted\n");
-               /* Fallthrough */
+               fallthrough;
        case MYRB_STATUS_NO_BGI_INPROGRESS:
                cb->bgi_status.status = MYRB_BGI_INVALID;
                break;
@@ -1528,7 +1528,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
                        scmd->scsi_done(scmd);
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case WRITE_6:
                lba = (((scmd->cmnd[1] & 0x1F) << 16) |
                       (scmd->cmnd[2] << 8) |
@@ -1545,7 +1545,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
                        scmd->scsi_done(scmd);
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case WRITE_10:
        case VERIFY:            /* 0x2F */
        case WRITE_VERIFY:      /* 0x2E */
@@ -1562,7 +1562,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
                        scmd->scsi_done(scmd);
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case WRITE_12:
        case VERIFY_12: /* 0xAF */
        case WRITE_VERIFY_12:   /* 0xAE */
index f88adab..03d7013 100644 (file)
@@ -3640,7 +3640,7 @@ ncr_script_copy_and_bind (struct ncb *np, ncrcmd *src, ncrcmd *dst, int len)
                                                new = old;
                                                break;
                                        }
-                                       /* fall through */
+                                       fallthrough;
                                default:
                                        panic("ncr_script_copy_and_bind: weird relocation %x\n", old);
                                        break;
@@ -3910,14 +3910,14 @@ static void __init ncr_prepare_setting(struct ncb *np)
                                        np->scsi_mode = SMODE_HVD;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case 3: /* SYMBIOS controllers report HVD through GPIO3 */
                        if (INB(nc_gpreg) & 0x08)
                                break;
-                       /* fall through */
+                       fallthrough;
                case 2: /* Set HVD unconditionally */
                        np->scsi_mode = SMODE_HVD;
-                       /* fall through */
+                       fallthrough;
                case 1: /* Trust previous settings for HVD */
                        if (np->sv_stest2 & 0x20)
                                np->scsi_mode = SMODE_HVD;
@@ -4296,7 +4296,7 @@ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
                        break;
                cp->phys.header.wgoalp  = cpu_to_scr(goalp);
                cp->phys.header.wlastp  = cpu_to_scr(lastp);
-               /* fall through */
+               fallthrough;
        case DMA_FROM_DEVICE:
                goalp = NCB_SCRIPT_PHYS (np, data_in2) + 8;
                if (segments <= MAX_SCATTERL)
@@ -6717,7 +6717,7 @@ void ncr_int_sir (struct ncb *np)
                        OUTL_DSP (scr_to_cpu(tp->lp[0]->jump_ccb[0]));
                        return;
                }
-               /* fall through */
+               fallthrough;
        case SIR_RESEL_BAD_TARGET:      /* Will send a TARGET RESET message */
        case SIR_RESEL_BAD_LUN:         /* Will send a TARGET RESET message */
        case SIR_RESEL_BAD_I_T_L_Q:     /* Will send an ABORT TAG message   */
@@ -6825,7 +6825,7 @@ void ncr_int_sir (struct ncb *np)
                */
                OUTB (HS_PRT, HS_BUSY);
 
-               /* fall through */
+               fallthrough;
 
        case SIR_NEGO_PROTO:
                /*-------------------------------------------------------
index 8655ff1..bc5a623 100644 (file)
@@ -1113,7 +1113,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
                        nsp_scsi_done(tmpSC);
                        return IRQ_HANDLED;
                }
-               /* fall thru */
+               fallthrough;
        default:
                if ((irq_status & (IRQSTATUS_SCSI | IRQSTATUS_FIFO)) == 0) {
                        return IRQ_HANDLED;
index 0ae800c..aa41f7a 100644 (file)
@@ -717,7 +717,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                        }
                        cmd->SCp.phase++;
                }
-               /* fall through */
+               fallthrough;
 
        case 2:         /* Phase 2 - We are now talking to the scsi bus */
                if (!ppa_select(dev, scmd_id(cmd))) {
@@ -725,7 +725,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                        return 0;
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 3:         /* Phase 3 - Ready to accept a command */
                w_ctr(ppb, 0x0c);
@@ -735,7 +735,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                if (!ppa_send_command(cmd))
                        return 0;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 4:         /* Phase 4 - Setup scatter/gather buffers */
                if (scsi_bufflen(cmd)) {
@@ -749,7 +749,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                }
                cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 5:         /* Phase 5 - Data transfer stage */
                w_ctr(ppb, 0x0c);
@@ -762,7 +762,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                if (retv == 0)
                        return 1;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 6:         /* Phase 6 - Read status/message */
                cmd->result = DID_OK << 16;
index 91eb690..e1d7de6 100644 (file)
@@ -380,5 +380,8 @@ extern int qla24xx_soft_reset(struct qla_hw_data *);
 static inline int
 ql_mask_match(uint level)
 {
+       if (ql2xextended_error_logging == 1)
+               ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
+
        return (level & ql2xextended_error_logging) == level;
 }
index 8c92af5..1bc090d 100644 (file)
@@ -3880,6 +3880,7 @@ struct qla_hw_data {
                uint32_t        scm_supported_f:1;
                                /* Enabled in Driver */
                uint32_t        scm_enabled:1;
+               uint32_t        max_req_queue_warned:1;
        } flags;
 
        uint16_t max_exchg;
index df670fb..b569fd6 100644 (file)
@@ -177,7 +177,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
                        break;
                case CS_TIMEOUT:
                        rval = QLA_FUNCTION_TIMEOUT;
-                       /* fall through */
+                       fallthrough;
                default:
                        ql_dbg(ql_dbg_disc, vha, 0x2033,
                            "%s failed, completion status (%x) on port_id: "
@@ -1505,11 +1505,11 @@ qla2x00_prep_ct_fdmi_req(struct ct_sns_pkt *p, uint16_t cmd,
 static uint
 qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
 {
+       uint speeds = 0;
+
        if (IS_CNA_CAPABLE(ha))
                return FDMI_PORT_SPEED_10GB;
        if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) {
-               uint speeds = 0;
-
                if (ha->max_supported_speed == 2) {
                        if (ha->min_supported_speed <= 6)
                                speeds |= FDMI_PORT_SPEED_64GB;
@@ -1536,9 +1536,16 @@ qla25xx_fdmi_port_speed_capability(struct qla_hw_data *ha)
                }
                return speeds;
        }
-       if (IS_QLA2031(ha))
-               return FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
-                       FDMI_PORT_SPEED_4GB;
+       if (IS_QLA2031(ha)) {
+               if ((ha->pdev->subsystem_vendor == 0x103C) &&
+                   (ha->pdev->subsystem_device == 0x8002)) {
+                       speeds = FDMI_PORT_SPEED_16GB;
+               } else {
+                       speeds = FDMI_PORT_SPEED_16GB|FDMI_PORT_SPEED_8GB|
+                               FDMI_PORT_SPEED_4GB;
+               }
+               return speeds;
+       }
        if (IS_QLA25XX(ha))
                return FDMI_PORT_SPEED_8GB|FDMI_PORT_SPEED_4GB|
                        FDMI_PORT_SPEED_2GB|FDMI_PORT_SPEED_1GB;
@@ -3436,7 +3443,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
                        list_for_each_entry(fcport, &vha->vp_fcports, list) {
                                if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) {
                                        fcport->scan_state = QLA_FCPORT_SCAN;
-                                       fcport->logout_on_delete = 0;
                                }
                        }
                        goto login_logout;
@@ -3532,10 +3538,22 @@ login_logout:
                }
 
                if (fcport->scan_state != QLA_FCPORT_FOUND) {
+                       bool do_delete = false;
+
+                       if (fcport->scan_needed &&
+                           fcport->disc_state == DSC_LOGIN_PEND) {
+                               /* Cable got disconnected after we sent
+                                * a login. Do delete to prevent timeout.
+                                */
+                               fcport->logout_on_delete = 1;
+                               do_delete = true;
+                       }
+
                        fcport->scan_needed = 0;
-                       if ((qla_dual_mode_enabled(vha) ||
-                               qla_ini_mode_enabled(vha)) &&
-                           atomic_read(&fcport->state) == FCS_ONLINE) {
+                       if (((qla_dual_mode_enabled(vha) ||
+                             qla_ini_mode_enabled(vha)) &&
+                           atomic_read(&fcport->state) == FCS_ONLINE) ||
+                               do_delete) {
                                if (fcport->loop_id != FC_NO_LOOP_ID) {
                                        if (fcport->flags & FCF_FCP2_DEVICE)
                                                fcport->logout_on_delete = 0;
@@ -3736,6 +3754,18 @@ static void qla2x00_async_gpnft_gnnft_sp_done(srb_t *sp, int res)
                unsigned long flags;
                const char *name = sp->name;
 
+               if (res == QLA_OS_TIMER_EXPIRED) {
+                       /* switch is ignoring all commands.
+                        * This might be a zone disable behavior.
+                        * This means we hit 64s timeout.
+                        * 22s GPNFT + 44s Abort = 64s
+                        */
+                       ql_dbg(ql_dbg_disc, vha, 0xffff,
+                              "%s: Switch Zone check please .\n",
+                              name);
+                       qla2x00_mark_all_devices_lost(vha);
+               }
+
                /*
                 * We are in an Interrupt context, queue up this
                 * sp for GNNFT_DONE work. This will allow all
index 57a2d76..507919d 100644 (file)
@@ -857,7 +857,7 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
                                            fcport);
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                if (fcport_is_smaller(fcport)) {
                                        /* local adapter is bigger */
index e3d2dea..0954fa4 100644 (file)
@@ -2874,7 +2874,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
                                            &vha->dpc_flags);
                                        qla2xxx_wake_dpc(vha);
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                ql_dbg(ql_dbg_disc, vha, 0x20eb,
                                    "%s %8phC cmd error fw_status 0x%x 0x%x 0x%x\n",
index 27bcd34..25e0a16 100644 (file)
@@ -1580,11 +1580,11 @@ global_port_update:
                                qla2xxx_wake_dpc(vha);
                        }
                }
-               /* fall through */
+               fallthrough;
        case MBA_IDC_COMPLETE:
                if (ha->notify_lb_portup_comp && !vha->vp_idx)
                        complete(&ha->lb_portup_comp);
-               /* Fallthru */
+               fallthrough;
        case MBA_IDC_TIME_EXT:
                if (IS_QLA81XX(vha->hw) || IS_QLA8031(vha->hw) ||
                    IS_QLA8044(ha))
@@ -2024,8 +2024,8 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
                                res = DID_ERROR << 16;
                        }
                }
-               ql_dbg(ql_dbg_user, vha, 0x503f,
-                   "ELS IOCB Done -%s error hdl=%x comp_status=0x%x error subcode 1=0x%x error subcode 2=0x%x total_byte=0x%x\n",
+               ql_dbg(ql_dbg_disc, vha, 0x503f,
+                   "ELS IOCB Done -%s hdl=%x comp_status=0x%x error subcode 1=0x%x error subcode 2=0x%x total_byte=0x%x\n",
                    type, sp->handle, comp_status, fw_status[1], fw_status[2],
                    le32_to_cpu(ese->total_byte_count));
                goto els_ct_done;
@@ -2188,7 +2188,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
                                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                }
-               /* fall through */
+               fallthrough;
        default:
                data[0] = MBS_COMMAND_ERROR;
                break;
@@ -2368,7 +2368,7 @@ static void qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
        case CS_PORT_UNAVAILABLE:
        case CS_PORT_LOGGED_OUT:
                fcport->nvme_flag |= NVME_FLAG_RESETTING;
-               /* fall through */
+               fallthrough;
        case CS_ABORTED:
        case CS_PORT_BUSY:
                fd->transferred_length = 0;
@@ -3485,7 +3485,7 @@ process_err:
                        } else {
                                qlt_24xx_process_atio_queue(vha, 1);
                        }
-                       /* fall through */
+                       fallthrough;
                case ABTS_RESP_24XX:
                case CTIO_TYPE7:
                case CTIO_CRC2:
index 7388343..226f142 100644 (file)
@@ -334,14 +334,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                        if (time_after(jiffies, wait_time))
                                break;
 
-                       /*
-                        * Check if it's UNLOADING, cause we cannot poll in
-                        * this case, or else a NULL pointer dereference
-                        * is triggered.
-                        */
-                       if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)))
-                               return QLA_FUNCTION_TIMEOUT;
-
                        /* Check for pending interrupts. */
                        qla2x00_poll(ha->rsp_q_map[0]);
 
@@ -5240,7 +5232,7 @@ qla2x00_read_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t *data)
        mcp->mb[8] = MSW(risc_addr);
        mcp->out_mb = MBX_8|MBX_1|MBX_0;
        mcp->in_mb = MBX_3|MBX_2|MBX_0;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
@@ -5428,7 +5420,7 @@ qla2x00_write_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t data)
        mcp->mb[8] = MSW(risc_addr);
        mcp->out_mb = MBX_8|MBX_3|MBX_2|MBX_1|MBX_0;
        mcp->in_mb = MBX_1|MBX_0;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (rval != QLA_SUCCESS) {
@@ -5700,7 +5692,7 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority,
        mcp->mb[9] = vha->vp_idx;
        mcp->out_mb = MBX_9|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
        mcp->in_mb = MBX_4|MBX_3|MBX_1|MBX_0;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
        rval = qla2x00_mailbox_command(vha, mcp);
        if (mb != NULL) {
@@ -5787,7 +5779,7 @@ qla82xx_mbx_intr_enable(scsi_qla_host_t *vha)
 
        mcp->out_mb = MBX_1|MBX_0;
        mcp->in_mb = MBX_0;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
 
        rval = qla2x00_mailbox_command(vha, mcp);
@@ -5822,7 +5814,7 @@ qla82xx_mbx_intr_disable(scsi_qla_host_t *vha)
 
        mcp->out_mb = MBX_1|MBX_0;
        mcp->in_mb = MBX_0;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
 
        rval = qla2x00_mailbox_command(vha, mcp);
@@ -6014,7 +6006,7 @@ qla81xx_set_led_config(scsi_qla_host_t *vha, uint16_t *led_cfg)
        if (IS_QLA8031(ha))
                mcp->out_mb |= MBX_6|MBX_5|MBX_4|MBX_3;
        mcp->in_mb = MBX_0;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
 
        rval = qla2x00_mailbox_command(vha, mcp);
@@ -6050,7 +6042,7 @@ qla81xx_get_led_config(scsi_qla_host_t *vha, uint16_t *led_cfg)
        mcp->in_mb = MBX_2|MBX_1|MBX_0;
        if (IS_QLA8031(ha))
                mcp->in_mb |= MBX_6|MBX_5|MBX_4|MBX_3;
-       mcp->tov = 30;
+       mcp->tov = MBX_TOV_SECONDS;
        mcp->flags = 0;
 
        rval = qla2x00_mailbox_command(vha, mcp);
index fa695a4..90bbc61 100644 (file)
@@ -536,6 +536,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
        struct nvme_private *priv = fd->private;
        struct qla_nvme_rport *qla_rport = rport->private;
 
+       if (!priv) {
+               /* nvme association has been torn down */
+               return rval;
+       }
+
        fcport = qla_rport->fcport;
 
        if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
@@ -687,7 +692,15 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
        tmpl = &qla_nvme_fc_transport;
 
        WARN_ON(vha->nvme_local_port);
-       WARN_ON(ha->max_req_queues < 3);
+
+       if (ha->max_req_queues < 3) {
+               if (!ha->flags.max_req_queue_warned)
+                       ql_log(ql_log_info, vha, 0x2120,
+                              "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n",
+                              __func__, ha->max_req_queues);
+               ha->flags.max_req_queue_warned = 1;
+               return ret;
+       }
 
        qla_nvme_fc_transport.max_hw_queues =
            min((uint8_t)(qla_nvme_fc_transport.max_hw_queues),
index 9b59f03..8da00ba 100644 (file)
@@ -2017,6 +2017,11 @@ skip_pio:
        /* Determine queue resources */
        ha->max_req_queues = ha->max_rsp_queues = 1;
        ha->msix_count = QLA_BASE_VECTORS;
+
+       /* Check if FW supports MQ or not */
+       if (!(ha->fw_attributes & BIT_6))
+               goto mqiobase_exit;
+
        if (!ql2xmqsupport || !ql2xnvmeenable ||
            (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
                goto mqiobase_exit;
@@ -2829,10 +2834,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        /* This may fail but that's ok */
        pci_enable_pcie_error_reporting(pdev);
 
-       /* Turn off T10-DIF when FC-NVMe is enabled */
-       if (ql2xnvmeenable)
-               ql2xenabledif = 0;
-
        ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
        if (!ha) {
                ql_log_pci(ql_log_fatal, pdev, 0x0009,
index e161c05..411b8a9 100644 (file)
@@ -2457,7 +2457,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, void *buf,
                                sec_mask = 0x10000;
                                break;
                        }
-                       /* Fall through... */
+                       fallthrough;
 
                case 0x1f: /* Atmel flash. */
                        /* 512k sector size. */
@@ -2466,7 +2466,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, void *buf,
                                sec_mask =   0x80000000;
                                break;
                        }
-                       /* Fall through... */
+                       fallthrough;
 
                case 0x01: /* AMD flash. */
                        if (flash_id == 0x38 || flash_id == 0x40 ||
@@ -2499,7 +2499,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, void *buf,
                                sec_mask = 0x1e000;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        /* Default to 16 kb sector size. */
                        rest_addr = 0x3fff;
index fbb80a0..2d445bd 100644 (file)
@@ -442,7 +442,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
                ql_dbg(ql_dbg_tgt, vha, 0xe073,
                        "qla_target(%d):%s: CRC2 Response pkt\n",
                        vha->vp_idx, __func__);
-               /* fall through */
+               fallthrough;
        case CTIO_TYPE7:
        {
                struct ctio7_from_24xx *entry = (struct ctio7_from_24xx *)pkt;
@@ -1270,7 +1270,7 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
 
        qla24xx_chk_fcp_state(sess);
 
-       ql_dbg(ql_dbg_tgt, sess->vha, 0xe001,
+       ql_dbg(ql_dbg_disc, sess->vha, 0xe001,
            "Scheduling sess %p for deletion %8phC\n",
            sess, sess->port_name);
 
@@ -4423,7 +4423,7 @@ static int qlt_issue_task_mgmt(struct fc_port *sess, u64 lun,
        case QLA_TGT_CLEAR_TS:
        case QLA_TGT_ABORT_TS:
                abort_cmds_for_lun(vha, lun, a->u.isp24.fcp_hdr.s_id);
-               /* fall through */
+               fallthrough;
        case QLA_TGT_CLEAR_ACA:
                h = qlt_find_qphint(vha, mcmd->unpacked_lun);
                mcmd->qpair = h->qpair;
@@ -5057,7 +5057,7 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha,
                        res = 1;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case ELS_LOGO:
        case ELS_PRLO:
                spin_lock_irqsave(&ha->tgt.sess_lock, flags);
index bab87e4..676778c 100644 (file)
@@ -2907,7 +2907,7 @@ static int qla4xxx_session_get_param(struct iscsi_cls_session *cls_sess,
                                                chap_tbl.secret_len);
                        }
                }
-               /* fall through */
+               fallthrough;
        default:
                return iscsi_session_get_param(cls_sess, param, buf);
        }
index 3790e8b..48ff7d8 100644 (file)
@@ -200,15 +200,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
        /* Write mailbox command registers. */
        switch (mbox_param[param[0]] >> 4) {
        case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
-               /* Fall through */
+               fallthrough;
        case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
-               /* Fall through */
+               fallthrough;
        case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
-               /* Fall through */
+               fallthrough;
        case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
-               /* Fall through */
+               fallthrough;
        case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
-               /* Fall through */
+               fallthrough;
        case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
        }
 
@@ -259,15 +259,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
        /* Read back output parameters. */
        switch (mbox_param[param[0]] & 0xf) {
        case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
-               /* Fall through */
+               fallthrough;
        case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
-               /* Fall through */
+               fallthrough;
        case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
-               /* Fall through */
+               fallthrough;
        case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
-               /* Fall through */
+               fallthrough;
        case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
-               /* Fall through */
+               fallthrough;
        case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
        }
 
index 064ed68..139f007 100644 (file)
@@ -5490,9 +5490,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
                                u64 d = ktime_get_boottime_ns() - ns_from_boot;
 
                                if (kt <= d) {  /* elapsed duration >= kt */
+                                       spin_lock_irqsave(&sqp->qc_lock, iflags);
                                        sqcp->a_cmnd = NULL;
                                        atomic_dec(&devip->num_in_q);
                                        clear_bit(k, sqp->in_use_bm);
+                                       spin_unlock_irqrestore(&sqp->qc_lock, iflags);
                                        if (new_sd_dp)
                                                kfree(sd_dp);
                                        /* call scsi_done() from this thread */
index 927b1e6..7d3571a 100644 (file)
@@ -599,7 +599,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
                        set_host_byte(scmd, DID_ALLOC_FAILURE);
                        return SUCCESS;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case COPY_ABORTED:
        case VOLUME_OVERFLOW:
        case MISCOMPARE:
@@ -621,7 +621,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
                        return ADD_TO_MLQUEUE;
                else
                        set_host_byte(scmd, DID_TARGET_FAILURE);
-               /* FALLTHROUGH */
+               fallthrough;
 
        case ILLEGAL_REQUEST:
                if (sshdr.asc == 0x20 || /* Invalid command operation code */
@@ -734,7 +734,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
        switch (status_byte(scmd->result)) {
        case GOOD:
                scsi_handle_queue_ramp_up(scmd->device);
-               /* FALLTHROUGH */
+               fallthrough;
        case COMMAND_TERMINATED:
                return SUCCESS;
        case CHECK_CONDITION:
@@ -755,7 +755,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
                return FAILED;
        case QUEUE_FULL:
                scsi_handle_queue_full(scmd->device);
-               /* fall through */
+               fallthrough;
        case BUSY:
                return NEEDS_RETRY;
        default:
@@ -1302,7 +1302,7 @@ retry_tur:
        case NEEDS_RETRY:
                if (retry_cnt--)
                        goto retry_tur;
-               /*FALLTHRU*/
+               fallthrough;
        case SUCCESS:
                return 0;
        default:
@@ -1739,7 +1739,7 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
                if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
                    status_byte(scmd->result) == RESERVATION_CONFLICT)
                        return 0;
-               /* fall through */
+               fallthrough;
        case DID_SOFT_ERROR:
                return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
        }
@@ -1810,7 +1810,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                        set_host_byte(scmd, DID_TIME_OUT);
                        return SUCCESS;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case DID_NO_CONNECT:
        case DID_BAD_TARGET:
                /*
@@ -1854,7 +1854,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                         * lower down
                         */
                        break;
-               /* fallthrough */
+               fallthrough;
        case DID_BUS_BUSY:
        case DID_PARITY:
                goto maybe_retry;
@@ -1892,7 +1892,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                 * the case of trying to send too many commands to a
                 * tagged queueing device.
                 */
-               /* FALLTHROUGH */
+               fallthrough;
        case BUSY:
                /*
                 * device can't talk to us at the moment.  Should only
@@ -1905,7 +1905,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                if (scmd->cmnd[0] == REPORT_LUNS)
                        scmd->device->sdev_target->expecting_lun_change = 0;
                scsi_handle_queue_ramp_up(scmd->device);
-               /* FALLTHROUGH */
+               fallthrough;
        case COMMAND_TERMINATED:
                return SUCCESS;
        case TASK_ABORTED:
@@ -2376,22 +2376,22 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
                rtn = scsi_try_bus_device_reset(scmd);
                if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case SG_SCSI_RESET_TARGET:
                rtn = scsi_try_target_reset(scmd);
                if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case SG_SCSI_RESET_BUS:
                rtn = scsi_try_bus_reset(scmd);
                if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case SG_SCSI_RESET_HOST:
                rtn = scsi_try_host_reset(scmd);
                if (rtn == SUCCESS)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                rtn = FAILED;
                break;
index 45d04b7..14872c9 100644 (file)
@@ -117,14 +117,14 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
                case NOT_READY: /* This happens if there is no disc in drive */
                        if (sdev->removable)
                                break;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case UNIT_ATTENTION:
                        if (sdev->removable) {
                                sdev->changed = 1;
                                result = 0;     /* This is no longer considered an error */
                                break;
                        }
-                       /* FALLTHROUGH -- for non-removable media */
+                       fallthrough;    /* for non-removable media */
                default:
                        sdev_printk(KERN_INFO, sdev,
                                    "ioctl_internal_command return code = %x\n",
index 7c6dd6f..7affaaf 100644 (file)
@@ -795,7 +795,7 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
                }
                if (!scsi_end_request(req, blk_stat, blk_rq_err_bytes(req)))
                        return;
-               /*FALLTHRU*/
+               fallthrough;
        case ACTION_REPREP:
                scsi_io_completion_reprep(cmd, q);
                break;
index bd38c8c..ca1e6cf 100644 (file)
@@ -516,7 +516,7 @@ static int pqi_build_raid_path_request(struct pqi_ctrl_info *ctrl_info,
                break;
        case BMIC_SENSE_DIAG_OPTIONS:
                cdb_length = 0;
-               /* fall through */
+               fallthrough;
        case BMIC_IDENTIFY_CONTROLLER:
        case BMIC_IDENTIFY_PHYSICAL_DEVICE:
        case BMIC_SENSE_SUBSYSTEM_INFORMATION:
@@ -527,7 +527,7 @@ static int pqi_build_raid_path_request(struct pqi_ctrl_info *ctrl_info,
                break;
        case BMIC_SET_DIAG_OPTIONS:
                cdb_length = 0;
-               /* fall through */
+               fallthrough;
        case BMIC_WRITE_HOST_WELLNESS:
                request->data_direction = SOP_WRITE_FLAG;
                cdb[0] = BMIC_WRITE;
@@ -2324,7 +2324,7 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info,
        switch (scmd->cmnd[0]) {
        case WRITE_6:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_6:
                first_block = (u64)(((scmd->cmnd[1] & 0x1f) << 16) |
                        (scmd->cmnd[2] << 8) | scmd->cmnd[3]);
@@ -2334,21 +2334,21 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info,
                break;
        case WRITE_10:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_10:
                first_block = (u64)get_unaligned_be32(&scmd->cmnd[2]);
                block_cnt = (u32)get_unaligned_be16(&scmd->cmnd[7]);
                break;
        case WRITE_12:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_12:
                first_block = (u64)get_unaligned_be32(&scmd->cmnd[2]);
                block_cnt = get_unaligned_be32(&scmd->cmnd[6]);
                break;
        case WRITE_16:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_16:
                first_block = get_unaligned_be64(&scmd->cmnd[2]);
                block_cnt = get_unaligned_be32(&scmd->cmnd[10]);
@@ -2948,7 +2948,7 @@ static unsigned int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info,
                case PQI_RESPONSE_IU_AIO_PATH_IO_SUCCESS:
                        if (io_request->scmd)
                                io_request->scmd->result = 0;
-                       /* fall through */
+                       fallthrough;
                case PQI_RESPONSE_IU_GENERAL_MANAGEMENT:
                        break;
                case PQI_RESPONSE_IU_VENDOR_GENERAL:
@@ -3115,12 +3115,11 @@ static void pqi_process_soft_reset(struct pqi_ctrl_info *ctrl_info,
 
        switch (reset_status) {
        case RESET_INITIATE_DRIVER:
-               /* fall through */
        case RESET_TIMEDOUT:
                dev_info(&ctrl_info->pci_dev->dev,
                        "resetting controller %u\n", ctrl_info->ctrl_id);
                sis_soft_reset(ctrl_info);
-               /* fall through */
+               fallthrough;
        case RESET_INITIATE_FIRMWARE:
                rc = pqi_ofa_ctrl_restart(ctrl_info);
                pqi_ofa_free_host_buffer(ctrl_info);
index 0c4aa46..3b3a53c 100644 (file)
@@ -877,10 +877,10 @@ static void get_sectorsize(struct scsi_cd *cd)
                case 2340:
                case 2352:
                        sector_size = 2048;
-                       /* fall through */
+                       fallthrough;
                case 2048:
                        cd->capacity *= 4;
-                       /* fall through */
+                       fallthrough;
                case 512:
                        break;
                default:
index 87fbc0e..e2e5356 100644 (file)
@@ -339,14 +339,14 @@ static void st_analyze_sense(struct st_request *SRpnt, struct st_cmdstatus *s)
                switch (sense[0] & 0x7f) {
                case 0x71:
                        s->deferred = 1;
-                       /* fall through */
+                       fallthrough;
                case 0x70:
                        s->fixed_format = 1;
                        s->flags = sense[2] & 0xe0;
                        break;
                case 0x73:
                        s->deferred = 1;
-                       /* fall through */
+                       fallthrough;
                case 0x72:
                        s->fixed_format = 0;
                        ucp = scsi_sense_desc_find(sense, SCSI_SENSE_BUFFERSIZE, 4);
@@ -2723,7 +2723,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
        switch (cmd_in) {
        case MTFSFM:
                chg_eof = 0;    /* Changed from the FSF after this */
-               /* fall through */
+               fallthrough;
        case MTFSF:
                cmd[0] = SPACE;
                cmd[1] = 0x01;  /* Space FileMarks */
@@ -2738,7 +2738,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
                break;
        case MTBSFM:
                chg_eof = 0;    /* Changed from the FSF after this */
-               /* fall through */
+               fallthrough;
        case MTBSF:
                cmd[0] = SPACE;
                cmd[1] = 0x01;  /* Space FileMarks */
index 701b842..2e3fbc2 100644 (file)
@@ -397,12 +397,12 @@ static int sun3scsi_dma_finish(int write_flag)
                case CSR_LEFT_3:
                        *vaddr = (dregs->bpack_lo & 0xff00) >> 8;
                        vaddr--;
-                       /* Fall through */
+                       fallthrough;
 
                case CSR_LEFT_2:
                        *vaddr = (dregs->bpack_hi & 0x00ff);
                        vaddr--;
-                       /* Fall through */
+                       fallthrough;
 
                case CSR_LEFT_1:
                        *vaddr = (dregs->bpack_hi & 0xff00) >> 8;
index 6d7651a..c6db61b 100644 (file)
@@ -523,7 +523,7 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
                                        new = old;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                new = 0;
                                panic("sym_fw_bind_script: "
index 8410117..cc11daa 100644 (file)
@@ -3059,7 +3059,7 @@ static void sym_sir_bad_scsi_status(struct sym_hcb *np, int num, struct sym_ccb
                        sym_print_addr(cp->cmd, "%s\n",
                                s_status == S_BUSY ? "BUSY" : "QUEUE FULL\n");
                }
-               /* fall through */
+               fallthrough;
        default:        /* S_INT, S_INT_COND_MET, S_CONFLICT */
                sym_complete_error (np, cp);
                break;
@@ -4620,7 +4620,7 @@ static void sym_int_sir(struct sym_hcb *np)
         *  Negotiation failed.
         *  Target does not want answer message.
         */
-       /* fall through */
+               fallthrough;
        case SIR_NEGO_PROTO:
                sym_nego_default(np, tp, cp);
                goto out;
index d37e2a6..e13d535 100644 (file)
@@ -695,7 +695,7 @@ static int sym_read_Tekram_nvram (struct sym_device *np, Tekram_nvram *nvram)
                                          data, len);
                if (!x)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                x = sym_read_T93C46_nvram(np, nvram);
                break;
index 46bb905..eafe0db 100644 (file)
@@ -38,6 +38,7 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
        /* Select MPHY refclk frequency */
        clk = devm_clk_get(dev, NULL);
        if (IS_ERR(clk)) {
+               ret = PTR_ERR(clk);
                dev_err(dev, "Cannot claim MPHY clock.\n");
                goto clk_err;
        }
index 29cd017..1755dd6 100644 (file)
@@ -212,7 +212,7 @@ static int ufs_mtk_wait_link_state(struct ufs_hba *hba, u32 state,
        ktime_t timeout, time_checked;
        u32 val;
 
-       timeout = ktime_add_us(ktime_get(), ms_to_ktime(max_wait_ms));
+       timeout = ktime_add_ms(ktime_get(), max_wait_ms);
        do {
                time_checked = ktime_get();
                ufshcd_writel(hba, 0x20, REG_UFS_DEBUG_SEL);
index bcfbbd0..5b2bc1a 100644 (file)
@@ -110,7 +110,7 @@ static int ufs_bsg_request(struct bsg_job *job)
                        goto out;
                }
 
-               /* fall through */
+               fallthrough;
        case UPIU_TRANSACTION_NOP_OUT:
        case UPIU_TRANSACTION_TASK_REQ:
                ret = ufshcd_exec_raw_upiu_cmd(hba, &bsg_request->upiu_req,
index f407b13..5a95a7b 100644 (file)
@@ -44,11 +44,23 @@ static int ufs_intel_link_startup_notify(struct ufs_hba *hba,
        return err;
 }
 
+static int ufs_intel_ehl_init(struct ufs_hba *hba)
+{
+       hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8;
+       return 0;
+}
+
 static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = {
        .name                   = "intel-pci",
        .link_startup_notify    = ufs_intel_link_startup_notify,
 };
 
+static struct ufs_hba_variant_ops ufs_intel_ehl_hba_vops = {
+       .name                   = "intel-pci",
+       .init                   = ufs_intel_ehl_init,
+       .link_startup_notify    = ufs_intel_link_startup_notify,
+};
+
 #ifdef CONFIG_PM_SLEEP
 /**
  * ufshcd_pci_suspend - suspend power management function
@@ -177,8 +189,8 @@ static const struct dev_pm_ops ufshcd_pci_pm_ops = {
 static const struct pci_device_id ufshcd_pci_tbl[] = {
        { PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
        { PCI_VDEVICE(INTEL, 0x9DFA), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
-       { PCI_VDEVICE(INTEL, 0x4B41), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
-       { PCI_VDEVICE(INTEL, 0x4B43), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
+       { PCI_VDEVICE(INTEL, 0x4B41), (kernel_ulong_t)&ufs_intel_ehl_hba_vops },
+       { PCI_VDEVICE(INTEL, 0x4B43), (kernel_ulong_t)&ufs_intel_ehl_hba_vops },
        { }     /* terminate list */
 };
 
index 3076222..1d157ff 100644 (file)
@@ -1561,6 +1561,7 @@ unblock_reqs:
 int ufshcd_hold(struct ufs_hba *hba, bool async)
 {
        int rc = 0;
+       bool flush_result;
        unsigned long flags;
 
        if (!ufshcd_is_clkgating_allowed(hba))
@@ -1592,7 +1593,9 @@ start:
                                break;
                        }
                        spin_unlock_irqrestore(hba->host->host_lock, flags);
-                       flush_work(&hba->clk_gating.ungate_work);
+                       flush_result = flush_work(&hba->clk_gating.ungate_work);
+                       if (hba->clk_gating.is_suspended && !flush_result)
+                               goto out;
                        spin_lock_irqsave(hba->host->host_lock, flags);
                        goto start;
                }
@@ -1609,7 +1612,7 @@ start:
                 * currently running. Hence, fall through to cancel gating
                 * work and to enable clocks.
                 */
-               /* fallthrough */
+               fallthrough;
        case CLKS_OFF:
                ufshcd_scsi_block_requests(hba);
                hba->clk_gating.state = REQ_CLKS_ON;
@@ -1621,7 +1624,7 @@ start:
                 * fall through to check if we should wait for this
                 * work to be done or not.
                 */
-               /* fallthrough */
+               fallthrough;
        case REQ_CLKS_ON:
                if (async) {
                        rc = -EAGAIN;
@@ -4734,7 +4737,7 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, int scsi_status)
        switch (scsi_status) {
        case SAM_STAT_CHECK_CONDITION:
                ufshcd_copy_sense_data(lrbp);
-               /* fallthrough */
+               fallthrough;
        case SAM_STAT_GOOD:
                result |= DID_OK << 16 |
                          COMMAND_COMPLETE << 8 |
@@ -5941,7 +5944,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
  */
 static irqreturn_t ufshcd_intr(int irq, void *__hba)
 {
-       u32 intr_status, enabled_intr_status;
+       u32 intr_status, enabled_intr_status = 0;
        irqreturn_t retval = IRQ_NONE;
        struct ufs_hba *hba = __hba;
        int retries = hba->nutrs;
@@ -5955,7 +5958,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
         * read, make sure we handle them by checking the interrupt status
         * again in a loop until we process all of the reqs before returning.
         */
-       do {
+       while (intr_status && retries--) {
                enabled_intr_status =
                        intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
                if (intr_status)
@@ -5964,9 +5967,9 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
                        retval |= ufshcd_sl_intr(hba, enabled_intr_status);
 
                intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
-       } while (intr_status && --retries);
+       }
 
-       if (retval == IRQ_NONE) {
+       if (enabled_intr_status && retval == IRQ_NONE) {
                dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n",
                                        __func__, intr_status);
                ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: ");
@@ -6274,7 +6277,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
        switch (msgcode) {
        case UPIU_TRANSACTION_NOP_OUT:
                cmd_type = DEV_CMD_TYPE_NOP;
-               /* fall through */
+               fallthrough;
        case UPIU_TRANSACTION_QUERY_REQ:
                ufshcd_hold(hba, false);
                mutex_lock(&hba->dev_cmd.lock);
@@ -6434,14 +6437,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
                goto out;
        }
 
-       if (!(reg & (1 << tag))) {
-               dev_err(hba->dev,
-               "%s: cmd was completed, but without a notifying intr, tag = %d",
-               __func__, tag);
-       }
-
        /* Print Transfer Request of aborted task */
-       dev_err(hba->dev, "%s: Device abort task at tag %d\n", __func__, tag);
+       dev_info(hba->dev, "%s: Device abort task at tag %d\n", __func__, tag);
 
        /*
         * Print detailed info about aborted request.
@@ -6462,6 +6459,13 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
        }
        hba->req_abort_count++;
 
+       if (!(reg & (1 << tag))) {
+               dev_err(hba->dev,
+               "%s: cmd was completed, but without a notifying intr, tag = %d",
+               __func__, tag);
+               goto cleanup;
+       }
+
        /* Skip task abort in case previous aborts failed and report failure */
        if (lrbp->req_abort_skip) {
                err = -EIO;
@@ -6492,7 +6496,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
                        /* command completed already */
                        dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n",
                                __func__, tag);
-                       goto out;
+                       goto cleanup;
                } else {
                        dev_err(hba->dev,
                                "%s: no response from device. tag = %d, err %d\n",
@@ -6526,6 +6530,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
                goto out;
        }
 
+cleanup:
        scsi_dma_unmap(cmd);
 
        spin_lock_irqsave(host->host_lock, flags);
index b2ef18f..363589c 100644 (file)
@@ -520,6 +520,12 @@ enum ufshcd_quirks {
         * OCS FATAL ERROR with device error through sense data
         */
        UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR             = 1 << 10,
+
+       /*
+        * This quirk needs to be enabled if the host controller has
+        * auto-hibernate capability but it doesn't work.
+        */
+       UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8                = 1 << 11,
 };
 
 enum ufshcd_caps {
@@ -803,7 +809,8 @@ return true;
 
 static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)
 {
-       return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT);
+       return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) &&
+               !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8);
 }
 
 static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba)
index ca1c39b..3b18034 100644 (file)
@@ -148,7 +148,7 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
        default:
                scmd_printk(KERN_WARNING, sc, "Unknown response %d",
                            resp->response);
-               /* fall through */
+               fallthrough;
        case VIRTIO_SCSI_S_FAILURE:
                set_host_byte(sc, DID_ERROR);
                break;
index 8dbb4db..081f54a 100644 (file)
@@ -607,7 +607,7 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
                case BTSTAT_TAGREJECT:
                case BTSTAT_BADMSG:
                        cmd->result = (DRIVER_INVALID << 24);
-                       /* fall through */
+                       fallthrough;
 
                case BTSTAT_HAHARDWARE:
                case BTSTAT_INVPHASE:
index f81046f..87dafbc 100644 (file)
@@ -1854,7 +1854,7 @@ round_4(unsigned int x)
                case 1: --x;
                        break;
                case 2: ++x;
-                       /* fall through */
+                       fallthrough;
                case 3: ++x;
        }
        return x;
index f0068e9..259fc24 100644 (file)
@@ -1111,7 +1111,7 @@ static void scsifront_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's Closing state */
+               fallthrough;    /* Missed the backend's Closing state */
        case XenbusStateClosing:
                scsifront_disconnect(info);
                break;
index e19102f..b25d0f7 100644 (file)
@@ -353,7 +353,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
 
                debugfs_create_u32("nmodem_supported", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.nmodem_supported);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 14):
                qcom_socinfo->info.num_clusters = __le32_to_cpu(info->num_clusters);
                qcom_socinfo->info.ncluster_array_offset = __le32_to_cpu(info->ncluster_array_offset);
@@ -368,14 +368,14 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                                   &qcom_socinfo->info.num_defective_parts);
                debugfs_create_u32("ndefective_parts_array_offset", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.ndefective_parts_array_offset);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 13):
                qcom_socinfo->info.nproduct_id = __le32_to_cpu(info->nproduct_id);
 
                debugfs_create_u32("nproduct_id", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.nproduct_id);
                DEBUGFS_ADD(info, chip_id);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 12):
                qcom_socinfo->info.chip_family =
                        __le32_to_cpu(info->chip_family);
@@ -392,7 +392,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                debugfs_create_x32("raw_device_number", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.raw_device_num);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 11):
        case SOCINFO_VERSION(0, 10):
        case SOCINFO_VERSION(0, 9):
@@ -400,12 +400,12 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
 
                debugfs_create_u32("foundry_id", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.foundry_id);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 8):
        case SOCINFO_VERSION(0, 7):
                DEBUGFS_ADD(info, pmic_model);
                DEBUGFS_ADD(info, pmic_die_rev);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 6):
                qcom_socinfo->info.hw_plat_subtype =
                        __le32_to_cpu(info->hw_plat_subtype);
@@ -413,7 +413,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                debugfs_create_u32("hardware_platform_subtype", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.hw_plat_subtype);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 5):
                qcom_socinfo->info.accessory_chip =
                        __le32_to_cpu(info->accessory_chip);
@@ -421,27 +421,27 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                debugfs_create_u32("accessory_chip", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.accessory_chip);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 4):
                qcom_socinfo->info.plat_ver = __le32_to_cpu(info->plat_ver);
 
                debugfs_create_u32("platform_version", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.plat_ver);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 3):
                qcom_socinfo->info.hw_plat = __le32_to_cpu(info->hw_plat);
 
                debugfs_create_u32("hardware_platform", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.hw_plat);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 2):
                qcom_socinfo->info.raw_ver  = __le32_to_cpu(info->raw_ver);
 
                debugfs_create_u32("raw_version", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.raw_ver);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 1):
                DEBUGFS_ADD(info, build_id);
                break;
index 2641856..fc7f48a 100644 (file)
@@ -35,7 +35,54 @@ config EXYNOS_PMU_ARM_DRIVERS
 
 config EXYNOS_PM_DOMAINS
        bool "Exynos PM domains" if COMPILE_TEST
-       depends on PM_GENERIC_DOMAINS || COMPILE_TEST
+       depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST
+
+config SAMSUNG_PM_DEBUG
+       bool "Samsung PM Suspend debug"
+       depends on PM && DEBUG_KERNEL
+       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
+       depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
+       depends on DEBUG_LL && MMU
+       help
+         Say Y here if you want verbose debugging from the PM Suspend and
+         Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
+         for more information.
+
+config S3C_PM_DEBUG_LED_SMDK
+       bool "SMDK LED suspend/resume debugging"
+       depends on PM && (MACH_SMDK6410)
+       help
+         Say Y here to enable the use of the SMDK LEDs on the baseboard
+        for debugging of the state of the suspend and resume process.
+
+        Note, this currently only works for S3C64XX based SMDK boards.
+
+config SAMSUNG_PM_CHECK
+       bool "S3C2410 PM Suspend Memory CRC"
+       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
+       select CRC32
+       help
+         Enable the PM code's memory area checksum over sleep. This option
+         will generate CRCs of all blocks of memory, and store them before
+         going to sleep. The blocks are then checked on resume for any
+         errors.
+
+         Note, this can take several seconds depending on memory size
+         and CPU speed.
+
+         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
+
+config SAMSUNG_PM_CHECK_CHUNKSIZE
+       int "S3C2410 PM Suspend CRC Chunksize (KiB)"
+       depends on PM && SAMSUNG_PM_CHECK
+       default 64
+       help
+         Set the chunksize in Kilobytes of the CRC for checking memory
+         corruption over suspend and resume. A smaller value will mean that
+         the CRC data block will take more memory, but will identify any
+         faults with better precision.
+
+         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
 
 config EXYNOS_REGULATOR_COUPLER
        bool "Exynos SoC Regulator Coupler" if COMPILE_TEST
index ecc3a32..59e8e94 100644 (file)
@@ -10,3 +10,6 @@ obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS)  += exynos3250-pmu.o exynos4-pmu.o \
                                        exynos5250-pmu.o exynos5420-pmu.o
 obj-$(CONFIG_EXYNOS_PM_DOMAINS) += pm_domains.o
 obj-$(CONFIG_EXYNOS_REGULATOR_COUPLER) += exynos-regulator-coupler.o
+
+obj-$(CONFIG_SAMSUNG_PM_CHECK) += s3c-pm-check.o
+obj-$(CONFIG_SAMSUNG_PM_DEBUG) += s3c-pm-debug.o
diff --git a/drivers/soc/samsung/s3c-pm-check.c b/drivers/soc/samsung/s3c-pm-check.c
new file mode 100644 (file)
index 0000000..ff3e099
--- /dev/null
@@ -0,0 +1,233 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// originally in linux/arch/arm/plat-s3c24xx/pm.c
+//
+// Copyright (c) 2004-2008 Simtec Electronics
+//     http://armlinux.simtec.co.uk
+//     Ben Dooks <ben@simtec.co.uk>
+//
+// S3C Power Mangament - suspend/resume memory corruption check.
+
+#include <linux/kernel.h>
+#include <linux/suspend.h>
+#include <linux/init.h>
+#include <linux/crc32.h>
+#include <linux/ioport.h>
+#include <linux/slab.h>
+
+#include <linux/soc/samsung/s3c-pm.h>
+
+#if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1
+#error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
+#endif
+
+/* suspend checking code...
+ *
+ * this next area does a set of crc checks over all the installed
+ * memory, so the system can verify if the resume was ok.
+ *
+ * CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE defines the block-size for the CRC,
+ * increasing it will mean that the area corrupted will be less easy to spot,
+ * and reducing the size will cause the CRC save area to grow
+*/
+
+#define CHECK_CHUNKSIZE (CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE * 1024)
+
+static u32 crc_size;   /* size needed for the crc block */
+static u32 *crcs;      /* allocated over suspend/resume */
+
+typedef u32 *(run_fn_t)(struct resource *ptr, u32 *arg);
+
+/* s3c_pm_run_res
+ *
+ * go through the given resource list, and look for system ram
+*/
+
+static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
+{
+       while (ptr != NULL) {
+               if (ptr->child != NULL)
+                       s3c_pm_run_res(ptr->child, fn, arg);
+
+               if ((ptr->flags & IORESOURCE_SYSTEM_RAM)
+                               == IORESOURCE_SYSTEM_RAM) {
+                       S3C_PMDBG("Found system RAM at %08lx..%08lx\n",
+                                 (unsigned long)ptr->start,
+                                 (unsigned long)ptr->end);
+                       arg = (fn)(ptr, arg);
+               }
+
+               ptr = ptr->sibling;
+       }
+}
+
+static void s3c_pm_run_sysram(run_fn_t fn, u32 *arg)
+{
+       s3c_pm_run_res(&iomem_resource, fn, arg);
+}
+
+static u32 *s3c_pm_countram(struct resource *res, u32 *val)
+{
+       u32 size = (u32)resource_size(res);
+
+       size += CHECK_CHUNKSIZE-1;
+       size /= CHECK_CHUNKSIZE;
+
+       S3C_PMDBG("Area %08lx..%08lx, %d blocks\n",
+                 (unsigned long)res->start, (unsigned long)res->end, size);
+
+       *val += size * sizeof(u32);
+       return val;
+}
+
+/* s3c_pm_prepare_check
+ *
+ * prepare the necessary information for creating the CRCs. This
+ * must be done before the final save, as it will require memory
+ * allocating, and thus touching bits of the kernel we do not
+ * know about.
+*/
+
+void s3c_pm_check_prepare(void)
+{
+       crc_size = 0;
+
+       s3c_pm_run_sysram(s3c_pm_countram, &crc_size);
+
+       S3C_PMDBG("s3c_pm_prepare_check: %u checks needed\n", crc_size);
+
+       crcs = kmalloc(crc_size+4, GFP_KERNEL);
+       if (crcs == NULL)
+               printk(KERN_ERR "Cannot allocated CRC save area\n");
+}
+
+static u32 *s3c_pm_makecheck(struct resource *res, u32 *val)
+{
+       unsigned long addr, left;
+
+       for (addr = res->start; addr < res->end;
+            addr += CHECK_CHUNKSIZE) {
+               left = res->end - addr;
+
+               if (left > CHECK_CHUNKSIZE)
+                       left = CHECK_CHUNKSIZE;
+
+               *val = crc32_le(~0, phys_to_virt(addr), left);
+               val++;
+       }
+
+       return val;
+}
+
+/* s3c_pm_check_store
+ *
+ * compute the CRC values for the memory blocks before the final
+ * sleep.
+*/
+
+void s3c_pm_check_store(void)
+{
+       if (crcs != NULL)
+               s3c_pm_run_sysram(s3c_pm_makecheck, crcs);
+}
+
+/* in_region
+ *
+ * return TRUE if the area defined by ptr..ptr+size contains the
+ * what..what+whatsz
+*/
+
+static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
+{
+       if ((what+whatsz) < ptr)
+               return 0;
+
+       if (what > (ptr+size))
+               return 0;
+
+       return 1;
+}
+
+/**
+ * s3c_pm_runcheck() - helper to check a resource on restore.
+ * @res: The resource to check
+ * @vak: Pointer to list of CRC32 values to check.
+ *
+ * Called from the s3c_pm_check_restore() via s3c_pm_run_sysram(), this
+ * function runs the given memory resource checking it against the stored
+ * CRC to ensure that memory is restored. The function tries to skip as
+ * many of the areas used during the suspend process.
+ */
+static u32 *s3c_pm_runcheck(struct resource *res, u32 *val)
+{
+       unsigned long addr;
+       unsigned long left;
+       void *stkpage;
+       void *ptr;
+       u32 calc;
+
+       stkpage = (void *)((u32)&calc & ~PAGE_MASK);
+
+       for (addr = res->start; addr < res->end;
+            addr += CHECK_CHUNKSIZE) {
+               left = res->end - addr;
+
+               if (left > CHECK_CHUNKSIZE)
+                       left = CHECK_CHUNKSIZE;
+
+               ptr = phys_to_virt(addr);
+
+               if (in_region(ptr, left, stkpage, 4096)) {
+                       S3C_PMDBG("skipping %08lx, has stack in\n", addr);
+                       goto skip_check;
+               }
+
+               if (in_region(ptr, left, crcs, crc_size)) {
+                       S3C_PMDBG("skipping %08lx, has crc block in\n", addr);
+                       goto skip_check;
+               }
+
+               /* calculate and check the checksum */
+
+               calc = crc32_le(~0, ptr, left);
+               if (calc != *val) {
+                       printk(KERN_ERR "Restore CRC error at "
+                              "%08lx (%08x vs %08x)\n", addr, calc, *val);
+
+                       S3C_PMDBG("Restore CRC error at %08lx (%08x vs %08x)\n",
+                           addr, calc, *val);
+               }
+
+       skip_check:
+               val++;
+       }
+
+       return val;
+}
+
+/**
+ * s3c_pm_check_restore() - memory check called on resume
+ *
+ * check the CRCs after the restore event and free the memory used
+ * to hold them
+*/
+void s3c_pm_check_restore(void)
+{
+       if (crcs != NULL)
+               s3c_pm_run_sysram(s3c_pm_runcheck, crcs);
+}
+
+/**
+ * s3c_pm_check_cleanup() - free memory resources
+ *
+ * Free the resources that where allocated by the suspend
+ * memory check code. We do this separately from the
+ * s3c_pm_check_restore() function as we cannot call any
+ * functions that might sleep during that resume.
+ */
+void s3c_pm_check_cleanup(void)
+{
+       kfree(crcs);
+       crcs = NULL;
+}
+
diff --git a/drivers/soc/samsung/s3c-pm-debug.c b/drivers/soc/samsung/s3c-pm-debug.c
new file mode 100644 (file)
index 0000000..b5ce0e9
--- /dev/null
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2013 Samsung Electronics Co., Ltd.
+//     Tomasz Figa <t.figa@samsung.com>
+// Copyright (C) 2008 Openmoko, Inc.
+// Copyright (C) 2004-2008 Simtec Electronics
+//     Ben Dooks <ben@simtec.co.uk>
+//     http://armlinux.simtec.co.uk/
+//
+// Samsung common power management (suspend to RAM) debug support
+
+#include <linux/serial_core.h>
+#include <linux/serial_s3c.h>
+#include <linux/io.h>
+
+#include <asm/mach/map.h>
+
+#include <linux/soc/samsung/s3c-pm.h>
+
+static struct pm_uart_save uart_save;
+
+extern void printascii(const char *);
+
+void s3c_pm_dbg(const char *fmt, ...)
+{
+       va_list va;
+       char buff[256];
+
+       va_start(va, fmt);
+       vsnprintf(buff, sizeof(buff), fmt, va);
+       va_end(va);
+
+       printascii(buff);
+}
+
+static inline void __iomem *s3c_pm_uart_base(void)
+{
+       unsigned long paddr;
+       unsigned long vaddr;
+
+       debug_ll_addr(&paddr, &vaddr);
+
+       return (void __iomem *)vaddr;
+}
+
+void s3c_pm_save_uarts(bool is_s3c2410)
+{
+       void __iomem *regs = s3c_pm_uart_base();
+       struct pm_uart_save *save = &uart_save;
+
+       save->ulcon = __raw_readl(regs + S3C2410_ULCON);
+       save->ucon = __raw_readl(regs + S3C2410_UCON);
+       save->ufcon = __raw_readl(regs + S3C2410_UFCON);
+       save->umcon = __raw_readl(regs + S3C2410_UMCON);
+       save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);
+
+       if (!is_s3c2410)
+               save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);
+
+       S3C_PMDBG("UART[%p]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
+                 regs, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);
+}
+
+void s3c_pm_restore_uarts(bool is_s3c2410)
+{
+       void __iomem *regs = s3c_pm_uart_base();
+       struct pm_uart_save *save = &uart_save;
+
+       s3c_pm_arch_update_uart(regs, save);
+
+       __raw_writel(save->ulcon, regs + S3C2410_ULCON);
+       __raw_writel(save->ucon,  regs + S3C2410_UCON);
+       __raw_writel(save->ufcon, regs + S3C2410_UFCON);
+       __raw_writel(save->umcon, regs + S3C2410_UMCON);
+       __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);
+
+       if (!is_s3c2410)
+               __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);
+}
index 42cf37a..d332e5d 100644 (file)
@@ -2229,7 +2229,7 @@ static int tegra_pmc_clk_notify_cb(struct notifier_block *nb,
 
        case POST_RATE_CHANGE:
                pmc->rate = data->new_rate;
-               /* fall through */
+               fallthrough;
 
        case ABORT_RATE_CHANGE:
                mutex_unlock(&pmc->powergates_lock);
index c9b3f9e..980b04c 100644 (file)
 #include <linux/device.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/reset-controller.h>
 #include <linux/delay.h>
 
 #include <linux/platform_data/ti-prm.h>
 
+enum omap_prm_domain_mode {
+       OMAP_PRMD_OFF,
+       OMAP_PRMD_RETENTION,
+       OMAP_PRMD_ON_INACTIVE,
+       OMAP_PRMD_ON_ACTIVE,
+};
+
+struct omap_prm_domain_map {
+       unsigned int usable_modes;      /* Mask of hardware supported modes */
+       unsigned long statechange:1;    /* Optional low-power state change */
+       unsigned long logicretstate:1;  /* Optional logic off mode */
+};
+
+struct omap_prm_domain {
+       struct device *dev;
+       struct omap_prm *prm;
+       struct generic_pm_domain pd;
+       u16 pwrstctrl;
+       u16 pwrstst;
+       const struct omap_prm_domain_map *cap;
+       u32 pwrstctrl_saved;
+};
+
 struct omap_rst_map {
        s8 rst;
        s8 st;
@@ -27,6 +52,9 @@ struct omap_prm_data {
        u32 base;
        const char *name;
        const char *clkdm_name;
+       u16 pwrstctrl;
+       u16 pwrstst;
+       const struct omap_prm_domain_map *dmap;
        u16 rstctrl;
        u16 rstst;
        const struct omap_rst_map *rstmap;
@@ -36,6 +64,7 @@ struct omap_prm_data {
 struct omap_prm {
        const struct omap_prm_data *data;
        void __iomem *base;
+       struct omap_prm_domain *prmd;
 };
 
 struct omap_reset_data {
@@ -47,6 +76,7 @@ struct omap_reset_data {
        struct device *dev;
 };
 
+#define genpd_to_prm_domain(gpd) container_of(gpd, struct omap_prm_domain, pd)
 #define to_omap_reset_data(p) container_of((p), struct omap_reset_data, rcdev)
 
 #define OMAP_MAX_RESETS                8
@@ -58,6 +88,39 @@ struct omap_reset_data {
 
 #define OMAP_PRM_HAS_RESETS    (OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_RSTST)
 
+#define PRM_STATE_MAX_WAIT     10000
+#define PRM_LOGICRETSTATE      BIT(2)
+#define PRM_LOWPOWERSTATECHANGE        BIT(4)
+#define PRM_POWERSTATE_MASK    OMAP_PRMD_ON_ACTIVE
+
+#define PRM_ST_INTRANSITION    BIT(20)
+
+static const struct omap_prm_domain_map omap_prm_all = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_ON_INACTIVE) |
+                       BIT(OMAP_PRMD_RETENTION) | BIT(OMAP_PRMD_OFF),
+       .statechange = 1,
+       .logicretstate = 1,
+};
+
+static const struct omap_prm_domain_map omap_prm_noinact = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_RETENTION) |
+                       BIT(OMAP_PRMD_OFF),
+       .statechange = 1,
+       .logicretstate = 1,
+};
+
+static const struct omap_prm_domain_map omap_prm_nooff = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_ON_INACTIVE) |
+                       BIT(OMAP_PRMD_RETENTION),
+       .statechange = 1,
+       .logicretstate = 1,
+};
+
+static const struct omap_prm_domain_map omap_prm_onoff_noauto = {
+       .usable_modes = BIT(OMAP_PRMD_ON_ACTIVE) | BIT(OMAP_PRMD_OFF),
+       .statechange = 1,
+};
+
 static const struct omap_rst_map rst_map_0[] = {
        { .rst = 0, .st = 0 },
        { .rst = -1 },
@@ -78,6 +141,10 @@ static const struct omap_rst_map rst_map_012[] = {
 
 static const struct omap_prm_data omap4_prm_data[] = {
        { .name = "tesla", .base = 0x4a306400, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_01 },
+       {
+               .name = "abe", .base = 0x4a306500,
+               .pwrstctrl = 0, .pwrstst = 0x4, .dmap = &omap_prm_all,
+       },
        { .name = "core", .base = 0x4a306700, .rstctrl = 0x210, .rstst = 0x214, .clkdm_name = "ducati", .rstmap = rst_map_012 },
        { .name = "ivahd", .base = 0x4a306f00, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_012 },
        { .name = "device", .base = 0x4a307b00, .rstctrl = 0x0, .rstst = 0x4, .rstmap = rst_map_01, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
@@ -86,6 +153,10 @@ static const struct omap_prm_data omap4_prm_data[] = {
 
 static const struct omap_prm_data omap5_prm_data[] = {
        { .name = "dsp", .base = 0x4ae06400, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_01 },
+       {
+               .name = "abe", .base = 0x4ae06500,
+               .pwrstctrl = 0, .pwrstst = 0x4, .dmap = &omap_prm_nooff,
+       },
        { .name = "core", .base = 0x4ae06700, .rstctrl = 0x210, .rstst = 0x214, .clkdm_name = "ipu", .rstmap = rst_map_012 },
        { .name = "iva", .base = 0x4ae07200, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_012 },
        { .name = "device", .base = 0x4ae07c00, .rstctrl = 0x0, .rstst = 0x4, .rstmap = rst_map_01, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
@@ -119,7 +190,11 @@ static const struct omap_prm_data am3_prm_data[] = {
        { .name = "per", .base = 0x44e00c00, .rstctrl = 0x0, .rstmap = am3_per_rst_map, .flags = OMAP_PRM_HAS_RSTCTRL, .clkdm_name = "pruss_ocp" },
        { .name = "wkup", .base = 0x44e00d00, .rstctrl = 0x0, .rstst = 0xc, .rstmap = am3_wkup_rst_map, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
        { .name = "device", .base = 0x44e00f00, .rstctrl = 0x0, .rstst = 0x8, .rstmap = rst_map_01, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
-       { .name = "gfx", .base = 0x44e01100, .rstctrl = 0x4, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3" },
+       {
+               .name = "gfx", .base = 0x44e01100,
+               .pwrstctrl = 0, .pwrstst = 0x10, .dmap = &omap_prm_noinact,
+               .rstctrl = 0x4, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3",
+       },
        { },
 };
 
@@ -135,7 +210,11 @@ static const struct omap_rst_map am4_device_rst_map[] = {
 };
 
 static const struct omap_prm_data am4_prm_data[] = {
-       { .name = "gfx", .base = 0x44df0400, .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3" },
+       {
+               .name = "gfx", .base = 0x44df0400,
+               .pwrstctrl = 0, .pwrstst = 0x4, .dmap = &omap_prm_onoff_noauto,
+               .rstctrl = 0x10, .rstst = 0x14, .rstmap = rst_map_0, .clkdm_name = "gfx_l3",
+       },
        { .name = "per", .base = 0x44df0800, .rstctrl = 0x10, .rstst = 0x14, .rstmap = am4_per_rst_map, .clkdm_name = "pruss_ocp" },
        { .name = "wkup", .base = 0x44df2000, .rstctrl = 0x10, .rstst = 0x14, .rstmap = am3_wkup_rst_map, .flags = OMAP_PRM_HAS_NO_CLKDM },
        { .name = "device", .base = 0x44df4000, .rstctrl = 0x0, .rstst = 0x4, .rstmap = am4_device_rst_map, .flags = OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_NO_CLKDM },
@@ -151,6 +230,180 @@ static const struct of_device_id omap_prm_id_table[] = {
        { },
 };
 
+#ifdef DEBUG
+static void omap_prm_domain_show_state(struct omap_prm_domain *prmd,
+                                      const char *desc)
+{
+       dev_dbg(prmd->dev, "%s %s: %08x/%08x\n",
+               prmd->pd.name, desc,
+               readl_relaxed(prmd->prm->base + prmd->pwrstctrl),
+               readl_relaxed(prmd->prm->base + prmd->pwrstst));
+}
+#else
+static inline void omap_prm_domain_show_state(struct omap_prm_domain *prmd,
+                                             const char *desc)
+{
+}
+#endif
+
+static int omap_prm_domain_power_on(struct generic_pm_domain *domain)
+{
+       struct omap_prm_domain *prmd;
+       int ret;
+       u32 v;
+
+       prmd = genpd_to_prm_domain(domain);
+       if (!prmd->cap)
+               return 0;
+
+       omap_prm_domain_show_state(prmd, "on: previous state");
+
+       if (prmd->pwrstctrl_saved)
+               v = prmd->pwrstctrl_saved;
+       else
+               v = readl_relaxed(prmd->prm->base + prmd->pwrstctrl);
+
+       writel_relaxed(v | OMAP_PRMD_ON_ACTIVE,
+                      prmd->prm->base + prmd->pwrstctrl);
+
+       /* wait for the transition bit to get cleared */
+       ret = readl_relaxed_poll_timeout(prmd->prm->base + prmd->pwrstst,
+                                        v, !(v & PRM_ST_INTRANSITION), 1,
+                                        PRM_STATE_MAX_WAIT);
+       if (ret)
+               dev_err(prmd->dev, "%s: %s timed out\n",
+                       prmd->pd.name, __func__);
+
+       omap_prm_domain_show_state(prmd, "on: new state");
+
+       return ret;
+}
+
+/* No need to check for holes in the mask for the lowest mode */
+static int omap_prm_domain_find_lowest(struct omap_prm_domain *prmd)
+{
+       return __ffs(prmd->cap->usable_modes);
+}
+
+static int omap_prm_domain_power_off(struct generic_pm_domain *domain)
+{
+       struct omap_prm_domain *prmd;
+       int ret;
+       u32 v;
+
+       prmd = genpd_to_prm_domain(domain);
+       if (!prmd->cap)
+               return 0;
+
+       omap_prm_domain_show_state(prmd, "off: previous state");
+
+       v = readl_relaxed(prmd->prm->base + prmd->pwrstctrl);
+       prmd->pwrstctrl_saved = v;
+
+       v &= ~PRM_POWERSTATE_MASK;
+       v |= omap_prm_domain_find_lowest(prmd);
+
+       if (prmd->cap->statechange)
+               v |= PRM_LOWPOWERSTATECHANGE;
+       if (prmd->cap->logicretstate)
+               v &= ~PRM_LOGICRETSTATE;
+       else
+               v |= PRM_LOGICRETSTATE;
+
+       writel_relaxed(v, prmd->prm->base + prmd->pwrstctrl);
+
+       /* wait for the transition bit to get cleared */
+       ret = readl_relaxed_poll_timeout(prmd->prm->base + prmd->pwrstst,
+                                        v, !(v & PRM_ST_INTRANSITION), 1,
+                                        PRM_STATE_MAX_WAIT);
+       if (ret)
+               dev_warn(prmd->dev, "%s: %s timed out\n",
+                        __func__, prmd->pd.name);
+
+       omap_prm_domain_show_state(prmd, "off: new state");
+
+       return 0;
+}
+
+static int omap_prm_domain_attach_dev(struct generic_pm_domain *domain,
+                                     struct device *dev)
+{
+       struct generic_pm_domain_data *genpd_data;
+       struct of_phandle_args pd_args;
+       struct omap_prm_domain *prmd;
+       struct device_node *np;
+       int ret;
+
+       prmd = genpd_to_prm_domain(domain);
+       np = dev->of_node;
+
+       ret = of_parse_phandle_with_args(np, "power-domains",
+                                        "#power-domain-cells", 0, &pd_args);
+       if (ret < 0)
+               return ret;
+
+       if (pd_args.args_count != 0)
+               dev_warn(dev, "%s: unusupported #power-domain-cells: %i\n",
+                        prmd->pd.name, pd_args.args_count);
+
+       genpd_data = dev_gpd_data(dev);
+       genpd_data->data = NULL;
+
+       return 0;
+}
+
+static void omap_prm_domain_detach_dev(struct generic_pm_domain *domain,
+                                      struct device *dev)
+{
+       struct generic_pm_domain_data *genpd_data;
+
+       genpd_data = dev_gpd_data(dev);
+       genpd_data->data = NULL;
+}
+
+static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
+{
+       struct omap_prm_domain *prmd;
+       struct device_node *np = dev->of_node;
+       const struct omap_prm_data *data;
+       const char *name;
+       int error;
+
+       if (!of_find_property(dev->of_node, "#power-domain-cells", NULL))
+               return 0;
+
+       of_node_put(dev->of_node);
+
+       prmd = devm_kzalloc(dev, sizeof(*prmd), GFP_KERNEL);
+       if (!prmd)
+               return -ENOMEM;
+
+       data = prm->data;
+       name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
+                             data->name);
+
+       prmd->dev = dev;
+       prmd->prm = prm;
+       prmd->cap = prmd->prm->data->dmap;
+       prmd->pwrstctrl = prmd->prm->data->pwrstctrl;
+       prmd->pwrstst = prmd->prm->data->pwrstst;
+
+       prmd->pd.name = name;
+       prmd->pd.power_on = omap_prm_domain_power_on;
+       prmd->pd.power_off = omap_prm_domain_power_off;
+       prmd->pd.attach_dev = omap_prm_domain_attach_dev;
+       prmd->pd.detach_dev = omap_prm_domain_detach_dev;
+
+       pm_genpd_init(&prmd->pd, NULL, true);
+       error = of_genpd_add_provider_simple(np, &prmd->pd);
+       if (error)
+               pm_genpd_remove(&prmd->pd);
+       else
+               prm->prmd = prmd;
+
+       return error;
+}
+
 static bool _is_valid_reset(struct omap_reset_data *reset, unsigned long id)
 {
        if (reset->mask & BIT(id))
@@ -351,6 +604,7 @@ static int omap_prm_probe(struct platform_device *pdev)
        const struct omap_prm_data *data;
        struct omap_prm *prm;
        const struct of_device_id *match;
+       int ret;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res)
@@ -378,7 +632,21 @@ static int omap_prm_probe(struct platform_device *pdev)
        if (IS_ERR(prm->base))
                return PTR_ERR(prm->base);
 
-       return omap_prm_reset_init(pdev, prm);
+       ret = omap_prm_domain_init(&pdev->dev, prm);
+       if (ret)
+               return ret;
+
+       ret = omap_prm_reset_init(pdev, prm);
+       if (ret)
+               goto err_domain;
+
+       return 0;
+
+err_domain:
+       of_genpd_del_provider(pdev->dev.of_node);
+       pm_genpd_remove(&prm->prmd->pd);
+
+       return ret;
 }
 
 static struct platform_driver omap_prm_driver = {
index de0123e..d2f5e70 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/nvmem-consumer.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/platform_data/pm33xx.h>
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
@@ -39,6 +40,8 @@
 #define GIC_INT_SET_PENDING_BASE 0x200
 #define AM43XX_GIC_DIST_BASE   0x48241000
 
+static void __iomem *rtc_base_virt;
+static struct clk *rtc_fck;
 static u32 rtc_magic_val;
 
 static int (*am33xx_do_wfi_sram)(unsigned long unused);
@@ -90,7 +93,7 @@ static int am33xx_push_sram_idle(void)
        ro_sram_data.amx3_pm_sram_data_virt = ocmcram_location_data;
        ro_sram_data.amx3_pm_sram_data_phys =
                gen_pool_virt_to_phys(sram_pool_data, ocmcram_location_data);
-       ro_sram_data.rtc_base_virt = pm_ops->get_rtc_base_addr();
+       ro_sram_data.rtc_base_virt = rtc_base_virt;
 
        /* Save physical address to calculate resume offset during pm init */
        am33xx_do_wfi_sram_phys = gen_pool_virt_to_phys(sram_pool,
@@ -158,7 +161,7 @@ static struct wkup_m3_wakeup_src rtc_wake_src(void)
 {
        u32 i;
 
-       i = __raw_readl(pm_ops->get_rtc_base_addr() + 0x44) & 0x40;
+       i = __raw_readl(rtc_base_virt + 0x44) & 0x40;
 
        if (i) {
                retrigger_irq = rtc_alarm_wakeup.irq_nr;
@@ -177,13 +180,24 @@ static int am33xx_rtc_only_idle(unsigned long wfi_flags)
        return 0;
 }
 
+/*
+ * Note that the RTC module clock must be re-enabled only for rtc+ddr suspend.
+ * And looks like the module can stay in SYSC_IDLE_SMART_WKUP mode configured
+ * by the interconnect code just fine for both rtc+ddr suspend and retention
+ * suspend.
+ */
 static int am33xx_pm_suspend(suspend_state_t suspend_state)
 {
        int i, ret = 0;
 
        if (suspend_state == PM_SUSPEND_MEM &&
            pm_ops->check_off_mode_enable()) {
-               pm_ops->prepare_rtc_suspend();
+               ret = clk_prepare_enable(rtc_fck);
+               if (ret) {
+                       dev_err(pm33xx_dev, "Failed to enable clock: %i\n", ret);
+                       return ret;
+               }
+
                pm_ops->save_context();
                suspend_wfi_flags |= WFI_FLAG_RTC_ONLY;
                clk_save_context();
@@ -236,7 +250,7 @@ static int am33xx_pm_suspend(suspend_state_t suspend_state)
        }
 
        if (suspend_state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable())
-               pm_ops->prepare_rtc_resume();
+               clk_disable_unprepare(rtc_fck);
 
        return ret;
 }
@@ -425,14 +439,28 @@ static int am33xx_pm_rtc_setup(void)
        struct device_node *np;
        unsigned long val = 0;
        struct nvmem_device *nvmem;
+       int error;
 
        np = of_find_node_by_name(NULL, "rtc");
 
        if (of_device_is_available(np)) {
+               /* RTC interconnect target module clock */
+               rtc_fck = of_clk_get_by_name(np->parent, "fck");
+               if (IS_ERR(rtc_fck))
+                       return PTR_ERR(rtc_fck);
+
+               rtc_base_virt = of_iomap(np, 0);
+               if (!rtc_base_virt) {
+                       pr_warn("PM: could not iomap rtc");
+                       error = -ENODEV;
+                       goto err_clk_put;
+               }
+
                omap_rtc = rtc_class_open("rtc0");
                if (!omap_rtc) {
                        pr_warn("PM: rtc0 not available");
-                       return -EPROBE_DEFER;
+                       error = -EPROBE_DEFER;
+                       goto err_iounmap;
                }
 
                nvmem = devm_nvmem_device_get(&omap_rtc->dev,
@@ -454,6 +482,13 @@ static int am33xx_pm_rtc_setup(void)
        }
 
        return 0;
+
+err_iounmap:
+       iounmap(rtc_base_virt);
+err_clk_put:
+       clk_put(rtc_fck);
+
+       return error;
 }
 
 static int am33xx_pm_probe(struct platform_device *pdev)
@@ -544,6 +579,8 @@ static int am33xx_pm_remove(struct platform_device *pdev)
        suspend_set_ops(NULL);
        wkup_m3_ipc_put(m3_ipc);
        am33xx_pm_free_sram();
+       iounmap(rtc_base_virt);
+       clk_put(rtc_fck);
        return 0;
 }
 
index 7dcf77c..bab4ad8 100644 (file)
@@ -100,7 +100,7 @@ ATTRIBUTE_GROUPS(integrator);
 
 static int __init integrator_soc_init(void)
 {
-       static struct regmap *syscon_regmap;
+       struct regmap *syscon_regmap;
        struct soc_device *soc_dev;
        struct soc_device_attribute *soc_dev_attr;
        struct device_node *np;
index c3008e4..01b6c80 100644 (file)
@@ -680,7 +680,7 @@ config SPI_S3C24XX_FIQ
 
 config SPI_S3C64XX
        tristate "Samsung S3C64XX series type SPI"
-       depends on (PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST)
+       depends on (PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST)
        help
          SPI driver for Samsung S3C64XX and newer SoCs.
 
@@ -1017,4 +1017,7 @@ config SPI_SLAVE_SYSTEM_CONTROL
 
 endif # SPI_SLAVE
 
+config SPI_DYNAMIC
+       def_bool ACPI || OF_DYNAMIC || SPI_SLAVE
+
 endif # SPI
index cf955ea..eba6fb6 100644 (file)
@@ -97,7 +97,6 @@ obj-$(CONFIG_SPI_RPCIF)                       += spi-rpc-if.o
 obj-$(CONFIG_SPI_RSPI)                 += spi-rspi.o
 obj-$(CONFIG_SPI_S3C24XX)              += spi-s3c24xx-hw.o
 spi-s3c24xx-hw-y                       := spi-s3c24xx.o
-spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o
 obj-$(CONFIG_SPI_S3C64XX)              += spi-s3c64xx.o
 obj-$(CONFIG_SPI_SC18IS602)            += spi-sc18is602.o
 obj-$(CONFIG_SPI_SH)                   += spi-sh.o
index 2f71781..03b034c 100644 (file)
@@ -164,10 +164,10 @@ static inline void bcm2835aux_rd_fifo(struct bcm2835aux_spi *bs)
                switch (count) {
                case 3:
                        *bs->rx_buf++ = (data >> 16) & 0xff;
-                       /* fallthrough */
+                       fallthrough;
                case 2:
                        *bs->rx_buf++ = (data >> 8) & 0xff;
-                       /* fallthrough */
+                       fallthrough;
                case 1:
                        *bs->rx_buf++ = (data >> 0) & 0xff;
                        /* fallthrough - no default */
index 54ad0ac..ee90588 100644 (file)
@@ -226,7 +226,7 @@ static void fsl_spi_free_dummy_rx(void)
        case 1:
                kfree(fsl_dummy_rx);
                fsl_dummy_rx = NULL;
-               /* fall through */
+               fallthrough;
        default:
                fsl_dummy_rx_refcnt--;
                break;
@@ -294,7 +294,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
                switch (mspi->subblock) {
                default:
                        dev_warn(dev, "cell-index unspecified, assuming SPI1\n");
-                       /* fall through */
+                       fallthrough;
                case 0:
                        mspi->subblock = QE_CR_SUBBLOCK_SPI1;
                        break;
diff --git a/drivers/spi/spi-s3c24xx-fiq.S b/drivers/spi/spi-s3c24xx-fiq.S
deleted file mode 100644 (file)
index e95d628..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* linux/drivers/spi/spi_s3c24xx_fiq.S
- *
- * Copyright 2009 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C24XX SPI - FIQ pseudo-DMA transfer code
-*/
-
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-#include <mach/map.h>
-#include <mach/regs-irq.h>
-#include <plat/regs-spi.h>
-
-#include "spi-s3c24xx-fiq.h"
-
-       .text
-
-       @ entry to these routines is as follows, with the register names
-       @ defined in fiq.h so that they can be shared with the C files which
-       @ setup the calling registers.
-       @
-       @ fiq_rirq      The base of the IRQ registers to find S3C2410_SRCPND
-       @ fiq_rtmp      Temporary register to hold tx/rx data
-       @ fiq_rspi      The base of the SPI register block
-       @ fiq_rtx       The tx buffer pointer
-       @ fiq_rrx       The rx buffer pointer
-       @ fiq_rcount    The number of bytes to move
-
-       @ each entry starts with a word entry of how long it is
-       @ and an offset to the irq acknowledgment word
-
-ENTRY(s3c24xx_spi_fiq_rx)
-s3c24xx_spi_fix_rx:
-       .word   fiq_rx_end - fiq_rx_start
-       .word   fiq_rx_irq_ack - fiq_rx_start
-fiq_rx_start:
-       ldr     fiq_rtmp, fiq_rx_irq_ack
-       str     fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
-
-       ldrb    fiq_rtmp, [ fiq_rspi, #  S3C2410_SPRDAT ]
-       strb    fiq_rtmp, [ fiq_rrx ], #1
-
-       mov     fiq_rtmp, #0xff
-       strb    fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
-
-       subs    fiq_rcount, fiq_rcount, #1
-       subnes  pc, lr, #4              @@ return, still have work to do
-
-       @@ set IRQ controller so that next op will trigger IRQ
-       mov     fiq_rtmp, #0
-       str     fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
-       subs    pc, lr, #4
-
-fiq_rx_irq_ack:
-       .word   0
-fiq_rx_end:
-
-ENTRY(s3c24xx_spi_fiq_txrx)
-s3c24xx_spi_fiq_txrx:
-       .word   fiq_txrx_end - fiq_txrx_start
-       .word   fiq_txrx_irq_ack - fiq_txrx_start
-fiq_txrx_start:
-
-       ldrb    fiq_rtmp, [ fiq_rspi, #  S3C2410_SPRDAT ]
-       strb    fiq_rtmp, [ fiq_rrx ], #1
-
-       ldr     fiq_rtmp, fiq_txrx_irq_ack
-       str     fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
-
-       ldrb    fiq_rtmp, [ fiq_rtx ], #1
-       strb    fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
-
-       subs    fiq_rcount, fiq_rcount, #1
-       subnes  pc, lr, #4              @@ return, still have work to do
-
-       mov     fiq_rtmp, #0
-       str     fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
-       subs    pc, lr, #4
-
-fiq_txrx_irq_ack:
-       .word   0
-
-fiq_txrx_end:
-
-ENTRY(s3c24xx_spi_fiq_tx)
-s3c24xx_spi_fix_tx:
-       .word   fiq_tx_end - fiq_tx_start
-       .word   fiq_tx_irq_ack - fiq_tx_start
-fiq_tx_start:
-       ldrb    fiq_rtmp, [ fiq_rspi, #  S3C2410_SPRDAT ]
-
-       ldr     fiq_rtmp, fiq_tx_irq_ack
-       str     fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
-
-       ldrb    fiq_rtmp, [ fiq_rtx ], #1
-       strb    fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
-
-       subs    fiq_rcount, fiq_rcount, #1
-       subnes  pc, lr, #4              @@ return, still have work to do
-
-       mov     fiq_rtmp, #0
-       str     fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD  - S3C24XX_VA_IRQ ]
-       subs    pc, lr, #4
-
-fiq_tx_irq_ack:
-       .word   0
-
-fiq_tx_end:
-
-       .end
diff --git a/drivers/spi/spi-s3c24xx-fiq.h b/drivers/spi/spi-s3c24xx-fiq.h
deleted file mode 100644 (file)
index 7786b0e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* linux/drivers/spi/spi_s3c24xx_fiq.h
- *
- * Copyright 2009 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C24XX SPI - FIQ pseudo-DMA transfer support
-*/
-
-/* We have R8 through R13 to play with */
-
-#ifdef __ASSEMBLY__
-#define __REG_NR(x)     r##x
-#else
-#define __REG_NR(x)     (x)
-#endif
-
-#define fiq_rspi       __REG_NR(8)
-#define fiq_rtmp       __REG_NR(9)
-#define fiq_rrx                __REG_NR(10)
-#define fiq_rtx                __REG_NR(11)
-#define fiq_rcount     __REG_NR(12)
-#define fiq_rirq       __REG_NR(13)
diff --git a/drivers/spi/spi-s3c24xx-regs.h b/drivers/spi/spi-s3c24xx-regs.h
new file mode 100644 (file)
index 0000000..f51464a
--- /dev/null
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Fetron GmbH
+ *
+ * S3C2410 SPI register definition
+ */
+
+#ifndef __SPI_S3C2410_H
+#define __SPI_S3C2410_H
+
+#define S3C2410_SPCON          (0x00)
+
+#define S3C2410_SPCON_SMOD_DMA (2 << 5)        /* DMA mode */
+#define S3C2410_SPCON_SMOD_INT (1 << 5)        /* interrupt mode */
+#define S3C2410_SPCON_SMOD_POLL        (0 << 5)        /* polling mode */
+#define S3C2410_SPCON_ENSCK    (1 << 4)        /* Enable SCK */
+#define S3C2410_SPCON_MSTR     (1 << 3)        /* Master:1, Slave:0 select */
+#define S3C2410_SPCON_CPOL_HIGH        (1 << 2)        /* Clock polarity select */
+#define S3C2410_SPCON_CPOL_LOW (0 << 2)        /* Clock polarity select */
+
+#define S3C2410_SPCON_CPHA_FMTB        (1 << 1)        /* Clock Phase Select */
+#define S3C2410_SPCON_CPHA_FMTA        (0 << 1)        /* Clock Phase Select */
+
+#define S3C2410_SPSTA          (0x04)
+
+#define S3C2410_SPSTA_DCOL     (1 << 2)        /* Data Collision Error */
+#define S3C2410_SPSTA_MULD     (1 << 1)        /* Multi Master Error */
+#define S3C2410_SPSTA_READY    (1 << 0)        /* Data Tx/Rx ready */
+#define S3C2412_SPSTA_READY_ORG        (1 << 3)
+
+#define S3C2410_SPPIN          (0x08)
+
+#define S3C2410_SPPIN_ENMUL    (1 << 2)        /* Multi Master Error detect */
+#define S3C2410_SPPIN_RESERVED (1 << 1)
+#define S3C2410_SPPIN_KEEP     (1 << 0)        /* Master Out keep */
+
+#define S3C2410_SPPRE          (0x0C)
+#define S3C2410_SPTDAT         (0x10)
+#define S3C2410_SPRDAT         (0x14)
+
+#endif /* __SPI_S3C2410_H */
index 2cb3b61..9138a31 100644 (file)
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
 #include <linux/spi/s3c24xx.h>
+#include <linux/spi/s3c24xx-fiq.h>
 #include <linux/module.h>
 
-#include <plat/regs-spi.h>
-
 #include <asm/fiq.h>
 
-#include "spi-s3c24xx-fiq.h"
+#include "spi-s3c24xx-regs.h"
 
 /**
  * s3c24xx_spi_devstate - per device data
@@ -230,21 +229,6 @@ struct spi_fiq_code {
        u8      data[];
 };
 
-extern struct spi_fiq_code s3c24xx_spi_fiq_txrx;
-extern struct spi_fiq_code s3c24xx_spi_fiq_tx;
-extern struct spi_fiq_code s3c24xx_spi_fiq_rx;
-
-/**
- * ack_bit - turn IRQ into IRQ acknowledgement bit
- * @irq: The interrupt number
- *
- * Returns the bit to write to the interrupt acknowledge register.
- */
-static inline u32 ack_bit(unsigned int irq)
-{
-       return 1 << (irq - IRQ_EINT0);
-}
-
 /**
  * s3c24xx_spi_tryfiq - attempt to claim and setup FIQ for transfer
  * @hw: The hardware state.
@@ -261,6 +245,7 @@ static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
        struct pt_regs regs;
        enum spi_fiq_mode mode;
        struct spi_fiq_code *code;
+       u32 *ack_ptr = NULL;
        int ret;
 
        if (!hw->fiq_claimed) {
@@ -283,13 +268,10 @@ static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
        regs.uregs[fiq_rrx]  = (long)hw->rx;
        regs.uregs[fiq_rtx]  = (long)hw->tx + 1;
        regs.uregs[fiq_rcount] = hw->len - 1;
-       regs.uregs[fiq_rirq] = (long)S3C24XX_VA_IRQ;
 
        set_fiq_regs(&regs);
 
        if (hw->fiq_mode != mode) {
-               u32 *ack_ptr;
-
                hw->fiq_mode = mode;
 
                switch (mode) {
@@ -309,12 +291,10 @@ static void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
                BUG_ON(!code);
 
                ack_ptr = (u32 *)&code->data[code->ack_offset];
-               *ack_ptr = ack_bit(hw->irq);
-
                set_fiq_handler(&code->data, code->length);
        }
 
-       s3c24xx_set_fiq(hw->irq, true);
+       s3c24xx_set_fiq(hw->irq, ack_ptr, true);
 
        hw->fiq_mode = mode;
        hw->fiq_inuse = 1;
index bd23c46..127b8bd 100644 (file)
@@ -506,7 +506,7 @@ static int sprd_adi_probe(struct platform_device *pdev)
                default:
                        dev_err(&pdev->dev,
                                "failed to find hwlock id, %d\n", ret);
-                       /* fall-through */
+                       fallthrough;
                case -EPROBE_DEFER:
                        goto put_ctlr;
                }
index 4c643df..d4b33b3 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
@@ -441,7 +442,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz,
 {
        u32 div, mbrdiv;
 
-       div = DIV_ROUND_UP(spi->clk_rate, speed_hz);
+       /* Ensure spi->clk_rate is even */
+       div = DIV_ROUND_UP(spi->clk_rate & ~0x1, speed_hz);
 
        /*
         * SPI framework set xfer->speed_hz to master->max_speed_hz if
@@ -467,20 +469,27 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz,
 /**
  * stm32h7_spi_prepare_fthlv - Determine FIFO threshold level
  * @spi: pointer to the spi controller data structure
+ * @xfer_len: length of the message to be transferred
  */
-static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi)
+static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi, u32 xfer_len)
 {
-       u32 fthlv, half_fifo;
+       u32 fthlv, half_fifo, packet;
 
        /* data packet should not exceed 1/2 of fifo space */
        half_fifo = (spi->fifo_size / 2);
 
+       /* data_packet should not exceed transfer length */
+       if (half_fifo > xfer_len)
+               packet = xfer_len;
+       else
+               packet = half_fifo;
+
        if (spi->cur_bpw <= 8)
-               fthlv = half_fifo;
+               fthlv = packet;
        else if (spi->cur_bpw <= 16)
-               fthlv = half_fifo / 2;
+               fthlv = packet / 2;
        else
-               fthlv = half_fifo / 4;
+               fthlv = packet / 4;
 
        /* align packet size with data registers access */
        if (spi->cur_bpw > 8)
@@ -488,6 +497,9 @@ static u32 stm32h7_spi_prepare_fthlv(struct stm32_spi *spi)
        else
                fthlv -= (fthlv % 4); /* multiple of 4 */
 
+       if (!fthlv)
+               fthlv = 1;
+
        return fthlv;
 }
 
@@ -966,13 +978,13 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
                if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
                        stm32h7_spi_read_rxfifo(spi, false);
 
-       writel_relaxed(mask, spi->base + STM32H7_SPI_IFCR);
+       writel_relaxed(sr & mask, spi->base + STM32H7_SPI_IFCR);
 
        spin_unlock_irqrestore(&spi->lock, flags);
 
        if (end) {
-               spi_finalize_current_transfer(master);
                stm32h7_spi_disable(spi);
+               spi_finalize_current_transfer(master);
        }
 
        return IRQ_HANDLED;
@@ -1393,7 +1405,7 @@ static void stm32h7_spi_set_bpw(struct stm32_spi *spi)
        cfg1_setb |= (bpw << STM32H7_SPI_CFG1_DSIZE_SHIFT) &
                     STM32H7_SPI_CFG1_DSIZE;
 
-       spi->cur_fthlv = stm32h7_spi_prepare_fthlv(spi);
+       spi->cur_fthlv = stm32h7_spi_prepare_fthlv(spi, spi->cur_xferlen);
        fthlv = spi->cur_fthlv - 1;
 
        cfg1_clrb |= STM32H7_SPI_CFG1_FTHLV;
@@ -1585,39 +1597,33 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
        unsigned long flags;
        unsigned int comm_type;
        int nb_words, ret = 0;
+       int mbr;
 
        spin_lock_irqsave(&spi->lock, flags);
 
-       if (spi->cur_bpw != transfer->bits_per_word) {
-               spi->cur_bpw = transfer->bits_per_word;
-               spi->cfg->set_bpw(spi);
-       }
-
-       if (spi->cur_speed != transfer->speed_hz) {
-               int mbr;
+       spi->cur_xferlen = transfer->len;
 
-               /* Update spi->cur_speed with real clock speed */
-               mbr = stm32_spi_prepare_mbr(spi, transfer->speed_hz,
-                                           spi->cfg->baud_rate_div_min,
-                                           spi->cfg->baud_rate_div_max);
-               if (mbr < 0) {
-                       ret = mbr;
-                       goto out;
-               }
+       spi->cur_bpw = transfer->bits_per_word;
+       spi->cfg->set_bpw(spi);
 
-               transfer->speed_hz = spi->cur_speed;
-               stm32_spi_set_mbr(spi, mbr);
+       /* Update spi->cur_speed with real clock speed */
+       mbr = stm32_spi_prepare_mbr(spi, transfer->speed_hz,
+                                   spi->cfg->baud_rate_div_min,
+                                   spi->cfg->baud_rate_div_max);
+       if (mbr < 0) {
+               ret = mbr;
+               goto out;
        }
 
+       transfer->speed_hz = spi->cur_speed;
+       stm32_spi_set_mbr(spi, mbr);
+
        comm_type = stm32_spi_communication_type(spi_dev, transfer);
-       if (spi->cur_comm != comm_type) {
-               ret = spi->cfg->set_mode(spi, comm_type);
+       ret = spi->cfg->set_mode(spi, comm_type);
+       if (ret < 0)
+               goto out;
 
-               if (ret < 0)
-                       goto out;
-
-               spi->cur_comm = comm_type;
-       }
+       spi->cur_comm = comm_type;
 
        if (spi->cfg->set_data_idleness)
                spi->cfg->set_data_idleness(spi, transfer->len);
@@ -1635,8 +1641,6 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
                        goto out;
        }
 
-       spi->cur_xferlen = transfer->len;
-
        dev_dbg(spi->dev, "transfer communication mode set to %d\n",
                spi->cur_comm);
        dev_dbg(spi->dev,
@@ -1996,6 +2000,8 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
        pm_runtime_disable(&pdev->dev);
 
+       pinctrl_pm_select_sleep_state(&pdev->dev);
+
        return 0;
 }
 
@@ -2007,13 +2013,18 @@ static int stm32_spi_runtime_suspend(struct device *dev)
 
        clk_disable_unprepare(spi->clk);
 
-       return 0;
+       return pinctrl_pm_select_sleep_state(dev);
 }
 
 static int stm32_spi_runtime_resume(struct device *dev)
 {
        struct spi_master *master = dev_get_drvdata(dev);
        struct stm32_spi *spi = spi_master_get_devdata(master);
+       int ret;
+
+       ret = pinctrl_pm_select_default_state(dev);
+       if (ret)
+               return ret;
 
        return clk_prepare_enable(spi->clk);
 }
@@ -2043,10 +2054,23 @@ static int stm32_spi_resume(struct device *dev)
                return ret;
 
        ret = spi_master_resume(master);
-       if (ret)
+       if (ret) {
                clk_disable_unprepare(spi->clk);
+               return ret;
+       }
 
-       return ret;
+       ret = pm_runtime_get_sync(dev);
+       if (ret) {
+               dev_err(dev, "Unable to power device:%d\n", ret);
+               return ret;
+       }
+
+       spi->cfg->config(spi);
+
+       pm_runtime_mark_last_busy(dev);
+       pm_runtime_put_autosuspend(dev);
+
+       return 0;
 }
 #endif
 
index 6626587..dc12af0 100644 (file)
@@ -475,6 +475,12 @@ static LIST_HEAD(spi_controller_list);
  */
 static DEFINE_MUTEX(board_lock);
 
+/*
+ * Prevents addition of devices with same chip select and
+ * addition of devices below an unregistering controller.
+ */
+static DEFINE_MUTEX(spi_add_lock);
+
 /**
  * spi_alloc_device - Allocate a new SPI device
  * @ctlr: Controller to which device is connected
@@ -554,7 +560,6 @@ static int spi_dev_check(struct device *dev, void *data)
  */
 int spi_add_device(struct spi_device *spi)
 {
-       static DEFINE_MUTEX(spi_add_lock);
        struct spi_controller *ctlr = spi->controller;
        struct device *dev = ctlr->dev.parent;
        int status;
@@ -582,6 +587,13 @@ int spi_add_device(struct spi_device *spi)
                goto done;
        }
 
+       /* Controller may unregister concurrently */
+       if (IS_ENABLED(CONFIG_SPI_DYNAMIC) &&
+           !device_is_registered(&ctlr->dev)) {
+               status = -ENODEV;
+               goto done;
+       }
+
        /* Descriptors take precedence */
        if (ctlr->cs_gpiods)
                spi->cs_gpiod = ctlr->cs_gpiods[spi->chip_select];
@@ -2795,6 +2807,10 @@ void spi_unregister_controller(struct spi_controller *ctlr)
        struct spi_controller *found;
        int id = ctlr->bus_num;
 
+       /* Prevent addition of new devices, unregister existing ones */
+       if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
+               mutex_lock(&spi_add_lock);
+
        device_for_each_child(&ctlr->dev, NULL, __unregister);
 
        /* First make sure that this controller was ever added */
@@ -2815,6 +2831,9 @@ void spi_unregister_controller(struct spi_controller *ctlr)
        if (found == ctlr)
                idr_remove(&spi_master_idr, id);
        mutex_unlock(&board_lock);
+
+       if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
+               mutex_unlock(&spi_add_lock);
 }
 EXPORT_SYMBOL_GPL(spi_unregister_controller);
 
index 823dc99..a8d2525 100644 (file)
@@ -425,7 +425,7 @@ void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
                        *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_M2);
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_SB);
        }
index 1ca2ac5..354486b 100644 (file)
@@ -342,7 +342,7 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
                                set_irq(dev, irq++);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case SSB_DEV_EXTIF:
                        set_irq(dev, 0);
                        break;
index b97a5c3..f49ab1a 100644 (file)
@@ -228,7 +228,7 @@ static void __iomem *ssb_ioremap(struct ssb_bus *bus,
        switch (bus->bustype) {
        case SSB_BUSTYPE_SSB:
                /* Only map the first core for now. */
-               /* fallthrough... */
+               fallthrough;
        case SSB_BUSTYPE_PCMCIA:
                mmio = ioremap(baseaddr, SSB_CORE_SIZE);
                break;
index 8ea65be..a4e4eef 100644 (file)
@@ -4984,7 +4984,7 @@ enum mipi_port_id __get_mipi_port(struct atomisp_device *isp,
                if (MIPI_PORT1_ID + 1 != N_MIPI_PORT_ID) {
                        return MIPI_PORT1_ID + 1;
                }
-       /* fall through */
+               fallthrough;
        default:
                dev_err(isp->dev, "unsupported port: %d\n", port);
                return MIPI_PORT0_ID;
index cccc5bf..1b2b2c6 100644 (file)
@@ -704,14 +704,14 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
 
                        return false;
                }
-       /* fall-through */
+               fallthrough;
        case ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE:
                if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
                    pipe_id == IA_CSS_PIPE_ID_PREVIEW)
                        return true;
 
                return false;
-       /* fall-through */
+               fallthrough;
        case ATOMISP_RUN_MODE_VIDEO:
                if (!asd->continuous_mode->val) {
                        if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
@@ -720,7 +720,7 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
                        else
                                return false;
                }
-       /* fall through  */
+               fallthrough;
        case ATOMISP_RUN_MODE_SDV:
                if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
                    pipe_id == IA_CSS_PIPE_ID_VIDEO)
@@ -2765,7 +2765,7 @@ static unsigned int atomisp_get_pipe_index(struct atomisp_sub_device *asd,
                if (!atomisp_is_mbuscode_raw(asd->fmt[asd->capture_pad].fmt.code)) {
                        return IA_CSS_PIPE_ID_CAPTURE;
                }
-               /* fall through */
+               fallthrough;
        case ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW:
                if (asd->yuvpp_mode)
                        return IA_CSS_PIPE_ID_YUVPP;
index f8d616f..65b0c8a 100644 (file)
@@ -1467,7 +1467,6 @@ enum ia_css_pipe_id atomisp_get_css_pipe_id(struct atomisp_sub_device *asd)
        case ATOMISP_RUN_MODE_VIDEO:
                return IA_CSS_PIPE_ID_VIDEO;
        case ATOMISP_RUN_MODE_STILL_CAPTURE:
-       /* fall through */
        default:
                return IA_CSS_PIPE_ID_CAPTURE;
        }
index a000a1e..0114b04 100644 (file)
@@ -1086,7 +1086,7 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)
                case RAW_CAMERA:
                        dev_dbg(isp->dev, "raw_index: %d\n", raw_index);
                        raw_index = isp->input_cnt;
-                       /* fall through */
+                       fallthrough;
                case SOC_CAMERA:
                        dev_dbg(isp->dev, "SOC_INDEX: %d\n", isp->input_cnt);
                        if (isp->input_cnt >= ATOM_ISP_MAX_INPUTS) {
index 4fb9bfd..f13af23 100644 (file)
@@ -660,7 +660,7 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
                                break;
                        }
 
-                       /* fall through */
+                       fallthrough;
 
                /*
                 * if dynamic memory pool doesn't exist, need to free
index 54434c2..a68cbb4 100644 (file)
@@ -4510,7 +4510,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
 #endif
                                        pipe->stop_requested = false;
                                }
-                               /* fall through */
+                               fallthrough;
                        case IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME:
                        case IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME:
                                frame = (struct ia_css_frame *)HOST_ADDRESS(ddr_buffer.kernel_ptr);
index 2404184..6386a39 100644 (file)
@@ -110,7 +110,7 @@ hantro_g1_mpeg2_dec_set_buffers(struct hantro_dev *vpu, struct hantro_ctx *ctx,
        case V4L2_MPEG2_PICTURE_CODING_TYPE_B:
                backward_addr = hantro_get_ref(ctx,
                                               slice_params->backward_ref_ts);
-               /* fall-through */
+               fallthrough;
        case V4L2_MPEG2_PICTURE_CODING_TYPE_P:
                forward_addr = hantro_get_ref(ctx,
                                              slice_params->forward_ref_ts);
index 7e9aad6..f610fa5 100644 (file)
@@ -112,7 +112,7 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu,
        case V4L2_MPEG2_PICTURE_CODING_TYPE_B:
                backward_addr = hantro_get_ref(ctx,
                                               slice_params->backward_ref_ts);
-               /* fall-through */
+               fallthrough;
        case V4L2_MPEG2_PICTURE_CODING_TYPE_P:
                forward_addr = hantro_get_ref(ctx,
                                              slice_params->forward_ref_ts);
index d92fd80..21ebf77 100644 (file)
@@ -488,7 +488,7 @@ static int csi_idmac_setup_channel(struct csi_priv *priv)
                        passthrough_cycles = incc->cycles;
                        break;
                }
-               /* fallthrough - non-passthrough RGB565 (CSI-2 bus) */
+               fallthrough;    /* non-passthrough RGB565 (CSI-2 bus) */
        default:
                burst_size = (image.pix.width & 0xf) ? 8 : 16;
                passthrough_bits = 16;
index 6e4df33..aa3ff67 100644 (file)
@@ -303,13 +303,13 @@ usbvision_i2c_read_max4(struct usb_usbvision *usbvision, unsigned char addr,
        switch (len) {
        case 4:
                buf[3] = usbvision_read_reg(usbvision, USBVISION_SER_DAT4);
-               /* fall through */
+               fallthrough;
        case 3:
                buf[2] = usbvision_read_reg(usbvision, USBVISION_SER_DAT3);
-               /* fall through */
+               fallthrough;
        case 2:
                buf[1] = usbvision_read_reg(usbvision, USBVISION_SER_DAT2);
-               /* fall through */
+               fallthrough;
        case 1:
                buf[0] = usbvision_read_reg(usbvision, USBVISION_SER_DAT1);
                break;
index 30ea37e..bd37f2a 100644 (file)
@@ -444,7 +444,7 @@ cxgbit_uld_lro_rx_handler(void *hndl, const __be64 *rsp,
        case CPL_RX_ISCSI_DDP:
        case CPL_FW4_ACK:
                lro_flush = false;
-               /* fall through */
+               fallthrough;
        case CPL_ABORT_RPL_RSS:
        case CPL_PASS_ESTABLISH:
        case CPL_PEER_CLOSE:
index c968961..cd045dc 100644 (file)
@@ -3740,7 +3740,7 @@ check_rsp_state:
        case ISTATE_SEND_LOGOUTRSP:
                if (!iscsit_logout_post_handler(cmd, conn))
                        return -ECONNRESET;
-               /* fall through */
+               fallthrough;
        case ISTATE_SEND_STATUS:
        case ISTATE_SEND_ASYNCMSG:
        case ISTATE_SEND_NOPIN:
index 8fc8865..5f79ea0 100644 (file)
@@ -345,7 +345,7 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,
                break;
        case PR_TYPE_WRITE_EXCLUSIVE_REGONLY:
                we = 1;
-               /* fall through */
+               fallthrough;
        case PR_TYPE_EXCLUSIVE_ACCESS_REGONLY:
                /*
                 * Some commands are only allowed for registered I_T Nexuses.
@@ -354,7 +354,7 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,
                break;
        case PR_TYPE_WRITE_EXCLUSIVE_ALLREG:
                we = 1;
-               /* fall through */
+               fallthrough;
        case PR_TYPE_EXCLUSIVE_ACCESS_ALLREG:
                /*
                 * Each registered I_T Nexus is a reservation holder.
index f1e8188..6e8b8d3 100644 (file)
@@ -734,7 +734,7 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
                }
                if (!protect)
                        return TCM_NO_SENSE;
-               /* Fallthrough */
+               fallthrough;
        default:
                pr_err("Unable to determine pi_prot_type for CDB: 0x%02x "
                       "PROTECT: 0x%02x\n", cdb[0], protect);
index 9fb0be0..590eac2 100644 (file)
@@ -2236,7 +2236,7 @@ static void transport_complete_qf(struct se_cmd *cmd)
                        ret = cmd->se_tfo->queue_data_in(cmd);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case DMA_NONE:
 queue_status:
                trace_target_cmd_complete(cmd);
@@ -2431,7 +2431,7 @@ queue_rsp:
                                goto queue_full;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case DMA_NONE:
 queue_status:
                trace_target_cmd_complete(cmd);
index e9f0dda..a7ed566 100644 (file)
@@ -537,7 +537,7 @@ static void ft_send_work(struct work_struct *work)
        case FCP_PTA_ACA:
                task_attr = TCM_ACA_TAG;
                break;
-       case FCP_PTA_SIMPLE: /* Fallthrough */
+       case FCP_PTA_SIMPLE:
        default:
                task_attr = TCM_SIMPLE_TAG;
        }
index e64db5f..4ffa2e2 100644 (file)
@@ -220,7 +220,7 @@ static int calibrate_8916(struct tsens_priv *priv)
                p2[4] = (qfprom_cdata[1] & MSM8916_S4_P2_MASK) >> MSM8916_S4_P2_SHIFT;
                for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = ((base1 + p2[i]) << 3);
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                base0 = (qfprom_cdata[0] & MSM8916_BASE0_MASK);
                p1[0] = (qfprom_cdata[0] & MSM8916_S0_P1_MASK) >> MSM8916_S0_P1_SHIFT;
@@ -355,7 +355,7 @@ static int calibrate_8974(struct tsens_priv *priv)
                        p2[8] = (calib[5] & S8_P2_BKP_MASK) >> S8_P2_BKP_SHIFT;
                        p2[9] = (calib[5] & S9_P2_BKP_MASK) >> S9_P2_BKP_SHIFT;
                        p2[10] = (calib[5] & S10_P2_BKP_MASK) >> S10_P2_BKP_SHIFT;
-                       /* Fall through */
+                       fallthrough;
                case ONE_PT_CALIB:
                case ONE_PT_CALIB2:
                        base1 = bkp[0] & BASE1_MASK;
@@ -390,7 +390,7 @@ static int calibrate_8974(struct tsens_priv *priv)
                        p2[8] = (calib[4] & S8_P2_MASK) >> S8_P2_SHIFT;
                        p2[9] = (calib[4] & S9_P2_MASK) >> S9_P2_SHIFT;
                        p2[10] = (calib[4] & S10_P2_MASK) >> S10_P2_SHIFT;
-                       /* Fall through */
+                       fallthrough;
                case ONE_PT_CALIB:
                case ONE_PT_CALIB2:
                        base1 = calib[0] & BASE1_MASK;
@@ -420,7 +420,7 @@ static int calibrate_8974(struct tsens_priv *priv)
                        p2[i] <<= 2;
                        p2[i] |= BIT_APPEND;
                }
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                for (i = 0; i < priv->num_sensors; i++) {
                        p1[i] += base1;
index b682a4d..3c19a38 100644 (file)
@@ -202,7 +202,7 @@ static int calibrate_v1(struct tsens_priv *priv)
                p2[9] = (qfprom_cdata[3] & S9_P2_MASK) >> S9_P2_SHIFT;
                for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = ((base1 + p2[i]) << 2);
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                base0 = (qfprom_cdata[4] & BASE0_MASK) >> BASE0_SHIFT;
                p1[0] = (qfprom_cdata[0] & S0_P1_MASK) >> S0_P1_SHIFT;
@@ -263,7 +263,7 @@ static int calibrate_8976(struct tsens_priv *priv)
 
                for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = ((base1 + p2[i]) << 2);
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                base0 = qfprom_cdata[0] & MSM8976_BASE0_MASK;
                p1[0] = (qfprom_cdata[0] & MSM8976_S0_P1_MASK) >> MSM8976_S0_P1_SHIFT;
index f77ceae..394a23c 100644 (file)
@@ -453,7 +453,7 @@ static void tb_ctl_rx_callback(struct tb_ring *ring, struct ring_frame *frame,
                                   "RX: checksum mismatch, dropping packet\n");
                        goto rx;
                }
-               /* Fall through */
+               fallthrough;
        case TB_CFG_PKG_ICM_EVENT:
                if (tb_ctl_handle_event(pkg->ctl, frame->eof, pkg, frame->size))
                        goto rx;
index 712395f..3845db5 100644 (file)
@@ -2092,7 +2092,7 @@ static int tb_switch_add_dma_port(struct tb_switch *sw)
                if (tb_route(sw))
                        return 0;
 
-               /* fallthrough */
+               fallthrough;
        case 3:
                ret = tb_switch_set_uuid(sw);
                if (ret)
index 2aae2c7..1a7e849 100644 (file)
@@ -315,7 +315,7 @@ static inline u32 tb_dp_cap_set_rate(u32 val, u32 rate)
        switch (rate) {
        default:
                WARN(1, "invalid rate %u passed, defaulting to 1620 MB/s\n", rate);
-               /* Fallthrough */
+               fallthrough;
        case 1620:
                val |= DP_COMMON_CAP_RATE_RBR << DP_COMMON_CAP_RATE_SHIFT;
                break;
@@ -355,7 +355,7 @@ static inline u32 tb_dp_cap_set_lanes(u32 val, u32 lanes)
        default:
                WARN(1, "invalid number of lanes %u passed, defaulting to 1\n",
                     lanes);
-               /* Fallthrough */
+               fallthrough;
        case 1:
                val |= DP_COMMON_CAP_1_LANE << DP_COMMON_CAP_LANES_SHIFT;
                break;
index 2a0e51a..92c9a47 100644 (file)
@@ -492,7 +492,7 @@ static void xencons_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 21e76a2..a8e19b4 100644 (file)
@@ -243,7 +243,7 @@ done:
                /* Fall back to a 3 byte encoding */
                word.bytes = 3;
                word.word &= 0x00ffffff;
-               /* Fall through */
+               fallthrough;
        case 3:
                /* 3 byte encoding */
                word.word |= 0x82000000;
index 0a29a94..35cf121 100644 (file)
@@ -1584,7 +1584,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen)
                        gsm_process_modem(tty, dlci, modem, clen);
                        tty_kref_put(tty);
                }
-               /* Fall through */
+               fallthrough;
        case 1:         /* Line state will go via DLCI 0 controls only */
        default:
                tty_insert_flip_string(port, data, len);
@@ -1986,7 +1986,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
                gsm->address = 0;
                gsm->state = GSM_ADDRESS;
                gsm->fcs = INIT_FCS;
-               /* Fall through */
+               fallthrough;
        case GSM_ADDRESS:       /* Address continuation */
                gsm->fcs = gsm_fcs_add(gsm->fcs, c);
                if (gsm_read_ea(&gsm->address, c))
index b09eac4..8e975cb 100644 (file)
@@ -602,7 +602,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
                case TCOFLUSH:
                        flush_tx_queue(tty);
                }
-               /* fall through - to default */
+               fallthrough;    /* to default */
 
        default:
                error = n_tty_ioctl_helper(tty, file, cmd, arg);
index f75696f..934dd2f 100644 (file)
@@ -605,7 +605,6 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c)
                }
                break;
        case R3964_WAIT_FOR_RX_REPEAT:
-               /* FALLTHROUGH */
        case R3964_IDLE:
                if (c == STX) {
                        /* Prevent rx_queue from overflow: */
index db88dee..f8e9999 100644 (file)
@@ -39,7 +39,7 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
                break;
        case UART_IER: /* IER @ 0x04 */
                value &= 0x0f; /* only 4 valid bits - not Xscale */
-               /* fall-through */
+               fallthrough;
        case UART_DLL_EM: /* DLL @ 0x24 (+9) */
        case UART_DLM_EM: /* DLM @ 0x28 (+9) */
                writel(value, p->membase + (offset << 2));
index 04b9af7..2d0e7c7 100644 (file)
@@ -744,6 +744,24 @@ static const struct exar8250_board pbn_exar_XR17V35x = {
        .exit           = pci_xr17v35x_exit,
 };
 
+static const struct exar8250_board pbn_fastcom35x_2 = {
+       .num_ports      = 2,
+       .setup          = pci_xr17v35x_setup,
+       .exit           = pci_xr17v35x_exit,
+};
+
+static const struct exar8250_board pbn_fastcom35x_4 = {
+       .num_ports      = 4,
+       .setup          = pci_xr17v35x_setup,
+       .exit           = pci_xr17v35x_exit,
+};
+
+static const struct exar8250_board pbn_fastcom35x_8 = {
+       .num_ports      = 8,
+       .setup          = pci_xr17v35x_setup,
+       .exit           = pci_xr17v35x_exit,
+};
+
 static const struct exar8250_board pbn_exar_XR17V4358 = {
        .num_ports      = 12,
        .setup          = pci_xr17v35x_setup,
@@ -811,9 +829,9 @@ static const struct pci_device_id exar_pci_tbl[] = {
        EXAR_DEVICE(EXAR, XR17V358, pbn_exar_XR17V35x),
        EXAR_DEVICE(EXAR, XR17V4358, pbn_exar_XR17V4358),
        EXAR_DEVICE(EXAR, XR17V8358, pbn_exar_XR17V8358),
-       EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_exar_XR17V35x),
-       EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_exar_XR17V35x),
-       EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_exar_XR17V35x),
+       EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_fastcom35x_2),
+       EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_fastcom35x_4),
+       EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_fastcom35x_8),
 
        EXAR_DEVICE(COMMTECH, 4222PCI335, pbn_fastcom335_2),
        EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),
index d1d253c..31c9e83 100644 (file)
@@ -255,7 +255,7 @@ static void fintek_8250_set_irq_mode(struct fintek_8250 *pdata, bool is_level)
        case CHIP_ID_F81866:
                sio_write_mask_reg(pdata, F81866_FIFO_CTRL, F81866_IRQ_MODE1,
                                   0);
-               /* fall through */
+               fallthrough;
        case CHIP_ID_F81865:
                sio_write_mask_reg(pdata, F81866_IRQ_MODE, F81866_IRQ_SHARE,
                                   F81866_IRQ_SHARE);
index 1a74d51..3eb2d48 100644 (file)
@@ -631,7 +631,7 @@ pci_timedia_setup(struct serial_private *priv,
                break;
        case 3:
                offset = board->uart_offset;
-               /* FALLTHROUGH */
+               fallthrough;
        case 4: /* BAR 2 */
        case 5: /* BAR 3 */
        case 6: /* BAR 4 */
index 0947569..c71d647 100644 (file)
@@ -1872,7 +1872,7 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
        switch (iir & 0x3f) {
        case UART_IIR_RX_TIMEOUT:
                serial8250_rx_dma_flush(up);
-               /* fall-through */
+               fallthrough;
        case UART_IIR_RLSI:
                return true;
        }
@@ -2275,6 +2275,10 @@ int serial8250_do_startup(struct uart_port *port)
 
        if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) {
                unsigned char iir1;
+
+               if (port->irqflags & IRQF_SHARED)
+                       disable_irq_nosync(port->irq);
+
                /*
                 * Test for UARTs that do not reassert THRE when the
                 * transmitter is idle and the interrupt has already
@@ -2284,8 +2288,6 @@ int serial8250_do_startup(struct uart_port *port)
                 * allow register changes to become visible.
                 */
                spin_lock_irqsave(&port->lock, flags);
-               if (up->port.irqflags & IRQF_SHARED)
-                       disable_irq_nosync(port->irq);
 
                wait_for_xmitr(up, UART_LSR_THRE);
                serial_port_out_sync(port, UART_IER, UART_IER_THRI);
@@ -2297,9 +2299,10 @@ int serial8250_do_startup(struct uart_port *port)
                iir = serial_port_in(port, UART_IIR);
                serial_port_out(port, UART_IER, 0);
 
+               spin_unlock_irqrestore(&port->lock, flags);
+
                if (port->irqflags & IRQF_SHARED)
                        enable_irq(port->irq);
-               spin_unlock_irqrestore(&port->lock, flags);
 
                /*
                 * If the interrupt is not reasserted, or we otherwise
index e0b73a5..a2978ab 100644 (file)
@@ -75,7 +75,7 @@ static unsigned int uniphier_serial_in(struct uart_port *p, int offset)
                break;
        case UART_LCR:
                valshift = 8;
-               /* fall through */
+               fallthrough;
        case UART_MCR:
                offset = UNIPHIER_UART_LCR_MCR;
                break;
@@ -101,7 +101,7 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
        case UART_SCR:
                /* No SCR for this hardware.  Use CHAR as a scratch register */
                valshift = 8;
-               /* fall through */
+               fallthrough;
        case UART_FCR:
                offset = UNIPHIER_UART_CHAR_FCR;
                break;
@@ -109,7 +109,7 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
                valshift = 8;
                /* Divisor latch access bit does not exist. */
                value &= ~UART_LCR_DLAB;
-               /* fall through */
+               fallthrough;
        case UART_MCR:
                offset = UNIPHIER_UART_LCR_MCR;
                break;
index 8a0352e..2a266b5 100644 (file)
@@ -235,7 +235,7 @@ config SERIAL_CLPS711X_CONSOLE
 
 config SERIAL_SAMSUNG
        tristate "Samsung SoC serial support"
-       depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        select SERIAL_CORE
        help
          Support for the on-chip UARTs on the Samsung S3C24XX series CPUs,
@@ -517,6 +517,7 @@ config SERIAL_IMX_CONSOLE
 
 config SERIAL_IMX_EARLYCON
        bool "Earlycon on IMX serial port"
+       depends on ARCH_MXC || COMPILE_TEST
        depends on OF
        select SERIAL_EARLYCON
        help
index d056ee6..caf167f 100644 (file)
@@ -43,6 +43,7 @@ obj-$(CONFIG_SERIAL_ZS) += zs.o
 obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o
 obj-$(CONFIG_SERIAL_CPM) += cpm_uart/
 obj-$(CONFIG_SERIAL_IMX) += imx.o
+obj-$(CONFIG_SERIAL_IMX_EARLYCON) += imx_earlycon.o
 obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o
 obj-$(CONFIG_SERIAL_ICOM) += icom.o
 obj-$(CONFIG_SERIAL_MESON) += meson_uart.o
index c010f63..6749859 100644 (file)
@@ -2241,9 +2241,8 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
        clk_disable(uap->clk);
 }
 
-static void __init
-pl011_console_get_options(struct uart_amba_port *uap, int *baud,
-                            int *parity, int *bits)
+static void pl011_console_get_options(struct uart_amba_port *uap, int *baud,
+                                     int *parity, int *bits)
 {
        if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) {
                unsigned int lcr_h, ibrd, fbrd;
@@ -2276,7 +2275,7 @@ pl011_console_get_options(struct uart_amba_port *uap, int *baud,
        }
 }
 
-static int __init pl011_console_setup(struct console *co, char *options)
+static int pl011_console_setup(struct console *co, char *options)
 {
        struct uart_amba_port *uap;
        int baud = 38400;
@@ -2344,8 +2343,8 @@ static int __init pl011_console_setup(struct console *co, char *options)
  *
  *     Returns 0 if console matches; otherwise non-zero to use default matching
  */
-static int __init pl011_console_match(struct console *co, char *name, int idx,
-                                     char *options)
+static int pl011_console_match(struct console *co, char *name, int idx,
+                              char *options)
 {
        unsigned char iotype;
        resource_size_t addr;
@@ -2615,7 +2614,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
 
 static int pl011_register_port(struct uart_amba_port *uap)
 {
-       int ret;
+       int ret, i;
 
        /* Ensure interrupts from this UART are masked and cleared */
        pl011_write(0, uap, REG_IMSC);
@@ -2626,6 +2625,9 @@ static int pl011_register_port(struct uart_amba_port *uap)
                if (ret < 0) {
                        dev_err(uap->port.dev,
                                "Failed to register AMBA-PL011 driver\n");
+                       for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
+                               if (amba_ports[i] == uap)
+                                       amba_ports[i] = NULL;
                        return ret;
                }
        }
index e43471b..bb5fc8b 100644 (file)
@@ -1845,7 +1845,7 @@ static void atmel_get_ip_name(struct uart_port *port)
                version = atmel_uart_readl(port, ATMEL_US_VERSION);
                switch (version) {
                case 0x814:     /* sama5d2 */
-                       /* fall through */
+                       fallthrough;
                case 0x701:     /* sama5d4 */
                        atmel_port->fidi_min = 3;
                        atmel_port->fidi_max = 65535;
index 8573fc9..76b94d0 100644 (file)
@@ -587,7 +587,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
                        transmit_chars(up, lsr);
                        break;
                case UART_IIR_RX_TIMEOUT:
-                       /* FALLTHROUGH */
                case UART_IIR_RDI:
                        serial_omap_rdi(up, lsr);
                        break;
@@ -598,7 +597,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
                        /* simply try again */
                        break;
                case UART_IIR_XOFF:
-                       /* FALLTHROUGH */
                default:
                        break;
                }
index 3aa29d2..184b458 100644 (file)
@@ -361,11 +361,16 @@ static int qcom_geni_serial_get_char(struct uart_port *uport)
                        return NO_POLL_CHAR;
 
                if (word_cnt == 1 && (status & RX_LAST))
+                       /*
+                        * NOTE: If RX_LAST_BYTE_VALID is 0 it needs to be
+                        * treated as if it was BYTES_PER_FIFO_WORD.
+                        */
                        private_data->poll_cached_bytes_cnt =
                                (status & RX_LAST_BYTE_VALID_MSK) >>
                                RX_LAST_BYTE_VALID_SHFT;
-               else
-                       private_data->poll_cached_bytes_cnt = 4;
+
+               if (private_data->poll_cached_bytes_cnt == 0)
+                       private_data->poll_cached_bytes_cnt = BYTES_PER_FIFO_WORD;
 
                private_data->poll_cached_bytes =
                        readl(uport->membase + SE_GENI_RX_FIFOn);
@@ -1098,7 +1103,7 @@ static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport)
 }
 
 #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
-static int __init qcom_geni_console_setup(struct console *co, char *options)
+static int qcom_geni_console_setup(struct console *co, char *options)
 {
        struct uart_port *uport;
        struct qcom_geni_serial_port *port;
index b5ef86a..85366e0 100644 (file)
@@ -259,7 +259,7 @@ static void rda_uart_set_termios(struct uart_port *port,
        case CS5:
        case CS6:
                dev_warn(port->dev, "bit size not supported, using 7 bits\n");
-               /* Fall through */
+               fallthrough;
        case CS7:
                ctrl &= ~RDA_UART_DBITS_8;
                break;
index 8ed3482..8ae3e03 100644 (file)
@@ -1905,9 +1905,11 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
                ourport->tx_irq = ret + 1;
        }
 
-       ret = platform_get_irq(platdev, 1);
-       if (ret > 0)
-               ourport->tx_irq = ret;
+       if (!s3c24xx_serial_has_interrupt_mask(port)) {
+               ret = platform_get_irq(platdev, 1);
+               if (ret > 0)
+                       ourport->tx_irq = ret;
+       }
        /*
         * DMA is currently supported only on DT platforms, if DMA properties
         * are specified.
index b87914a..bd13014 100644 (file)
@@ -876,7 +876,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
                                tegra_uart_write(tup, ier, UART_IER);
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case 2: /* Receive */
                        if (!tup->use_rx_pio) {
                                is_rx_start = tup->rx_in_progress;
index 3403dd7..f797c97 100644 (file)
@@ -2101,7 +2101,7 @@ uart_set_options(struct uart_port *port, struct console *co,
        switch (parity) {
        case 'o': case 'O':
                termios.c_cflag |= PARODD;
-               /*fall through*/
+               fallthrough;
        case 'e': case 'E':
                termios.c_cflag |= PARENB;
                break;
index 143300a..ba503dd 100644 (file)
@@ -970,7 +970,7 @@ static int stm32_init_port(struct stm32_port *stm32port,
                return ret;
 
        if (stm32port->info->cfg.has_wakeup) {
-               stm32port->wakeirq = platform_get_irq(pdev, 1);
+               stm32port->wakeirq = platform_get_irq_optional(pdev, 1);
                if (stm32port->wakeirq <= 0 && stm32port->wakeirq != -ENXIO)
                        return stm32port->wakeirq ? : -ENODEV;
        }
index 8ce9a7a..319e5ce 100644 (file)
@@ -514,7 +514,7 @@ static void receive_kbd_ms_chars(struct uart_sunsu_port *up, int is_break)
                        switch (ret) {
                        case 2:
                                sunsu_change_mouse_baud(up);
-                               /* fallthru */
+                               fallthrough;
                        case 1:
                                break;
 
index 7ea06bb..001e19d 100644 (file)
@@ -306,7 +306,7 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up,
                switch (ret) {
                case 2:
                        sunzilog_change_mouse_baud(up);
-                       /* fallthru */
+                       fallthrough;
                case 1:
                        break;
 
index 2833f14..a9b1ee2 100644 (file)
@@ -544,7 +544,7 @@ static int cdns_uart_clk_notifier_cb(struct notifier_block *nb,
 
                cdns_uart->baud = cdns_uart_set_baud_rate(cdns_uart->port,
                                cdns_uart->baud);
-               /* fall through */
+               fallthrough;
        case ABORT_RATE_CHANGE:
                if (!locked)
                        spin_lock_irqsave(&cdns_uart->port->lock, flags);
index 9245fff..e18f318 100644 (file)
@@ -866,7 +866,7 @@ static int __tty_perform_flush(struct tty_struct *tty, unsigned long arg)
                        ld->ops->flush_buffer(tty);
                        tty_unthrottle(tty);
                }
-               /* fall through */
+               fallthrough;
        case TCOFLUSH:
                tty_driver_flush_buffer(tty);
                break;
index ccb533f..19cd4a4 100644 (file)
@@ -1201,7 +1201,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
        unsigned int old_rows, old_row_size, first_copied_row;
        unsigned int new_cols, new_rows, new_row_size, new_screen_size;
        unsigned int user;
-       unsigned short *newscreen;
+       unsigned short *oldscreen, *newscreen;
        struct uni_screen *new_uniscr = NULL;
 
        WARN_CONSOLE_UNLOCKED();
@@ -1299,10 +1299,11 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
        if (new_scr_end > new_origin)
                scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
                            new_scr_end - new_origin);
-       kfree(vc->vc_screenbuf);
+       oldscreen = vc->vc_screenbuf;
        vc->vc_screenbuf = newscreen;
        vc->vc_screenbuf_size = new_screen_size;
        set_origin(vc);
+       kfree(oldscreen);
 
        /* do part of a reset_terminal() */
        vc->vc_top = 0;
@@ -1553,7 +1554,7 @@ static void csi_J(struct vc_data *vc, int vpar)
                        break;
                case 3: /* include scrollback */
                        flush_scrollback(vc);
-                       /* fallthrough */
+                       fallthrough;
                case 2: /* erase whole display */
                        vc_uniscr_clear_lines(vc, 0, vc->vc_rows);
                        count = vc->vc_cols * vc->vc_rows;
@@ -2167,7 +2168,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                lf(vc);
                if (!is_kbd(vc, lnm))
                        return;
-               /* fall through */
+               fallthrough;
        case 13:
                cr(vc);
                return;
@@ -2306,7 +2307,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                        return;
                }
                vc->vc_priv = EPecma;
-               /* fall through */
+               fallthrough;
        case ESgetpars:
                if (c == ';' && vc->vc_npar < NPAR - 1) {
                        vc->vc_npar++;
index 91c3017..a4e520b 100644 (file)
@@ -806,12 +806,22 @@ static int vt_resizex(struct vc_data *vc, struct vt_consize __user *cs)
                console_lock();
                vcp = vc_cons[i].d;
                if (vcp) {
+                       int ret;
+                       int save_scan_lines = vcp->vc_scan_lines;
+                       int save_font_height = vcp->vc_font.height;
+
                        if (v.v_vlin)
                                vcp->vc_scan_lines = v.v_vlin;
                        if (v.v_clin)
                                vcp->vc_font.height = v.v_clin;
                        vcp->vc_resize_user = 1;
-                       vc_resize(vcp, v.v_cols, v.v_rows);
+                       ret = vc_resize(vcp, v.v_cols, v.v_rows);
+                       if (ret) {
+                               vcp->vc_scan_lines = save_scan_lines;
+                               vcp->vc_font.height = save_font_height;
+                               console_unlock();
+                               return ret;
+                       }
                }
                console_unlock();
        }
index f7f6229..60f4711 100644 (file)
@@ -710,7 +710,8 @@ static int c67x00_add_ctrl_urb(struct c67x00_hcd *c67x00, struct urb *urb)
                        if (ret)
                                return ret;
                        break;
-               }               /* else fallthrough */
+               }
+               fallthrough;
        case STATUS_STAGE:
                pid = !usb_pipeout(urb->pipe) ? USB_PID_OUT : USB_PID_IN;
                ret = c67x00_create_td(c67x00, urb, NULL, 0, pid, 1,
index 9917868..7f6f3ab 100644 (file)
@@ -378,21 +378,19 @@ static void acm_ctrl_irq(struct urb *urb)
        if (current_size < expected_size) {
                /* notification is transmitted fragmented, reassemble */
                if (acm->nb_size < expected_size) {
-                       if (acm->nb_size) {
-                               kfree(acm->notification_buffer);
-                               acm->nb_size = 0;
-                       }
+                       u8 *new_buffer;
                        alloc_size = roundup_pow_of_two(expected_size);
-                       /*
-                        * kmalloc ensures a valid notification_buffer after a
-                        * use of kfree in case the previous allocation was too
-                        * small. Final freeing is done on disconnect.
-                        */
-                       acm->notification_buffer =
-                               kmalloc(alloc_size, GFP_ATOMIC);
-                       if (!acm->notification_buffer)
+                       /* Final freeing is done on disconnect. */
+                       new_buffer = krealloc(acm->notification_buffer,
+                                             alloc_size, GFP_ATOMIC);
+                       if (!new_buffer) {
+                               acm->nb_index = 0;
                                goto exit;
+                       }
+
+                       acm->notification_buffer = new_buffer;
                        acm->nb_size = alloc_size;
+                       dr = (struct usb_cdc_notification *)acm->notification_buffer;
                }
 
                copy_size = min(current_size,
index f81606c..7e73e98 100644 (file)
@@ -905,6 +905,35 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
+static bool is_dev_usb_generic_driver(struct device *dev)
+{
+       struct usb_device_driver *udd = dev->driver ?
+               to_usb_device_driver(dev->driver) : NULL;
+
+       return udd == &usb_generic_driver;
+}
+
+static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
+{
+       struct usb_device_driver *new_udriver = data;
+       struct usb_device *udev;
+       int ret;
+
+       if (!is_dev_usb_generic_driver(dev))
+               return 0;
+
+       udev = to_usb_device(dev);
+       if (usb_device_match_id(udev, new_udriver->id_table) == NULL &&
+           (!new_udriver->match || new_udriver->match(udev) != 0))
+               return 0;
+
+       ret = device_reprobe(dev);
+       if (ret && ret != -EPROBE_DEFER)
+               dev_err(dev, "Failed to reprobe device (error %d)\n", ret);
+
+       return 0;
+}
+
 /**
  * usb_register_device_driver - register a USB device (not interface) driver
  * @new_udriver: USB operations for the device driver
@@ -934,13 +963,20 @@ int usb_register_device_driver(struct usb_device_driver *new_udriver,
 
        retval = driver_register(&new_udriver->drvwrap.driver);
 
-       if (!retval)
+       if (!retval) {
                pr_info("%s: registered new device driver %s\n",
                        usbcore_name, new_udriver->name);
-       else
+               /*
+                * Check whether any device could be better served with
+                * this new driver
+                */
+               bus_for_each_dev(&usb_bus_type, NULL, new_udriver,
+                                __usb_bus_reprobe_drivers);
+       } else {
                printk(KERN_ERR "%s: error %d registering device "
                        "       driver %s\n",
                        usbcore_name, retval, new_udriver->name);
+       }
 
        return retval;
 }
index b6f2d4b..2b2f1ab 100644 (file)
@@ -205,8 +205,9 @@ static int __check_usb_generic(struct device_driver *drv, void *data)
        udrv = to_usb_device_driver(drv);
        if (udrv == &usb_generic_driver)
                return 0;
-
-       return usb_device_match_id(udev, udrv->id_table) != NULL;
+       if (usb_device_match_id(udev, udrv->id_table) != NULL)
+               return 1;
+       return (udrv->match && udrv->match(udev));
 }
 
 static bool usb_generic_driver_match(struct usb_device *udev)
index 4dc443a..ec0d6c5 100644 (file)
@@ -315,11 +315,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
 void usb_hcd_pci_remove(struct pci_dev *dev)
 {
        struct usb_hcd          *hcd;
+       int                     hcd_driver_flags;
 
        hcd = pci_get_drvdata(dev);
        if (!hcd)
                return;
 
+       hcd_driver_flags = hcd->driver->flags;
+
        if (pci_dev_run_wake(dev))
                pm_runtime_get_noresume(&dev->dev);
 
@@ -347,7 +350,7 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
                up_read(&companions_rwsem);
        }
        usb_put_hcd(hcd);
-       if ((hcd->driver->flags & HCD_MASK) < HCD_USB3)
+       if ((hcd_driver_flags & HCD_MASK) < HCD_USB3)
                pci_free_irq_vectors(dev);
        pci_disable_device(dev);
 }
index 052d5ac..5b768b8 100644 (file)
@@ -727,7 +727,7 @@ static void hub_irq(struct urb *urb)
                if ((++hub->nerrors < 10) || hub->error)
                        goto resubmit;
                hub->error = status;
-               /* FALL THROUGH */
+               fallthrough;
 
        /* let hub_wq handle things */
        case 0:                 /* we got data:  port status changed */
index 7c1198f..f232914 100644 (file)
@@ -370,6 +370,10 @@ static const struct usb_device_id usb_quirk_list[] = {
        { USB_DEVICE(0x0926, 0x0202), .driver_info =
                        USB_QUIRK_ENDPOINT_IGNORE },
 
+       /* Sound Devices MixPre-D */
+       { USB_DEVICE(0x0926, 0x0208), .driver_info =
+                       USB_QUIRK_ENDPOINT_IGNORE },
+
        /* Keytouch QWERTY Panel keyboard */
        { USB_DEVICE(0x0926, 0x3333), .driver_info =
                        USB_QUIRK_CONFIG_INTF_STRINGS },
@@ -465,6 +469,8 @@ static const struct usb_device_id usb_quirk_list[] = {
 
        { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM },
 
+       { USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM },
+
        /* DJI CineSSD */
        { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
 
@@ -509,6 +515,7 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = {
  */
 static const struct usb_device_id usb_endpoint_ignore[] = {
        { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 },
+       { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 },
        { }
 };
 
index 422aea2..2eb34c8 100644 (file)
@@ -646,9 +646,8 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
                        if (!(reg & DWC3_GUSB2PHYCFG_ULPI_UTMI))
                                break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
-               /* FALLTHROUGH */
        default:
                break;
        }
@@ -1411,7 +1410,7 @@ static void dwc3_check_params(struct dwc3 *dwc)
        default:
                dev_err(dev, "invalid maximum_speed parameter %d\n",
                        dwc->maximum_speed);
-               /* fall through */
+               fallthrough;
        case USB_SPEED_UNKNOWN:
                /* default to superspeed */
                dwc->maximum_speed = USB_SPEED_SUPER;
index e44bfc3..c2a0f64 100644 (file)
@@ -1054,27 +1054,25 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb,
  * dwc3_prepare_one_trb - setup one TRB from one request
  * @dep: endpoint for which this request is prepared
  * @req: dwc3_request pointer
+ * @trb_length: buffer size of the TRB
  * @chain: should this TRB be chained to the next?
  * @node: only for isochronous endpoints. First TRB needs different type.
  */
 static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
-               struct dwc3_request *req, unsigned chain, unsigned node)
+               struct dwc3_request *req, unsigned int trb_length,
+               unsigned chain, unsigned node)
 {
        struct dwc3_trb         *trb;
-       unsigned int            length;
        dma_addr_t              dma;
        unsigned                stream_id = req->request.stream_id;
        unsigned                short_not_ok = req->request.short_not_ok;
        unsigned                no_interrupt = req->request.no_interrupt;
        unsigned                is_last = req->request.is_last;
 
-       if (req->request.num_sgs > 0) {
-               length = sg_dma_len(req->start_sg);
+       if (req->request.num_sgs > 0)
                dma = sg_dma_address(req->start_sg);
-       } else {
-               length = req->request.length;
+       else
                dma = req->request.dma;
-       }
 
        trb = &dep->trb_pool[dep->trb_enqueue];
 
@@ -1086,7 +1084,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 
        req->num_trbs++;
 
-       __dwc3_prepare_one_trb(dep, trb, dma, length, chain, node,
+       __dwc3_prepare_one_trb(dep, trb, dma, trb_length, chain, node,
                        stream_id, short_not_ok, no_interrupt, is_last);
 }
 
@@ -1096,16 +1094,27 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
        struct scatterlist *sg = req->start_sg;
        struct scatterlist *s;
        int             i;
-
+       unsigned int length = req->request.length;
        unsigned int remaining = req->request.num_mapped_sgs
                - req->num_queued_sgs;
 
+       /*
+        * If we resume preparing the request, then get the remaining length of
+        * the request and resume where we left off.
+        */
+       for_each_sg(req->request.sg, s, req->num_queued_sgs, i)
+               length -= sg_dma_len(s);
+
        for_each_sg(sg, s, remaining, i) {
-               unsigned int length = req->request.length;
                unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
                unsigned int rem = length % maxp;
+               unsigned int trb_length;
                unsigned chain = true;
 
+               trb_length = min_t(unsigned int, length, sg_dma_len(s));
+
+               length -= trb_length;
+
                /*
                 * IOMMU driver is coalescing the list of sgs which shares a
                 * page boundary into one and giving it to USB driver. With
@@ -1113,7 +1122,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                 * sgs passed. So mark the chain bit to false if it isthe last
                 * mapped sg.
                 */
-               if (i == remaining - 1)
+               if ((i == remaining - 1) || !length)
                        chain = false;
 
                if (rem && usb_endpoint_dir_out(dep->endpoint.desc) && !chain) {
@@ -1123,7 +1132,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                        req->needs_extra_trb = true;
 
                        /* prepare normal TRB */
-                       dwc3_prepare_one_trb(dep, req, true, i);
+                       dwc3_prepare_one_trb(dep, req, trb_length, true, i);
 
                        /* Now prepare one extra TRB to align transfer size */
                        trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1134,8 +1143,39 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                                        req->request.short_not_ok,
                                        req->request.no_interrupt,
                                        req->request.is_last);
+               } else if (req->request.zero && req->request.length &&
+                          !usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+                          !rem && !chain) {
+                       struct dwc3     *dwc = dep->dwc;
+                       struct dwc3_trb *trb;
+
+                       req->needs_extra_trb = true;
+
+                       /* Prepare normal TRB */
+                       dwc3_prepare_one_trb(dep, req, trb_length, true, i);
+
+                       /* Prepare one extra TRB to handle ZLP */
+                       trb = &dep->trb_pool[dep->trb_enqueue];
+                       req->num_trbs++;
+                       __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0,
+                                              !req->direction, 1,
+                                              req->request.stream_id,
+                                              req->request.short_not_ok,
+                                              req->request.no_interrupt,
+                                              req->request.is_last);
+
+                       /* Prepare one more TRB to handle MPS alignment */
+                       if (!req->direction) {
+                               trb = &dep->trb_pool[dep->trb_enqueue];
+                               req->num_trbs++;
+                               __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp,
+                                                      false, 1, req->request.stream_id,
+                                                      req->request.short_not_ok,
+                                                      req->request.no_interrupt,
+                                                      req->request.is_last);
+                       }
                } else {
-                       dwc3_prepare_one_trb(dep, req, chain, i);
+                       dwc3_prepare_one_trb(dep, req, trb_length, chain, i);
                }
 
                /*
@@ -1150,6 +1190,16 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
 
                req->num_queued_sgs++;
 
+               /*
+                * The number of pending SG entries may not correspond to the
+                * number of mapped SG entries. If all the data are queued, then
+                * don't include unused SG entries.
+                */
+               if (length == 0) {
+                       req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs;
+                       break;
+               }
+
                if (!dwc3_calc_trbs_left(dep))
                        break;
        }
@@ -1169,7 +1219,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                req->needs_extra_trb = true;
 
                /* prepare normal TRB */
-               dwc3_prepare_one_trb(dep, req, true, 0);
+               dwc3_prepare_one_trb(dep, req, length, true, 0);
 
                /* Now prepare one extra TRB to align transfer size */
                trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1180,6 +1230,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                                req->request.no_interrupt,
                                req->request.is_last);
        } else if (req->request.zero && req->request.length &&
+                  !usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
                   (IS_ALIGNED(req->request.length, maxp))) {
                struct dwc3     *dwc = dep->dwc;
                struct dwc3_trb *trb;
@@ -1187,18 +1238,29 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                req->needs_extra_trb = true;
 
                /* prepare normal TRB */
-               dwc3_prepare_one_trb(dep, req, true, 0);
+               dwc3_prepare_one_trb(dep, req, length, true, 0);
 
-               /* Now prepare one extra TRB to handle ZLP */
+               /* Prepare one extra TRB to handle ZLP */
                trb = &dep->trb_pool[dep->trb_enqueue];
                req->num_trbs++;
                __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0,
-                               false, 1, req->request.stream_id,
+                               !req->direction, 1, req->request.stream_id,
                                req->request.short_not_ok,
                                req->request.no_interrupt,
                                req->request.is_last);
+
+               /* Prepare one more TRB to handle MPS alignment for OUT */
+               if (!req->direction) {
+                       trb = &dep->trb_pool[dep->trb_enqueue];
+                       req->num_trbs++;
+                       __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp,
+                                              false, 1, req->request.stream_id,
+                                              req->request.short_not_ok,
+                                              req->request.no_interrupt,
+                                              req->request.is_last);
+               }
        } else {
-               dwc3_prepare_one_trb(dep, req, false, 0);
+               dwc3_prepare_one_trb(dep, req, length, false, 0);
        }
 }
 
@@ -2671,8 +2733,17 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
                                status);
 
        if (req->needs_extra_trb) {
+               unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
+
                ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event,
                                status);
+
+               /* Reclaim MPS padding TRB for ZLP */
+               if (!req->direction && req->request.zero && req->request.length &&
+                   !usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+                   (IS_ALIGNED(req->request.length, maxp)))
+                       ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, status);
+
                req->needs_extra_trb = false;
        }
 
index 331c951..950c943 100644 (file)
@@ -2039,7 +2039,6 @@ static int do_scsi_command(struct fsg_common *common)
        case RELEASE:
        case RESERVE:
        case SEND_DIAGNOSTIC:
-               fallthrough;
 
        default:
 unknown_cmnd:
index 1d90008..b4206b0 100644 (file)
@@ -1181,12 +1181,15 @@ static int ncm_unwrap_ntb(struct gether *port,
        int             ndp_index;
        unsigned        dg_len, dg_len2;
        unsigned        ndp_len;
+       unsigned        block_len;
        struct sk_buff  *skb2;
        int             ret = -EINVAL;
-       unsigned        max_size = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize);
+       unsigned        ntb_max = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize);
+       unsigned        frame_max = le16_to_cpu(ecm_desc.wMaxSegmentSize);
        const struct ndp_parser_opts *opts = ncm->parser_opts;
        unsigned        crc_len = ncm->is_crc ? sizeof(uint32_t) : 0;
        int             dgram_counter;
+       bool            ndp_after_header;
 
        /* dwSignature */
        if (get_unaligned_le32(tmp) != opts->nth_sign) {
@@ -1205,25 +1208,37 @@ static int ncm_unwrap_ntb(struct gether *port,
        }
        tmp++; /* skip wSequence */
 
+       block_len = get_ncm(&tmp, opts->block_length);
        /* (d)wBlockLength */
-       if (get_ncm(&tmp, opts->block_length) > max_size) {
+       if (block_len > ntb_max) {
                INFO(port->func.config->cdev, "OUT size exceeded\n");
                goto err;
        }
 
        ndp_index = get_ncm(&tmp, opts->ndp_index);
+       ndp_after_header = false;
 
        /* Run through all the NDP's in the NTB */
        do {
-               /* NCM 3.2 */
-               if (((ndp_index % 4) != 0) &&
-                               (ndp_index < opts->nth_size)) {
+               /*
+                * NCM 3.2
+                * dwNdpIndex
+                */
+               if (((ndp_index % 4) != 0) ||
+                               (ndp_index < opts->nth_size) ||
+                               (ndp_index > (block_len -
+                                             opts->ndp_size))) {
                        INFO(port->func.config->cdev, "Bad index: %#X\n",
                             ndp_index);
                        goto err;
                }
+               if (ndp_index == opts->nth_size)
+                       ndp_after_header = true;
 
-               /* walk through NDP */
+               /*
+                * walk through NDP
+                * dwSignature
+                */
                tmp = (void *)(skb->data + ndp_index);
                if (get_unaligned_le32(tmp) != ncm->ndp_sign) {
                        INFO(port->func.config->cdev, "Wrong NDP SIGN\n");
@@ -1234,14 +1249,15 @@ static int ncm_unwrap_ntb(struct gether *port,
                ndp_len = get_unaligned_le16(tmp++);
                /*
                 * NCM 3.3.1
+                * wLength
                 * entry is 2 items
                 * item size is 16/32 bits, opts->dgram_item_len * 2 bytes
                 * minimal: struct usb_cdc_ncm_ndpX + normal entry + zero entry
                 * Each entry is a dgram index and a dgram length.
                 */
                if ((ndp_len < opts->ndp_size
-                               + 2 * 2 * (opts->dgram_item_len * 2))
-                               || (ndp_len % opts->ndplen_align != 0)) {
+                               + 2 * 2 * (opts->dgram_item_len * 2)) ||
+                               (ndp_len % opts->ndplen_align != 0)) {
                        INFO(port->func.config->cdev, "Bad NDP length: %#X\n",
                             ndp_len);
                        goto err;
@@ -1258,8 +1274,21 @@ static int ncm_unwrap_ntb(struct gether *port,
 
                do {
                        index = index2;
+                       /* wDatagramIndex[0] */
+                       if ((index < opts->nth_size) ||
+                                       (index > block_len - opts->dpe_size)) {
+                               INFO(port->func.config->cdev,
+                                    "Bad index: %#X\n", index);
+                               goto err;
+                       }
+
                        dg_len = dg_len2;
-                       if (dg_len < 14 + crc_len) { /* ethernet hdr + crc */
+                       /*
+                        * wDatagramLength[0]
+                        * ethernet hdr + crc or larger than max frame size
+                        */
+                       if ((dg_len < 14 + crc_len) ||
+                                       (dg_len > frame_max)) {
                                INFO(port->func.config->cdev,
                                     "Bad dgram length: %#X\n", dg_len);
                                goto err;
@@ -1283,6 +1312,37 @@ static int ncm_unwrap_ntb(struct gether *port,
                        index2 = get_ncm(&tmp, opts->dgram_item_len);
                        dg_len2 = get_ncm(&tmp, opts->dgram_item_len);
 
+                       if (index2 == 0 || dg_len2 == 0)
+                               break;
+
+                       /* wDatagramIndex[1] */
+                       if (ndp_after_header) {
+                               if (index2 < opts->nth_size + opts->ndp_size) {
+                                       INFO(port->func.config->cdev,
+                                            "Bad index: %#X\n", index2);
+                                       goto err;
+                               }
+                       } else {
+                               if (index2 < opts->nth_size + opts->dpe_size) {
+                                       INFO(port->func.config->cdev,
+                                            "Bad index: %#X\n", index2);
+                                       goto err;
+                               }
+                       }
+                       if (index2 > block_len - opts->dpe_size) {
+                               INFO(port->func.config->cdev,
+                                    "Bad index: %#X\n", index2);
+                               goto err;
+                       }
+
+                       /* wDatagramLength[1] */
+                       if ((dg_len2 < 14 + crc_len) ||
+                                       (dg_len2 > frame_max)) {
+                               INFO(port->func.config->cdev,
+                                    "Bad dgram length: %#X\n", dg_len);
+                               goto err;
+                       }
+
                        /*
                         * Copy the data into a new skb.
                         * This ensures the truesize is correct
@@ -1299,9 +1359,6 @@ static int ncm_unwrap_ntb(struct gether *port,
                        ndp_len -= 2 * (opts->dgram_item_len * 2);
 
                        dgram_counter++;
-
-                       if (index2 == 0 || dg_len2 == 0)
-                               break;
                } while (ndp_len > 2 * (opts->dgram_item_len * 2));
        } while (ndp_index);
 
index d94b814..184165e 100644 (file)
@@ -753,12 +753,13 @@ static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream)
                goto err_sts;
 
        return 0;
+
 err_sts:
-       usb_ep_free_request(fu->ep_status, stream->req_status);
-       stream->req_status = NULL;
-err_out:
        usb_ep_free_request(fu->ep_out, stream->req_out);
        stream->req_out = NULL;
+err_out:
+       usb_ep_free_request(fu->ep_in, stream->req_in);
+       stream->req_in = NULL;
 out:
        return -ENOMEM;
 }
index eaa13fd..e313c3b 100644 (file)
@@ -14,6 +14,7 @@
 #define __U_F_H__
 
 #include <linux/usb/gadget.h>
+#include <linux/overflow.h>
 
 /* Variable Length Array Macros **********************************************/
 #define vla_group(groupname) size_t groupname##__next = 0
 
 #define vla_item(groupname, type, name, n) \
        size_t groupname##_##name##__offset = ({                               \
-               size_t align_mask = __alignof__(type) - 1;                     \
-               size_t offset = (groupname##__next + align_mask) & ~align_mask;\
-               size_t size = (n) * sizeof(type);                              \
-               groupname##__next = offset + size;                             \
+               size_t offset = 0;                                             \
+               if (groupname##__next != SIZE_MAX) {                           \
+                       size_t align_mask = __alignof__(type) - 1;             \
+                       size_t size = array_size(n, sizeof(type));             \
+                       offset = (groupname##__next + align_mask) &            \
+                                 ~align_mask;                                 \
+                       if (check_add_overflow(offset, size,                   \
+                                              &groupname##__next)) {          \
+                               groupname##__next = SIZE_MAX;                  \
+                               offset = 0;                                    \
+                       }                                                      \
+               }                                                              \
                offset;                                                        \
        })
 
 #define vla_item_with_sz(groupname, type, name, n) \
-       size_t groupname##_##name##__sz = (n) * sizeof(type);                  \
-       size_t groupname##_##name##__offset = ({                               \
-               size_t align_mask = __alignof__(type) - 1;                     \
-               size_t offset = (groupname##__next + align_mask) & ~align_mask;\
-               size_t size = groupname##_##name##__sz;                        \
-               groupname##__next = offset + size;                             \
-               offset;                                                        \
+       size_t groupname##_##name##__sz = array_size(n, sizeof(type));          \
+       size_t groupname##_##name##__offset = ({                                \
+               size_t offset = 0;                                              \
+               if (groupname##__next != SIZE_MAX) {                            \
+                       size_t align_mask = __alignof__(type) - 1;              \
+                       offset = (groupname##__next + align_mask) &             \
+                                 ~align_mask;                                  \
+                       if (check_add_overflow(offset, groupname##_##name##__sz,\
+                                                       &groupname##__next)) {  \
+                               groupname##__next = SIZE_MAX;                   \
+                               offset = 0;                                     \
+                       }                                                       \
+               }                                                               \
+               offset;                                                         \
        })
 
 #define vla_ptr(ptr, groupname, name) \
index fa67930..a6426dd 100644 (file)
@@ -328,7 +328,7 @@ static int usba_config_fifo_table(struct usba_udc *udc)
        switch (fifo_mode) {
        default:
                fifo_mode = 0;
-               /* fall through */
+               fallthrough;
        case 0:
                udc->fifo_cfg = NULL;
                n = 0;
index b2638e8..a6f7b25 100644 (file)
@@ -250,7 +250,7 @@ static int dr_controller_setup(struct fsl_udc *udc)
                break;
        case FSL_USB2_PHY_UTMI_WIDE:
                portctrl |= PORTSCX_PTW_16BIT;
-               /* fall through */
+               fallthrough;
        case FSL_USB2_PHY_UTMI:
        case FSL_USB2_PHY_UTMI_DUAL:
                if (udc->pdata->have_sysif_regs) {
index cfafdd9..10324a7 100644 (file)
@@ -2340,12 +2340,12 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
        case PXA250_A0:
        case PXA250_A1:
                /* A0/A1 "not released"; ep 13, 15 unusable */
-               /* fall through */
+               fallthrough;
        case PXA250_B2: case PXA210_B2:
        case PXA250_B1: case PXA210_B1:
        case PXA250_B0: case PXA210_B0:
                /* OUT-DMA is broken ... */
-               /* fall through */
+               fallthrough;
        case PXA250_C0: case PXA210_C0:
                break;
 #elif  defined(CONFIG_ARCH_IXP4XX)
index aaca1b0..7bd5182 100644 (file)
@@ -30,8 +30,6 @@
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
 
-#include <mach/regs-s3c2443-clock.h>
-
 #define S3C_HSUDC_REG(x)       (x)
 
 /* Non-Indexed Registers */
@@ -186,53 +184,6 @@ static inline void __orr32(void __iomem *ptr, u32 val)
        writel(readl(ptr) | val, ptr);
 }
 
-static void s3c_hsudc_init_phy(void)
-{
-       u32 cfg;
-
-       cfg = readl(S3C2443_PWRCFG) | S3C2443_PWRCFG_USBPHY;
-       writel(cfg, S3C2443_PWRCFG);
-
-       cfg = readl(S3C2443_URSTCON);
-       cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
-       writel(cfg, S3C2443_URSTCON);
-       mdelay(1);
-
-       cfg = readl(S3C2443_URSTCON);
-       cfg &= ~(S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
-       writel(cfg, S3C2443_URSTCON);
-
-       cfg = readl(S3C2443_PHYCTRL);
-       cfg &= ~(S3C2443_PHYCTRL_CLKSEL | S3C2443_PHYCTRL_DSPORT);
-       cfg |= (S3C2443_PHYCTRL_EXTCLK | S3C2443_PHYCTRL_PLLSEL);
-       writel(cfg, S3C2443_PHYCTRL);
-
-       cfg = readl(S3C2443_PHYPWR);
-       cfg &= ~(S3C2443_PHYPWR_FSUSPEND | S3C2443_PHYPWR_PLL_PWRDN |
-               S3C2443_PHYPWR_XO_ON | S3C2443_PHYPWR_PLL_REFCLK |
-               S3C2443_PHYPWR_ANALOG_PD);
-       cfg |= S3C2443_PHYPWR_COMMON_ON;
-       writel(cfg, S3C2443_PHYPWR);
-
-       cfg = readl(S3C2443_UCLKCON);
-       cfg |= (S3C2443_UCLKCON_DETECT_VBUS | S3C2443_UCLKCON_FUNC_CLKEN |
-               S3C2443_UCLKCON_TCLKEN);
-       writel(cfg, S3C2443_UCLKCON);
-}
-
-static void s3c_hsudc_uninit_phy(void)
-{
-       u32 cfg;
-
-       cfg = readl(S3C2443_PWRCFG) & ~S3C2443_PWRCFG_USBPHY;
-       writel(cfg, S3C2443_PWRCFG);
-
-       writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR);
-
-       cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN;
-       writel(cfg, S3C2443_UCLKCON);
-}
-
 /**
  * s3c_hsudc_complete_request - Complete a transfer request.
  * @hsep: Endpoint to which the request belongs.
@@ -1188,7 +1139,8 @@ static int s3c_hsudc_start(struct usb_gadget *gadget,
 
        pm_runtime_get_sync(hsudc->dev);
 
-       s3c_hsudc_init_phy();
+       if (hsudc->pd->phy_init)
+               hsudc->pd->phy_init();
        if (hsudc->pd->gpio_init)
                hsudc->pd->gpio_init();
 
@@ -1210,7 +1162,8 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget)
 
        spin_lock_irqsave(&hsudc->lock, flags);
        hsudc->gadget.speed = USB_SPEED_UNKNOWN;
-       s3c_hsudc_uninit_phy();
+       if (hsudc->pd->phy_uninit)
+               hsudc->pd->phy_uninit();
 
        pm_runtime_put(hsudc->dev);
 
index bc2e8eb..f1ea514 100644 (file)
 #include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/unaligned.h>
-#include <mach/irqs.h>
 
-#include <mach/hardware.h>
-
-#include <plat/regs-udc.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 
-
 #include "s3c2410_udc.h"
+#include "s3c2410_udc_regs.h"
 
 #define DRIVER_DESC    "S3C2410 USB Device Controller Gadget"
 #define DRIVER_AUTHOR  "Herbert Pötzl <herbert@13thfloor.at>, " \
@@ -57,6 +53,7 @@ static struct s3c2410_udc     *the_controller;
 static struct clk              *udc_clock;
 static struct clk              *usb_bus_clock;
 static void __iomem            *base_addr;
+static int                     irq_usbd;
 static u64                     rsrc_start;
 static u64                     rsrc_len;
 static struct dentry           *s3c2410_udc_debugfs_root;
@@ -835,8 +832,6 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep)
        }
 }
 
-#include <mach/regs-irq.h>
-
 /*
  *     s3c2410_udc_irq - interrupt handler
  */
@@ -977,7 +972,7 @@ static irqreturn_t s3c2410_udc_irq(int dummy, void *_dev)
                }
        }
 
-       dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", IRQ_USBD);
+       dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", irq_usbd);
 
        /* Restore old index */
        udc_write(idx, S3C2410_UDC_INDEX_REG);
@@ -1270,7 +1265,6 @@ static int s3c2410_udc_queue(struct usb_ep *_ep, struct usb_request *_req,
 static int s3c2410_udc_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 {
        struct s3c2410_ep       *ep = to_s3c2410_ep(_ep);
-       struct s3c2410_udc      *udc;
        int                     retval = -EINVAL;
        unsigned long           flags;
        struct s3c2410_request  *req = NULL;
@@ -1283,8 +1277,6 @@ static int s3c2410_udc_dequeue(struct usb_ep *_ep, struct usb_request *_req)
        if (!_ep || !_req)
                return retval;
 
-       udc = to_s3c2410_udc(ep->gadget);
-
        local_irq_save(flags);
 
        list_for_each_entry(req, &ep->queue, queue) {
@@ -1780,13 +1772,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
        spin_lock_init(&udc->lock);
        udc_info = dev_get_platdata(&pdev->dev);
 
-       rsrc_start = S3C2410_PA_USBDEV;
-       rsrc_len   = S3C24XX_SZ_USBDEV;
-
-       if (!request_mem_region(rsrc_start, rsrc_len, gadget_name))
-               return -EBUSY;
-
-       base_addr = ioremap(rsrc_start, rsrc_len);
+       base_addr = devm_platform_ioremap_resource(pdev, 0);
        if (!base_addr) {
                retval = -ENOMEM;
                goto err_mem;
@@ -1798,17 +1784,19 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
        s3c2410_udc_disable(udc);
        s3c2410_udc_reinit(udc);
 
+       irq_usbd = platform_get_irq(pdev, 0);
+
        /* irq setup after old hardware state is cleaned up */
-       retval = request_irq(IRQ_USBD, s3c2410_udc_irq,
+       retval = request_irq(irq_usbd, s3c2410_udc_irq,
                             0, gadget_name, udc);
 
        if (retval != 0) {
-               dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval);
+               dev_err(dev, "cannot get irq %i, err %d\n", irq_usbd, retval);
                retval = -EBUSY;
                goto err_map;
        }
 
-       dev_dbg(dev, "got irq %i\n", IRQ_USBD);
+       dev_dbg(dev, "got irq %i\n", irq_usbd);
 
        if (udc_info && udc_info->vbus_pin > 0) {
                retval = gpio_request(udc_info->vbus_pin, "udc vbus");
@@ -1875,7 +1863,7 @@ err_gpio_claim:
        if (udc_info && udc_info->vbus_pin > 0)
                gpio_free(udc_info->vbus_pin);
 err_int:
-       free_irq(IRQ_USBD, udc);
+       free_irq(irq_usbd, udc);
 err_map:
        iounmap(base_addr);
 err_mem:
@@ -1909,7 +1897,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
                free_irq(irq, udc);
        }
 
-       free_irq(IRQ_USBD, udc);
+       free_irq(irq_usbd, udc);
 
        iounmap(base_addr);
        release_mem_region(rsrc_start, rsrc_len);
index bdcaa8d..68bdf3e 100644 (file)
@@ -90,6 +90,7 @@ struct s3c2410_udc {
        unsigned                        req_pending : 1;
        u8                              vbus;
        struct dentry                   *regs_info;
+       int                             irq;
 };
 #define to_s3c2410(g)  (container_of((g), struct s3c2410_udc, gadget))
 
diff --git a/drivers/usb/gadget/udc/s3c2410_udc_regs.h b/drivers/usb/gadget/udc/s3c2410_udc_regs.h
new file mode 100644 (file)
index 0000000..d8d2eea
--- /dev/null
@@ -0,0 +1,146 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
+ */
+
+#ifndef __ASM_ARCH_REGS_UDC_H
+#define __ASM_ARCH_REGS_UDC_H
+
+#define S3C2410_USBDREG(x) (x)
+
+#define S3C2410_UDC_FUNC_ADDR_REG      S3C2410_USBDREG(0x0140)
+#define S3C2410_UDC_PWR_REG            S3C2410_USBDREG(0x0144)
+#define S3C2410_UDC_EP_INT_REG         S3C2410_USBDREG(0x0148)
+
+#define S3C2410_UDC_USB_INT_REG                S3C2410_USBDREG(0x0158)
+#define S3C2410_UDC_EP_INT_EN_REG      S3C2410_USBDREG(0x015c)
+
+#define S3C2410_UDC_USB_INT_EN_REG     S3C2410_USBDREG(0x016c)
+
+#define S3C2410_UDC_FRAME_NUM1_REG     S3C2410_USBDREG(0x0170)
+#define S3C2410_UDC_FRAME_NUM2_REG     S3C2410_USBDREG(0x0174)
+
+#define S3C2410_UDC_EP0_FIFO_REG       S3C2410_USBDREG(0x01c0)
+#define S3C2410_UDC_EP1_FIFO_REG       S3C2410_USBDREG(0x01c4)
+#define S3C2410_UDC_EP2_FIFO_REG       S3C2410_USBDREG(0x01c8)
+#define S3C2410_UDC_EP3_FIFO_REG       S3C2410_USBDREG(0x01cc)
+#define S3C2410_UDC_EP4_FIFO_REG       S3C2410_USBDREG(0x01d0)
+
+#define S3C2410_UDC_EP1_DMA_CON                S3C2410_USBDREG(0x0200)
+#define S3C2410_UDC_EP1_DMA_UNIT       S3C2410_USBDREG(0x0204)
+#define S3C2410_UDC_EP1_DMA_FIFO       S3C2410_USBDREG(0x0208)
+#define S3C2410_UDC_EP1_DMA_TTC_L      S3C2410_USBDREG(0x020c)
+#define S3C2410_UDC_EP1_DMA_TTC_M      S3C2410_USBDREG(0x0210)
+#define S3C2410_UDC_EP1_DMA_TTC_H      S3C2410_USBDREG(0x0214)
+
+#define S3C2410_UDC_EP2_DMA_CON                S3C2410_USBDREG(0x0218)
+#define S3C2410_UDC_EP2_DMA_UNIT       S3C2410_USBDREG(0x021c)
+#define S3C2410_UDC_EP2_DMA_FIFO       S3C2410_USBDREG(0x0220)
+#define S3C2410_UDC_EP2_DMA_TTC_L      S3C2410_USBDREG(0x0224)
+#define S3C2410_UDC_EP2_DMA_TTC_M      S3C2410_USBDREG(0x0228)
+#define S3C2410_UDC_EP2_DMA_TTC_H      S3C2410_USBDREG(0x022c)
+
+#define S3C2410_UDC_EP3_DMA_CON                S3C2410_USBDREG(0x0240)
+#define S3C2410_UDC_EP3_DMA_UNIT       S3C2410_USBDREG(0x0244)
+#define S3C2410_UDC_EP3_DMA_FIFO       S3C2410_USBDREG(0x0248)
+#define S3C2410_UDC_EP3_DMA_TTC_L      S3C2410_USBDREG(0x024c)
+#define S3C2410_UDC_EP3_DMA_TTC_M      S3C2410_USBDREG(0x0250)
+#define S3C2410_UDC_EP3_DMA_TTC_H      S3C2410_USBDREG(0x0254)
+
+#define S3C2410_UDC_EP4_DMA_CON                S3C2410_USBDREG(0x0258)
+#define S3C2410_UDC_EP4_DMA_UNIT       S3C2410_USBDREG(0x025c)
+#define S3C2410_UDC_EP4_DMA_FIFO       S3C2410_USBDREG(0x0260)
+#define S3C2410_UDC_EP4_DMA_TTC_L      S3C2410_USBDREG(0x0264)
+#define S3C2410_UDC_EP4_DMA_TTC_M      S3C2410_USBDREG(0x0268)
+#define S3C2410_UDC_EP4_DMA_TTC_H      S3C2410_USBDREG(0x026c)
+
+#define S3C2410_UDC_INDEX_REG          S3C2410_USBDREG(0x0178)
+
+/* indexed registers */
+
+#define S3C2410_UDC_MAXP_REG           S3C2410_USBDREG(0x0180)
+
+#define S3C2410_UDC_EP0_CSR_REG                S3C2410_USBDREG(0x0184)
+
+#define S3C2410_UDC_IN_CSR1_REG                S3C2410_USBDREG(0x0184)
+#define S3C2410_UDC_IN_CSR2_REG                S3C2410_USBDREG(0x0188)
+
+#define S3C2410_UDC_OUT_CSR1_REG       S3C2410_USBDREG(0x0190)
+#define S3C2410_UDC_OUT_CSR2_REG       S3C2410_USBDREG(0x0194)
+#define S3C2410_UDC_OUT_FIFO_CNT1_REG  S3C2410_USBDREG(0x0198)
+#define S3C2410_UDC_OUT_FIFO_CNT2_REG  S3C2410_USBDREG(0x019c)
+
+#define S3C2410_UDC_FUNCADDR_UPDATE    (1 << 7)
+
+#define S3C2410_UDC_PWR_ISOUP          (1 << 7) /* R/W */
+#define S3C2410_UDC_PWR_RESET          (1 << 3) /* R   */
+#define S3C2410_UDC_PWR_RESUME         (1 << 2) /* R/W */
+#define S3C2410_UDC_PWR_SUSPEND                (1 << 1) /* R   */
+#define S3C2410_UDC_PWR_ENSUSPEND      (1 << 0) /* R/W */
+
+#define S3C2410_UDC_PWR_DEFAULT                (0x00)
+
+#define S3C2410_UDC_INT_EP4            (1 << 4) /* R/W (clear only) */
+#define S3C2410_UDC_INT_EP3            (1 << 3) /* R/W (clear only) */
+#define S3C2410_UDC_INT_EP2            (1 << 2) /* R/W (clear only) */
+#define S3C2410_UDC_INT_EP1            (1 << 1) /* R/W (clear only) */
+#define S3C2410_UDC_INT_EP0            (1 << 0) /* R/W (clear only) */
+
+#define S3C2410_UDC_USBINT_RESET       (1 << 2) /* R/W (clear only) */
+#define S3C2410_UDC_USBINT_RESUME      (1 << 1) /* R/W (clear only) */
+#define S3C2410_UDC_USBINT_SUSPEND     (1 << 0) /* R/W (clear only) */
+
+#define S3C2410_UDC_INTE_EP4           (1 << 4) /* R/W */
+#define S3C2410_UDC_INTE_EP3           (1 << 3) /* R/W */
+#define S3C2410_UDC_INTE_EP2           (1 << 2) /* R/W */
+#define S3C2410_UDC_INTE_EP1           (1 << 1) /* R/W */
+#define S3C2410_UDC_INTE_EP0           (1 << 0) /* R/W */
+
+#define S3C2410_UDC_USBINTE_RESET      (1 << 2) /* R/W */
+#define S3C2410_UDC_USBINTE_SUSPEND    (1 << 0) /* R/W */
+
+#define S3C2410_UDC_INDEX_EP0          (0x00)
+#define S3C2410_UDC_INDEX_EP1          (0x01)
+#define S3C2410_UDC_INDEX_EP2          (0x02)
+#define S3C2410_UDC_INDEX_EP3          (0x03)
+#define S3C2410_UDC_INDEX_EP4          (0x04)
+
+#define S3C2410_UDC_ICSR1_CLRDT                (1 << 6) /* R/W */
+#define S3C2410_UDC_ICSR1_SENTSTL      (1 << 5) /* R/W (clear only) */
+#define S3C2410_UDC_ICSR1_SENDSTL      (1 << 4) /* R/W */
+#define S3C2410_UDC_ICSR1_FFLUSH       (1 << 3) /* W   (set only) */
+#define S3C2410_UDC_ICSR1_UNDRUN       (1 << 2) /* R/W (clear only) */
+#define S3C2410_UDC_ICSR1_PKTRDY       (1 << 0) /* R/W (set only) */
+
+#define S3C2410_UDC_ICSR2_AUTOSET      (1 << 7) /* R/W */
+#define S3C2410_UDC_ICSR2_ISO          (1 << 6) /* R/W */
+#define S3C2410_UDC_ICSR2_MODEIN       (1 << 5) /* R/W */
+#define S3C2410_UDC_ICSR2_DMAIEN       (1 << 4) /* R/W */
+
+#define S3C2410_UDC_OCSR1_CLRDT                (1 << 7) /* R/W */
+#define S3C2410_UDC_OCSR1_SENTSTL      (1 << 6) /* R/W (clear only) */
+#define S3C2410_UDC_OCSR1_SENDSTL      (1 << 5) /* R/W */
+#define S3C2410_UDC_OCSR1_FFLUSH       (1 << 4) /* R/W */
+#define S3C2410_UDC_OCSR1_DERROR       (1 << 3) /* R   */
+#define S3C2410_UDC_OCSR1_OVRRUN       (1 << 2) /* R/W (clear only) */
+#define S3C2410_UDC_OCSR1_PKTRDY       (1 << 0) /* R/W (clear only) */
+
+#define S3C2410_UDC_OCSR2_AUTOCLR      (1 << 7) /* R/W */
+#define S3C2410_UDC_OCSR2_ISO          (1 << 6) /* R/W */
+#define S3C2410_UDC_OCSR2_DMAIEN       (1 << 5) /* R/W */
+
+#define S3C2410_UDC_EP0_CSR_OPKRDY     (1 << 0)
+#define S3C2410_UDC_EP0_CSR_IPKRDY     (1 << 1)
+#define S3C2410_UDC_EP0_CSR_SENTSTL    (1 << 2)
+#define S3C2410_UDC_EP0_CSR_DE         (1 << 3)
+#define S3C2410_UDC_EP0_CSR_SE         (1 << 4)
+#define S3C2410_UDC_EP0_CSR_SENDSTL    (1 << 5)
+#define S3C2410_UDC_EP0_CSR_SOPKTRDY   (1 << 6)
+#define S3C2410_UDC_EP0_CSR_SSE                (1 << 7)
+
+#define S3C2410_UDC_MAXP_8             (1 << 0)
+#define S3C2410_UDC_MAXP_16            (1 << 1)
+#define S3C2410_UDC_MAXP_32            (1 << 2)
+#define S3C2410_UDC_MAXP_64            (1 << 3)
+
+#endif
index a87c0b2..3055d9a 100644 (file)
@@ -1019,7 +1019,7 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
                        spin_lock_irqsave(&isp116x->lock, flags);
                        isp116x_write_reg32(isp116x, HCRHSTATUS, RH_HS_OCIC);
                        spin_unlock_irqrestore(&isp116x->lock, flags);
-                       /* fall through */
+                       fallthrough;
                case C_HUB_LOCAL_POWER:
                        DBG("C_HUB_LOCAL_POWER\n");
                        break;
@@ -1421,10 +1421,10 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd)
                isp116x_write_reg32(isp116x, HCCONTROL,
                                    (val & ~HCCONTROL_HCFS) |
                                    HCCONTROL_USB_RESET);
-               /* fall through */
+               fallthrough;
        case HCCONTROL_USB_RESET:
                ret = -EBUSY;
-               /* fall through */
+               fallthrough;
        default:                /* HCCONTROL_USB_SUSPEND */
                spin_unlock_irqrestore(&isp116x->lock, flags);
                break;
index bd40e59..5f5e8a6 100644 (file)
@@ -171,9 +171,8 @@ static int exynos_ohci_probe(struct platform_device *pdev)
        hcd->rsrc_len = resource_size(res);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               dev_err(&pdev->dev, "Failed to get IRQ\n");
-               err = -ENODEV;
+       if (irq < 0) {
+               err = irq;
                goto fail_io;
        }
 
index b8961c0..8c1bbac 100644 (file)
@@ -957,7 +957,8 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
                        ehci_bios_handoff(pdev, op_reg_base, cap, offset);
                        break;
                case 0: /* Illegal reserved cap, set cap=0 so we exit */
-                       cap = 0; /* fall through */
+                       cap = 0;
+                       fallthrough;
                default:
                        dev_warn(&pdev->dev,
                                 "EHCI: unrecognized capability %02x\n",
index fcc5ac5..ccb0156 100644 (file)
@@ -699,7 +699,7 @@ static void dbc_handle_xfer_event(struct xhci_dbc *dbc, union xhci_trb *event)
        switch (comp_code) {
        case COMP_SUCCESS:
                remain_length = 0;
-       /* FALLTHROUGH */
+               fallthrough;
        case COMP_SHORT_PACKET:
                status = 0;
                break;
index 92e25a6..c88bffd 100644 (file)
@@ -274,7 +274,7 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused)
 
 static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
 {
-       int                     dci;
+       int                     ep_index;
        dma_addr_t              dma;
        struct xhci_hcd         *xhci;
        struct xhci_ep_ctx      *ep_ctx;
@@ -283,9 +283,9 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
 
        xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
 
-       for (dci = 1; dci < 32; dci++) {
-               ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
-               dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
+       for (ep_index = 0; ep_index < 31; ep_index++) {
+               ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
+               dma = dev->out_ctx->dma + (ep_index + 1) * CTX_SIZE(xhci->hcc_params);
                seq_printf(s, "%pad: %s\n", &dma,
                           xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
                                                  le32_to_cpu(ep_ctx->ep_info2),
index c3554e3..c799ca5 100644 (file)
@@ -740,15 +740,6 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
 {
        u32 pls = status_reg & PORT_PLS_MASK;
 
-       /* resume state is a xHCI internal state.
-        * Do not report it to usb core, instead, pretend to be U3,
-        * thus usb core knows it's not ready for transfer
-        */
-       if (pls == XDEV_RESUME) {
-               *status |= USB_SS_PORT_LS_U3;
-               return;
-       }
-
        /* When the CAS bit is set then warm reset
         * should be performed on port
         */
@@ -770,6 +761,16 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
                 */
                pls |= USB_PORT_STAT_CONNECTION;
        } else {
+               /*
+                * Resume state is an xHCI internal state.  Do not report it to
+                * usb core, instead, pretend to be U3, thus usb core knows
+                * it's not ready for transfer.
+                */
+               if (pls == XDEV_RESUME) {
+                       *status |= USB_SS_PORT_LS_U3;
+                       return;
+               }
+
                /*
                 * If CAS bit isn't set but the Port is already at
                 * Compliance Mode, fake a connection so the USB core
@@ -1483,7 +1484,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        break;
                case USB_PORT_FEAT_C_SUSPEND:
                        bus_state->port_c_suspend &= ~(1 << wIndex);
-                       /* fall through */
+                       fallthrough;
                case USB_PORT_FEAT_C_RESET:
                case USB_PORT_FEAT_C_BH_PORT_RESET:
                case USB_PORT_FEAT_C_CONNECTION:
index 696fad5..fe405cd 100644 (file)
@@ -1311,7 +1311,7 @@ static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
                        interval = xhci_parse_microframe_interval(udev, ep);
                        break;
                }
-               /* Fall through - SS and HS isoc/int have same decoding */
+               fallthrough;    /* SS and HS isoc/int have same decoding */
 
        case USB_SPEED_SUPER_PLUS:
        case USB_SPEED_SUPER:
@@ -1331,7 +1331,7 @@ static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
                 * since it uses the same rules as low speed interrupt
                 * endpoints.
                 */
-               /* fall through */
+               fallthrough;
 
        case USB_SPEED_LOW:
                if (usb_endpoint_xfer_int(&ep->desc) ||
index 59b1965..f97ac9f 100644 (file)
 #define RENESAS_RETRY  10000
 #define RENESAS_DELAY  10
 
-#define ROM_VALID_01 0x2013
-#define ROM_VALID_02 0x2026
-
-static int renesas_verify_fw_version(struct pci_dev *pdev, u32 version)
-{
-       switch (version) {
-       case ROM_VALID_01:
-       case ROM_VALID_02:
-               return 0;
-       }
-       dev_err(&pdev->dev, "FW has invalid version :%d\n", version);
-       return -EINVAL;
-}
-
 static int renesas_fw_download_image(struct pci_dev *dev,
                                     const u32 *fw, size_t step, bool rom)
 {
@@ -202,10 +188,7 @@ static int renesas_check_rom_state(struct pci_dev *pdev)
 
        version &= RENESAS_FW_VERSION_FIELD;
        version = version >> RENESAS_FW_VERSION_OFFSET;
-
-       err = renesas_verify_fw_version(pdev, version);
-       if (err)
-               return err;
+       dev_dbg(&pdev->dev, "Found ROM version: %x\n", version);
 
        /*
         * Test if ROM is present and loaded, if so we can skip everything
index 2c255d0..a741a38 100644 (file)
@@ -2103,7 +2103,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
                        break;
                xhci_dbg(xhci, "TRB error %u, halted endpoint index = %u\n",
                         trb_comp_code, ep_index);
-               /* else fall through */
+               fallthrough;
        case COMP_STALL_ERROR:
                /* Did we transfer part of the data (middle) phase? */
                if (trb_type == TRB_DATA || trb_type == TRB_NORMAL)
index 014d793..190923d 100644 (file)
@@ -1136,7 +1136,7 @@ static struct phy *tegra_xusb_get_phy(struct tegra_xusb *tegra, char *name,
        unsigned int i, phy_count = 0;
 
        for (i = 0; i < tegra->soc->num_types; i++) {
-               if (!strncmp(tegra->soc->phy_types[i].name, "usb2",
+               if (!strncmp(tegra->soc->phy_types[i].name, name,
                                                            strlen(name)))
                        return tegra->phys[phy_count+port];
 
@@ -1258,6 +1258,8 @@ static int tegra_xusb_init_usb_phy(struct tegra_xusb *tegra)
 
        INIT_WORK(&tegra->id_work, tegra_xhci_id_work);
        tegra->id_nb.notifier_call = tegra_xhci_id_notify;
+       tegra->otg_usb2_port = -EINVAL;
+       tegra->otg_usb3_port = -EINVAL;
 
        for (i = 0; i < tegra->num_usb_phys; i++) {
                struct phy *phy = tegra_xusb_get_phy(tegra, "usb2", i);
index 3c41b14..f4cedca 100644 (file)
@@ -3236,10 +3236,11 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd,
 
        wait_for_completion(cfg_cmd->completion);
 
-       ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE;
        xhci_free_command(xhci, cfg_cmd);
 cleanup:
        xhci_free_command(xhci, stop_cmd);
+       if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE)
+               ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE;
 }
 
 static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
@@ -4618,7 +4619,7 @@ static unsigned long long xhci_calculate_intel_u1_timeout(
                        break;
                }
                /* Otherwise the calculation is the same as isoc eps */
-               /* fall through */
+               fallthrough;
        case USB_ENDPOINT_XFER_ISOC:
                timeout_ns = xhci_service_interval_to_ns(desc);
                timeout_ns = DIV_ROUND_UP_ULL(timeout_ns * 105, 100);
index 407fe75..f868613 100644 (file)
@@ -426,7 +426,7 @@ static int lvs_rh_probe(struct usb_interface *intf,
                        USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT);
        if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) {
                dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret);
-               return ret;
+               return ret < 0 ? ret : -EINVAL;
        }
 
        /* submit urb to poll interrupt endpoint */
index 6e7d34e..b2e0988 100644 (file)
@@ -492,7 +492,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
        prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
        dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
                dev->cntl_buffer[0]);
-       retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
+       retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
        if (retval >= 0)
                timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
        finish_wait(&dev->waitq, &wait);
index c545b27..edb5b63 100644 (file)
@@ -975,7 +975,7 @@ static int cppi_channel_program(struct dma_channel *ch,
                musb_dbg(musb, "%cX DMA%d not allocated!",
                                cppi_ch->transmit ? 'T' : 'R',
                                cppi_ch->index);
-               /* FALLTHROUGH */
+               fallthrough;
        case MUSB_DMA_STATUS_FREE:
                break;
        }
index 5a56a03..849e0b7 100644 (file)
@@ -852,7 +852,7 @@ static void musb_handle_intr_suspend(struct musb *musb, u8 devctl)
        case OTG_STATE_B_IDLE:
                if (!musb->is_active)
                        break;
-               /* fall through */
+               fallthrough;
        case OTG_STATE_B_PERIPHERAL:
                musb_g_suspend(musb);
                musb->is_active = musb->g.b_hnp_enable;
@@ -972,9 +972,8 @@ static void musb_handle_intr_disconnect(struct musb *musb, u8 devctl)
        case OTG_STATE_A_PERIPHERAL:
                musb_hnp_stop(musb);
                musb_root_disconnect(musb);
-               /* FALLTHROUGH */
+               fallthrough;
        case OTG_STATE_B_WAIT_ACON:
-               /* FALLTHROUGH */
        case OTG_STATE_B_PERIPHERAL:
        case OTG_STATE_B_IDLE:
                musb_g_disconnect(musb);
@@ -1009,7 +1008,7 @@ static void musb_handle_intr_reset(struct musb *musb)
                switch (musb->xceiv->otg->state) {
                case OTG_STATE_A_SUSPEND:
                        musb_g_reset(musb);
-                       /* FALLTHROUGH */
+                       fallthrough;
                case OTG_STATE_A_WAIT_BCON:     /* OPT TD.4.7-900ms */
                        /* never use invalid T(a_wait_bcon) */
                        musb_dbg(musb, "HNP: in %s, %d msec timeout",
@@ -1030,7 +1029,7 @@ static void musb_handle_intr_reset(struct musb *musb)
                        break;
                case OTG_STATE_B_IDLE:
                        musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case OTG_STATE_B_PERIPHERAL:
                        musb_g_reset(musb);
                        break;
@@ -1471,7 +1470,7 @@ static int ep_config_from_table(struct musb *musb)
        switch (fifo_mode) {
        default:
                fifo_mode = 0;
-               /* FALLTHROUGH */
+               fallthrough;
        case 0:
                cfg = mode_0_cfg;
                n = ARRAY_SIZE(mode_0_cfg);
@@ -2018,7 +2017,7 @@ static void musb_pm_runtime_check_session(struct musb *musb)
                        musb->quirk_retries--;
                        return;
                }
-               /* fall through */
+               fallthrough;
        case MUSB_QUIRK_A_DISCONNECT_19:
                if (musb->quirk_retries && !musb->flush_irq_work) {
                        musb_dbg(musb,
index 19556c1..30085b2 100644 (file)
@@ -232,7 +232,7 @@ static int dsps_check_status(struct musb *musb, void *unused)
                        dsps_mod_timer_optional(glue);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case OTG_STATE_A_WAIT_BCON:
                /* keep VBUS on for host-only mode */
@@ -242,7 +242,7 @@ static int dsps_check_status(struct musb *musb, void *unused)
                }
                musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
                skip_session = 1;
-               /* fall through */
+               fallthrough;
 
        case OTG_STATE_A_IDLE:
        case OTG_STATE_B_IDLE:
@@ -793,7 +793,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
        case USB_SPEED_SUPER:
                dev_warn(dev, "ignore incorrect maximum_speed "
                                "(super-speed) setting in dts");
-               /* fall through */
+               fallthrough;
        default:
                config->maximum_speed = USB_SPEED_HIGH;
        }
index 0ae3e0b..44d3cb0 100644 (file)
@@ -735,7 +735,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
                        musb_writeb(mbase, MUSB_TESTMODE,
                                        musb->test_mode_nr);
                }
-               /* FALLTHROUGH */
+               fallthrough;
 
        case MUSB_EP0_STAGE_STATUSOUT:
                /* end of sequence #1: write to host (TX state) */
@@ -767,7 +767,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
                 */
                retval = IRQ_HANDLED;
                musb->ep0_state = MUSB_EP0_STAGE_SETUP;
-               /* FALLTHROUGH */
+               fallthrough;
 
        case MUSB_EP0_STAGE_SETUP:
 setup:
index 8b7d22a..30c5e7d 100644 (file)
@@ -360,7 +360,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb,
                                qh = first_qh(head);
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
 
                case USB_ENDPOINT_XFER_ISOC:
                case USB_ENDPOINT_XFER_INT:
@@ -1019,7 +1019,7 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
                        musb->ep0_stage = MUSB_EP0_OUT;
                        more = true;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case MUSB_EP0_OUT:
                fifo_count = min_t(size_t, qh->maxpacket,
                                   urb->transfer_buffer_length -
@@ -2222,7 +2222,7 @@ static int musb_urb_enqueue(
                        interval = max_t(u8, epd->bInterval, 1);
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case USB_ENDPOINT_XFER_ISOC:
                /* ISO always uses logarithmic encoding */
                interval = min_t(u8, epd->bInterval, 16);
index cb7ae29..cafc695 100644 (file)
@@ -211,7 +211,7 @@ void musb_root_disconnect(struct musb *musb)
                        musb->g.is_a_peripheral = 1;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OTG_STATE_A_HOST:
                musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
                musb->is_active = 0;
index d62c78b..4232f1c 100644 (file)
@@ -104,7 +104,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
                        if (error)
                                break;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
-                       /* Fall through */
+                       fallthrough;
                case OTG_STATE_A_WAIT_VRISE:
                case OTG_STATE_A_WAIT_BCON:
                case OTG_STATE_A_HOST:
index 99890d1..c26683a 100644 (file)
@@ -464,7 +464,7 @@ static void musb_do_idle(struct timer_list *t)
                        dev_dbg(musb->controller, "Nothing connected %s, turning off VBUS\n",
                                        usb_otg_state_string(musb->xceiv->otg->state));
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OTG_STATE_A_IDLE:
                tusb_musb_set_vbus(musb, 0);
        default:
index d4ee3cb..f6d3731 100644 (file)
@@ -176,6 +176,7 @@ static int ingenic_usb_phy_init(struct usb_phy *phy)
 
        /* Wait for PHY to reset */
        usleep_range(30, 300);
+       reg = readl(priv->base + REG_USBPCR_OFFSET);
        writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET);
        usleep_range(300, 1000);
 
index c8a988d..15dc258 100644 (file)
@@ -592,7 +592,7 @@ static unsigned long sddr55_get_capacity(struct us_data *us) {
        case 0x64:
                info->pageshift = 8;
                info->smallpageshift = 1;
-               /* fall through */
+               fallthrough;
        case 0x5d: // 5d is a ROM card with pagesize 512.
                return 0x00200000;
 
index d592071..08f9296 100644 (file)
@@ -688,7 +688,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
                break;
        case DMA_BIDIRECTIONAL:
                cmdinfo->state |= ALLOC_DATA_IN_URB | SUBMIT_DATA_IN_URB;
-               /* fall through */
+               fallthrough;
        case DMA_TO_DEVICE:
                cmdinfo->state |= ALLOC_DATA_OUT_URB | SUBMIT_DATA_OUT_URB;
        case DMA_NONE:
index 220ae2c..5732e96 100644 (file)
@@ -2328,7 +2328,7 @@ UNUSUAL_DEV(  0x357d, 0x7788, 0x0114, 0x0114,
                "JMicron",
                "USB to ATA/ATAPI Bridge",
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
-               US_FL_BROKEN_FUA ),
+               US_FL_BROKEN_FUA | US_FL_IGNORE_UAS ),
 
 /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */
 UNUSUAL_DEV(  0x4102, 0x1020, 0x0100,  0x0100,
index 162b09d..711ab24 100644 (file)
  * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org>
  */
 
+/* Reported-by: Till Dörges <doerges@pre-sense.de> */
+UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
+               "Sony",
+               "PSZ-HA*",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_REPORT_OPCODES),
+
 /* Reported-by: Julian Groß <julian.g@posteo.de> */
 UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
                "LaCie",
@@ -80,6 +87,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
                US_FL_BROKEN_FUA),
 
+/* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */
+UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999,
+               "PNY",
+               "Pro Elite SSD",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_ATA_1X),
+
 /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
 UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
                "VIA",
index f57d91f..bd80e03 100644 (file)
@@ -157,7 +157,7 @@ static enum typec_cc_status tcpci_to_typec_cc(unsigned int cc, bool sink)
        case 0x3:
                if (sink)
                        return TYPEC_CC_RP_3_0;
-               /* fall through */
+               fallthrough;
        case 0x0:
        default:
                return TYPEC_CC_OPEN;
index 3ef3720..a48e3f9 100644 (file)
@@ -3372,13 +3372,31 @@ static void run_state_machine(struct tcpm_port *port)
                        tcpm_set_state(port, SNK_HARD_RESET_SINK_OFF, 0);
                break;
        case SRC_HARD_RESET_VBUS_OFF:
-               tcpm_set_vconn(port, true);
+               /*
+                * 7.1.5 Response to Hard Resets
+                * Hard Reset Signaling indicates a communication failure has occurred and the
+                * Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin and Shall
+                * drive VBUS to vSafe0V as shown in Figure 7-9.
+                */
+               tcpm_set_vconn(port, false);
                tcpm_set_vbus(port, false);
                tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE,
                               tcpm_data_role_for_source(port));
-               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER);
+               /*
+                * If tcpc fails to notify vbus off, TCPM will wait for PD_T_SAFE_0V +
+                * PD_T_SRC_RECOVER before turning vbus back on.
+                * From Table 7-12 Sequence Description for a Source Initiated Hard Reset:
+                * 4. Policy Engine waits tPSHardReset after sending Hard Reset Signaling and then
+                * tells the Device Policy Manager to instruct the power supply to perform a
+                * Hard Reset. The transition to vSafe0V Shall occur within tSafe0V (t2).
+                * 5. After tSrcRecover the Source applies power to VBUS in an attempt to
+                * re-establish communication with the Sink and resume USB Default Operation.
+                * The transition to vSafe5V Shall occur within tSrcTurnOn(t4).
+                */
+               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SAFE_0V + PD_T_SRC_RECOVER);
                break;
        case SRC_HARD_RESET_VBUS_ON:
+               tcpm_set_vconn(port, true);
                tcpm_set_vbus(port, true);
                port->tcpc->set_pd_rx(port->tcpc, true);
                tcpm_set_attached_state(port, true);
@@ -3944,7 +3962,11 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
                tcpm_set_state(port, SNK_HARD_RESET_WAIT_VBUS, 0);
                break;
        case SRC_HARD_RESET_VBUS_OFF:
-               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, 0);
+               /*
+                * After establishing the vSafe0V voltage condition on VBUS, the Source Shall wait
+                * tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V.
+                */
+               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER);
                break;
        case HARD_RESET_SEND:
                break;
index 048381c..261131c 100644 (file)
@@ -288,8 +288,6 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
        struct typec_altmode *alt;
        struct ucsi_dp *dp;
 
-       mutex_lock(&con->lock);
-
        /* We can't rely on the firmware with the capabilities. */
        desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE;
 
@@ -298,15 +296,12 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
        desc->vdo |= all_assignments << 16;
 
        alt = typec_port_register_altmode(con->port, desc);
-       if (IS_ERR(alt)) {
-               mutex_unlock(&con->lock);
+       if (IS_ERR(alt))
                return alt;
-       }
 
        dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
        if (!dp) {
                typec_unregister_altmode(alt);
-               mutex_unlock(&con->lock);
                return ERR_PTR(-ENOMEM);
        }
 
@@ -319,7 +314,5 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
        alt->ops = &ucsi_displayport_ops;
        typec_altmode_set_drvdata(alt, dp);
 
-       mutex_unlock(&con->lock);
-
        return alt;
 }
index affd024..e680fcf 100644 (file)
@@ -146,40 +146,33 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
        return UCSI_CCI_LENGTH(cci);
 }
 
-static int ucsi_run_command(struct ucsi *ucsi, u64 command,
-                           void *data, size_t size)
+int ucsi_send_command(struct ucsi *ucsi, u64 command,
+                     void *data, size_t size)
 {
        u8 length;
        int ret;
 
+       mutex_lock(&ucsi->ppm_lock);
+
        ret = ucsi_exec_command(ucsi, command);
        if (ret < 0)
-               return ret;
+               goto out;
 
        length = ret;
 
        if (data) {
                ret = ucsi->ops->read(ucsi, UCSI_MESSAGE_IN, data, size);
                if (ret)
-                       return ret;
+                       goto out;
        }
 
        ret = ucsi_acknowledge_command(ucsi);
        if (ret)
-               return ret;
-
-       return length;
-}
-
-int ucsi_send_command(struct ucsi *ucsi, u64 command,
-                     void *retval, size_t size)
-{
-       int ret;
+               goto out;
 
-       mutex_lock(&ucsi->ppm_lock);
-       ret = ucsi_run_command(ucsi, command, retval, size);
+       ret = length;
+out:
        mutex_unlock(&ucsi->ppm_lock);
-
        return ret;
 }
 EXPORT_SYMBOL_GPL(ucsi_send_command);
@@ -205,7 +198,7 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
        int i;
 
        command = UCSI_GET_CURRENT_CAM | UCSI_CONNECTOR_NUMBER(con->num);
-       ret = ucsi_run_command(con->ucsi, command, &cur, sizeof(cur));
+       ret = ucsi_send_command(con->ucsi, command, &cur, sizeof(cur));
        if (ret < 0) {
                if (con->ucsi->version > 0x0100) {
                        dev_err(con->ucsi->dev,
@@ -354,7 +347,7 @@ ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient)
                command |= UCSI_GET_ALTMODE_RECIPIENT(recipient);
                command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num);
                command |= UCSI_GET_ALTMODE_OFFSET(i);
-               len = ucsi_run_command(con->ucsi, command, &alt, sizeof(alt));
+               len = ucsi_send_command(con->ucsi, command, &alt, sizeof(alt));
                /*
                 * We are collecting all altmodes first and then registering.
                 * Some type-C device will return zero length data beyond last
@@ -431,7 +424,7 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient)
                command |= UCSI_GET_ALTMODE_RECIPIENT(recipient);
                command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num);
                command |= UCSI_GET_ALTMODE_OFFSET(i);
-               len = ucsi_run_command(con->ucsi, command, alt, sizeof(alt));
+               len = ucsi_send_command(con->ucsi, command, alt, sizeof(alt));
                if (len <= 0)
                        return len;
 
@@ -502,7 +495,7 @@ static void ucsi_get_pdos(struct ucsi_connector *con, int is_partner)
        command |= UCSI_GET_PDOS_PARTNER_PDO(is_partner);
        command |= UCSI_GET_PDOS_NUM_PDOS(UCSI_MAX_PDOS - 1);
        command |= UCSI_GET_PDOS_SRC_PDOS;
-       ret = ucsi_run_command(ucsi, command, con->src_pdos,
+       ret = ucsi_send_command(ucsi, command, con->src_pdos,
                               sizeof(con->src_pdos));
        if (ret < 0) {
                dev_err(ucsi->dev, "UCSI_GET_PDOS failed (%d)\n", ret);
@@ -681,7 +674,7 @@ static void ucsi_handle_connector_change(struct work_struct *work)
                 */
                command = UCSI_GET_CAM_SUPPORTED;
                command |= UCSI_CONNECTOR_NUMBER(con->num);
-               ucsi_run_command(con->ucsi, command, NULL, 0);
+               ucsi_send_command(con->ucsi, command, NULL, 0);
        }
 
        if (con->status.change & UCSI_CONSTAT_PARTNER_CHANGE)
@@ -736,20 +729,24 @@ static int ucsi_reset_ppm(struct ucsi *ucsi)
        u32 cci;
        int ret;
 
+       mutex_lock(&ucsi->ppm_lock);
+
        ret = ucsi->ops->async_write(ucsi, UCSI_CONTROL, &command,
                                     sizeof(command));
        if (ret < 0)
-               return ret;
+               goto out;
 
        tmo = jiffies + msecs_to_jiffies(UCSI_TIMEOUT_MS);
 
        do {
-               if (time_is_before_jiffies(tmo))
-                       return -ETIMEDOUT;
+               if (time_is_before_jiffies(tmo)) {
+                       ret = -ETIMEDOUT;
+                       goto out;
+               }
 
                ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
                if (ret)
-                       return ret;
+                       goto out;
 
                /* If the PPM is still doing something else, reset it again. */
                if (cci & ~UCSI_CCI_RESET_COMPLETE) {
@@ -757,13 +754,15 @@ static int ucsi_reset_ppm(struct ucsi *ucsi)
                                                     &command,
                                                     sizeof(command));
                        if (ret < 0)
-                               return ret;
+                               goto out;
                }
 
                msleep(20);
        } while (!(cci & UCSI_CCI_RESET_COMPLETE));
 
-       return 0;
+out:
+       mutex_unlock(&ucsi->ppm_lock);
+       return ret;
 }
 
 static int ucsi_role_cmd(struct ucsi_connector *con, u64 command)
@@ -775,9 +774,7 @@ static int ucsi_role_cmd(struct ucsi_connector *con, u64 command)
                u64 c;
 
                /* PPM most likely stopped responding. Resetting everything. */
-               mutex_lock(&con->ucsi->ppm_lock);
                ucsi_reset_ppm(con->ucsi);
-               mutex_unlock(&con->ucsi->ppm_lock);
 
                c = UCSI_SET_NOTIFICATION_ENABLE | con->ucsi->ntfy;
                ucsi_send_command(con->ucsi, c, NULL, 0);
@@ -901,12 +898,15 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
        con->num = index + 1;
        con->ucsi = ucsi;
 
+       /* Delay other interactions with the con until registration is complete */
+       mutex_lock(&con->lock);
+
        /* Get connector capability */
        command = UCSI_GET_CONNECTOR_CAPABILITY;
        command |= UCSI_CONNECTOR_NUMBER(con->num);
-       ret = ucsi_run_command(ucsi, command, &con->cap, sizeof(con->cap));
+       ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap));
        if (ret < 0)
-               return ret;
+               goto out;
 
        if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP)
                cap->data = TYPEC_PORT_DRD;
@@ -938,27 +938,32 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
 
        ret = ucsi_register_port_psy(con);
        if (ret)
-               return ret;
+               goto out;
 
        /* Register the connector */
        con->port = typec_register_port(ucsi->dev, cap);
-       if (IS_ERR(con->port))
-               return PTR_ERR(con->port);
+       if (IS_ERR(con->port)) {
+               ret = PTR_ERR(con->port);
+               goto out;
+       }
 
        /* Alternate modes */
        ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_CON);
-       if (ret)
+       if (ret) {
                dev_err(ucsi->dev, "con%d: failed to register alt modes\n",
                        con->num);
+               goto out;
+       }
 
        /* Get the status */
        command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num);
-       ret = ucsi_run_command(ucsi, command, &con->status,
-                              sizeof(con->status));
+       ret = ucsi_send_command(ucsi, command, &con->status, sizeof(con->status));
        if (ret < 0) {
                dev_err(ucsi->dev, "con%d: failed to get status\n", con->num);
-               return 0;
+               ret = 0;
+               goto out;
        }
+       ret = 0; /* ucsi_send_command() returns length on success */
 
        switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
        case UCSI_CONSTAT_PARTNER_TYPE_UFP:
@@ -983,17 +988,21 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
 
        if (con->partner) {
                ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_SOP);
-               if (ret)
+               if (ret) {
                        dev_err(ucsi->dev,
                                "con%d: failed to register alternate modes\n",
                                con->num);
-               else
+                       ret = 0;
+               } else {
                        ucsi_altmode_update_active(con);
+               }
        }
 
        trace_ucsi_register_port(con->num, &con->status);
 
-       return 0;
+out:
+       mutex_unlock(&con->lock);
+       return ret;
 }
 
 /**
@@ -1009,8 +1018,6 @@ static int ucsi_init(struct ucsi *ucsi)
        int ret;
        int i;
 
-       mutex_lock(&ucsi->ppm_lock);
-
        /* Reset the PPM */
        ret = ucsi_reset_ppm(ucsi);
        if (ret) {
@@ -1021,13 +1028,13 @@ static int ucsi_init(struct ucsi *ucsi)
        /* Enable basic notifications */
        ucsi->ntfy = UCSI_ENABLE_NTFY_CMD_COMPLETE | UCSI_ENABLE_NTFY_ERROR;
        command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;
-       ret = ucsi_run_command(ucsi, command, NULL, 0);
+       ret = ucsi_send_command(ucsi, command, NULL, 0);
        if (ret < 0)
                goto err_reset;
 
        /* Get PPM capabilities */
        command = UCSI_GET_CAPABILITY;
-       ret = ucsi_run_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap));
+       ret = ucsi_send_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap));
        if (ret < 0)
                goto err_reset;
 
@@ -1054,12 +1061,10 @@ static int ucsi_init(struct ucsi *ucsi)
        /* Enable all notifications */
        ucsi->ntfy = UCSI_ENABLE_NTFY_ALL;
        command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;
-       ret = ucsi_run_command(ucsi, command, NULL, 0);
+       ret = ucsi_send_command(ucsi, command, NULL, 0);
        if (ret < 0)
                goto err_unregister;
 
-       mutex_unlock(&ucsi->ppm_lock);
-
        return 0;
 
 err_unregister:
@@ -1074,8 +1079,6 @@ err_unregister:
 err_reset:
        ucsi_reset_ppm(ucsi);
 err:
-       mutex_unlock(&ucsi->ppm_lock);
-
        return ret;
 }
 
index 2305d42..9d7d642 100644 (file)
@@ -461,6 +461,11 @@ static void stub_disconnect(struct usb_device *udev)
        return;
 }
 
+static bool usbip_match(struct usb_device *udev)
+{
+       return true;
+}
+
 #ifdef CONFIG_PM
 
 /* These functions need usb_port_suspend and usb_port_resume,
@@ -486,6 +491,7 @@ struct usb_device_driver stub_driver = {
        .name           = "usbip-host",
        .probe          = stub_probe,
        .disconnect     = stub_disconnect,
+       .match          = usbip_match,
 #ifdef CONFIG_PM
        .suspend        = stub_suspend,
        .resume         = stub_resume,
index 08f267a..64696d6 100644 (file)
@@ -84,7 +84,7 @@ struct ifcvf_hw {
        void __iomem * const *base;
        char config_msix_name[256];
        struct vdpa_callback config_cb;
-
+       unsigned int config_irq;
 };
 
 struct ifcvf_adapter {
index 076d7ac..8b40285 100644 (file)
@@ -55,6 +55,7 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues)
                vf->vring[i].irq = -EINVAL;
        }
 
+       devm_free_irq(&pdev->dev, vf->config_irq, vf);
        ifcvf_free_irq_vectors(pdev);
 }
 
@@ -74,10 +75,14 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
        snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
                 pci_name(pdev));
        vector = 0;
-       irq = pci_irq_vector(pdev, vector);
-       ret = devm_request_irq(&pdev->dev, irq,
+       vf->config_irq = pci_irq_vector(pdev, vector);
+       ret = devm_request_irq(&pdev->dev, vf->config_irq,
                               ifcvf_config_changed, 0,
                               vf->config_msix_name, vf);
+       if (ret) {
+               IFCVF_ERR(pdev, "Failed to request config irq\n");
+               return ret;
+       }
 
        for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
                snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",
index 9df69d5..70676a6 100644 (file)
 #define to_mvdev(__vdev) container_of((__vdev), struct mlx5_vdpa_dev, vdev)
 
 #define VALID_FEATURES_MASK                                                                        \
-       (BIT(VIRTIO_NET_F_CSUM) | BIT(VIRTIO_NET_F_GUEST_CSUM) |                                   \
-        BIT(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT(VIRTIO_NET_F_MTU) | BIT(VIRTIO_NET_F_MAC) |   \
-        BIT(VIRTIO_NET_F_GUEST_TSO4) | BIT(VIRTIO_NET_F_GUEST_TSO6) |                             \
-        BIT(VIRTIO_NET_F_GUEST_ECN) | BIT(VIRTIO_NET_F_GUEST_UFO) | BIT(VIRTIO_NET_F_HOST_TSO4) | \
-        BIT(VIRTIO_NET_F_HOST_TSO6) | BIT(VIRTIO_NET_F_HOST_ECN) | BIT(VIRTIO_NET_F_HOST_UFO) |   \
-        BIT(VIRTIO_NET_F_MRG_RXBUF) | BIT(VIRTIO_NET_F_STATUS) | BIT(VIRTIO_NET_F_CTRL_VQ) |      \
-        BIT(VIRTIO_NET_F_CTRL_RX) | BIT(VIRTIO_NET_F_CTRL_VLAN) |                                 \
-        BIT(VIRTIO_NET_F_CTRL_RX_EXTRA) | BIT(VIRTIO_NET_F_GUEST_ANNOUNCE) |                      \
-        BIT(VIRTIO_NET_F_MQ) | BIT(VIRTIO_NET_F_CTRL_MAC_ADDR) | BIT(VIRTIO_NET_F_HASH_REPORT) |  \
-        BIT(VIRTIO_NET_F_RSS) | BIT(VIRTIO_NET_F_RSC_EXT) | BIT(VIRTIO_NET_F_STANDBY) |           \
-        BIT(VIRTIO_NET_F_SPEED_DUPLEX) | BIT(VIRTIO_F_NOTIFY_ON_EMPTY) |                          \
-        BIT(VIRTIO_F_ANY_LAYOUT) | BIT(VIRTIO_F_VERSION_1) | BIT(VIRTIO_F_ACCESS_PLATFORM) |      \
-        BIT(VIRTIO_F_RING_PACKED) | BIT(VIRTIO_F_ORDER_PLATFORM) | BIT(VIRTIO_F_SR_IOV))
+       (BIT_ULL(VIRTIO_NET_F_CSUM) | BIT_ULL(VIRTIO_NET_F_GUEST_CSUM) |                                   \
+        BIT_ULL(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT_ULL(VIRTIO_NET_F_MTU) | BIT_ULL(VIRTIO_NET_F_MAC) |   \
+        BIT_ULL(VIRTIO_NET_F_GUEST_TSO4) | BIT_ULL(VIRTIO_NET_F_GUEST_TSO6) |                             \
+        BIT_ULL(VIRTIO_NET_F_GUEST_ECN) | BIT_ULL(VIRTIO_NET_F_GUEST_UFO) | BIT_ULL(VIRTIO_NET_F_HOST_TSO4) | \
+        BIT_ULL(VIRTIO_NET_F_HOST_TSO6) | BIT_ULL(VIRTIO_NET_F_HOST_ECN) | BIT_ULL(VIRTIO_NET_F_HOST_UFO) |   \
+        BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) | BIT_ULL(VIRTIO_NET_F_STATUS) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ) |      \
+        BIT_ULL(VIRTIO_NET_F_CTRL_RX) | BIT_ULL(VIRTIO_NET_F_CTRL_VLAN) |                                 \
+        BIT_ULL(VIRTIO_NET_F_CTRL_RX_EXTRA) | BIT_ULL(VIRTIO_NET_F_GUEST_ANNOUNCE) |                      \
+        BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | BIT_ULL(VIRTIO_NET_F_HASH_REPORT) |  \
+        BIT_ULL(VIRTIO_NET_F_RSS) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY) |           \
+        BIT_ULL(VIRTIO_NET_F_SPEED_DUPLEX) | BIT_ULL(VIRTIO_F_NOTIFY_ON_EMPTY) |                          \
+        BIT_ULL(VIRTIO_F_ANY_LAYOUT) | BIT_ULL(VIRTIO_F_VERSION_1) | BIT_ULL(VIRTIO_F_ACCESS_PLATFORM) |      \
+        BIT_ULL(VIRTIO_F_RING_PACKED) | BIT_ULL(VIRTIO_F_ORDER_PLATFORM) | BIT_ULL(VIRTIO_F_SR_IOV))
 
 #define VALID_STATUS_MASK                                                                          \
        (VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK |        \
@@ -149,7 +149,7 @@ static bool mlx5_vdpa_debug;
 
 #define MLX5_LOG_VIO_FLAG(_feature)                                                                \
        do {                                                                                       \
-               if (features & BIT(_feature))                                                      \
+               if (features & BIT_ULL(_feature))                                                  \
                        mlx5_vdpa_info(mvdev, "%s\n", #_feature);                                  \
        } while (0)
 
@@ -750,10 +750,10 @@ static bool vq_is_tx(u16 idx)
 
 static u16 get_features_12_3(u64 features)
 {
-       return (!!(features & BIT(VIRTIO_NET_F_HOST_TSO4)) << 9) |
-              (!!(features & BIT(VIRTIO_NET_F_HOST_TSO6)) << 8) |
-              (!!(features & BIT(VIRTIO_NET_F_CSUM)) << 7) |
-              (!!(features & BIT(VIRTIO_NET_F_GUEST_CSUM)) << 6);
+       return (!!(features & BIT_ULL(VIRTIO_NET_F_HOST_TSO4)) << 9) |
+              (!!(features & BIT_ULL(VIRTIO_NET_F_HOST_TSO6)) << 8) |
+              (!!(features & BIT_ULL(VIRTIO_NET_F_CSUM)) << 7) |
+              (!!(features & BIT_ULL(VIRTIO_NET_F_GUEST_CSUM)) << 6);
 }
 
 static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq)
@@ -1439,13 +1439,13 @@ static u64 mlx_to_vritio_features(u16 dev_features)
        u64 result = 0;
 
        if (dev_features & MLX5_VIRTIO_NET_F_GUEST_CSUM)
-               result |= BIT(VIRTIO_NET_F_GUEST_CSUM);
+               result |= BIT_ULL(VIRTIO_NET_F_GUEST_CSUM);
        if (dev_features & MLX5_VIRTIO_NET_F_CSUM)
-               result |= BIT(VIRTIO_NET_F_CSUM);
+               result |= BIT_ULL(VIRTIO_NET_F_CSUM);
        if (dev_features & MLX5_VIRTIO_NET_F_HOST_TSO6)
-               result |= BIT(VIRTIO_NET_F_HOST_TSO6);
+               result |= BIT_ULL(VIRTIO_NET_F_HOST_TSO6);
        if (dev_features & MLX5_VIRTIO_NET_F_HOST_TSO4)
-               result |= BIT(VIRTIO_NET_F_HOST_TSO4);
+               result |= BIT_ULL(VIRTIO_NET_F_HOST_TSO4);
 
        return result;
 }
@@ -1459,15 +1459,15 @@ static u64 mlx5_vdpa_get_features(struct vdpa_device *vdev)
        dev_features = MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, device_features_bits_mask);
        ndev->mvdev.mlx_features = mlx_to_vritio_features(dev_features);
        if (MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, virtio_version_1_0))
-               ndev->mvdev.mlx_features |= BIT(VIRTIO_F_VERSION_1);
-       ndev->mvdev.mlx_features |= BIT(VIRTIO_F_ACCESS_PLATFORM);
+               ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_VERSION_1);
+       ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM);
        print_features(mvdev, ndev->mvdev.mlx_features, false);
        return ndev->mvdev.mlx_features;
 }
 
 static int verify_min_features(struct mlx5_vdpa_dev *mvdev, u64 features)
 {
-       if (!(features & BIT(VIRTIO_F_ACCESS_PLATFORM)))
+       if (!(features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM)))
                return -EOPNOTSUPP;
 
        return 0;
index 620465c..1ab1f5c 100644 (file)
@@ -990,7 +990,7 @@ static long vfio_pci_ioctl(void *device_data,
                case VFIO_PCI_ERR_IRQ_INDEX:
                        if (pci_is_pcie(vdev->pdev))
                                break;
-               /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
                }
index 86a02af..61ca8ab 100644 (file)
 
 struct vfio_pci_ioeventfd {
        struct list_head        next;
+       struct vfio_pci_device  *vdev;
        struct virqfd           *virqfd;
        void __iomem            *addr;
        uint64_t                data;
        loff_t                  pos;
        int                     bar;
        int                     count;
+       bool                    test_mem;
 };
 
 struct vfio_pci_irq_ctx {
index 916b184..9e353c4 100644 (file)
 #define vfio_ioread8   ioread8
 #define vfio_iowrite8  iowrite8
 
+#define VFIO_IOWRITE(size) \
+static int vfio_pci_iowrite##size(struct vfio_pci_device *vdev,                \
+                       bool test_mem, u##size val, void __iomem *io)   \
+{                                                                      \
+       if (test_mem) {                                                 \
+               down_read(&vdev->memory_lock);                          \
+               if (!__vfio_pci_memory_enabled(vdev)) {                 \
+                       up_read(&vdev->memory_lock);                    \
+                       return -EIO;                                    \
+               }                                                       \
+       }                                                               \
+                                                                       \
+       vfio_iowrite##size(val, io);                                    \
+                                                                       \
+       if (test_mem)                                                   \
+               up_read(&vdev->memory_lock);                            \
+                                                                       \
+       return 0;                                                       \
+}
+
+VFIO_IOWRITE(8)
+VFIO_IOWRITE(16)
+VFIO_IOWRITE(32)
+#ifdef iowrite64
+VFIO_IOWRITE(64)
+#endif
+
+#define VFIO_IOREAD(size) \
+static int vfio_pci_ioread##size(struct vfio_pci_device *vdev,         \
+                       bool test_mem, u##size *val, void __iomem *io)  \
+{                                                                      \
+       if (test_mem) {                                                 \
+               down_read(&vdev->memory_lock);                          \
+               if (!__vfio_pci_memory_enabled(vdev)) {                 \
+                       up_read(&vdev->memory_lock);                    \
+                       return -EIO;                                    \
+               }                                                       \
+       }                                                               \
+                                                                       \
+       *val = vfio_ioread##size(io);                                   \
+                                                                       \
+       if (test_mem)                                                   \
+               up_read(&vdev->memory_lock);                            \
+                                                                       \
+       return 0;                                                       \
+}
+
+VFIO_IOREAD(8)
+VFIO_IOREAD(16)
+VFIO_IOREAD(32)
+
 /*
  * Read or write from an __iomem region (MMIO or I/O port) with an excluded
  * range which is inaccessible.  The excluded range drops writes and fills
  * reads with -1.  This is intended for handling MSI-X vector tables and
  * leftover space for ROM BARs.
  */
-static ssize_t do_io_rw(void __iomem *io, char __user *buf,
+static ssize_t do_io_rw(struct vfio_pci_device *vdev, bool test_mem,
+                       void __iomem *io, char __user *buf,
                        loff_t off, size_t count, size_t x_start,
                        size_t x_end, bool iswrite)
 {
        ssize_t done = 0;
+       int ret;
 
        while (count) {
                size_t fillable, filled;
@@ -66,9 +119,15 @@ static ssize_t do_io_rw(void __iomem *io, char __user *buf,
                                if (copy_from_user(&val, buf, 4))
                                        return -EFAULT;
 
-                               vfio_iowrite32(val, io + off);
+                               ret = vfio_pci_iowrite32(vdev, test_mem,
+                                                        val, io + off);
+                               if (ret)
+                                       return ret;
                        } else {
-                               val = vfio_ioread32(io + off);
+                               ret = vfio_pci_ioread32(vdev, test_mem,
+                                                       &val, io + off);
+                               if (ret)
+                                       return ret;
 
                                if (copy_to_user(buf, &val, 4))
                                        return -EFAULT;
@@ -82,9 +141,15 @@ static ssize_t do_io_rw(void __iomem *io, char __user *buf,
                                if (copy_from_user(&val, buf, 2))
                                        return -EFAULT;
 
-                               vfio_iowrite16(val, io + off);
+                               ret = vfio_pci_iowrite16(vdev, test_mem,
+                                                        val, io + off);
+                               if (ret)
+                                       return ret;
                        } else {
-                               val = vfio_ioread16(io + off);
+                               ret = vfio_pci_ioread16(vdev, test_mem,
+                                                       &val, io + off);
+                               if (ret)
+                                       return ret;
 
                                if (copy_to_user(buf, &val, 2))
                                        return -EFAULT;
@@ -98,9 +163,15 @@ static ssize_t do_io_rw(void __iomem *io, char __user *buf,
                                if (copy_from_user(&val, buf, 1))
                                        return -EFAULT;
 
-                               vfio_iowrite8(val, io + off);
+                               ret = vfio_pci_iowrite8(vdev, test_mem,
+                                                       val, io + off);
+                               if (ret)
+                                       return ret;
                        } else {
-                               val = vfio_ioread8(io + off);
+                               ret = vfio_pci_ioread8(vdev, test_mem,
+                                                      &val, io + off);
+                               if (ret)
+                                       return ret;
 
                                if (copy_to_user(buf, &val, 1))
                                        return -EFAULT;
@@ -178,14 +249,6 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_device *vdev, char __user *buf,
 
        count = min(count, (size_t)(end - pos));
 
-       if (res->flags & IORESOURCE_MEM) {
-               down_read(&vdev->memory_lock);
-               if (!__vfio_pci_memory_enabled(vdev)) {
-                       up_read(&vdev->memory_lock);
-                       return -EIO;
-               }
-       }
-
        if (bar == PCI_ROM_RESOURCE) {
                /*
                 * The ROM can fill less space than the BAR, so we start the
@@ -213,7 +276,8 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_device *vdev, char __user *buf,
                x_end = vdev->msix_offset + vdev->msix_size;
        }
 
-       done = do_io_rw(io, buf, pos, count, x_start, x_end, iswrite);
+       done = do_io_rw(vdev, res->flags & IORESOURCE_MEM, io, buf, pos,
+                       count, x_start, x_end, iswrite);
 
        if (done >= 0)
                *ppos += done;
@@ -221,9 +285,6 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_device *vdev, char __user *buf,
        if (bar == PCI_ROM_RESOURCE)
                pci_unmap_rom(pdev, io);
 out:
-       if (res->flags & IORESOURCE_MEM)
-               up_read(&vdev->memory_lock);
-
        return done;
 }
 
@@ -278,7 +339,12 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
                return ret;
        }
 
-       done = do_io_rw(iomem, buf, off, count, 0, 0, iswrite);
+       /*
+        * VGA MMIO is a legacy, non-BAR resource that hopefully allows
+        * probing, so we don't currently worry about access in relation
+        * to the memory enable bit in the command register.
+        */
+       done = do_io_rw(vdev, false, iomem, buf, off, count, 0, 0, iswrite);
 
        vga_put(vdev->pdev, rsrc);
 
@@ -296,17 +362,21 @@ static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
 
        switch (ioeventfd->count) {
        case 1:
-               vfio_iowrite8(ioeventfd->data, ioeventfd->addr);
+               vfio_pci_iowrite8(ioeventfd->vdev, ioeventfd->test_mem,
+                                 ioeventfd->data, ioeventfd->addr);
                break;
        case 2:
-               vfio_iowrite16(ioeventfd->data, ioeventfd->addr);
+               vfio_pci_iowrite16(ioeventfd->vdev, ioeventfd->test_mem,
+                                  ioeventfd->data, ioeventfd->addr);
                break;
        case 4:
-               vfio_iowrite32(ioeventfd->data, ioeventfd->addr);
+               vfio_pci_iowrite32(ioeventfd->vdev, ioeventfd->test_mem,
+                                  ioeventfd->data, ioeventfd->addr);
                break;
 #ifdef iowrite64
        case 8:
-               vfio_iowrite64(ioeventfd->data, ioeventfd->addr);
+               vfio_pci_iowrite64(ioeventfd->vdev, ioeventfd->test_mem,
+                                  ioeventfd->data, ioeventfd->addr);
                break;
 #endif
        }
@@ -378,11 +448,13 @@ long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset,
                goto out_unlock;
        }
 
+       ioeventfd->vdev = vdev;
        ioeventfd->addr = vdev->barmap[bar] + pos;
        ioeventfd->data = data;
        ioeventfd->pos = pos;
        ioeventfd->bar = bar;
        ioeventfd->count = count;
+       ioeventfd->test_mem = vdev->pdev->resource[bar].flags & IORESOURCE_MEM;
 
        ret = vfio_virqfd_enable(ioeventfd, vfio_pci_ioeventfd_handler,
                                 NULL, NULL, &ioeventfd->virqfd, fd);
index 6990fc7..5fbf0c1 100644 (file)
@@ -1424,13 +1424,16 @@ static int vfio_bus_type(struct device *dev, void *data)
 static int vfio_iommu_replay(struct vfio_iommu *iommu,
                             struct vfio_domain *domain)
 {
-       struct vfio_domain *d;
+       struct vfio_domain *d = NULL;
        struct rb_node *n;
        unsigned long limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
        int ret;
 
        /* Arbitrarily pick the first domain in the list for lookups */
-       d = list_first_entry(&iommu->domain_list, struct vfio_domain, next);
+       if (!list_empty(&iommu->domain_list))
+               d = list_first_entry(&iommu->domain_list,
+                                    struct vfio_domain, next);
+
        n = rb_first(&iommu->dma_list);
 
        for (; n; n = rb_next(n)) {
@@ -1448,6 +1451,11 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
                                phys_addr_t p;
                                dma_addr_t i;
 
+                               if (WARN_ON(!d)) { /* mapped w/o a domain?! */
+                                       ret = -EINVAL;
+                                       goto unwind;
+                               }
+
                                phys = iommu_iova_to_phys(d->domain, iova);
 
                                if (WARN_ON(!phys)) {
@@ -1477,7 +1485,7 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
                                if (npage <= 0) {
                                        WARN_ON(!npage);
                                        ret = (int)npage;
-                                       return ret;
+                                       goto unwind;
                                }
 
                                phys = pfn << PAGE_SHIFT;
@@ -1486,14 +1494,67 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
 
                        ret = iommu_map(domain->domain, iova, phys,
                                        size, dma->prot | domain->prot);
-                       if (ret)
-                               return ret;
+                       if (ret) {
+                               if (!dma->iommu_mapped)
+                                       vfio_unpin_pages_remote(dma, iova,
+                                                       phys >> PAGE_SHIFT,
+                                                       size >> PAGE_SHIFT,
+                                                       true);
+                               goto unwind;
+                       }
 
                        iova += size;
                }
+       }
+
+       /* All dmas are now mapped, defer to second tree walk for unwind */
+       for (n = rb_first(&iommu->dma_list); n; n = rb_next(n)) {
+               struct vfio_dma *dma = rb_entry(n, struct vfio_dma, node);
+
                dma->iommu_mapped = true;
        }
+
        return 0;
+
+unwind:
+       for (; n; n = rb_prev(n)) {
+               struct vfio_dma *dma = rb_entry(n, struct vfio_dma, node);
+               dma_addr_t iova;
+
+               if (dma->iommu_mapped) {
+                       iommu_unmap(domain->domain, dma->iova, dma->size);
+                       continue;
+               }
+
+               iova = dma->iova;
+               while (iova < dma->iova + dma->size) {
+                       phys_addr_t phys, p;
+                       size_t size;
+                       dma_addr_t i;
+
+                       phys = iommu_iova_to_phys(domain->domain, iova);
+                       if (!phys) {
+                               iova += PAGE_SIZE;
+                               continue;
+                       }
+
+                       size = PAGE_SIZE;
+                       p = phys + size;
+                       i = iova + size;
+                       while (i < dma->iova + dma->size &&
+                              p == iommu_iova_to_phys(domain->domain, i)) {
+                               size += PAGE_SIZE;
+                               p += PAGE_SIZE;
+                               i += PAGE_SIZE;
+                       }
+
+                       iommu_unmap(domain->domain, iova, size);
+                       vfio_unpin_pages_remote(dma, iova, phys >> PAGE_SHIFT,
+                                               size >> PAGE_SHIFT, true);
+               }
+       }
+
+       return ret;
 }
 
 /*
@@ -2378,7 +2439,7 @@ static void *vfio_iommu_type1_open(unsigned long arg)
                break;
        case VFIO_TYPE1_NESTING_IOMMU:
                iommu->nesting = true;
-               /* fall through */
+               fallthrough;
        case VFIO_TYPE1v2_IOMMU:
                iommu->v2 = true;
                break;
index 1f0ca6e..34aec4b 100644 (file)
@@ -159,8 +159,8 @@ vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
 EXPORT_SYMBOL_GPL(vhost_iotlb_itree_first);
 
 /**
- * vhost_iotlb_itree_first - return the next overlapped range
- * @iotlb: the IOTLB
+ * vhost_iotlb_itree_next - return the next overlapped range
+ * @map: the starting map node
  * @start: start of IOVA range
  * @end: end of IOVA range
  */
index ddc7f5f..8ec1942 100644 (file)
@@ -681,7 +681,7 @@ static int adp8860_probe(struct i2c_client *client,
        switch (ADP8860_MANID(reg_val)) {
        case ADP8863_MANUFID:
                data->gdwn_dis = !!pdata->gdwn_dis;
-               /* fall through */
+               fallthrough;
        case ADP8860_MANUFID:
                data->en_ambl_sens = !!pdata->en_ambl_sens;
                break;
index 09a9ad9..bcc92ae 100644 (file)
@@ -857,7 +857,7 @@ static void acornfb_parse_dram(char *opt)
                case 'M':
                case 'm':
                        size *= 1024;
-                       /* Fall through */
+                       fallthrough;
                case 'K':
                case 'k':
                        size *= 1024;
index 6f78389..ae3d8e8 100644 (file)
@@ -419,7 +419,7 @@ static int arcfb_ioctl(struct fb_info *info,
                        schedule();
                        finish_wait(&arcfb_waitq, &wait);
                }
-               /* fall through */
+                       fallthrough;
 
                case FBIO_GETCONTROL2:
                {
index 1e25219..bfd2f00 100644 (file)
@@ -508,7 +508,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
        case 32:
                var->transp.offset = 24;
                var->transp.length = 8;
-               /* fall through */
+               fallthrough;
        case 24:
                if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
                        /* RGB:888 mode */
@@ -633,7 +633,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
                case 2: value |= ATMEL_LCDC_PIXELSIZE_2; break;
                case 4: value |= ATMEL_LCDC_PIXELSIZE_4; break;
                case 8: value |= ATMEL_LCDC_PIXELSIZE_8; break;
-               case 15: /* fall through */
+               case 15:
                case 16: value |= ATMEL_LCDC_PIXELSIZE_16; break;
                case 24: value |= ATMEL_LCDC_PIXELSIZE_24; break;
                case 32: value |= ATMEL_LCDC_PIXELSIZE_32; break;
index 7c4483c..f3d8123 100644 (file)
@@ -1208,11 +1208,11 @@ static void radeon_pm_enable_dll_m10(struct radeonfb_info *rinfo)
        case 1:
                if (mc & 0x4)
                        break;
-               /* fall through */
+               fallthrough;
        case 2:
                dll_sleep_mask |= MDLL_R300_RDCK__MRDCKB_SLEEP;
                dll_reset_mask |= MDLL_R300_RDCK__MRDCKB_RESET;
-               /* fall through */
+               fallthrough;
        case 0:
                dll_sleep_mask |= MDLL_R300_RDCK__MRDCKA_SLEEP;
                dll_reset_mask |= MDLL_R300_RDCK__MRDCKA_RESET;
@@ -1221,7 +1221,7 @@ static void radeon_pm_enable_dll_m10(struct radeonfb_info *rinfo)
        case 1:
                if (!(mc & 0x4))
                        break;
-               /* fall through */
+               fallthrough;
        case 2:
                dll_sleep_mask |= MDLL_R300_RDCK__MRDCKD_SLEEP;
                dll_reset_mask |= MDLL_R300_RDCK__MRDCKD_RESET;
index 3df64a9..15a9ee7 100644 (file)
@@ -1476,11 +1476,11 @@ static void init_vgachip(struct fb_info *info)
                mdelay(100);
                /* mode */
                vga_wgfx(cinfo->regbase, CL_GR31, 0x00);
-               /* fall through */
+               fallthrough;
        case BT_GD5480:
                /* from Klaus' NetBSD driver: */
                vga_wgfx(cinfo->regbase, CL_GR2F, 0x00);
-               /* fall through */
+               fallthrough;
        case BT_ALPINE:
                /* put blitter into 542x compat */
                vga_wgfx(cinfo->regbase, CL_GR33, 0x00);
index 9c4f1be..2df56bd 100644 (file)
@@ -49,6 +49,8 @@
 #include <linux/cuda.h>
 #ifdef CONFIG_PPC_PMAC
 #include <asm/prom.h>
+#endif
+#ifdef CONFIG_BOOTX_TEXT
 #include <asm/btext.h>
 #endif
 
@@ -713,7 +715,7 @@ static int controlfb_blank(int blank_mode, struct fb_info *info)
                        break;
                case FB_BLANK_POWERDOWN:
                        ctrl &= ~0x33;
-                       /* fall through */
+                       fallthrough;
                case FB_BLANK_NORMAL:
                        ctrl |= 0x400;
                        break;
index 8a31fc2..6616783 100644 (file)
@@ -2191,6 +2191,9 @@ static void updatescrollmode(struct fbcon_display *p,
        }
 }
 
+#define PITCH(w) (((w) + 7) >> 3)
+#define CALC_FONTSZ(h, p, c) ((h) * (p) * (c)) /* size = height * pitch * charcount */
+
 static int fbcon_resize(struct vc_data *vc, unsigned int width, 
                        unsigned int height, unsigned int user)
 {
@@ -2200,6 +2203,24 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
        struct fb_var_screeninfo var = info->var;
        int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
 
+       if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) {
+               int size;
+               int pitch = PITCH(vc->vc_font.width);
+
+               /*
+                * If user font, ensure that a possible change to user font
+                * height or width will not allow a font data out-of-bounds access.
+                * NOTE: must use original charcount in calculation as font
+                * charcount can change and cannot be used to determine the
+                * font data allocated size.
+                */
+               if (pitch <= 0)
+                       return -EINVAL;
+               size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data));
+               if (size > FNTSIZE(vc->vc_font.data))
+                       return -EINVAL;
+       }
+
        virt_w = FBCON_SWAP(ops->rotate, width, height);
        virt_h = FBCON_SWAP(ops->rotate, height, width);
        virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width,
@@ -2652,7 +2673,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
        int size;
        int i, csum;
        u8 *new_data, *data = font->data;
-       int pitch = (font->width+7) >> 3;
+       int pitch = PITCH(font->width);
 
        /* Is there a reason why fbconsole couldn't handle any charcount >256?
         * If not this check should be changed to charcount < 256 */
@@ -2668,7 +2689,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
        if (fbcon_invalid_charcount(info, charcount))
                return -EINVAL;
 
-       size = h * pitch * charcount;
+       size = CALC_FONTSZ(h, pitch, charcount);
 
        new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);
 
index da7c88f..6815bfb 100644 (file)
@@ -1306,7 +1306,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
        case FBIOGET_CON2FBMAP:
        case FBIOPUT_CON2FBMAP:
                arg = (unsigned long) compat_ptr(arg);
-               /* fall through */
+               fallthrough;
        case FBIOBLANK:
                ret = do_fb_ioctl(info, cmd, arg);
                break;
index 65491ae..e57c008 100644 (file)
@@ -453,7 +453,7 @@ static int efifb_probe(struct platform_device *dev)
        info->apertures->ranges[0].base = efifb_fix.smem_start;
        info->apertures->ranges[0].size = size_remap;
 
-       if (efi_enabled(EFI_BOOT) &&
+       if (efi_enabled(EFI_MEMMAP) &&
            !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
                if ((efifb_fix.smem_start + efifb_fix.smem_len) >
                    (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
index 67ebfe5..a547c21 100644 (file)
@@ -1287,7 +1287,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
                dev_warn(info->dev,
                         "MFB_SET_PIXFMT value of 0x%08x is deprecated.\n",
                         MFB_SET_PIXFMT_OLD);
-               /* fall through */
+               fallthrough;
        case MFB_SET_PIXFMT:
                if (copy_from_user(&pix_fmt, buf, sizeof(pix_fmt)))
                        return -EFAULT;
@@ -1297,7 +1297,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
                dev_warn(info->dev,
                         "MFB_GET_PIXFMT value of 0x%08x is deprecated.\n",
                         MFB_GET_PIXFMT_OLD);
-               /* fall through */
+               fallthrough;
        case MFB_GET_PIXFMT:
                pix_fmt = ad->pix_fmt;
                if (copy_to_user(buf, &pix_fmt, sizeof(pix_fmt)))
index 13ded3a..e5475ae 100644 (file)
@@ -534,7 +534,7 @@ static int gxt4500_setcolreg(unsigned int reg, unsigned int red,
                        break;
                case DFA_PIX_32BIT:
                        val |= (reg << 24);
-                       /* fall through */
+                       fallthrough;
                case DFA_PIX_24BIT:
                        val |= (reg << 16) | (reg << 8);
                        break;
index e4c3c8b..02411d8 100644 (file)
@@ -648,13 +648,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev)
                ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN10);
                if (!ret)
                        break;
-               /* Fallthrough */
+               fallthrough;
        case VERSION_WIN8:
        case VERSION_WIN8_1:
                ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN8);
                if (!ret)
                        break;
-               /* Fallthrough */
+               fallthrough;
        case VERSION_WS2008:
        case VERSION_WIN7:
                ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN7);
index c65ec73..e6f35f8 100644 (file)
@@ -430,7 +430,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,
                break;
        case 9 ... 15:
                bpp = 15;
-               /* fall through */
+               fallthrough;
        case 16:
                if ((1000000 / var->pixclock) > DACSPEED16) {
                        dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 15/16bpp)\n",
index 01c75c0..39ebbe0 100644 (file)
@@ -90,8 +90,6 @@ static int var_to_pixfmt(struct fb_var_screeninfo *var)
                        else
                                return PIXFMT_BGR888UNPACK;
                }
-
-               /* fall through */
        }
 
        return -EINVAL;
index 8335da4..9b0a324 100644 (file)
@@ -896,7 +896,7 @@ void NVCalcStateExt(struct nvidia_par *par,
                if (!par->FlatPanel)
                        state->control = NV_RD32(par->PRAMDAC0, 0x0580) &
                                0xeffffeff;
-               /* fallthrough */
+               fallthrough;
        case NV_ARCH_10:
        case NV_ARCH_20:
        case NV_ARCH_30:
index 5cd0f5f..4501e84 100644 (file)
@@ -141,7 +141,7 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */
                out_le32(par->cmap_adr + 0x58,
                         in_le32(par->cmap_adr + 0x58) & ~0x20);
-               /* fall through */
+               fallthrough;
        case cmap_r128:
                /* Set palette index & data */
                out_8(par->cmap_adr + 0xb0, regno);
@@ -211,7 +211,7 @@ static int offb_blank(int blank, struct fb_info *info)
                                /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */
                                out_le32(par->cmap_adr + 0x58,
                                         in_le32(par->cmap_adr + 0x58) & ~0x20);
-                               /* fall through */
+                               fallthrough;
                        case cmap_r128:
                                /* Set palette index & data */
                                out_8(par->cmap_adr + 0xb0, i);
index fa73acf..7317c9a 100644 (file)
@@ -328,13 +328,13 @@ static int omap_lcdc_setup_plane(int plane, int channel_out,
                        lcdc.bpp = 12;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case OMAPFB_COLOR_YUV422:
                if (lcdc.ext_mode) {
                        lcdc.bpp = 16;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        default:
                /* FIXME: other BPPs.
                 * bpp1: code  0,     size 256
index 0cbcc74..3d090d2 100644 (file)
@@ -253,7 +253,7 @@ static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green,
                if (fbdev->ctrl->setcolreg)
                        r = fbdev->ctrl->setcolreg(regno, red, green, blue,
                                                        transp, update_hw_pal);
-               /* Fallthrough */
+               fallthrough;
        case OMAPFB_COLOR_RGB565:
        case OMAPFB_COLOR_RGB444:
                if (r != 0)
@@ -443,7 +443,7 @@ static int set_color_mode(struct omapfb_plane_struct *plane,
                return 0;
        case 12:
                var->bits_per_pixel = 16;
-               /* fall through */
+               fallthrough;
        case 16:
                if (plane->fbdev->panel->bpp == 12)
                        plane->color_mode = OMAPFB_COLOR_RGB444;
@@ -1531,27 +1531,27 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
        case OMAPFB_ACTIVE:
                for (i = 0; i < fbdev->mem_desc.region_cnt; i++)
                        unregister_framebuffer(fbdev->fb_info[i]);
-               /* fall through */
+               fallthrough;
        case 7:
                omapfb_unregister_sysfs(fbdev);
-               /* fall through */
+               fallthrough;
        case 6:
                if (fbdev->panel->disable)
                        fbdev->panel->disable(fbdev->panel);
-               /* fall through */
+               fallthrough;
        case 5:
                omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED);
-               /* fall through */
+               fallthrough;
        case 4:
                planes_cleanup(fbdev);
-               /* fall through */
+               fallthrough;
        case 3:
                ctrl_cleanup(fbdev);
-               /* fall through */
+               fallthrough;
        case 2:
                if (fbdev->panel->cleanup)
                        fbdev->panel->cleanup(fbdev->panel);
-               /* fall through */
+               fallthrough;
        case 1:
                dev_set_drvdata(fbdev->dev, NULL);
                kfree(fbdev);
@@ -1854,7 +1854,7 @@ static int __init omapfb_setup(char *options)
                        case 'm':
                        case 'M':
                                vram *= 1024;
-                               /* Fall through */
+                               fallthrough;
                        case 'k':
                        case 'K':
                                vram *= 1024;
index 3920a0d..b2d6e6d 100644 (file)
@@ -1861,7 +1861,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
                if (color_mode == OMAP_DSS_COLOR_YUV2 ||
                        color_mode == OMAP_DSS_COLOR_UYVY)
                        width = width >> 1;
-               /* fall through */
+               fallthrough;
        case OMAP_DSS_ROT_90:
        case OMAP_DSS_ROT_270:
                *offset1 = 0;
@@ -1884,7 +1884,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
                if (color_mode == OMAP_DSS_COLOR_YUV2 ||
                        color_mode == OMAP_DSS_COLOR_UYVY)
                        width = width >> 1;
-               /* fall through */
+               fallthrough;
        case OMAP_DSS_ROT_90 + 4:
        case OMAP_DSS_ROT_270 + 4:
                *offset1 = 0;
index f40be68..ea8c88a 100644 (file)
@@ -760,7 +760,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                        r = -ENODEV;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
 
        case OMAPFB_WAITFORVSYNC:
                DBG("ioctl WAITFORVSYNC\n");
index 836e7b1..a3decc7 100644 (file)
@@ -882,7 +882,7 @@ int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
                                / (var->bits_per_pixel >> 2);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                screen_width = fix->line_length / (var->bits_per_pixel >> 3);
                break;
index c7c98d8..0642555 100644 (file)
@@ -233,10 +233,10 @@ static u32 to3264(u32 timing, int bpp, int is64)
        switch (bpp) {
        case 24:
                timing *= 3;
-               /* fall through */
+               fallthrough;
        case 8:
                timing >>= 1;
-               /* fall through */
+               fallthrough;
        case 16:
                timing >>= 1;
        case 32:
index eedfbd3..47e6a1d 100644 (file)
@@ -60,8 +60,6 @@ static int determine_best_pix_fmt(struct fb_var_screeninfo *var)
                        else
                                return PIX_FMT_BGR1555;
                }
-
-               /* fall through */
        }
 
        /*
@@ -87,8 +85,6 @@ static int determine_best_pix_fmt(struct fb_var_screeninfo *var)
                        else
                                return PIX_FMT_BGR888UNPACK;
                }
-
-               /* fall through */
        }
 
        return -EINVAL;
index a53d24f..f1551e0 100644 (file)
@@ -1614,7 +1614,7 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
                 */
                if (old_state != C_DISABLE_PM)
                        break;
-               /* fall through */
+               fallthrough;
 
        case C_ENABLE:
                /*
index 9b34938..ce55b9d 100644 (file)
@@ -1093,7 +1093,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                break;
        case 9 ... 15:
                var->green.length = 5;
-               /* fall through */
+               fallthrough;
        case 16:
                var->bits_per_pixel = 16;
                /* The Riva128 supports RGB555 only */
index 9dc9250..ba316bd 100644 (file)
@@ -284,7 +284,7 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var,
                /* 666 with one bit alpha/transparency */
                var->transp.offset      = 18;
                var->transp.length      = 1;
-               /* fall through */
+               fallthrough;
        case 18:
                var->bits_per_pixel     = 32;
 
@@ -312,7 +312,7 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var,
        case 25:
                var->transp.length      = var->bits_per_pixel - 24;
                var->transp.offset      = 24;
-               /* fall through */
+               fallthrough;
        case 24:
                /* our 24bpp is unpacked, so 32bpp */
                var->bits_per_pixel     = 32;
@@ -809,7 +809,7 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
        case FB_BLANK_POWERDOWN:
                wincon &= ~WINCONx_ENWIN;
                sfb->enabled &= ~(1 << index);
-               /* fall through - to FB_BLANK_NORMAL */
+               fallthrough;    /* to FB_BLANK_NORMAL */
 
        case FB_BLANK_NORMAL:
                /* disable the DMA and display 0x0 (black) */
diff --git a/drivers/video/fbdev/s3c2410fb-regs-lcd.h b/drivers/video/fbdev/s3c2410fb-regs-lcd.h
new file mode 100644 (file)
index 0000000..1e46f7a
--- /dev/null
@@ -0,0 +1,143 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
+ *                   http://www.simtec.co.uk/products/SWLINUX/
+ */
+
+#ifndef ___ASM_ARCH_REGS_LCD_H
+#define ___ASM_ARCH_REGS_LCD_H
+
+/*
+ * a couple of values are used as platform data in
+ * include/linux/platform_data/fb-s3c2410.h and not
+ * duplicated here.
+ */
+#include <linux/platform_data/fb-s3c2410.h>
+
+#define S3C2410_LCDREG(x)      (x)
+
+/* LCD control registers */
+#define S3C2410_LCDCON1            S3C2410_LCDREG(0x00)
+#define S3C2410_LCDCON2            S3C2410_LCDREG(0x04)
+#define S3C2410_LCDCON3            S3C2410_LCDREG(0x08)
+#define S3C2410_LCDCON4            S3C2410_LCDREG(0x0C)
+#define S3C2410_LCDCON5            S3C2410_LCDREG(0x10)
+
+#define S3C2410_LCDCON1_CLKVAL(x)  ((x) << 8)
+#define S3C2410_LCDCON1_MMODE     (1<<7)
+#define S3C2410_LCDCON1_DSCAN4    (0<<5)
+#define S3C2410_LCDCON1_STN4      (1<<5)
+#define S3C2410_LCDCON1_STN8      (2<<5)
+#define S3C2410_LCDCON1_TFT       (3<<5)
+
+#define S3C2410_LCDCON1_STN1BPP           (0<<1)
+#define S3C2410_LCDCON1_STN2GREY   (1<<1)
+#define S3C2410_LCDCON1_STN4GREY   (2<<1)
+#define S3C2410_LCDCON1_STN8BPP           (3<<1)
+#define S3C2410_LCDCON1_STN12BPP   (4<<1)
+
+#define S3C2410_LCDCON1_ENVID     (1)
+
+#define S3C2410_LCDCON1_MODEMASK    0x1E
+
+#define S3C2410_LCDCON2_VBPD(x)            ((x) << 24)
+#define S3C2410_LCDCON2_LINEVAL(x)  ((x) << 14)
+#define S3C2410_LCDCON2_VFPD(x)            ((x) << 6)
+#define S3C2410_LCDCON2_VSPW(x)            ((x) << 0)
+
+#define S3C2410_LCDCON2_GET_VBPD(x) ( ((x) >> 24) & 0xFF)
+#define S3C2410_LCDCON2_GET_VFPD(x) ( ((x) >>  6) & 0xFF)
+#define S3C2410_LCDCON2_GET_VSPW(x) ( ((x) >>  0) & 0x3F)
+
+#define S3C2410_LCDCON3_HBPD(x)            ((x) << 19)
+#define S3C2410_LCDCON3_WDLY(x)            ((x) << 19)
+#define S3C2410_LCDCON3_HOZVAL(x)   ((x) << 8)
+#define S3C2410_LCDCON3_HFPD(x)            ((x) << 0)
+#define S3C2410_LCDCON3_LINEBLANK(x)((x) << 0)
+
+#define S3C2410_LCDCON3_GET_HBPD(x) ( ((x) >> 19) & 0x7F)
+#define S3C2410_LCDCON3_GET_HFPD(x) ( ((x) >>  0) & 0xFF)
+
+/* LDCCON4 changes for STN mode on the S3C2412 */
+
+#define S3C2410_LCDCON4_MVAL(x)            ((x) << 8)
+#define S3C2410_LCDCON4_HSPW(x)            ((x) << 0)
+#define S3C2410_LCDCON4_WLH(x)     ((x) << 0)
+
+#define S3C2410_LCDCON4_GET_HSPW(x) ( ((x) >>  0) & 0xFF)
+
+/* framebuffer start addressed */
+#define S3C2410_LCDSADDR1   S3C2410_LCDREG(0x14)
+#define S3C2410_LCDSADDR2   S3C2410_LCDREG(0x18)
+#define S3C2410_LCDSADDR3   S3C2410_LCDREG(0x1C)
+
+#define S3C2410_LCDBANK(x)     ((x) << 21)
+#define S3C2410_LCDBASEU(x)    (x)
+
+#define S3C2410_OFFSIZE(x)     ((x) << 11)
+#define S3C2410_PAGEWIDTH(x)   (x)
+
+/* colour lookup and miscellaneous controls */
+
+#define S3C2410_REDLUT    S3C2410_LCDREG(0x20)
+#define S3C2410_GREENLUT   S3C2410_LCDREG(0x24)
+#define S3C2410_BLUELUT           S3C2410_LCDREG(0x28)
+
+#define S3C2410_DITHMODE   S3C2410_LCDREG(0x4C)
+#define S3C2410_TPAL      S3C2410_LCDREG(0x50)
+
+#define S3C2410_TPAL_EN                (1<<24)
+
+/* interrupt info */
+#define S3C2410_LCDINTPND  S3C2410_LCDREG(0x54)
+#define S3C2410_LCDSRCPND  S3C2410_LCDREG(0x58)
+#define S3C2410_LCDINTMSK  S3C2410_LCDREG(0x5C)
+#define S3C2410_LCDINT_FIWSEL  (1<<2)
+#define        S3C2410_LCDINT_FRSYNC   (1<<1)
+#define S3C2410_LCDINT_FICNT   (1<<0)
+
+/* s3c2442 extra stn registers */
+
+#define S3C2442_REDLUT         S3C2410_LCDREG(0x20)
+#define S3C2442_GREENLUT       S3C2410_LCDREG(0x24)
+#define S3C2442_BLUELUT                S3C2410_LCDREG(0x28)
+#define S3C2442_DITHMODE       S3C2410_LCDREG(0x20)
+
+#define S3C2410_LPCSEL    S3C2410_LCDREG(0x60)
+
+#define S3C2410_TFTPAL(x)  S3C2410_LCDREG((0x400 + (x)*4))
+
+/* S3C2412 registers */
+
+#define S3C2412_TPAL           S3C2410_LCDREG(0x20)
+
+#define S3C2412_LCDINTPND      S3C2410_LCDREG(0x24)
+#define S3C2412_LCDSRCPND      S3C2410_LCDREG(0x28)
+#define S3C2412_LCDINTMSK      S3C2410_LCDREG(0x2C)
+
+#define S3C2412_TCONSEL                S3C2410_LCDREG(0x30)
+
+#define S3C2412_LCDCON6                S3C2410_LCDREG(0x34)
+#define S3C2412_LCDCON7                S3C2410_LCDREG(0x38)
+#define S3C2412_LCDCON8                S3C2410_LCDREG(0x3C)
+#define S3C2412_LCDCON9                S3C2410_LCDREG(0x40)
+
+#define S3C2412_REDLUT(x)      S3C2410_LCDREG(0x44 + ((x)*4))
+#define S3C2412_GREENLUT(x)    S3C2410_LCDREG(0x60 + ((x)*4))
+#define S3C2412_BLUELUT(x)     S3C2410_LCDREG(0x98 + ((x)*4))
+
+#define S3C2412_FRCPAT(x)      S3C2410_LCDREG(0xB4 + ((x)*4))
+
+/* general registers */
+
+/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
+ * are available. */
+
+#define S3C2410_LCDINTBASE     S3C2410_LCDREG(0x54)
+#define S3C2412_LCDINTBASE     S3C2410_LCDREG(0x24)
+
+#define S3C24XX_LCDINTPND      (0x00)
+#define S3C24XX_LCDSRCPND      (0x04)
+#define S3C24XX_LCDINTMSK      (0x08)
+
+#endif /* ___ASM_ARCH_REGS_LCD_H */
index 6f8fa50..d8ae525 100644 (file)
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
 #include <linux/io.h>
+#include <linux/platform_data/fb-s3c2410.h>
 
 #include <asm/div64.h>
 
 #include <asm/mach/map.h>
-#include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
-#include <mach/fb.h>
 
 #ifdef CONFIG_PM
 #include <linux/pm.h>
 #endif
 
 #include "s3c2410fb.h"
+#include "s3c2410fb-regs-lcd.h"
 
 /* Debugging stuff */
 static int debug = IS_BUILTIN(CONFIG_FB_S3C2410_DEBUG);
@@ -672,6 +671,9 @@ static inline void modify_gpio(void __iomem *reg,
 {
        unsigned long tmp;
 
+       if (!reg)
+               return;
+
        tmp = readl(reg) & ~mask;
        writel(tmp | set, reg);
 }
@@ -702,10 +704,10 @@ static int s3c2410fb_init_registers(struct fb_info *info)
 
        /* modify the gpio(s) with interrupts set (bjd) */
 
-       modify_gpio(S3C2410_GPCUP,  mach_info->gpcup,  mach_info->gpcup_mask);
-       modify_gpio(S3C2410_GPCCON, mach_info->gpccon, mach_info->gpccon_mask);
-       modify_gpio(S3C2410_GPDUP,  mach_info->gpdup,  mach_info->gpdup_mask);
-       modify_gpio(S3C2410_GPDCON, mach_info->gpdcon, mach_info->gpdcon_mask);
+       modify_gpio(mach_info->gpcup_reg,  mach_info->gpcup,  mach_info->gpcup_mask);
+       modify_gpio(mach_info->gpccon_reg, mach_info->gpccon, mach_info->gpccon_mask);
+       modify_gpio(mach_info->gpdup_reg,  mach_info->gpdup,  mach_info->gpdup_mask);
+       modify_gpio(mach_info->gpdcon_reg, mach_info->gpdcon, mach_info->gpdcon_mask);
 
        local_irq_restore(flags);
 
index bda6cc3..e31cf63 100644 (file)
@@ -935,7 +935,7 @@ static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state)
                 */
                if (old_state != C_DISABLE_PM)
                        break;
-               /* fall through */
+               fallthrough;
 
        case C_ENABLE:
                /*
index 3fd87ae..a2442aa 100644 (file)
@@ -1860,7 +1860,7 @@ static int savage_init_hw(struct savagefb_par *par)
                if ((vga_in8(0x3d5, par) & 0xC0) == (0x01 << 6))
                        RamSavage4[1] = 8;
 
-               /*FALLTHROUGH*/
+               fallthrough;
 
        case S3_SAVAGE2000:
                videoRam = RamSavage4[(config1 & 0xE0) >> 5] * 1024;
index 8a27d12..c104342 100644 (file)
@@ -1594,7 +1594,7 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21:
                info->fix.ypanstep = 2;
-               /* Fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                info->fix.xpanstep = 2;
@@ -2085,7 +2085,7 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21:
                info->fix.ypanstep = 2;
-               /* Fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                info->fix.xpanstep = 2;
index ac14096..03c736f 100644 (file)
@@ -1739,7 +1739,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_GET_INFO:  /* For communication with X driver */
                ivideo->sisfb_infoblock.sisfb_id         = SISFB_ID;
                ivideo->sisfb_infoblock.sisfb_version    = VER_MAJOR;
@@ -1793,7 +1793,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_GET_VBRSTATUS:
                if(sisfb_CheckVBRetrace(ivideo))
                        return put_user((u32)1, argp);
@@ -1804,7 +1804,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_GET_AUTOMAXIMIZE:
                if(ivideo->sisfb_max)
                        return put_user((u32)1, argp);
@@ -1815,7 +1815,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_SET_AUTOMAXIMIZE:
                if(get_user(gpu32, argp))
                        return -EFAULT;
index 3dd1b1d..6a52eba 100644 (file)
@@ -1005,7 +1005,7 @@ static int sm501fb_blank_crt(int blank_mode, struct fb_info *info)
        case FB_BLANK_POWERDOWN:
                ctrl &= ~SM501_DC_CRT_CONTROL_ENABLE;
                sm501_misc_control(fbi->dev->parent, SM501_MISC_DAC_POWER, 0);
-               /* fall through */
+               fallthrough;
 
        case FB_BLANK_NORMAL:
                ctrl |= SM501_DC_CRT_CONTROL_BLANK;
index de953dd..2658656 100644 (file)
@@ -999,7 +999,7 @@ stifb_blank(int blank_mode, struct fb_info *info)
        case S9000_ID_HCRX:
                HYPER_ENABLE_DISABLE_DISPLAY(fb, enable);
                break;
-       case S9000_ID_A1659A:   /* fall through */
+       case S9000_ID_A1659A:
        case S9000_ID_TIMBER:
        case CRX24_OVERLAY_PLANES:
        default:
@@ -1157,7 +1157,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
                        dev_name);
                   goto out_err0;
                }
-               /* fall through */
+               fallthrough;
        case S9000_ID_ARTIST:
        case S9000_ID_HCRX:
        case S9000_ID_TIMBER:
index f73e26c..f056d80 100644 (file)
@@ -523,7 +523,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        case 32:
                var->transp.offset = 24;
                var->transp.length = 8;
-               /* fall through */
+               fallthrough;
        case 24:
                var->red.offset = 16;
                var->green.offset = 8;
index 3fea01d..4a86940 100644 (file)
@@ -744,7 +744,7 @@ static void set_lcd_output_path(int set_iga, int output_interface)
                    viaparinfo->chip_info->gfx_chip_name))
                        viafb_write_reg_mask(CR97, VIACR, 0x84,
                                       BIT7 + BIT2 + BIT1 + BIT0);
-               /* fall through */
+               fallthrough;
        case INTERFACE_DVP0:
        case INTERFACE_DVP1:
        case INTERFACE_DFP_HIGH:
index 00307b8..5ec5144 100644 (file)
@@ -677,7 +677,7 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index ab7aad5..e4dd498 100644 (file)
@@ -478,16 +478,10 @@ config IXP4XX_WATCHDOG
 
          Say N if you are unsure.
 
-config HAVE_S3C2410_WATCHDOG
-       bool
-       help
-         This will include watchdog timer support for Samsung SoCs. If
-         you want to include watchdog support for any machine, kindly
-         select this in the respective mach-XXXX/Kconfig file.
-
 config S3C2410_WATCHDOG
        tristate "S3C2410 Watchdog"
-       depends on HAVE_S3C2410_WATCHDOG || COMPILE_TEST
+       depends on ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || \
+                  COMPILE_TEST
        select WATCHDOG_CORE
        select MFD_SYSCON if ARCH_EXYNOS
        help
index 9673eb1..f22ebe8 100644 (file)
@@ -234,7 +234,7 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
                        return -EINVAL;
                timeout = new_timeout;
                sc1200wdt_write_data(WDTO, timeout);
-               /* fall through - and return the new timeout */
+               fallthrough;    /* and return the new timeout */
 
        case WDIOC_GETTIMEOUT:
                return put_user(timeout * 60, p);
index 184a06a..c006278 100644 (file)
@@ -332,7 +332,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd,
                        wdrtas_interval = i;
                else
                        wdrtas_interval = wdrtas_get_interval(i);
-               /* fallthrough */
+               fallthrough;
 
        case WDIOC_GETTIMEOUT:
                return put_user(wdrtas_interval, argp);
index 140c7bf..90b8f56 100644 (file)
@@ -156,7 +156,7 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
 /* Get info for IRQ */
 struct irq_info *info_for_irq(unsigned irq)
 {
-       return irq_get_handler_data(irq);
+       return irq_get_chip_data(irq);
 }
 
 /* Constructors for packed IRQ information. */
@@ -377,7 +377,7 @@ static void xen_irq_init(unsigned irq)
        info->type = IRQT_UNBOUND;
        info->refcnt = -1;
 
-       irq_set_handler_data(irq, info);
+       irq_set_chip_data(irq, info);
 
        list_add_tail(&info->list, &xen_irq_list_head);
 }
@@ -426,14 +426,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
 
 static void xen_free_irq(unsigned irq)
 {
-       struct irq_info *info = irq_get_handler_data(irq);
+       struct irq_info *info = irq_get_chip_data(irq);
 
        if (WARN_ON(!info))
                return;
 
        list_del(&info->list);
 
-       irq_set_handler_data(irq, NULL);
+       irq_set_chip_data(irq, NULL);
 
        WARN_ON(info->refcnt > 0);
 
@@ -603,7 +603,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
 static void __unbind_from_irq(unsigned int irq)
 {
        evtchn_port_t evtchn = evtchn_from_irq(irq);
-       struct irq_info *info = irq_get_handler_data(irq);
+       struct irq_info *info = irq_get_chip_data(irq);
 
        if (info->refcnt > 0) {
                info->refcnt--;
@@ -1108,7 +1108,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
 
 void unbind_from_irqhandler(unsigned int irq, void *dev_id)
 {
-       struct irq_info *info = irq_get_handler_data(irq);
+       struct irq_info *info = irq_get_chip_data(irq);
 
        if (WARN_ON(!info))
                return;
@@ -1142,7 +1142,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn)
        if (irq == -1)
                return -ENOENT;
 
-       info = irq_get_handler_data(irq);
+       info = irq_get_chip_data(irq);
 
        if (!info)
                return -ENOENT;
@@ -1170,7 +1170,7 @@ int evtchn_get(evtchn_port_t evtchn)
        if (irq == -1)
                goto done;
 
-       info = irq_get_handler_data(irq);
+       info = irq_get_chip_data(irq);
 
        if (!info)
                goto done;
index b43b559..72d725a 100644 (file)
@@ -1263,7 +1263,7 @@ static void pvcalls_front_changed(struct xenbus_device *dev,
                if (dev->state == XenbusStateClosed)
                        break;
                /* Missed the backend's CLOSING state */
-               /* fall through */
+               fallthrough;
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 7457213..f914b72 100644 (file)
@@ -229,7 +229,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
        case ACPI_NOTIFY_BUS_CHECK:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                        "\nReceived BUS CHECK notification for device\n"));
-               /* Fall Through */
+               fallthrough;
        case ACPI_NOTIFY_DEVICE_CHECK:
                if (event == ACPI_NOTIFY_DEVICE_CHECK)
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
index f211558..b500466 100644 (file)
@@ -545,7 +545,7 @@ static void xen_pcibk_frontend_changed(struct xenbus_device *xdev,
                xenbus_switch_state(xdev, XenbusStateClosed);
                if (xenbus_dev_is_online(xdev))
                        break;
-               /* fall through - if not online */
+               fallthrough;    /* if not online */
        case XenbusStateUnknown:
                dev_dbg(&xdev->dev, "frontend is gone! unregister device\n");
                device_unregister(&xdev->dev);
index 75c0a2e..1e8cfd8 100644 (file)
@@ -1185,7 +1185,7 @@ static void scsiback_frontend_changed(struct xenbus_device *dev,
                xenbus_switch_state(dev, XenbusStateClosed);
                if (xenbus_dev_is_online(dev))
                        break;
-               /* fall through - if not online */
+               fallthrough;    /* if not online */
        case XenbusStateUnknown:
                device_unregister(&dev->dev);
                break;
index 786fbb7..907bcbb 100644 (file)
@@ -379,8 +379,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
        int i, j;
 
        for (i = 0; i < nr_pages; i++) {
-               err = gnttab_grant_foreign_access(dev->otherend_id,
-                                                 virt_to_gfn(vaddr), 0);
+               unsigned long gfn;
+
+               if (is_vmalloc_addr(vaddr))
+                       gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr));
+               else
+                       gfn = virt_to_gfn(vaddr);
+
+               err = gnttab_grant_foreign_access(dev->otherend_id, gfn, 0);
                if (err < 0) {
                        xenbus_dev_fatal(dev, err,
                                         "granting access to ring page");
index 1537908..4809446 100644 (file)
@@ -401,12 +401,12 @@ static void xenbus_reset_frontend(char *fe, char *be, int be_state)
        case XenbusStateConnected:
                xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateClosing);
                xenbus_reset_wait_for_backend(be, XenbusStateClosing);
-               /* fall through */
+               fallthrough;
 
        case XenbusStateClosing:
                xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateClosed);
                xenbus_reset_wait_for_backend(be, XenbusStateClosed);
-               /* fall through */
+               fallthrough;
 
        case XenbusStateClosed:
                xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateInitialising);
index 92cd1d8..3576123 100644 (file)
@@ -213,7 +213,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
                break;
        default:
                WARN_ONCE(1, "unknown lock status code: %d\n", status);
-               /* fall through */
+               fallthrough;
        case P9_LOCK_ERROR:
        case P9_LOCK_GRACE:
                res = -ENOLCK;
index 30d526f..05e9634 100644 (file)
@@ -18,11 +18,11 @@ static inline unsigned int adfs_readval(unsigned char *p, int len)
 
        switch (len) {
        case 4:         val |= p[3] << 24;
-                       /* fall through */
+               fallthrough;
        case 3:         val |= p[2] << 16;
-                       /* fall through */
+               fallthrough;
        case 2:         val |= p[1] << 8;
-                       /* fall through */
+               fallthrough;
        default:        val |= p[0];
        }
        return val;
@@ -32,11 +32,11 @@ static inline void adfs_writeval(unsigned char *p, int len, unsigned int val)
 {
        switch (len) {
        case 4:         p[3] = val >> 24;
-                       /* fall through */
+               fallthrough;
        case 3:         p[2] = val >> 16;
-                       /* fall through */
+               fallthrough;
        case 2:         p[1] = val >> 8;
-                       /* fall through */
+               fallthrough;
        default:        p[0] = val;
        }
 }
index a346cf7..0444121 100644 (file)
@@ -93,7 +93,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
        case ST_ROOT:
                inode->i_uid = sbi->s_uid;
                inode->i_gid = sbi->s_gid;
-               /* fall through */
+               fallthrough;
        case ST_USERDIR:
                if (be32_to_cpu(tail->stype) == ST_USERDIR ||
                    affs_test_opt(sbi->s_flags, SF_SETMODE)) {
index 47107c6..a100cd9 100644 (file)
@@ -474,7 +474,7 @@ got_root:
        case MUFS_INTLFFS:
        case MUFS_DCFFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall thru */
+               fallthrough;
        case FS_INTLFFS:
        case FS_DCFFS:
                affs_set_opt(sbi->s_flags, SF_INTL);
@@ -486,7 +486,7 @@ got_root:
                break;
        case MUFS_OFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall through */
+               fallthrough;
        case FS_OFS:
                affs_set_opt(sbi->s_flags, SF_OFS);
                sb->s_flags |= SB_NOEXEC;
@@ -494,7 +494,7 @@ got_root:
        case MUFS_DCOFS:
        case MUFS_INTLOFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall through */
+               fallthrough;
        case FS_DCOFS:
        case FS_INTLOFS:
                affs_set_opt(sbi->s_flags, SF_INTL);
index bef4138..a4e9e6e 100644 (file)
@@ -252,7 +252,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the FID array and its count in two steps */
-               /* fall through */
+               fallthrough;
        case 1:
                _debug("extract FID count");
                ret = afs_extract_data(call, true);
@@ -271,7 +271,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                afs_extract_to_buf(call, call->count * 3 * 4);
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 2:
                _debug("extract FID array");
                ret = afs_extract_data(call, true);
@@ -297,7 +297,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the callback array and its count in two steps */
-               /* fall through */
+               fallthrough;
        case 3:
                _debug("extract CB count");
                ret = afs_extract_data(call, true);
@@ -312,7 +312,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                iov_iter_discard(&call->def_iter, READ, call->count2 * 3 * 4);
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 4:
                _debug("extract discard %zu/%u",
                       iov_iter_count(call->iter), call->count2 * 3 * 4);
@@ -391,7 +391,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
                afs_extract_to_buf(call, 11 * sizeof(__be32));
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 1:
                _debug("extract UUID");
                ret = afs_extract_data(call, false);
@@ -503,7 +503,7 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
                afs_extract_to_buf(call, 11 * sizeof(__be32));
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 1:
                _debug("extract UUID");
                ret = afs_extract_data(call, false);
@@ -618,7 +618,7 @@ static int afs_deliver_yfs_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the FID array and its count in two steps */
-               /* Fall through */
+               fallthrough;
        case 1:
                _debug("extract FID count");
                ret = afs_extract_data(call, true);
@@ -637,7 +637,7 @@ static int afs_deliver_yfs_cb_callback(struct afs_call *call)
                afs_extract_to_buf(call, size);
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 2:
                _debug("extract FID array");
                ret = afs_extract_data(call, false);
index b79879a..7b784af 100644 (file)
@@ -382,15 +382,17 @@ void afs_dynroot_depopulate(struct super_block *sb)
                net->dynroot_sb = NULL;
        mutex_unlock(&net->proc_cells_lock);
 
-       inode_lock(root->d_inode);
-
-       /* Remove all the pins for dirs created for manually added cells */
-       list_for_each_entry_safe(subdir, tmp, &root->d_subdirs, d_child) {
-               if (subdir->d_fsdata) {
-                       subdir->d_fsdata = NULL;
-                       dput(subdir);
+       if (root) {
+               inode_lock(root->d_inode);
+
+               /* Remove all the pins for dirs created for manually added cells */
+               list_for_each_entry_safe(subdir, tmp, &root->d_subdirs, d_child) {
+                       if (subdir->d_fsdata) {
+                               subdir->d_fsdata = NULL;
+                               dput(subdir);
+                       }
                }
-       }
 
-       inode_unlock(root->d_inode);
+               inode_unlock(root->d_inode);
+       }
 }
index 6f6ed16..371d148 100644 (file)
@@ -311,7 +311,7 @@ int afs_page_filler(void *data, struct page *page)
        case -ENOBUFS:
                _debug("cache said ENOBUFS");
 
-               /* fall through */
+               fallthrough;
        default:
        go_on:
                req = kzalloc(struct_size(req, array, 1), GFP_KERNEL);
index ffb8575..cb3054c 100644 (file)
@@ -376,7 +376,6 @@ again:
                spin_unlock(&vnode->lock);
                return;
 
-               /* Fall through */
        default:
                /* Looks like a lock request was withdrawn. */
                spin_unlock(&vnode->lock);
index 24fd163..97cab12 100644 (file)
@@ -235,6 +235,7 @@ int afs_put_operation(struct afs_operation *op)
        afs_end_cursor(&op->ac);
        afs_put_serverlist(op->net, op->server_list);
        afs_put_volume(op->net, op->volume, afs_volume_trace_put_put_op);
+       key_put(op->key);
        kfree(op);
        return ret;
 }
index acb4d0c..1d95ed9 100644 (file)
@@ -320,7 +320,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                        call->tmp_u = htonl(0);
                        afs_extract_to_tmp(call);
                }
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data length */
        case 1:
@@ -348,7 +348,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                call->bvec[0].bv_page = req->pages[req->index];
                iov_iter_bvec(&call->def_iter, READ, call->bvec, 1, size);
                ASSERTCMP(size, <=, PAGE_SIZE);
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data */
        case 2:
@@ -375,7 +375,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                /* Discard any excess data the server gave us */
                afs_extract_discard(call, req->actual_len - req->len);
                call->unmarshall = 3;
-               /* Fall through */
+               fallthrough;
 
        case 3:
                _debug("extract discard %zu/%llu",
@@ -388,7 +388,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
        no_more_data:
                call->unmarshall = 4;
                afs_extract_to_buf(call, (21 + 3 + 6) * 4);
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 4:
@@ -1343,7 +1343,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
        case 0:
                call->unmarshall++;
                afs_extract_to_buf(call, 12 * 4);
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned status record */
        case 1:
@@ -1356,7 +1356,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                xdr_decode_AFSFetchVolumeStatus(&bp, &op->volstatus.vs);
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name length */
        case 2:
@@ -1371,7 +1371,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name */
        case 3:
@@ -1385,7 +1385,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                _debug("volname '%s'", p);
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message length */
        case 4:
@@ -1400,7 +1400,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message */
        case 5:
@@ -1415,7 +1415,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
 
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day length */
        case 6:
@@ -1430,7 +1430,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day */
        case 7:
@@ -1682,7 +1682,7 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the capabilities word count */
        case 1:
@@ -1696,7 +1696,7 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
                call->count2 = count;
                afs_extract_discard(call, count * sizeof(__be32));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract capabilities words */
        case 2:
@@ -1776,7 +1776,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file status count and array in two steps */
        case 1:
@@ -1794,7 +1794,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_counts:
                afs_extract_to_buf(call, 21 * sizeof(__be32));
-               /* Fall through */
+               fallthrough;
 
        case 2:
                _debug("extract status array %u", call->count);
@@ -1824,7 +1824,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->count = 0;
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* Extract the callback count and array in two steps */
        case 3:
@@ -1841,7 +1841,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_cbs:
                afs_extract_to_buf(call, 3 * sizeof(__be32));
-               /* Fall through */
+               fallthrough;
 
        case 4:
                _debug("extract CB array");
@@ -1870,7 +1870,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
 
                afs_extract_to_buf(call, 6 * sizeof(__be32));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 5:
                ret = afs_extract_data(call, false);
@@ -1974,7 +1974,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data length */
        case 1:
@@ -1992,7 +1992,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
                acl->size = call->count2;
                afs_extract_begin(call, acl->data, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data */
        case 2:
@@ -2002,7 +2002,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
 
                afs_extract_to_buf(call, (21 + 6) * 4);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 3:
index 5334f1b..1d1a8de 100644 (file)
@@ -120,42 +120,42 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code)
                if (e->error == -ETIMEDOUT ||
                    e->error == -ETIME)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ETIMEDOUT:
        case -ETIME:
                if (e->error == -ENOMEM ||
                    e->error == -ENONET)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ENOMEM:
        case -ENONET:
                if (e->error == -ERFKILL)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ERFKILL:
                if (e->error == -EADDRNOTAVAIL)
                        return;
-               /* Fall through */
+               fallthrough;
        case -EADDRNOTAVAIL:
                if (e->error == -ENETUNREACH)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ENETUNREACH:
                if (e->error == -EHOSTUNREACH)
                        return;
-               /* Fall through */
+               fallthrough;
        case -EHOSTUNREACH:
                if (e->error == -EHOSTDOWN)
                        return;
-               /* Fall through */
+               fallthrough;
        case -EHOSTDOWN:
                if (e->error == -ECONNREFUSED)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ECONNREFUSED:
                if (e->error == -ECONNRESET)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ECONNRESET: /* Responded, but call expired. */
                if (e->responded)
                        return;
index 6a0935c..d83f13c 100644 (file)
@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_operation *op)
        case -ETIME:
                if (op->error != -EDESTADDRREQ)
                        goto iterate_address;
-               /* Fall through */
+               fallthrough;
        case -ERFKILL:
        case -EADDRNOTAVAIL:
        case -ENETUNREACH:
index 8fc8fb4..8be709c 100644 (file)
@@ -568,7 +568,7 @@ static void afs_deliver_to_call(struct afs_call *call)
                case -EIO:
                        pr_err("kAFS: Call %u in bad state %u\n",
                               call->debug_id, state);
-                       /* Fall through */
+                       fallthrough;
                case -ENODATA:
                case -EBADMSG:
                case -EMSGSIZE:
@@ -669,7 +669,7 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
                ret = call->ret0;
                call->ret0 = 0;
 
-               /* Fall through */
+               fallthrough;
        case -ECONNABORTED:
                ac->responded = true;
                break;
@@ -872,7 +872,7 @@ void afs_send_empty_reply(struct afs_call *call)
                _debug("oom");
                rxrpc_kernel_abort_call(net->socket, call->rxcall,
                                        RX_USER_ABORT, -ENOMEM, "KOO");
-               /* Fall through */
+               fallthrough;
        default:
                _leave(" [error]");
                return;
index fd82850..dc93273 100644 (file)
@@ -196,7 +196,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
 
                /* Extract the returned uuid, uniquifier, nentries and
                 * blkaddrs size */
-               /* Fall through */
+               fallthrough;
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -221,7 +221,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
                count = min(call->count, 4U);
                afs_extract_to_buf(call, count * sizeof(__be32));
 
-               /* Fall through - and extract entries */
+               fallthrough;    /* and extract entries */
        case 2:
                ret = afs_extract_data(call, call->count > 4);
                if (ret < 0)
@@ -324,7 +324,7 @@ static int afs_deliver_vl_get_capabilities(struct afs_call *call)
                afs_extract_to_tmp(call);
                call->unmarshall++;
 
-               /* Fall through - and extract the capabilities word count */
+               fallthrough;    /* and extract the capabilities word count */
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -337,7 +337,7 @@ static int afs_deliver_vl_get_capabilities(struct afs_call *call)
                call->unmarshall++;
                afs_extract_discard(call, count * sizeof(__be32));
 
-               /* Fall through - and extract capabilities words */
+               fallthrough;    /* and extract capabilities words */
        case 2:
                ret = afs_extract_data(call, false);
                if (ret < 0)
@@ -436,7 +436,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                /* Extract the returned uuid, uniquifier, fsEndpoints count and
                 * either the first fsEndpoint type or the volEndpoints
                 * count if there are no fsEndpoints. */
-               /* Fall through */
+               fallthrough;
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -475,7 +475,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                afs_extract_to_buf(call, size);
                call->unmarshall = 2;
 
-               /* Fall through - and extract fsEndpoints[] entries */
+               fallthrough;    /* and extract fsEndpoints[] entries */
        case 2:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -526,7 +526,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                 * extract the type of the next endpoint when we extract the
                 * data of the current one, but this is the first...
                 */
-               /* Fall through */
+               fallthrough;
        case 3:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -552,7 +552,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                afs_extract_to_buf(call, size);
                call->unmarshall = 4;
 
-               /* Fall through - and extract volEndpoints[] entries */
+               fallthrough;    /* and extract volEndpoints[] entries */
        case 4:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -587,7 +587,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                afs_extract_discard(call, 0);
                call->unmarshall = 5;
 
-               /* Fall through - Done */
+               fallthrough;    /* Done */
        case 5:
                ret = afs_extract_data(call, false);
                if (ret < 0)
@@ -663,7 +663,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
                afs_extract_to_tmp(call);
                call->unmarshall++;
 
-               /* Fall through - and extract the cell name length */
+               fallthrough;    /* and extract the cell name length */
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -685,7 +685,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
                afs_extract_begin(call, cell_name, namesz);
                call->unmarshall++;
 
-               /* Fall through - and extract cell name */
+               fallthrough;    /* and extract cell name */
        case 2:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -694,7 +694,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
                afs_extract_discard(call, call->count2);
                call->unmarshall++;
 
-               /* Fall through - and extract padding */
+               fallthrough;    /* and extract padding */
        case 3:
                ret = afs_extract_data(call, false);
                if (ret < 0)
index a121c24..4b2265c 100644 (file)
@@ -609,7 +609,7 @@ no_more:
 
        default:
                pr_notice("kAFS: Unexpected error from FS.StoreData %d\n", ret);
-               /* Fall through */
+               fallthrough;
        case -EACCES:
        case -EPERM:
        case -ENOKEY:
index 8c24fdc..3b1239b 100644 (file)
@@ -373,7 +373,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                req->offset = req->pos & (PAGE_SIZE - 1);
                afs_extract_to_tmp64(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data length */
        case 1:
@@ -401,7 +401,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                call->bvec[0].bv_page = req->pages[req->index];
                iov_iter_bvec(&call->def_iter, READ, call->bvec, 1, size);
                ASSERTCMP(size, <=, PAGE_SIZE);
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data */
        case 2:
@@ -428,7 +428,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                /* Discard any excess data the server gave us */
                afs_extract_discard(call, req->actual_len - req->len);
                call->unmarshall = 3;
-               /* Fall through */
+               fallthrough;
 
        case 3:
                _debug("extract discard %zu/%llu",
@@ -444,7 +444,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                                   sizeof(struct yfs_xdr_YFSFetchStatus) +
                                   sizeof(struct yfs_xdr_YFSCallBack) +
                                   sizeof(struct yfs_xdr_YFSVolSync));
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 4:
@@ -461,7 +461,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                req->file_size = vp->scb.status.size;
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 5:
                break;
@@ -1262,7 +1262,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
        case 0:
                call->unmarshall++;
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSFetchVolumeStatus));
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned status record */
        case 1:
@@ -1275,7 +1275,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                xdr_decode_YFSFetchVolumeStatus(&bp, &op->volstatus.vs);
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name length */
        case 2:
@@ -1290,7 +1290,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name */
        case 3:
@@ -1304,7 +1304,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                _debug("volname '%s'", p);
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message length */
        case 4:
@@ -1319,7 +1319,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message */
        case 5:
@@ -1334,7 +1334,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
 
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day length */
        case 6:
@@ -1349,7 +1349,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day */
        case 7:
@@ -1363,7 +1363,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                _debug("motd '%s'", p);
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 8:
                break;
@@ -1622,7 +1622,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file status count and array in two steps */
        case 1:
@@ -1640,7 +1640,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_counts:
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSFetchStatus));
-               /* Fall through */
+               fallthrough;
 
        case 2:
                _debug("extract status array %u", call->count);
@@ -1670,7 +1670,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->count = 0;
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* Extract the callback count and array in two steps */
        case 3:
@@ -1687,7 +1687,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_cbs:
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSCallBack));
-               /* Fall through */
+               fallthrough;
 
        case 4:
                _debug("extract CB array");
@@ -1716,7 +1716,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
 
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSVolSync));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 5:
                ret = afs_extract_data(call, false);
@@ -1727,7 +1727,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                xdr_decode_YFSVolSync(&bp, &op->volsync);
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 6:
                break;
@@ -1804,7 +1804,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file ACL length */
        case 1:
@@ -1826,7 +1826,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                        afs_extract_discard(call, size);
                }
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file ACL */
        case 2:
@@ -1836,7 +1836,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
 
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the volume ACL length */
        case 3:
@@ -1858,7 +1858,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                        afs_extract_discard(call, size);
                }
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the volume ACL */
        case 4:
@@ -1871,7 +1871,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                                   sizeof(struct yfs_xdr_YFSFetchStatus) +
                                   sizeof(struct yfs_xdr_YFSVolSync));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 5:
@@ -1886,7 +1886,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                xdr_decode_YFSVolSync(&bp, &op->volsync);
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 6:
                break;
index 5736bff..d5ec303 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1511,7 +1511,7 @@ static inline void aio_rw_done(struct kiocb *req, ssize_t ret)
                 * may be already running. Just fail this IO with EINTR.
                 */
                ret = -EINTR;
-               /*FALLTHRU*/
+               fallthrough;
        default:
                req->ki_complete(req, ret, 0);
        }
index f2f9086..b9c658e 100644 (file)
@@ -576,7 +576,7 @@ static int load_flat_file(struct linux_binprm *bprm,
                        goto err;
                }
 
-               len = data_len + extra;
+               len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
                len = PAGE_ALIGN(len);
                realdatastart = vm_mmap(NULL, 0, len,
                        PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
@@ -590,7 +590,9 @@ static int load_flat_file(struct linux_binprm *bprm,
                        vm_munmap(textpos, text_len);
                        goto err;
                }
-               datapos = ALIGN(realdatastart, FLAT_DATA_ALIGN);
+               datapos = ALIGN(realdatastart +
+                               MAX_SHARED_LIBS * sizeof(unsigned long),
+                               FLAT_DATA_ALIGN);
 
                pr_debug("Allocated data+bss+stack (%u bytes): %lx\n",
                         data_len + bss_len + stack_len, datapos);
@@ -620,7 +622,7 @@ static int load_flat_file(struct linux_binprm *bprm,
                memp_size = len;
        } else {
 
-               len = text_len + data_len + extra;
+               len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(u32);
                len = PAGE_ALIGN(len);
                textpos = vm_mmap(NULL, 0, len,
                        PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
@@ -635,7 +637,9 @@ static int load_flat_file(struct linux_binprm *bprm,
                }
 
                realdatastart = textpos + ntohl(hdr->data_start);
-               datapos = ALIGN(realdatastart, FLAT_DATA_ALIGN);
+               datapos = ALIGN(realdatastart +
+                               MAX_SHARED_LIBS * sizeof(u32),
+                               FLAT_DATA_ALIGN);
 
                reloc = (__be32 __user *)
                        (datapos + (ntohl(hdr->reloc_start) - text_len));
@@ -652,9 +656,8 @@ static int load_flat_file(struct linux_binprm *bprm,
                                         (text_len + full_data
                                                  - sizeof(struct flat_hdr)),
                                         0);
-                       if (datapos != realdatastart)
-                               memmove((void *)datapos, (void *)realdatastart,
-                                               full_data);
+                       memmove((void *) datapos, (void *) realdatastart,
+                                       full_data);
 #else
                        /*
                         * This is used on MMU systems mainly for testing.
@@ -710,7 +713,8 @@ static int load_flat_file(struct linux_binprm *bprm,
                if (IS_ERR_VALUE(result)) {
                        ret = result;
                        pr_err("Unable to read code+data+bss, errno %d\n", ret);
-                       vm_munmap(textpos, text_len + data_len + extra);
+                       vm_munmap(textpos, text_len + data_len + extra +
+                               MAX_SHARED_LIBS * sizeof(u32));
                        goto err;
                }
        }
index 70e49d8..cd1cd67 100644 (file)
@@ -68,7 +68,7 @@ const char *btrfs_super_csum_driver(u16 csum_type)
                btrfs_csums[csum_type].name;
 }
 
-size_t __const btrfs_get_num_csums(void)
+size_t __attribute_const__ btrfs_get_num_csums(void)
 {
        return ARRAY_SIZE(btrfs_csums);
 }
index 9c7e466..9a72896 100644 (file)
@@ -2262,7 +2262,7 @@ BTRFS_SETGET_STACK_FUNCS(super_uuid_tree_generation, struct btrfs_super_block,
 int btrfs_super_csum_size(const struct btrfs_super_block *s);
 const char *btrfs_super_csum_name(u16 csum_type);
 const char *btrfs_super_csum_driver(u16 csum_type);
-size_t __const btrfs_get_num_csums(void);
+size_t __attribute_const__ btrfs_get_num_csums(void);
 
 
 /*
@@ -2518,7 +2518,7 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
                                    u64 bytenr, u64 num_bytes);
 int btrfs_exclude_logged_extents(struct extent_buffer *eb);
 int btrfs_cross_ref_exist(struct btrfs_root *root,
-                         u64 objectid, u64 offset, u64 bytenr);
+                         u64 objectid, u64 offset, u64 bytenr, bool strict);
 struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
                                             struct btrfs_root *root,
                                             u64 parent, u64 root_objectid,
@@ -2934,7 +2934,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
                                           u64 start, u64 len);
 noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
                              u64 *orig_start, u64 *orig_block_len,
-                             u64 *ram_bytes);
+                             u64 *ram_bytes, bool strict);
 
 void __btrfs_del_delalloc_inode(struct btrfs_root *root,
                                struct btrfs_inode *inode);
index 9ae25f6..f6bba7e 100644 (file)
@@ -4551,6 +4551,7 @@ static void btrfs_cleanup_bg_io(struct btrfs_block_group *cache)
                cache->io_ctl.inode = NULL;
                iput(inode);
        }
+       ASSERT(cache->io_ctl.pages == NULL);
        btrfs_put_block_group(cache);
 }
 
index de6fe17..5871ef7 100644 (file)
@@ -2306,7 +2306,8 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
 
 static noinline int check_committed_ref(struct btrfs_root *root,
                                        struct btrfs_path *path,
-                                       u64 objectid, u64 offset, u64 bytenr)
+                                       u64 objectid, u64 offset, u64 bytenr,
+                                       bool strict)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_root *extent_root = fs_info->extent_root;
@@ -2348,9 +2349,13 @@ static noinline int check_committed_ref(struct btrfs_root *root,
            btrfs_extent_inline_ref_size(BTRFS_EXTENT_DATA_REF_KEY))
                goto out;
 
-       /* If extent created before last snapshot => it's definitely shared */
-       if (btrfs_extent_generation(leaf, ei) <=
-           btrfs_root_last_snapshot(&root->root_item))
+       /*
+        * If extent created before last snapshot => it's shared unless the
+        * snapshot has been deleted. Use the heuristic if strict is false.
+        */
+       if (!strict &&
+           (btrfs_extent_generation(leaf, ei) <=
+            btrfs_root_last_snapshot(&root->root_item)))
                goto out;
 
        iref = (struct btrfs_extent_inline_ref *)(ei + 1);
@@ -2375,7 +2380,7 @@ out:
 }
 
 int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
-                         u64 bytenr)
+                         u64 bytenr, bool strict)
 {
        struct btrfs_path *path;
        int ret;
@@ -2386,7 +2391,7 @@ int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
 
        do {
                ret = check_committed_ref(root, path, objectid,
-                                         offset, bytenr);
+                                         offset, bytenr, strict);
                if (ret && ret != -ENOENT)
                        goto out;
 
index bb824c7..4507c3d 100644 (file)
@@ -1571,7 +1571,7 @@ static int check_can_nocow(struct btrfs_inode *inode, loff_t pos,
        }
 
        ret = can_nocow_extent(&inode->vfs_inode, lockstart, &num_bytes,
-                       NULL, NULL, NULL);
+                       NULL, NULL, NULL, false);
        if (ret <= 0) {
                ret = 0;
                if (!nowait)
index ef0fd7a..dc82fd0 100644 (file)
@@ -1186,7 +1186,6 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root,
        ret = update_cache_item(trans, root, inode, path, offset,
                                io_ctl->entries, io_ctl->bitmaps);
 out:
-       io_ctl_free(io_ctl);
        if (ret) {
                invalidate_inode_pages2(inode->i_mapping);
                BTRFS_I(inode)->generation = 0;
@@ -1347,6 +1346,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
         * them out later
         */
        io_ctl_drop_pages(io_ctl);
+       io_ctl_free(io_ctl);
 
        unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0,
                             i_size_read(inode) - 1, &cached_state);
index 51fcd82..9570458 100644 (file)
@@ -1610,7 +1610,7 @@ next_slot:
                                goto out_check;
                        ret = btrfs_cross_ref_exist(root, ino,
                                                    found_key.offset -
-                                                   extent_offset, disk_bytenr);
+                                                   extent_offset, disk_bytenr, false);
                        if (ret) {
                                /*
                                 * ret could be -EIO if the above fails to read
@@ -2161,11 +2161,8 @@ static blk_status_t btrfs_submit_bio_start(void *private_data, struct bio *bio,
                                    u64 bio_offset)
 {
        struct inode *inode = private_data;
-       blk_status_t ret = 0;
 
-       ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, 0, 0);
-       BUG_ON(ret); /* -ENOMEM */
-       return 0;
+       return btrfs_csum_one_bio(BTRFS_I(inode), bio, 0, 0);
 }
 
 /*
@@ -6953,6 +6950,8 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode,
  * @orig_start:        (optional) Return the original file offset of the file extent
  * @orig_len:  (optional) Return the original on-disk length of the file extent
  * @ram_bytes: (optional) Return the ram_bytes of the file extent
+ * @strict:    if true, omit optimizations that might force us into unnecessary
+ *             cow. e.g., don't trust generation number.
  *
  * This function will flush ordered extents in the range to ensure proper
  * nocow checks for (nowait == false) case.
@@ -6967,7 +6966,7 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode,
  */
 noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
                              u64 *orig_start, u64 *orig_block_len,
-                             u64 *ram_bytes)
+                             u64 *ram_bytes, bool strict)
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        struct btrfs_path *path;
@@ -7045,8 +7044,9 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
         * Do the same check as in btrfs_cross_ref_exist but without the
         * unnecessary search.
         */
-       if (btrfs_file_extent_generation(leaf, fi) <=
-           btrfs_root_last_snapshot(&root->root_item))
+       if (!strict &&
+           (btrfs_file_extent_generation(leaf, fi) <=
+            btrfs_root_last_snapshot(&root->root_item)))
                goto out;
 
        backref_offset = btrfs_file_extent_offset(leaf, fi);
@@ -7082,7 +7082,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
         */
 
        ret = btrfs_cross_ref_exist(root, btrfs_ino(BTRFS_I(inode)),
-                                   key.offset - backref_offset, disk_bytenr);
+                                   key.offset - backref_offset, disk_bytenr,
+                                   strict);
        if (ret) {
                ret = 0;
                goto out;
@@ -7303,7 +7304,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
                block_start = em->block_start + (start - em->start);
 
                if (can_nocow_extent(inode, start, &len, &orig_start,
-                                    &orig_block_len, &ram_bytes) == 1 &&
+                                    &orig_block_len, &ram_bytes, false) == 1 &&
                    btrfs_inc_nocow_writers(fs_info, block_start)) {
                        struct extent_map *em2;
 
@@ -7619,10 +7620,8 @@ static blk_status_t btrfs_submit_bio_start_direct_io(void *private_data,
                                    struct bio *bio, u64 offset)
 {
        struct inode *inode = private_data;
-       blk_status_t ret;
-       ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, offset, 1);
-       BUG_ON(ret); /* -ENOMEM */
-       return 0;
+
+       return btrfs_csum_one_bio(BTRFS_I(inode), bio, offset, 1);
 }
 
 static void btrfs_end_dio_bio(struct bio *bio)
@@ -10136,7 +10135,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
                free_extent_map(em);
                em = NULL;
 
-               ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL);
+               ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL, true);
                if (ret < 0) {
                        goto out;
                } else if (ret) {
index e529ddb..25967ec 100644 (file)
@@ -625,6 +625,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        } else if (strncmp(args[0].from, "lzo", 3) == 0) {
                                compress_type = "lzo";
                                info->compress_type = BTRFS_COMPRESS_LZO;
+                               info->compress_level = 0;
                                btrfs_set_opt(info->mount_opt, COMPRESS);
                                btrfs_clear_opt(info->mount_opt, NODATACOW);
                                btrfs_clear_opt(info->mount_opt, NODATASUM);
index 696dd86..39da9db 100644 (file)
@@ -3449,11 +3449,13 @@ fail:
        btrfs_free_path(path);
 out_unlock:
        mutex_unlock(&dir->log_mutex);
-       if (ret == -ENOSPC) {
+       if (err == -ENOSPC) {
                btrfs_set_log_full_commit(trans);
-               ret = 0;
-       } else if (ret < 0)
-               btrfs_abort_transaction(trans, ret);
+               err = 0;
+       } else if (err < 0 && err != -ENOENT) {
+               /* ENOENT can be returned if the entry hasn't been fsynced yet */
+               btrfs_abort_transaction(trans, err);
+       }
 
        btrfs_end_log_trans(root);
 
index 061dd20..50bbc99 100644 (file)
@@ -1958,7 +1958,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
                 */
                set_buffer_new(bh);
                set_buffer_unwritten(bh);
-               /* FALLTHRU */
+               fallthrough;
        case IOMAP_MAPPED:
                if ((iomap->flags & IOMAP_F_NEW) ||
                    offset >= i_size_read(inode))
@@ -3157,6 +3157,15 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
        WARN_ON(atomic_read(&bh->b_count) < 1);
        lock_buffer(bh);
        if (test_clear_buffer_dirty(bh)) {
+               /*
+                * The bh should be mapped, but it might not be if the
+                * device was hot-removed. Not much we can do but fail the I/O.
+                */
+               if (!buffer_mapped(bh)) {
+                       unlock_buffer(bh);
+                       return -EIO;
+               }
+
                get_bh(bh);
                bh->b_end_io = end_buffer_write_sync;
                ret = submit_bh(REQ_OP_WRITE, op_flags, bh);
index 55ccccf..034b3f4 100644 (file)
@@ -887,8 +887,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
        int have = ci->i_snap_caps;
 
        if ((have & mask) == mask) {
-               dout("__ceph_caps_issued_mask ino 0x%lx snap issued %s"
-                    " (mask %s)\n", ci->vfs_inode.i_ino,
+               dout("__ceph_caps_issued_mask ino 0x%llx snap issued %s"
+                    " (mask %s)\n", ceph_ino(&ci->vfs_inode),
                     ceph_cap_string(have),
                     ceph_cap_string(mask));
                return 1;
@@ -899,8 +899,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                if (!__cap_is_valid(cap))
                        continue;
                if ((cap->issued & mask) == mask) {
-                       dout("__ceph_caps_issued_mask ino 0x%lx cap %p issued %s"
-                            " (mask %s)\n", ci->vfs_inode.i_ino, cap,
+                       dout("__ceph_caps_issued_mask ino 0x%llx cap %p issued %s"
+                            " (mask %s)\n", ceph_ino(&ci->vfs_inode), cap,
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch)
@@ -911,8 +911,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                /* does a combination of caps satisfy mask? */
                have |= cap->issued;
                if ((have & mask) == mask) {
-                       dout("__ceph_caps_issued_mask ino 0x%lx combo issued %s"
-                            " (mask %s)\n", ci->vfs_inode.i_ino,
+                       dout("__ceph_caps_issued_mask ino 0x%llx combo issued %s"
+                            " (mask %s)\n", ceph_ino(&ci->vfs_inode),
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch) {
@@ -2872,7 +2872,7 @@ int ceph_get_caps(struct file *filp, int need, int want,
                        struct cap_wait cw;
                        DEFINE_WAIT_FUNC(wait, woken_wake_function);
 
-                       cw.ino = inode->i_ino;
+                       cw.ino = ceph_ino(inode);
                        cw.tgid = current->tgid;
                        cw.need = need;
                        cw.want = want;
index 97539b4..3e3fcda 100644 (file)
@@ -202,7 +202,7 @@ static int caps_show_cb(struct inode *inode, struct ceph_cap *cap, void *p)
 {
        struct seq_file *s = p;
 
-       seq_printf(s, "0x%-17lx%-17s%-17s\n", inode->i_ino,
+       seq_printf(s, "0x%-17llx%-17s%-17s\n", ceph_ino(inode),
                   ceph_cap_string(cap->issued),
                   ceph_cap_string(cap->implemented));
        return 0;
@@ -247,7 +247,7 @@ static int caps_show(struct seq_file *s, void *p)
 
        spin_lock(&mdsc->caps_list_lock);
        list_for_each_entry(cw, &mdsc->cap_wait_list, list) {
-               seq_printf(s, "%-13d0x%-17lx%-17s%-17s\n", cw->tgid, cw->ino,
+               seq_printf(s, "%-13d0x%-17llx%-17s%-17s\n", cw->tgid, cw->ino,
                                ceph_cap_string(cw->need),
                                ceph_cap_string(cw->want));
        }
index 060bdcc..d72e4a1 100644 (file)
@@ -259,9 +259,7 @@ static int __dcache_readdir(struct file *file,  struct dir_context *ctx,
                             dentry, dentry, d_inode(dentry));
                        ctx->pos = di->offset;
                        if (!dir_emit(ctx, dentry->d_name.name,
-                                     dentry->d_name.len,
-                                     ceph_translate_ino(dentry->d_sb,
-                                                        d_inode(dentry)->i_ino),
+                                     dentry->d_name.len, ceph_present_inode(d_inode(dentry)),
                                      d_inode(dentry)->i_mode >> 12)) {
                                dput(dentry);
                                err = 0;
@@ -324,18 +322,21 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
        /* always start with . and .. */
        if (ctx->pos == 0) {
                dout("readdir off 0 -> '.'\n");
-               if (!dir_emit(ctx, ".", 1, 
-                           ceph_translate_ino(inode->i_sb, inode->i_ino),
+               if (!dir_emit(ctx, ".", 1, ceph_present_inode(inode),
                            inode->i_mode >> 12))
                        return 0;
                ctx->pos = 1;
        }
        if (ctx->pos == 1) {
-               ino_t ino = parent_ino(file->f_path.dentry);
+               u64 ino;
+               struct dentry *dentry = file->f_path.dentry;
+
+               spin_lock(&dentry->d_lock);
+               ino = ceph_present_inode(dentry->d_parent->d_inode);
+               spin_unlock(&dentry->d_lock);
+
                dout("readdir off 1 -> '..'\n");
-               if (!dir_emit(ctx, "..", 2,
-                           ceph_translate_ino(inode->i_sb, ino),
-                           inode->i_mode >> 12))
+               if (!dir_emit(ctx, "..", 2, ino, inode->i_mode >> 12))
                        return 0;
                ctx->pos = 2;
        }
@@ -507,9 +508,6 @@ more:
        }
        for (; i < rinfo->dir_nr; i++) {
                struct ceph_mds_reply_dir_entry *rde = rinfo->dir_entries + i;
-               struct ceph_vino vino;
-               ino_t ino;
-               u32 ftype;
 
                BUG_ON(rde->offset < ctx->pos);
 
@@ -519,13 +517,10 @@ more:
                     rde->name_len, rde->name, &rde->inode.in);
 
                BUG_ON(!rde->inode.in);
-               ftype = le32_to_cpu(rde->inode.in->mode) >> 12;
-               vino.ino = le64_to_cpu(rde->inode.in->ino);
-               vino.snap = le64_to_cpu(rde->inode.in->snapid);
-               ino = ceph_vino_to_ino(vino);
 
                if (!dir_emit(ctx, rde->name, rde->name_len,
-                             ceph_translate_ino(inode->i_sb, ino), ftype)) {
+                             ceph_present_ino(inode->i_sb, le64_to_cpu(rde->inode.in->ino)),
+                             le32_to_cpu(rde->inode.in->mode) >> 12)) {
                        dout("filldir stopping us...\n");
                        return 0;
                }
@@ -1161,7 +1156,7 @@ retry:
 
        if (try_async && op == CEPH_MDS_OP_UNLINK &&
            (req->r_dir_caps = get_caps_for_async_unlink(dir, dentry))) {
-               dout("async unlink on %lu/%.*s caps=%s", dir->i_ino,
+               dout("async unlink on %llu/%.*s caps=%s", ceph_ino(dir),
                     dentry->d_name.len, dentry->d_name.name,
                     ceph_cap_string(req->r_dir_caps));
                set_bit(CEPH_MDS_R_ASYNC, &req->r_req_flags);
@@ -1745,7 +1740,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
                        case -ENOENT:
                                if (d_really_is_negative(dentry))
                                        valid = 1;
-                               /* Fallthrough */
+                               fallthrough;
                        default:
                                break;
                        }
index d51c3f2..3f4c993 100644 (file)
@@ -252,7 +252,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
        case S_IFREG:
                ceph_fscache_register_inode_cookie(inode);
                ceph_fscache_file_set_cookie(inode, file);
-               /* fall through */
+               fallthrough;
        case S_IFDIR:
                ret = ceph_init_file_info(inode, file, fmode,
                                                S_ISDIR(inode->i_mode));
@@ -630,8 +630,8 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
        } else {
                struct dentry *dn;
 
-               dout("%s d_adding new inode 0x%llx to 0x%lx/%s\n", __func__,
-                       vino.ino, dir->i_ino, dentry->d_name.name);
+               dout("%s d_adding new inode 0x%llx to 0x%llx/%s\n", __func__,
+                       vino.ino, ceph_ino(dir), dentry->d_name.name);
                ceph_dir_clear_ordered(dir);
                ceph_init_inode_acls(inode, as_ctx);
                if (inode->i_state & I_NEW) {
@@ -2507,6 +2507,7 @@ const struct file_operations ceph_file_fops = {
        .mmap = ceph_mmap,
        .fsync = ceph_fsync,
        .lock = ceph_lock,
+       .setlease = simple_nosetlease,
        .flock = ceph_flock,
        .splice_read = generic_file_splice_read,
        .splice_write = iter_file_splice_write,
index 357c937..d163fa9 100644 (file)
@@ -41,8 +41,10 @@ static void ceph_inode_work(struct work_struct *work);
  */
 static int ceph_set_ino_cb(struct inode *inode, void *data)
 {
-       ceph_inode(inode)->i_vino = *(struct ceph_vino *)data;
-       inode->i_ino = ceph_vino_to_ino(*(struct ceph_vino *)data);
+       struct ceph_inode_info *ci = ceph_inode(inode);
+
+       ci->i_vino = *(struct ceph_vino *)data;
+       inode->i_ino = ceph_vino_to_ino_t(ci->i_vino);
        inode_set_iversion_raw(inode, 0);
        return 0;
 }
@@ -50,17 +52,14 @@ static int ceph_set_ino_cb(struct inode *inode, void *data)
 struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino)
 {
        struct inode *inode;
-       ino_t t = ceph_vino_to_ino(vino);
 
-       inode = iget5_locked(sb, t, ceph_ino_compare, ceph_set_ino_cb, &vino);
+       inode = iget5_locked(sb, (unsigned long)vino.ino, ceph_ino_compare,
+                            ceph_set_ino_cb, &vino);
        if (!inode)
                return ERR_PTR(-ENOMEM);
-       if (inode->i_state & I_NEW)
-               dout("get_inode created new inode %p %llx.%llx ino %llx\n",
-                    inode, ceph_vinop(inode), (u64)inode->i_ino);
 
-       dout("get_inode on %lu=%llx.%llx got %p\n", inode->i_ino, vino.ino,
-            vino.snap, inode);
+       dout("get_inode on %llu=%llx.%llx got %p new %d\n", ceph_present_inode(inode),
+            ceph_vinop(inode), inode, !!(inode->i_state & I_NEW));
        return inode;
 }
 
@@ -2378,7 +2377,7 @@ int ceph_getattr(const struct path *path, struct kstat *stat,
        }
 
        generic_fillattr(inode, stat);
-       stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
+       stat->ino = ceph_present_inode(inode);
 
        /*
         * btime on newly-allocated inodes is 0, so if this is still set to
index bc9e959..6588006 100644 (file)
@@ -372,7 +372,7 @@ struct ceph_quotarealm_inode {
 
 struct cap_wait {
        struct list_head        list;
-       unsigned long           ino;
+       u64                     ino;
        pid_t                   tgid;
        int                     need;
        int                     want;
index 198ddde..cc2c4d4 100644 (file)
@@ -23,12 +23,12 @@ static inline bool ceph_has_realms_with_quotas(struct inode *inode)
 {
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        struct super_block *sb = mdsc->fsc->sb;
+       struct inode *root = d_inode(sb->s_root);
 
        if (atomic64_read(&mdsc->quotarealms_count) > 0)
                return true;
        /* if root is the real CephFS root, we don't have quota realms */
-       if (sb->s_root->d_inode &&
-           (sb->s_root->d_inode->i_ino == CEPH_INO_ROOT))
+       if (root && ceph_ino(root) == CEPH_INO_ROOT)
                return false;
        /* otherwise, we can't know for sure */
        return true;
index 4c3c964..a3995eb 100644 (file)
@@ -457,15 +457,7 @@ ceph_vino(const struct inode *inode)
        return ceph_inode(inode)->i_vino;
 }
 
-/*
- * ino_t is <64 bits on many architectures, blech.
- *
- *               i_ino (kernel inode)   st_ino (userspace)
- * i386          32                     32
- * x86_64+ino32  64                     32
- * x86_64        64                     64
- */
-static inline u32 ceph_ino_to_ino32(__u64 vino)
+static inline u32 ceph_ino_to_ino32(u64 vino)
 {
        u32 ino = vino & 0xffffffff;
        ino ^= vino >> 32;
@@ -475,34 +467,17 @@ static inline u32 ceph_ino_to_ino32(__u64 vino)
 }
 
 /*
- * kernel i_ino value
+ * Inode numbers in cephfs are 64 bits, but inode->i_ino is 32-bits on
+ * some arches. We generally do not use this value inside the ceph driver, but
+ * we do want to set it to something, so that generic vfs code has an
+ * appropriate value for tracepoints and the like.
  */
-static inline ino_t ceph_vino_to_ino(struct ceph_vino vino)
+static inline ino_t ceph_vino_to_ino_t(struct ceph_vino vino)
 {
-#if BITS_PER_LONG == 32
-       return ceph_ino_to_ino32(vino.ino);
-#else
+       if (sizeof(ino_t) == sizeof(u32))
+               return ceph_ino_to_ino32(vino.ino);
        return (ino_t)vino.ino;
-#endif
-}
-
-/*
- * user-visible ino (stat, filldir)
- */
-#if BITS_PER_LONG == 32
-static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
-{
-       return ino;
-}
-#else
-static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
-{
-       if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))
-               ino = ceph_ino_to_ino32(ino);
-       return ino;
 }
-#endif
-
 
 /* for printf-style formatting */
 #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap
@@ -511,11 +486,34 @@ static inline u64 ceph_ino(struct inode *inode)
 {
        return ceph_inode(inode)->i_vino.ino;
 }
+
 static inline u64 ceph_snap(struct inode *inode)
 {
        return ceph_inode(inode)->i_vino.snap;
 }
 
+/**
+ * ceph_present_ino - format an inode number for presentation to userland
+ * @sb: superblock where the inode lives
+ * @ino: inode number to (possibly) convert
+ *
+ * If the user mounted with the ino32 option, then the 64-bit value needs
+ * to be converted to something that can fit inside 32 bits. Note that
+ * internal kernel code never uses this value, so this is entirely for
+ * userland consumption.
+ */
+static inline u64 ceph_present_ino(struct super_block *sb, u64 ino)
+{
+       if (unlikely(ceph_test_mount_opt(ceph_sb_to_client(sb), INO32)))
+               return ceph_ino_to_ino32(ino);
+       return ino;
+}
+
+static inline u64 ceph_present_inode(struct inode *inode)
+{
+       return ceph_present_ino(inode->i_sb, ceph_ino(inode));
+}
+
 static inline int ceph_ino_compare(struct inode *inode, void *data)
 {
        struct ceph_vino *pvino = (struct ceph_vino *)data;
@@ -524,11 +522,16 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
                ci->i_vino.snap == pvino->snap;
 }
 
+
 static inline struct inode *ceph_find_inode(struct super_block *sb,
                                            struct ceph_vino vino)
 {
-       ino_t t = ceph_vino_to_ino(vino);
-       return ilookup5(sb, t, ceph_ino_compare, &vino);
+       /*
+        * NB: The hashval will be run through the fs/inode.c hash function
+        * anyway, so there is no need to squash the inode number down to
+        * 32-bits first. Just use low-order bits on arches with 32-bit long.
+        */
+       return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino);
 }
 
 
index b296964..b565d83 100644 (file)
@@ -2031,4 +2031,19 @@ static inline bool is_smb1_server(struct TCP_Server_Info *server)
        return strcmp(server->vals->version_string, SMB1_VERSION_STRING) == 0;
 }
 
+static inline bool is_tcon_dfs(struct cifs_tcon *tcon)
+{
+       /*
+        * For SMB1, see MS-CIFS 2.4.55 SMB_COM_TREE_CONNECT_ANDX (0x75) and MS-CIFS 3.3.4.4 DFS
+        * Subsystem Notifies That a Share Is a DFS Share.
+        *
+        * For SMB2+, see MS-SMB2 2.2.10 SMB2 TREE_CONNECT Response and MS-SMB2 3.3.4.14 Server
+        * Application Updates a Share.
+        */
+       if (!tcon || !tcon->ses || !tcon->ses->server)
+               return false;
+       return is_smb1_server(tcon->ses->server) ? tcon->Flags & SMB_SHARE_IS_IN_DFS :
+               tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT);
+}
+
 #endif /* _CIFS_GLOB_H */
index 0e763d2..0496934 100644 (file)
@@ -581,7 +581,7 @@ should_set_ext_sec_flag(enum securityEnum sectype)
                if (global_secflags &
                    (CIFSSEC_MAY_KRB5 | CIFSSEC_MAY_NTLMSSP))
                        return true;
-               /* Fallthrough */
+               fallthrough;
        default:
                return false;
        }
index a275ee3..a5731dd 100644 (file)
@@ -1378,25 +1378,25 @@ static int cifs_parse_security_flavors(char *value,
                return 1;
        case Opt_sec_krb5i:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_sec_krb5:
                vol->sectype = Kerberos;
                break;
        case Opt_sec_ntlmsspi:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_sec_ntlmssp:
                vol->sectype = RawNTLMSSP;
                break;
        case Opt_sec_ntlmi:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_ntlm:
                vol->sectype = NTLM;
                break;
        case Opt_sec_ntlmv2i:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_sec_ntlmv2:
                vol->sectype = NTLMv2;
                break;
@@ -2187,7 +2187,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
                                vol->password = NULL;
                                break;
                        }
-                       /* Fallthrough - to Opt_pass below.*/
+                       fallthrough;    /* to Opt_pass below */
                case Opt_pass:
                        /* Obtain the value string */
                        value = strchr(data, '=');
@@ -4909,7 +4909,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol)
                if (!tcon)
                        continue;
                /* Make sure that requests go through new root servers */
-               if (tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT)) {
+               if (is_tcon_dfs(tcon)) {
                        put_root_ses(root_ses);
                        set_root_ses(cifs_sb, ses, &root_ses);
                }
index 69cd585..de56436 100644 (file)
@@ -798,7 +798,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                        if ((server->sec_kerberos || server->sec_mskerberos) &&
                            (global_secflags & CIFSSEC_MAY_KRB5))
                                return Kerberos;
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        return Unspecified;
                }
@@ -815,7 +815,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                default:
                        break;
                }
-               /* Fallthrough - to attempt LANMAN authentication next */
+               fallthrough;    /* to attempt LANMAN authentication next */
        case CIFS_NEGFLAVOR_LANMAN:
                switch (requested) {
                case LANMAN:
@@ -823,7 +823,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                case Unspecified:
                        if (global_secflags & CIFSSEC_MAY_LANMAN)
                                return LANMAN;
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        return Unspecified;
                }
index 667d70a..96c172d 100644 (file)
@@ -1101,7 +1101,7 @@ smb2_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                if ((server->sec_kerberos || server->sec_mskerberos) &&
                        (global_secflags & CIFSSEC_MAY_KRB5))
                        return Kerberos;
-               /* Fallthrough */
+               fallthrough;
        default:
                return Unspecified;
        }
index cb73365..ca22737 100644 (file)
@@ -1688,11 +1688,11 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
                case 1:
                        offset += file->f_pos;
-                       /* fall through */
+                       fallthrough;
                case 0:
                        if (offset >= 0)
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
        }
index 95341af..994ab66 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1367,7 +1367,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
                        ret = dax_load_hole(&xas, mapping, &entry, vmf);
                        goto finish_iomap;
                }
-               /*FALLTHRU*/
+               fallthrough;
        default:
                WARN_ON_ONCE(1);
                error = -EIO;
index 18d8159..002123e 100644 (file)
@@ -5817,7 +5817,7 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua,
                break;
        case -EAGAIN:
                error = 0;
-               /* fall through */
+               fallthrough;
        default:
                __put_lkb(ls, lkb);
                goto out;
index 7d40d78..ae32554 100644 (file)
@@ -359,7 +359,7 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m,
                return z_erofs_extent_lookback(m, m->delta[0]);
        case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN:
                map->m_flags &= ~EROFS_MAP_ZIPPED;
-               /* fallthrough */
+               fallthrough;
        case Z_EROFS_VLE_CLUSTER_TYPE_HEAD:
                map->m_la = (lcn << lclusterbits) | m->clusterofs;
                break;
@@ -416,7 +416,7 @@ int z_erofs_map_blocks_iter(struct inode *inode,
        case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN:
                if (endoff >= m.clusterofs)
                        map->m_flags &= ~EROFS_MAP_ZIPPED;
-               /* fallthrough */
+               fallthrough;
        case Z_EROFS_VLE_CLUSTER_TYPE_HEAD:
                if (endoff >= m.clusterofs) {
                        map->m_la = (m.lcn << lclusterbits) | m.clusterofs;
@@ -433,7 +433,7 @@ int z_erofs_map_blocks_iter(struct inode *inode,
                end = (m.lcn << lclusterbits) | m.clusterofs;
                map->m_flags |= EROFS_MAP_FULL_MAPPED;
                m.delta[0] = 1;
-               /* fallthrough */
+               fallthrough;
        case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD:
                /* get the correspoinding first chunk */
                err = z_erofs_extent_lookback(&m, m.delta[0]);
index 12eebcd..e0decff 100644 (file)
@@ -1994,9 +1994,11 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
                         * not already there, and calling reverse_path_check()
                         * during ep_insert().
                         */
-                       if (list_empty(&epi->ffd.file->f_tfile_llink))
+                       if (list_empty(&epi->ffd.file->f_tfile_llink)) {
+                               get_file(epi->ffd.file);
                                list_add(&epi->ffd.file->f_tfile_llink,
                                         &tfile_check_list);
+                       }
                }
        }
        mutex_unlock(&ep->mtx);
@@ -2040,6 +2042,7 @@ static void clear_tfile_check_list(void)
                file = list_first_entry(&tfile_check_list, struct file,
                                        f_tfile_llink);
                list_del_init(&file->f_tfile_llink);
+               fput(file);
        }
        INIT_LIST_HEAD(&tfile_check_list);
 }
@@ -2200,25 +2203,22 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
                        full_check = 1;
                        if (is_file_epoll(tf.file)) {
                                error = -ELOOP;
-                               if (ep_loop_check(ep, tf.file) != 0) {
-                                       clear_tfile_check_list();
+                               if (ep_loop_check(ep, tf.file) != 0)
                                        goto error_tgt_fput;
-                               }
-                       } else
+                       } else {
+                               get_file(tf.file);
                                list_add(&tf.file->f_tfile_llink,
                                                        &tfile_check_list);
+                       }
                        error = epoll_mutex_lock(&ep->mtx, 0, nonblock);
-                       if (error) {
-out_del:
-                               list_del(&tf.file->f_tfile_llink);
+                       if (error)
                                goto error_tgt_fput;
-                       }
                        if (is_file_epoll(tf.file)) {
                                tep = tf.file->private_data;
                                error = epoll_mutex_lock(&tep->mtx, 1, nonblock);
                                if (error) {
                                        mutex_unlock(&ep->mtx);
-                                       goto out_del;
+                                       goto error_tgt_fput;
                                }
                        }
                }
@@ -2239,8 +2239,6 @@ out_del:
                        error = ep_insert(ep, epds, tf.file, fd, full_check);
                } else
                        error = -EEXIST;
-               if (full_check)
-                       clear_tfile_check_list();
                break;
        case EPOLL_CTL_DEL:
                if (epi)
@@ -2263,8 +2261,10 @@ out_del:
        mutex_unlock(&ep->mtx);
 
 error_tgt_fput:
-       if (full_check)
+       if (full_check) {
+               clear_tfile_check_list();
                mutex_unlock(&epmutex);
+       }
 
        fdput(tf);
 error_fput:
index 80662e1..415c21f 100644 (file)
@@ -1241,7 +1241,7 @@ do_indirects:
                                mark_inode_dirty(inode);
                                ext2_free_branches(inode, &nr, &nr+1, 1);
                        }
-                       /* fall through */
+                       fallthrough;
                case EXT2_IND_BLOCK:
                        nr = i_data[EXT2_DIND_BLOCK];
                        if (nr) {
@@ -1249,7 +1249,7 @@ do_indirects:
                                mark_inode_dirty(inode);
                                ext2_free_branches(inode, &nr, &nr+1, 2);
                        }
-                       /* fall through */
+                       fallthrough;
                case EXT2_DIND_BLOCK:
                        nr = i_data[EXT2_TIND_BLOCK];
                        if (nr) {
index dda8605..7fab2b3 100644 (file)
@@ -587,7 +587,7 @@ static int parse_options(char *options, struct super_block *sb,
                case Opt_xip:
                        ext2_msg(sb, KERN_INFO, "use dax instead of xip");
                        set_opt(opts->s_mount_opt, XIP);
-                       /* Fall through */
+                       fallthrough;
                case Opt_dax:
 #ifdef CONFIG_FS_DAX
                        ext2_msg(sb, KERN_WARNING,
index 1afa5a4..619dd35 100644 (file)
@@ -110,7 +110,7 @@ config EXT4_KUNIT_TESTS
          This builds the ext4 KUnit tests.
 
          KUnit tests run during boot and output the results to the debug log
-         in TAP format (http://testanything.org/). Only useful for kernel devs
+         in TAP format (https://testanything.org/). Only useful for kernel devs
          running KUnit test harness and are not for inclusion into a production
          build.
 
index 1ba46d8..48c3df4 100644 (file)
@@ -413,7 +413,8 @@ verified:
  * Return buffer_head on success or an ERR_PTR in case of failure.
  */
 struct buffer_head *
-ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
+ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group,
+                             bool ignore_locked)
 {
        struct ext4_group_desc *desc;
        struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -441,6 +442,12 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
                return ERR_PTR(-ENOMEM);
        }
 
+       if (ignore_locked && buffer_locked(bh)) {
+               /* buffer under IO already, return if called for prefetching */
+               put_bh(bh);
+               return NULL;
+       }
+
        if (bitmap_uptodate(bh))
                goto verify;
 
@@ -487,10 +494,11 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
         * submit the buffer_head for reading
         */
        set_buffer_new(bh);
-       trace_ext4_read_block_bitmap_load(sb, block_group);
+       trace_ext4_read_block_bitmap_load(sb, block_group, ignore_locked);
        bh->b_end_io = ext4_end_bitmap_read;
        get_bh(bh);
-       submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
+       submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO |
+                 (ignore_locked ? REQ_RAHEAD : 0), bh);
        return bh;
 verify:
        err = ext4_validate_block_bitmap(sb, desc, block_group, bh);
@@ -534,7 +542,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
        struct buffer_head *bh;
        int err;
 
-       bh = ext4_read_block_bitmap_nowait(sb, block_group);
+       bh = ext4_read_block_bitmap_nowait(sb, block_group, false);
        if (IS_ERR(bh))
                return bh;
        err = ext4_wait_block_bitmap(sb, block_group, bh);
index 16e9b2f..c54ba52 100644 (file)
@@ -24,6 +24,7 @@ struct ext4_system_zone {
        struct rb_node  node;
        ext4_fsblk_t    start_blk;
        unsigned int    count;
+       u32             ino;
 };
 
 static struct kmem_cache *ext4_system_zone_cachep;
@@ -45,7 +46,8 @@ void ext4_exit_system_zone(void)
 static inline int can_merge(struct ext4_system_zone *entry1,
                     struct ext4_system_zone *entry2)
 {
-       if ((entry1->start_blk + entry1->count) == entry2->start_blk)
+       if ((entry1->start_blk + entry1->count) == entry2->start_blk &&
+           entry1->ino == entry2->ino)
                return 1;
        return 0;
 }
@@ -66,9 +68,9 @@ static void release_system_zone(struct ext4_system_blocks *system_blks)
  */
 static int add_system_zone(struct ext4_system_blocks *system_blks,
                           ext4_fsblk_t start_blk,
-                          unsigned int count)
+                          unsigned int count, u32 ino)
 {
-       struct ext4_system_zone *new_entry = NULL, *entry;
+       struct ext4_system_zone *new_entry, *entry;
        struct rb_node **n = &system_blks->root.rb_node, *node;
        struct rb_node *parent = NULL, *new_node = NULL;
 
@@ -79,30 +81,21 @@ static int add_system_zone(struct ext4_system_blocks *system_blks,
                        n = &(*n)->rb_left;
                else if (start_blk >= (entry->start_blk + entry->count))
                        n = &(*n)->rb_right;
-               else {
-                       if (start_blk + count > (entry->start_blk +
-                                                entry->count))
-                               entry->count = (start_blk + count -
-                                               entry->start_blk);
-                       new_node = *n;
-                       new_entry = rb_entry(new_node, struct ext4_system_zone,
-                                            node);
-                       break;
-               }
+               else    /* Unexpected overlap of system zones. */
+                       return -EFSCORRUPTED;
        }
 
-       if (!new_entry) {
-               new_entry = kmem_cache_alloc(ext4_system_zone_cachep,
-                                            GFP_KERNEL);
-               if (!new_entry)
-                       return -ENOMEM;
-               new_entry->start_blk = start_blk;
-               new_entry->count = count;
-               new_node = &new_entry->node;
-
-               rb_link_node(new_node, parent, n);
-               rb_insert_color(new_node, &system_blks->root);
-       }
+       new_entry = kmem_cache_alloc(ext4_system_zone_cachep,
+                                    GFP_KERNEL);
+       if (!new_entry)
+               return -ENOMEM;
+       new_entry->start_blk = start_blk;
+       new_entry->count = count;
+       new_entry->ino = ino;
+       new_node = &new_entry->node;
+
+       rb_link_node(new_node, parent, n);
+       rb_insert_color(new_node, &system_blks->root);
 
        /* Can we merge to the left? */
        node = rb_prev(new_node);
@@ -151,40 +144,6 @@ static void debug_print_tree(struct ext4_sb_info *sbi)
        printk(KERN_CONT "\n");
 }
 
-/*
- * Returns 1 if the passed-in block region (start_blk,
- * start_blk+count) is valid; 0 if some part of the block region
- * overlaps with filesystem metadata blocks.
- */
-static int ext4_data_block_valid_rcu(struct ext4_sb_info *sbi,
-                                    struct ext4_system_blocks *system_blks,
-                                    ext4_fsblk_t start_blk,
-                                    unsigned int count)
-{
-       struct ext4_system_zone *entry;
-       struct rb_node *n;
-
-       if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
-           (start_blk + count < start_blk) ||
-           (start_blk + count > ext4_blocks_count(sbi->s_es)))
-               return 0;
-
-       if (system_blks == NULL)
-               return 1;
-
-       n = system_blks->root.rb_node;
-       while (n) {
-               entry = rb_entry(n, struct ext4_system_zone, node);
-               if (start_blk + count - 1 < entry->start_blk)
-                       n = n->rb_left;
-               else if (start_blk >= (entry->start_blk + entry->count))
-                       n = n->rb_right;
-               else
-                       return 0;
-       }
-       return 1;
-}
-
 static int ext4_protect_reserved_inode(struct super_block *sb,
                                       struct ext4_system_blocks *system_blks,
                                       u32 ino)
@@ -214,19 +173,18 @@ static int ext4_protect_reserved_inode(struct super_block *sb,
                if (n == 0) {
                        i++;
                } else {
-                       if (!ext4_data_block_valid_rcu(sbi, system_blks,
-                                               map.m_pblk, n)) {
-                               err = -EFSCORRUPTED;
-                               __ext4_error(sb, __func__, __LINE__, -err,
-                                            map.m_pblk, "blocks %llu-%llu "
-                                            "from inode %u overlap system zone",
-                                            map.m_pblk,
-                                            map.m_pblk + map.m_len - 1, ino);
+                       err = add_system_zone(system_blks, map.m_pblk, n, ino);
+                       if (err < 0) {
+                               if (err == -EFSCORRUPTED) {
+                                       __ext4_error(sb, __func__, __LINE__,
+                                                    -err, map.m_pblk,
+                                                    "blocks %llu-%llu from inode %u overlap system zone",
+                                                    map.m_pblk,
+                                                    map.m_pblk + map.m_len - 1,
+                                                    ino);
+                               }
                                break;
                        }
-                       err = add_system_zone(system_blks, map.m_pblk, n);
-                       if (err < 0)
-                               break;
                        i += n;
                }
        }
@@ -262,14 +220,6 @@ int ext4_setup_system_zone(struct super_block *sb)
        int flex_size = ext4_flex_bg_size(sbi);
        int ret;
 
-       if (!test_opt(sb, BLOCK_VALIDITY)) {
-               if (sbi->system_blks)
-                       ext4_release_system_zone(sb);
-               return 0;
-       }
-       if (sbi->system_blks)
-               return 0;
-
        system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL);
        if (!system_blks)
                return -ENOMEM;
@@ -277,22 +227,25 @@ int ext4_setup_system_zone(struct super_block *sb)
        for (i=0; i < ngroups; i++) {
                cond_resched();
                if (ext4_bg_has_super(sb, i) &&
-                   ((i < 5) || ((i % flex_size) == 0)))
-                       add_system_zone(system_blks,
+                   ((i < 5) || ((i % flex_size) == 0))) {
+                       ret = add_system_zone(system_blks,
                                        ext4_group_first_block_no(sb, i),
-                                       ext4_bg_num_gdb(sb, i) + 1);
+                                       ext4_bg_num_gdb(sb, i) + 1, 0);
+                       if (ret)
+                               goto err;
+               }
                gdp = ext4_get_group_desc(sb, i, NULL);
                ret = add_system_zone(system_blks,
-                               ext4_block_bitmap(sb, gdp), 1);
+                               ext4_block_bitmap(sb, gdp), 1, 0);
                if (ret)
                        goto err;
                ret = add_system_zone(system_blks,
-                               ext4_inode_bitmap(sb, gdp), 1);
+                               ext4_inode_bitmap(sb, gdp), 1, 0);
                if (ret)
                        goto err;
                ret = add_system_zone(system_blks,
                                ext4_inode_table(sb, gdp),
-                               sbi->s_itb_per_group);
+                               sbi->s_itb_per_group, 0);
                if (ret)
                        goto err;
        }
@@ -341,11 +294,24 @@ void ext4_release_system_zone(struct super_block *sb)
                call_rcu(&system_blks->rcu, ext4_destroy_system_zone);
 }
 
-int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
+/*
+ * Returns 1 if the passed-in block region (start_blk,
+ * start_blk+count) is valid; 0 if some part of the block region
+ * overlaps with some other filesystem metadata blocks.
+ */
+int ext4_inode_block_valid(struct inode *inode, ext4_fsblk_t start_blk,
                          unsigned int count)
 {
+       struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
        struct ext4_system_blocks *system_blks;
-       int ret;
+       struct ext4_system_zone *entry;
+       struct rb_node *n;
+       int ret = 1;
+
+       if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
+           (start_blk + count < start_blk) ||
+           (start_blk + count > ext4_blocks_count(sbi->s_es)))
+               return 0;
 
        /*
         * Lock the system zone to prevent it being released concurrently
@@ -354,8 +320,22 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
         */
        rcu_read_lock();
        system_blks = rcu_dereference(sbi->system_blks);
-       ret = ext4_data_block_valid_rcu(sbi, system_blks, start_blk,
-                                       count);
+       if (system_blks == NULL)
+               goto out_rcu;
+
+       n = system_blks->root.rb_node;
+       while (n) {
+               entry = rb_entry(n, struct ext4_system_zone, node);
+               if (start_blk + count - 1 < entry->start_blk)
+                       n = n->rb_left;
+               else if (start_blk >= (entry->start_blk + entry->count))
+                       n = n->rb_right;
+               else {
+                       ret = (entry->ino == inode->i_ino);
+                       break;
+               }
+       }
+out_rcu:
        rcu_read_unlock();
        return ret;
 }
@@ -374,8 +354,7 @@ int ext4_check_blockref(const char *function, unsigned int line,
        while (bref < p+max) {
                blk = le32_to_cpu(*bref++);
                if (blk &&
-                   unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb),
-                                                   blk, 1))) {
+                   unlikely(!ext4_inode_block_valid(inode, blk, 1))) {
                        ext4_error_inode(inode, function, line, blk,
                                         "invalid block");
                        return -EFSCORRUPTED;
index 42f5060..523e00d 100644 (file)
@@ -434,10 +434,36 @@ struct flex_groups {
 #define EXT4_CASEFOLD_FL               0x40000000 /* Casefolded directory */
 #define EXT4_RESERVED_FL               0x80000000 /* reserved for ext4 lib */
 
-#define EXT4_FL_USER_VISIBLE           0x725BDFFF /* User visible flags */
-#define EXT4_FL_USER_MODIFIABLE                0x624BC0FF /* User modifiable flags */
-
-/* Flags we can manipulate with through EXT4_IOC_FSSETXATTR */
+/* User modifiable flags */
+#define EXT4_FL_USER_MODIFIABLE                (EXT4_SECRM_FL | \
+                                        EXT4_UNRM_FL | \
+                                        EXT4_COMPR_FL | \
+                                        EXT4_SYNC_FL | \
+                                        EXT4_IMMUTABLE_FL | \
+                                        EXT4_APPEND_FL | \
+                                        EXT4_NODUMP_FL | \
+                                        EXT4_NOATIME_FL | \
+                                        EXT4_JOURNAL_DATA_FL | \
+                                        EXT4_NOTAIL_FL | \
+                                        EXT4_DIRSYNC_FL | \
+                                        EXT4_TOPDIR_FL | \
+                                        EXT4_EXTENTS_FL | \
+                                        0x00400000 /* EXT4_EOFBLOCKS_FL */ | \
+                                        EXT4_DAX_FL | \
+                                        EXT4_PROJINHERIT_FL | \
+                                        EXT4_CASEFOLD_FL)
+
+/* User visible flags */
+#define EXT4_FL_USER_VISIBLE           (EXT4_FL_USER_MODIFIABLE | \
+                                        EXT4_DIRTY_FL | \
+                                        EXT4_COMPRBLK_FL | \
+                                        EXT4_NOCOMPR_FL | \
+                                        EXT4_ENCRYPT_FL | \
+                                        EXT4_INDEX_FL | \
+                                        EXT4_VERITY_FL | \
+                                        EXT4_INLINE_DATA_FL)
+
+/* Flags we can manipulate with through FS_IOC_FSSETXATTR */
 #define EXT4_FL_XFLAG_VISIBLE          (EXT4_SYNC_FL | \
                                         EXT4_IMMUTABLE_FL | \
                                         EXT4_APPEND_FL | \
@@ -669,8 +695,6 @@ enum {
 /*
  * ioctl commands
  */
-#define        EXT4_IOC_GETFLAGS               FS_IOC_GETFLAGS
-#define        EXT4_IOC_SETFLAGS               FS_IOC_SETFLAGS
 #define        EXT4_IOC_GETVERSION             _IOR('f', 3, long)
 #define        EXT4_IOC_SETVERSION             _IOW('f', 4, long)
 #define        EXT4_IOC_GETVERSION_OLD         FS_IOC_GETVERSION
@@ -687,17 +711,11 @@ enum {
 #define EXT4_IOC_RESIZE_FS             _IOW('f', 16, __u64)
 #define EXT4_IOC_SWAP_BOOT             _IO('f', 17)
 #define EXT4_IOC_PRECACHE_EXTENTS      _IO('f', 18)
-#define EXT4_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
-#define EXT4_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
-#define EXT4_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
 /* ioctl codes 19--39 are reserved for fscrypt */
 #define EXT4_IOC_CLEAR_ES_CACHE                _IO('f', 40)
 #define EXT4_IOC_GETSTATE              _IOW('f', 41, __u32)
 #define EXT4_IOC_GET_ES_CACHE          _IOWR('f', 42, struct fiemap)
 
-#define EXT4_IOC_FSGETXATTR            FS_IOC_FSGETXATTR
-#define EXT4_IOC_FSSETXATTR            FS_IOC_FSSETXATTR
-
 #define EXT4_IOC_SHUTDOWN _IOR ('X', 125, __u32)
 
 /*
@@ -722,8 +740,6 @@ enum {
 /*
  * ioctl commands in 32 bit emulation
  */
-#define EXT4_IOC32_GETFLAGS            FS_IOC32_GETFLAGS
-#define EXT4_IOC32_SETFLAGS            FS_IOC32_SETFLAGS
 #define EXT4_IOC32_GETVERSION          _IOR('f', 3, int)
 #define EXT4_IOC32_SETVERSION          _IOW('f', 4, int)
 #define EXT4_IOC32_GETRSVSZ            _IOR('f', 5, int)
@@ -1054,6 +1070,7 @@ struct ext4_inode_info {
        struct timespec64 i_crtime;
 
        /* mballoc */
+       atomic_t i_prealloc_active;
        struct list_head i_prealloc_list;
        spinlock_t i_prealloc_lock;
 
@@ -1172,6 +1189,7 @@ struct ext4_inode_info {
 #define EXT4_MOUNT_JOURNAL_CHECKSUM    0x800000 /* Journal checksums */
 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT        0x1000000 /* Journal Async Commit */
 #define EXT4_MOUNT_WARN_ON_ERROR       0x2000000 /* Trigger WARN_ON on error */
+#define EXT4_MOUNT_PREFETCH_BLOCK_BITMAPS 0x4000000
 #define EXT4_MOUNT_DELALLOC            0x8000000 /* Delalloc support */
 #define EXT4_MOUNT_DATA_ERR_ABORT      0x10000000 /* Abort on file data write */
 #define EXT4_MOUNT_BLOCK_VALIDITY      0x20000000 /* Block validity checking */
@@ -1501,10 +1519,13 @@ struct ext4_sb_info {
        unsigned int s_mb_stats;
        unsigned int s_mb_order2_reqs;
        unsigned int s_mb_group_prealloc;
+       unsigned int s_mb_max_inode_prealloc;
        unsigned int s_max_dir_size_kb;
        /* where last allocation was done - for stream allocation */
        unsigned long s_mb_last_group;
        unsigned long s_mb_last_start;
+       unsigned int s_mb_prefetch;
+       unsigned int s_mb_prefetch_limit;
 
        /* stats for buddy allocator */
        atomic_t s_bal_reqs;    /* number of reqs with len > 1 */
@@ -1572,6 +1593,8 @@ struct ext4_sb_info {
        struct ratelimit_state s_err_ratelimit_state;
        struct ratelimit_state s_warning_ratelimit_state;
        struct ratelimit_state s_msg_ratelimit_state;
+       atomic_t s_warning_count;
+       atomic_t s_msg_count;
 
        /* Encryption context for '-o test_dummy_encryption' */
        struct fscrypt_dummy_context s_dummy_enc_ctx;
@@ -1585,6 +1608,9 @@ struct ext4_sb_info {
 #ifdef CONFIG_EXT4_DEBUG
        unsigned long s_simulate_fail;
 #endif
+       /* Record the errseq of the backing block device */
+       errseq_t s_bdev_wb_err;
+       spinlock_t s_bdev_wb_lock;
 };
 
 static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)
@@ -2313,9 +2339,15 @@ struct ext4_lazy_init {
        struct mutex            li_list_mtx;
 };
 
+enum ext4_li_mode {
+       EXT4_LI_MODE_PREFETCH_BBITMAP,
+       EXT4_LI_MODE_ITABLE,
+};
+
 struct ext4_li_request {
        struct super_block      *lr_super;
-       struct ext4_sb_info     *lr_sbi;
+       enum ext4_li_mode       lr_mode;
+       ext4_group_t            lr_first_not_zeroed;
        ext4_group_t            lr_next_group;
        struct list_head        lr_request;
        unsigned long           lr_next_sched;
@@ -2446,7 +2478,8 @@ extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
 extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
 
 extern struct buffer_head *ext4_read_block_bitmap_nowait(struct super_block *sb,
-                                               ext4_group_t block_group);
+                                               ext4_group_t block_group,
+                                               bool ignore_locked);
 extern int ext4_wait_block_bitmap(struct super_block *sb,
                                  ext4_group_t block_group,
                                  struct buffer_head *bh);
@@ -2651,9 +2684,15 @@ extern int ext4_mb_release(struct super_block *);
 extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
                                struct ext4_allocation_request *, int *);
 extern int ext4_mb_reserve_blocks(struct super_block *, int);
-extern void ext4_discard_preallocations(struct inode *);
+extern void ext4_discard_preallocations(struct inode *, unsigned int);
 extern int __init ext4_init_mballoc(void);
 extern void ext4_exit_mballoc(void);
+extern ext4_group_t ext4_mb_prefetch(struct super_block *sb,
+                                    ext4_group_t group,
+                                    unsigned int nr, int *cnt);
+extern void ext4_mb_prefetch_fini(struct super_block *sb, ext4_group_t group,
+                                 unsigned int nr);
+
 extern void ext4_free_blocks(handle_t *handle, struct inode *inode,
                             struct buffer_head *bh, ext4_fsblk_t block,
                             unsigned long count, int flags);
@@ -2765,8 +2804,7 @@ extern int ext4_search_dir(struct buffer_head *bh,
                           struct ext4_filename *fname,
                           unsigned int offset,
                           struct ext4_dir_entry_2 **res_dir);
-extern int ext4_generic_delete_entry(handle_t *handle,
-                                    struct inode *dir,
+extern int ext4_generic_delete_entry(struct inode *dir,
                                     struct ext4_dir_entry_2 *de_del,
                                     struct buffer_head *bh,
                                     void *entry_buf,
@@ -2924,12 +2962,6 @@ do {                                                                     \
 
 #endif
 
-extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
-                                       __u32 compat);
-extern int ext4_update_rocompat_feature(handle_t *handle,
-                                       struct super_block *sb, __u32 rocompat);
-extern int ext4_update_incompat_feature(handle_t *handle,
-                                       struct super_block *sb, __u32 incompat);
 extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
                                      struct ext4_group_desc *bg);
 extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
@@ -3145,6 +3177,7 @@ struct ext4_group_info {
        (1 << EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT)
 #define EXT4_GROUP_INFO_IBITMAP_CORRUPT                \
        (1 << EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT)
+#define EXT4_GROUP_INFO_BBITMAP_READ_BIT       4
 
 #define EXT4_MB_GRP_NEED_INIT(grp)     \
        (test_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &((grp)->bb_state)))
@@ -3159,6 +3192,8 @@ struct ext4_group_info {
        (set_bit(EXT4_GROUP_INFO_WAS_TRIMMED_BIT, &((grp)->bb_state)))
 #define EXT4_MB_GRP_CLEAR_TRIMMED(grp) \
        (clear_bit(EXT4_GROUP_INFO_WAS_TRIMMED_BIT, &((grp)->bb_state)))
+#define EXT4_MB_GRP_TEST_AND_SET_READ(grp)     \
+       (test_and_set_bit(EXT4_GROUP_INFO_BBITMAP_READ_BIT, &((grp)->bb_state)))
 
 #define EXT4_MAX_CONTENTION            8
 #define EXT4_CONTENTION_THRESHOLD      2
@@ -3363,9 +3398,9 @@ extern void ext4_release_system_zone(struct super_block *sb);
 extern int ext4_setup_system_zone(struct super_block *sb);
 extern int __init ext4_init_system_zone(void);
 extern void ext4_exit_system_zone(void);
-extern int ext4_data_block_valid(struct ext4_sb_info *sbi,
-                                ext4_fsblk_t start_blk,
-                                unsigned int count);
+extern int ext4_inode_block_valid(struct inode *inode,
+                                 ext4_fsblk_t start_blk,
+                                 unsigned int count);
 extern int ext4_check_blockref(const char *, unsigned int,
                               struct inode *, __le32 *, unsigned int);
 
index 0c76cdd..760b9ee 100644 (file)
@@ -195,6 +195,28 @@ static void ext4_journal_abort_handle(const char *caller, unsigned int line,
        jbd2_journal_abort_handle(handle);
 }
 
+static void ext4_check_bdev_write_error(struct super_block *sb)
+{
+       struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
+       struct ext4_sb_info *sbi = EXT4_SB(sb);
+       int err;
+
+       /*
+        * If the block device has write error flag, it may have failed to
+        * async write out metadata buffers in the background. In this case,
+        * we could read old data from disk and write it out again, which
+        * may lead to on-disk filesystem inconsistency.
+        */
+       if (errseq_check(&mapping->wb_err, READ_ONCE(sbi->s_bdev_wb_err))) {
+               spin_lock(&sbi->s_bdev_wb_lock);
+               err = errseq_check_and_advance(&mapping->wb_err, &sbi->s_bdev_wb_err);
+               spin_unlock(&sbi->s_bdev_wb_lock);
+               if (err)
+                       ext4_error_err(sb, -err,
+                                      "Error while async write back metadata");
+       }
+}
+
 int __ext4_journal_get_write_access(const char *where, unsigned int line,
                                    handle_t *handle, struct buffer_head *bh)
 {
@@ -202,6 +224,9 @@ int __ext4_journal_get_write_access(const char *where, unsigned int line,
 
        might_sleep();
 
+       if (bh->b_bdev->bd_super)
+               ext4_check_bdev_write_error(bh->b_bdev->bd_super);
+
        if (ext4_handle_valid(handle)) {
                err = jbd2_journal_get_write_access(handle, bh);
                if (err)
index 221f240..a048158 100644 (file)
@@ -100,7 +100,7 @@ static int ext4_ext_trunc_restart_fn(struct inode *inode, int *dropped)
         * i_mutex. So we can safely drop the i_data_sem here.
         */
        BUG_ON(EXT4_JOURNAL(inode) == NULL);
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
        up_write(&EXT4_I(inode)->i_data_sem);
        *dropped = 1;
        return 0;
@@ -340,7 +340,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
         */
        if (lblock + len <= lblock)
                return 0;
-       return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
+       return ext4_inode_block_valid(inode, block, len);
 }
 
 static int ext4_valid_extent_idx(struct inode *inode,
@@ -348,7 +348,7 @@ static int ext4_valid_extent_idx(struct inode *inode,
 {
        ext4_fsblk_t block = ext4_idx_pblock(ext_idx);
 
-       return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, 1);
+       return ext4_inode_block_valid(inode, block, 1);
 }
 
 static int ext4_valid_extent_entries(struct inode *inode,
@@ -507,14 +507,10 @@ __read_extent_tree_block(const char *function, unsigned int line,
        }
        if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE))
                return bh;
-       if (!ext4_has_feature_journal(inode->i_sb) ||
-           (inode->i_ino !=
-            le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) {
-               err = __ext4_ext_check(function, line, inode,
-                                      ext_block_hdr(bh), depth, pblk);
-               if (err)
-                       goto errout;
-       }
+       err = __ext4_ext_check(function, line, inode,
+                              ext_block_hdr(bh), depth, pblk);
+       if (err)
+               goto errout;
        set_buffer_verified(bh);
        /*
         * If this is a leaf block, cache all of its entries
@@ -693,10 +689,8 @@ void ext4_ext_drop_refs(struct ext4_ext_path *path)
                return;
        depth = path->p_depth;
        for (i = 0; i <= depth; i++, path++) {
-               if (path->p_bh) {
-                       brelse(path->p_bh);
-                       path->p_bh = NULL;
-               }
+               brelse(path->p_bh);
+               path->p_bh = NULL;
        }
 }
 
@@ -1915,7 +1909,7 @@ out:
 
 /*
  * ext4_ext_insert_extent:
- * tries to merge requsted extent into the existing extent or
+ * tries to merge requested extent into the existing extent or
  * inserts requested extent as new one into the tree,
  * creating new leaf in the no-space case.
  */
@@ -3125,7 +3119,7 @@ static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)
  *
  *
  * Splits extent [a, b] into two extents [a, @split) and [@split, b], states
- * of which are deterimined by split_flag.
+ * of which are determined by split_flag.
  *
  * There are two cases:
  *  a> the extent are splitted into two extent.
@@ -3650,7 +3644,7 @@ static int ext4_split_convert_extents(handle_t *handle,
                eof_block = map->m_lblk + map->m_len;
        /*
         * It is safe to convert extent to initialized via explicit
-        * zeroout only if extent is fully insde i_size or new_size.
+        * zeroout only if extent is fully inside i_size or new_size.
         */
        depth = ext_depth(inode);
        ex = path[depth].p_ext;
@@ -4272,7 +4266,7 @@ got_allocated_blocks:
                         * not a good idea to call discard here directly,
                         * but otherwise we'd need to call it every free().
                         */
-                       ext4_discard_preallocations(inode);
+                       ext4_discard_preallocations(inode, 0);
                        if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
                                fb_flags = EXT4_FREE_BLOCKS_NO_QUOT_UPDATE;
                        ext4_free_blocks(handle, inode, NULL, newblock,
@@ -4495,7 +4489,7 @@ static long ext4_zero_range(struct file *file, loff_t offset,
        }
 
        /*
-        * Round up offset. This is not fallocate, we neet to zero out
+        * Round up offset. This is not fallocate, we need to zero out
         * blocks, so convert interior block aligned part of the range to
         * unwritten and possibly manually zero out unaligned parts of the
         * range.
@@ -5299,7 +5293,7 @@ static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
        }
 
        down_write(&EXT4_I(inode)->i_data_sem);
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
 
        ret = ext4_es_remove_extent(inode, punch_start,
                                    EXT_MAX_BLOCKS - punch_start);
@@ -5313,7 +5307,7 @@ static int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
                up_write(&EXT4_I(inode)->i_data_sem);
                goto out_stop;
        }
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
 
        ret = ext4_ext_shift_extents(inode, handle, punch_stop,
                                     punch_stop - punch_start, SHIFT_LEFT);
@@ -5445,7 +5439,7 @@ static int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
                goto out_stop;
 
        down_write(&EXT4_I(inode)->i_data_sem);
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
 
        path = ext4_find_extent(inode, offset_lblk, NULL, 0);
        if (IS_ERR(path)) {
@@ -5579,7 +5573,7 @@ ext4_swap_extents(handle_t *handle, struct inode *inode1,
                }
                ex1 = path1[path1->p_depth].p_ext;
                ex2 = path2[path2->p_depth].p_ext;
-               /* Do we have somthing to swap ? */
+               /* Do we have something to swap ? */
                if (unlikely(!ex2 || !ex1))
                        goto finish;
 
index 129cc1d..7d61069 100644 (file)
@@ -145,10 +145,9 @@ static int ext4_release_file(struct inode *inode, struct file *filp)
        /* if we are the last writer on the inode, drop the block reservation */
        if ((filp->f_mode & FMODE_WRITE) &&
                        (atomic_read(&inode->i_writecount) == 1) &&
-                       !EXT4_I(inode)->i_reserved_data_blocks)
-       {
+                       !EXT4_I(inode)->i_reserved_data_blocks) {
                down_write(&EXT4_I(inode)->i_data_sem);
-               ext4_discard_preallocations(inode);
+               ext4_discard_preallocations(inode, 0);
                up_write(&EXT4_I(inode)->i_data_sem);
        }
        if (is_dx(inode) && filp->private_data)
@@ -428,6 +427,10 @@ restart:
         */
        if (*ilock_shared && (!IS_NOSEC(inode) || *extend ||
             !ext4_overwrite_io(inode, offset, count))) {
+               if (iocb->ki_flags & IOCB_NOWAIT) {
+                       ret = -EAGAIN;
+                       goto out;
+               }
                inode_unlock_shared(inode);
                *ilock_shared = false;
                inode_lock(inode);
@@ -812,7 +815,7 @@ out:
        return err;
 }
 
-static int ext4_file_open(struct inode * inode, struct file * filp)
+static int ext4_file_open(struct inode *inode, struct file *filp)
 {
        int ret;
 
index 3e13379..2924261 100644 (file)
@@ -233,7 +233,7 @@ static int __ext4fs_dirhash(const char *name, int len,
                break;
        case DX_HASH_HALF_MD4_UNSIGNED:
                str2hashbuf = str2hashbuf_unsigned;
-               /* fall through */
+               fallthrough;
        case DX_HASH_HALF_MD4:
                p = name;
                while (len > 0) {
@@ -247,7 +247,7 @@ static int __ext4fs_dirhash(const char *name, int len,
                break;
        case DX_HASH_TEA_UNSIGNED:
                str2hashbuf = str2hashbuf_unsigned;
-               /* fall through */
+               fallthrough;
        case DX_HASH_TEA:
                p = name;
                while (len > 0) {
index be2b66e..80c9f33 100644 (file)
@@ -696,7 +696,7 @@ static int ext4_ind_trunc_restart_fn(handle_t *handle, struct inode *inode,
         * i_mutex. So we can safely drop the i_data_sem here.
         */
        BUG_ON(EXT4_JOURNAL(inode) == NULL);
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
        up_write(&EXT4_I(inode)->i_data_sem);
        *dropped = 1;
        return 0;
@@ -858,8 +858,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
        else if (ext4_should_journal_data(inode))
                flags |= EXT4_FREE_BLOCKS_FORGET;
 
-       if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free,
-                                  count)) {
+       if (!ext4_inode_block_valid(inode, block_to_free, count)) {
                EXT4_ERROR_INODE(inode, "attempt to clear invalid "
                                 "blocks %llu len %lu",
                                 (unsigned long long) block_to_free, count);
@@ -1004,8 +1003,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
                        if (!nr)
                                continue;               /* A hole */
 
-                       if (!ext4_data_block_valid(EXT4_SB(inode->i_sb),
-                                                  nr, 1)) {
+                       if (!ext4_inode_block_valid(inode, nr, 1)) {
                                EXT4_ERROR_INODE(inode,
                                                 "invalid indirect mapped "
                                                 "block %lu (level %d)",
@@ -1182,21 +1180,21 @@ do_indirects:
                        ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 1);
                        i_data[EXT4_IND_BLOCK] = 0;
                }
-               /* fall through */
+               fallthrough;
        case EXT4_IND_BLOCK:
                nr = i_data[EXT4_DIND_BLOCK];
                if (nr) {
                        ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 2);
                        i_data[EXT4_DIND_BLOCK] = 0;
                }
-               /* fall through */
+               fallthrough;
        case EXT4_DIND_BLOCK:
                nr = i_data[EXT4_TIND_BLOCK];
                if (nr) {
                        ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 3);
                        i_data[EXT4_TIND_BLOCK] = 0;
                }
-               /* fall through */
+               fallthrough;
        case EXT4_TIND_BLOCK:
                ;
        }
@@ -1436,7 +1434,7 @@ do_indirects:
                        ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 1);
                        i_data[EXT4_IND_BLOCK] = 0;
                }
-               /* fall through */
+               fallthrough;
        case EXT4_IND_BLOCK:
                if (++n >= n2)
                        break;
@@ -1445,7 +1443,7 @@ do_indirects:
                        ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 2);
                        i_data[EXT4_DIND_BLOCK] = 0;
                }
-               /* fall through */
+               fallthrough;
        case EXT4_DIND_BLOCK:
                if (++n >= n2)
                        break;
@@ -1454,7 +1452,7 @@ do_indirects:
                        ext4_free_branches(handle, inode, NULL, &nr, &nr+1, 3);
                        i_data[EXT4_TIND_BLOCK] = 0;
                }
-               /* fall through */
+               fallthrough;
        case EXT4_TIND_BLOCK:
                ;
        }
index c3a1ad2..75c97bc 100644 (file)
@@ -276,7 +276,7 @@ static int ext4_create_inline_data(handle_t *handle,
                len = 0;
        }
 
-       /* Insert the the xttr entry. */
+       /* Insert the xttr entry. */
        i.value = value;
        i.value_len = len;
 
@@ -1706,7 +1706,7 @@ int ext4_delete_inline_entry(handle_t *handle,
        if (err)
                goto out;
 
-       err = ext4_generic_delete_entry(handle, dir, de_del, bh,
+       err = ext4_generic_delete_entry(dir, de_del, bh,
                                        inline_start, inline_size, 0);
        if (err)
                goto out;
index 44bad4b..bf59646 100644 (file)
@@ -383,7 +383,7 @@ void ext4_da_update_reserve_space(struct inode *inode,
         */
        if ((ei->i_reserved_data_blocks == 0) &&
            !inode_is_open_for_write(inode))
-               ext4_discard_preallocations(inode);
+               ext4_discard_preallocations(inode, 0);
 }
 
 static int __check_block_validity(struct inode *inode, const char *func,
@@ -394,8 +394,7 @@ static int __check_block_validity(struct inode *inode, const char *func,
            (inode->i_ino ==
             le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum)))
                return 0;
-       if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk,
-                                  map->m_len)) {
+       if (!ext4_inode_block_valid(inode, map->m_pblk, map->m_len)) {
                ext4_error_inode(inode, func, line, map->m_pblk,
                                 "lblock %lu mapped to illegal pblock %llu "
                                 "(length %d)", (unsigned long) map->m_lblk,
@@ -3288,7 +3287,7 @@ static int ext4_releasepage(struct page *page, gfp_t wait)
        if (PageChecked(page))
                return 0;
        if (journal)
-               return jbd2_journal_try_to_free_buffers(journal, page, wait);
+               return jbd2_journal_try_to_free_buffers(journal, page);
        else
                return try_to_free_buffers(page);
 }
@@ -4056,7 +4055,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
        if (stop_block > first_block) {
 
                down_write(&EXT4_I(inode)->i_data_sem);
-               ext4_discard_preallocations(inode);
+               ext4_discard_preallocations(inode, 0);
 
                ret = ext4_es_remove_extent(inode, first_block,
                                            stop_block - first_block);
@@ -4163,7 +4162,7 @@ int ext4_truncate(struct inode *inode)
        trace_ext4_truncate_enter(inode);
 
        if (!ext4_can_truncate(inode))
-               return 0;
+               goto out_trace;
 
        if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
                ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
@@ -4172,16 +4171,14 @@ int ext4_truncate(struct inode *inode)
                int has_inline = 1;
 
                err = ext4_inline_data_truncate(inode, &has_inline);
-               if (err)
-                       return err;
-               if (has_inline)
-                       return 0;
+               if (err || has_inline)
+                       goto out_trace;
        }
 
        /* If we zero-out tail of the page, we have to create jinode for jbd2 */
        if (inode->i_size & (inode->i_sb->s_blocksize - 1)) {
                if (ext4_inode_attach_jinode(inode) < 0)
-                       return 0;
+                       goto out_trace;
        }
 
        if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
@@ -4190,8 +4187,10 @@ int ext4_truncate(struct inode *inode)
                credits = ext4_blocks_for_truncate(inode);
 
        handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, credits);
-       if (IS_ERR(handle))
-               return PTR_ERR(handle);
+       if (IS_ERR(handle)) {
+               err = PTR_ERR(handle);
+               goto out_trace;
+       }
 
        if (inode->i_size & (inode->i_sb->s_blocksize - 1))
                ext4_block_truncate_page(handle, mapping, inode->i_size);
@@ -4211,7 +4210,7 @@ int ext4_truncate(struct inode *inode)
 
        down_write(&EXT4_I(inode)->i_data_sem);
 
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
 
        if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
                err = ext4_ext_truncate(handle, inode);
@@ -4242,6 +4241,7 @@ out_stop:
                err = err2;
        ext4_journal_stop(handle);
 
+out_trace:
        trace_ext4_truncate_exit(inode);
        return err;
 }
@@ -4760,7 +4760,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
 
        ret = 0;
        if (ei->i_file_acl &&
-           !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
+           !ext4_inode_block_valid(inode, ei->i_file_acl, 1)) {
                ext4_error_inode(inode, function, line, 0,
                                 "iget: bad extended attribute block %llu",
                                 ei->i_file_acl);
@@ -4901,7 +4901,7 @@ static void __ext4_update_other_inode_time(struct super_block *sb,
            (inode->i_state & I_DIRTY_TIME)) {
                struct ext4_inode_info  *ei = EXT4_I(inode);
 
-               inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED);
+               inode->i_state &= ~I_DIRTY_TIME;
                spin_unlock(&inode->i_lock);
 
                spin_lock(&ei->i_raw_lock);
index 999cf6a..36eca3b 100644 (file)
@@ -202,7 +202,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
        reset_inode_seed(inode);
        reset_inode_seed(inode_bl);
 
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
 
        err = ext4_mark_inode_dirty(handle, inode);
        if (err < 0) {
@@ -819,12 +819,12 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        switch (cmd) {
        case FS_IOC_GETFSMAP:
                return ext4_ioc_getfsmap(sb, (void __user *)arg);
-       case EXT4_IOC_GETFLAGS:
+       case FS_IOC_GETFLAGS:
                flags = ei->i_flags & EXT4_FL_USER_VISIBLE;
                if (S_ISREG(inode->i_mode))
                        flags &= ~EXT4_PROJINHERIT_FL;
                return put_user(flags, (int __user *) arg);
-       case EXT4_IOC_SETFLAGS: {
+       case FS_IOC_SETFLAGS: {
                int err;
 
                if (!inode_owner_or_capable(inode))
@@ -1129,12 +1129,12 @@ resizefs_out:
        case EXT4_IOC_PRECACHE_EXTENTS:
                return ext4_ext_precache(inode);
 
-       case EXT4_IOC_SET_ENCRYPTION_POLICY:
+       case FS_IOC_SET_ENCRYPTION_POLICY:
                if (!ext4_has_feature_encrypt(sb))
                        return -EOPNOTSUPP;
                return fscrypt_ioctl_set_policy(filp, (const void __user *)arg);
 
-       case EXT4_IOC_GET_ENCRYPTION_PWSALT: {
+       case FS_IOC_GET_ENCRYPTION_PWSALT: {
 #ifdef CONFIG_FS_ENCRYPTION
                int err, err2;
                struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -1174,7 +1174,7 @@ resizefs_out:
                return -EOPNOTSUPP;
 #endif
        }
-       case EXT4_IOC_GET_ENCRYPTION_POLICY:
+       case FS_IOC_GET_ENCRYPTION_POLICY:
                if (!ext4_has_feature_encrypt(sb))
                        return -EOPNOTSUPP;
                return fscrypt_ioctl_get_policy(filp, (void __user *)arg);
@@ -1236,7 +1236,7 @@ resizefs_out:
        case EXT4_IOC_GET_ES_CACHE:
                return ext4_ioctl_get_es_cache(filp, arg);
 
-       case EXT4_IOC_FSGETXATTR:
+       case FS_IOC_FSGETXATTR:
        {
                struct fsxattr fa;
 
@@ -1247,7 +1247,7 @@ resizefs_out:
                        return -EFAULT;
                return 0;
        }
-       case EXT4_IOC_FSSETXATTR:
+       case FS_IOC_FSSETXATTR:
        {
                struct fsxattr fa, old_fa;
                int err;
@@ -1313,11 +1313,11 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        /* These are just misnamed, they actually get/put from/to user an int */
        switch (cmd) {
-       case EXT4_IOC32_GETFLAGS:
-               cmd = EXT4_IOC_GETFLAGS;
+       case FS_IOC32_GETFLAGS:
+               cmd = FS_IOC_GETFLAGS;
                break;
-       case EXT4_IOC32_SETFLAGS:
-               cmd = EXT4_IOC_SETFLAGS;
+       case FS_IOC32_SETFLAGS:
+               cmd = FS_IOC_SETFLAGS;
                break;
        case EXT4_IOC32_GETVERSION:
                cmd = EXT4_IOC_GETVERSION;
@@ -1361,9 +1361,9 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case EXT4_IOC_RESIZE_FS:
        case FITRIM:
        case EXT4_IOC_PRECACHE_EXTENTS:
-       case EXT4_IOC_SET_ENCRYPTION_POLICY:
-       case EXT4_IOC_GET_ENCRYPTION_PWSALT:
-       case EXT4_IOC_GET_ENCRYPTION_POLICY:
+       case FS_IOC_SET_ENCRYPTION_POLICY:
+       case FS_IOC_GET_ENCRYPTION_PWSALT:
+       case FS_IOC_GET_ENCRYPTION_POLICY:
        case FS_IOC_GET_ENCRYPTION_POLICY_EX:
        case FS_IOC_ADD_ENCRYPTION_KEY:
        case FS_IOC_REMOVE_ENCRYPTION_KEY:
@@ -1377,8 +1377,8 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case EXT4_IOC_CLEAR_ES_CACHE:
        case EXT4_IOC_GETSTATE:
        case EXT4_IOC_GET_ES_CACHE:
-       case EXT4_IOC_FSGETXATTR:
-       case EXT4_IOC_FSSETXATTR:
+       case FS_IOC_FSGETXATTR:
+       case FS_IOC_FSSETXATTR:
                break;
        default:
                return -ENOIOCTLCMD;
index c0a331e..132c118 100644 (file)
@@ -922,7 +922,7 @@ static int ext4_mb_init_cache(struct page *page, char *incore, gfp_t gfp)
                        bh[i] = NULL;
                        continue;
                }
-               bh[i] = ext4_read_block_bitmap_nowait(sb, group);
+               bh[i] = ext4_read_block_bitmap_nowait(sb, group, false);
                if (IS_ERR(bh[i])) {
                        err = PTR_ERR(bh[i]);
                        bh[i] = NULL;
@@ -1279,9 +1279,6 @@ ext4_mb_load_buddy_gfp(struct super_block *sb, ext4_group_t group,
        e4b->bd_buddy_page = page;
        e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize);
 
-       BUG_ON(e4b->bd_bitmap_page == NULL);
-       BUG_ON(e4b->bd_buddy_page == NULL);
-
        return 0;
 
 err:
@@ -1743,10 +1740,6 @@ static void ext4_mb_use_best_found(struct ext4_allocation_context *ac,
 
 }
 
-/*
- * regular allocator, for general purposes allocation
- */
-
 static void ext4_mb_check_limits(struct ext4_allocation_context *ac,
                                        struct ext4_buddy *e4b,
                                        int finish_group)
@@ -2119,13 +2112,11 @@ static bool ext4_mb_good_group(struct ext4_allocation_context *ac,
 
        BUG_ON(cr < 0 || cr >= 4);
 
-       free = grp->bb_free;
-       if (free == 0)
-               return false;
-       if (cr <= 2 && free < ac->ac_g_ex.fe_len)
+       if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(grp)))
                return false;
 
-       if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(grp)))
+       free = grp->bb_free;
+       if (free == 0)
                return false;
 
        fragments = grp->bb_fragments;
@@ -2142,8 +2133,10 @@ static bool ext4_mb_good_group(struct ext4_allocation_context *ac,
                    ((group % flex_size) == 0))
                        return false;
 
-               if ((ac->ac_2order > ac->ac_sb->s_blocksize_bits+1) ||
-                   (free / fragments) >= ac->ac_g_ex.fe_len)
+               if (free < ac->ac_g_ex.fe_len)
+                       return false;
+
+               if (ac->ac_2order > ac->ac_sb->s_blocksize_bits+1)
                        return true;
 
                if (grp->bb_largest_free_order < ac->ac_2order)
@@ -2177,6 +2170,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
 {
        struct ext4_group_info *grp = ext4_get_group_info(ac->ac_sb, group);
        struct super_block *sb = ac->ac_sb;
+       struct ext4_sb_info *sbi = EXT4_SB(sb);
        bool should_lock = ac->ac_flags & EXT4_MB_STRICT_CHECK;
        ext4_grpblk_t free;
        int ret = 0;
@@ -2195,7 +2189,25 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
 
        /* We only do this if the grp has never been initialized */
        if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
-               ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);
+               struct ext4_group_desc *gdp =
+                       ext4_get_group_desc(sb, group, NULL);
+               int ret;
+
+               /* cr=0/1 is a very optimistic search to find large
+                * good chunks almost for free.  If buddy data is not
+                * ready, then this optimization makes no sense.  But
+                * we never skip the first block group in a flex_bg,
+                * since this gets used for metadata block allocation,
+                * and we want to make sure we locate metadata blocks
+                * in the first block group in the flex_bg if possible.
+                */
+               if (cr < 2 &&
+                   (!sbi->s_log_groups_per_flex ||
+                    ((group & ((1 << sbi->s_log_groups_per_flex) - 1)) != 0)) &&
+                   !(ext4_has_group_desc_csum(sb) &&
+                     (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))))
+                       return 0;
+               ret = ext4_mb_init_group(sb, group, GFP_NOFS);
                if (ret)
                        return ret;
        }
@@ -2209,15 +2221,95 @@ out:
        return ret;
 }
 
+/*
+ * Start prefetching @nr block bitmaps starting at @group.
+ * Return the next group which needs to be prefetched.
+ */
+ext4_group_t ext4_mb_prefetch(struct super_block *sb, ext4_group_t group,
+                             unsigned int nr, int *cnt)
+{
+       ext4_group_t ngroups = ext4_get_groups_count(sb);
+       struct buffer_head *bh;
+       struct blk_plug plug;
+
+       blk_start_plug(&plug);
+       while (nr-- > 0) {
+               struct ext4_group_desc *gdp = ext4_get_group_desc(sb, group,
+                                                                 NULL);
+               struct ext4_group_info *grp = ext4_get_group_info(sb, group);
+
+               /*
+                * Prefetch block groups with free blocks; but don't
+                * bother if it is marked uninitialized on disk, since
+                * it won't require I/O to read.  Also only try to
+                * prefetch once, so we avoid getblk() call, which can
+                * be expensive.
+                */
+               if (!EXT4_MB_GRP_TEST_AND_SET_READ(grp) &&
+                   EXT4_MB_GRP_NEED_INIT(grp) &&
+                   ext4_free_group_clusters(sb, gdp) > 0 &&
+                   !(ext4_has_group_desc_csum(sb) &&
+                     (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)))) {
+                       bh = ext4_read_block_bitmap_nowait(sb, group, true);
+                       if (bh && !IS_ERR(bh)) {
+                               if (!buffer_uptodate(bh) && cnt)
+                                       (*cnt)++;
+                               brelse(bh);
+                       }
+               }
+               if (++group >= ngroups)
+                       group = 0;
+       }
+       blk_finish_plug(&plug);
+       return group;
+}
+
+/*
+ * Prefetching reads the block bitmap into the buffer cache; but we
+ * need to make sure that the buddy bitmap in the page cache has been
+ * initialized.  Note that ext4_mb_init_group() will block if the I/O
+ * is not yet completed, or indeed if it was not initiated by
+ * ext4_mb_prefetch did not start the I/O.
+ *
+ * TODO: We should actually kick off the buddy bitmap setup in a work
+ * queue when the buffer I/O is completed, so that we don't block
+ * waiting for the block allocation bitmap read to finish when
+ * ext4_mb_prefetch_fini is called from ext4_mb_regular_allocator().
+ */
+void ext4_mb_prefetch_fini(struct super_block *sb, ext4_group_t group,
+                          unsigned int nr)
+{
+       while (nr-- > 0) {
+               struct ext4_group_desc *gdp = ext4_get_group_desc(sb, group,
+                                                                 NULL);
+               struct ext4_group_info *grp = ext4_get_group_info(sb, group);
+
+               if (!group)
+                       group = ext4_get_groups_count(sb);
+               group--;
+               grp = ext4_get_group_info(sb, group);
+
+               if (EXT4_MB_GRP_NEED_INIT(grp) &&
+                   ext4_free_group_clusters(sb, gdp) > 0 &&
+                   !(ext4_has_group_desc_csum(sb) &&
+                     (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)))) {
+                       if (ext4_mb_init_group(sb, group, GFP_NOFS))
+                               break;
+               }
+       }
+}
+
 static noinline_for_stack int
 ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
 {
-       ext4_group_t ngroups, group, i;
+       ext4_group_t prefetch_grp = 0, ngroups, group, i;
        int cr = -1;
        int err = 0, first_err = 0;
+       unsigned int nr = 0, prefetch_ios = 0;
        struct ext4_sb_info *sbi;
        struct super_block *sb;
        struct ext4_buddy e4b;
+       int lost;
 
        sb = ac->ac_sb;
        sbi = EXT4_SB(sb);
@@ -2237,8 +2329,8 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
                goto out;
 
        /*
-        * ac->ac2_order is set only if the fe_len is a power of 2
-        * if ac2_order is set we also set criteria to 0 so that we
+        * ac->ac_2order is set only if the fe_len is a power of 2
+        * if ac->ac_2order is set we also set criteria to 0 so that we
         * try exact allocation using buddy.
         */
        i = fls(ac->ac_g_ex.fe_len);
@@ -2282,6 +2374,7 @@ repeat:
                 * from the goal value specified
                 */
                group = ac->ac_g_ex.fe_group;
+               prefetch_grp = group;
 
                for (i = 0; i < ngroups; group++, i++) {
                        int ret = 0;
@@ -2293,6 +2386,29 @@ repeat:
                        if (group >= ngroups)
                                group = 0;
 
+                       /*
+                        * Batch reads of the block allocation bitmaps
+                        * to get multiple READs in flight; limit
+                        * prefetching at cr=0/1, otherwise mballoc can
+                        * spend a lot of time loading imperfect groups
+                        */
+                       if ((prefetch_grp == group) &&
+                           (cr > 1 ||
+                            prefetch_ios < sbi->s_mb_prefetch_limit)) {
+                               unsigned int curr_ios = prefetch_ios;
+
+                               nr = sbi->s_mb_prefetch;
+                               if (ext4_has_feature_flex_bg(sb)) {
+                                       nr = (group / sbi->s_mb_prefetch) *
+                                               sbi->s_mb_prefetch;
+                                       nr = nr + sbi->s_mb_prefetch - group;
+                               }
+                               prefetch_grp = ext4_mb_prefetch(sb, group,
+                                                       nr, &prefetch_ios);
+                               if (prefetch_ios == curr_ios)
+                                       nr = 0;
+                       }
+
                        /* This now checks without needing the buddy page */
                        ret = ext4_mb_good_group_nolock(ac, group, cr);
                        if (ret <= 0) {
@@ -2341,22 +2457,24 @@ repeat:
                 * We've been searching too long. Let's try to allocate
                 * the best chunk we've found so far
                 */
-
                ext4_mb_try_best_found(ac, &e4b);
                if (ac->ac_status != AC_STATUS_FOUND) {
                        /*
                         * Someone more lucky has already allocated it.
                         * The only thing we can do is just take first
                         * found block(s)
-                       printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n");
                         */
+                       lost = atomic_inc_return(&sbi->s_mb_lost_chunks);
+                       mb_debug(sb, "lost chunk, group: %u, start: %d, len: %d, lost: %d\n",
+                                ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start,
+                                ac->ac_b_ex.fe_len, lost);
+
                        ac->ac_b_ex.fe_group = 0;
                        ac->ac_b_ex.fe_start = 0;
                        ac->ac_b_ex.fe_len = 0;
                        ac->ac_status = AC_STATUS_CONTINUE;
                        ac->ac_flags |= EXT4_MB_HINT_FIRST;
                        cr = 3;
-                       atomic_inc(&sbi->s_mb_lost_chunks);
                        goto repeat;
                }
        }
@@ -2367,6 +2485,10 @@ out:
        mb_debug(sb, "Best len %d, origin len %d, ac_status %u, ac_flags 0x%x, cr %d ret %d\n",
                 ac->ac_b_ex.fe_len, ac->ac_o_ex.fe_len, ac->ac_status,
                 ac->ac_flags, cr, err);
+
+       if (nr)
+               ext4_mb_prefetch_fini(sb, prefetch_grp, nr);
+
        return err;
 }
 
@@ -2439,7 +2561,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
        for (i = 0; i <= 13; i++)
                seq_printf(seq, " %-5u", i <= blocksize_bits + 1 ?
                                sg.info.bb_counters[i] : 0);
-       seq_printf(seq, " ]\n");
+       seq_puts(seq, " ]\n");
 
        return 0;
 }
@@ -2613,6 +2735,26 @@ static int ext4_mb_init_backend(struct super_block *sb)
                        goto err_freebuddy;
        }
 
+       if (ext4_has_feature_flex_bg(sb)) {
+               /* a single flex group is supposed to be read by a single IO */
+               sbi->s_mb_prefetch = 1 << sbi->s_es->s_log_groups_per_flex;
+               sbi->s_mb_prefetch *= 8; /* 8 prefetch IOs in flight at most */
+       } else {
+               sbi->s_mb_prefetch = 32;
+       }
+       if (sbi->s_mb_prefetch > ext4_get_groups_count(sb))
+               sbi->s_mb_prefetch = ext4_get_groups_count(sb);
+       /* now many real IOs to prefetch within a single allocation at cr=0
+        * given cr=0 is an CPU-related optimization we shouldn't try to
+        * load too many groups, at some point we should start to use what
+        * we've got in memory.
+        * with an average random access time 5ms, it'd take a second to get
+        * 200 groups (* N with flex_bg), so let's make this limit 4
+        */
+       sbi->s_mb_prefetch_limit = sbi->s_mb_prefetch * 4;
+       if (sbi->s_mb_prefetch_limit > ext4_get_groups_count(sb))
+               sbi->s_mb_prefetch_limit = ext4_get_groups_count(sb);
+
        return 0;
 
 err_freebuddy:
@@ -2736,6 +2878,7 @@ int ext4_mb_init(struct super_block *sb)
        sbi->s_mb_stats = MB_DEFAULT_STATS;
        sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
        sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
+       sbi->s_mb_max_inode_prealloc = MB_DEFAULT_MAX_INODE_PREALLOC;
        /*
         * The default group preallocation is 512, which for 4k block
         * sizes translates to 2 megabytes.  However for bigalloc file
@@ -3090,7 +3233,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
        block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex);
 
        len = EXT4_C2B(sbi, ac->ac_b_ex.fe_len);
-       if (!ext4_data_block_valid(sbi, block, len)) {
+       if (!ext4_inode_block_valid(ac->ac_inode, block, len)) {
                ext4_error(sb, "Allocating blocks %llu-%llu which overlap "
                           "fs metadata", block, block+len);
                /* File system mounted not to panic on error
@@ -3674,6 +3817,26 @@ void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
        mb_debug(sb, "preallocated %d for group %u\n", preallocated, group);
 }
 
+static void ext4_mb_mark_pa_deleted(struct super_block *sb,
+                                   struct ext4_prealloc_space *pa)
+{
+       struct ext4_inode_info *ei;
+
+       if (pa->pa_deleted) {
+               ext4_warning(sb, "deleted pa, type:%d, pblk:%llu, lblk:%u, len:%d\n",
+                            pa->pa_type, pa->pa_pstart, pa->pa_lstart,
+                            pa->pa_len);
+               return;
+       }
+
+       pa->pa_deleted = 1;
+
+       if (pa->pa_type == MB_INODE_PA) {
+               ei = EXT4_I(pa->pa_inode);
+               atomic_dec(&ei->i_prealloc_active);
+       }
+}
+
 static void ext4_mb_pa_callback(struct rcu_head *head)
 {
        struct ext4_prealloc_space *pa;
@@ -3706,7 +3869,7 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
                return;
        }
 
-       pa->pa_deleted = 1;
+       ext4_mb_mark_pa_deleted(sb, pa);
        spin_unlock(&pa->pa_lock);
 
        grp_blk = pa->pa_pstart;
@@ -3830,6 +3993,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
        spin_lock(pa->pa_obj_lock);
        list_add_rcu(&pa->pa_inode_list, &ei->i_prealloc_list);
        spin_unlock(pa->pa_obj_lock);
+       atomic_inc(&ei->i_prealloc_active);
 }
 
 /*
@@ -4040,7 +4204,7 @@ repeat:
                }
 
                /* seems this one can be freed ... */
-               pa->pa_deleted = 1;
+               ext4_mb_mark_pa_deleted(sb, pa);
 
                /* we can trust pa_free ... */
                free += pa->pa_free;
@@ -4103,7 +4267,7 @@ out_dbg:
  *
  * FIXME!! Make sure it is valid at all the call sites
  */
-void ext4_discard_preallocations(struct inode *inode)
+void ext4_discard_preallocations(struct inode *inode, unsigned int needed)
 {
        struct ext4_inode_info *ei = EXT4_I(inode);
        struct super_block *sb = inode->i_sb;
@@ -4121,15 +4285,19 @@ void ext4_discard_preallocations(struct inode *inode)
 
        mb_debug(sb, "discard preallocation for inode %lu\n",
                 inode->i_ino);
-       trace_ext4_discard_preallocations(inode);
+       trace_ext4_discard_preallocations(inode,
+                       atomic_read(&ei->i_prealloc_active), needed);
 
        INIT_LIST_HEAD(&list);
 
+       if (needed == 0)
+               needed = UINT_MAX;
+
 repeat:
        /* first, collect all pa's in the inode */
        spin_lock(&ei->i_prealloc_lock);
-       while (!list_empty(&ei->i_prealloc_list)) {
-               pa = list_entry(ei->i_prealloc_list.next,
+       while (!list_empty(&ei->i_prealloc_list) && needed) {
+               pa = list_entry(ei->i_prealloc_list.prev,
                                struct ext4_prealloc_space, pa_inode_list);
                BUG_ON(pa->pa_obj_lock != &ei->i_prealloc_lock);
                spin_lock(&pa->pa_lock);
@@ -4146,10 +4314,11 @@ repeat:
 
                }
                if (pa->pa_deleted == 0) {
-                       pa->pa_deleted = 1;
+                       ext4_mb_mark_pa_deleted(sb, pa);
                        spin_unlock(&pa->pa_lock);
                        list_del_rcu(&pa->pa_inode_list);
                        list_add(&pa->u.pa_tmp_list, &list);
+                       needed--;
                        continue;
                }
 
@@ -4399,7 +4568,7 @@ ext4_mb_initialize_context(struct ext4_allocation_context *ac,
        ac->ac_g_ex = ac->ac_o_ex;
        ac->ac_flags = ar->flags;
 
-       /* we have to define context: we'll we work with a file or
+       /* we have to define context: we'll work with a file or
         * locality group. this is a policy, actually */
        ext4_mb_group_or_file(ac);
 
@@ -4450,7 +4619,7 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
                BUG_ON(pa->pa_type != MB_GROUP_PA);
 
                /* seems this one can be freed ... */
-               pa->pa_deleted = 1;
+               ext4_mb_mark_pa_deleted(sb, pa);
                spin_unlock(&pa->pa_lock);
 
                list_del_rcu(&pa->pa_inode_list);
@@ -4548,11 +4717,30 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac)
        return ;
 }
 
+/*
+ * if per-inode prealloc list is too long, trim some PA
+ */
+static void ext4_mb_trim_inode_pa(struct inode *inode)
+{
+       struct ext4_inode_info *ei = EXT4_I(inode);
+       struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+       int count, delta;
+
+       count = atomic_read(&ei->i_prealloc_active);
+       delta = (sbi->s_mb_max_inode_prealloc >> 2) + 1;
+       if (count > sbi->s_mb_max_inode_prealloc + delta) {
+               count -= sbi->s_mb_max_inode_prealloc;
+               ext4_discard_preallocations(inode, count);
+       }
+}
+
 /*
  * release all resource we used in allocation
  */
 static int ext4_mb_release_context(struct ext4_allocation_context *ac)
 {
+       struct inode *inode = ac->ac_inode;
+       struct ext4_inode_info *ei = EXT4_I(inode);
        struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
        struct ext4_prealloc_space *pa = ac->ac_pa;
        if (pa) {
@@ -4564,21 +4752,31 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
                        pa->pa_free -= ac->ac_b_ex.fe_len;
                        pa->pa_len -= ac->ac_b_ex.fe_len;
                        spin_unlock(&pa->pa_lock);
+
+                       /*
+                        * We want to add the pa to the right bucket.
+                        * Remove it from the list and while adding
+                        * make sure the list to which we are adding
+                        * doesn't grow big.
+                        */
+                       if (likely(pa->pa_free)) {
+                               spin_lock(pa->pa_obj_lock);
+                               list_del_rcu(&pa->pa_inode_list);
+                               spin_unlock(pa->pa_obj_lock);
+                               ext4_mb_add_n_trim(ac);
+                       }
                }
-       }
-       if (pa) {
-               /*
-                * We want to add the pa to the right bucket.
-                * Remove it from the list and while adding
-                * make sure the list to which we are adding
-                * doesn't grow big.
-                */
-               if ((pa->pa_type == MB_GROUP_PA) && likely(pa->pa_free)) {
+
+               if (pa->pa_type == MB_INODE_PA) {
+                       /*
+                        * treat per-inode prealloc list as a lru list, then try
+                        * to trim the least recently used PA.
+                        */
                        spin_lock(pa->pa_obj_lock);
-                       list_del_rcu(&pa->pa_inode_list);
+                       list_move(&pa->pa_inode_list, &ei->i_prealloc_list);
                        spin_unlock(pa->pa_obj_lock);
-                       ext4_mb_add_n_trim(ac);
                }
+
                ext4_mb_put_pa(ac, ac->ac_sb, pa);
        }
        if (ac->ac_bitmap_page)
@@ -4588,6 +4786,7 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
        if (ac->ac_flags & EXT4_MB_HINT_GROUP_ALLOC)
                mutex_unlock(&ac->ac_lg->lg_mutex);
        ext4_mb_collect_stats(ac);
+       ext4_mb_trim_inode_pa(inode);
        return 0;
 }
 
@@ -4915,7 +5114,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
 
        sbi = EXT4_SB(sb);
        if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) &&
-           !ext4_data_block_valid(sbi, block, count)) {
+           !ext4_inode_block_valid(inode, block, count)) {
                ext4_error(sb, "Freeing blocks not in datazone - "
                           "block = %llu, count = %lu", block, count);
                goto error_return;
index 6b4d17c..e75b474 100644 (file)
  */
 #define MB_DEFAULT_GROUP_PREALLOC      512
 
+/*
+ * maximum length of inode prealloc list
+ */
+#define MB_DEFAULT_MAX_INODE_PREALLOC  512
 
 struct ext4_free_data {
        /* this links the free block information from sb_info */
index 1ed86fb..0d601b8 100644 (file)
@@ -686,8 +686,8 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
 
 out:
        if (*moved_len) {
-               ext4_discard_preallocations(orig_inode);
-               ext4_discard_preallocations(donor_inode);
+               ext4_discard_preallocations(orig_inode, 0);
+               ext4_discard_preallocations(donor_inode, 0);
        }
 
        ext4_ext_drop_refs(path);
index 56738b5..153a9fb 100644 (file)
@@ -1396,8 +1396,8 @@ int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size,
                    ext4_match(dir, fname, de)) {
                        /* found a match - just to be sure, do
                         * a full check */
-                       if (ext4_check_dir_entry(dir, NULL, de, bh, bh->b_data,
-                                                bh->b_size, offset))
+                       if (ext4_check_dir_entry(dir, NULL, de, bh, search_buf,
+                                                buf_size, offset))
                                return -1;
                        *res_dir = de;
                        return 1;
@@ -1858,7 +1858,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
                             blocksize, hinfo, map);
        map -= count;
        dx_sort_map(map, count);
-       /* Split the existing block in the middle, size-wise */
+       /* Ensure that neither split block is over half full */
        size = 0;
        move = 0;
        for (i = count-1; i >= 0; i--) {
@@ -1868,8 +1868,18 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
                size += map[i].size;
                move++;
        }
-       /* map index at which we will split */
-       split = count - move;
+       /*
+        * map index at which we will split
+        *
+        * If the sum of active entries didn't exceed half the block size, just
+        * split it in half by count; each resulting block will have at least
+        * half the space free.
+        */
+       if (i > 0)
+               split = count - move;
+       else
+               split = count/2;
+
        hash2 = map[split].hash;
        continued = hash2 == map[split - 1].hash;
        dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n",
@@ -2455,8 +2465,7 @@ cleanup:
  * ext4_generic_delete_entry deletes a directory entry by merging it
  * with the previous entry
  */
-int ext4_generic_delete_entry(handle_t *handle,
-                             struct inode *dir,
+int ext4_generic_delete_entry(struct inode *dir,
                              struct ext4_dir_entry_2 *de_del,
                              struct buffer_head *bh,
                              void *entry_buf,
@@ -2472,7 +2481,7 @@ int ext4_generic_delete_entry(handle_t *handle,
        de = (struct ext4_dir_entry_2 *)entry_buf;
        while (i < buf_size - csum_size) {
                if (ext4_check_dir_entry(dir, NULL, de, bh,
-                                        bh->b_data, bh->b_size, i))
+                                        entry_buf, buf_size, i))
                        return -EFSCORRUPTED;
                if (de == de_del)  {
                        if (pde)
@@ -2517,8 +2526,7 @@ static int ext4_delete_entry(handle_t *handle,
        if (unlikely(err))
                goto out;
 
-       err = ext4_generic_delete_entry(handle, dir, de_del,
-                                       bh, bh->b_data,
+       err = ext4_generic_delete_entry(dir, de_del, bh, bh->b_data,
                                        dir->i_sb->s_blocksize, csum_size);
        if (err)
                goto out;
@@ -3193,30 +3201,33 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
         * in separate transaction */
        retval = dquot_initialize(dir);
        if (retval)
-               return retval;
+               goto out_trace;
        retval = dquot_initialize(d_inode(dentry));
        if (retval)
-               return retval;
+               goto out_trace;
 
-       retval = -ENOENT;
        bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
-       if (IS_ERR(bh))
-               return PTR_ERR(bh);
-       if (!bh)
-               goto end_unlink;
+       if (IS_ERR(bh)) {
+               retval = PTR_ERR(bh);
+               goto out_trace;
+       }
+       if (!bh) {
+               retval = -ENOENT;
+               goto out_trace;
+       }
 
        inode = d_inode(dentry);
 
-       retval = -EFSCORRUPTED;
-       if (le32_to_cpu(de->inode) != inode->i_ino)
-               goto end_unlink;
+       if (le32_to_cpu(de->inode) != inode->i_ino) {
+               retval = -EFSCORRUPTED;
+               goto out_bh;
+       }
 
        handle = ext4_journal_start(dir, EXT4_HT_DIR,
                                    EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
        if (IS_ERR(handle)) {
                retval = PTR_ERR(handle);
-               handle = NULL;
-               goto end_unlink;
+               goto out_bh;
        }
 
        if (IS_DIRSYNC(dir))
@@ -3224,12 +3235,12 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
 
        retval = ext4_delete_entry(handle, dir, de, bh);
        if (retval)
-               goto end_unlink;
+               goto out_handle;
        dir->i_ctime = dir->i_mtime = current_time(dir);
        ext4_update_dx_flag(dir);
        retval = ext4_mark_inode_dirty(handle, dir);
        if (retval)
-               goto end_unlink;
+               goto out_handle;
        if (inode->i_nlink == 0)
                ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
                                   dentry->d_name.len, dentry->d_name.name);
@@ -3251,10 +3262,11 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
                d_invalidate(dentry);
 #endif
 
-end_unlink:
+out_handle:
+       ext4_journal_stop(handle);
+out_bh:
        brelse(bh);
-       if (handle)
-               ext4_journal_stop(handle);
+out_trace:
        trace_ext4_unlink_exit(dentry, retval);
        return retval;
 }
index f2df2db..f014c5e 100644 (file)
@@ -140,7 +140,7 @@ static void bio_post_read_processing(struct bio_post_read_ctx *ctx)
                        return;
                }
                ctx->cur_step++;
-               /* fall-through */
+               fallthrough;
        case STEP_VERITY:
                if (ctx->enabled_steps & (1 << STEP_VERITY)) {
                        INIT_WORK(&ctx->work, verity_work);
@@ -148,7 +148,7 @@ static void bio_post_read_processing(struct bio_post_read_ctx *ctx)
                        return;
                }
                ctx->cur_step++;
-               /* fall-through */
+               fallthrough;
        default:
                __read_end_io(ctx->bio);
        }
index 0907f90..ea425b4 100644 (file)
@@ -66,10 +66,10 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
                             unsigned long journal_devnum);
 static int ext4_show_options(struct seq_file *seq, struct dentry *root);
 static int ext4_commit_super(struct super_block *sb, int sync);
-static void ext4_mark_recovery_complete(struct super_block *sb,
+static int ext4_mark_recovery_complete(struct super_block *sb,
                                        struct ext4_super_block *es);
-static void ext4_clear_journal_err(struct super_block *sb,
-                                  struct ext4_super_block *es);
+static int ext4_clear_journal_err(struct super_block *sb,
+                                 struct ext4_super_block *es);
 static int ext4_sync_fs(struct super_block *sb, int wait);
 static int ext4_remount(struct super_block *sb, int *flags, char *data);
 static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
@@ -744,6 +744,7 @@ void __ext4_msg(struct super_block *sb,
        struct va_format vaf;
        va_list args;
 
+       atomic_inc(&EXT4_SB(sb)->s_msg_count);
        if (!___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), "EXT4-fs"))
                return;
 
@@ -754,9 +755,12 @@ void __ext4_msg(struct super_block *sb,
        va_end(args);
 }
 
-#define ext4_warning_ratelimit(sb)                                     \
-               ___ratelimit(&(EXT4_SB(sb)->s_warning_ratelimit_state), \
-                            "EXT4-fs warning")
+static int ext4_warning_ratelimit(struct super_block *sb)
+{
+       atomic_inc(&EXT4_SB(sb)->s_warning_count);
+       return ___ratelimit(&(EXT4_SB(sb)->s_warning_ratelimit_state),
+                           "EXT4-fs warning");
+}
 
 void __ext4_warning(struct super_block *sb, const char *function,
                    unsigned int line, const char *fmt, ...)
@@ -1123,6 +1127,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
        inode_set_iversion(&ei->vfs_inode, 1);
        spin_lock_init(&ei->i_raw_lock);
        INIT_LIST_HEAD(&ei->i_prealloc_list);
+       atomic_set(&ei->i_prealloc_active, 0);
        spin_lock_init(&ei->i_prealloc_lock);
        ext4_es_init_tree(&ei->i_es_tree);
        rwlock_init(&ei->i_es_lock);
@@ -1216,7 +1221,7 @@ void ext4_clear_inode(struct inode *inode)
 {
        invalidate_inode_buffers(inode);
        clear_inode(inode);
-       ext4_discard_preallocations(inode);
+       ext4_discard_preallocations(inode, 0);
        ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);
        dquot_drop(inode);
        if (EXT4_I(inode)->jinode) {
@@ -1288,8 +1293,8 @@ static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
        if (!page_has_buffers(page))
                return 0;
        if (journal)
-               return jbd2_journal_try_to_free_buffers(journal, page,
-                                               wait & ~__GFP_DIRECT_RECLAIM);
+               return jbd2_journal_try_to_free_buffers(journal, page);
+
        return try_to_free_buffers(page);
 }
 
@@ -1522,6 +1527,7 @@ enum {
        Opt_dioread_nolock, Opt_dioread_lock,
        Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
        Opt_max_dir_size_kb, Opt_nojournal_checksum, Opt_nombcache,
+       Opt_prefetch_block_bitmaps,
 };
 
 static const match_table_t tokens = {
@@ -1614,6 +1620,7 @@ static const match_table_t tokens = {
        {Opt_inlinecrypt, "inlinecrypt"},
        {Opt_nombcache, "nombcache"},
        {Opt_nombcache, "no_mbcache"},  /* for backward compatibility */
+       {Opt_prefetch_block_bitmaps, "prefetch_block_bitmaps"},
        {Opt_removed, "check=none"},    /* mount option from ext2/3 */
        {Opt_removed, "nocheck"},       /* mount option from ext2/3 */
        {Opt_removed, "reservation"},   /* mount option from ext2/3 */
@@ -1831,6 +1838,8 @@ static const struct mount_opts {
        {Opt_max_dir_size_kb, 0, MOPT_GTE0},
        {Opt_test_dummy_encryption, 0, MOPT_STRING},
        {Opt_nombcache, EXT4_MOUNT_NO_MBCACHE, MOPT_SET},
+       {Opt_prefetch_block_bitmaps, EXT4_MOUNT_PREFETCH_BLOCK_BITMAPS,
+        MOPT_SET},
        {Opt_err, 0, 0}
 };
 
@@ -3213,15 +3222,34 @@ static void print_daily_error_info(struct timer_list *t)
 static int ext4_run_li_request(struct ext4_li_request *elr)
 {
        struct ext4_group_desc *gdp = NULL;
-       ext4_group_t group, ngroups;
-       struct super_block *sb;
+       struct super_block *sb = elr->lr_super;
+       ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
+       ext4_group_t group = elr->lr_next_group;
        unsigned long timeout = 0;
+       unsigned int prefetch_ios = 0;
        int ret = 0;
 
-       sb = elr->lr_super;
-       ngroups = EXT4_SB(sb)->s_groups_count;
+       if (elr->lr_mode == EXT4_LI_MODE_PREFETCH_BBITMAP) {
+               elr->lr_next_group = ext4_mb_prefetch(sb, group,
+                               EXT4_SB(sb)->s_mb_prefetch, &prefetch_ios);
+               if (prefetch_ios)
+                       ext4_mb_prefetch_fini(sb, elr->lr_next_group,
+                                             prefetch_ios);
+               trace_ext4_prefetch_bitmaps(sb, group, elr->lr_next_group,
+                                           prefetch_ios);
+               if (group >= elr->lr_next_group) {
+                       ret = 1;
+                       if (elr->lr_first_not_zeroed != ngroups &&
+                           !sb_rdonly(sb) && test_opt(sb, INIT_INODE_TABLE)) {
+                               elr->lr_next_group = elr->lr_first_not_zeroed;
+                               elr->lr_mode = EXT4_LI_MODE_ITABLE;
+                               ret = 0;
+                       }
+               }
+               return ret;
+       }
 
-       for (group = elr->lr_next_group; group < ngroups; group++) {
+       for (; group < ngroups; group++) {
                gdp = ext4_get_group_desc(sb, group, NULL);
                if (!gdp) {
                        ret = 1;
@@ -3239,9 +3267,10 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
                timeout = jiffies;
                ret = ext4_init_inode_table(sb, group,
                                            elr->lr_timeout ? 0 : 1);
+               trace_ext4_lazy_itable_init(sb, group);
                if (elr->lr_timeout == 0) {
                        timeout = (jiffies - timeout) *
-                                 elr->lr_sbi->s_li_wait_mult;
+                               EXT4_SB(elr->lr_super)->s_li_wait_mult;
                        elr->lr_timeout = timeout;
                }
                elr->lr_next_sched = jiffies + elr->lr_timeout;
@@ -3256,15 +3285,11 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
  */
 static void ext4_remove_li_request(struct ext4_li_request *elr)
 {
-       struct ext4_sb_info *sbi;
-
        if (!elr)
                return;
 
-       sbi = elr->lr_sbi;
-
        list_del(&elr->lr_request);
-       sbi->s_li_request = NULL;
+       EXT4_SB(elr->lr_super)->s_li_request = NULL;
        kfree(elr);
 }
 
@@ -3473,7 +3498,6 @@ static int ext4_li_info_new(void)
 static struct ext4_li_request *ext4_li_request_new(struct super_block *sb,
                                            ext4_group_t start)
 {
-       struct ext4_sb_info *sbi = EXT4_SB(sb);
        struct ext4_li_request *elr;
 
        elr = kzalloc(sizeof(*elr), GFP_KERNEL);
@@ -3481,8 +3505,13 @@ static struct ext4_li_request *ext4_li_request_new(struct super_block *sb,
                return NULL;
 
        elr->lr_super = sb;
-       elr->lr_sbi = sbi;
-       elr->lr_next_group = start;
+       elr->lr_first_not_zeroed = start;
+       if (test_opt(sb, PREFETCH_BLOCK_BITMAPS))
+               elr->lr_mode = EXT4_LI_MODE_PREFETCH_BBITMAP;
+       else {
+               elr->lr_mode = EXT4_LI_MODE_ITABLE;
+               elr->lr_next_group = start;
+       }
 
        /*
         * Randomize first schedule time of the request to
@@ -3512,8 +3541,9 @@ int ext4_register_li_request(struct super_block *sb,
                goto out;
        }
 
-       if (first_not_zeroed == ngroups || sb_rdonly(sb) ||
-           !test_opt(sb, INIT_INODE_TABLE))
+       if (!test_opt(sb, PREFETCH_BLOCK_BITMAPS) &&
+           (first_not_zeroed == ngroups || sb_rdonly(sb) ||
+            !test_opt(sb, INIT_INODE_TABLE)))
                goto out;
 
        elr = ext4_li_request_new(sb, first_not_zeroed);
@@ -4710,11 +4740,13 @@ no_journal:
 
        ext4_set_resv_clusters(sb);
 
-       err = ext4_setup_system_zone(sb);
-       if (err) {
-               ext4_msg(sb, KERN_ERR, "failed to initialize system "
-                        "zone (%d)", err);
-               goto failed_mount4a;
+       if (test_opt(sb, BLOCK_VALIDITY)) {
+               err = ext4_setup_system_zone(sb);
+               if (err) {
+                       ext4_msg(sb, KERN_ERR, "failed to initialize system "
+                                "zone (%d)", err);
+                       goto failed_mount4a;
+               }
        }
 
        ext4_ext_init(sb);
@@ -4777,12 +4809,23 @@ no_journal:
        }
 #endif  /* CONFIG_QUOTA */
 
+       /*
+        * Save the original bdev mapping's wb_err value which could be
+        * used to detect the metadata async write error.
+        */
+       spin_lock_init(&sbi->s_bdev_wb_lock);
+       if (!sb_rdonly(sb))
+               errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err,
+                                        &sbi->s_bdev_wb_err);
+       sb->s_bdev->bd_super = sb;
        EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;
        ext4_orphan_cleanup(sb, es);
        EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
        if (needs_recovery) {
                ext4_msg(sb, KERN_INFO, "recovery complete");
-               ext4_mark_recovery_complete(sb, es);
+               err = ext4_mark_recovery_complete(sb, es);
+               if (err)
+                       goto failed_mount8;
        }
        if (EXT4_SB(sb)->s_journal) {
                if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
@@ -4816,6 +4859,8 @@ no_journal:
        ratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10);
        ratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10);
        ratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);
+       atomic_set(&sbi->s_warning_count, 0);
+       atomic_set(&sbi->s_msg_count, 0);
 
        kfree(orig_data);
        return 0;
@@ -4825,10 +4870,8 @@ cantfind_ext4:
                ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
        goto failed_mount;
 
-#ifdef CONFIG_QUOTA
 failed_mount8:
        ext4_unregister_sysfs(sb);
-#endif
 failed_mount7:
        ext4_unregister_li_request(sb);
 failed_mount6:
@@ -4968,7 +5011,8 @@ static journal_t *ext4_get_journal(struct super_block *sb,
        struct inode *journal_inode;
        journal_t *journal;
 
-       BUG_ON(!ext4_has_feature_journal(sb));
+       if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
+               return NULL;
 
        journal_inode = ext4_get_journal_inode(sb, journal_inum);
        if (!journal_inode)
@@ -4998,7 +5042,8 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
        struct ext4_super_block *es;
        struct block_device *bdev;
 
-       BUG_ON(!ext4_has_feature_journal(sb));
+       if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
+               return NULL;
 
        bdev = ext4_blkdev_get(j_dev, sb);
        if (bdev == NULL)
@@ -5089,8 +5134,10 @@ static int ext4_load_journal(struct super_block *sb,
        dev_t journal_dev;
        int err = 0;
        int really_read_only;
+       int journal_dev_ro;
 
-       BUG_ON(!ext4_has_feature_journal(sb));
+       if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
+               return -EFSCORRUPTED;
 
        if (journal_devnum &&
            journal_devnum != le32_to_cpu(es->s_journal_dev)) {
@@ -5100,7 +5147,31 @@ static int ext4_load_journal(struct super_block *sb,
        } else
                journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
 
-       really_read_only = bdev_read_only(sb->s_bdev);
+       if (journal_inum && journal_dev) {
+               ext4_msg(sb, KERN_ERR,
+                        "filesystem has both journal inode and journal device!");
+               return -EINVAL;
+       }
+
+       if (journal_inum) {
+               journal = ext4_get_journal(sb, journal_inum);
+               if (!journal)
+                       return -EINVAL;
+       } else {
+               journal = ext4_get_dev_journal(sb, journal_dev);
+               if (!journal)
+                       return -EINVAL;
+       }
+
+       journal_dev_ro = bdev_read_only(journal->j_dev);
+       really_read_only = bdev_read_only(sb->s_bdev) | journal_dev_ro;
+
+       if (journal_dev_ro && !sb_rdonly(sb)) {
+               ext4_msg(sb, KERN_ERR,
+                        "journal device read-only, try mounting with '-o ro'");
+               err = -EROFS;
+               goto err_out;
+       }
 
        /*
         * Are we loading a blank journal or performing recovery after a
@@ -5115,27 +5186,14 @@ static int ext4_load_journal(struct super_block *sb,
                                ext4_msg(sb, KERN_ERR, "write access "
                                        "unavailable, cannot proceed "
                                        "(try mounting with noload)");
-                               return -EROFS;
+                               err = -EROFS;
+                               goto err_out;
                        }
                        ext4_msg(sb, KERN_INFO, "write access will "
                               "be enabled during recovery");
                }
        }
 
-       if (journal_inum && journal_dev) {
-               ext4_msg(sb, KERN_ERR, "filesystem has both journal "
-                      "and inode journals!");
-               return -EINVAL;
-       }
-
-       if (journal_inum) {
-               if (!(journal = ext4_get_journal(sb, journal_inum)))
-                       return -EINVAL;
-       } else {
-               if (!(journal = ext4_get_dev_journal(sb, journal_dev)))
-                       return -EINVAL;
-       }
-
        if (!(journal->j_flags & JBD2_BARRIER))
                ext4_msg(sb, KERN_INFO, "barriers disabled");
 
@@ -5155,12 +5213,16 @@ static int ext4_load_journal(struct super_block *sb,
 
        if (err) {
                ext4_msg(sb, KERN_ERR, "error loading journal");
-               jbd2_journal_destroy(journal);
-               return err;
+               goto err_out;
        }
 
        EXT4_SB(sb)->s_journal = journal;
-       ext4_clear_journal_err(sb, es);
+       err = ext4_clear_journal_err(sb, es);
+       if (err) {
+               EXT4_SB(sb)->s_journal = NULL;
+               jbd2_journal_destroy(journal);
+               return err;
+       }
 
        if (!really_read_only && journal_devnum &&
            journal_devnum != le32_to_cpu(es->s_journal_dev)) {
@@ -5171,6 +5233,10 @@ static int ext4_load_journal(struct super_block *sb,
        }
 
        return 0;
+
+err_out:
+       jbd2_journal_destroy(journal);
+       return err;
 }
 
 static int ext4_commit_super(struct super_block *sb, int sync)
@@ -5182,13 +5248,6 @@ static int ext4_commit_super(struct super_block *sb, int sync)
        if (!sbh || block_device_ejected(sb))
                return error;
 
-       /*
-        * The superblock bh should be mapped, but it might not be if the
-        * device was hot-removed. Not much we can do but fail the I/O.
-        */
-       if (!buffer_mapped(sbh))
-               return error;
-
        /*
         * If the file system is mounted read-only, don't update the
         * superblock write time.  This avoids updating the superblock
@@ -5256,26 +5315,32 @@ static int ext4_commit_super(struct super_block *sb, int sync)
  * remounting) the filesystem readonly, then we will end up with a
  * consistent fs on disk.  Record that fact.
  */
-static void ext4_mark_recovery_complete(struct super_block *sb,
-                                       struct ext4_super_block *es)
+static int ext4_mark_recovery_complete(struct super_block *sb,
+                                      struct ext4_super_block *es)
 {
+       int err;
        journal_t *journal = EXT4_SB(sb)->s_journal;
 
        if (!ext4_has_feature_journal(sb)) {
-               BUG_ON(journal != NULL);
-               return;
+               if (journal != NULL) {
+                       ext4_error(sb, "Journal got removed while the fs was "
+                                  "mounted!");
+                       return -EFSCORRUPTED;
+               }
+               return 0;
        }
        jbd2_journal_lock_updates(journal);
-       if (jbd2_journal_flush(journal) < 0)
+       err = jbd2_journal_flush(journal);
+       if (err < 0)
                goto out;
 
        if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) {
                ext4_clear_feature_journal_needs_recovery(sb);
                ext4_commit_super(sb, 1);
        }
-
 out:
        jbd2_journal_unlock_updates(journal);
+       return err;
 }
 
 /*
@@ -5283,14 +5348,17 @@ out:
  * has recorded an error from a previous lifetime, move that error to the
  * main filesystem now.
  */
-static void ext4_clear_journal_err(struct super_block *sb,
+static int ext4_clear_journal_err(struct super_block *sb,
                                   struct ext4_super_block *es)
 {
        journal_t *journal;
        int j_errno;
        const char *errstr;
 
-       BUG_ON(!ext4_has_feature_journal(sb));
+       if (!ext4_has_feature_journal(sb)) {
+               ext4_error(sb, "Journal got removed while the fs was mounted!");
+               return -EFSCORRUPTED;
+       }
 
        journal = EXT4_SB(sb)->s_journal;
 
@@ -5315,6 +5383,7 @@ static void ext4_clear_journal_err(struct super_block *sb,
                jbd2_journal_clear_err(journal);
                jbd2_journal_update_sb_errno(journal);
        }
+       return 0;
 }
 
 /*
@@ -5457,7 +5526,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 {
        struct ext4_super_block *es;
        struct ext4_sb_info *sbi = EXT4_SB(sb);
-       unsigned long old_sb_flags;
+       unsigned long old_sb_flags, vfs_flags;
        struct ext4_mount_options old_opts;
        int enable_quota = 0;
        ext4_group_t g;
@@ -5500,6 +5569,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
        if (sbi->s_journal && sbi->s_journal->j_task->io_context)
                journal_ioprio = sbi->s_journal->j_task->io_context->ioprio;
 
+       /*
+        * Some options can be enabled by ext4 and/or by VFS mount flag
+        * either way we need to make sure it matches in both *flags and
+        * s_flags. Copy those selected flags from *flags to s_flags
+        */
+       vfs_flags = SB_LAZYTIME | SB_I_VERSION;
+       sb->s_flags = (sb->s_flags & ~vfs_flags) | (*flags & vfs_flags);
+
        if (!parse_options(data, sb, NULL, &journal_ioprio, 1)) {
                err = -EINVAL;
                goto restore_opts;
@@ -5553,9 +5630,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                set_task_ioprio(sbi->s_journal->j_task, journal_ioprio);
        }
 
-       if (*flags & SB_LAZYTIME)
-               sb->s_flags |= SB_LAZYTIME;
-
        if ((bool)(*flags & SB_RDONLY) != sb_rdonly(sb)) {
                if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) {
                        err = -EROFS;
@@ -5585,8 +5659,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                            (sbi->s_mount_state & EXT4_VALID_FS))
                                es->s_state = cpu_to_le16(sbi->s_mount_state);
 
-                       if (sbi->s_journal)
+                       if (sbi->s_journal) {
+                               /*
+                                * We let remount-ro finish even if marking fs
+                                * as clean failed...
+                                */
                                ext4_mark_recovery_complete(sb, es);
+                       }
                        if (sbi->s_mmp_tsk)
                                kthread_stop(sbi->s_mmp_tsk);
                } else {
@@ -5628,14 +5707,25 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                                goto restore_opts;
                        }
 
+                       /*
+                        * Update the original bdev mapping's wb_err value
+                        * which could be used to detect the metadata async
+                        * write error.
+                        */
+                       errseq_check_and_advance(&sb->s_bdev->bd_inode->i_mapping->wb_err,
+                                                &sbi->s_bdev_wb_err);
+
                        /*
                         * Mounting a RDONLY partition read-write, so reread
                         * and store the current valid flag.  (It may have
                         * been changed by e2fsck since we originally mounted
                         * the partition.)
                         */
-                       if (sbi->s_journal)
-                               ext4_clear_journal_err(sb, es);
+                       if (sbi->s_journal) {
+                               err = ext4_clear_journal_err(sb, es);
+                               if (err)
+                                       goto restore_opts;
+                       }
                        sbi->s_mount_state = le16_to_cpu(es->s_state);
 
                        err = ext4_setup_super(sb, es, 0);
@@ -5665,7 +5755,17 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                ext4_register_li_request(sb, first_not_zeroed);
        }
 
-       ext4_setup_system_zone(sb);
+       /*
+        * Handle creation of system zone data early because it can fail.
+        * Releasing of existing data is done when we are sure remount will
+        * succeed.
+        */
+       if (test_opt(sb, BLOCK_VALIDITY) && !sbi->system_blks) {
+               err = ext4_setup_system_zone(sb);
+               if (err)
+                       goto restore_opts;
+       }
+
        if (sbi->s_journal == NULL && !(old_sb_flags & SB_RDONLY)) {
                err = ext4_commit_super(sb, 1);
                if (err)
@@ -5686,8 +5786,16 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                }
        }
 #endif
+       if (!test_opt(sb, BLOCK_VALIDITY) && sbi->system_blks)
+               ext4_release_system_zone(sb);
+
+       /*
+        * Some options can be enabled by ext4 and/or by VFS mount flag
+        * either way we need to make sure it matches in both *flags and
+        * s_flags. Copy those selected flags from s_flags to *flags
+        */
+       *flags = (*flags & ~vfs_flags) | (sb->s_flags & vfs_flags);
 
-       *flags = (*flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYTIME);
        ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data);
        kfree(orig_data);
        return 0;
@@ -5701,6 +5809,8 @@ restore_opts:
        sbi->s_commit_interval = old_opts.s_commit_interval;
        sbi->s_min_batch_time = old_opts.s_min_batch_time;
        sbi->s_max_batch_time = old_opts.s_max_batch_time;
+       if (!test_opt(sb, BLOCK_VALIDITY) && sbi->system_blks)
+               ext4_release_system_zone(sb);
 #ifdef CONFIG_QUOTA
        sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
        for (i = 0; i < EXT4_MAXQUOTAS; i++) {
index 6c9fc9e..bfabb79 100644 (file)
@@ -189,6 +189,9 @@ static struct ext4_attr ext4_attr_##_name = {                       \
 #define EXT4_RW_ATTR_SBI_UL(_name,_elname)     \
        EXT4_ATTR_OFFSET(_name, 0644, pointer_ul, ext4_sb_info, _elname)
 
+#define EXT4_RO_ATTR_SBI_ATOMIC(_name,_elname) \
+       EXT4_ATTR_OFFSET(_name, 0444, pointer_atomic, ext4_sb_info, _elname)
+
 #define EXT4_ATTR_PTR(_name,_mode,_id,_ptr) \
 static struct ext4_attr ext4_attr_##_name = {                  \
        .attr = {.name = __stringify(_name), .mode = _mode },   \
@@ -215,6 +218,7 @@ EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
 EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
 EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
 EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
+EXT4_RW_ATTR_SBI_UI(mb_max_inode_prealloc, s_mb_max_inode_prealloc);
 EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
 EXT4_ATTR(trigger_fs_error, 0200, trigger_test_error);
 EXT4_RW_ATTR_SBI_UI(err_ratelimit_interval_ms, s_err_ratelimit_state.interval);
@@ -226,6 +230,8 @@ EXT4_RW_ATTR_SBI_UI(msg_ratelimit_burst, s_msg_ratelimit_state.burst);
 #ifdef CONFIG_EXT4_DEBUG
 EXT4_RW_ATTR_SBI_UL(simulate_fail, s_simulate_fail);
 #endif
+EXT4_RO_ATTR_SBI_ATOMIC(warning_count, s_warning_count);
+EXT4_RO_ATTR_SBI_ATOMIC(msg_count, s_msg_count);
 EXT4_RO_ATTR_ES_UI(errors_count, s_error_count);
 EXT4_RO_ATTR_ES_U8(first_error_errcode, s_first_error_errcode);
 EXT4_RO_ATTR_ES_U8(last_error_errcode, s_last_error_errcode);
@@ -240,6 +246,8 @@ EXT4_RO_ATTR_ES_STRING(last_error_func, s_last_error_func, 32);
 EXT4_ATTR(first_error_time, 0444, first_error_time);
 EXT4_ATTR(last_error_time, 0444, last_error_time);
 EXT4_ATTR(journal_task, 0444, journal_task);
+EXT4_RW_ATTR_SBI_UI(mb_prefetch, s_mb_prefetch);
+EXT4_RW_ATTR_SBI_UI(mb_prefetch_limit, s_mb_prefetch_limit);
 
 static unsigned int old_bump_val = 128;
 EXT4_ATTR_PTR(max_writeback_mb_bump, 0444, pointer_ui, &old_bump_val);
@@ -257,6 +265,7 @@ static struct attribute *ext4_attrs[] = {
        ATTR_LIST(mb_order2_req),
        ATTR_LIST(mb_stream_req),
        ATTR_LIST(mb_group_prealloc),
+       ATTR_LIST(mb_max_inode_prealloc),
        ATTR_LIST(max_writeback_mb_bump),
        ATTR_LIST(extent_max_zeroout_kb),
        ATTR_LIST(trigger_fs_error),
@@ -267,6 +276,8 @@ static struct attribute *ext4_attrs[] = {
        ATTR_LIST(msg_ratelimit_interval_ms),
        ATTR_LIST(msg_ratelimit_burst),
        ATTR_LIST(errors_count),
+       ATTR_LIST(warning_count),
+       ATTR_LIST(msg_count),
        ATTR_LIST(first_error_ino),
        ATTR_LIST(last_error_ino),
        ATTR_LIST(first_error_block),
@@ -283,6 +294,8 @@ static struct attribute *ext4_attrs[] = {
 #ifdef CONFIG_EXT4_DEBUG
        ATTR_LIST(simulate_fail),
 #endif
+       ATTR_LIST(mb_prefetch),
+       ATTR_LIST(mb_prefetch_limit),
        NULL,
 };
 ATTRIBUTE_GROUPS(ext4);
index 7d2f657..cba4b87 100644 (file)
@@ -1356,8 +1356,7 @@ retry:
 
        block = 0;
        while (wsize < bufsize) {
-               if (bh != NULL)
-                       brelse(bh);
+               brelse(bh);
                csize = (bufsize - wsize) > blocksize ? blocksize :
                                                                bufsize - wsize;
                bh = ext4_getblk(handle, ea_inode, block, 0);
index 16322ea..d9e52a7 100644 (file)
@@ -2646,7 +2646,7 @@ static inline void __mark_inode_dirty_flag(struct inode *inode,
        case FI_NEW_INODE:
                if (set)
                        return;
-               /* fall through */
+               fallthrough;
        case FI_DATA_EXIST:
        case FI_INLINE_DOTS:
        case FI_PIN_FILE:
index 9bbaa26..3ad7bdb 100644 (file)
@@ -618,10 +618,10 @@ pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs)
        switch (dn->max_level) {
        case 3:
                base += 2 * indirect_blks;
-               /* fall through */
+               fallthrough;
        case 2:
                base += 2 * direct_blks;
-               /* fall through */
+               fallthrough;
        case 1:
                base += direct_index;
                break;
index 2e4c0fa..19ac5ba 100644 (file)
@@ -362,7 +362,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
        case F_OFD_SETLK:
        case F_OFD_SETLKW:
 #endif
-               /* Fallthrough */
+               fallthrough;
        case F_SETLK:
        case F_SETLKW:
                if (copy_from_user(&flock, argp, sizeof(flock)))
@@ -771,7 +771,7 @@ static void send_sigio_to_task(struct task_struct *p,
                        if (!do_send_sig_info(signum, &si, p, type))
                                break;
                }
-               /* fall-through - fall back on the old plain SIGIO signal */
+                       fallthrough;    /* fall back on the old plain SIGIO signal */
                case 0:
                        do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type);
        }
index a605c3d..1492271 100644 (file)
@@ -42,7 +42,6 @@
 struct wb_writeback_work {
        long nr_pages;
        struct super_block *sb;
-       unsigned long *older_than_this;
        enum writeback_sync_modes sync_mode;
        unsigned int tagged_writepages:1;
        unsigned int for_kupdate:1;
@@ -144,7 +143,9 @@ static void inode_io_list_del_locked(struct inode *inode,
                                     struct bdi_writeback *wb)
 {
        assert_spin_locked(&wb->list_lock);
+       assert_spin_locked(&inode->i_lock);
 
+       inode->i_state &= ~I_SYNC_QUEUED;
        list_del_init(&inode->i_io_list);
        wb_io_lists_depopulated(wb);
 }
@@ -1122,7 +1123,9 @@ void inode_io_list_del(struct inode *inode)
        struct bdi_writeback *wb;
 
        wb = inode_to_wb_and_lock_list(inode);
+       spin_lock(&inode->i_lock);
        inode_io_list_del_locked(inode, wb);
+       spin_unlock(&inode->i_lock);
        spin_unlock(&wb->list_lock);
 }
 EXPORT_SYMBOL(inode_io_list_del);
@@ -1172,8 +1175,10 @@ void sb_clear_inode_writeback(struct inode *inode)
  * the case then the inode must have been redirtied while it was being written
  * out and we don't reset its dirtied_when.
  */
-static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
+static void redirty_tail_locked(struct inode *inode, struct bdi_writeback *wb)
 {
+       assert_spin_locked(&inode->i_lock);
+
        if (!list_empty(&wb->b_dirty)) {
                struct inode *tail;
 
@@ -1182,6 +1187,14 @@ static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
                        inode->dirtied_when = jiffies;
        }
        inode_io_list_move_locked(inode, wb, &wb->b_dirty);
+       inode->i_state &= ~I_SYNC_QUEUED;
+}
+
+static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
+{
+       spin_lock(&inode->i_lock);
+       redirty_tail_locked(inode, wb);
+       spin_unlock(&inode->i_lock);
 }
 
 /*
@@ -1220,16 +1233,13 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
 #define EXPIRE_DIRTY_ATIME 0x0001
 
 /*
- * Move expired (dirtied before work->older_than_this) dirty inodes from
+ * Move expired (dirtied before dirtied_before) dirty inodes from
  * @delaying_queue to @dispatch_queue.
  */
 static int move_expired_inodes(struct list_head *delaying_queue,
                               struct list_head *dispatch_queue,
-                              int flags,
-                              struct wb_writeback_work *work)
+                              unsigned long dirtied_before)
 {
-       unsigned long *older_than_this = NULL;
-       unsigned long expire_time;
        LIST_HEAD(tmp);
        struct list_head *pos, *node;
        struct super_block *sb = NULL;
@@ -1237,21 +1247,15 @@ static int move_expired_inodes(struct list_head *delaying_queue,
        int do_sb_sort = 0;
        int moved = 0;
 
-       if ((flags & EXPIRE_DIRTY_ATIME) == 0)
-               older_than_this = work->older_than_this;
-       else if (!work->for_sync) {
-               expire_time = jiffies - (dirtytime_expire_interval * HZ);
-               older_than_this = &expire_time;
-       }
        while (!list_empty(delaying_queue)) {
                inode = wb_inode(delaying_queue->prev);
-               if (older_than_this &&
-                   inode_dirtied_after(inode, *older_than_this))
+               if (inode_dirtied_after(inode, dirtied_before))
                        break;
                list_move(&inode->i_io_list, &tmp);
                moved++;
-               if (flags & EXPIRE_DIRTY_ATIME)
-                       set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state);
+               spin_lock(&inode->i_lock);
+               inode->i_state |= I_SYNC_QUEUED;
+               spin_unlock(&inode->i_lock);
                if (sb_is_blkdev_sb(inode->i_sb))
                        continue;
                if (sb && sb != inode->i_sb)
@@ -1289,18 +1293,22 @@ out:
  *                                           |
  *                                           +--> dequeue for IO
  */
-static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
+static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work,
+                    unsigned long dirtied_before)
 {
        int moved;
+       unsigned long time_expire_jif = dirtied_before;
 
        assert_spin_locked(&wb->list_lock);
        list_splice_init(&wb->b_more_io, &wb->b_io);
-       moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, work);
+       moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, dirtied_before);
+       if (!work->for_sync)
+               time_expire_jif = jiffies - dirtytime_expire_interval * HZ;
        moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io,
-                                    EXPIRE_DIRTY_ATIME, work);
+                                    time_expire_jif);
        if (moved)
                wb_io_lists_populated(wb);
-       trace_writeback_queue_io(wb, work, moved);
+       trace_writeback_queue_io(wb, work, dirtied_before, moved);
 }
 
 static int write_inode(struct inode *inode, struct writeback_control *wbc)
@@ -1394,7 +1402,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
                 * writeback is not making progress due to locked
                 * buffers. Skip this inode for now.
                 */
-               redirty_tail(inode, wb);
+               redirty_tail_locked(inode, wb);
                return;
        }
 
@@ -1414,7 +1422,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
                         * retrying writeback of the dirty page/inode
                         * that cannot be performed immediately.
                         */
-                       redirty_tail(inode, wb);
+                       redirty_tail_locked(inode, wb);
                }
        } else if (inode->i_state & I_DIRTY) {
                /*
@@ -1422,10 +1430,11 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
                 * such as delayed allocation during submission or metadata
                 * updates after data IO completion.
                 */
-               redirty_tail(inode, wb);
+               redirty_tail_locked(inode, wb);
        } else if (inode->i_state & I_DIRTY_TIME) {
                inode->dirtied_when = jiffies;
                inode_io_list_move_locked(inode, wb, &wb->b_dirty_time);
+               inode->i_state &= ~I_SYNC_QUEUED;
        } else {
                /* The inode is clean. Remove from writeback lists. */
                inode_io_list_del_locked(inode, wb);
@@ -1472,18 +1481,14 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
        spin_lock(&inode->i_lock);
 
        dirty = inode->i_state & I_DIRTY;
-       if (inode->i_state & I_DIRTY_TIME) {
-               if ((dirty & I_DIRTY_INODE) ||
-                   wbc->sync_mode == WB_SYNC_ALL ||
-                   unlikely(inode->i_state & I_DIRTY_TIME_EXPIRED) ||
-                   unlikely(time_after(jiffies,
-                                       (inode->dirtied_time_when +
-                                        dirtytime_expire_interval * HZ)))) {
-                       dirty |= I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED;
-                       trace_writeback_lazytime(inode);
-               }
-       } else
-               inode->i_state &= ~I_DIRTY_TIME_EXPIRED;
+       if ((inode->i_state & I_DIRTY_TIME) &&
+           ((dirty & I_DIRTY_INODE) ||
+            wbc->sync_mode == WB_SYNC_ALL || wbc->for_sync ||
+            time_after(jiffies, inode->dirtied_time_when +
+                       dirtytime_expire_interval * HZ))) {
+               dirty |= I_DIRTY_TIME;
+               trace_writeback_lazytime(inode);
+       }
        inode->i_state &= ~dirty;
 
        /*
@@ -1669,8 +1674,8 @@ static long writeback_sb_inodes(struct super_block *sb,
                 */
                spin_lock(&inode->i_lock);
                if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
+                       redirty_tail_locked(inode, wb);
                        spin_unlock(&inode->i_lock);
-                       redirty_tail(inode, wb);
                        continue;
                }
                if ((inode->i_state & I_SYNC) && wbc.sync_mode != WB_SYNC_ALL) {
@@ -1811,7 +1816,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
        blk_start_plug(&plug);
        spin_lock(&wb->list_lock);
        if (list_empty(&wb->b_io))
-               queue_io(wb, &work);
+               queue_io(wb, &work, jiffies);
        __writeback_inodes_wb(wb, &work);
        spin_unlock(&wb->list_lock);
        blk_finish_plug(&plug);
@@ -1831,7 +1836,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
  * takes longer than a dirty_writeback_interval interval, then leave a
  * one-second gap.
  *
- * older_than_this takes precedence over nr_to_write.  So we'll only write back
+ * dirtied_before takes precedence over nr_to_write.  So we'll only write back
  * all dirty pages if they are all attached to "old" mappings.
  */
 static long wb_writeback(struct bdi_writeback *wb,
@@ -1839,14 +1844,11 @@ static long wb_writeback(struct bdi_writeback *wb,
 {
        unsigned long wb_start = jiffies;
        long nr_pages = work->nr_pages;
-       unsigned long oldest_jif;
+       unsigned long dirtied_before = jiffies;
        struct inode *inode;
        long progress;
        struct blk_plug plug;
 
-       oldest_jif = jiffies;
-       work->older_than_this = &oldest_jif;
-
        blk_start_plug(&plug);
        spin_lock(&wb->list_lock);
        for (;;) {
@@ -1880,14 +1882,14 @@ static long wb_writeback(struct bdi_writeback *wb,
                 * safe.
                 */
                if (work->for_kupdate) {
-                       oldest_jif = jiffies -
+                       dirtied_before = jiffies -
                                msecs_to_jiffies(dirty_expire_interval * 10);
                } else if (work->for_background)
-                       oldest_jif = jiffies;
+                       dirtied_before = jiffies;
 
                trace_writeback_start(wb, work);
                if (list_empty(&wb->b_io))
-                       queue_io(wb, work);
+                       queue_io(wb, work, dirtied_before);
                if (work->sb)
                        progress = writeback_sb_inodes(work->sb, wb, work);
                else
@@ -2289,11 +2291,12 @@ void __mark_inode_dirty(struct inode *inode, int flags)
                inode->i_state |= flags;
 
                /*
-                * If the inode is being synced, just update its dirty state.
-                * The unlocker will place the inode on the appropriate
-                * superblock list, based upon its state.
+                * If the inode is queued for writeback by flush worker, just
+                * update its dirty state. Once the flush worker is done with
+                * the inode it will place it on the appropriate superblock
+                * list, based upon its state.
                 */
-               if (inode->i_state & I_SYNC)
+               if (inode->i_state & I_SYNC_QUEUED)
                        goto out_unlock_inode;
 
                /*
index 7d5c5dd..2834d1a 100644 (file)
@@ -521,7 +521,7 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
        switch (param->type) {
        case fs_value_is_string:
                len = 1 + param->size;
-               /* Fall through */
+               fallthrough;
        case fs_value_is_flag:
                len += strlen(param->key);
                break;
index 2fa3f24..27a890a 100644 (file)
@@ -412,7 +412,7 @@ SYSCALL_DEFINE5(fsconfig,
                break;
        case FSCONFIG_SET_PATH_EMPTY:
                lookup_flags = LOOKUP_EMPTY;
-               /* fallthru */
+               fallthrough;
        case FSCONFIG_SET_PATH:
                param.type = fs_value_is_filename;
                param.name = getname_flags(_value, lookup_flags, NULL);
index 770f3a7..0f69fbd 100644 (file)
@@ -746,7 +746,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
                        }
                        if (n == 0)
                                break;
-               /* fall through - To branching from existing tree */
+                       fallthrough;    /* To branching from existing tree */
                case ALLOC_GROW_DEPTH:
                        if (i > 1 && i < mp->mp_fheight)
                                gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[i-1]);
@@ -757,7 +757,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
                                state = ALLOC_DATA;
                        if (n == 0)
                                break;
-               /* fall through - To tree complete, adding data blocks */
+                       fallthrough;    /* To tree complete, adding data blocks */
                case ALLOC_DATA:
                        BUG_ON(n > dblks);
                        BUG_ON(mp->mp_bh[end_of_metadata] == NULL);
index a58333e..3763c9f 100644 (file)
@@ -901,6 +901,36 @@ static void empty_ail1_list(struct gfs2_sbd *sdp)
        }
 }
 
+/**
+ * drain_bd - drain the buf and databuf queue for a failed transaction
+ * @tr: the transaction to drain
+ *
+ * When this is called, we're taking an error exit for a log write that failed
+ * but since we bypassed the after_commit functions, we need to remove the
+ * items from the buf and databuf queue.
+ */
+static void trans_drain(struct gfs2_trans *tr)
+{
+       struct gfs2_bufdata *bd;
+       struct list_head *head;
+
+       if (!tr)
+               return;
+
+       head = &tr->tr_buf;
+       while (!list_empty(head)) {
+               bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
+               list_del_init(&bd->bd_list);
+               kmem_cache_free(gfs2_bufdata_cachep, bd);
+       }
+       head = &tr->tr_databuf;
+       while (!list_empty(head)) {
+               bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
+               list_del_init(&bd->bd_list);
+               kmem_cache_free(gfs2_bufdata_cachep, bd);
+       }
+}
+
 /**
  * gfs2_log_flush - flush incore transaction(s)
  * @sdp: the filesystem
@@ -1005,6 +1035,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
 
 out:
        if (gfs2_withdrawn(sdp)) {
+               trans_drain(tr);
                /**
                 * If the tr_list is empty, we're withdrawing during a log
                 * flush that targets a transaction, but the transaction was
index 4b67d47..6e173ae 100644 (file)
@@ -1599,7 +1599,7 @@ static int gfs2_quota_get_state(struct super_block *sb, struct qc_state *state)
        case GFS2_QUOTA_ON:
                state->s_state[USRQUOTA].flags |= QCI_LIMITS_ENFORCED;
                state->s_state[GRPQUOTA].flags |= QCI_LIMITS_ENFORCED;
-               /*FALLTHRU*/
+               fallthrough;
        case GFS2_QUOTA_ACCOUNT:
                state->s_state[USRQUOTA].flags |= QCI_ACCT_ENABLED |
                                                  QCI_SYSFILE;
index e1c7eb6..6d4bf7e 100644 (file)
@@ -67,6 +67,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
                tr->tr_reserved += gfs2_struct2blk(sdp, revokes);
        INIT_LIST_HEAD(&tr->tr_databuf);
        INIT_LIST_HEAD(&tr->tr_buf);
+       INIT_LIST_HEAD(&tr->tr_list);
        INIT_LIST_HEAD(&tr->tr_ail1_list);
        INIT_LIST_HEAD(&tr->tr_ail2_list);
 
index 61eec62..0350dc7 100644 (file)
@@ -195,7 +195,7 @@ reread:
        switch (sbi->s_vhdr->signature) {
        case cpu_to_be16(HFSPLUS_VOLHEAD_SIGX):
                set_bit(HFSPLUS_SB_HFSX, &sbi->flags);
-               /*FALLTHRU*/
+               fallthrough;
        case cpu_to_be16(HFSPLUS_VOLHEAD_SIG):
                break;
        case cpu_to_be16(HFSP_WRAP_MAGIC):
index e92c472..414beb5 100644 (file)
@@ -925,6 +925,24 @@ static bool io_wq_worker_cancel(struct io_worker *worker, void *data)
        return match->nr_running && !match->cancel_all;
 }
 
+static inline void io_wqe_remove_pending(struct io_wqe *wqe,
+                                        struct io_wq_work *work,
+                                        struct io_wq_work_node *prev)
+{
+       unsigned int hash = io_get_work_hash(work);
+       struct io_wq_work *prev_work = NULL;
+
+       if (io_wq_is_hashed(work) && work == wqe->hash_tail[hash]) {
+               if (prev)
+                       prev_work = container_of(prev, struct io_wq_work, list);
+               if (prev_work && io_get_work_hash(prev_work) == hash)
+                       wqe->hash_tail[hash] = prev_work;
+               else
+                       wqe->hash_tail[hash] = NULL;
+       }
+       wq_list_del(&wqe->work_list, &work->list, prev);
+}
+
 static void io_wqe_cancel_pending_work(struct io_wqe *wqe,
                                       struct io_cb_cancel_data *match)
 {
@@ -938,8 +956,7 @@ retry:
                work = container_of(node, struct io_wq_work, list);
                if (!match->fn(work, match->data))
                        continue;
-
-               wq_list_del(&wqe->work_list, node, prev);
+               io_wqe_remove_pending(wqe, work, prev);
                spin_unlock_irqrestore(&wqe->lock, flags);
                io_run_cancel(work, wqe);
                match->nr_pending++;
index dc506b7..ce69bd9 100644 (file)
@@ -540,7 +540,6 @@ enum {
        REQ_F_ISREG_BIT,
        REQ_F_COMP_LOCKED_BIT,
        REQ_F_NEED_CLEANUP_BIT,
-       REQ_F_OVERFLOW_BIT,
        REQ_F_POLLED_BIT,
        REQ_F_BUFFER_SELECTED_BIT,
        REQ_F_NO_FILE_TABLE_BIT,
@@ -583,8 +582,6 @@ enum {
        REQ_F_COMP_LOCKED       = BIT(REQ_F_COMP_LOCKED_BIT),
        /* needs cleanup */
        REQ_F_NEED_CLEANUP      = BIT(REQ_F_NEED_CLEANUP_BIT),
-       /* in overflow list */
-       REQ_F_OVERFLOW          = BIT(REQ_F_OVERFLOW_BIT),
        /* already went through poll handler */
        REQ_F_POLLED            = BIT(REQ_F_POLLED_BIT),
        /* buffer already selected */
@@ -946,7 +943,8 @@ static void io_get_req_task(struct io_kiocb *req)
 
 static inline void io_clean_op(struct io_kiocb *req)
 {
-       if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED))
+       if (req->flags & (REQ_F_NEED_CLEANUP | REQ_F_BUFFER_SELECTED |
+                         REQ_F_INFLIGHT))
                __io_clean_op(req);
 }
 
@@ -1152,7 +1150,7 @@ static void io_prep_async_work(struct io_kiocb *req)
        io_req_init_async(req);
 
        if (req->flags & REQ_F_ISREG) {
-               if (def->hash_reg_file)
+               if (def->hash_reg_file || (req->ctx->flags & IORING_SETUP_IOPOLL))
                        io_wq_hash_work(&req->work, file_inode(req->file));
        } else {
                if (def->unbound_nonreg_file)
@@ -1366,7 +1364,6 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force)
                req = list_first_entry(&ctx->cq_overflow_list, struct io_kiocb,
                                                compl.list);
                list_move(&req->compl.list, &list);
-               req->flags &= ~REQ_F_OVERFLOW;
                if (cqe) {
                        WRITE_ONCE(cqe->user_data, req->user_data);
                        WRITE_ONCE(cqe->res, req->result);
@@ -1419,7 +1416,6 @@ static void __io_cqring_fill_event(struct io_kiocb *req, long res, long cflags)
                        ctx->rings->sq_flags |= IORING_SQ_CQ_OVERFLOW;
                }
                io_clean_op(req);
-               req->flags |= REQ_F_OVERFLOW;
                req->result = res;
                req->compl.cflags = cflags;
                refcount_inc(&req->refs);
@@ -1563,17 +1559,6 @@ static bool io_dismantle_req(struct io_kiocb *req)
        if (req->file)
                io_put_file(req, req->file, (req->flags & REQ_F_FIXED_FILE));
 
-       if (req->flags & REQ_F_INFLIGHT) {
-               struct io_ring_ctx *ctx = req->ctx;
-               unsigned long flags;
-
-               spin_lock_irqsave(&ctx->inflight_lock, flags);
-               list_del(&req->inflight_entry);
-               if (waitqueue_active(&ctx->inflight_wait))
-                       wake_up(&ctx->inflight_wait);
-               spin_unlock_irqrestore(&ctx->inflight_lock, flags);
-       }
-
        return io_req_clean_work(req);
 }
 
@@ -1761,7 +1746,8 @@ static struct io_kiocb *io_req_find_next(struct io_kiocb *req)
        return __io_req_find_next(req);
 }
 
-static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb)
+static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb,
+                               bool twa_signal_ok)
 {
        struct task_struct *tsk = req->task;
        struct io_ring_ctx *ctx = req->ctx;
@@ -1774,7 +1760,7 @@ static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb)
         * will do the job.
         */
        notify = 0;
-       if (!(ctx->flags & IORING_SETUP_SQPOLL))
+       if (!(ctx->flags & IORING_SETUP_SQPOLL) && twa_signal_ok)
                notify = TWA_SIGNAL;
 
        ret = task_work_add(tsk, cb, notify);
@@ -1834,7 +1820,7 @@ static void io_req_task_queue(struct io_kiocb *req)
        init_task_work(&req->task_work, io_req_task_submit);
        percpu_ref_get(&req->ctx->refs);
 
-       ret = io_req_task_work_add(req, &req->task_work);
+       ret = io_req_task_work_add(req, &req->task_work, true);
        if (unlikely(ret)) {
                struct task_struct *tsk;
 
@@ -2063,6 +2049,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
 
                req = list_first_entry(done, struct io_kiocb, inflight_entry);
                if (READ_ONCE(req->result) == -EAGAIN) {
+                       req->result = 0;
                        req->iopoll_completed = 0;
                        list_move_tail(&req->inflight_entry, &again);
                        continue;
@@ -2308,22 +2295,6 @@ end_req:
        io_req_complete(req, ret);
        return false;
 }
-
-static void io_rw_resubmit(struct callback_head *cb)
-{
-       struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
-       struct io_ring_ctx *ctx = req->ctx;
-       int err;
-
-       err = io_sq_thread_acquire_mm(ctx, req);
-
-       if (io_resubmit_prep(req, err)) {
-               refcount_inc(&req->refs);
-               io_queue_async_work(req);
-       }
-
-       percpu_ref_put(&ctx->refs);
-}
 #endif
 
 static bool io_rw_reissue(struct io_kiocb *req, long res)
@@ -2334,12 +2305,14 @@ static bool io_rw_reissue(struct io_kiocb *req, long res)
        if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker())
                return false;
 
-       init_task_work(&req->task_work, io_rw_resubmit);
-       percpu_ref_get(&req->ctx->refs);
+       ret = io_sq_thread_acquire_mm(req->ctx, req);
 
-       ret = io_req_task_work_add(req, &req->task_work);
-       if (!ret)
+       if (io_resubmit_prep(req, ret)) {
+               refcount_inc(&req->refs);
+               io_queue_async_work(req);
                return true;
+       }
+
 #endif
        return false;
 }
@@ -2578,7 +2551,7 @@ static inline void io_rw_done(struct kiocb *kiocb, ssize_t ret)
                 * IO with EINTR.
                 */
                ret = -EINTR;
-               /* fall through */
+               fallthrough;
        default:
                kiocb->ki_complete(kiocb, ret, 0);
        }
@@ -2819,22 +2792,15 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov,
        return __io_iov_buffer_select(req, iov, needs_lock);
 }
 
-static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
-                              struct iovec **iovec, struct iov_iter *iter,
-                              bool needs_lock)
+static ssize_t __io_import_iovec(int rw, struct io_kiocb *req,
+                                struct iovec **iovec, struct iov_iter *iter,
+                                bool needs_lock)
 {
        void __user *buf = u64_to_user_ptr(req->rw.addr);
        size_t sqe_len = req->rw.len;
        ssize_t ret;
        u8 opcode;
 
-       if (req->io) {
-               struct io_async_rw *iorw = &req->io->rw;
-
-               *iovec = NULL;
-               return iov_iter_count(&iorw->iter);
-       }
-
        opcode = req->opcode;
        if (opcode == IORING_OP_READ_FIXED || opcode == IORING_OP_WRITE_FIXED) {
                *iovec = NULL;
@@ -2848,10 +2814,8 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
        if (opcode == IORING_OP_READ || opcode == IORING_OP_WRITE) {
                if (req->flags & REQ_F_BUFFER_SELECT) {
                        buf = io_rw_buffer_select(req, &sqe_len, needs_lock);
-                       if (IS_ERR(buf)) {
-                               *iovec = NULL;
+                       if (IS_ERR(buf))
                                return PTR_ERR(buf);
-                       }
                        req->rw.len = sqe_len;
                }
 
@@ -2879,6 +2843,21 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
        return import_iovec(rw, buf, sqe_len, UIO_FASTIOV, iovec, iter);
 }
 
+static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
+                              struct iovec **iovec, struct iov_iter *iter,
+                              bool needs_lock)
+{
+       if (!req->io)
+               return __io_import_iovec(rw, req, iovec, iter, needs_lock);
+       *iovec = NULL;
+       return iov_iter_count(&req->io->rw.iter);
+}
+
+static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb)
+{
+       return kiocb->ki_filp->f_mode & FMODE_STREAM ? NULL : &kiocb->ki_pos;
+}
+
 /*
  * For files that don't have ->read_iter() and ->write_iter(), handle them
  * by looping over ->read() or ->write() manually.
@@ -2914,10 +2893,10 @@ static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb,
 
                if (rw == READ) {
                        nr = file->f_op->read(file, iovec.iov_base,
-                                             iovec.iov_len, &kiocb->ki_pos);
+                                             iovec.iov_len, io_kiocb_ppos(kiocb));
                } else {
                        nr = file->f_op->write(file, iovec.iov_base,
-                                              iovec.iov_len, &kiocb->ki_pos);
+                                              iovec.iov_len, io_kiocb_ppos(kiocb));
                }
 
                if (iov_iter_is_bvec(iter))
@@ -3001,11 +2980,8 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw,
        ssize_t ret;
 
        iorw->iter.iov = iorw->fast_iov;
-       /* reset ->io around the iovec import, we don't want to use it */
-       req->io = NULL;
-       ret = io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov,
+       ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov,
                                &iorw->iter, !force_nonblock);
-       req->io = container_of(iorw, struct io_async_ctx, rw);
        if (unlikely(ret < 0))
                return ret;
 
@@ -3061,7 +3037,7 @@ static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode,
 
        /* submit ref gets dropped, acquire a new one */
        refcount_inc(&req->refs);
-       ret = io_req_task_work_add(req, &req->task_work);
+       ret = io_req_task_work_add(req, &req->task_work, true);
        if (unlikely(ret)) {
                struct task_struct *tsk;
 
@@ -3074,27 +3050,6 @@ static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode,
        return 1;
 }
 
-static inline int kiocb_wait_page_queue_init(struct kiocb *kiocb,
-                                            struct wait_page_queue *wait,
-                                            wait_queue_func_t func,
-                                            void *data)
-{
-       /* Can't support async wakeup with polled IO */
-       if (kiocb->ki_flags & IOCB_HIPRI)
-               return -EINVAL;
-       if (kiocb->ki_filp->f_mode & FMODE_BUF_RASYNC) {
-               wait->wait.func = func;
-               wait->wait.private = data;
-               wait->wait.flags = 0;
-               INIT_LIST_HEAD(&wait->wait.entry);
-               kiocb->ki_flags |= IOCB_WAITQ;
-               kiocb->ki_waitq = wait;
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
 /*
  * This controls whether a given IO request should be armed for async page
  * based retry. If we return false here, the request is handed to the async
@@ -3109,16 +3064,17 @@ static inline int kiocb_wait_page_queue_init(struct kiocb *kiocb,
  */
 static bool io_rw_should_retry(struct io_kiocb *req)
 {
+       struct wait_page_queue *wait = &req->io->rw.wpq;
        struct kiocb *kiocb = &req->rw.kiocb;
-       int ret;
 
        /* never retry for NOWAIT, we just complete with -EAGAIN */
        if (req->flags & REQ_F_NOWAIT)
                return false;
 
        /* Only for buffered IO */
-       if (kiocb->ki_flags & IOCB_DIRECT)
+       if (kiocb->ki_flags & (IOCB_DIRECT | IOCB_HIPRI))
                return false;
+
        /*
         * just use poll if we can, and don't attempt if the fs doesn't
         * support callback based unlocks
@@ -3126,14 +3082,15 @@ static bool io_rw_should_retry(struct io_kiocb *req)
        if (file_can_poll(req->file) || !(req->file->f_mode & FMODE_BUF_RASYNC))
                return false;
 
-       ret = kiocb_wait_page_queue_init(kiocb, &req->io->rw.wpq,
-                                               io_async_buf_func, req);
-       if (!ret) {
-               io_get_req_task(req);
-               return true;
-       }
+       wait->wait.func = io_async_buf_func;
+       wait->wait.private = req;
+       wait->wait.flags = 0;
+       INIT_LIST_HEAD(&wait->wait.entry);
+       kiocb->ki_flags |= IOCB_WAITQ;
+       kiocb->ki_waitq = wait;
 
-       return false;
+       io_get_req_task(req);
+       return true;
 }
 
 static int io_iter_do_read(struct io_kiocb *req, struct iov_iter *iter)
@@ -3161,6 +3118,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
        ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock);
        if (ret < 0)
                return ret;
+       iov_count = iov_iter_count(iter);
        io_size = ret;
        req->result = io_size;
        ret = 0;
@@ -3173,8 +3131,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
        if (force_nonblock && !io_file_supports_async(req->file, READ))
                goto copy_iov;
 
-       iov_count = iov_iter_count(iter);
-       ret = rw_verify_area(READ, req->file, &kiocb->ki_pos, iov_count);
+       ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count);
        if (unlikely(ret))
                goto out_free;
 
@@ -3186,14 +3143,18 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
                ret = 0;
                goto out_free;
        } else if (ret == -EAGAIN) {
-               if (!force_nonblock)
+               /* IOPOLL retry should happen for io-wq threads */
+               if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL))
                        goto done;
+               /* some cases will consume bytes even on error returns */
+               iov_iter_revert(iter, iov_count - iov_iter_count(iter));
                ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
                if (ret)
                        goto out_free;
                return -EAGAIN;
        } else if (ret < 0) {
-               goto out_free;
+               /* make sure -ERESTARTSYS -> -EINTR is done */
+               goto done;
        }
 
        /* read it all, or we did blocking attempt. no retry. */
@@ -3238,6 +3199,7 @@ done:
        kiocb_done(kiocb, ret, cs);
        ret = 0;
 out_free:
+       /* it's reportedly faster than delegating the null check to kfree() */
        if (iovec)
                kfree(iovec);
        return ret;
@@ -3276,6 +3238,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
        ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock);
        if (ret < 0)
                return ret;
+       iov_count = iov_iter_count(iter);
        io_size = ret;
        req->result = io_size;
 
@@ -3292,8 +3255,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
            (req->flags & REQ_F_ISREG))
                goto copy_iov;
 
-       iov_count = iov_iter_count(iter);
-       ret = rw_verify_area(WRITE, req->file, &kiocb->ki_pos, iov_count);
+       ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), iov_count);
        if (unlikely(ret))
                goto out_free;
 
@@ -3326,14 +3288,20 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
        if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT))
                ret2 = -EAGAIN;
        if (!force_nonblock || ret2 != -EAGAIN) {
+               /* IOPOLL retry should happen for io-wq threads */
+               if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN)
+                       goto copy_iov;
                kiocb_done(kiocb, ret2, cs);
        } else {
 copy_iov:
+               /* some cases will consume bytes even on error returns */
+               iov_iter_revert(iter, iov_count - iov_iter_count(iter));
                ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
                if (!ret)
                        return -EAGAIN;
        }
 out_free:
+       /* it's reportedly faster than delegating the null check to kfree() */
        if (iovec)
                kfree(iovec);
        return ret;
@@ -4600,6 +4568,7 @@ struct io_poll_table {
 static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll,
                           __poll_t mask, task_work_func_t func)
 {
+       bool twa_signal_ok;
        int ret;
 
        /* for instances that support it check for an event match first: */
@@ -4614,13 +4583,21 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll,
        init_task_work(&req->task_work, func);
        percpu_ref_get(&req->ctx->refs);
 
+       /*
+        * If we using the signalfd wait_queue_head for this wakeup, then
+        * it's not safe to use TWA_SIGNAL as we could be recursing on the
+        * tsk->sighand->siglock on doing the wakeup. Should not be needed
+        * either, as the normal wakeup will suffice.
+        */
+       twa_signal_ok = (poll->head != &req->task->sighand->signalfd_wqh);
+
        /*
         * If this fails, then the task is exiting. When a task exits, the
         * work gets canceled, so just cancel this request as well instead
         * of executing it. We can't safely execute it anyway, as we may not
         * have the needed state needed for it anyway.
         */
-       ret = io_req_task_work_add(req, &req->task_work);
+       ret = io_req_task_work_add(req, &req->task_work, twa_signal_ok);
        if (unlikely(ret)) {
                struct task_struct *tsk;
 
@@ -4909,12 +4886,20 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
        struct async_poll *apoll;
        struct io_poll_table ipt;
        __poll_t mask, ret;
+       int rw;
 
        if (!req->file || !file_can_poll(req->file))
                return false;
        if (req->flags & REQ_F_POLLED)
                return false;
-       if (!def->pollin && !def->pollout)
+       if (def->pollin)
+               rw = READ;
+       else if (def->pollout)
+               rw = WRITE;
+       else
+               return false;
+       /* if we can't nonblock try, then no point in arming a poll handler */
+       if (!io_file_supports_async(req->file, rw))
                return false;
 
        apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
@@ -5653,6 +5638,18 @@ static void __io_clean_op(struct io_kiocb *req)
                }
                req->flags &= ~REQ_F_NEED_CLEANUP;
        }
+
+       if (req->flags & REQ_F_INFLIGHT) {
+               struct io_ring_ctx *ctx = req->ctx;
+               unsigned long flags;
+
+               spin_lock_irqsave(&ctx->inflight_lock, flags);
+               list_del(&req->inflight_entry);
+               if (waitqueue_active(&ctx->inflight_wait))
+                       wake_up(&ctx->inflight_wait);
+               spin_unlock_irqrestore(&ctx->inflight_lock, flags);
+               req->flags &= ~REQ_F_INFLIGHT;
+       }
 }
 
 static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
@@ -7455,9 +7452,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
 {
        int ret;
 
-       mmgrab(current->mm);
-       ctx->sqo_mm = current->mm;
-
        if (ctx->flags & IORING_SETUP_SQPOLL) {
                ret = -EPERM;
                if (!capable(CAP_SYS_ADMIN))
@@ -7502,10 +7496,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
        return 0;
 err:
        io_finish_async(ctx);
-       if (ctx->sqo_mm) {
-               mmdrop(ctx->sqo_mm);
-               ctx->sqo_mm = NULL;
-       }
        return ret;
 }
 
@@ -7979,7 +7969,13 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
                         ACCT_LOCKED);
 
        INIT_WORK(&ctx->exit_work, io_ring_exit_work);
-       queue_work(system_wq, &ctx->exit_work);
+       /*
+        * Use system_unbound_wq to avoid spawning tons of event kworkers
+        * if we're exiting a ton of rings at the same time. It just adds
+        * noise and overhead, there's no discernable change in runtime
+        * over using system_wq.
+        */
+       queue_work(system_unbound_wq, &ctx->exit_work);
 }
 
 static int io_uring_release(struct inode *inode, struct file *file)
@@ -8063,6 +8059,33 @@ static bool io_timeout_remove_link(struct io_ring_ctx *ctx,
        return found;
 }
 
+static bool io_cancel_link_cb(struct io_wq_work *work, void *data)
+{
+       return io_match_link(container_of(work, struct io_kiocb, work), data);
+}
+
+static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req)
+{
+       enum io_wq_cancel cret;
+
+       /* cancel this particular work, if it's running */
+       cret = io_wq_cancel_work(ctx->io_wq, &req->work);
+       if (cret != IO_WQ_CANCEL_NOTFOUND)
+               return;
+
+       /* find links that hold this pending, cancel those */
+       cret = io_wq_cancel_cb(ctx->io_wq, io_cancel_link_cb, req, true);
+       if (cret != IO_WQ_CANCEL_NOTFOUND)
+               return;
+
+       /* if we have a poll link holding this pending, cancel that */
+       if (io_poll_remove_link(ctx, req))
+               return;
+
+       /* final option, timeout link is holding this req pending */
+       io_timeout_remove_link(ctx, req);
+}
+
 static void io_uring_cancel_files(struct io_ring_ctx *ctx,
                                  struct files_struct *files)
 {
@@ -8094,35 +8117,9 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx,
                /* We need to keep going until we don't find a matching req */
                if (!cancel_req)
                        break;
-
-               if (cancel_req->flags & REQ_F_OVERFLOW) {
-                       spin_lock_irq(&ctx->completion_lock);
-                       list_del(&cancel_req->compl.list);
-                       cancel_req->flags &= ~REQ_F_OVERFLOW;
-
-                       io_cqring_mark_overflow(ctx);
-                       WRITE_ONCE(ctx->rings->cq_overflow,
-                               atomic_inc_return(&ctx->cached_cq_overflow));
-                       io_commit_cqring(ctx);
-                       spin_unlock_irq(&ctx->completion_lock);
-
-                       /*
-                        * Put inflight ref and overflow ref. If that's
-                        * all we had, then we're done with this request.
-                        */
-                       if (refcount_sub_and_test(2, &cancel_req->refs)) {
-                               io_free_req(cancel_req);
-                               finish_wait(&ctx->inflight_wait, &wait);
-                               continue;
-                       }
-               } else {
-                       io_wq_cancel_work(ctx->io_wq, &cancel_req->work);
-                       /* could be a link, check and remove if it is */
-                       if (!io_poll_remove_link(ctx, cancel_req))
-                               io_timeout_remove_link(ctx, cancel_req);
-                       io_put_req(cancel_req);
-               }
-
+               /* cancel this request, or head link requests */
+               io_attempt_cancel(ctx, cancel_req);
+               io_put_req(cancel_req);
                schedule();
                finish_wait(&ctx->inflight_wait, &wait);
        }
@@ -8548,6 +8545,9 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
        ctx->user = user;
        ctx->creds = get_current_cred();
 
+       mmgrab(current->mm);
+       ctx->sqo_mm = current->mm;
+
        /*
         * Account memory _before_ installing the file descriptor. Once
         * the descriptor is installed, it can get closed at any time. Also
index 89f61d9..107ee80 100644 (file)
@@ -127,7 +127,7 @@ iomap_seek_hole_actor(struct inode *inode, loff_t offset, loff_t length,
                                                   SEEK_HOLE);
                if (offset < 0)
                        return length;
-               /* fall through */
+               fallthrough;
        case IOMAP_HOLE:
                *(loff_t *)data = offset;
                return 0;
@@ -175,7 +175,7 @@ iomap_seek_data_actor(struct inode *inode, loff_t offset, loff_t length,
                                                   SEEK_DATA);
                if (offset < 0)
                        return length;
-               /*FALLTHRU*/
+               fallthrough;
        default:
                *(loff_t *)data = offset;
                return 0;
index e494443..17fdc48 100644 (file)
@@ -1285,7 +1285,7 @@ journal_t *jbd2_journal_init_inode(struct inode *inode)
  * superblock as being NULL to prevent the journal destroy from writing
  * back a bogus superblock.
  */
-static void journal_fail_superblock (journal_t *journal)
+static void journal_fail_superblock(journal_t *journal)
 {
        struct buffer_head *bh = journal->j_sb_buffer;
        brelse(bh);
@@ -1367,8 +1367,10 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
        int ret;
 
        /* Buffer got discarded which means block device got invalidated */
-       if (!buffer_mapped(bh))
+       if (!buffer_mapped(bh)) {
+               unlock_buffer(bh);
                return -EIO;
+       }
 
        trace_jbd2_write_superblock(journal, write_flags);
        if (!(journal->j_flags & JBD2_BARRIER))
@@ -1815,7 +1817,7 @@ int jbd2_journal_destroy(journal_t *journal)
 
 
 /**
- *int jbd2_journal_check_used_features () - Check if features specified are used.
+ *int jbd2_journal_check_used_features() - Check if features specified are used.
  * @journal: Journal to check.
  * @compat: bitmask of compatible features
  * @ro: bitmask of features that force read-only mount
@@ -1825,7 +1827,7 @@ int jbd2_journal_destroy(journal_t *journal)
  * features.  Return true (non-zero) if it does.
  **/
 
-int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat,
+int jbd2_journal_check_used_features(journal_t *journal, unsigned long compat,
                                 unsigned long ro, unsigned long incompat)
 {
        journal_superblock_t *sb;
@@ -1860,7 +1862,7 @@ int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat,
  * all of a given set of features on this journal.  Return true
  * (non-zero) if it can. */
 
-int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat,
+int jbd2_journal_check_available_features(journal_t *journal, unsigned long compat,
                                      unsigned long ro, unsigned long incompat)
 {
        if (!compat && !ro && !incompat)
@@ -1882,7 +1884,7 @@ int jbd2_journal_check_available_features (journal_t *journal, unsigned long com
 }
 
 /**
- * int jbd2_journal_set_features () - Mark a given journal feature in the superblock
+ * int jbd2_journal_set_features() - Mark a given journal feature in the superblock
  * @journal: Journal to act on.
  * @compat: bitmask of compatible features
  * @ro: bitmask of features that force read-only mount
@@ -1893,7 +1895,7 @@ int jbd2_journal_check_available_features (journal_t *journal, unsigned long com
  *
  */
 
-int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
+int jbd2_journal_set_features(journal_t *journal, unsigned long compat,
                          unsigned long ro, unsigned long incompat)
 {
 #define INCOMPAT_FEATURE_ON(f) \
index 2ed278f..faa97d7 100644 (file)
@@ -690,14 +690,11 @@ static int do_one_pass(journal_t *journal,
                         * number. */
                        if (pass == PASS_SCAN &&
                            jbd2_has_feature_checksum(journal)) {
-                               int chksum_err, chksum_seen;
                                struct commit_header *cbh =
                                        (struct commit_header *)bh->b_data;
                                unsigned found_chksum =
                                        be32_to_cpu(cbh->h_chksum[0]);
 
-                               chksum_err = chksum_seen = 0;
-
                                if (info->end_transaction) {
                                        journal->j_failed_commit =
                                                info->end_transaction;
@@ -705,42 +702,23 @@ static int do_one_pass(journal_t *journal,
                                        break;
                                }
 
-                               if (crc32_sum == found_chksum &&
-                                   cbh->h_chksum_type == JBD2_CRC32_CHKSUM &&
-                                   cbh->h_chksum_size ==
-                                               JBD2_CRC32_CHKSUM_SIZE)
-                                      chksum_seen = 1;
-                               else if (!(cbh->h_chksum_type == 0 &&
-                                            cbh->h_chksum_size == 0 &&
-                                            found_chksum == 0 &&
-                                            !chksum_seen))
-                               /*
-                                * If fs is mounted using an old kernel and then
-                                * kernel with journal_chksum is used then we
-                                * get a situation where the journal flag has
-                                * checksum flag set but checksums are not
-                                * present i.e chksum = 0, in the individual
-                                * commit blocks.
-                                * Hence to avoid checksum failures, in this
-                                * situation, this extra check is added.
-                                */
-                                               chksum_err = 1;
-
-                               if (chksum_err) {
-                                       info->end_transaction = next_commit_ID;
-
-                                       if (!jbd2_has_feature_async_commit(journal)) {
-                                               journal->j_failed_commit =
-                                                       next_commit_ID;
-                                               brelse(bh);
-                                               break;
-                                       }
-                               }
+                               /* Neither checksum match nor unused? */
+                               if (!((crc32_sum == found_chksum &&
+                                      cbh->h_chksum_type ==
+                                               JBD2_CRC32_CHKSUM &&
+                                      cbh->h_chksum_size ==
+                                               JBD2_CRC32_CHKSUM_SIZE) ||
+                                     (cbh->h_chksum_type == 0 &&
+                                      cbh->h_chksum_size == 0 &&
+                                      found_chksum == 0)))
+                                       goto chksum_error;
+
                                crc32_sum = ~0;
                        }
                        if (pass == PASS_SCAN &&
                            !jbd2_commit_block_csum_verify(journal,
                                                           bh->b_data)) {
+                       chksum_error:
                                info->end_transaction = next_commit_ID;
 
                                if (!jbd2_has_feature_async_commit(journal)) {
index e91aad3..4398573 100644 (file)
@@ -2026,6 +2026,9 @@ static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh)
  */
 static void __jbd2_journal_unfile_buffer(struct journal_head *jh)
 {
+       J_ASSERT_JH(jh, jh->b_transaction != NULL);
+       J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
+
        __jbd2_journal_temp_unlink_buffer(jh);
        jh->b_transaction = NULL;
 }
@@ -2078,10 +2081,6 @@ out:
  * int jbd2_journal_try_to_free_buffers() - try to free page buffers.
  * @journal: journal for operation
  * @page: to try and free
- * @gfp_mask: we use the mask to detect how hard should we try to release
- * buffers. If __GFP_DIRECT_RECLAIM and __GFP_FS is set, we wait for commit
- * code to release the buffers.
- *
  *
  * For all the buffers on this page,
  * if they are fully written out ordered data, move them onto BUF_CLEAN
@@ -2112,11 +2111,11 @@ out:
  *
  * Return 0 on failure, 1 on success
  */
-int jbd2_journal_try_to_free_buffers(journal_t *journal,
-                               struct page *page, gfp_t gfp_mask)
+int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
 {
        struct buffer_head *head;
        struct buffer_head *bh;
+       bool has_write_io_error = false;
        int ret = 0;
 
        J_ASSERT(PageLocked(page));
@@ -2141,11 +2140,26 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
                jbd2_journal_put_journal_head(jh);
                if (buffer_jbd(bh))
                        goto busy;
+
+               /*
+                * If we free a metadata buffer which has been failed to
+                * write out, the jbd2 checkpoint procedure will not detect
+                * this failure and may lead to filesystem inconsistency
+                * after cleanup journal tail.
+                */
+               if (buffer_write_io_error(bh)) {
+                       pr_err("JBD2: Error while async write back metadata bh %llu.",
+                              (unsigned long long)bh->b_blocknr);
+                       has_write_io_error = true;
+               }
        } while ((bh = bh->b_this_page) != head);
 
        ret = try_to_free_buffers(page);
 
 busy:
+       if (has_write_io_error)
+               jbd2_journal_abort(journal, -EIO);
+
        return ret;
 }
 
@@ -2572,6 +2586,13 @@ bool __jbd2_journal_refile_buffer(struct journal_head *jh)
 
        was_dirty = test_clear_buffer_jbddirty(bh);
        __jbd2_journal_temp_unlink_buffer(jh);
+
+       /*
+        * b_transaction must be set, otherwise the new b_transaction won't
+        * be holding jh reference
+        */
+       J_ASSERT_JH(jh, jh->b_transaction != NULL);
+
        /*
         * We set b_transaction here because b_next_transaction will inherit
         * our jh reference and thus __jbd2_journal_file_buffer() must not
index ab8cdd9..78858f6 100644 (file)
@@ -341,7 +341,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
                        rdev = old_decode_dev(je16_to_cpu(jdev.old_id));
                else
                        rdev = new_decode_dev(je32_to_cpu(jdev.new_id));
-               /* fall through */
+               fallthrough;
 
        case S_IFSOCK:
        case S_IFIFO:
index bccfc40..2f6f0b1 100644 (file)
@@ -1273,7 +1273,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
                        dbg_readinode("symlink's target '%s' cached\n", f->target);
                }
 
-               /* fall through... */
+               fallthrough;
 
        case S_IFBLK:
        case S_IFCHR:
index 4d08edf..e0d42e9 100644 (file)
@@ -137,11 +137,11 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
                case 1:
                        offset += file->f_pos;
-                       /* fall through */
+                       fallthrough;
                case 0:
                        if (offset >= 0)
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
        }
index 8fc0542..1f84a03 100644 (file)
@@ -1499,7 +1499,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
        switch (arg) {
        case F_UNLCK:
                fl->fl_flags &= ~FL_UNLOCK_PENDING;
-               /* fall through */
+               fallthrough;
        case F_RDLCK:
                fl->fl_flags &= ~FL_DOWNGRADE_PENDING;
        }
@@ -2525,7 +2525,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
                cmd = F_SETLKW;
                file_lock->fl_flags |= FL_OFDLCK;
                file_lock->fl_owner = filp;
-               /* Fallthrough */
+               fallthrough;
        case F_SETLKW:
                file_lock->fl_flags |= FL_SLEEP;
        }
@@ -2656,7 +2656,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
                cmd = F_SETLKW64;
                file_lock->fl_flags |= FL_OFDLCK;
                file_lock->fl_owner = filp;
-               /* Fallthrough */
+               fallthrough;
        case F_SETLKW64:
                file_lock->fl_flags |= FL_SLEEP;
        }
index d1a0e2c..08108b6 100644 (file)
@@ -753,7 +753,7 @@ out:
        case -ENODEV:
                /* Our extent block devices are unavailable */
                set_bit(NFS_LSEG_UNAVAILABLE, &lseg->pls_flags);
-               /* Fall through */
+               fallthrough;
        case 0:
                return lseg;
        default:
index a12f42e..e732580 100644 (file)
@@ -1181,7 +1181,7 @@ int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
                        /* A NFSv4 OPEN will revalidate later */
                        if (server->caps & NFS_CAP_ATOMIC_OPEN)
                                goto out;
-                       /* Fallthrough */
+                       fallthrough;
                case S_IFDIR:
                        if (server->flags & NFS_MOUNT_NOCTO)
                                break;
index a13e690..7f5aa04 100644 (file)
@@ -187,7 +187,7 @@ static int filelayout_async_handle_error(struct rpc_task *task,
                pnfs_error_mark_layout_for_return(inode, lseg);
                pnfs_set_lo_fail(lseg);
                rpc_wake_up(&tbl->slot_tbl_waitq);
-               /* fall through */
+               fallthrough;
        default:
 reset:
                dprintk("%s Retry through MDS. Error %d\n", __func__,
index 9651455..ff8965d 100644 (file)
@@ -1133,7 +1133,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
                nfs4_delete_deviceid(devid->ld, devid->nfs_client,
                                &devid->deviceid);
                rpc_wake_up(&tbl->slot_tbl_waitq);
-               /* fall through */
+               fallthrough;
        default:
                if (ff_layout_avoid_mds_available_ds(lseg))
                        return -NFS4ERR_RESET_TO_PNFS;
@@ -1260,7 +1260,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
                 */
                if (opnum == OP_READ)
                        break;
-               /* Fallthrough */
+               fallthrough;
        default:
                pnfs_error_mark_layout_for_return(lseg->pls_layout->plh_inode,
                                                  lseg);
index 66949da..5248129 100644 (file)
@@ -651,21 +651,21 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
                switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) {
                case Opt_xprt_udp6:
                        protofamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_udp:
                        ctx->flags &= ~NFS_MOUNT_TCP;
                        ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP;
                        break;
                case Opt_xprt_tcp6:
                        protofamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_tcp:
                        ctx->flags |= NFS_MOUNT_TCP;
                        ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
                        break;
                case Opt_xprt_rdma6:
                        protofamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_rdma:
                        /* vector side protocols to TCP */
                        ctx->flags |= NFS_MOUNT_TCP;
@@ -684,13 +684,13 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
                switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) {
                case Opt_xprt_udp6:
                        mountfamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_udp:
                        ctx->mount_server.protocol = XPRT_TRANSPORT_UDP;
                        break;
                case Opt_xprt_tcp6:
                        mountfamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_tcp:
                        ctx->mount_server.protocol = XPRT_TRANSPORT_TCP;
                        break;
@@ -899,9 +899,11 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
        ctx->version = NFS_DEFAULT_VERSION;
        switch (data->version) {
        case 1:
-               data->namlen = 0; /* fall through */
+               data->namlen = 0;
+               fallthrough;
        case 2:
-               data->bsize = 0; /* fall through */
+               data->bsize = 0;
+               fallthrough;
        case 3:
                if (data->flags & NFS_MOUNT_VER3)
                        goto out_no_v3;
@@ -909,14 +911,14 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
                memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE);
                /* Turn off security negotiation */
                extra_flags |= NFS_MOUNT_SECFLAVOUR;
-               /* fall through */
+               fallthrough;
        case 4:
                if (data->flags & NFS_MOUNT_SECFLAVOUR)
                        goto out_no_sec;
-               /* fall through */
+               fallthrough;
        case 5:
                memset(data->context, 0, sizeof(data->context));
-               /* fall through */
+               fallthrough;
        case 6:
                if (data->flags & NFS_MOUNT_VER3) {
                        if (data->root.size > NFS3_FHSIZE || data->root.size == 0)
index 26c94b3..c6c8633 100644 (file)
@@ -108,7 +108,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
                case -EPROTONOSUPPORT:
                        dprintk("NFS_V3_ACL extension not supported; disabling\n");
                        server->caps &= ~NFS_CAP_ACLS;
-                       /* fall through */
+                       fallthrough;
                case -ENOTSUPP:
                        status = -EOPNOTSUPP;
                default:
@@ -228,7 +228,7 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
                        dprintk("NFS_V3_ACL SETACL RPC not supported"
                                        "(will not retry)\n");
                        server->caps &= ~NFS_CAP_ACLS;
-                       /* fall through */
+                       fallthrough;
                case -ENOTSUPP:
                        status = -EOPNOTSUPP;
        }
index a339707..fdfc774 100644 (file)
@@ -211,7 +211,7 @@ static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence)
                ret = nfs42_proc_llseek(filep, offset, whence);
                if (ret != -ENOTSUPP)
                        return ret;
-               /* Fall through */
+               fallthrough;
        default:
                return nfs_file_llseek(filep, offset, whence);
        }
index 1e72963..62e6eea 100644 (file)
@@ -520,7 +520,7 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
        switch (token) {
        case Opt_find_uid:
                im->im_type = IDMAP_TYPE_USER;
-               /* Fall through */
+               fallthrough;
        case Opt_find_gid:
                im->im_conv = IDMAP_CONV_NAMETOID;
                ret = match_strlcpy(im->im_name, &substr, IDMAP_NAMESZ);
@@ -528,7 +528,7 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
 
        case Opt_find_user:
                im->im_type = IDMAP_TYPE_USER;
-               /* Fall through */
+               fallthrough;
        case Opt_find_group:
                im->im_conv = IDMAP_CONV_IDTONAME;
                ret = match_int(&substr, &im->im_id);
index dbd0154..f8946b9 100644 (file)
@@ -483,7 +483,7 @@ static int nfs4_do_handle_exception(struct nfs_server *server,
                                                stateid);
                                goto wait_on_recovery;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_OPENMODE:
                        if (inode) {
                                int err;
@@ -534,10 +534,10 @@ static int nfs4_do_handle_exception(struct nfs_server *server,
                                ret = -EBUSY;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_DELAY:
                        nfs_inc_server_stats(server, NFSIOS_DELAY);
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_GRACE:
                case -NFS4ERR_LAYOUTTRYLATER:
                case -NFS4ERR_RECALLCONFLICT:
@@ -1505,7 +1505,7 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode,
        case NFS4_OPEN_CLAIM_PREVIOUS:
                if (!test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags))
                        break;
-               /* Fall through */
+               fallthrough;
        default:
                return 0;
        }
@@ -2439,7 +2439,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
        case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
        case NFS4_OPEN_CLAIM_DELEG_PREV_FH:
                data->o_arg.open_bitmap = &nfs4_open_noattr_bitmap[0];
-               /* Fall through */
+               fallthrough;
        case NFS4_OPEN_CLAIM_FH:
                task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR];
        }
@@ -3545,11 +3545,11 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
                        nfs4_free_revoked_stateid(server,
                                        &calldata->arg.stateid,
                                        task->tk_msg.rpc_cred);
-                       /* Fallthrough */
+                       fallthrough;
                case -NFS4ERR_BAD_STATEID:
                        if (calldata->arg.fmode == 0)
                                break;
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        task->tk_status = nfs4_async_handle_exception(task,
                                        server, task->tk_status, &exception);
@@ -6294,7 +6294,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
                nfs4_free_revoked_stateid(data->res.server,
                                data->args.stateid,
                                task->tk_msg.rpc_cred);
-               /* Fallthrough */
+               fallthrough;
        case -NFS4ERR_BAD_STATEID:
        case -NFS4ERR_STALE_STATEID:
        case -ETIMEDOUT:
@@ -6314,7 +6314,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
                        data->res.fattr = NULL;
                        goto out_restart;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                task->tk_status = nfs4_async_handle_exception(task,
                                data->res.server, task->tk_status,
@@ -6622,13 +6622,13 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
                        if (nfs4_update_lock_stateid(calldata->lsp,
                                        &calldata->res.stateid))
                                break;
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_ADMIN_REVOKED:
                case -NFS4ERR_EXPIRED:
                        nfs4_free_revoked_stateid(calldata->server,
                                        &calldata->arg.stateid,
                                        task->tk_msg.rpc_cred);
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_BAD_STATEID:
                case -NFS4ERR_STALE_STATEID:
                        if (nfs4_sync_lock_stateid(&calldata->arg.stateid,
@@ -8665,7 +8665,7 @@ static void nfs4_get_lease_time_done(struct rpc_task *task, void *calldata)
                dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status);
                rpc_delay(task, NFS4_POLL_RETRY_MIN);
                task->tk_status = 0;
-               /* fall through */
+               fallthrough;
        case -NFS4ERR_RETRY_UNCACHED_REP:
                rpc_restart_call_prepare(task);
                return;
@@ -9113,13 +9113,13 @@ static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nf
        switch(task->tk_status) {
        case 0:
                wake_up_all(&clp->cl_lock_waitq);
-               /* Fallthrough */
+               fallthrough;
        case -NFS4ERR_COMPLETE_ALREADY:
        case -NFS4ERR_WRONG_CRED: /* What to do here? */
                break;
        case -NFS4ERR_DELAY:
                rpc_delay(task, NFS4_POLL_RETRY_MAX);
-               /* fall through */
+               fallthrough;
        case -NFS4ERR_RETRY_UNCACHED_REP:
                return -EAGAIN;
        case -NFS4ERR_BADSESSION:
@@ -9434,10 +9434,10 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
                                        &lrp->args.range,
                                        lrp->args.inode))
                        goto out_restart;
-               /* Fallthrough */
+               fallthrough;
        default:
                task->tk_status = 0;
-               /* Fallthrough */
+               fallthrough;
        case 0:
                break;
        case -NFS4ERR_DELAY:
index b1dba24..4bf1079 100644 (file)
@@ -1530,7 +1530,7 @@ restart:
                default:
                        pr_err("NFS: %s: unhandled error %d\n",
                                        __func__, status);
-                       /* Fall through */
+                       fallthrough;
                case -ENOMEM:
                case -NFS4ERR_DENIED:
                case -NFS4ERR_RECLAIM_BAD:
@@ -1667,7 +1667,7 @@ restart:
                                break;
                        }
                        printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status);
-                       /* Fall through */
+                       fallthrough;
                case -ENOENT:
                case -ENOMEM:
                case -EACCES:
@@ -1683,7 +1683,7 @@ restart:
                                set_bit(ops->state_flag_bit, &state->flags);
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_ADMIN_REVOKED:
                case -NFS4ERR_STALE_STATEID:
                case -NFS4ERR_OLD_STATEID:
@@ -1695,7 +1695,7 @@ restart:
                case -NFS4ERR_EXPIRED:
                case -NFS4ERR_NO_GRACE:
                        nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state);
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_STALE_CLIENTID:
                case -NFS4ERR_BADSESSION:
                case -NFS4ERR_BADSLOT:
@@ -2273,11 +2273,11 @@ again:
        case -ETIMEDOUT:
                if (clnt->cl_softrtry)
                        break;
-               /* Fall through */
+               fallthrough;
        case -NFS4ERR_DELAY:
        case -EAGAIN:
                ssleep(1);
-               /* Fall through */
+               fallthrough;
        case -NFS4ERR_STALE_CLIENTID:
                dprintk("NFS: %s after status %d, retrying\n",
                        __func__, status);
@@ -2289,7 +2289,7 @@ again:
                }
                if (clnt->cl_auth->au_flavor == RPC_AUTH_UNIX)
                        break;
-               /* Fall through */
+               fallthrough;
        case -NFS4ERR_CLID_INUSE:
        case -NFS4ERR_WRONGSEC:
                /* No point in retrying if we already used RPC_AUTH_UNIX */
index 6ea4cac..6985cac 100644 (file)
@@ -711,7 +711,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr,
        case FLUSH_COND_STABLE:
                if (nfs_reqs_to_commit(cinfo))
                        break;
-               /* fall through */
+               fallthrough;
        default:
                hdr->args.stable = NFS_FILE_SYNC;
        }
index 40332c7..71f7741 100644 (file)
@@ -1541,7 +1541,7 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
        case 0:
                if (res->lrs_present)
                        res_stateid = &res->stateid;
-               /* Fallthrough */
+               fallthrough;
        default:
                arg_stateid = &args->stateid;
        }
index 8ceb642..d056ad2 100644 (file)
@@ -237,7 +237,7 @@ posix_acl_from_nfsacl(struct posix_acl *acl)
                                break;
                        case ACL_MASK:
                                mask = pa;
-                               /* fall through */
+                               fallthrough;
                        case ACL_OTHER:
                                break;
                }
index 9bbaa67..311e5ce 100644 (file)
@@ -83,13 +83,13 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,
                        bex->soff = iomap.addr;
                        break;
                }
-               /*FALLTHRU*/
+               fallthrough;
        case IOMAP_HOLE:
                if (seg->iomode == IOMODE_READ) {
                        bex->es = PNFS_BLOCK_NONE_DATA;
                        break;
                }
-               /*FALLTHRU*/
+               fallthrough;
        case IOMAP_DELALLOC:
        default:
                WARN(1, "pnfsd: filesystem returned %d extent\n", iomap.type);
index 7fbe984..052be5b 100644 (file)
@@ -1119,7 +1119,7 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                break;
        case -ESERVERFAULT:
                ++session->se_cb_seq_nr;
-               /* Fall through */
+               fallthrough;
        case 1:
        case -NFS4ERR_BADSESSION:
                nfsd4_mark_cb_fault(cb->cb_clp, cb->cb_seq_status);
index e12409e..a97873f 100644 (file)
@@ -681,7 +681,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
                        rpc_delay(task, HZ/100); /* 10 mili-seconds */
                        return 0;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                /*
                 * Unknown error or non-responding client, we'll need to fence.
index a527da3..eaf50ea 100644 (file)
@@ -428,7 +428,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                                goto out;
                        open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
                        reclaim = true;
-                       /* fall through */
+                       fallthrough;
                case NFS4_OPEN_CLAIM_FH:
                case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
                        status = do_open_fhandle(rqstp, cstate, open);
index 81ed8e8..c09a2a4 100644 (file)
@@ -3117,7 +3117,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                break;
        default:                                /* checked by xdr code */
                WARN_ON_ONCE(1);
-               /* fall through */
+               fallthrough;
        case SP4_SSV:
                status = nfserr_encr_alg_unsupp;
                goto out_nolock;
@@ -4532,7 +4532,7 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
                        rpc_delay(task, 2 * HZ);
                        return 0;
                }
-               /*FALLTHRU*/
+               fallthrough;
        default:
                return 1;
        }
@@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
        if (!i_am_nfsd())
                return NULL;
        rqst = kthread_data(current);
+       if (!rqst->rq_lease_breaker)
+               return NULL;
        clp = *(rqst->rq_lease_breaker);
        return dl->dl_stid.sc_client == clp;
 }
@@ -5652,7 +5654,7 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
                break;
        default:
                printk("unknown stateid type %x\n", s->sc_type);
-               /* Fallthrough */
+               fallthrough;
        case NFS4_CLOSED_STID:
        case NFS4_CLOSED_DELEG_STID:
                status = nfserr_bad_stateid;
@@ -6742,7 +6744,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                case NFS4_READW_LT:
                        if (nfsd4_has_session(cstate))
                                fl_flags |= FL_SLEEP;
-                       /* Fallthrough */
+                       fallthrough;
                case NFS4_READ_LT:
                        spin_lock(&fp->fi_lock);
                        nf = find_readable_file_locked(fp);
@@ -6754,7 +6756,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                case NFS4_WRITEW_LT:
                        if (nfsd4_has_session(cstate))
                                fl_flags |= FL_SLEEP;
-                       /* Fallthrough */
+                       fallthrough;
                case NFS4_WRITE_LT:
                        spin_lock(&fp->fi_lock);
                        nf = find_writeable_file_locked(fp);
@@ -6816,7 +6818,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                break;
        case FILE_LOCK_DEFERRED:
                nbl = NULL;
-               /* Fallthrough */
+               fallthrough;
        case -EAGAIN:           /* conflock holds conflicting lock */
                status = nfserr_denied;
                dprintk("NFSD: nfsd4_lock: conflicting lock found!\n");
index 37bc8f5..c81dbba 100644 (file)
@@ -459,7 +459,7 @@ static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
        case FSID_DEV:
                if (!old_valid_dev(exp_sb(exp)->s_dev))
                        return false;
-               /* FALL THROUGH */
+               fallthrough;
        case FSID_MAJOR_MINOR:
        case FSID_ENCODE_DEV:
                return exp_sb(exp)->s_type->fs_flags & FS_REQUIRES_DEV;
@@ -469,7 +469,7 @@ static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
        case FSID_UUID16:
                if (!is_root_export(exp))
                        return false;
-               /* fall through */
+               fallthrough;
        case FSID_UUID4_INUM:
        case FSID_UUID16_INUM:
                return exp->ex_uuid != NULL;
index 543bbe0..6e0b066 100644 (file)
@@ -314,7 +314,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)
                                        rdev = inode->i_rdev;
                                        attr->ia_valid |= ATTR_SIZE;
 
-                                       /* FALLTHROUGH */
+                                       fallthrough;
                                case S_IFIFO:
                                        /* this is probably a permission check..
                                         * at least IRIX implements perm checking on
index b603dfc..f7f6473 100644 (file)
@@ -221,7 +221,7 @@ int nfsd_vers(struct nfsd_net *nn, int vers, enum vers_op change)
        case NFSD_TEST:
                if (nn->nfsd_versions)
                        return nn->nfsd_versions[vers];
-               /* Fallthrough */
+               fallthrough;
        case NFSD_AVAIL:
                return nfsd_support_version(vers);
        }
index 7d2933b..aba5af9 100644 (file)
@@ -1456,7 +1456,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                        *created = true;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case NFS4_CREATE_EXCLUSIVE4_1:
                        if (   d_inode(dchild)->i_mtime.tv_sec == v_mtime
                            && d_inode(dchild)->i_atime.tv_sec == v_atime
@@ -1465,7 +1465,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                        *created = true;
                                goto set_attr;
                        }
-                       /* fall through */
+                       fallthrough;
                case NFS3_CREATE_GUARDED:
                        err = nfserr_exist;
                }
index fb5a9a8..e516ae3 100644 (file)
@@ -519,7 +519,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
                break;
        case NILFS_IFILE_INO:
                lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key);
-               /* Fall through */
+               fallthrough;
        default:
                bmap->b_ptr_type = NILFS_BMAP_PTR_VM;
                bmap->b_last_allocated_key = 0;
index 0b453ef..2217f90 100644 (file)
@@ -626,7 +626,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
                            !(flags & NILFS_SS_SYNDT))
                                goto try_next_pseg;
                        state = RF_DSYNC_ST;
-                       /* Fall through */
+                       fallthrough;
                case RF_DSYNC_ST:
                        if (!(flags & NILFS_SS_SYNDT))
                                goto confused;
index a651e82..e3726ac 100644 (file)
@@ -1138,7 +1138,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                        nilfs_sc_cstage_set(sci, NILFS_ST_DAT);
                        goto dat_stage;
                }
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_GC:
                if (nilfs_doing_gc()) {
                        head = &sci->sc_gc_inodes;
@@ -1159,7 +1160,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                        }
                        sci->sc_stage.gc_inode_ptr = NULL;
                }
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_FILE:
                head = &sci->sc_dirty_files;
                ii = list_prepare_entry(sci->sc_stage.dirty_file_ptr, head,
@@ -1186,7 +1188,7 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                }
                nilfs_sc_cstage_inc(sci);
                sci->sc_stage.flags |= NILFS_CF_IFILE_STARTED;
-               /* Fall through */
+               fallthrough;
        case NILFS_ST_IFILE:
                err = nilfs_segctor_scan_file(sci, sci->sc_root->ifile,
                                              &nilfs_sc_file_ops);
@@ -1197,13 +1199,14 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                err = nilfs_segctor_create_checkpoint(sci);
                if (unlikely(err))
                        break;
-               /* Fall through */
+               fallthrough;
        case NILFS_ST_CPFILE:
                err = nilfs_segctor_scan_file(sci, nilfs->ns_cpfile,
                                              &nilfs_sc_file_ops);
                if (unlikely(err))
                        break;
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_SUFILE:
                err = nilfs_sufile_freev(nilfs->ns_sufile, sci->sc_freesegs,
                                         sci->sc_nfreesegs, &ndone);
@@ -1219,7 +1222,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                                              &nilfs_sc_file_ops);
                if (unlikely(err))
                        break;
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_DAT:
  dat_stage:
                err = nilfs_segctor_scan_file(sci, nilfs->ns_dat,
@@ -1230,7 +1234,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                        nilfs_sc_cstage_set(sci, NILFS_ST_DONE);
                        return 0;
                }
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_SR:
                if (mode == SC_LSEG_SR) {
                        /* Appending a super root */
index 559de31..3e01d8f 100644 (file)
@@ -1147,7 +1147,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
        }
 
        switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
-       case FAN_MARK_ADD:              /* fallthrough */
+       case FAN_MARK_ADD:
        case FAN_MARK_REMOVE:
                if (!mask)
                        return -EINVAL;
index 1ef2457..cea739b 100644 (file)
@@ -67,7 +67,7 @@ static void o2quo_fence_self(void)
        default:
                WARN_ON(o2nm_single_cluster->cl_fence_method >=
                        O2NM_FENCE_METHODS);
-               /* fall through */
+               fallthrough;
        case O2NM_FENCE_RESET:
                printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this "
                       "system by restarting ***\n");
index 819428d..3ce8921 100644 (file)
@@ -1081,7 +1081,6 @@ next_zone:
                readop = psz_ftrace_read;
                break;
        case PSTORE_TYPE_CONSOLE:
-               fallthrough;
        case PSTORE_TYPE_PMSG:
                readop = psz_record_read;
                break;
index 5444d3c..47f9e15 100644 (file)
@@ -38,7 +38,7 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
                if ((type == USRQUOTA && uid_eq(current_euid(), make_kuid(current_user_ns(), id))) ||
                    (type == GRPQUOTA && in_egroup_p(make_kgid(current_user_ns(), id))))
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        default:
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
index 6b2b436..b57b3ff 100644 (file)
@@ -217,10 +217,8 @@ int romfs_dev_read(struct super_block *sb, unsigned long pos,
        size_t limit;
 
        limit = romfs_maxsize(sb);
-       if (pos >= limit)
+       if (pos >= limit || buflen > limit - pos)
                return -EIO;
-       if (buflen > limit - pos)
-               buflen = limit - pos;
 
 #ifdef CONFIG_ROMFS_ON_MTD
        if (sb->s_mtd)
index 4e6239f..31219c1 100644 (file)
@@ -295,7 +295,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
        case SEEK_CUR:
                offset += file->f_pos;
-               /* fall through */
+               fallthrough;
        case SEEK_SET:
                if (offset < 0)
                        break;
index 5b78719..456046e 100644 (file)
@@ -176,7 +176,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info
                if (!nonblock)
                        break;
                ret = -EAGAIN;
-               /* fall through */
+               fallthrough;
        default:
                spin_unlock_irq(&current->sighand->siglock);
                return ret;
index 76bb1c8..8a19773 100644 (file)
@@ -87,7 +87,11 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length,
        int error, i;
        struct bio *bio;
 
-       bio = bio_alloc(GFP_NOIO, page_count);
+       if (page_count <= BIO_MAX_PAGES)
+               bio = bio_alloc(GFP_NOIO, page_count);
+       else
+               bio = bio_kmalloc(GFP_NOIO, page_count);
+
        if (!bio)
                return -ENOMEM;
 
index 22bfda1..6d6cd85 100644 (file)
@@ -269,7 +269,7 @@ void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
                        break;
                /* No more room on heap so make it un-categorized */
                cat = LPROPS_UNCAT;
-               /* Fall through */
+               fallthrough;
        case LPROPS_UNCAT:
                list_add(&lprops->list, &c->uncat_list);
                break;
@@ -313,7 +313,7 @@ static void ubifs_remove_from_cat(struct ubifs_info *c,
        case LPROPS_FREEABLE:
                c->freeable_cnt -= 1;
                ubifs_assert(c, c->freeable_cnt >= 0);
-               /* Fall through */
+               fallthrough;
        case LPROPS_UNCAT:
        case LPROPS_EMPTY:
        case LPROPS_FRDI_IDX:
index 6023c97..25ff91c 100644 (file)
@@ -52,7 +52,7 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
                                elen += pc->lengthComponentIdent;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case 2:
                        if (tolen == 0)
                                return -ENAMETOOLONG;
index e1f1b2e..4931bec 100644 (file)
@@ -42,7 +42,7 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
        case UFS_ST_SUNOS:
                if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
                        return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
-               /* Fall Through - to UFS_ST_SUN */
+               fallthrough;    /* to UFS_ST_SUN */
        case UFS_ST_SUN:
                return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
        case UFS_ST_SUNx86:
@@ -63,7 +63,7 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
                        usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
                        break;
                }
-               /* Fall Through - to UFS_ST_SUN */
+               fallthrough;    /* to UFS_ST_SUN */
        case UFS_ST_SUN:
                usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
                break;
@@ -197,7 +197,7 @@ ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
        case UFS_UID_EFT:
                if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
                        return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
-               /* Fall through */
+               fallthrough;
        default:
                return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid);
        }
@@ -215,7 +215,7 @@ ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
                inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
                if (value > 0xFFFF)
                        value = 0xFFFF;
-               /* Fall through */
+               fallthrough;
        default:
                inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
                break;
@@ -231,7 +231,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
        case UFS_UID_EFT:
                if (inode->ui_u1.oldids.ui_sgid == 0xFFFF)
                        return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
-               /* Fall through */
+               fallthrough;
        default:
                return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid);
        }
@@ -249,7 +249,7 @@ ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value)
                inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
                if (value > 0xFFFF)
                        value = 0xFFFF;
-               /* Fall through */
+               fallthrough;
        default:
                inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
                break;
index 96bd160..0180575 100644 (file)
@@ -226,7 +226,7 @@ int vboxsf_getattr(const struct path *path, struct kstat *kstat,
                break;
        case AT_STATX_FORCE_SYNC:
                sf_i->force_restat = 1;
-               /* fall-through */
+               fallthrough;
        default:
                err = vboxsf_inode_revalidate(dentry);
        }
index e151296..b7e222b 100644 (file)
@@ -110,9 +110,9 @@ xfs_trans_log_inode(
         * to log the timestamps, or will clear already cleared fields in the
         * worst case.
         */
-       if (inode->i_state & (I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED)) {
+       if (inode->i_state & I_DIRTY_TIME) {
                spin_lock(&inode->i_lock);
-               inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED);
+               inode->i_state &= ~I_DIRTY_TIME;
                spin_unlock(&inode->i_lock);
        }
 
index 4fc9a43..aafd073 100644 (file)
@@ -164,6 +164,8 @@ int drm_modeset_lock_all_ctx(struct drm_device *dev,
  * is 0, so no error checking is necessary
  */
 #define DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, flags, ret)               \
+       if (!drm_drv_uses_atomic_modeset(dev))                          \
+               mutex_lock(&dev->mode_config.mutex);                    \
        drm_modeset_acquire_init(&ctx, flags);                          \
 modeset_lock_retry:                                                    \
        ret = drm_modeset_lock_all_ctx(dev, &ctx);                      \
@@ -172,6 +174,7 @@ modeset_lock_retry:                                                 \
 
 /**
  * DRM_MODESET_LOCK_ALL_END - Helper to release and cleanup modeset locks
+ * @dev: drm device
  * @ctx: local modeset acquire context, will be dereferenced
  * @ret: local ret/err/etc variable to track error status
  *
@@ -188,7 +191,7 @@ modeset_lock_retry:                                                 \
  * to that failure. In both of these cases the code between BEGIN/END will not
  * be run, so the failure will reflect the inability to grab the locks.
  */
-#define DRM_MODESET_LOCK_ALL_END(ctx, ret)                             \
+#define DRM_MODESET_LOCK_ALL_END(dev, ctx, ret)                                \
 modeset_lock_fail:                                                     \
        if (ret == -EDEADLK) {                                          \
                ret = drm_modeset_backoff(&ctx);                        \
@@ -196,6 +199,8 @@ modeset_lock_fail:                                                  \
                        goto modeset_lock_retry;                        \
        }                                                               \
        drm_modeset_drop_locks(&ctx);                                   \
-       drm_modeset_acquire_fini(&ctx);
+       drm_modeset_acquire_fini(&ctx);                                 \
+       if (!drm_drv_uses_atomic_modeset(dev))                          \
+               mutex_unlock(&dev->mode_config.mutex);
 
 #endif /* DRM_MODESET_LOCK_H_ */
index fcd84e8..999636d 100644 (file)
 #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
 
 #define DEFINE_CEPH_FEATURE(bit, incarnation, name)                    \
-       static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit);                \
-       static const uint64_t CEPH_FEATUREMASK_##name =                 \
+       static const uint64_t __maybe_unused CEPH_FEATURE_##name = (1ULL<<bit);         \
+       static const uint64_t __maybe_unused CEPH_FEATUREMASK_##name =                  \
                (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
 
 /* this bit is ignored but still advertised by release *when* */
 #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
-       static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
-       static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name =              \
+       static const uint64_t __maybe_unused DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit);      \
+       static const uint64_t __maybe_unused DEPRECATED_CEPH_FEATUREMASK_##name =               \
                (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
 
 /*
diff --git a/include/linux/clk/samsung.h b/include/linux/clk/samsung.h
new file mode 100644 (file)
index 0000000..79097e3
--- /dev/null
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifndef __LINUX_CLK_SAMSUNG_H_
+#define __LINUX_CLK_SAMSUNG_H_
+
+#include <linux/compiler_types.h>
+
+struct device_node;
+
+#ifdef CONFIG_ARCH_S3C64XX
+void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
+                     unsigned long xusbxti_f, bool s3c6400,
+                     void __iomem *base);
+#else
+static inline void s3c64xx_clk_init(struct device_node *np,
+                                   unsigned long xtal_f,
+                                   unsigned long xusbxti_f,
+                                   bool s3c6400, void __iomem *base) { }
+#endif /* CONFIG_ARCH_S3C64XX */
+
+#ifdef CONFIG_S3C2410_COMMON_CLK
+void s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
+                            int current_soc,
+                            void __iomem *reg_base);
+#else
+static inline void s3c2410_common_clk_init(struct device_node *np,
+                                          unsigned long xti_f,
+                                          int current_soc,
+                                          void __iomem *reg_base) { }
+#endif /* CONFIG_S3C2410_COMMON_CLK */
+
+#ifdef CONFIG_S3C2412_COMMON_CLK
+void s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
+                            unsigned long ext_f, void __iomem *reg_base);
+#else
+static inline void s3c2412_common_clk_init(struct device_node *np,
+                                          unsigned long xti_f,
+                                          unsigned long ext_f,
+                                          void __iomem *reg_base) { }
+#endif /* CONFIG_S3C2412_COMMON_CLK */
+
+#ifdef CONFIG_S3C2443_COMMON_CLK
+void s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
+                            int current_soc,
+                            void __iomem *reg_base);
+#else
+static inline void s3c2443_common_clk_init(struct device_node *np,
+                                          unsigned long xti_f,
+                                          int current_soc,
+                                          void __iomem *reg_base) { }
+#endif /* CONFIG_S3C2443_COMMON_CLK */
+
+#endif /* __LINUX_CLK_SAMSUNG_H_ */
index d38c4d7..b354ce5 100644 (file)
@@ -429,11 +429,11 @@ put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
        compat_sigset_t v;
        switch (_NSIG_WORDS) {
        case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
-               /* fall through */
+               fallthrough;
        case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
-               /* fall through */
+               fallthrough;
        case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
-               /* fall through */
+               fallthrough;
        case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
        }
        return copy_to_user(compat, &v, size) ? -EFAULT : 0;
index 8f141d4..a911e5d 100644 (file)
@@ -956,8 +956,8 @@ static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
        case CPUFREQ_RELATION_C:
                return cpufreq_table_find_index_c(policy, target_freq);
        default:
-               pr_err("%s: Invalid relation: %d\n", __func__, relation);
-               return -EINVAL;
+               WARN_ON_ONCE(1);
+               return 0;
        }
 }
 
index a2710e6..3215023 100644 (file)
@@ -132,6 +132,7 @@ enum cpuhp_state {
        CPUHP_AP_MIPS_GIC_TIMER_STARTING,
        CPUHP_AP_ARC_TIMER_STARTING,
        CPUHP_AP_RISCV_TIMER_STARTING,
+       CPUHP_AP_CLINT_TIMER_STARTING,
        CPUHP_AP_CSKY_TIMER_STARTING,
        CPUHP_AP_HYPERV_TIMER_STARTING,
        CPUHP_AP_KVM_STARTING,
index b65909a..75895e6 100644 (file)
@@ -75,12 +75,13 @@ struct cpuidle_state {
 };
 
 /* Idle State Flags */
-#define CPUIDLE_FLAG_NONE       (0x00)
-#define CPUIDLE_FLAG_POLLING   BIT(0) /* polling state */
-#define CPUIDLE_FLAG_COUPLED   BIT(1) /* state applies to multiple cpus */
-#define CPUIDLE_FLAG_TIMER_STOP BIT(2) /* timer is stopped on this state */
-#define CPUIDLE_FLAG_UNUSABLE  BIT(3) /* avoid using this state */
-#define CPUIDLE_FLAG_OFF       BIT(4) /* disable this state by default */
+#define CPUIDLE_FLAG_NONE              (0x00)
+#define CPUIDLE_FLAG_POLLING           BIT(0) /* polling state */
+#define CPUIDLE_FLAG_COUPLED           BIT(1) /* state applies to multiple cpus */
+#define CPUIDLE_FLAG_TIMER_STOP        BIT(2) /* timer is stopped on this state */
+#define CPUIDLE_FLAG_UNUSABLE          BIT(3) /* avoid using this state */
+#define CPUIDLE_FLAG_OFF               BIT(4) /* disable this state by default */
+#define CPUIDLE_FLAG_TLB_FLUSHED       BIT(5) /* idle-state flushes TLBs */
 
 struct cpuidle_device_kobj;
 struct cpuidle_state_kobj;
index 5a3ce2a..6e87225 100644 (file)
@@ -73,9 +73,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size,
 }
 
 u64 dma_direct_get_required_mask(struct device *dev);
-gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
-                                 u64 *phys_mask);
-bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size);
 void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
                gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
index 016b96b..52635e9 100644 (file)
@@ -522,8 +522,9 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
                        pgprot_t prot, const void *caller);
 void dma_common_free_remap(void *cpu_addr, size_t size);
 
-void *dma_alloc_from_pool(struct device *dev, size_t size,
-                         struct page **ret_page, gfp_t flags);
+struct page *dma_alloc_from_pool(struct device *dev, size_t size,
+               void **cpu_addr, gfp_t flags,
+               bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t));
 bool dma_free_from_pool(struct device *dev, void *start, size_t size);
 
 int
index 0a355b0..ebfb7cf 100644 (file)
@@ -1200,7 +1200,7 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
                BPF_ANCILLARY(RANDOM);
                BPF_ANCILLARY(VLAN_TPID);
                }
-               /* Fallthrough. */
+               fallthrough;
        default:
                return ftest->code;
        }
index e019ea2..7519ae0 100644 (file)
@@ -2132,6 +2132,10 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
  *
  * I_DONTCACHE         Evict inode as soon as it is not used anymore.
  *
+ * I_SYNC_QUEUED       Inode is queued in b_io or b_more_io writeback lists.
+ *                     Used to detect that mark_inode_dirty() should not move
+ *                     inode between dirty lists.
+ *
  * Q: What is the difference between I_WILL_FREE and I_FREEING?
  */
 #define I_DIRTY_SYNC           (1 << 0)
@@ -2149,12 +2153,11 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
 #define I_DIO_WAKEUP           (1 << __I_DIO_WAKEUP)
 #define I_LINKABLE             (1 << 10)
 #define I_DIRTY_TIME           (1 << 11)
-#define __I_DIRTY_TIME_EXPIRED 12
-#define I_DIRTY_TIME_EXPIRED   (1 << __I_DIRTY_TIME_EXPIRED)
 #define I_WB_SWITCH            (1 << 13)
 #define I_OVL_INUSE            (1 << 14)
 #define I_CREATING             (1 << 15)
 #define I_DONTCACHE            (1 << 16)
+#define I_SYNC_QUEUED          (1 << 17)
 
 #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
 #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
index bd5c557..3ed4e87 100644 (file)
@@ -49,17 +49,18 @@ struct irqtrace_events {
 DECLARE_PER_CPU(int, hardirqs_enabled);
 DECLARE_PER_CPU(int, hardirq_context);
 
-  extern void trace_hardirqs_on_prepare(void);
-  extern void trace_hardirqs_off_finish(void);
-  extern void trace_hardirqs_on(void);
-  extern void trace_hardirqs_off(void);
-# define lockdep_hardirq_context()     (this_cpu_read(hardirq_context))
+extern void trace_hardirqs_on_prepare(void);
+extern void trace_hardirqs_off_finish(void);
+extern void trace_hardirqs_on(void);
+extern void trace_hardirqs_off(void);
+
+# define lockdep_hardirq_context()     (raw_cpu_read(hardirq_context))
 # define lockdep_softirq_context(p)    ((p)->softirq_context)
 # define lockdep_hardirqs_enabled()    (this_cpu_read(hardirqs_enabled))
 # define lockdep_softirqs_enabled(p)   ((p)->softirqs_enabled)
 # define lockdep_hardirq_enter()                       \
 do {                                                   \
-       if (this_cpu_inc_return(hardirq_context) == 1)  \
+       if (__this_cpu_inc_return(hardirq_context) == 1)\
                current->hardirq_threaded = 0;          \
 } while (0)
 # define lockdep_hardirq_threaded()            \
@@ -68,7 +69,7 @@ do {                                          \
 } while (0)
 # define lockdep_hardirq_exit()                        \
 do {                                           \
-       this_cpu_dec(hardirq_context);          \
+       __this_cpu_dec(hardirq_context);        \
 } while (0)
 # define lockdep_softirq_enter()               \
 do {                                           \
@@ -120,17 +121,17 @@ do {                                              \
 #else
 # define trace_hardirqs_on_prepare()           do { } while (0)
 # define trace_hardirqs_off_finish()           do { } while (0)
-# define trace_hardirqs_on()           do { } while (0)
-# define trace_hardirqs_off()          do { } while (0)
-# define lockdep_hardirq_context()     0
-# define lockdep_softirq_context(p)    0
-# define lockdep_hardirqs_enabled()    0
-# define lockdep_softirqs_enabled(p)   0
-# define lockdep_hardirq_enter()       do { } while (0)
-# define lockdep_hardirq_threaded()    do { } while (0)
-# define lockdep_hardirq_exit()                do { } while (0)
-# define lockdep_softirq_enter()       do { } while (0)
-# define lockdep_softirq_exit()                do { } while (0)
+# define trace_hardirqs_on()                   do { } while (0)
+# define trace_hardirqs_off()                  do { } while (0)
+# define lockdep_hardirq_context()             0
+# define lockdep_softirq_context(p)            0
+# define lockdep_hardirqs_enabled()            0
+# define lockdep_softirqs_enabled(p)           0
+# define lockdep_hardirq_enter()               do { } while (0)
+# define lockdep_hardirq_threaded()            do { } while (0)
+# define lockdep_hardirq_exit()                        do { } while (0)
+# define lockdep_softirq_enter()               do { } while (0)
+# define lockdep_softirq_exit()                        do { } while (0)
 # define lockdep_hrtimer_enter(__hrtimer)      false
 # define lockdep_hrtimer_exit(__context)       do { } while (0)
 # define lockdep_posixtimer_enter()            do { } while (0)
@@ -181,26 +182,33 @@ do {                                              \
  * if !TRACE_IRQFLAGS.
  */
 #ifdef CONFIG_TRACE_IRQFLAGS
-#define local_irq_enable() \
-       do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
-#define local_irq_disable() \
-       do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
+
+#define local_irq_enable()                             \
+       do {                                            \
+               trace_hardirqs_on();                    \
+               raw_local_irq_enable();                 \
+       } while (0)
+
+#define local_irq_disable()                            \
+       do {                                            \
+               bool was_disabled = raw_irqs_disabled();\
+               raw_local_irq_disable();                \
+               if (!was_disabled)                      \
+                       trace_hardirqs_off();           \
+       } while (0)
+
 #define local_irq_save(flags)                          \
        do {                                            \
                raw_local_irq_save(flags);              \
-               trace_hardirqs_off();                   \
+               if (!raw_irqs_disabled_flags(flags))    \
+                       trace_hardirqs_off();           \
        } while (0)
 
-
 #define local_irq_restore(flags)                       \
        do {                                            \
-               if (raw_irqs_disabled_flags(flags)) {   \
-                       raw_local_irq_restore(flags);   \
-                       trace_hardirqs_off();           \
-               } else {                                \
+               if (!raw_irqs_disabled_flags(flags))    \
                        trace_hardirqs_on();            \
-                       raw_local_irq_restore(flags);   \
-               }                                       \
+               raw_local_irq_restore(flags);           \
        } while (0)
 
 #define safe_halt()                            \
@@ -214,10 +222,7 @@ do {                                               \
 
 #define local_irq_enable()     do { raw_local_irq_enable(); } while (0)
 #define local_irq_disable()    do { raw_local_irq_disable(); } while (0)
-#define local_irq_save(flags)                                  \
-       do {                                                    \
-               raw_local_irq_save(flags);                      \
-       } while (0)
+#define local_irq_save(flags)  do { raw_local_irq_save(flags); } while (0)
 #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
 #define safe_halt()            do { raw_safe_halt(); } while (0)
 
index 4aaa297..08f9049 100644 (file)
@@ -1381,7 +1381,7 @@ extern int         jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
 extern int      jbd2_journal_forget (handle_t *, struct buffer_head *);
 extern int      jbd2_journal_invalidatepage(journal_t *,
                                struct page *, unsigned int, unsigned int);
-extern int      jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
+extern int      jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page);
 extern int      jbd2_journal_stop(handle_t *);
 extern int      jbd2_journal_flush (journal_t *);
 extern void     jbd2_journal_lock_updates (journal_t *);
index 19ddd43..cfb62e9 100644 (file)
@@ -86,17 +86,17 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
        }
        /* Last block: affect all 32 bits of (c) */
        switch (length) {
-       case 12: c += (u32)k[11]<<24;   /* fall through */
-       case 11: c += (u32)k[10]<<16;   /* fall through */
-       case 10: c += (u32)k[9]<<8;     /* fall through */
-       case 9:  c += k[8];             /* fall through */
-       case 8:  b += (u32)k[7]<<24;    /* fall through */
-       case 7:  b += (u32)k[6]<<16;    /* fall through */
-       case 6:  b += (u32)k[5]<<8;     /* fall through */
-       case 5:  b += k[4];             /* fall through */
-       case 4:  a += (u32)k[3]<<24;    /* fall through */
-       case 3:  a += (u32)k[2]<<16;    /* fall through */
-       case 2:  a += (u32)k[1]<<8;     /* fall through */
+       case 12: c += (u32)k[11]<<24;   fallthrough;
+       case 11: c += (u32)k[10]<<16;   fallthrough;
+       case 10: c += (u32)k[9]<<8;     fallthrough;
+       case 9:  c += k[8];             fallthrough;
+       case 8:  b += (u32)k[7]<<24;    fallthrough;
+       case 7:  b += (u32)k[6]<<16;    fallthrough;
+       case 6:  b += (u32)k[5]<<8;     fallthrough;
+       case 5:  b += k[4];             fallthrough;
+       case 4:  a += (u32)k[3]<<24;    fallthrough;
+       case 3:  a += (u32)k[2]<<16;    fallthrough;
+       case 2:  a += (u32)k[1]<<8;     fallthrough;
        case 1:  a += k[0];
                 __jhash_final(a, b, c);
        case 0: /* Nothing left to add */
@@ -132,8 +132,8 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
 
        /* Handle the last 3 u32's */
        switch (length) {
-       case 3: c += k[2];      /* fall through */
-       case 2: b += k[1];      /* fall through */
+       case 3: c += k[2];      fallthrough;
+       case 2: b += k[1];      fallthrough;
        case 1: a += k[0];
                __jhash_final(a, b, c);
        case 0: /* Nothing left to add */
index 500def6..c25b8e4 100644 (file)
  * lower_32_bits - return bits 0-31 of a number
  * @n: the number we're accessing
  */
-#define lower_32_bits(n) ((u32)(n))
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
 
 struct completion;
 struct pt_regs;
index 62a382d..6a584b3 100644 (file)
@@ -535,19 +535,27 @@ do {                                                                      \
 DECLARE_PER_CPU(int, hardirqs_enabled);
 DECLARE_PER_CPU(int, hardirq_context);
 
+/*
+ * The below lockdep_assert_*() macros use raw_cpu_read() to access the above
+ * per-cpu variables. This is required because this_cpu_read() will potentially
+ * call into preempt/irq-disable and that obviously isn't right. This is also
+ * correct because when IRQs are enabled, it doesn't matter if we accidentally
+ * read the value from our previous CPU.
+ */
+
 #define lockdep_assert_irqs_enabled()                                  \
 do {                                                                   \
-       WARN_ON_ONCE(debug_locks && !this_cpu_read(hardirqs_enabled));  \
+       WARN_ON_ONCE(debug_locks && !raw_cpu_read(hardirqs_enabled));   \
 } while (0)
 
 #define lockdep_assert_irqs_disabled()                                 \
 do {                                                                   \
-       WARN_ON_ONCE(debug_locks && this_cpu_read(hardirqs_enabled));   \
+       WARN_ON_ONCE(debug_locks && raw_cpu_read(hardirqs_enabled));    \
 } while (0)
 
 #define lockdep_assert_in_irq()                                                \
 do {                                                                   \
-       WARN_ON_ONCE(debug_locks && !this_cpu_read(hardirq_context));   \
+       WARN_ON_ONCE(debug_locks && !raw_cpu_read(hardirq_context));    \
 } while (0)
 
 #define lockdep_assert_preemption_enabled()                            \
@@ -555,7 +563,7 @@ do {                                                                        \
        WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_COUNT)   &&              \
                     debug_locks                        &&              \
                     (preempt_count() != 0              ||              \
-                     !this_cpu_read(hardirqs_enabled)));               \
+                     !raw_cpu_read(hardirqs_enabled)));                \
 } while (0)
 
 #define lockdep_assert_preemption_disabled()                           \
@@ -563,7 +571,7 @@ do {                                                                        \
        WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_COUNT)   &&              \
                     debug_locks                        &&              \
                     (preempt_count() == 0              &&              \
-                     this_cpu_read(hardirqs_enabled)));                \
+                     raw_cpu_read(hardirqs_enabled)));                 \
 } while (0)
 
 #else
index 1983e08..ca6e6a8 100644 (file)
@@ -157,11 +157,14 @@ static inline void __mm_zero_struct_page(struct page *page)
 
        switch (sizeof(struct page)) {
        case 80:
-               _pp[9] = 0;     /* fallthrough */
+               _pp[9] = 0;
+               fallthrough;
        case 72:
-               _pp[8] = 0;     /* fallthrough */
+               _pp[8] = 0;
+               fallthrough;
        case 64:
-               _pp[7] = 0;     /* fallthrough */
+               _pp[7] = 0;
+               fallthrough;
        case 56:
                _pp[6] = 0;
                _pp[5] = 0;
@@ -321,6 +324,8 @@ extern unsigned int kobjsize(const void *objp);
 
 #if defined(CONFIG_X86)
 # define VM_PAT                VM_ARCH_1       /* PAT reserves whole VMA at once (x86) */
+#elif defined(CONFIG_PPC)
+# define VM_SAO                VM_ARCH_1       /* Strong Access Ordering (powerpc) */
 #elif defined(CONFIG_PARISC)
 # define VM_GROWSUP    VM_ARCH_1
 #elif defined(CONFIG_IA64)
index c51a841..03dee12 100644 (file)
@@ -3,10 +3,15 @@
 #define _LINUX_MMU_CONTEXT_H
 
 #include <asm/mmu_context.h>
+#include <asm/mmu.h>
 
 /* Architectures that care about IRQ state in switch_mm can override this. */
 #ifndef switch_mm_irqs_off
 # define switch_mm_irqs_off switch_mm
 #endif
 
+#ifndef leave_mm
+static inline void leave_mm(int cpu) { }
+#endif
+
 #endif
index aac42c2..9b67394 100644 (file)
@@ -58,7 +58,6 @@ struct nf_ipv6_ops {
                        int (*output)(struct net *, struct sock *, struct sk_buff *));
        int (*reroute)(struct sk_buff *skb, const struct nf_queue_entry *entry);
 #if IS_MODULE(CONFIG_IPV6)
-       int (*br_defrag)(struct net *net, struct sk_buff *skb, u32 user);
        int (*br_fragment)(struct net *net, struct sock *sk,
                           struct sk_buff *skb,
                           struct nf_bridge_frag_data *data,
@@ -117,23 +116,6 @@ static inline int nf_ip6_route(struct net *net, struct dst_entry **dst,
 
 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
 
-static inline int nf_ipv6_br_defrag(struct net *net, struct sk_buff *skb,
-                                   u32 user)
-{
-#if IS_MODULE(CONFIG_IPV6)
-       const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
-
-       if (!v6_ops)
-               return 1;
-
-       return v6_ops->br_defrag(net, skb, user);
-#elif IS_BUILTIN(CONFIG_IPV6)
-       return nf_ct_frag6_gather(net, skb, user);
-#else
-       return 1;
-#endif
-}
-
 int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
                    struct nf_bridge_frag_data *data,
                    int (*output)(struct net *, struct sock *sk,
index a124c21..e8cbc2e 100644 (file)
@@ -117,7 +117,9 @@ static inline pgd_t *pgd_offset_pgd(pgd_t *pgd, unsigned long address)
  * a shortcut which implies the use of the kernel's pgd, instead
  * of a process's
  */
+#ifndef pgd_offset_k
 #define pgd_offset_k(address)          pgd_offset(&init_mm, (address))
+#endif
 
 /*
  * In many cases it is known that a virtual address is mapped at PMD or PTE
index a8e8763..c36fb41 100644 (file)
@@ -402,7 +402,8 @@ void pcs_get_state(struct phylink_pcs *pcs,
  * For most 10GBASE-R, there is no advertisement.
  */
 int pcs_config(struct phylink_pcs *pcs, unsigned int mode,
-              phy_interface_t interface, const unsigned long *advertising);
+              phy_interface_t interface, const unsigned long *advertising,
+              bool permit_pause_to_mac);
 
 /**
  * pcs_an_restart() - restart 802.3z BaseX autonegotiation
diff --git a/include/linux/platform_data/clk-s3c2410.h b/include/linux/platform_data/clk-s3c2410.h
new file mode 100644 (file)
index 0000000..7eb1cfa
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifndef __LINUX_PLATFORM_DATA_CLK_S3C2410_H_
+#define __LINUX_PLATFORM_DATA_CLK_S3C2410_H_
+
+/**
+ * struct s3c2410_clk_platform_data - platform data for S3C2410 clock driver
+ *
+ * @modify_misccr: Function to modify the MISCCR and return the new value
+ */
+struct s3c2410_clk_platform_data {
+       unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg);
+};
+
+#endif /* __LINUX_PLATFORM_DATA_CLK_S3C2410_H_ */
+
diff --git a/include/linux/platform_data/fb-s3c2410.h b/include/linux/platform_data/fb-s3c2410.h
new file mode 100644 (file)
index 0000000..10c11e6
--- /dev/null
@@ -0,0 +1,99 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2004 Arnaud Patard <arnaud.patard@rtp-net.org>
+ *
+ * Inspired by pxafb.h
+*/
+
+#ifndef __ASM_PLAT_FB_S3C2410_H
+#define __ASM_PLAT_FB_S3C2410_H __FILE__
+
+#include <linux/compiler_types.h>
+
+struct s3c2410fb_hw {
+       unsigned long   lcdcon1;
+       unsigned long   lcdcon2;
+       unsigned long   lcdcon3;
+       unsigned long   lcdcon4;
+       unsigned long   lcdcon5;
+};
+
+/* LCD description */
+struct s3c2410fb_display {
+       /* LCD type */
+       unsigned type;
+#define S3C2410_LCDCON1_DSCAN4    (0<<5)
+#define S3C2410_LCDCON1_STN4      (1<<5)
+#define S3C2410_LCDCON1_STN8      (2<<5)
+#define S3C2410_LCDCON1_TFT       (3<<5)
+
+#define S3C2410_LCDCON1_TFT1BPP           (8<<1)
+#define S3C2410_LCDCON1_TFT2BPP           (9<<1)
+#define S3C2410_LCDCON1_TFT4BPP           (10<<1)
+#define S3C2410_LCDCON1_TFT8BPP           (11<<1)
+#define S3C2410_LCDCON1_TFT16BPP   (12<<1)
+#define S3C2410_LCDCON1_TFT24BPP   (13<<1)
+
+       /* Screen size */
+       unsigned short width;
+       unsigned short height;
+
+       /* Screen info */
+       unsigned short xres;
+       unsigned short yres;
+       unsigned short bpp;
+
+       unsigned pixclock;              /* pixclock in picoseconds */
+       unsigned short left_margin;  /* value in pixels (TFT) or HCLKs (STN) */
+       unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */
+       unsigned short hsync_len;    /* value in pixels (TFT) or HCLKs (STN) */
+       unsigned short upper_margin;    /* value in lines (TFT) or 0 (STN) */
+       unsigned short lower_margin;    /* value in lines (TFT) or 0 (STN) */
+       unsigned short vsync_len;       /* value in lines (TFT) or 0 (STN) */
+
+       /* lcd configuration registers */
+       unsigned long   lcdcon5;
+#define S3C2410_LCDCON5_BPP24BL            (1<<12)
+#define S3C2410_LCDCON5_FRM565     (1<<11)
+#define S3C2410_LCDCON5_INVVCLK            (1<<10)
+#define S3C2410_LCDCON5_INVVLINE    (1<<9)
+#define S3C2410_LCDCON5_INVVFRAME   (1<<8)
+#define S3C2410_LCDCON5_INVVD      (1<<7)
+#define S3C2410_LCDCON5_INVVDEN            (1<<6)
+#define S3C2410_LCDCON5_INVPWREN    (1<<5)
+#define S3C2410_LCDCON5_INVLEND            (1<<4)
+#define S3C2410_LCDCON5_PWREN      (1<<3)
+#define S3C2410_LCDCON5_ENLEND     (1<<2)
+#define S3C2410_LCDCON5_BSWP       (1<<1)
+#define S3C2410_LCDCON5_HWSWP      (1<<0)
+};
+
+struct s3c2410fb_mach_info {
+
+       struct s3c2410fb_display *displays;     /* attached displays info */
+       unsigned num_displays;                  /* number of defined displays */
+       unsigned default_display;
+
+       /* GPIOs */
+
+       unsigned long   gpcup;
+       unsigned long   gpcup_mask;
+       unsigned long   gpccon;
+       unsigned long   gpccon_mask;
+       unsigned long   gpdup;
+       unsigned long   gpdup_mask;
+       unsigned long   gpdcon;
+       unsigned long   gpdcon_mask;
+
+       void __iomem *  gpccon_reg;
+       void __iomem *  gpcup_reg;
+       void __iomem *  gpdcon_reg;
+       void __iomem *  gpdup_reg;
+
+       /* lpc3600 control register */
+       unsigned long   lpcsel;
+};
+
+extern void s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *);
+
+#endif /* __ASM_PLAT_FB_S3C2410_H */
index 33310b1..bacb86d 100644 (file)
@@ -35,6 +35,7 @@ struct s3c24xx_mci_pdata {
        unsigned long   ocr_avail;
        void            (*set_power)(unsigned char power_mode,
                                     unsigned short vdd);
+       struct gpio_desc *bus[6];
 };
 
 /**
@@ -44,6 +45,7 @@ struct s3c24xx_mci_pdata {
  * Copy the platform data supplied by @pdata so that this can be marked
  * __initdata.
  */
+extern void s3c24xx_mci_def_set_power(unsigned char power_mode, unsigned short vdd);
 extern void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata);
 
 #endif /* _ARCH_NCI_H */
index 644af1d..7037ba7 100644 (file)
@@ -54,11 +54,8 @@ struct am33xx_pm_platform_data {
        void    (*begin_suspend)(void);
        void    (*finish_suspend)(void);
        struct  am33xx_pm_sram_addr *(*get_sram_addrs)(void);
-       void __iomem *(*get_rtc_base_addr)(void);
        void (*save_context)(void);
        void (*restore_context)(void);
-       void (*prepare_rtc_suspend)(void);
-       void (*prepare_rtc_resume)(void);
        int (*check_off_mode_enable)(void);
 };
 
index 4dc9b87..a170939 100644 (file)
@@ -26,6 +26,8 @@ struct s3c24xx_hsudc_platdata {
        unsigned int    epnum;
        void            (*gpio_init)(void);
        void            (*gpio_uninit)(void);
+       void            (*phy_init)(void);
+       void            (*phy_uninit)(void);
 };
 
 #endif /* __LINUX_USB_S3C_HSUDC_H */
index 93ecd93..afe01e2 100644 (file)
@@ -1666,7 +1666,7 @@ extern struct task_struct *idle_task(int cpu);
  *
  * Return: 1 if @p is an idle task. 0 otherwise.
  */
-static inline bool is_idle_task(const struct task_struct *p)
+static __always_inline bool is_idle_task(const struct task_struct *p)
 {
        return !!(p->flags & PF_IDLE);
 }
index 917d88e..a8ec3b6 100644 (file)
@@ -36,6 +36,9 @@ struct user_struct {
     defined(CONFIG_NET) || defined(CONFIG_IO_URING)
        atomic_long_t locked_vm;
 #endif
+#ifdef CONFIG_WATCH_QUEUE
+       atomic_t nr_watches;    /* The number of watches this user currently has */
+#endif
 
        /* Miscellaneous per-user rate limit */
        struct ratelimit_state ratelimit;
index 6bb1a3f..7bbc0e9 100644 (file)
@@ -137,11 +137,11 @@ static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
                b3 = b->sig[3]; b2 = b->sig[2];                         \
                r->sig[3] = op(a3, b3);                                 \
                r->sig[2] = op(a2, b2);                                 \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 2:                                                         \
                a1 = a->sig[1]; b1 = b->sig[1];                         \
                r->sig[1] = op(a1, b1);                                 \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 1:                                                         \
                a0 = a->sig[0]; b0 = b->sig[0];                         \
                r->sig[0] = op(a0, b0);                                 \
@@ -171,9 +171,9 @@ static inline void name(sigset_t *set)                                      \
        switch (_NSIG_WORDS) {                                          \
        case 4: set->sig[3] = op(set->sig[3]);                          \
                set->sig[2] = op(set->sig[2]);                          \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 2: set->sig[1] = op(set->sig[1]);                          \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 1: set->sig[0] = op(set->sig[0]);                          \
                    break;                                              \
        default:                                                        \
@@ -194,7 +194,7 @@ static inline void sigemptyset(sigset_t *set)
                memset(set, 0, sizeof(sigset_t));
                break;
        case 2: set->sig[1] = 0;
-               /* fall through */
+               fallthrough;
        case 1: set->sig[0] = 0;
                break;
        }
@@ -207,7 +207,7 @@ static inline void sigfillset(sigset_t *set)
                memset(set, -1, sizeof(sigset_t));
                break;
        case 2: set->sig[1] = -1;
-               /* fall through */
+               fallthrough;
        case 1: set->sig[0] = -1;
                break;
        }
index 46881d9..ab57cf7 100644 (file)
@@ -3745,19 +3745,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
 #define __it(x, op) (x -= sizeof(u##op))
 #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
        case 32: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 24: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 16: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case  8: diffs |= __it_diff(a, b, 64);
                break;
        case 28: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 20: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 12: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case  4: diffs |= __it_diff(a, b, 32);
                break;
        }
diff --git a/include/linux/soc/samsung/s3c-adc.h b/include/linux/soc/samsung/s3c-adc.h
new file mode 100644 (file)
index 0000000..591c94e
--- /dev/null
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/   
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C ADC driver information
+ */
+
+#ifndef __LINUX_SOC_SAMSUNG_S3C_ADC_H
+#define __LINUX_SOC_SAMSUNG_S3C_ADC_H __FILE__
+
+struct s3c_adc_client;
+struct platform_device;
+
+extern int s3c_adc_start(struct s3c_adc_client *client,
+                        unsigned int channel, unsigned int nr_samples);
+
+extern int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch);
+
+extern struct s3c_adc_client *
+       s3c_adc_register(struct platform_device *pdev,
+                        void (*select)(struct s3c_adc_client *client,
+                                       unsigned selected),
+                        void (*conv)(struct s3c_adc_client *client,
+                                     unsigned d0, unsigned d1,
+                                     unsigned *samples_left),
+                        unsigned int is_ts);
+
+extern void s3c_adc_release(struct s3c_adc_client *client);
+
+#endif /* __LINUX_SOC_SAMSUNG_S3C_ADC_H */
diff --git a/include/linux/soc/samsung/s3c-cpu-freq.h b/include/linux/soc/samsung/s3c-cpu-freq.h
new file mode 100644 (file)
index 0000000..63e88fd
--- /dev/null
@@ -0,0 +1,145 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2006-2007 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C CPU frequency scaling support - driver and board
+ */
+#ifndef __LINUX_SOC_SAMSUNG_S3C_CPU_FREQ_H
+#define __LINUX_SOC_SAMSUNG_S3C_CPU_FREQ_H
+
+#include <linux/cpufreq.h>
+
+struct s3c_cpufreq_info;
+struct s3c_cpufreq_board;
+struct s3c_iotimings;
+
+/**
+ * struct s3c_freq - frequency information (mainly for core drivers)
+ * @fclk: The FCLK frequency in Hz.
+ * @armclk: The ARMCLK frequency in Hz.
+ * @hclk_tns: HCLK cycle time in 10ths of nano-seconds.
+ * @hclk: The HCLK frequency in Hz.
+ * @pclk: The PCLK frequency in Hz.
+ *
+ * This contains the frequency information about the current configuration
+ * mainly for the core drivers to ensure we do not end up passing about
+ * a large number of parameters.
+ *
+ * The @hclk_tns field is a useful cache for the parts of the drivers that
+ * need to calculate IO timings and suchlike.
+ */
+struct s3c_freq {
+       unsigned long   fclk;
+       unsigned long   armclk;
+       unsigned long   hclk_tns;       /* in 10ths of ns */
+       unsigned long   hclk;
+       unsigned long   pclk;
+};
+
+/**
+ * struct s3c_cpufreq_freqs - s3c cpufreq notification information.
+ * @freqs: The cpufreq setting information.
+ * @old: The old clock settings.
+ * @new: The new clock settings.
+ * @pll_changing: Set if the PLL is changing.
+ *
+ * Wrapper 'struct cpufreq_freqs' so that any drivers receiving the
+ * notification can use this information that is not provided by just
+ * having the core frequency alone.
+ *
+ * The pll_changing flag is used to indicate if the PLL itself is
+ * being set during this change. This is important as the clocks
+ * will temporarily be set to the XTAL clock during this time, so
+ * drivers may want to close down their output during this time.
+ *
+ * Note, this is not being used by any current drivers and therefore
+ * may be removed in the future.
+ */
+struct s3c_cpufreq_freqs {
+       struct cpufreq_freqs    freqs;
+       struct s3c_freq         old;
+       struct s3c_freq         new;
+
+       unsigned int            pll_changing:1;
+};
+
+#define to_s3c_cpufreq(_cf) container_of(_cf, struct s3c_cpufreq_freqs, freqs)
+
+/**
+ * struct s3c_clkdivs - clock divisor information
+ * @p_divisor: Divisor from FCLK to PCLK.
+ * @h_divisor: Divisor from FCLK to HCLK.
+ * @arm_divisor: Divisor from FCLK to ARMCLK (not all CPUs).
+ * @dvs: Non-zero if using DVS mode for ARMCLK.
+ *
+ * Divisor settings for the core clocks.
+ */
+struct s3c_clkdivs {
+       int             p_divisor;
+       int             h_divisor;
+       int             arm_divisor;
+       unsigned char   dvs;
+};
+
+#define PLLVAL(_m, _p, _s) (((_m) << 12) | ((_p) << 4) | (_s))
+
+/**
+ * struct s3c_pllval - PLL value entry.
+ * @freq: The frequency for this entry in Hz.
+ * @pll_reg: The PLL register setting for this PLL value.
+ */
+struct s3c_pllval {
+       unsigned long           freq;
+       unsigned long           pll_reg;
+};
+
+/**
+ * struct s3c_cpufreq_board - per-board cpu frequency informatin
+ * @refresh: The SDRAM refresh period in nanoseconds.
+ * @auto_io: Set if the IO timing settings should be generated from the
+ *     initialisation time hardware registers.
+ * @need_io: Set if the board has external IO on any of the chipselect
+ *     lines that will require the hardware timing registers to be
+ *     updated on a clock change.
+ * @max: The maxium frequency limits for the system. Any field that
+ *     is left at zero will use the CPU's settings.
+ *
+ * This contains the board specific settings that affect how the CPU
+ * drivers chose settings. These include the memory refresh and IO
+ * timing information.
+ *
+ * Registration depends on the driver being used, the ARMCLK only
+ * implementation does not currently need this but the older style
+ * driver requires this to be available.
+ */
+struct s3c_cpufreq_board {
+       unsigned int    refresh;
+       unsigned int    auto_io:1;      /* automatically init io timings. */
+       unsigned int    need_io:1;      /* set if needs io timing support. */
+
+       /* any non-zero field in here is taken as an upper limit. */
+       struct s3c_freq max;    /* frequency limits */
+};
+
+/* Things depending on frequency scaling. */
+#ifdef CONFIG_ARM_S3C_CPUFREQ
+#define __init_or_cpufreq
+#else
+#define __init_or_cpufreq __init
+#endif
+
+/* Board functions */
+
+#ifdef CONFIG_ARM_S3C_CPUFREQ
+extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board);
+#else
+
+static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
+{
+       return 0;
+}
+#endif  /* CONFIG_ARM_S3C_CPUFREQ */
+
+#endif
diff --git a/include/linux/soc/samsung/s3c-cpufreq-core.h b/include/linux/soc/samsung/s3c-cpufreq-core.h
new file mode 100644 (file)
index 0000000..3b278af
--- /dev/null
@@ -0,0 +1,299 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2006-2009 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C CPU frequency scaling support - core support
+ */
+#ifndef __LINUX_SOC_SAMSUNG_S3C_CPUFREQ_CORE_H
+#define __LINUX_SOC_SAMSUNG_S3C_CPUFREQ_CORE_H
+
+#include <linux/soc/samsung/s3c-cpu-freq.h>
+
+struct seq_file;
+
+#define MAX_BANKS (8)
+#define S3C2412_MAX_IO (8)
+
+/**
+ * struct s3c2410_iobank_timing - IO bank timings for S3C2410 style timings
+ * @bankcon: The cached version of settings in this structure.
+ * @tacp:
+ * @tacs: Time from address valid to nCS asserted.
+ * @tcos: Time from nCS asserted to nOE or nWE asserted.
+ * @tacc: Time that nOE or nWE is asserted.
+ * @tcoh: Time nCS is held after nOE or nWE are released.
+ * @tcah: Time address is held for after
+ * @nwait_en: Whether nWAIT is enabled for this bank.
+ *
+ * This structure represents the IO timings for a S3C2410 style IO bank
+ * used by the CPU frequency support if it needs to change the settings
+ * of the IO.
+ */
+struct s3c2410_iobank_timing {
+       unsigned long   bankcon;
+       unsigned int    tacp;
+       unsigned int    tacs;
+       unsigned int    tcos;
+       unsigned int    tacc;
+       unsigned int    tcoh;           /* nCS hold after nOE/nWE */
+       unsigned int    tcah;           /* Address hold after nCS */
+       unsigned char   nwait_en;       /* nWait enabled for bank. */
+};
+
+/**
+ * struct s3c2412_iobank_timing - io timings for PL092 (S3C2412) style IO
+ * @idcy: The idle cycle time between transactions.
+ * @wstrd: nCS release to end of read cycle.
+ * @wstwr: nCS release to end of write cycle.
+ * @wstoen: nCS assertion to nOE assertion time.
+ * @wstwen: nCS assertion to nWE assertion time.
+ * @wstbrd: Burst ready delay.
+ * @smbidcyr: Register cache for smbidcyr value.
+ * @smbwstrd: Register cache for smbwstrd value.
+ * @smbwstwr: Register cache for smbwstwr value.
+ * @smbwstoen: Register cache for smbwstoen value.
+ * @smbwstwen: Register cache for smbwstwen value.
+ * @smbwstbrd: Register cache for smbwstbrd value.
+ *
+ * Timing information for a IO bank on an S3C2412 or similar system which
+ * uses a PL093 block.
+ */
+struct s3c2412_iobank_timing {
+       unsigned int    idcy;
+       unsigned int    wstrd;
+       unsigned int    wstwr;
+       unsigned int    wstoen;
+       unsigned int    wstwen;
+       unsigned int    wstbrd;
+
+       /* register cache */
+       unsigned char   smbidcyr;
+       unsigned char   smbwstrd;
+       unsigned char   smbwstwr;
+       unsigned char   smbwstoen;
+       unsigned char   smbwstwen;
+       unsigned char   smbwstbrd;
+};
+
+union s3c_iobank {
+       struct s3c2410_iobank_timing    *io_2410;
+       struct s3c2412_iobank_timing    *io_2412;
+};
+
+/**
+ * struct s3c_iotimings - Chip IO timings holder
+ * @bank: The timings for each IO bank.
+ */
+struct s3c_iotimings {
+       union s3c_iobank        bank[MAX_BANKS];
+};
+
+/**
+ * struct s3c_plltab - PLL table information.
+ * @vals: List of PLL values.
+ * @size: Size of the PLL table @vals.
+ */
+struct s3c_plltab {
+       struct s3c_pllval       *vals;
+       int                      size;
+};
+
+/**
+ * struct s3c_cpufreq_config - current cpu frequency configuration
+ * @freq: The current settings for the core clocks.
+ * @max: Maxium settings, derived from core, board and user settings.
+ * @pll: The PLL table entry for the current PLL settings.
+ * @divs: The divisor settings for the core clocks.
+ * @info: The current core driver information.
+ * @board: The information for the board we are running on.
+ * @lock_pll: Set if the PLL settings cannot be changed.
+ *
+ * This is for the core drivers that need to know information about
+ * the current settings and values. It should not be needed by any
+ * device drivers.
+*/
+struct s3c_cpufreq_config {
+       struct s3c_freq         freq;
+       struct s3c_freq         max;
+       struct clk              *mpll;
+       struct cpufreq_frequency_table pll;
+       struct s3c_clkdivs      divs;
+       struct s3c_cpufreq_info *info;  /* for core, not drivers */
+       struct s3c_cpufreq_board *board;
+
+       unsigned int    lock_pll:1;
+};
+
+/**
+ * struct s3c_cpufreq_info - Information for the CPU frequency driver.
+ * @name: The name of this implementation.
+ * @max: The maximum frequencies for the system.
+ * @latency: Transition latency to give to cpufreq.
+ * @locktime_m: The lock-time in uS for the MPLL.
+ * @locktime_u: The lock-time in uS for the UPLL.
+ * @locttime_bits: The number of bits each LOCKTIME field.
+ * @need_pll: Set if this driver needs to change the PLL values to achieve
+ *     any frequency changes. This is really only need by devices like the
+ *     S3C2410 where there is no or limited divider between the PLL and the
+ *     ARMCLK.
+ * @get_iotiming: Get the current IO timing data, mainly for use at start.
+ * @set_iotiming: Update the IO timings from the cached copies calculated
+ *     from the @calc_iotiming entry when changing the frequency.
+ * @calc_iotiming: Calculate and update the cached copies of the IO timings
+ *     from the newly calculated frequencies.
+ * @calc_freqtable: Calculate (fill in) the given frequency table from the
+ *     current frequency configuration. If the table passed in is NULL,
+ *     then the return is the number of elements to be filled for allocation
+ *     of the table.
+ * @set_refresh: Set the memory refresh configuration.
+ * @set_fvco: Set the PLL frequencies.
+ * @set_divs: Update the clock divisors.
+ * @calc_divs: Calculate the clock divisors.
+ */
+struct s3c_cpufreq_info {
+       const char              *name;
+       struct s3c_freq         max;
+
+       unsigned int            latency;
+
+       unsigned int            locktime_m;
+       unsigned int            locktime_u;
+       unsigned char           locktime_bits;
+
+       unsigned int            need_pll:1;
+
+       /* driver routines */
+
+       int             (*get_iotiming)(struct s3c_cpufreq_config *cfg,
+                                       struct s3c_iotimings *timings);
+
+       void            (*set_iotiming)(struct s3c_cpufreq_config *cfg,
+                                       struct s3c_iotimings *timings);
+
+       int             (*calc_iotiming)(struct s3c_cpufreq_config *cfg,
+                                        struct s3c_iotimings *timings);
+
+       int             (*calc_freqtable)(struct s3c_cpufreq_config *cfg,
+                                         struct cpufreq_frequency_table *t,
+                                         size_t table_size);
+
+       void            (*debug_io_show)(struct seq_file *seq,
+                                        struct s3c_cpufreq_config *cfg,
+                                        union s3c_iobank *iob);
+
+       void            (*set_refresh)(struct s3c_cpufreq_config *cfg);
+       void            (*set_fvco)(struct s3c_cpufreq_config *cfg);
+       void            (*set_divs)(struct s3c_cpufreq_config *cfg);
+       int             (*calc_divs)(struct s3c_cpufreq_config *cfg);
+};
+
+extern int s3c_cpufreq_register(struct s3c_cpufreq_info *info);
+
+extern int s3c_plltab_register(struct cpufreq_frequency_table *plls,
+                              unsigned int plls_no);
+
+/* exports and utilities for debugfs */
+extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
+extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
+
+#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS
+#define s3c_cpufreq_debugfs_call(x) x
+#else
+#define s3c_cpufreq_debugfs_call(x) NULL
+#endif
+
+/* Useful utility functions. */
+
+extern struct clk *s3c_cpufreq_clk_get(struct device *, const char *);
+
+/* S3C2410 and compatible exported functions */
+
+extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
+extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg);
+
+#ifdef CONFIG_S3C2410_IOTIMING
+extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
+                                    struct s3c_cpufreq_config *cfg,
+                                    union s3c_iobank *iob);
+
+extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
+                                struct s3c_iotimings *iot);
+
+extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
+                               struct s3c_iotimings *timings);
+
+extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
+                                struct s3c_iotimings *iot);
+#else
+#define s3c2410_iotiming_debugfs NULL
+#define s3c2410_iotiming_calc NULL
+#define s3c2410_iotiming_get NULL
+#define s3c2410_iotiming_set NULL
+#endif /* CONFIG_S3C2410_IOTIMING */
+
+/* S3C2412 compatible routines */
+
+#ifdef CONFIG_S3C2412_IOTIMING
+extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
+                                    struct s3c_cpufreq_config *cfg,
+                                    union s3c_iobank *iob);
+
+extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
+                               struct s3c_iotimings *timings);
+
+extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
+                                struct s3c_iotimings *iot);
+
+extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
+                                struct s3c_iotimings *iot);
+extern void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
+#else
+#define s3c2412_iotiming_debugfs NULL
+#define s3c2412_iotiming_calc NULL
+#define s3c2412_iotiming_get NULL
+#define s3c2412_iotiming_set NULL
+#endif /* CONFIG_S3C2412_IOTIMING */
+
+#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG
+#define s3c_freq_dbg(x...) printk(KERN_INFO x)
+#else
+#define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0)
+#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG */
+
+#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG
+#define s3c_freq_iodbg(x...) printk(KERN_INFO x)
+#else
+#define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0)
+#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG */
+
+static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
+                                     int index, size_t table_size,
+                                     unsigned int freq)
+{
+       if (index < 0)
+               return index;
+
+       if (table) {
+               if (index >= table_size)
+                       return -ENOMEM;
+
+               s3c_freq_dbg("%s: { %d = %u kHz }\n",
+                            __func__, index, freq);
+
+               table[index].driver_data = index;
+               table[index].frequency = freq;
+       }
+
+       return index + 1;
+}
+
+u32 s3c2440_read_camdivn(void);
+void s3c2440_write_camdivn(u32 camdiv);
+u32 s3c24xx_read_clkdivn(void);
+void s3c24xx_write_clkdivn(u32 clkdiv);
+u32 s3c24xx_read_mpllcon(void);
+void s3c24xx_write_locktime(u32 locktime);
+
+#endif
diff --git a/include/linux/soc/samsung/s3c-pm.h b/include/linux/soc/samsung/s3c-pm.h
new file mode 100644 (file)
index 0000000..f916455
--- /dev/null
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ *     Tomasz Figa <t.figa@samsung.com>
+ * Copyright (c) 2004 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Written by Ben Dooks, <ben@simtec.co.uk>
+ */
+
+#ifndef __LINUX_SOC_SAMSUNG_S3C_PM_H
+#define __LINUX_SOC_SAMSUNG_S3C_PM_H __FILE__
+
+#include <linux/types.h>
+
+/* PM debug functions */
+
+/**
+ * struct pm_uart_save - save block for core UART
+ * @ulcon: Save value for S3C2410_ULCON
+ * @ucon: Save value for S3C2410_UCON
+ * @ufcon: Save value for S3C2410_UFCON
+ * @umcon: Save value for S3C2410_UMCON
+ * @ubrdiv: Save value for S3C2410_UBRDIV
+ *
+ * Save block for UART registers to be held over sleep and restored if they
+ * are needed (say by debug).
+*/
+struct pm_uart_save {
+       u32     ulcon;
+       u32     ucon;
+       u32     ufcon;
+       u32     umcon;
+       u32     ubrdiv;
+       u32     udivslot;
+};
+
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+/**
+ * s3c_pm_dbg() - low level debug function for use in suspend/resume.
+ * @msg: The message to print.
+ *
+ * This function is used mainly to debug the resume process before the system
+ * can rely on printk/console output. It uses the low-level debugging output
+ * routine printascii() to do its work.
+ */
+extern void s3c_pm_dbg(const char *msg, ...);
+
+#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
+
+extern void s3c_pm_save_uarts(bool is_s3c24xx);
+extern void s3c_pm_restore_uarts(bool is_s3c24xx);
+
+#ifdef CONFIG_ARCH_S3C64XX
+extern void s3c_pm_arch_update_uart(void __iomem *regs,
+                                   struct pm_uart_save *save);
+#else
+static inline void
+s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
+{
+}
+#endif
+
+#else
+#define S3C_PMDBG(fmt...) pr_debug(fmt)
+
+static inline void s3c_pm_save_uarts(bool is_s3c24xx) { }
+static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { }
+#endif
+
+/* suspend memory checking */
+
+#ifdef CONFIG_SAMSUNG_PM_CHECK
+extern void s3c_pm_check_prepare(void);
+extern void s3c_pm_check_restore(void);
+extern void s3c_pm_check_cleanup(void);
+extern void s3c_pm_check_store(void);
+#else
+#define s3c_pm_check_prepare() do { } while (0)
+#define s3c_pm_check_restore() do { } while (0)
+#define s3c_pm_check_cleanup() do { } while (0)
+#define s3c_pm_check_store()   do { } while (0)
+#endif
+
+/* system device subsystems */
+
+extern struct bus_type s3c2410_subsys;
+extern struct bus_type s3c2410a_subsys;
+extern struct bus_type s3c2412_subsys;
+extern struct bus_type s3c2416_subsys;
+extern struct bus_type s3c2440_subsys;
+extern struct bus_type s3c2442_subsys;
+extern struct bus_type s3c2443_subsys;
+
+#endif
index 49c5d29..cf27b08 100644 (file)
@@ -220,6 +220,9 @@ struct ti_sci_rm_core_ops {
                                    u16 *range_start, u16 *range_num);
 };
 
+#define TI_SCI_RESASG_SUBTYPE_IR_OUTPUT                0
+#define TI_SCI_RESASG_SUBTYPE_IA_VINT          0xa
+#define TI_SCI_RESASG_SUBTYPE_GLOBAL_EVENT_SEVT        0xd
 /**
  * struct ti_sci_rm_irq_ops: IRQ management operations
  * @set_irq:           Set an IRQ route between the requested source
@@ -556,6 +559,9 @@ u32 ti_sci_get_num_resources(struct ti_sci_resource *res);
 struct ti_sci_resource *
 devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
                            struct device *dev, u32 dev_id, char *of_prop);
+struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+                        u32 dev_id, u32 sub_type);
 
 #else  /* CONFIG_TI_SCI_PROTOCOL */
 
@@ -609,6 +615,13 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
 {
        return ERR_PTR(-EINVAL);
 }
+
+static inline struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+                        u32 dev_id, u32 sub_type);
+{
+       return ERR_PTR(-EINVAL);
+}
 #endif /* CONFIG_TI_SCI_PROTOCOL */
 
 #endif /* __TISCI_PROTOCOL_H */
diff --git a/include/linux/spi/s3c24xx-fiq.h b/include/linux/spi/s3c24xx-fiq.h
new file mode 100644 (file)
index 0000000..d2842ac
--- /dev/null
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* linux/drivers/spi/spi_s3c24xx_fiq.h
+ *
+ * Copyright 2009 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C24XX SPI - FIQ pseudo-DMA transfer support
+*/
+
+#ifndef __LINUX_SPI_S3C24XX_FIQ_H
+#define __LINUX_SPI_S3C24XX_FIQ_H __FILE__
+
+/* We have R8 through R13 to play with */
+
+#ifdef __ASSEMBLY__
+#define __REG_NR(x)     r##x
+#else
+
+extern struct spi_fiq_code s3c24xx_spi_fiq_txrx;
+extern struct spi_fiq_code s3c24xx_spi_fiq_tx;
+extern struct spi_fiq_code s3c24xx_spi_fiq_rx;
+
+#define __REG_NR(x)     (x)
+#endif
+
+#define fiq_rspi       __REG_NR(8)
+#define fiq_rtmp       __REG_NR(9)
+#define fiq_rrx                __REG_NR(10)
+#define fiq_rtx                __REG_NR(11)
+#define fiq_rcount     __REG_NR(12)
+#define fiq_rirq       __REG_NR(13)
+
+#endif /* __LINUX_SPI_S3C24XX_FIQ_H */
index c91d10b..440a715 100644 (file)
@@ -20,6 +20,6 @@ struct s3c2410_spi_info {
        void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
 };
 
-extern int s3c24xx_set_fiq(unsigned int irq, bool on);
+extern int s3c24xx_set_fiq(unsigned int irq, u32 *ack_ptr, bool on);
 
 #endif /* __LINUX_SPI_S3C24XX_H */
index adcc6a9..143568d 100644 (file)
@@ -308,7 +308,7 @@ do {                                                                             \
                                                                             \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):                          \
     R##_e = X##_e;                                                          \
-         /* Fall through */                                                 \
+       fallthrough;                                                         \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL):                           \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):                              \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):                                     \
@@ -319,7 +319,7 @@ do {                                                                             \
                                                                             \
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL):                          \
     R##_e = Y##_e;                                                          \
-         /* Fall through */                                                 \
+       fallthrough;                                                         \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN):                           \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):                              \
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):                                     \
@@ -417,7 +417,7 @@ do {                                                        \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):         \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):                \
     R##_s = X##_s;                                     \
-       /* Fall through */                              \
+         fallthrough;                                  \
                                                        \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):         \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):      \
@@ -431,7 +431,7 @@ do {                                                        \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):         \
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):                \
     R##_s = Y##_s;                                     \
-       /* Fall through */                              \
+         fallthrough;                                  \
                                                        \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF):      \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):     \
@@ -497,7 +497,7 @@ do {                                                        \
                                                        \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):     \
     FP_SET_EXCEPTION(FP_EX_DIVZERO);                   \
-         /* Fall through */                            \
+       fallthrough;                                    \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO):                \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):      \
     R##_c = FP_CLS_INF;                                        \
index d1200b4..f746851 100644 (file)
@@ -35,8 +35,4 @@ struct s3c_camif_plat_data {
        int (*gpio_put)(void);
 };
 
-/* Platform default helper functions */
-int s3c_camif_gpio_get(void);
-int s3c_camif_gpio_put(void);
-
 #endif /* MEDIA_S3C_CAMIF_ */
index ba3f6c1..18f783d 100644 (file)
@@ -97,7 +97,8 @@ bool ipv6_chk_custom_prefix(const struct in6_addr *addr,
 
 int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev);
 
-struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr);
+struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr,
+                                struct net_device *dev);
 
 struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
                                     const struct in6_addr *addr,
index cc41d69..4c8b99e 100644 (file)
@@ -746,24 +746,29 @@ TRACE_EVENT(ext4_mb_release_group_pa,
 );
 
 TRACE_EVENT(ext4_discard_preallocations,
-       TP_PROTO(struct inode *inode),
+       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
 
-       TP_ARGS(inode),
+       TP_ARGS(inode, len, needed),
 
        TP_STRUCT__entry(
-               __field(        dev_t,  dev                     )
-               __field(        ino_t,  ino                     )
+               __field(        dev_t,          dev             )
+               __field(        ino_t,          ino             )
+               __field(        unsigned int,   len             )
+               __field(        unsigned int,   needed          )
 
        ),
 
        TP_fast_assign(
                __entry->dev    = inode->i_sb->s_dev;
                __entry->ino    = inode->i_ino;
+               __entry->len    = len;
+               __entry->needed = needed;
        ),
 
-       TP_printk("dev %d,%d ino %lu",
+       TP_printk("dev %d,%d ino %lu len: %u needed %u",
                  MAJOR(__entry->dev), MINOR(__entry->dev),
-                 (unsigned long) __entry->ino)
+                 (unsigned long) __entry->ino, __entry->len,
+                 __entry->needed)
 );
 
 TRACE_EVENT(ext4_mb_discard_preallocations,
@@ -1312,18 +1317,34 @@ DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
        TP_ARGS(sb, group)
 );
 
-DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
+DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
 
        TP_PROTO(struct super_block *sb, unsigned long group),
 
        TP_ARGS(sb, group)
 );
 
-DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
+TRACE_EVENT(ext4_read_block_bitmap_load,
+       TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
 
-       TP_PROTO(struct super_block *sb, unsigned long group),
+       TP_ARGS(sb, group, prefetch),
 
-       TP_ARGS(sb, group)
+       TP_STRUCT__entry(
+               __field(        dev_t,  dev                     )
+               __field(        __u32,  group                   )
+               __field(        bool,   prefetch                )
+
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = sb->s_dev;
+               __entry->group  = group;
+               __entry->prefetch = prefetch;
+       ),
+
+       TP_printk("dev %d,%d group %u prefetch %d",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->group, __entry->prefetch)
 );
 
 TRACE_EVENT(ext4_direct_IO_enter,
@@ -2726,6 +2747,50 @@ TRACE_EVENT(ext4_error,
                  __entry->function, __entry->line)
 );
 
+TRACE_EVENT(ext4_prefetch_bitmaps,
+           TP_PROTO(struct super_block *sb, ext4_group_t group,
+                    ext4_group_t next, unsigned int prefetch_ios),
+
+       TP_ARGS(sb, group, next, prefetch_ios),
+
+       TP_STRUCT__entry(
+               __field(        dev_t,  dev                     )
+               __field(        __u32,  group                   )
+               __field(        __u32,  next                    )
+               __field(        __u32,  ios                     )
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = sb->s_dev;
+               __entry->group  = group;
+               __entry->next   = next;
+               __entry->ios    = prefetch_ios;
+       ),
+
+       TP_printk("dev %d,%d group %u next %u ios %u",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->group, __entry->next, __entry->ios)
+);
+
+TRACE_EVENT(ext4_lazy_itable_init,
+           TP_PROTO(struct super_block *sb, ext4_group_t group),
+
+       TP_ARGS(sb, group),
+
+       TP_STRUCT__entry(
+               __field(        dev_t,  dev                     )
+               __field(        __u32,  group                   )
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = sb->s_dev;
+               __entry->group  = group;
+       ),
+
+       TP_printk("dev %d,%d group %u",
+                 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->group)
+);
+
 #endif /* _TRACE_EXT4_H */
 
 /* This part must be outside protection */
index 939092d..5fb7520 100644 (file)
@@ -114,6 +114,8 @@ IF_HAVE_PG_IDLE(PG_idle,            "idle"          )
 
 #if defined(CONFIG_X86)
 #define __VM_ARCH_SPECIFIC_1 {VM_PAT,     "pat"           }
+#elif defined(CONFIG_PPC)
+#define __VM_ARCH_SPECIFIC_1 {VM_SAO,     "sao"           }
 #elif defined(CONFIG_PARISC) || defined(CONFIG_IA64)
 #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP,      "growsup"       }
 #elif !defined(CONFIG_MMU)
index 10f5d1f..e7cbccc 100644 (file)
@@ -20,7 +20,6 @@
                {I_CLEAR,               "I_CLEAR"},             \
                {I_SYNC,                "I_SYNC"},              \
                {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
-               {I_DIRTY_TIME_EXPIRED,  "I_DIRTY_TIME_EXPIRED"}, \
                {I_REFERENCED,          "I_REFERENCED"}         \
        )
 
@@ -498,8 +497,9 @@ DEFINE_WBC_EVENT(wbc_writepage);
 TRACE_EVENT(writeback_queue_io,
        TP_PROTO(struct bdi_writeback *wb,
                 struct wb_writeback_work *work,
+                unsigned long dirtied_before,
                 int moved),
-       TP_ARGS(wb, work, moved),
+       TP_ARGS(wb, work, dirtied_before, moved),
        TP_STRUCT__entry(
                __array(char,           name, 32)
                __field(unsigned long,  older)
@@ -509,19 +509,17 @@ TRACE_EVENT(writeback_queue_io,
                __field(ino_t,          cgroup_ino)
        ),
        TP_fast_assign(
-               unsigned long *older_than_this = work->older_than_this;
                strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32);
-               __entry->older  = older_than_this ?  *older_than_this : 0;
-               __entry->age    = older_than_this ?
-                                 (jiffies - *older_than_this) * 1000 / HZ : -1;
+               __entry->older  = dirtied_before;
+               __entry->age    = (jiffies - dirtied_before) * 1000 / HZ;
                __entry->moved  = moved;
                __entry->reason = work->reason;
                __entry->cgroup_ino     = __trace_wb_assign_cgroup(wb);
        ),
        TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%lu",
                __entry->name,
-               __entry->older, /* older_than_this in jiffies */
-               __entry->age,   /* older_than_this in relative milliseconds */
+               __entry->older, /* dirtied_before in jiffies */
+               __entry->age,   /* dirtied_before in relative milliseconds */
                __entry->moved,
                __print_symbolic(__entry->reason, WB_WORK_REASON),
                (unsigned long)__entry->cgroup_ino
index 0480f89..b6238b2 100644 (file)
@@ -767,7 +767,7 @@ union bpf_attr {
  *
  *             Also, note that **bpf_trace_printk**\ () is slow, and should
  *             only be used for debugging purposes. For this reason, a notice
- *             bloc (spanning several lines) is printed to kernel logs and
+ *             block (spanning several lines) is printed to kernel logs and
  *             states that the helper should not be used "for production use"
  *             the first time this helper is used (or more precisely, when
  *             **trace_printk**\ () buffers are allocated). For passing values
@@ -1033,14 +1033,14 @@ union bpf_attr {
  *
  *                     int ret;
  *                     struct bpf_tunnel_key key = {};
- *                     
+ *
  *                     ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
  *                     if (ret < 0)
  *                             return TC_ACT_SHOT;     // drop packet
- *                     
+ *
  *                     if (key.remote_ipv4 != 0x0a000001)
  *                             return TC_ACT_SHOT;     // drop packet
- *                     
+ *
  *                     return TC_ACT_OK;               // accept packet
  *
  *             This interface can also be used with all encapsulation devices
@@ -1147,7 +1147,7 @@ union bpf_attr {
  *     Description
  *             Retrieve the realm or the route, that is to say the
  *             **tclassid** field of the destination for the *skb*. The
- *             indentifier retrieved is a user-provided tag, similar to the
+ *             identifier retrieved is a user-provided tag, similar to the
  *             one used with the net_cls cgroup (see description for
  *             **bpf_get_cgroup_classid**\ () helper), but here this tag is
  *             held by a route (a destination entry), not by a task.
index d7f6af5..39df751 100644 (file)
@@ -76,7 +76,11 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn)
 #define bfn_to_local_pfn(bfn)  bfn_to_pfn(bfn)
 
 /* VIRT <-> GUEST conversion */
-#define virt_to_gfn(v)         (pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT))
+#define virt_to_gfn(v)                                                         \
+       ({                                                                     \
+               WARN_ON_ONCE(!virt_addr_valid(v));                              \
+               pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT);                 \
+       })
 #define gfn_to_virt(m)         (__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT))
 
 /* Only used in PV code. But ARM guests are always HVM. */
index 8c0244e..f6c30a8 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1691,7 +1691,7 @@ static long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg, int v
        case IPC_SET:
                if (copy_semid_from_user(&semid64, p, version))
                        return -EFAULT;
-               /* fall through */
+               fallthrough;
        case IPC_RMID:
                return semctl_down(ns, semid, cmd, &semid64);
        default:
@@ -1805,7 +1805,7 @@ static long compat_ksys_semctl(int semid, int semnum, int cmd, int arg, int vers
        case IPC_SET:
                if (copy_compat_semid_from_user(&semid64, p, version))
                        return -EFAULT;
-               /* fallthru */
+               fallthrough;
        case IPC_RMID:
                return semctl_down(ns, semid, cmd, &semid64);
        default:
index f1ed36e..e25c7c6 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1179,7 +1179,7 @@ static long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf, int ver
        case IPC_SET:
                if (copy_shmid_from_user(&sem64, buf, version))
                        return -EFAULT;
-               /* fallthru */
+               fallthrough;
        case IPC_RMID:
                return shmctl_down(ns, shmid, cmd, &sem64);
        case SHM_LOCK:
@@ -1374,7 +1374,7 @@ static long compat_ksys_shmctl(int shmid, int cmd, void __user *uptr, int versio
        case IPC_SET:
                if (copy_compat_shmid_from_user(&sem64, uptr, version))
                        return -EFAULT;
-               /* fallthru */
+               fallthrough;
        case IPC_RMID:
                return shmctl_down(ns, shmid, cmd, &sem64);
        case SHM_LOCK:
index a10e299..333b3bc 100644 (file)
@@ -681,7 +681,7 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule)
                                data->values[i] = AUDIT_UID_UNSET;
                                break;
                        }
-                       /* fall through - if set */
+                       fallthrough;    /* if set */
                default:
                        data->values[i] = f->val;
                }
index b671596..8faa2ce 100644 (file)
@@ -67,6 +67,9 @@ static void bpf_iter_done_stop(struct seq_file *seq)
        iter_priv->done_stop = true;
 }
 
+/* maximum visited objects before bailing out */
+#define MAX_ITER_OBJECTS       1000000
+
 /* bpf_seq_read, a customized and simpler version for bpf iterator.
  * no_llseek is assumed for this file.
  * The following are differences from seq_read():
@@ -79,7 +82,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size,
 {
        struct seq_file *seq = file->private_data;
        size_t n, offs, copied = 0;
-       int err = 0;
+       int err = 0, num_objs = 0;
        void *p;
 
        mutex_lock(&seq->lock);
@@ -135,6 +138,7 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size,
        while (1) {
                loff_t pos = seq->index;
 
+               num_objs++;
                offs = seq->count;
                p = seq->op->next(seq, p, &seq->index);
                if (pos == seq->index) {
@@ -153,6 +157,15 @@ static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size,
                if (seq->count >= size)
                        break;
 
+               if (num_objs >= MAX_ITER_OBJECTS) {
+                       if (offs == 0) {
+                               err = -EAGAIN;
+                               seq->op->stop(seq, p);
+                               goto done;
+                       }
+                       break;
+               }
+
                err = seq->op->show(seq, p);
                if (err > 0) {
                        bpf_iter_dec_seq_num(seq);
index 83ff127..e21de4f 100644 (file)
@@ -1794,7 +1794,7 @@ static bool cg_sockopt_is_valid_access(int off, int size,
                        return prog->expected_attach_type ==
                                BPF_CGROUP_GETSOCKOPT;
                case offsetof(struct bpf_sockopt, optname):
-                       /* fallthrough */
+                       fallthrough;
                case offsetof(struct bpf_sockopt, level):
                        if (size != size_default)
                                return false;
index f1c4652..6386b7b 100644 (file)
@@ -279,7 +279,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
                        break;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fallthrough */
+                       fallthrough;
                case XDP_DROP:
                        xdp_return_frame(xdpf);
                        stats->drop++;
index 4fd830a..cfed0ac 100644 (file)
@@ -213,11 +213,13 @@ static int stack_map_get_build_id_32(void *page_addr,
 
        phdr = (Elf32_Phdr *)(page_addr + sizeof(Elf32_Ehdr));
 
-       for (i = 0; i < ehdr->e_phnum; ++i)
-               if (phdr[i].p_type == PT_NOTE)
-                       return stack_map_parse_build_id(page_addr, build_id,
-                                       page_addr + phdr[i].p_offset,
-                                       phdr[i].p_filesz);
+       for (i = 0; i < ehdr->e_phnum; ++i) {
+               if (phdr[i].p_type == PT_NOTE &&
+                   !stack_map_parse_build_id(page_addr, build_id,
+                                             page_addr + phdr[i].p_offset,
+                                             phdr[i].p_filesz))
+                       return 0;
+       }
        return -EINVAL;
 }
 
@@ -236,11 +238,13 @@ static int stack_map_get_build_id_64(void *page_addr,
 
        phdr = (Elf64_Phdr *)(page_addr + sizeof(Elf64_Ehdr));
 
-       for (i = 0; i < ehdr->e_phnum; ++i)
-               if (phdr[i].p_type == PT_NOTE)
-                       return stack_map_parse_build_id(page_addr, build_id,
-                                       page_addr + phdr[i].p_offset,
-                                       phdr[i].p_filesz);
+       for (i = 0; i < ehdr->e_phnum; ++i) {
+               if (phdr[i].p_type == PT_NOTE &&
+                   !stack_map_parse_build_id(page_addr, build_id,
+                                             page_addr + phdr[i].p_offset,
+                                             phdr[i].p_filesz))
+                       return 0;
+       }
        return -EINVAL;
 }
 
index 86299a2..1bf960a 100644 (file)
@@ -2029,7 +2029,7 @@ bpf_prog_load_check_attach(enum bpf_prog_type prog_type,
        case BPF_PROG_TYPE_EXT:
                if (expected_attach_type)
                        return -EINVAL;
-               /* fallthrough */
+               fallthrough;
        default:
                return 0;
        }
index 232df29..99af4ce 100644 (file)
@@ -29,8 +29,9 @@ static struct task_struct *task_seq_get_next(struct pid_namespace *ns,
 
        rcu_read_lock();
 retry:
-       pid = idr_get_next(&ns->idr, tid);
+       pid = find_ge_pid(*tid, ns);
        if (pid) {
+               *tid = pid_nr_ns(pid, ns);
                task = get_pid_task(pid, PIDTYPE_PID);
                if (!task) {
                        ++*tid;
@@ -178,10 +179,11 @@ again:
                f = fcheck_files(curr_files, curr_fd);
                if (!f)
                        continue;
+               if (!get_file_rcu(f))
+                       continue;
 
                /* set info->fd */
                info->fd = curr_fd;
-               get_file(f);
                rcu_read_unlock();
                return f;
        }
index ef938f1..47e74f0 100644 (file)
@@ -5236,7 +5236,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
                                off_reg == dst_reg ? dst : src);
                        return -EACCES;
                }
-               /* fall-through */
+               fallthrough;
        default:
                break;
        }
@@ -10988,7 +10988,7 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
        default:
                if (!prog_extension)
                        return -EINVAL;
-               /* fallthrough */
+               fallthrough;
        case BPF_MODIFY_RETURN:
        case BPF_LSM_MAC:
        case BPF_TRACE_FENTRY:
index 1444f39..7c59b09 100644 (file)
@@ -93,7 +93,7 @@ static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy)
                break;
        case _LINUX_CAPABILITY_VERSION_2:
                warn_deprecated_v2();
-               /* fall through - v3 is otherwise equivalent to v2. */
+               fallthrough;    /* v3 is otherwise equivalent to v2 */
        case _LINUX_CAPABILITY_VERSION_3:
                *tocopy = _LINUX_CAPABILITY_U32S_3;
                break;
index b8d2800..05adfd6 100644 (file)
@@ -255,11 +255,11 @@ get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat)
                return -EFAULT;
        switch (_NSIG_WORDS) {
        case 4: set->sig[3] = v.sig[6] | (((long)v.sig[7]) << 32 );
-               /* fall through */
+               fallthrough;
        case 3: set->sig[2] = v.sig[4] | (((long)v.sig[5]) << 32 );
-               /* fall through */
+               fallthrough;
        case 2: set->sig[1] = v.sig[2] | (((long)v.sig[3]) << 32 );
-               /* fall through */
+               fallthrough;
        case 1: set->sig[0] = v.sig[0] | (((long)v.sig[1]) << 32 );
        }
 #else
index a790026..cc3c43d 100644 (file)
@@ -1046,14 +1046,14 @@ int gdb_serial_stub(struct kgdb_state *ks)
                                return DBG_PASS_EVENT;
                        }
 #endif
-                       /* Fall through */
+                       fallthrough;
                case 'C': /* Exception passing */
                        tmp = gdb_cmd_exception_pass(ks);
                        if (tmp > 0)
                                goto default_handle;
                        if (tmp == 0)
                                break;
-                       /* Fall through - on tmp < 0 */
+                       fallthrough;    /* on tmp < 0 */
                case 'c': /* Continue packet */
                case 's': /* Single step packet */
                        if (kgdb_contthread && kgdb_contthread != current) {
@@ -1062,7 +1062,7 @@ int gdb_serial_stub(struct kgdb_state *ks)
                                break;
                        }
                        dbg_activate_sw_breakpoints();
-                       /* Fall through - to default processing */
+                       fallthrough;    /* to default processing */
                default:
 default_handle:
                        error = kgdb_arch_handle_exception(ks->ex_vector,
index 750497b..f877a0a 100644 (file)
@@ -173,11 +173,11 @@ int kdb_get_kbd_char(void)
        case KT_LATIN:
                if (isprint(keychar))
                        break;          /* printable characters */
-               /* fall through */
+               fallthrough;
        case KT_SPEC:
                if (keychar == K_ENTER)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return -1;      /* ignore unprintables */
        }
index 004c5b6..6226502 100644 (file)
@@ -432,7 +432,7 @@ int kdb_getphysword(unsigned long *word, unsigned long addr, size_t size)
                                *word = w8;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                diag = KDB_BADWIDTH;
                kdb_printf("kdb_getphysword: bad width %ld\n", (long) size);
@@ -481,7 +481,7 @@ int kdb_getword(unsigned long *word, unsigned long addr, size_t size)
                                *word = w8;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                diag = KDB_BADWIDTH;
                kdb_printf("kdb_getword: bad width %ld\n", (long) size);
@@ -525,7 +525,7 @@ int kdb_putword(unsigned long addr, unsigned long word, size_t size)
                        diag = kdb_putarea(addr, w8);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                diag = KDB_BADWIDTH;
                kdb_printf("kdb_putword: bad width %ld\n", (long) size);
index bb0041e..db6ef07 100644 (file)
@@ -43,7 +43,7 @@ u64 dma_direct_get_required_mask(struct device *dev)
        return (1ULL << (fls64(max_dma) - 1)) * 2 - 1;
 }
 
-gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
+static gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
                                  u64 *phys_limit)
 {
        u64 dma_limit = min_not_zero(dma_mask, dev->bus_dma_limit);
@@ -68,7 +68,7 @@ gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
        return 0;
 }
 
-bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size)
+static bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size)
 {
        return phys_to_dma_direct(dev, phys) + size - 1 <=
                        min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit);
@@ -161,8 +161,13 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,
        size = PAGE_ALIGN(size);
 
        if (dma_should_alloc_from_pool(dev, gfp, attrs)) {
-               ret = dma_alloc_from_pool(dev, size, &page, gfp);
-               if (!ret)
+               u64 phys_mask;
+
+               gfp |= dma_direct_optimal_gfp_mask(dev, dev->coherent_dma_mask,
+                               &phys_mask);
+               page = dma_alloc_from_pool(dev, size, &ret, gfp,
+                               dma_coherent_ok);
+               if (!page)
                        return NULL;
                goto done;
        }
index 6bc74a2..1281c0f 100644 (file)
@@ -3,7 +3,9 @@
  * Copyright (C) 2012 ARM Ltd.
  * Copyright (C) 2020 Google LLC
  */
+#include <linux/cma.h>
 #include <linux/debugfs.h>
+#include <linux/dma-contiguous.h>
 #include <linux/dma-direct.h>
 #include <linux/dma-noncoherent.h>
 #include <linux/init.h>
@@ -55,11 +57,34 @@ static void dma_atomic_pool_size_add(gfp_t gfp, size_t size)
                pool_size_kernel += size;
 }
 
+static bool cma_in_zone(gfp_t gfp)
+{
+       unsigned long size;
+       phys_addr_t end;
+       struct cma *cma;
+
+       cma = dev_get_cma_area(NULL);
+       if (!cma)
+               return false;
+
+       size = cma_get_size(cma);
+       if (!size)
+               return false;
+
+       /* CMA can't cross zone boundaries, see cma_activate_area() */
+       end = cma_get_base(cma) + size - 1;
+       if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA))
+               return end <= DMA_BIT_MASK(zone_dma_bits);
+       if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32))
+               return end <= DMA_BIT_MASK(32);
+       return true;
+}
+
 static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
                              gfp_t gfp)
 {
        unsigned int order;
-       struct page *page;
+       struct page *page = NULL;
        void *addr;
        int ret = -ENOMEM;
 
@@ -68,7 +93,11 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
 
        do {
                pool_size = 1 << (PAGE_SHIFT + order);
-               page = alloc_pages(gfp, order);
+               if (cma_in_zone(gfp))
+                       page = dma_alloc_from_contiguous(NULL, 1 << order,
+                                                        order, false);
+               if (!page)
+                       page = alloc_pages(gfp, order);
        } while (!page && order-- > 0);
        if (!page)
                goto out;
@@ -196,93 +225,75 @@ static int __init dma_atomic_pool_init(void)
 }
 postcore_initcall(dma_atomic_pool_init);
 
-static inline struct gen_pool *dma_guess_pool_from_device(struct device *dev)
+static inline struct gen_pool *dma_guess_pool(struct gen_pool *prev, gfp_t gfp)
 {
-       u64 phys_mask;
-       gfp_t gfp;
-
-       gfp = dma_direct_optimal_gfp_mask(dev, dev->coherent_dma_mask,
-                                         &phys_mask);
-       if (IS_ENABLED(CONFIG_ZONE_DMA) && gfp == GFP_DMA)
+       if (prev == NULL) {
+               if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32))
+                       return atomic_pool_dma32;
+               if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA))
+                       return atomic_pool_dma;
+               return atomic_pool_kernel;
+       }
+       if (prev == atomic_pool_kernel)
+               return atomic_pool_dma32 ? atomic_pool_dma32 : atomic_pool_dma;
+       if (prev == atomic_pool_dma32)
                return atomic_pool_dma;
-       if (IS_ENABLED(CONFIG_ZONE_DMA32) && gfp == GFP_DMA32)
-               return atomic_pool_dma32;
-       return atomic_pool_kernel;
+       return NULL;
 }
 
-static inline struct gen_pool *dma_get_safer_pool(struct gen_pool *bad_pool)
+static struct page *__dma_alloc_from_pool(struct device *dev, size_t size,
+               struct gen_pool *pool, void **cpu_addr,
+               bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t))
 {
-       if (bad_pool == atomic_pool_kernel)
-               return atomic_pool_dma32 ? : atomic_pool_dma;
+       unsigned long addr;
+       phys_addr_t phys;
 
-       if (bad_pool == atomic_pool_dma32)
-               return atomic_pool_dma;
+       addr = gen_pool_alloc(pool, size);
+       if (!addr)
+               return NULL;
 
-       return NULL;
-}
+       phys = gen_pool_virt_to_phys(pool, addr);
+       if (phys_addr_ok && !phys_addr_ok(dev, phys, size)) {
+               gen_pool_free(pool, addr, size);
+               return NULL;
+       }
 
-static inline struct gen_pool *dma_guess_pool(struct device *dev,
-                                             struct gen_pool *bad_pool)
-{
-       if (bad_pool)
-               return dma_get_safer_pool(bad_pool);
+       if (gen_pool_avail(pool) < atomic_pool_size)
+               schedule_work(&atomic_pool_work);
 
-       return dma_guess_pool_from_device(dev);
+       *cpu_addr = (void *)addr;
+       memset(*cpu_addr, 0, size);
+       return pfn_to_page(__phys_to_pfn(phys));
 }
 
-void *dma_alloc_from_pool(struct device *dev, size_t size,
-                         struct page **ret_page, gfp_t flags)
+struct page *dma_alloc_from_pool(struct device *dev, size_t size,
+               void **cpu_addr, gfp_t gfp,
+               bool (*phys_addr_ok)(struct device *, phys_addr_t, size_t))
 {
        struct gen_pool *pool = NULL;
-       unsigned long val = 0;
-       void *ptr = NULL;
-       phys_addr_t phys;
-
-       while (1) {
-               pool = dma_guess_pool(dev, pool);
-               if (!pool) {
-                       WARN(1, "Failed to get suitable pool for %s\n",
-                            dev_name(dev));
-                       break;
-               }
-
-               val = gen_pool_alloc(pool, size);
-               if (!val)
-                       continue;
-
-               phys = gen_pool_virt_to_phys(pool, val);
-               if (dma_coherent_ok(dev, phys, size))
-                       break;
-
-               gen_pool_free(pool, val, size);
-               val = 0;
-       }
-
-
-       if (val) {
-               *ret_page = pfn_to_page(__phys_to_pfn(phys));
-               ptr = (void *)val;
-               memset(ptr, 0, size);
+       struct page *page;
 
-               if (gen_pool_avail(pool) < atomic_pool_size)
-                       schedule_work(&atomic_pool_work);
+       while ((pool = dma_guess_pool(pool, gfp))) {
+               page = __dma_alloc_from_pool(dev, size, pool, cpu_addr,
+                                            phys_addr_ok);
+               if (page)
+                       return page;
        }
 
-       return ptr;
+       WARN(1, "Failed to get suitable pool for %s\n", dev_name(dev));
+       return NULL;
 }
 
 bool dma_free_from_pool(struct device *dev, void *start, size_t size)
 {
        struct gen_pool *pool = NULL;
 
-       while (1) {
-               pool = dma_guess_pool(dev, pool);
-               if (!pool)
-                       return false;
-
-               if (gen_pool_has_addr(pool, (unsigned long)start, size)) {
-                       gen_pool_free(pool, (unsigned long)start, size);
-                       return true;
-               }
+       while ((pool = dma_guess_pool(pool, 0))) {
+               if (!gen_pool_has_addr(pool, (unsigned long)start, size))
+                       continue;
+               gen_pool_free(pool, (unsigned long)start, size);
+               return true;
        }
+
+       return false;
 }
index 9852e0d..fcae019 100644 (file)
@@ -65,7 +65,8 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall,
 
        syscall_enter_audit(regs, syscall);
 
-       return ret ? : syscall;
+       /* The above might have changed the syscall number */
+       return ret ? : syscall_get_nr(current, regs);
 }
 
 noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
index 5bfe8e3..7ed5248 100644 (file)
@@ -10034,7 +10034,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
                case IF_SRC_KERNELADDR:
                case IF_SRC_KERNEL:
                        kernel = 1;
-                       /* fall through */
+                       fallthrough;
 
                case IF_SRC_FILEADDR:
                case IF_SRC_FILE:
index 649fd53..0e18aaf 100644 (file)
@@ -205,7 +205,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
                try_to_free_swap(old_page);
        page_vma_mapped_walk_done(&pvmw);
 
-       if (vma->vm_flags & VM_LOCKED)
+       if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page))
                munlock_vma_page(old_page);
        put_page(old_page);
 
index a8e14c8..762a928 100644 (file)
@@ -173,7 +173,7 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags
 
                        __irq_wake_thread(desc, action);
 
-                       /* Fall through - to add to randomness */
+                       fallthrough;    /* to add to randomness */
                case IRQ_HANDLED:
                        *flags |= action->flags;
                        break;
index 52ac539..5df903f 100644 (file)
@@ -271,7 +271,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
        case IRQ_SET_MASK_OK:
        case IRQ_SET_MASK_OK_DONE:
                cpumask_copy(desc->irq_common_data.affinity, mask);
-               /* fall through */
+               fallthrough;
        case IRQ_SET_MASK_OK_NOCOPY:
                irq_validate_effective_affinity(data);
                irq_set_thread_affinity(desc);
@@ -868,7 +868,7 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned long flags)
        case IRQ_SET_MASK_OK_DONE:
                irqd_clear(&desc->irq_data, IRQD_TRIGGER_MASK);
                irqd_set(&desc->irq_data, flags);
-               /* fall through */
+               fallthrough;
 
        case IRQ_SET_MASK_OK_NOCOPY:
                flags = irqd_get_trigger_type(&desc->irq_data);
index 30cc217..651a4ad 100644 (file)
@@ -380,6 +380,13 @@ int irq_matrix_alloc(struct irq_matrix *m, const struct cpumask *msk,
        unsigned int cpu, bit;
        struct cpumap *cm;
 
+       /*
+        * Not required in theory, but matrix_find_best_cpu() uses
+        * for_each_cpu() which ignores the cpumask on UP .
+        */
+       if (cpumask_empty(msk))
+               return -EINVAL;
+
        cpu = matrix_find_best_cpu(m, msk);
        if (cpu == UINT_MAX)
                return -ENOSPC;
index 95cb74f..4fb15fa 100644 (file)
@@ -684,12 +684,12 @@ bool kallsyms_show_value(const struct cred *cred)
        case 0:
                if (kallsyms_for_perf())
                        return true;
-       /* fallthrough */
+               fallthrough;
        case 1:
                if (security_capable(cred, &init_user_ns, CAP_SYSLOG,
                                     CAP_OPT_NOAUDIT) == 0)
                        return true;
-       /* fallthrough */
+               fallthrough;
        default:
                return false;
        }
index 2fad21d..54b74fa 100644 (file)
@@ -3756,7 +3756,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
 
 skip_checks:
        /* we'll do an OFF -> ON transition: */
-       this_cpu_write(hardirqs_enabled, 1);
+       __this_cpu_write(hardirqs_enabled, 1);
        trace->hardirq_enable_ip = ip;
        trace->hardirq_enable_event = ++trace->irq_events;
        debug_atomic_inc(hardirqs_on_events);
@@ -3795,7 +3795,7 @@ void noinstr lockdep_hardirqs_off(unsigned long ip)
                /*
                 * We have done an ON -> OFF transition:
                 */
-               this_cpu_write(hardirqs_enabled, 0);
+               __this_cpu_write(hardirqs_enabled, 0);
                trace->hardirq_disable_ip = ip;
                trace->hardirq_disable_event = ++trace->irq_events;
                debug_atomic_inc(hardirqs_off_events);
@@ -4977,6 +4977,8 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 {
        unsigned long flags;
 
+       trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
+
        if (unlikely(current->lockdep_recursion)) {
                /* XXX allow trylock from NMI ?!? */
                if (lockdep_nmi() && !trylock) {
@@ -5001,7 +5003,6 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
        check_flags(flags);
 
        current->lockdep_recursion++;
-       trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
        __lock_acquire(lock, subclass, trylock, read, check,
                       irqs_disabled_flags(flags), nest_lock, ip, 0, 0);
        lockdep_recursion_finish();
@@ -5013,13 +5014,15 @@ void lock_release(struct lockdep_map *lock, unsigned long ip)
 {
        unsigned long flags;
 
+       trace_lock_release(lock, ip);
+
        if (unlikely(current->lockdep_recursion))
                return;
 
        raw_local_irq_save(flags);
        check_flags(flags);
+
        current->lockdep_recursion++;
-       trace_lock_release(lock, ip);
        if (__lock_release(lock, ip))
                check_chain_key(current);
        lockdep_recursion_finish();
@@ -5205,8 +5208,6 @@ __lock_acquired(struct lockdep_map *lock, unsigned long ip)
                hlock->holdtime_stamp = now;
        }
 
-       trace_lock_acquired(lock, ip);
-
        stats = get_lock_stats(hlock_class(hlock));
        if (waittime) {
                if (hlock->read)
@@ -5225,6 +5226,8 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
 {
        unsigned long flags;
 
+       trace_lock_acquired(lock, ip);
+
        if (unlikely(!lock_stat || !debug_locks))
                return;
 
@@ -5234,7 +5237,6 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
        raw_local_irq_save(flags);
        check_flags(flags);
        current->lockdep_recursion++;
-       trace_lock_contended(lock, ip);
        __lock_contended(lock, ip);
        lockdep_recursion_finish();
        raw_local_irq_restore(flags);
@@ -5245,6 +5247,8 @@ void lock_acquired(struct lockdep_map *lock, unsigned long ip)
 {
        unsigned long flags;
 
+       trace_lock_contended(lock, ip);
+
        if (unlikely(!lock_stat || !debug_locks))
                return;
 
index f33769f..e7aa57f 100644 (file)
@@ -659,7 +659,7 @@ static void power_down(void)
                break;
        case HIBERNATION_PLATFORM:
                hibernation_platform_enter();
-               /* Fall through */
+               fallthrough;
        case HIBERNATION_SHUTDOWN:
                if (pm_power_off)
                        kernel_power_off();
index db0bed2..ec7e1e8 100644 (file)
@@ -119,7 +119,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
                 * and add, then see if the aggregate has changed.
                 */
                plist_del(node, &c->list);
-               /* fall through */
+               fallthrough;
        case PM_QOS_ADD_REQ:
                plist_node_init(node, new_value);
                plist_add(node, &c->list);
@@ -188,7 +188,7 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
                break;
        case PM_QOS_UPDATE_REQ:
                pm_qos_flags_remove_req(pqf, req);
-               /* fall through */
+               fallthrough;
        case PM_QOS_ADD_REQ:
                req->flags = val;
                INIT_LIST_HEAD(&req->node);
index 72fe443..fb4e0c5 100644 (file)
@@ -197,6 +197,7 @@ free_buf:
 static void relay_destroy_channel(struct kref *kref)
 {
        struct rchan *chan = container_of(kref, struct rchan, kref);
+       free_percpu(chan->buf);
        kfree(chan);
 }
 
index 8471a0f..2d95dc3 100644 (file)
@@ -2320,7 +2320,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
                                state = possible;
                                break;
                        }
-                       /* Fall-through */
+                       fallthrough;
                case possible:
                        do_set_cpus_allowed(p, cpu_possible_mask);
                        state = fail;
index 6bf3498..f324dc3 100644 (file)
@@ -54,17 +54,18 @@ __setup("hlt", cpu_idle_nopoll_setup);
 
 static noinline int __cpuidle cpu_idle_poll(void)
 {
+       trace_cpu_idle(0, smp_processor_id());
+       stop_critical_timings();
        rcu_idle_enter();
-       trace_cpu_idle_rcuidle(0, smp_processor_id());
        local_irq_enable();
-       stop_critical_timings();
 
        while (!tif_need_resched() &&
-               (cpu_idle_force_poll || tick_check_broadcast_expired()))
+              (cpu_idle_force_poll || tick_check_broadcast_expired()))
                cpu_relax();
-       start_critical_timings();
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
+
        rcu_idle_exit();
+       start_critical_timings();
+       trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
 
        return 1;
 }
@@ -90,9 +91,14 @@ void __cpuidle default_idle_call(void)
        if (current_clr_polling_and_test()) {
                local_irq_enable();
        } else {
+
+               trace_cpu_idle(1, smp_processor_id());
                stop_critical_timings();
+               rcu_idle_enter();
                arch_cpu_idle();
+               rcu_idle_exit();
                start_critical_timings();
+               trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
        }
 }
 
@@ -158,7 +164,6 @@ static void cpuidle_idle_call(void)
 
        if (cpuidle_not_available(drv, dev)) {
                tick_nohz_idle_stop_tick();
-               rcu_idle_enter();
 
                default_idle_call();
                goto exit_idle;
@@ -178,21 +183,17 @@ static void cpuidle_idle_call(void)
                u64 max_latency_ns;
 
                if (idle_should_enter_s2idle()) {
-                       rcu_idle_enter();
 
                        entered_state = call_cpuidle_s2idle(drv, dev);
                        if (entered_state > 0)
                                goto exit_idle;
 
-                       rcu_idle_exit();
-
                        max_latency_ns = U64_MAX;
                } else {
                        max_latency_ns = dev->forced_idle_latency_limit_ns;
                }
 
                tick_nohz_idle_stop_tick();
-               rcu_idle_enter();
 
                next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns);
                call_cpuidle(drv, dev, next_state);
@@ -209,8 +210,6 @@ static void cpuidle_idle_call(void)
                else
                        tick_nohz_idle_retain_tick();
 
-               rcu_idle_enter();
-
                entered_state = call_cpuidle(drv, dev, next_state);
                /*
                 * Give the governor an opportunity to reflect on the outcome
@@ -226,8 +225,6 @@ exit_idle:
         */
        if (WARN_ON_ONCE(irqs_disabled()))
                local_irq_enable();
-
-       rcu_idle_exit();
 }
 
 /*
index 007b0a6..1bd7e3a 100644 (file)
@@ -1219,13 +1219,13 @@ static void __free_domain_allocs(struct s_data *d, enum s_alloc what,
        case sa_rootdomain:
                if (!atomic_read(&d->rd->refcount))
                        free_rootdomain(&d->rd->rcu);
-               /* Fall through */
+               fallthrough;
        case sa_sd:
                free_percpu(d->sd);
-               /* Fall through */
+               fallthrough;
        case sa_sd_storage:
                __sdt_free(cpu_map);
-               /* Fall through */
+               fallthrough;
        case sa_none:
                break;
        }
index 42b67d2..a38b3ed 100644 (file)
@@ -851,7 +851,7 @@ static int check_kill_permission(int sig, struct kernel_siginfo *info,
                         */
                        if (!sid || sid == task_session(current))
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EPERM;
                }
index ca11af9..ab6c409 100644 (file)
@@ -1753,7 +1753,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
 
                if (who == RUSAGE_CHILDREN)
                        break;
-               /* fall through */
+               fallthrough;
 
        case RUSAGE_SELF:
                thread_group_cputime_adjusted(p, &tgutime, &tgstime);
index c403851..95b6a70 100644 (file)
@@ -377,7 +377,7 @@ static bool hrtimer_fixup_activate(void *addr, enum debug_obj_state state)
        switch (state) {
        case ODEBUG_STATE_ACTIVE:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 07709ac..bf540f5 100644 (file)
@@ -439,12 +439,12 @@ static struct pid *good_sigevent(sigevent_t * event)
                rtn = pid_task(pid, PIDTYPE_PID);
                if (!rtn || !same_thread_group(rtn, current))
                        return NULL;
-               /* FALLTHRU */
+               fallthrough;
        case SIGEV_SIGNAL:
        case SIGEV_THREAD:
                if (event->sigev_signo <= 0 || event->sigev_signo > SIGRTMAX)
                        return NULL;
-               /* FALLTHRU */
+               fallthrough;
        case SIGEV_NONE:
                return pid;
        default:
index e51778c..36d7464 100644 (file)
@@ -381,7 +381,7 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
        switch (mode) {
        case TICK_BROADCAST_FORCE:
                tick_broadcast_forced = 1;
-               /* fall through */
+               fallthrough;
        case TICK_BROADCAST_ON:
                cpumask_set_cpu(cpu, tick_broadcast_on);
                if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) {
index a16764b..a50364d 100644 (file)
@@ -666,7 +666,7 @@ static bool timer_fixup_activate(void *addr, enum debug_obj_state state)
 
        case ODEBUG_STATE_ACTIVE:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 7ba62d6..4b3a42f 100644 (file)
@@ -745,7 +745,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
 #endif
        case BLKTRACESTART:
                start = 1;
-               /* fall through */
+               fallthrough;
        case BLKTRACESTOP:
                ret = __blk_trace_startstop(q, start);
                break;
index bf44f6b..78a678e 100644 (file)
@@ -499,7 +499,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
                                        ptr++;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                parse_error(pe, FILT_ERR_TOO_MANY_PREDS,
                                            next - str);
@@ -1273,7 +1273,7 @@ static int parse_pred(const char *str, void *data,
                switch (op) {
                case OP_NE:
                        pred->not = 1;
-                       /* Fall through */
+                       fallthrough;
                case OP_GLOB:
                case OP_EQ:
                        break;
index f74020f..0ef8f65 100644 (file)
@@ -393,6 +393,7 @@ static void free_watch(struct rcu_head *rcu)
        struct watch *watch = container_of(rcu, struct watch, rcu);
 
        put_watch_queue(rcu_access_pointer(watch->queue));
+       atomic_dec(&watch->cred->user->nr_watches);
        put_cred(watch->cred);
 }
 
@@ -452,6 +453,13 @@ int add_watch_to_object(struct watch *watch, struct watch_list *wlist)
        watch->cred = get_current_cred();
        rcu_assign_pointer(watch->watch_list, wlist);
 
+       if (atomic_inc_return(&watch->cred->user->nr_watches) >
+           task_rlimit(current, RLIMIT_NOFILE)) {
+               atomic_dec(&watch->cred->user->nr_watches);
+               put_cred(watch->cred);
+               return -EAGAIN;
+       }
+
        spin_lock_bh(&wqueue->lock);
        kref_get(&wqueue->usage);
        kref_get(&watch->usage);
index e290fc5..a4a4c68 100644 (file)
@@ -15,11 +15,16 @@ KCOV_INSTRUMENT_debugobjects.o := n
 KCOV_INSTRUMENT_dynamic_debug.o := n
 KCOV_INSTRUMENT_fault-inject.o := n
 
+# string.o implements standard library functions like memset/memcpy etc.
+# Use -ffreestanding to ensure that the compiler does not try to "optimize"
+# them into calls to themselves.
+CFLAGS_string.o := -ffreestanding
+
 # Early boot use of cmdline, don't instrument it
 ifdef CONFIG_AMD_MEM_ENCRYPT
 KASAN_SANITIZE_string.o := n
 
-CFLAGS_string.o := -fno-stack-protector
+CFLAGS_string.o += -fno-stack-protector
 endif
 
 # Used by KCSAN while enabled, avoid recursion.
index a5f7011..2c905a9 100644 (file)
@@ -817,7 +817,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
                                                        q - 2);
                                break;
                        }
-                       /* Fall through */
+                       /* fall through */
                case '=':
                        ret = xbc_parse_kv(&p, q, c);
                        break;
index 0ba3ea8..52e3ed7 100644 (file)
@@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
                        break;
                case '\\':
                        d = *pat++;
-                       /*FALLTHROUGH*/
+                       /* fall through */
                default:        /* Literal character */
 literal:
                        if (c == d) {
index c155769..afb9521 100644 (file)
@@ -1681,7 +1681,8 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 
        switch (*(++fmt)) {
        case 'L':
-               uc = true;              /* fall-through */
+               uc = true;
+               /* fall through */
        case 'l':
                index = guid_index;
                break;
@@ -2218,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
        case 'S':
        case 's':
                ptr = dereference_symbol_descriptor(ptr);
-               /* Fallthrough */
+               /* fall through */
        case 'B':
                return symbol_string(buf, end, ptr, spec, fmt);
        case 'R':
@@ -2467,7 +2468,7 @@ qualifier:
                 * utility, treat it as any other invalid or
                 * unsupported format specifier.
                 */
-               /* Fall-through */
+               /* fall through */
 
        default:
                WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
index 9f336bc..65a1aad 100644 (file)
@@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 
                        s->lzma2.sequence = SEQ_LZMA_PREPARE;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_LZMA_PREPARE:
                        if (s->lzma2.compressed < RC_INIT_BYTES)
@@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
                        s->lzma2.compressed -= RC_INIT_BYTES;
                        s->lzma2.sequence = SEQ_LZMA_RUN;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_LZMA_RUN:
                        /*
index bd1d182..32ab2a0 100644 (file)
@@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
                        if (ret != XZ_OK)
                                return ret;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_START:
                        /* We need one byte of input to continue. */
@@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
                        s->temp.pos = 0;
                        s->sequence = SEQ_BLOCK_HEADER;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_HEADER:
                        if (!fill_temp(s, b))
@@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_BLOCK_UNCOMPRESS;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_UNCOMPRESS:
                        ret = dec_block(s, b);
@@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_BLOCK_PADDING;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_PADDING:
                        /*
@@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_BLOCK_CHECK;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_CHECK:
                        if (s->check_type == XZ_CHECK_CRC32) {
@@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_INDEX_PADDING;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_INDEX_PADDING:
                        while ((s->index.size + (b->in_pos - s->in_start))
@@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_INDEX_CRC32;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_INDEX_CRC32:
                        ret = crc32_validate(s, b);
@@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
                        s->temp.size = STREAM_HEADER_SIZE;
                        s->sequence = SEQ_STREAM_FOOTER;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_STREAM_FOOTER:
                        if (!fill_temp(s, b))
index 269ee9a..db6761e 100644 (file)
@@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
                case set_repeat:
                        if (dctx->litEntropy == 0)
                                return ERROR(dictionary_corrupted);
-               /* fall-through */
+                       /* fall through */
                case set_compressed:
                        if (srcSize < 5)
                                return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
@@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                switch (zds->stage) {
                case zdss_init:
                        ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
-                                               /* fall-through */
+                       /* fall through */
 
                case zdss_loadHeader: {
                        size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
@@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                        }
                        zds->stage = zdss_read;
                }
-               /* fall through */
+                       /* fall through */
 
                case zdss_read: {
                        size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                        zds->stage = zdss_load;
                        /* pass-through */
                }
-               /* fall through */
+                       /* fall through */
 
                case zdss_load: {
                        size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                                /* pass-through */
                        }
                }
-               /* fall through */
+                       /* fall through */
 
                case zdss_flush: {
                        size_t const toFlushSize = zds->outEnd - zds->outStart;
index aabf65d..1f87aec 100644 (file)
@@ -655,7 +655,7 @@ static void __init __hugetlb_cgroup_file_dfl_init(int idx)
        snprintf(cft->name, MAX_CFTYPE_NAME, "%s.events", buf);
        cft->private = MEMFILE_PRIVATE(idx, 0);
        cft->seq_show = hugetlb_events_show;
-       cft->file_offset = offsetof(struct hugetlb_cgroup, events_file[idx]),
+       cft->file_offset = offsetof(struct hugetlb_cgroup, events_file[idx]);
        cft->flags = CFTYPE_NOT_ON_ROOT;
 
        /* Add the events.local file */
@@ -664,7 +664,7 @@ static void __init __hugetlb_cgroup_file_dfl_init(int idx)
        cft->private = MEMFILE_PRIVATE(idx, 0);
        cft->seq_show = hugetlb_events_local_show;
        cft->file_offset = offsetof(struct hugetlb_cgroup,
-                                   events_local_file[idx]),
+                                   events_local_file[idx]);
        cft->flags = CFTYPE_NOT_ON_ROOT;
 
        /* NULL terminate the last cft */
index 15a9af7..e749e56 100644 (file)
@@ -466,7 +466,7 @@ int __khugepaged_enter(struct mm_struct *mm)
                return -ENOMEM;
 
        /* __khugepaged_exit() must not run from under us */
-       VM_BUG_ON_MM(khugepaged_test_exit(mm), mm);
+       VM_BUG_ON_MM(atomic_read(&mm->mm_users) == 0, mm);
        if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) {
                free_mm_slot(mm_slot);
                return 0;
index 0aa2247..90a625b 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2453,6 +2453,10 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
                if (vma_is_dax(vma))
                        return 0;
 
+#ifdef VM_SAO
+               if (*vm_flags & VM_SAO)
+                       return 0;
+#endif
 #ifdef VM_SPARC_ADI
                if (*vm_flags & VM_SPARC_ADI)
                        return 0;
index 3a7779d..602f428 100644 (file)
@@ -4247,6 +4247,9 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf)
                                vmf->flags & FAULT_FLAG_WRITE)) {
                update_mmu_cache(vmf->vma, vmf->address, vmf->pte);
        } else {
+               /* Skip spurious TLB flush for retried page fault */
+               if (vmf->flags & FAULT_FLAG_TRIED)
+                       goto unlock;
                /*
                 * This is needed only for protection faults but the arch code
                 * is not yet telling us if this is a protection fault or not.
index 0e2bab4..fab5e97 100644 (file)
@@ -1302,6 +1302,11 @@ static void free_pcppages_bulk(struct zone *zone, int count,
        struct page *page, *tmp;
        LIST_HEAD(head);
 
+       /*
+        * Ensure proper count is passed which otherwise would stuck in the
+        * below while (list_empty(list)) loop.
+        */
+       count = min(pcp->count, count);
        while (count) {
                struct list_head *list;
 
@@ -7888,7 +7893,7 @@ int __meminit init_per_zone_wmark_min(void)
 
        return 0;
 }
-core_initcall(init_per_zone_wmark_min)
+postcore_initcall(init_per_zone_wmark_min)
 
 /*
  * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
index 2a99df7..2613371 100644 (file)
@@ -7,6 +7,7 @@
  */
 #define pr_fmt(fmt) "rodata_test: " fmt
 
+#include <linux/rodata_test.h>
 #include <linux/uaccess.h>
 #include <asm/sections.h>
 
index b482d24..be4724b 100644 (file)
@@ -104,6 +104,8 @@ static void vunmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
                if (pmd_none_or_clear_bad(pmd))
                        continue;
                vunmap_pte_range(pmd, addr, next, mask);
+
+               cond_resched();
        } while (pmd++, addr = next, addr != end);
 }
 
index 3dd7c97..ec8408d 100644 (file)
@@ -367,7 +367,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (!net_eq(dev_net(dev), &init_net))
                        break;
-               /* fall through */
+               fallthrough;
        case SIOCGMIIPHY:
        case SIOCGMIIREG:
        case SIOCSMIIREG:
index 3debad9..bc8807d 100644 (file)
@@ -520,7 +520,7 @@ static void xen_9pfs_front_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 84367b8..1cfa9bf 100644 (file)
@@ -297,7 +297,7 @@ static int adjust_tp(struct atm_trafprm *tp, unsigned char aal)
                break;
        default:
                pr_warn("AAL problems ... (%d)\n", aal);
-               /* fall through */
+               fallthrough;
        case ATM_AAL5:
                max_sdu = ATM_MAX_AAL5_PDU;
        }
@@ -417,7 +417,7 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
        case ATM_NO_AAL:
                /* ATM_AAL5 is also used in the "0 for default" case */
                vcc->qos.aal = ATM_AAL5;
-               /* fall through */
+               fallthrough;
        case ATM_AAL5:
                error = atm_init_aal5(vcc);
                vcc->stats = &dev->stats.aal5;
index 875fc0b..b570ef9 100644 (file)
@@ -380,7 +380,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
 
                if (mesg->content.normal.no_source_le_narp)
                        break;
-               /* FALL THROUGH */
+               fallthrough;
        case l_arp_update:
                lec_arp_update(priv, mesg->content.normal.mac_addr,
                               mesg->content.normal.atm_addr,
index 94bdc65..5323698 100644 (file)
@@ -266,7 +266,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                                goto done;
                        }
        }
-       /* fall through */
+               fallthrough;
        case ATM_SETESIF:
        {
                unsigned char esi[ESI_LEN];
@@ -288,7 +288,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        error = -EPERM;
                        goto done;
                }
-               /* fall through */
+               fallthrough;
        case ATM_GETSTAT:
                size = sizeof(struct atm_dev_stats);
                error = fetch_stats(dev, buf, cmd == ATM_GETSTATZ);
@@ -361,7 +361,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        error = -EINVAL;
                        goto done;
                }
-               /* fall through */
+               fallthrough;
        case ATM_SETCIRANGE:
        case SONET_GETSTATZ:
        case SONET_SETDIAG:
@@ -371,7 +371,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        error = -EPERM;
                        goto done;
                }
-               /* fall through */
+               fallthrough;
        default:
                if (IS_ENABLED(CONFIG_COMPAT) && compat) {
 #ifdef CONFIG_COMPAT
index 99eb8c6..a66f211 100644 (file)
@@ -425,7 +425,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
        case BPF_PROG_TYPE_SCHED_CLS:
        case BPF_PROG_TYPE_SCHED_ACT:
                is_l2 = true;
-               /* fall through */
+               fallthrough;
        case BPF_PROG_TYPE_LWT_IN:
        case BPF_PROG_TYPE_LWT_OUT:
        case BPF_PROG_TYPE_LWT_XMIT:
index 1641f41..ebe33b6 100644 (file)
@@ -2238,6 +2238,10 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd,
        struct ebt_table *t;
        struct net *net = sock_net(sk);
 
+       if ((cmd == EBT_SO_GET_INFO || cmd == EBT_SO_GET_INIT_INFO) &&
+           *len != sizeof(struct compat_ebt_replace))
+               return -EINVAL;
+
        if (copy_from_user(&tmp, user, sizeof(tmp)))
                return -EFAULT;
 
index 8096732..8d033a7 100644 (file)
@@ -168,6 +168,7 @@ static unsigned int nf_ct_br_defrag4(struct sk_buff *skb,
 static unsigned int nf_ct_br_defrag6(struct sk_buff *skb,
                                     const struct nf_hook_state *state)
 {
+#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
        u16 zone_id = NF_CT_DEFAULT_ZONE_ID;
        enum ip_conntrack_info ctinfo;
        struct br_input_skb_cb cb;
@@ -180,14 +181,17 @@ static unsigned int nf_ct_br_defrag6(struct sk_buff *skb,
 
        br_skb_cb_save(skb, &cb, sizeof(struct inet6_skb_parm));
 
-       err = nf_ipv6_br_defrag(state->net, skb,
-                               IP_DEFRAG_CONNTRACK_BRIDGE_IN + zone_id);
+       err = nf_ct_frag6_gather(state->net, skb,
+                                IP_DEFRAG_CONNTRACK_BRIDGE_IN + zone_id);
        /* queued */
        if (err == -EINPROGRESS)
                return NF_STOLEN;
 
        br_skb_cb_restore(skb, &cb, IP6CB(skb)->frag_max_size);
        return err == 0 ? NF_ACCEPT : NF_DROP;
+#else
+       return NF_ACCEPT;
+#endif
 }
 
 static int nf_ct_br_ip_check(const struct sk_buff *skb)
index 78ff9b3..1be4c89 100644 (file)
@@ -398,6 +398,7 @@ static int j1939_sk_init(struct sock *sk)
        spin_lock_init(&jsk->sk_session_queue_lock);
        INIT_LIST_HEAD(&jsk->sk_session_queue);
        sk->sk_destruct = j1939_sk_sock_destruct;
+       sk->sk_protocol = CAN_J1939;
 
        return 0;
 }
@@ -466,6 +467,14 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
                        goto out_release_sock;
                }
 
+               if (!ndev->ml_priv) {
+                       netdev_warn_once(ndev,
+                                        "No CAN mid layer private allocated, please fix your driver and use alloc_candev()!\n");
+                       dev_put(ndev);
+                       ret = -ENODEV;
+                       goto out_release_sock;
+               }
+
                priv = j1939_netdev_start(ndev);
                dev_put(ndev);
                if (IS_ERR(priv)) {
@@ -553,6 +562,11 @@ static int j1939_sk_connect(struct socket *sock, struct sockaddr *uaddr,
 static void j1939_sk_sock2sockaddr_can(struct sockaddr_can *addr,
                                       const struct j1939_sock *jsk, int peer)
 {
+       /* There are two holes (2 bytes and 3 bytes) to clear to avoid
+        * leaking kernel information to user space.
+        */
+       memset(addr, 0, J1939_MIN_NAMELEN);
+
        addr->can_family = AF_CAN;
        addr->can_ifindex = jsk->ifindex;
        addr->can_addr.j1939.pgn = jsk->addr.pgn;
@@ -1072,7 +1086,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv,  struct sock *sk,
                break;
        case -ERESTARTSYS:
                ret = -EINTR;
-               /* fall through */
+               fallthrough;
        case -EAGAIN: /* OK */
                if (todo_size != size)
                        ret = size - todo_size;
index 9f99af5..0cec415 100644 (file)
@@ -352,17 +352,16 @@ void j1939_session_skb_queue(struct j1939_session *session,
        skb_queue_tail(&session->skb_queue, skb);
 }
 
-static struct sk_buff *j1939_session_skb_find(struct j1939_session *session)
+static struct
+sk_buff *j1939_session_skb_find_by_offset(struct j1939_session *session,
+                                         unsigned int offset_start)
 {
        struct j1939_priv *priv = session->priv;
+       struct j1939_sk_buff_cb *do_skcb;
        struct sk_buff *skb = NULL;
        struct sk_buff *do_skb;
-       struct j1939_sk_buff_cb *do_skcb;
-       unsigned int offset_start;
        unsigned long flags;
 
-       offset_start = session->pkt.dpo * 7;
-
        spin_lock_irqsave(&session->skb_queue.lock, flags);
        skb_queue_walk(&session->skb_queue, do_skb) {
                do_skcb = j1939_skb_to_cb(do_skb);
@@ -382,6 +381,14 @@ static struct sk_buff *j1939_session_skb_find(struct j1939_session *session)
        return skb;
 }
 
+static struct sk_buff *j1939_session_skb_find(struct j1939_session *session)
+{
+       unsigned int offset_start;
+
+       offset_start = session->pkt.dpo * 7;
+       return j1939_session_skb_find_by_offset(session, offset_start);
+}
+
 /* see if we are receiver
  * returns 0 for broadcasts, although we will receive them
  */
@@ -716,10 +723,12 @@ static int j1939_session_tx_rts(struct j1939_session *session)
                return ret;
 
        session->last_txcmd = dat[0];
-       if (dat[0] == J1939_TP_CMD_BAM)
+       if (dat[0] == J1939_TP_CMD_BAM) {
                j1939_tp_schedule_txtimer(session, 50);
-
-       j1939_tp_set_rxtimeout(session, 1250);
+               j1939_tp_set_rxtimeout(session, 250);
+       } else {
+               j1939_tp_set_rxtimeout(session, 1250);
+       }
 
        netdev_dbg(session->priv->ndev, "%s: 0x%p\n", __func__, session);
 
@@ -766,7 +775,7 @@ static int j1939_session_tx_dat(struct j1939_session *session)
        int ret = 0;
        u8 dat[8];
 
-       se_skb = j1939_session_skb_find(session);
+       se_skb = j1939_session_skb_find_by_offset(session, session->pkt.tx * 7);
        if (!se_skb)
                return -ENOBUFS;
 
@@ -787,6 +796,18 @@ static int j1939_session_tx_dat(struct j1939_session *session)
                if (len > 7)
                        len = 7;
 
+               if (offset + len > se_skb->len) {
+                       netdev_err_once(priv->ndev,
+                                       "%s: 0x%p: requested data outside of queued buffer: offset %i, len %i, pkt.tx: %i\n",
+                                       __func__, session, skcb->offset, se_skb->len , session->pkt.tx);
+                       return -EOVERFLOW;
+               }
+
+               if (!len) {
+                       ret = -ENOBUFS;
+                       break;
+               }
+
                memcpy(&dat[1], &tpdat[offset], len);
                ret = j1939_tp_tx_dat(session, dat, len + 1);
                if (ret < 0) {
@@ -839,7 +860,7 @@ static int j1939_xtp_txnext_transmiter(struct j1939_session *session)
                                return ret;
                }
 
-               /* fall through */
+               fallthrough;
        case J1939_TP_CMD_CTS:
        case 0xff: /* did some data */
        case J1939_ETP_CMD_DPO:
@@ -1055,9 +1076,9 @@ static void __j1939_session_cancel(struct j1939_session *session,
        lockdep_assert_held(&session->priv->active_session_list_lock);
 
        session->err = j1939_xtp_abort_to_errno(priv, err);
+       session->state = J1939_SESSION_WAITING_ABORT;
        /* do not send aborts on incoming broadcasts */
        if (!j1939_cb_is_broadcast(&session->skcb)) {
-               session->state = J1939_SESSION_WAITING_ABORT;
                j1939_xtp_tx_abort(priv, &session->skcb,
                                   !session->transmission,
                                   err, session->skcb.addr.pgn);
@@ -1120,6 +1141,9 @@ static enum hrtimer_restart j1939_tp_txtimer(struct hrtimer *hrtimer)
                 * cleanup including propagation of the error to user space.
                 */
                break;
+       case -EOVERFLOW:
+               j1939_session_cancel(session, J1939_XTP_ABORT_ECTS_TOO_BIG);
+               break;
        case 0:
                session->tx_retry = 0;
                break;
@@ -1651,8 +1675,12 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
                        return;
                }
                session = j1939_xtp_rx_rts_session_new(priv, skb);
-               if (!session)
+               if (!session) {
+                       if (cmd == J1939_TP_CMD_BAM && j1939_sk_recv_match(priv, skcb))
+                               netdev_info(priv->ndev, "%s: failed to create TP BAM session\n",
+                                           __func__);
                        return;
+               }
        } else {
                if (j1939_xtp_rx_rts_session_active(session, skb)) {
                        j1939_session_put(session);
@@ -1661,11 +1689,15 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
        }
        session->last_cmd = cmd;
 
-       j1939_tp_set_rxtimeout(session, 1250);
-
-       if (cmd != J1939_TP_CMD_BAM && !session->transmission) {
-               j1939_session_txtimer_cancel(session);
-               j1939_tp_schedule_txtimer(session, 0);
+       if (cmd == J1939_TP_CMD_BAM) {
+               if (!session->transmission)
+                       j1939_tp_set_rxtimeout(session, 750);
+       } else {
+               if (!session->transmission) {
+                       j1939_session_txtimer_cancel(session);
+                       j1939_tp_schedule_txtimer(session, 0);
+               }
+               j1939_tp_set_rxtimeout(session, 1250);
        }
 
        j1939_session_put(session);
@@ -1716,6 +1748,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
        int offset;
        int nbytes;
        bool final = false;
+       bool remain = false;
        bool do_cts_eoma = false;
        int packet;
 
@@ -1731,12 +1764,12 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
        case J1939_ETP_CMD_DPO:
                if (skcb->addr.type == J1939_ETP)
                        break;
-               /* fall through */
-       case J1939_TP_CMD_BAM: /* fall through */
+               fallthrough;
+       case J1939_TP_CMD_BAM:
        case J1939_TP_CMD_CTS: /* fall through */
                if (skcb->addr.type != J1939_ETP)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                netdev_info(priv->ndev, "%s: 0x%p: last %02x\n", __func__,
                            session, session->last_cmd);
@@ -1750,7 +1783,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
                            __func__, session);
                goto out_session_cancel;
        }
-       se_skb = j1939_session_skb_find(session);
+
+       se_skb = j1939_session_skb_find_by_offset(session, packet * 7);
        if (!se_skb) {
                netdev_warn(priv->ndev, "%s: 0x%p: no skb found\n", __func__,
                            session);
@@ -1769,7 +1803,20 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
        }
 
        tpdat = se_skb->data;
-       memcpy(&tpdat[offset], &dat[1], nbytes);
+       if (!session->transmission) {
+               memcpy(&tpdat[offset], &dat[1], nbytes);
+       } else {
+               int err;
+
+               err = memcmp(&tpdat[offset], &dat[1], nbytes);
+               if (err)
+                       netdev_err_once(priv->ndev,
+                                       "%s: 0x%p: Data of RX-looped back packet (%*ph) doesn't match TX data (%*ph)!\n",
+                                       __func__, session,
+                                       nbytes, &dat[1],
+                                       nbytes, &tpdat[offset]);
+       }
+
        if (packet == session->pkt.rx)
                session->pkt.rx++;
 
@@ -1777,6 +1824,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
            j1939_cb_is_broadcast(&session->skcb)) {
                if (session->pkt.rx >= session->pkt.total)
                        final = true;
+               else
+                       remain = true;
        } else {
                /* never final, an EOMA must follow */
                if (session->pkt.rx >= session->pkt.last)
@@ -1784,7 +1833,11 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
        }
 
        if (final) {
+               j1939_session_timers_cancel(session);
                j1939_session_completed(session);
+       } else if (remain) {
+               if (!session->transmission)
+                       j1939_tp_set_rxtimeout(session, 750);
        } else if (do_cts_eoma) {
                j1939_tp_set_rxtimeout(session, 1250);
                if (!session->transmission)
@@ -1829,6 +1882,13 @@ static void j1939_xtp_rx_dat(struct j1939_priv *priv, struct sk_buff *skb)
                else
                        j1939_xtp_rx_dat_one(session, skb);
        }
+
+       if (j1939_cb_is_broadcast(skcb)) {
+               session = j1939_session_get_by_addr(priv, &skcb->addr, false,
+                                                   false);
+               if (session)
+                       j1939_xtp_rx_dat_one(session, skb);
+       }
 }
 
 /* j1939 main intf */
@@ -1905,8 +1965,8 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
        switch (cmd) {
        case J1939_ETP_CMD_RTS:
                extd = J1939_ETP;
-               /* fall through */
-       case J1939_TP_CMD_BAM: /* fall through */
+               fallthrough;
+       case J1939_TP_CMD_BAM:
        case J1939_TP_CMD_RTS: /* fall through */
                if (skcb->addr.type != extd)
                        return;
@@ -1920,14 +1980,14 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
                if (j1939_tp_im_transmitter(skcb))
                        j1939_xtp_rx_rts(priv, skb, true);
 
-               if (j1939_tp_im_receiver(skcb))
+               if (j1939_tp_im_receiver(skcb) || j1939_cb_is_broadcast(skcb))
                        j1939_xtp_rx_rts(priv, skb, false);
 
                break;
 
        case J1939_ETP_CMD_CTS:
                extd = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_CMD_CTS:
                if (skcb->addr.type != extd)
                        return;
@@ -1954,7 +2014,7 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
 
        case J1939_ETP_CMD_EOMA:
                extd = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_CMD_EOMA:
                if (skcb->addr.type != extd)
                        return;
@@ -1984,20 +2044,20 @@ int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb)
 {
        struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
 
-       if (!j1939_tp_im_involved_anydir(skcb))
+       if (!j1939_tp_im_involved_anydir(skcb) && !j1939_cb_is_broadcast(skcb))
                return 0;
 
        switch (skcb->addr.pgn) {
        case J1939_ETP_PGN_DAT:
                skcb->addr.type = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_PGN_DAT:
                j1939_xtp_rx_dat(priv, skb);
                break;
 
        case J1939_ETP_PGN_CTL:
                skcb->addr.type = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_PGN_CTL:
                if (skb->len < 8)
                        return 0; /* Don't care. Nothing to extract here */
@@ -2017,6 +2077,10 @@ void j1939_simple_recv(struct j1939_priv *priv, struct sk_buff *skb)
        if (!skb->sk)
                return;
 
+       if (skb->sk->sk_family != AF_CAN ||
+           skb->sk->sk_protocol != CAN_J1939)
+               return;
+
        j1939_session_list_lock(priv);
        session = j1939_session_get_simple(priv, skb);
        j1939_session_list_unlock(priv);
index 81e1e00..16a47c0 100644 (file)
@@ -50,35 +50,35 @@ unsigned int ceph_str_hash_rjenkins(const char *str, unsigned int length)
        switch (len) {
        case 11:
                c = c + ((__u32)k[10] << 24);
-               /* fall through */
+               fallthrough;
        case 10:
                c = c + ((__u32)k[9] << 16);
-               /* fall through */
+               fallthrough;
        case 9:
                c = c + ((__u32)k[8] << 8);
                /* the first byte of c is reserved for the length */
-               /* fall through */
+               fallthrough;
        case 8:
                b = b + ((__u32)k[7] << 24);
-               /* fall through */
+               fallthrough;
        case 7:
                b = b + ((__u32)k[6] << 16);
-               /* fall through */
+               fallthrough;
        case 6:
                b = b + ((__u32)k[5] << 8);
-               /* fall through */
+               fallthrough;
        case 5:
                b = b + k[4];
-               /* fall through */
+               fallthrough;
        case 4:
                a = a + ((__u32)k[3] << 24);
-               /* fall through */
+               fallthrough;
        case 3:
                a = a + ((__u32)k[2] << 16);
-               /* fall through */
+               fallthrough;
        case 2:
                a = a + ((__u32)k[1] << 8);
-               /* fall through */
+               fallthrough;
        case 1:
                a = a + k[0];
                /* case 0: nothing left to add */
index 07e5614..7057f8d 100644 (file)
@@ -987,7 +987,7 @@ int crush_do_rule(const struct crush_map *map,
                case CRUSH_RULE_CHOOSELEAF_FIRSTN:
                case CRUSH_RULE_CHOOSE_FIRSTN:
                        firstn = 1;
-                       /* fall through */
+                       fallthrough;
                case CRUSH_RULE_CHOOSELEAF_INDEP:
                case CRUSH_RULE_CHOOSE_INDEP:
                        if (wsize == 0)
index 27d6ab1..bdfd66b 100644 (file)
@@ -412,7 +412,7 @@ static void ceph_sock_state_change(struct sock *sk)
        switch (sk->sk_state) {
        case TCP_CLOSE:
                dout("%s TCP_CLOSE\n", __func__);
-               /* fall through */
+               fallthrough;
        case TCP_CLOSE_WAIT:
                dout("%s TCP_CLOSE_WAIT\n", __func__);
                con_sock_state_closing(con);
@@ -2751,7 +2751,7 @@ more:
                        switch (ret) {
                        case -EBADMSG:
                                con->error_msg = "bad crc/signature";
-                               /* fall through */
+                               fallthrough;
                        case -EBADE:
                                ret = -EIO;
                                break;
index 3d8c801..d633a0a 100644 (file)
@@ -1307,7 +1307,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
                 * request had a non-zero tid.  Work around this weirdness
                 * by allocating a new message.
                 */
-               /* fall through */
+               fallthrough;
        case CEPH_MSG_MON_MAP:
        case CEPH_MSG_MDS_MAP:
        case CEPH_MSG_OSD_MAP:
index e4fbcad..7901ab6 100644 (file)
@@ -3854,7 +3854,7 @@ static void scan_requests(struct ceph_osd *osd,
                        if (!force_resend && !force_resend_writes)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case CALC_TARGET_NEED_RESEND:
                        cancel_linger_map_check(lreq);
                        /*
@@ -3891,7 +3891,7 @@ static void scan_requests(struct ceph_osd *osd,
                             !force_resend_writes))
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case CALC_TARGET_NEED_RESEND:
                        cancel_map_check(req);
                        unlink_request(osd, req);
index 7df6c96..b9c6f31 100644 (file)
@@ -4690,10 +4690,10 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(skb->dev, xdp_prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
        do_drop:
                kfree_skb(skb);
@@ -8742,13 +8742,15 @@ struct bpf_xdp_link {
        int flags;
 };
 
-static enum bpf_xdp_mode dev_xdp_mode(u32 flags)
+static enum bpf_xdp_mode dev_xdp_mode(struct net_device *dev, u32 flags)
 {
        if (flags & XDP_FLAGS_HW_MODE)
                return XDP_MODE_HW;
        if (flags & XDP_FLAGS_DRV_MODE)
                return XDP_MODE_DRV;
-       return XDP_MODE_SKB;
+       if (flags & XDP_FLAGS_SKB_MODE)
+               return XDP_MODE_SKB;
+       return dev->netdev_ops->ndo_bpf ? XDP_MODE_DRV : XDP_MODE_SKB;
 }
 
 static bpf_op_t dev_xdp_bpf_op(struct net_device *dev, enum bpf_xdp_mode mode)
@@ -8896,7 +8898,7 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
                return -EINVAL;
        }
 
-       mode = dev_xdp_mode(flags);
+       mode = dev_xdp_mode(dev, flags);
        /* can't replace attached link */
        if (dev_xdp_link(dev, mode)) {
                NL_SET_ERR_MSG(extack, "Can't replace active BPF XDP link");
@@ -8913,10 +8915,6 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
                NL_SET_ERR_MSG(extack, "Active program does not match expected");
                return -EEXIST;
        }
-       if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) && cur_prog) {
-               NL_SET_ERR_MSG(extack, "XDP program already attached");
-               return -EBUSY;
-       }
 
        /* put effective new program into new_prog */
        if (link)
@@ -8927,6 +8925,10 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
                enum bpf_xdp_mode other_mode = mode == XDP_MODE_SKB
                                               ? XDP_MODE_DRV : XDP_MODE_SKB;
 
+               if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) && cur_prog) {
+                       NL_SET_ERR_MSG(extack, "XDP program already attached");
+                       return -EBUSY;
+               }
                if (!offload && dev_xdp_prog(dev, other_mode)) {
                        NL_SET_ERR_MSG(extack, "Native and generic XDP can't be active at the same time");
                        return -EEXIST;
@@ -8984,7 +8986,7 @@ static int dev_xdp_detach_link(struct net_device *dev,
 
        ASSERT_RTNL();
 
-       mode = dev_xdp_mode(link->flags);
+       mode = dev_xdp_mode(dev, link->flags);
        if (dev_xdp_link(dev, mode) != link)
                return -EINVAL;
 
@@ -9080,7 +9082,7 @@ static int bpf_xdp_link_update(struct bpf_link *link, struct bpf_prog *new_prog,
                goto out_unlock;
        }
 
-       mode = dev_xdp_mode(xdp_link->flags);
+       mode = dev_xdp_mode(xdp_link->dev, xdp_link->flags);
        bpf_op = dev_xdp_bpf_op(xdp_link->dev, mode);
        err = dev_xdp_install(xdp_link->dev, mode, bpf_op, NULL,
                              xdp_link->flags, new_prog);
@@ -9164,7 +9166,7 @@ out_put_dev:
 int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
                      int fd, int expected_fd, u32 flags)
 {
-       enum bpf_xdp_mode mode = dev_xdp_mode(flags);
+       enum bpf_xdp_mode mode = dev_xdp_mode(dev, flags);
        struct bpf_prog *new_prog = NULL, *old_prog = NULL;
        int err;
 
index b2cf9b7..205e92e 100644 (file)
@@ -322,7 +322,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
                err = net_hwtstamp_validate(ifr);
                if (err)
                        return err;
-               /* fall through */
+               fallthrough;
 
        /*
         *      Unknown or private ioctl
@@ -478,7 +478,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_c
        case SIOCSIFTXQLEN:
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
-               /* fall through */
+               fallthrough;
        /*
         *      These ioctl calls:
         *      - require local superuser power.
@@ -503,7 +503,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_c
        case SIOCSHWTSTAMP:
                if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
-               /* fall through */
+               fallthrough;
        case SIOCBONDSLAVEINFOQUERY:
        case SIOCBONDINFOQUERY:
                dev_load(net, ifr->ifr_name);
index e674f0f..80ec1cd 100644 (file)
@@ -4063,7 +4063,7 @@ static int __devlink_snapshot_id_insert(struct devlink *devlink, u32 id)
 {
        lockdep_assert_held(&devlink->lock);
 
-       if (WARN_ON(xa_load(&devlink->snapshot_ids, id)))
+       if (xa_load(&devlink->snapshot_ids, id))
                return -EEXIST;
 
        return xa_err(xa_store(&devlink->snapshot_ids, id, xa_mk_value(0),
@@ -6196,8 +6196,8 @@ devlink_trap_action_get_from_info(struct genl_info *info,
 
        val = nla_get_u8(info->attrs[DEVLINK_ATTR_TRAP_ACTION]);
        switch (val) {
-       case DEVLINK_TRAP_ACTION_DROP: /* fall-through */
-       case DEVLINK_TRAP_ACTION_TRAP: /* fall-through */
+       case DEVLINK_TRAP_ACTION_DROP:
+       case DEVLINK_TRAP_ACTION_TRAP:
        case DEVLINK_TRAP_ACTION_MIRROR:
                *p_trap_action = val;
                break;
index b09bebe..9704522 100644 (file)
@@ -1189,7 +1189,7 @@ static int net_dm_alert_mode_get_from_info(struct genl_info *info,
        val = nla_get_u8(info->attrs[NET_DM_ATTR_ALERT_MODE]);
 
        switch (val) {
-       case NET_DM_ALERT_MODE_SUMMARY: /* fall-through */
+       case NET_DM_ALERT_MODE_SUMMARY:
        case NET_DM_ALERT_MODE_PACKET:
                *p_alert_mode = val;
                break;
index 7124f0f..1f647ab 100644 (file)
@@ -8317,15 +8317,31 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
 /* Helper macro for adding read access to tcp_sock or sock fields. */
 #define SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ)                        \
        do {                                                                  \
+               int fullsock_reg = si->dst_reg, reg = BPF_REG_9, jmp = 2;     \
                BUILD_BUG_ON(sizeof_field(OBJ, OBJ_FIELD) >                   \
                             sizeof_field(struct bpf_sock_ops, BPF_FIELD));   \
+               if (si->dst_reg == reg || si->src_reg == reg)                 \
+                       reg--;                                                \
+               if (si->dst_reg == reg || si->src_reg == reg)                 \
+                       reg--;                                                \
+               if (si->dst_reg == si->src_reg) {                             \
+                       *insn++ = BPF_STX_MEM(BPF_DW, si->src_reg, reg,       \
+                                         offsetof(struct bpf_sock_ops_kern,  \
+                                         temp));                             \
+                       fullsock_reg = reg;                                   \
+                       jmp += 2;                                             \
+               }                                                             \
                *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(                       \
                                                struct bpf_sock_ops_kern,     \
                                                is_fullsock),                 \
-                                     si->dst_reg, si->src_reg,               \
+                                     fullsock_reg, si->src_reg,              \
                                      offsetof(struct bpf_sock_ops_kern,      \
                                               is_fullsock));                 \
-               *insn++ = BPF_JMP_IMM(BPF_JEQ, si->dst_reg, 0, 2);            \
+               *insn++ = BPF_JMP_IMM(BPF_JEQ, fullsock_reg, 0, jmp);         \
+               if (si->dst_reg == si->src_reg)                               \
+                       *insn++ = BPF_LDX_MEM(BPF_DW, reg, si->src_reg,       \
+                                     offsetof(struct bpf_sock_ops_kern,      \
+                                     temp));                                 \
                *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(                       \
                                                struct bpf_sock_ops_kern, sk),\
                                      si->dst_reg, si->src_reg,               \
@@ -8334,6 +8350,49 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
                                                       OBJ_FIELD),            \
                                      si->dst_reg, si->dst_reg,               \
                                      offsetof(OBJ, OBJ_FIELD));              \
+               if (si->dst_reg == si->src_reg) {                             \
+                       *insn++ = BPF_JMP_A(1);                               \
+                       *insn++ = BPF_LDX_MEM(BPF_DW, reg, si->src_reg,       \
+                                     offsetof(struct bpf_sock_ops_kern,      \
+                                     temp));                                 \
+               }                                                             \
+       } while (0)
+
+#define SOCK_OPS_GET_SK()                                                            \
+       do {                                                                  \
+               int fullsock_reg = si->dst_reg, reg = BPF_REG_9, jmp = 1;     \
+               if (si->dst_reg == reg || si->src_reg == reg)                 \
+                       reg--;                                                \
+               if (si->dst_reg == reg || si->src_reg == reg)                 \
+                       reg--;                                                \
+               if (si->dst_reg == si->src_reg) {                             \
+                       *insn++ = BPF_STX_MEM(BPF_DW, si->src_reg, reg,       \
+                                         offsetof(struct bpf_sock_ops_kern,  \
+                                         temp));                             \
+                       fullsock_reg = reg;                                   \
+                       jmp += 2;                                             \
+               }                                                             \
+               *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(                       \
+                                               struct bpf_sock_ops_kern,     \
+                                               is_fullsock),                 \
+                                     fullsock_reg, si->src_reg,              \
+                                     offsetof(struct bpf_sock_ops_kern,      \
+                                              is_fullsock));                 \
+               *insn++ = BPF_JMP_IMM(BPF_JEQ, fullsock_reg, 0, jmp);         \
+               if (si->dst_reg == si->src_reg)                               \
+                       *insn++ = BPF_LDX_MEM(BPF_DW, reg, si->src_reg,       \
+                                     offsetof(struct bpf_sock_ops_kern,      \
+                                     temp));                                 \
+               *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(                       \
+                                               struct bpf_sock_ops_kern, sk),\
+                                     si->dst_reg, si->src_reg,               \
+                                     offsetof(struct bpf_sock_ops_kern, sk));\
+               if (si->dst_reg == si->src_reg) {                             \
+                       *insn++ = BPF_JMP_A(1);                               \
+                       *insn++ = BPF_LDX_MEM(BPF_DW, reg, si->src_reg,       \
+                                     offsetof(struct bpf_sock_ops_kern,      \
+                                     temp));                                 \
+               }                                                             \
        } while (0)
 
 #define SOCK_OPS_GET_TCP_SOCK_FIELD(FIELD) \
@@ -8620,17 +8679,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
                SOCK_OPS_GET_TCP_SOCK_FIELD(bytes_acked);
                break;
        case offsetof(struct bpf_sock_ops, sk):
-               *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
-                                               struct bpf_sock_ops_kern,
-                                               is_fullsock),
-                                     si->dst_reg, si->src_reg,
-                                     offsetof(struct bpf_sock_ops_kern,
-                                              is_fullsock));
-               *insn++ = BPF_JMP_IMM(BPF_JEQ, si->dst_reg, 0, 1);
-               *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
-                                               struct bpf_sock_ops_kern, sk),
-                                     si->dst_reg, si->src_reg,
-                                     offsetof(struct bpf_sock_ops_kern, sk));
+               SOCK_OPS_GET_SK();
                break;
        }
        return insn - insn_buf;
@@ -9174,7 +9223,7 @@ sk_reuseport_is_valid_access(int off, int size,
        case bpf_ctx_range(struct sk_reuseport_md, eth_protocol):
                if (size < sizeof_field(struct sk_buff, protocol))
                        return false;
-               /* fall through */
+               fallthrough;
        case bpf_ctx_range(struct sk_reuseport_md, ip_protocol):
        case bpf_ctx_range(struct sk_reuseport_md, bind_inany):
        case bpf_ctx_range(struct sk_reuseport_md, len):
index b53b6d3..95f4c6b 100644 (file)
@@ -3430,7 +3430,7 @@ xmit_more:
                net_info_ratelimited("%s xmit error: %d\n",
                                     pkt_dev->odevname, ret);
                pkt_dev->errors++;
-               /* fall through */
+               fallthrough;
        case NETDEV_TX_BUSY:
                /* Retry it next time */
                refcount_dec(&(pkt_dev->skb->users));
index 7e2e502..e18184f 100644 (file)
@@ -5418,8 +5418,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
        skb = skb_share_check(skb, GFP_ATOMIC);
        if (unlikely(!skb))
                goto err_free;
-
-       if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
+       /* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */
+       if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short))))
                goto err_free;
 
        vhdr = (struct vlan_hdr *)skb->data;
@@ -5987,9 +5987,13 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,
        if (skb_has_frag_list(skb))
                skb_clone_fraglist(skb);
 
-       if (k == 0) {
-               /* split line is in frag list */
-               pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask);
+       /* split line is in frag list */
+       if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) {
+               /* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. */
+               if (skb_has_frag_list(skb))
+                       kfree_skb_list(skb_shinfo(skb)->frag_list);
+               kfree(data);
+               return -ENOMEM;
        }
        skb_release_data(skb);
 
index 6a32a1f..6495831 100644 (file)
@@ -772,7 +772,6 @@ static void sk_psock_verdict_apply(struct sk_psock *psock,
                sk_psock_skb_redirect(skb);
                break;
        case __SK_DROP:
-               /* fall-through */
        default:
 out_free:
                kfree_skb(skb);
index e4f40b1..f8e5ccc 100644 (file)
@@ -1008,7 +1008,7 @@ set_sndbuf:
                break;
        case SO_TIMESTAMPING_NEW:
                sock_set_flag(sk, SOCK_TSTAMP_NEW);
-               /* fall through */
+               fallthrough;
        case SO_TIMESTAMPING_OLD:
                if (val & ~SOF_TIMESTAMPING_MASK) {
                        ret = -EINVAL;
index aef72f6..b9ee1a4 100644 (file)
@@ -608,7 +608,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
                 */
                if (hc->rx_x_recv > 0)
                        break;
-               /* fall through */
+               fallthrough;
        case CCID3_FBACK_PERIODIC:
                delta = ktime_us_delta(now, hc->rx_tstamp_last_feedback);
                if (delta <= 0)
index afc071e..788dd62 100644 (file)
@@ -1407,7 +1407,8 @@ int dccp_feat_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
         *      Negotiation during connection setup
         */
        case DCCP_LISTEN:
-               server = true;                  /* fall through */
+               server = true;
+               fallthrough;
        case DCCP_REQUESTING:
                switch (opt) {
                case DCCPO_CHANGE_L:
index bd9cfdb..2cbb757 100644 (file)
@@ -64,7 +64,7 @@ static int dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
                 */
                if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT)
                        break;
-               /* fall through */
+               fallthrough;
        case DCCP_REQUESTING:
        case DCCP_ACTIVE_CLOSEREQ:
                dccp_send_reset(sk, DCCP_RESET_CODE_CLOSED);
@@ -76,7 +76,7 @@ static int dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
                queued = 1;
                dccp_fin(sk, skb);
                dccp_set_state(sk, DCCP_PASSIVE_CLOSE);
-               /* fall through */
+               fallthrough;
        case DCCP_PASSIVE_CLOSE:
                /*
                 * Retransmitted Close: we have already enqueued the first one.
@@ -113,7 +113,7 @@ static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
                queued = 1;
                dccp_fin(sk, skb);
                dccp_set_state(sk, DCCP_PASSIVE_CLOSEREQ);
-               /* fall through */
+               fallthrough;
        case DCCP_PASSIVE_CLOSEREQ:
                sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
        }
@@ -530,7 +530,7 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
        case DCCP_PKT_DATA:
                if (sk->sk_state == DCCP_RESPOND)
                        break;
-               /* fall through */
+               fallthrough;
        case DCCP_PKT_DATAACK:
        case DCCP_PKT_ACK:
                /*
@@ -684,7 +684,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
                /* Step 8: if using Ack Vectors, mark packet acknowledgeable */
                dccp_handle_ackvec_processing(sk, skb);
                dccp_deliver_input_to_ccids(sk, skb);
-               /* fall through */
+               fallthrough;
        case DCCP_RESPOND:
                queued = dccp_rcv_respond_partopen_state_process(sk, skb,
                                                                 dh, len);
index 51aaba7..d24cad0 100644 (file)
@@ -225,7 +225,7 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
                         * interested. The RX CCID need not parse Ack Vectors,
                         * since it is only interested in clearing old state.
                         */
-                       /* fall through */
+                       fallthrough;
                case DCCPO_MIN_TX_CCID_SPECIFIC ... DCCPO_MAX_TX_CCID_SPECIFIC:
                        if (ccid_hc_tx_parse_options(dp->dccps_hc_tx_ccid, sk,
                                                     pkt_type, opt, value, len))
index 6433187..50e6d56 100644 (file)
@@ -62,7 +62,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
                switch (dcb->dccpd_type) {
                case DCCP_PKT_DATA:
                        set_ack = 0;
-                       /* fall through */
+                       fallthrough;
                case DCCP_PKT_DATAACK:
                case DCCP_PKT_RESET:
                        break;
@@ -72,12 +72,12 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
                        /* Use ISS on the first (non-retransmitted) Request. */
                        if (icsk->icsk_retransmits == 0)
                                dcb->dccpd_seq = dp->dccps_iss;
-                       /* fall through */
+                       fallthrough;
 
                case DCCP_PKT_SYNC:
                case DCCP_PKT_SYNCACK:
                        ackno = dcb->dccpd_ack_seq;
-                       /* fall through */
+                       fallthrough;
                default:
                        /*
                         * Set owner/destructor: some skbs are allocated via
@@ -481,7 +481,7 @@ struct sk_buff *dccp_ctl_make_reset(struct sock *sk, struct sk_buff *rcv_skb)
        case DCCP_RESET_CODE_PACKET_ERROR:
                dhr->dccph_reset_data[0] = rxdh->dccph_type;
                break;
-       case DCCP_RESET_CODE_OPTION_ERROR:      /* fall through */
+       case DCCP_RESET_CODE_OPTION_ERROR:
        case DCCP_RESET_CODE_MANDATORY_ERROR:
                memcpy(dhr->dccph_reset_data, dcb->dccpd_reset_data, 3);
                break;
index d148ab1..6d705d9 100644 (file)
@@ -101,7 +101,7 @@ void dccp_set_state(struct sock *sk, const int state)
                if (inet_csk(sk)->icsk_bind_hash != NULL &&
                    !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
                        inet_put_port(sk);
-               /* fall through */
+               fallthrough;
        default:
                if (oldstate == DCCP_OPEN)
                        DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
@@ -834,7 +834,7 @@ int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
                case DCCP_PKT_CLOSEREQ:
                        if (!(flags & MSG_PEEK))
                                dccp_finish_passive_close(sk);
-                       /* fall through */
+                       fallthrough;
                case DCCP_PKT_RESET:
                        dccp_pr_debug("found fin (%s) ok!\n",
                                      dccp_packet_name(dh->dccph_type));
@@ -960,7 +960,7 @@ static void dccp_terminate_connection(struct sock *sk)
        case DCCP_PARTOPEN:
                dccp_pr_debug("Stop PARTOPEN timer (%p)\n", sk);
                inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
-               /* fall through */
+               fallthrough;
        case DCCP_OPEN:
                dccp_send_close(sk, 1);
 
@@ -969,7 +969,7 @@ static void dccp_terminate_connection(struct sock *sk)
                        next_state = DCCP_ACTIVE_CLOSEREQ;
                else
                        next_state = DCCP_CLOSING;
-               /* fall through */
+               fallthrough;
        default:
                dccp_set_state(sk, next_state);
        }
index 3b53d76..5dbd45d 100644 (file)
@@ -623,12 +623,12 @@ static void dn_destroy_sock(struct sock *sk)
                goto disc_reject;
        case DN_RUN:
                scp->state = DN_DI;
-               /* fall through */
+               fallthrough;
        case DN_DI:
        case DN_DR:
 disc_reject:
                dn_nsp_send_disc(sk, NSP_DISCINIT, 0, sk->sk_allocation);
-               /* fall through */
+               fallthrough;
        case DN_NC:
        case DN_NR:
        case DN_RJ:
@@ -642,7 +642,7 @@ disc_reject:
                break;
        default:
                printk(KERN_DEBUG "DECnet: dn_destroy_sock passed socket in invalid state\n");
-               /* fall through */
+               fallthrough;
        case DN_O:
                dn_stop_slow_timer(sk);
 
index c68503a..c97bdca 100644 (file)
@@ -483,7 +483,7 @@ static void dn_nsp_disc_conf(struct sock *sk, struct sk_buff *skb)
                break;
        case DN_RUN:
                sk->sk_shutdown |= SHUTDOWN_MASK;
-               /* fall through */
+               fallthrough;
        case DN_CC:
                scp->state = DN_CN;
        }
index 33fefb0..4086f9c 100644 (file)
@@ -156,7 +156,7 @@ static void dn_rehash_zone(struct dn_zone *dz)
        default:
                printk(KERN_DEBUG "DECnet: dn_rehash_zone: BUG! %d\n",
                       old_divisor);
-               /* fall through */
+               fallthrough;
        case 256:
                new_divisor = 1024;
                new_hashmask = 0x3FF;
index deae519..67b5ab2 100644 (file)
@@ -75,7 +75,7 @@ static void strip_it(char *str)
                case '\r':
                case ':':
                        *str = 0;
-                       /* Fallthrough */
+                       fallthrough;
                case 0:
                        return;
                }
index 41d60ee..9af1a2d 100644 (file)
@@ -2009,7 +2009,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
        switchdev_work->event = event;
 
        switch (event) {
-       case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_FDB_DEL_TO_DEVICE:
                if (dsa_slave_switchdev_fdb_work_init(switchdev_work, ptr))
                        goto err_fdb_work_init;
index 4e632dc..495635f 100644 (file)
@@ -224,7 +224,9 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
        DECLARE_BITMAP(wanted_diff_mask, NETDEV_FEATURE_COUNT);
        DECLARE_BITMAP(active_diff_mask, NETDEV_FEATURE_COUNT);
        DECLARE_BITMAP(old_active, NETDEV_FEATURE_COUNT);
+       DECLARE_BITMAP(old_wanted, NETDEV_FEATURE_COUNT);
        DECLARE_BITMAP(new_active, NETDEV_FEATURE_COUNT);
+       DECLARE_BITMAP(new_wanted, NETDEV_FEATURE_COUNT);
        DECLARE_BITMAP(req_wanted, NETDEV_FEATURE_COUNT);
        DECLARE_BITMAP(req_mask, NETDEV_FEATURE_COUNT);
        struct nlattr *tb[ETHTOOL_A_FEATURES_MAX + 1];
@@ -250,6 +252,7 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
 
        rtnl_lock();
        ethnl_features_to_bitmap(old_active, dev->features);
+       ethnl_features_to_bitmap(old_wanted, dev->wanted_features);
        ret = ethnl_parse_bitset(req_wanted, req_mask, NETDEV_FEATURE_COUNT,
                                 tb[ETHTOOL_A_FEATURES_WANTED],
                                 netdev_features_strings, info->extack);
@@ -261,17 +264,15 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
                goto out_rtnl;
        }
 
-       /* set req_wanted bits not in req_mask from old_active */
+       /* set req_wanted bits not in req_mask from old_wanted */
        bitmap_and(req_wanted, req_wanted, req_mask, NETDEV_FEATURE_COUNT);
-       bitmap_andnot(new_active, old_active, req_mask, NETDEV_FEATURE_COUNT);
-       bitmap_or(req_wanted, new_active, req_wanted, NETDEV_FEATURE_COUNT);
-       if (bitmap_equal(req_wanted, old_active, NETDEV_FEATURE_COUNT)) {
-               ret = 0;
-               goto out_rtnl;
+       bitmap_andnot(new_wanted, old_wanted, req_mask, NETDEV_FEATURE_COUNT);
+       bitmap_or(req_wanted, new_wanted, req_wanted, NETDEV_FEATURE_COUNT);
+       if (!bitmap_equal(req_wanted, old_wanted, NETDEV_FEATURE_COUNT)) {
+               dev->wanted_features &= ~dev->hw_features;
+               dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features;
+               __netdev_update_features(dev);
        }
-
-       dev->wanted_features = ethnl_bitmap_to_features(req_wanted);
-       __netdev_update_features(dev);
        ethnl_features_to_bitmap(new_active, dev->features);
        mod = !bitmap_equal(old_active, new_active, NETDEV_FEATURE_COUNT);
 
index bbe9b3b..be6f06a 100644 (file)
@@ -195,7 +195,7 @@ static int lowpan_frag_rx_handlers_result(struct sk_buff *skb,
                net_warn_ratelimited("%s: received unknown dispatch\n",
                                     __func__);
 
-               /* fall-through */
+               fallthrough;
        default:
                /* all others failure */
                return NET_RX_DROP;
index b34d050..517e649 100644 (file)
@@ -35,11 +35,11 @@ static int lowpan_rx_handlers_result(struct sk_buff *skb, lowpan_rx_result res)
                net_warn_ratelimited("%s: received unknown dispatch\n",
                                     __func__);
 
-               /* fall-through */
+               fallthrough;
        case RX_DROP_UNUSABLE:
                kfree_skb(skb);
 
-               /* fall-through */
+               fallthrough;
        case RX_DROP:
                return NET_RX_DROP;
        case RX_QUEUED:
index 60db5a6..87983e7 100644 (file)
@@ -661,13 +661,13 @@ config TCP_CONG_BBR
 
          BBR (Bottleneck Bandwidth and RTT) TCP congestion control aims to
          maximize network utilization and minimize queues. It builds an explicit
-         model of the the bottleneck delivery rate and path round-trip
-         propagation delay. It tolerates packet loss and delay unrelated to
-         congestion. It can operate over LAN, WAN, cellular, wifi, or cable
-         modem links. It can coexist with flows that use loss-based congestion
-         control, and can operate with shallow buffers, deep buffers,
-         bufferbloat, policers, or AQM schemes that do not provide a delay
-         signal. It requires the fq ("Fair Queue") pacing packet scheduler.
+         model of the bottleneck delivery rate and path round-trip propagation
+         delay. It tolerates packet loss and delay unrelated to congestion. It
+         can operate over LAN, WAN, cellular, wifi, or cable modem links. It can
+         coexist with flows that use loss-based congestion control, and can
+         operate with shallow buffers, deep buffers, bufferbloat, policers, or
+         AQM schemes that do not provide a delay signal. It requires the fq
+         ("Fair Queue") pacing packet scheduler.
 
 choice
        prompt "Default TCP congestion control"
index cc8049b..134e923 100644 (file)
@@ -446,7 +446,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[],
        unsigned int i, j;
        u8 nhg_fdb = 0;
 
-       if (len & (sizeof(struct nexthop_grp) - 1)) {
+       if (!len || len & (sizeof(struct nexthop_grp) - 1)) {
                NL_SET_ERR_MSG(extack,
                               "Invalid length for nexthop group attribute");
                return -EINVAL;
@@ -1187,6 +1187,9 @@ static struct nexthop *nexthop_create_group(struct net *net,
        struct nexthop *nh;
        int i;
 
+       if (WARN_ON(!num_nh))
+               return ERR_PTR(-EINVAL);
+
        nh = nexthop_alloc();
        if (!nh)
                return ERR_PTR(-ENOMEM);
index 8e761b8..01146b6 100644 (file)
@@ -1893,12 +1893,13 @@ EXPORT_SYMBOL(ipv6_chk_addr);
  *   2. does the address exist on the specific device
  *      (skip_dev_check = false)
  */
-int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
-                           const struct net_device *dev, bool skip_dev_check,
-                           int strict, u32 banned_flags)
+static struct net_device *
+__ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
+                         const struct net_device *dev, bool skip_dev_check,
+                         int strict, u32 banned_flags)
 {
        unsigned int hash = inet6_addr_hash(net, addr);
-       const struct net_device *l3mdev;
+       struct net_device *l3mdev, *ndev;
        struct inet6_ifaddr *ifp;
        u32 ifp_flags;
 
@@ -1909,10 +1910,11 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
                dev = NULL;
 
        hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
-               if (!net_eq(dev_net(ifp->idev->dev), net))
+               ndev = ifp->idev->dev;
+               if (!net_eq(dev_net(ndev), net))
                        continue;
 
-               if (l3mdev_master_dev_rcu(ifp->idev->dev) != l3mdev)
+               if (l3mdev_master_dev_rcu(ndev) != l3mdev)
                        continue;
 
                /* Decouple optimistic from tentative for evaluation here.
@@ -1923,15 +1925,23 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
                            : ifp->flags;
                if (ipv6_addr_equal(&ifp->addr, addr) &&
                    !(ifp_flags&banned_flags) &&
-                   (!dev || ifp->idev->dev == dev ||
+                   (!dev || ndev == dev ||
                     !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
                        rcu_read_unlock();
-                       return 1;
+                       return ndev;
                }
        }
 
        rcu_read_unlock();
-       return 0;
+       return NULL;
+}
+
+int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
+                           const struct net_device *dev, bool skip_dev_check,
+                           int strict, u32 banned_flags)
+{
+       return __ipv6_chk_addr_and_flags(net, addr, dev, skip_dev_check,
+                                        strict, banned_flags) ? 1 : 0;
 }
 EXPORT_SYMBOL(ipv6_chk_addr_and_flags);
 
@@ -1990,35 +2000,11 @@ EXPORT_SYMBOL(ipv6_chk_prefix);
  *
  * The caller should be protected by RCU, or RTNL.
  */
-struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr)
+struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr,
+                                struct net_device *dev)
 {
-       unsigned int hash = inet6_addr_hash(net, addr);
-       struct inet6_ifaddr *ifp, *result = NULL;
-       struct net_device *dev = NULL;
-
-       rcu_read_lock();
-       hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
-               if (net_eq(dev_net(ifp->idev->dev), net) &&
-                   ipv6_addr_equal(&ifp->addr, addr)) {
-                       result = ifp;
-                       break;
-               }
-       }
-
-       if (!result) {
-               struct rt6_info *rt;
-
-               rt = rt6_lookup(net, addr, NULL, 0, NULL, 0);
-               if (rt) {
-                       dev = rt->dst.dev;
-                       ip6_rt_put(rt);
-               }
-       } else {
-               dev = result->idev->dev;
-       }
-       rcu_read_unlock();
-
-       return dev;
+       return __ipv6_chk_addr_and_flags(net, addr, dev, !dev, 1,
+                                        IFA_F_TENTATIVE);
 }
 EXPORT_SYMBOL(ipv6_dev_find);
 
index f635914..a0217e5 100644 (file)
@@ -915,7 +915,15 @@ int ip6_tnl_rcv(struct ip6_tnl *t, struct sk_buff *skb,
                struct metadata_dst *tun_dst,
                bool log_ecn_err)
 {
-       return __ip6_tnl_rcv(t, skb, tpi, tun_dst, ip6ip6_dscp_ecn_decapsulate,
+       int (*dscp_ecn_decapsulate)(const struct ip6_tnl *t,
+                                   const struct ipv6hdr *ipv6h,
+                                   struct sk_buff *skb);
+
+       dscp_ecn_decapsulate = ip6ip6_dscp_ecn_decapsulate;
+       if (tpi->proto == htons(ETH_P_IP))
+               dscp_ecn_decapsulate = ip4ip6_dscp_ecn_decapsulate;
+
+       return __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate,
                             log_ecn_err);
 }
 EXPORT_SYMBOL(ip6_tnl_rcv);
index 409e79b..6d0e942 100644 (file)
@@ -245,9 +245,6 @@ static const struct nf_ipv6_ops ipv6ops = {
        .route_input            = ip6_route_input,
        .fragment               = ip6_fragment,
        .reroute                = nf_ip6_reroute,
-#if IS_MODULE(CONFIG_IPV6) && IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
-       .br_defrag              = nf_ct_frag6_gather,
-#endif
 #if IS_MODULE(CONFIG_IPV6)
        .br_fragment            = br_ip6_fragment,
 #endif
index 6ee9851..a95af62 100644 (file)
@@ -418,7 +418,7 @@ static void iucv_sock_close(struct sock *sk)
                        sk->sk_state = IUCV_DISCONN;
                        sk->sk_state_change(sk);
                }
-               /* fall through */
+               fallthrough;
 
        case IUCV_DISCONN:
                sk->sk_state = IUCV_CLOSING;
@@ -433,7 +433,7 @@ static void iucv_sock_close(struct sock *sk)
                                        iucv_sock_in_state(sk, IUCV_CLOSED, 0),
                                        timeo);
                }
-               /* fall through */
+               fallthrough;
 
        case IUCV_CLOSING:
                sk->sk_state = IUCV_CLOSED;
@@ -444,7 +444,7 @@ static void iucv_sock_close(struct sock *sk)
 
                skb_queue_purge(&iucv->send_skb_q);
                skb_queue_purge(&iucv->backlog_skb_q);
-               /* fall through */
+               fallthrough;
 
        default:
                iucv_sever_path(sk, 1);
@@ -2111,10 +2111,10 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
                        kfree_skb(skb);
                        break;
                }
-               /* fall through - and receive non-zero length data */
+               fallthrough;    /* and receive non-zero length data */
        case (AF_IUCV_FLAG_SHT):
                /* shutdown request */
-               /* fall through - and receive zero length data */
+               fallthrough;    /* and receive zero length data */
        case 0:
                /* plain data frame */
                IUCV_SKB_CB(skb)->class = trans_hdr->iucv_hdr.class;
index 6fdd0c9..f2868a8 100644 (file)
@@ -1516,7 +1516,7 @@ static void mpls_ifdown(struct net_device *dev, int event)
                        case NETDEV_DOWN:
                        case NETDEV_UNREGISTER:
                                nh_flags |= RTNH_F_DEAD;
-                               /* fall through */
+                               fallthrough;
                        case NETDEV_CHANGE:
                                nh_flags |= RTNH_F_LINKDOWN;
                                break;
index 8c1d1a5..49b8150 100644 (file)
@@ -193,7 +193,6 @@ static void mptcp_check_data_fin_ack(struct sock *sk)
                        sk->sk_state_change(sk);
                        break;
                case TCP_CLOSING:
-                       fallthrough;
                case TCP_LAST_ACK:
                        inet_sk_state_store(sk, TCP_CLOSE);
                        sk->sk_state_change(sk);
@@ -725,8 +724,10 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
                if (!psize)
                        return -EINVAL;
 
-               if (!sk_wmem_schedule(sk, psize + dfrag->overhead))
+               if (!sk_wmem_schedule(sk, psize + dfrag->overhead)) {
+                       iov_iter_revert(&msg->msg_iter, psize);
                        return -ENOMEM;
+               }
        } else {
                offset = dfrag->offset;
                psize = min_t(size_t, dfrag->data_len, avail_size);
@@ -737,8 +738,11 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
         */
        ret = do_tcp_sendpages(ssk, page, offset, psize,
                               msg->msg_flags | MSG_SENDPAGE_NOTLAST | MSG_DONTWAIT);
-       if (ret <= 0)
+       if (ret <= 0) {
+               if (!retransmission)
+                       iov_iter_revert(&msg->msg_iter, psize);
                return ret;
+       }
 
        frag_truesize += ret;
        if (!retransmission) {
@@ -1388,7 +1392,9 @@ static void mptcp_worker(struct work_struct *work)
        struct mptcp_data_frag *dfrag;
        u64 orig_write_seq;
        size_t copied = 0;
-       struct msghdr msg;
+       struct msghdr msg = {
+               .msg_flags = MSG_DONTWAIT,
+       };
        long timeo = 0;
 
        lock_sock(sk);
@@ -1421,7 +1427,6 @@ static void mptcp_worker(struct work_struct *work)
 
        lock_sock(ssk);
 
-       msg.msg_flags = MSG_DONTWAIT;
        orig_len = dfrag->data_len;
        orig_offset = dfrag->offset;
        orig_write_seq = dfrag->data_seq;
@@ -1535,7 +1540,7 @@ static void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
        case TCP_LISTEN:
                if (!(how & RCV_SHUTDOWN))
                        break;
-               /* fall through */
+               fallthrough;
        case TCP_SYN_SENT:
                tcp_disconnect(ssk, O_NONBLOCK);
                break;
index 1f387be..f1be3e3 100644 (file)
@@ -474,7 +474,7 @@ static void ncsi_suspend_channel(struct ncsi_dev_priv *ndp)
        switch (nd->state) {
        case ncsi_dev_state_suspend:
                nd->state = ncsi_dev_state_suspend_select;
-               /* Fall through */
+               fallthrough;
        case ncsi_dev_state_suspend_select:
                ndp->pending_req_num = 1;
 
@@ -1302,7 +1302,7 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
        switch (nd->state) {
        case ncsi_dev_state_probe:
                nd->state = ncsi_dev_state_probe_deselect;
-               /* Fall through */
+               fallthrough;
        case ncsi_dev_state_probe_deselect:
                ndp->pending_req_num = 8;
 
index 32b0288..dc2e7da 100644 (file)
@@ -315,7 +315,7 @@ tcp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
        switch (skb->ip_summed) {
        case CHECKSUM_NONE:
                skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
-               /* fall through */
+               fallthrough;
        case CHECKSUM_COMPLETE:
 #ifdef CONFIG_IP_VS_IPV6
                if (af == AF_INET6) {
index 153d896..68260d9 100644 (file)
@@ -318,7 +318,7 @@ udp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
                case CHECKSUM_NONE:
                        skb->csum = skb_checksum(skb, udphoff,
                                                 skb->len - udphoff, 0);
-                       /* fall through */
+                       fallthrough;
                case CHECKSUM_COMPLETE:
 #ifdef CONFIG_IP_VS_IPV6
                        if (af == AF_INET6) {
index d878e34..fd814e5 100644 (file)
@@ -2018,8 +2018,10 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
        if (nla[NFTA_CHAIN_NAME]) {
                chain->name = nla_strdup(nla[NFTA_CHAIN_NAME], GFP_KERNEL);
        } else {
-               if (!(flags & NFT_CHAIN_BINDING))
-                       return -EINVAL;
+               if (!(flags & NFT_CHAIN_BINDING)) {
+                       err = -EINVAL;
+                       goto err1;
+               }
 
                snprintf(name, sizeof(name), "__chain%llu", ++chain_id);
                chain->name = kstrdup(name, GFP_KERNEL);
index 6428856..8e56f35 100644 (file)
@@ -27,8 +27,6 @@ struct nft_xt_match_priv {
        void *info;
 };
 
-static refcount_t nft_compat_pending_destroy = REFCOUNT_INIT(1);
-
 static int nft_compat_chain_validate_dependency(const struct nft_ctx *ctx,
                                                const char *tablename)
 {
@@ -215,6 +213,17 @@ static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv)
        return 0;
 }
 
+static void nft_compat_wait_for_destructors(void)
+{
+       /* xtables matches or targets can have side effects, e.g.
+        * creation/destruction of /proc files.
+        * The xt ->destroy functions are run asynchronously from
+        * work queue.  If we have pending invocations we thus
+        * need to wait for those to finish.
+        */
+       nf_tables_trans_destroy_flush_work();
+}
+
 static int
 nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
                const struct nlattr * const tb[])
@@ -238,14 +247,7 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
 
        nft_target_set_tgchk_param(&par, ctx, target, info, &e, proto, inv);
 
-       /* xtables matches or targets can have side effects, e.g.
-        * creation/destruction of /proc files.
-        * The xt ->destroy functions are run asynchronously from
-        * work queue.  If we have pending invocations we thus
-        * need to wait for those to finish.
-        */
-       if (refcount_read(&nft_compat_pending_destroy) > 1)
-               nf_tables_trans_destroy_flush_work();
+       nft_compat_wait_for_destructors();
 
        ret = xt_check_target(&par, size, proto, inv);
        if (ret < 0)
@@ -260,7 +262,6 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
 
 static void __nft_mt_tg_destroy(struct module *me, const struct nft_expr *expr)
 {
-       refcount_dec(&nft_compat_pending_destroy);
        module_put(me);
        kfree(expr->ops);
 }
@@ -468,6 +469,8 @@ __nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
 
        nft_match_set_mtchk_param(&par, ctx, match, info, &e, proto, inv);
 
+       nft_compat_wait_for_destructors();
+
        return xt_check_match(&par, size, proto, inv);
 }
 
@@ -716,14 +719,6 @@ static const struct nfnetlink_subsystem nfnl_compat_subsys = {
 
 static struct nft_expr_type nft_match_type;
 
-static void nft_mt_tg_deactivate(const struct nft_ctx *ctx,
-                                const struct nft_expr *expr,
-                                enum nft_trans_phase phase)
-{
-       if (phase == NFT_TRANS_COMMIT)
-               refcount_inc(&nft_compat_pending_destroy);
-}
-
 static const struct nft_expr_ops *
 nft_match_select_ops(const struct nft_ctx *ctx,
                     const struct nlattr * const tb[])
@@ -762,7 +757,6 @@ nft_match_select_ops(const struct nft_ctx *ctx,
        ops->type = &nft_match_type;
        ops->eval = nft_match_eval;
        ops->init = nft_match_init;
-       ops->deactivate = nft_mt_tg_deactivate,
        ops->destroy = nft_match_destroy;
        ops->dump = nft_match_dump;
        ops->validate = nft_match_validate;
@@ -853,7 +847,6 @@ nft_target_select_ops(const struct nft_ctx *ctx,
        ops->size = NFT_EXPR_SIZE(XT_ALIGN(target->targetsize));
        ops->init = nft_target_init;
        ops->destroy = nft_target_destroy;
-       ops->deactivate = nft_mt_tg_deactivate,
        ops->dump = nft_target_dump;
        ops->validate = nft_target_validate;
        ops->data = target;
@@ -917,8 +910,6 @@ static void __exit nft_compat_module_exit(void)
        nfnetlink_subsys_unregister(&nfnl_compat_subsys);
        nft_unregister_expr(&nft_target_type);
        nft_unregister_expr(&nft_match_type);
-
-       WARN_ON_ONCE(refcount_read(&nft_compat_pending_destroy) != 1);
 }
 
 MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFT_COMPAT);
index 0778283..3c48cdc 100644 (file)
@@ -44,7 +44,7 @@ static void nft_exthdr_ipv6_eval(const struct nft_expr *expr,
 
        err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
        if (priv->flags & NFT_EXTHDR_F_PRESENT) {
-               *dest = (err >= 0);
+               nft_reg_store8(dest, err >= 0);
                return;
        } else if (err < 0) {
                goto err;
@@ -141,7 +141,7 @@ static void nft_exthdr_ipv4_eval(const struct nft_expr *expr,
 
        err = ipv4_find_option(nft_net(pkt), skb, &offset, priv->type);
        if (priv->flags & NFT_EXTHDR_F_PRESENT) {
-               *dest = (err >= 0);
+               nft_reg_store8(dest, err >= 0);
                return;
        } else if (err < 0) {
                goto err;
index f649185..641ffbd 100644 (file)
@@ -51,6 +51,9 @@ static int add_policy(struct nl_policy_dump **statep,
        if (!state)
                return -ENOMEM;
 
+       memset(&state->policies[state->n_alloc], 0,
+              flex_array_size(state, policies, n_alloc - state->n_alloc));
+
        state->policies[state->n_alloc].policy = policy;
        state->policies[state->n_alloc].maxtype = maxtype;
        state->n_alloc = n_alloc;
@@ -185,7 +188,7 @@ send_attribute:
                goto next;
        case NLA_NESTED:
                type = NL_ATTR_TYPE_NESTED;
-               /* fall through */
+               fallthrough;
        case NLA_NESTED_ARRAY:
                if (pt->type == NLA_NESTED_ARRAY)
                        type = NL_ATTR_TYPE_NESTED_ARRAY;
index 2bef377..69e5890 100644 (file)
@@ -122,7 +122,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
 
        case NR_DISCREQ:
                nr_write_internal(sk, NR_DISCACK);
-               /* fall through */
+               fallthrough;
        case NR_DISCACK:
                nr_disconnect(sk, 0);
                break;
index 0891ee0..78da5ea 100644 (file)
@@ -263,7 +263,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
        case 3:
                re_sort_routes(nr_node, 0, 1);
                re_sort_routes(nr_node, 1, 2);
-               /* fall through */
+               fallthrough;
        case 2:
                re_sort_routes(nr_node, 0, 1);
        case 1:
@@ -356,7 +356,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n
                                switch (i) {
                                case 0:
                                        nr_node->routes[0] = nr_node->routes[1];
-                                       /* fall through */
+                                       fallthrough;
                                case 1:
                                        nr_node->routes[1] = nr_node->routes[2];
                                case 2:
@@ -479,7 +479,7 @@ static int nr_dec_obs(void)
                                switch (i) {
                                case 0:
                                        s->routes[0] = s->routes[1];
-                                       /* Fallthrough */
+                                       fallthrough;
                                case 1:
                                        s->routes[1] = s->routes[2];
                                case 2:
@@ -526,7 +526,7 @@ void nr_rt_device_down(struct net_device *dev)
                                                switch (i) {
                                                case 0:
                                                        t->routes[0] = t->routes[1];
-                                                       /* fall through */
+                                                       fallthrough;
                                                case 1:
                                                        t->routes[1] = t->routes[2];
                                                case 2:
index 98d393e..a3f1204 100644 (file)
@@ -778,7 +778,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
                        }
                }
                /* Non-ICMP, fall thru to initialize if needed. */
-               /* fall through */
+               fallthrough;
        case IP_CT_NEW:
                /* Seen it before?  This can happen for loopback, retrans,
                 * or local packets.
@@ -1540,7 +1540,7 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
                switch (type) {
                case OVS_CT_ATTR_FORCE_COMMIT:
                        info->force = true;
-                       /* fall through. */
+                       fallthrough;
                case OVS_CT_ATTR_COMMIT:
                        info->commit = true;
                        break;
index 03942c3..b03d142 100644 (file)
@@ -675,7 +675,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
                        case -EINVAL:
                                memset(&key->ip, 0, sizeof(key->ip));
                                memset(&key->ipv6.addr, 0, sizeof(key->ipv6.addr));
-                               /* fall-through */
+                               fallthrough;
                        case -EPROTO:
                                skb->transport_header = skb->network_header;
                                error = 0;
index 479c257..da8254e 100644 (file)
@@ -4061,7 +4061,7 @@ static int packet_notifier(struct notifier_block *this,
                case NETDEV_UNREGISTER:
                        if (po->mclist)
                                packet_dev_mclist_delete(dev, &po->mclist);
-                       /* fallthrough */
+                       fallthrough;
 
                case NETDEV_DOWN:
                        if (dev->ifindex == po->ifindex) {
index e47d09a..a152591 100644 (file)
@@ -368,7 +368,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
                        err = -EINVAL;
                        goto out;
                }
-               /* fall through */
+               fallthrough;
        case PNS_PEP_DISABLE_REQ:
                atomic_set(&pn->tx_credits, 0);
                pep_reply(sk, skb, PN_PIPE_NO_ERROR, NULL, 0, GFP_ATOMIC);
@@ -385,7 +385,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
 
        case PNS_PIPE_ALIGNED_DATA:
                __skb_pull(skb, 1);
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_DATA:
                __skb_pull(skb, 3); /* Pipe data header */
                if (!pn_flow_safe(pn->rx_fc)) {
@@ -417,11 +417,11 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
                err = pipe_rcv_created(sk, skb);
                if (err)
                        break;
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_RESET_IND:
                if (!pn->init_enable)
                        break;
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_ENABLED_IND:
                if (!pn_flow_safe(pn->tx_fc)) {
                        atomic_set(&pn->tx_credits, 1);
@@ -555,7 +555,7 @@ static int pipe_handler_do_rcv(struct sock *sk, struct sk_buff *skb)
        switch (hdr->message_id) {
        case PNS_PIPE_ALIGNED_DATA:
                __skb_pull(skb, 1);
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_DATA:
                __skb_pull(skb, 3); /* Pipe data header */
                if (!pn_flow_safe(pn->rx_fc)) {
index b4c0db0..90c558f 100644 (file)
@@ -692,23 +692,25 @@ static void qrtr_port_remove(struct qrtr_sock *ipc)
  */
 static int qrtr_port_assign(struct qrtr_sock *ipc, int *port)
 {
+       u32 min_port;
        int rc;
 
        mutex_lock(&qrtr_port_lock);
        if (!*port) {
-               rc = idr_alloc(&qrtr_ports, ipc,
-                              QRTR_MIN_EPH_SOCKET, QRTR_MAX_EPH_SOCKET + 1,
-                              GFP_ATOMIC);
-               if (rc >= 0)
-                       *port = rc;
+               min_port = QRTR_MIN_EPH_SOCKET;
+               rc = idr_alloc_u32(&qrtr_ports, ipc, &min_port, QRTR_MAX_EPH_SOCKET, GFP_ATOMIC);
+               if (!rc)
+                       *port = min_port;
        } else if (*port < QRTR_MIN_EPH_SOCKET && !capable(CAP_NET_ADMIN)) {
                rc = -EACCES;
        } else if (*port == QRTR_PORT_CTRL) {
-               rc = idr_alloc(&qrtr_ports, ipc, 0, 1, GFP_ATOMIC);
+               min_port = 0;
+               rc = idr_alloc_u32(&qrtr_ports, ipc, &min_port, 0, GFP_ATOMIC);
        } else {
-               rc = idr_alloc(&qrtr_ports, ipc, *port, *port + 1, GFP_ATOMIC);
-               if (rc >= 0)
-                       *port = rc;
+               min_port = *port;
+               rc = idr_alloc_u32(&qrtr_ports, ipc, &min_port, *port, GFP_ATOMIC);
+               if (!rc)
+                       *port = min_port;
        }
        mutex_unlock(&qrtr_port_lock);
 
index 9a529a0..985d0b7 100644 (file)
@@ -934,7 +934,7 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs,
 
                case RDS_CMSG_ZCOPY_COOKIE:
                        zcopy_cookie = true;
-                       /* fall through */
+                       fallthrough;
 
                case RDS_CMSG_RDMA_DEST:
                case RDS_CMSG_RDMA_MAP:
index 0d4fab2..6af786d 100644 (file)
@@ -216,7 +216,7 @@ static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int framety
        switch (frametype) {
        case ROSE_RESET_REQUEST:
                rose_write_internal(sk, ROSE_RESET_CONFIRMATION);
-               /* fall through */
+               fallthrough;
        case ROSE_RESET_CONFIRMATION:
                rose_stop_timer(sk);
                rose_start_idletimer(sk);
index 5277631..6e35703 100644 (file)
@@ -343,7 +343,7 @@ static int rose_del_node(struct rose_route_struct *rose_route,
                                case 0:
                                        rose_node->neighbour[0] =
                                                rose_node->neighbour[1];
-                                       /* fall through */
+                                       fallthrough;
                                case 1:
                                        rose_node->neighbour[1] =
                                                rose_node->neighbour[2];
@@ -505,7 +505,7 @@ void rose_rt_device_down(struct net_device *dev)
                                switch (i) {
                                case 0:
                                        t->neighbour[0] = t->neighbour[1];
-                                       /* fall through */
+                                       fallthrough;
                                case 1:
                                        t->neighbour[1] = t->neighbour[2];
                                case 2:
index e6725a6..186c8a8 100644 (file)
@@ -246,7 +246,7 @@ static int rxrpc_listen(struct socket *sock, int backlog)
                        ret = 0;
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                ret = -EBUSY;
                break;
@@ -545,7 +545,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
 
                rx->local = local;
                rx->sk.sk_state = RXRPC_CLIENT_BOUND;
-               /* Fall through */
+               fallthrough;
 
        case RXRPC_CLIENT_BOUND:
                if (!m->msg_name &&
@@ -553,7 +553,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
                        m->msg_name = &rx->connect_srx;
                        m->msg_namelen = sizeof(rx->connect_srx);
                }
-               /* Fall through */
+               fallthrough;
        case RXRPC_SERVER_BOUND:
        case RXRPC_SERVER_LISTENING:
                ret = rxrpc_do_sendmsg(rx, m, len);
index 032ed76..ef16056 100644 (file)
@@ -622,7 +622,7 @@ int rxrpc_reject_call(struct rxrpc_sock *rx)
        case RXRPC_CALL_SERVER_ACCEPTING:
                __rxrpc_abort_call("REJ", call, 1, RX_USER_ABORT, -ECONNABORTED);
                abort = true;
-               /* fall through */
+               fallthrough;
        case RXRPC_CALL_COMPLETE:
                ret = call->error;
                goto out_discard;
index f2a1a5d..159e3ed 100644 (file)
@@ -881,7 +881,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call)
                        conn->cache_state = RXRPC_CONN_CLIENT_ACTIVE;
                        rxrpc_activate_channels_locked(conn);
                }
-               /* fall through */
+               fallthrough;
        case RXRPC_CONN_CLIENT_ACTIVE:
                if (list_empty(&conn->waiting_calls)) {
                        rxrpc_deactivate_one_channel(conn, channel);
index 7675793..fbde8b8 100644 (file)
@@ -1084,7 +1084,7 @@ static void rxrpc_input_implicit_end_call(struct rxrpc_sock *rx,
        switch (READ_ONCE(call->state)) {
        case RXRPC_CALL_SERVER_AWAIT_ACK:
                rxrpc_call_completed(call);
-               /* Fall through */
+               fallthrough;
        case RXRPC_CALL_COMPLETE:
                break;
        default:
@@ -1243,12 +1243,12 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb)
        case RXRPC_PACKET_TYPE_BUSY:
                if (rxrpc_to_server(sp))
                        goto discard;
-               /* Fall through */
+               fallthrough;
        case RXRPC_PACKET_TYPE_ACK:
        case RXRPC_PACKET_TYPE_ACKALL:
                if (sp->hdr.callNumber == 0)
                        goto bad_message;
-               /* Fall through */
+               fallthrough;
        case RXRPC_PACKET_TYPE_ABORT:
                break;
 
index c8b2097..ede058f 100644 (file)
@@ -162,7 +162,7 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
                /* Fall through and set IPv4 options too otherwise we don't get
                 * errors from IPv4 packets sent through the IPv6 socket.
                 */
-               /* Fall through */
+               fallthrough;
        case AF_INET:
                /* we want to receive ICMP errors */
                ip_sock_set_recverr(local->socket->sk);
index a852f46..be03285 100644 (file)
@@ -273,7 +273,7 @@ static void rxrpc_store_error(struct rxrpc_peer *peer,
        case SO_EE_ORIGIN_ICMP6:
                if (err == EACCES)
                        err = EHOSTUNREACH;
-               /* Fall through */
+               fallthrough;
        default:
                _proto("Rx Received error report { orig=%u }", ee->ee_origin);
                break;
index efecc5a..c4684dd 100644 (file)
@@ -776,7 +776,7 @@ out:
        case RXRPC_ACK_DELAY:
                if (ret != -EAGAIN)
                        break;
-               /* Fall through */
+               fallthrough;
        default:
                rxrpc_send_ack_packet(call, false, NULL);
        }
index f3f6da6..0824e10 100644 (file)
@@ -241,7 +241,7 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
                        trace_rxrpc_timer(call, rxrpc_timer_init_for_send_reply, now);
                        if (!last)
                                break;
-                       /* Fall through */
+                       fallthrough;
                case RXRPC_CALL_SERVER_SEND_REPLY:
                        call->state = RXRPC_CALL_SERVER_AWAIT_ACK;
                        rxrpc_notify_end_tx(rx, call, notify_end_tx);
@@ -721,13 +721,13 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
                if (p.call.timeouts.normal > 0 && j == 0)
                        j = 1;
                WRITE_ONCE(call->next_rx_timo, j);
-               /* Fall through */
+               fallthrough;
        case 2:
                j = msecs_to_jiffies(p.call.timeouts.idle);
                if (p.call.timeouts.idle > 0 && j == 0)
                        j = 1;
                WRITE_ONCE(call->next_req_timo, j);
-               /* Fall through */
+               fallthrough;
        case 1:
                if (p.call.timeouts.hard > 0) {
                        j = msecs_to_jiffies(p.call.timeouts.hard);
index e6ad42b..2c36191 100644 (file)
@@ -704,7 +704,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb,
                err = ip_defrag(net, skb, user);
                local_bh_enable();
                if (err && err != -EINPROGRESS)
-                       goto out_free;
+                       return err;
 
                if (!err) {
                        *defrag = true;
index 0618b63..7d37638 100644 (file)
@@ -1670,7 +1670,7 @@ static u32 cake_classify(struct Qdisc *sch, struct cake_tin_data **t,
                case TC_ACT_QUEUED:
                case TC_ACT_TRAP:
                        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
-                       /* fall through */
+                       fallthrough;
                case TC_ACT_SHOT:
                        return 0;
                }
index aea2a98..8a58f42 100644 (file)
@@ -875,7 +875,7 @@ static int sctp_inet6_af_supported(sa_family_t family, struct sctp_sock *sp)
        case AF_INET:
                if (!__ipv6_only_sock(sctp_opt2sk(sp)))
                        return 1;
-               /* fallthru */
+               fallthrough;
        default:
                return 0;
        }
index 577e3bc..3fd06a2 100644 (file)
@@ -912,7 +912,7 @@ static void sctp_outq_flush_ctrl(struct sctp_flush_ctx *ctx)
                case SCTP_CID_ABORT:
                        if (sctp_test_T_bit(chunk))
                                ctx->packet->vtag = ctx->asoc->c.my_vtag;
-                       /* fallthru */
+                       fallthrough;
 
                /* The following chunks are "response" chunks, i.e.
                 * they are generated in response to something we
@@ -927,7 +927,7 @@ static void sctp_outq_flush_ctrl(struct sctp_flush_ctx *ctx)
                case SCTP_CID_ECN_CWR:
                case SCTP_CID_ASCONF_ACK:
                        one_packet = 1;
-                       /* Fall through */
+                       fallthrough;
 
                case SCTP_CID_SACK:
                case SCTP_CID_HEARTBEAT:
@@ -1030,7 +1030,7 @@ static void sctp_outq_flush_data(struct sctp_flush_ctx *ctx,
                if (!ctx->packet || !ctx->packet->has_cookie_echo)
                        return;
 
-               /* fall through */
+               fallthrough;
        case SCTP_STATE_ESTABLISHED:
        case SCTP_STATE_SHUTDOWN_PENDING:
        case SCTP_STATE_SHUTDOWN_RECEIVED:
index 4791047..c11c245 100644 (file)
@@ -2077,7 +2077,7 @@ static enum sctp_ierror sctp_process_unk_param(
                break;
        case SCTP_PARAM_ACTION_DISCARD_ERR:
                retval =  SCTP_IERROR_ERROR;
-               /* Fall through */
+               fallthrough;
        case SCTP_PARAM_ACTION_SKIP_ERR:
                /* Make an ERROR chunk, preparing enough room for
                 * returning multiple unknown parameters.
index 9f36fe9..aa821e7 100644 (file)
@@ -1516,7 +1516,7 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
 
                        if (timer_pending(timer))
                                break;
-                       /* fall through */
+                       fallthrough;
 
                case SCTP_CMD_TIMER_START:
                        timer = &asoc->timers[cmd->obj.to];
index e86620f..c669f8b 100644 (file)
@@ -4315,7 +4315,7 @@ enum sctp_disposition sctp_sf_eat_auth(struct net *net,
                        sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
                                        SCTP_CHUNK(err_chunk));
                }
-               /* Fall Through */
+               fallthrough;
        case SCTP_IERROR_AUTH_BAD_KEYID:
        case SCTP_IERROR_BAD_SIG:
                return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
index bda2536..6dc95dc 100644 (file)
@@ -88,12 +88,13 @@ static int sctp_stream_alloc_out(struct sctp_stream *stream, __u16 outcnt,
        int ret;
 
        if (outcnt <= stream->outcnt)
-               return 0;
+               goto out;
 
        ret = genradix_prealloc(&stream->out, outcnt, gfp);
        if (ret)
                return ret;
 
+out:
        stream->outcnt = outcnt;
        return 0;
 }
@@ -104,12 +105,13 @@ static int sctp_stream_alloc_in(struct sctp_stream *stream, __u16 incnt,
        int ret;
 
        if (incnt <= stream->incnt)
-               return 0;
+               goto out;
 
        ret = genradix_prealloc(&stream->in, incnt, gfp);
        if (ret)
                return ret;
 
+out:
        stream->incnt = incnt;
        return 0;
 }
index 290270c..3b5c374 100644 (file)
@@ -372,7 +372,7 @@ static void smc_close_passive_work(struct work_struct *work)
        case SMC_PEERCLOSEWAIT1:
                if (rxflags->peer_done_writing)
                        sk->sk_state = SMC_PEERCLOSEWAIT2;
-               /* fall through */
+               fallthrough;
                /* to check for closing */
        case SMC_PEERCLOSEWAIT2:
                if (!smc_cdc_rxed_any_close(conn))
index e1f64f4..da9ba6d 100644 (file)
@@ -170,13 +170,15 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb,
            (req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) &&
            !list_empty(&smc->conn.lgr->list)) {
                struct smc_connection *conn = &smc->conn;
-               struct smcd_diag_dmbinfo dinfo = {
-                       .linkid = *((u32 *)conn->lgr->id),
-                       .peer_gid = conn->lgr->peer_gid,
-                       .my_gid = conn->lgr->smcd->local_gid,
-                       .token = conn->rmb_desc->token,
-                       .peer_token = conn->peer_token
-               };
+               struct smcd_diag_dmbinfo dinfo;
+
+               memset(&dinfo, 0, sizeof(dinfo));
+
+               dinfo.linkid = *((u32 *)conn->lgr->id);
+               dinfo.peer_gid = conn->lgr->peer_gid;
+               dinfo.my_gid = conn->lgr->smcd->local_gid;
+               dinfo.token = conn->rmb_desc->token;
+               dinfo.peer_token = conn->peer_token;
 
                if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0)
                        goto errout;
index 90b8329..8b300b7 100644 (file)
@@ -137,7 +137,7 @@ gss_krb5_make_confounder(char *p, u32 conflen)
        switch (conflen) {
        case 16:
                *q++ = i++;
-               /* fall through */
+               fallthrough;
        case 8:
                *q++ = i++;
                break;
index d26036a..76685ab 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/sunrpc/svc_xprt.h>
 #include <linux/sunrpc/auth_gss.h>
 #include <linux/sunrpc/gss_err.h>
-#include <linux/sunrpc/auth_gss.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/rpcgss.h>
index a91d1cd..62e0b6c 100644 (file)
@@ -1702,7 +1702,7 @@ call_reserveresult(struct rpc_task *task)
        switch (status) {
        case -ENOMEM:
                rpc_delay(task, HZ >> 2);
-               /* fall through */
+               fallthrough;
        case -EAGAIN:   /* woken up; retry */
                task->tk_action = call_retry_reserve;
                return;
@@ -1759,13 +1759,13 @@ call_refreshresult(struct rpc_task *task)
                /* Use rate-limiting and a max number of retries if refresh
                 * had status 0 but failed to update the cred.
                 */
-               /* fall through */
+               fallthrough;
        case -ETIMEDOUT:
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -EAGAIN:
                status = -EACCES;
-               /* fall through */
+               fallthrough;
        case -EKEYEXPIRED:
                if (!task->tk_cred_retry)
                        break;
@@ -2132,7 +2132,7 @@ call_connect_status(struct rpc_task *task)
                        rpc_force_rebind(clnt);
                        goto out_retry;
                }
-               /* fall through */
+               fallthrough;
        case -ECONNRESET:
        case -ECONNABORTED:
        case -ENETDOWN:
@@ -2146,7 +2146,7 @@ call_connect_status(struct rpc_task *task)
                        break;
                /* retry with existing socket, after a delay */
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -EADDRINUSE:
        case -ENOTCONN:
        case -EAGAIN:
@@ -2228,7 +2228,7 @@ call_transmit_status(struct rpc_task *task)
                 */
        case -ENOBUFS:
                rpc_delay(task, HZ>>2);
-               /* fall through */
+               fallthrough;
        case -EBADSLT:
        case -EAGAIN:
                task->tk_action = call_transmit;
@@ -2247,7 +2247,7 @@ call_transmit_status(struct rpc_task *task)
                        rpc_call_rpcerror(task, task->tk_status);
                        return;
                }
-               /* fall through */
+               fallthrough;
        case -ECONNRESET:
        case -ECONNABORTED:
        case -EADDRINUSE:
@@ -2313,7 +2313,7 @@ call_bc_transmit_status(struct rpc_task *task)
                break;
        case -ENOBUFS:
                rpc_delay(task, HZ>>2);
-               /* fall through */
+               fallthrough;
        case -EBADSLT:
        case -EAGAIN:
                task->tk_status = 0;
@@ -2380,7 +2380,7 @@ call_status(struct rpc_task *task)
                 * were a timeout.
                 */
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -ETIMEDOUT:
                break;
        case -ECONNREFUSED:
@@ -2391,7 +2391,7 @@ call_status(struct rpc_task *task)
                break;
        case -EADDRINUSE:
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -EPIPE:
        case -EAGAIN:
                break;
index 6ba9d58..5a8e47b 100644 (file)
@@ -1623,7 +1623,7 @@ void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task)
        case -EAGAIN:
                xprt_add_backlog(xprt, task);
                dprintk("RPC:       waiting for request slot\n");
-               /* fall through */
+               fallthrough;
        default:
                task->tk_status = -EAGAIN;
        }
index 75c6467..3f86d03 100644 (file)
@@ -268,7 +268,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_DEVICE_REMOVAL:
                pr_info("rpcrdma: removing device %s for %pISpc\n",
                        ep->re_id->device->name, sap);
-               /* fall through */
+               fallthrough;
        case RDMA_CM_EVENT_ADDR_CHANGE:
                ep->re_connect_status = -ENODEV;
                goto disconnected;
index c57aef8..554e1bb 100644 (file)
@@ -885,7 +885,7 @@ static int xs_local_send_request(struct rpc_rqst *req)
        default:
                dprintk("RPC:       sendmsg returned unrecognized error %d\n",
                        -status);
-               /* fall through */
+               fallthrough;
        case -EPIPE:
                xs_close(xprt);
                status = -ENOTCONN;
@@ -1436,7 +1436,7 @@ static void xs_tcp_state_change(struct sock *sk)
                xprt->connect_cookie++;
                clear_bit(XPRT_CONNECTED, &xprt->state);
                xs_run_error_worker(transport, XPRT_SOCK_WAKE_DISCONNECT);
-               /* fall through */
+               fallthrough;
        case TCP_CLOSING:
                /*
                 * If the server closed down the connection, make sure that
@@ -2202,7 +2202,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
        switch (ret) {
        case 0:
                xs_set_srcport(transport, sock);
-               /* fall through */
+               fallthrough;
        case -EINPROGRESS:
                /* SYN_SENT! */
                if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)
@@ -2255,7 +2255,7 @@ static void xs_tcp_setup_socket(struct work_struct *work)
        default:
                printk("%s: connect returned unhandled error %d\n",
                        __func__, status);
-               /* fall through */
+               fallthrough;
        case -EADDRNOTAVAIL:
                /* We're probably in TIME_WAIT. Get rid of existing socket,
                 * and retry
index 9dd7802..be1c400 100644 (file)
@@ -6,6 +6,7 @@
 menuconfig TIPC
        tristate "The TIPC Protocol"
        depends on INET
+       depends on IPV6 || IPV6=n
        help
          The Transparent Inter Process Communication (TIPC) protocol is
          specially designed for intra cluster communication. This protocol
index 808b147..6504141 100644 (file)
@@ -652,7 +652,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
                        test_and_set_bit_lock(0, &b->up);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case NETDEV_GOING_DOWN:
                clear_bit_unlock(0, &b->up);
                tipc_reset_bearer(net, b);
index 001bcb0..c38baba 100644 (file)
@@ -757,10 +757,12 @@ static void tipc_aead_encrypt_done(struct crypto_async_request *base, int err)
        switch (err) {
        case 0:
                this_cpu_inc(tx->stats->stat[STAT_ASYNC_OK]);
+               rcu_read_lock();
                if (likely(test_bit(0, &b->up)))
                        b->media->send_msg(net, skb, b, &tx_ctx->dst);
                else
                        kfree_skb(skb);
+               rcu_read_unlock();
                break;
        case -EINPROGRESS:
                return;
index 89257e2..588c2d2 100644 (file)
@@ -536,7 +536,7 @@ void tipc_group_filter_msg(struct tipc_group *grp, struct sk_buff_head *inputq,
                                update = true;
                                deliver = false;
                        }
-                       /* Fall thru */
+                       fallthrough;
                case TIPC_GRP_BCAST_MSG:
                        m->bc_rcv_nxt++;
                        ack = msg_grp_bc_ack_req(hdr);
index 1075781..b736255 100644 (file)
@@ -1239,7 +1239,7 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
                        skb_queue_tail(mc_inputq, skb);
                        return true;
                }
-               /* fall through */
+               fallthrough;
        case CONN_MANAGER:
                skb_queue_tail(inputq, skb);
                return true;
index 2175163..90e3c70 100644 (file)
@@ -275,8 +275,9 @@ err_out:
 static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
                                 struct tipc_nl_compat_msg *msg)
 {
-       int err;
+       struct nlmsghdr *nlh;
        struct sk_buff *arg;
+       int err;
 
        if (msg->req_type && (!msg->req_size ||
                              !TLV_CHECK_TYPE(msg->req, msg->req_type)))
@@ -305,6 +306,15 @@ static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
                return -ENOMEM;
        }
 
+       nlh = nlmsg_put(arg, 0, 0, tipc_genl_family.id, 0, NLM_F_MULTI);
+       if (!nlh) {
+               kfree_skb(arg);
+               kfree_skb(msg->rep);
+               msg->rep = NULL;
+               return -EMSGSIZE;
+       }
+       nlmsg_end(arg, nlh);
+
        err = __tipc_nl_compat_dumpit(cmd, msg, arg);
        if (err) {
                kfree_skb(msg->rep);
index 07419f3..2679e97 100644 (file)
@@ -783,7 +783,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
        case TIPC_ESTABLISHED:
                if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk))
                        revents |= EPOLLOUT;
-               /* fall through */
+               fallthrough;
        case TIPC_LISTEN:
        case TIPC_CONNECTING:
                if (!skb_queue_empty_lockless(&sk->sk_receive_queue))
@@ -2597,7 +2597,7 @@ static int tipc_connect(struct socket *sock, struct sockaddr *dest,
                 * case is EINPROGRESS, rather than EALREADY.
                 */
                res = -EINPROGRESS;
-               /* fall through */
+               fallthrough;
        case TIPC_CONNECTING:
                if (!timeout) {
                        if (previous == TIPC_CONNECTING)
index 53f0de0..911d13c 100644 (file)
@@ -660,6 +660,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
        struct udp_tunnel_sock_cfg tuncfg = {NULL};
        struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
        u8 node_id[NODE_ID_LEN] = {0,};
+       struct net_device *dev;
        int rmcast = 0;
 
        ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
@@ -714,8 +715,6 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
        rcu_assign_pointer(ub->bearer, b);
        tipc_udp_media_addr_set(&b->addr, &local);
        if (local.proto == htons(ETH_P_IP)) {
-               struct net_device *dev;
-
                dev = __ip_dev_find(net, local.ipv4.s_addr, false);
                if (!dev) {
                        err = -ENODEV;
@@ -738,9 +737,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
                b->mtu = b->media->mtu;
 #if IS_ENABLED(CONFIG_IPV6)
        } else if (local.proto == htons(ETH_P_IPV6)) {
-               struct net_device *dev;
-
-               dev = ipv6_dev_find(net, &local.ipv6);
+               dev = ub->ifindex ? __dev_get_by_index(net, ub->ifindex) : NULL;
+               dev = ipv6_dev_find(net, &local.ipv6, dev);
                if (!dev) {
                        err = -ENODEV;
                        goto err;
index 181ea6f..92784e5 100644 (file)
@@ -837,7 +837,7 @@ static int unix_create(struct net *net, struct socket *sock, int protocol,
                 */
        case SOCK_RAW:
                sock->type = SOCK_DGRAM;
-               /* fall through */
+               fallthrough;
        case SOCK_DGRAM:
                sock->ops = &unix_dgram_ops;
                break;
index 90f0f82..e97a4f0 100644 (file)
@@ -957,7 +957,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
                if (!ht_cap->ht_supported &&
                    chandef->chan->band != NL80211_BAND_6GHZ)
                        return false;
-               /* fall through */
+               fallthrough;
        case NL80211_CHAN_WIDTH_20_NOHT:
                prohibited_flags |= IEEE80211_CHAN_NO_20MHZ;
                width = 20;
@@ -983,7 +983,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
                if (chandef->chan->band != NL80211_BAND_6GHZ &&
                    cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
                        return false;
-               /* fall through */
+               fallthrough;
        case NL80211_CHAN_WIDTH_80:
                prohibited_flags |= IEEE80211_CHAN_NO_80MHZ;
                width = 80;
index a6c61a2..db7333e 100644 (file)
@@ -941,7 +941,7 @@ void cfg80211_cac_event(struct net_device *netdev,
                       sizeof(struct cfg80211_chan_def));
                queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk);
                cfg80211_sched_dfs_chan_update(rdev);
-               /* fall through */
+               fallthrough;
        case NL80211_RADAR_CAC_ABORTED:
                wdev->cac_started = false;
                break;
index c04fc6c..fde420a 100644 (file)
@@ -2107,7 +2107,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 1:
                if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES,
                            sizeof(u32) * rdev->wiphy.n_cipher_suites,
@@ -2154,7 +2154,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 2:
                if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
                                        rdev->wiphy.interface_modes))
@@ -2162,7 +2162,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 3:
                nl_bands = nla_nest_start_noflag(msg,
                                                 NL80211_ATTR_WIPHY_BANDS);
@@ -2189,7 +2189,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                                state->chan_start++;
                                if (state->split)
                                        break;
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* add frequencies */
                                nl_freqs = nla_nest_start_noflag(msg,
@@ -2244,7 +2244,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                        state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 4:
                nl_cmds = nla_nest_start_noflag(msg,
                                                NL80211_ATTR_SUPPORTED_COMMANDS);
@@ -2273,7 +2273,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 5:
                if (rdev->ops->remain_on_channel &&
                    (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) &&
@@ -2291,7 +2291,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 6:
 #ifdef CONFIG_PM
                if (nl80211_send_wowlan(msg, rdev, state->split))
@@ -2302,7 +2302,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 #else
                state->split_start++;
 #endif
-               /* fall through */
+               fallthrough;
        case 7:
                if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES,
                                        rdev->wiphy.software_iftypes))
@@ -2315,7 +2315,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 8:
                if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) &&
                    nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME,
@@ -5207,7 +5207,7 @@ bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, int attr)
                break;
        default:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        case RATE_INFO_BW_20:
                rate_flg = 0;
                break;
index e67a744..04f2d19 100644 (file)
@@ -1433,7 +1433,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
        switch (ftype) {
        case CFG80211_BSS_FTYPE_BEACON:
                ies->from_beacon = true;
-               /* fall through */
+               fallthrough;
        case CFG80211_BSS_FTYPE_UNKNOWN:
                rcu_assign_pointer(tmp.pub.beacon_ies, ies);
                break;
index 985f3c2..079ce32 100644 (file)
@@ -205,7 +205,7 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev,
                return err;
        case CFG80211_CONN_ASSOC_FAILED_TIMEOUT:
                *treason = NL80211_TIMEOUT_ASSOC;
-               /* fall through */
+               fallthrough;
        case CFG80211_CONN_ASSOC_FAILED:
                cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
                                     NULL, 0,
@@ -215,7 +215,7 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev,
                cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
                                     NULL, 0,
                                     WLAN_REASON_DEAUTH_LEAVING, false);
-               /* fall through */
+               fallthrough;
        case CFG80211_CONN_ABANDON:
                /* free directly, disconnected event already sent */
                cfg80211_sme_free(wdev);
index dfad1c0..7c5d536 100644 (file)
@@ -198,7 +198,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)
                                sband->bitrates[i].flags |=
                                        IEEE80211_RATE_MANDATORY_G;
                                want--;
-                               /* fall through */
+                               fallthrough;
                        default:
                                sband->bitrates[i].flags |=
                                        IEEE80211_RATE_ERP_G;
@@ -1008,7 +1008,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                case NL80211_IFTYPE_STATION:
                        if (dev->ieee80211_ptr->use_4addr)
                                break;
-                       /* fall through */
+                       fallthrough;
                case NL80211_IFTYPE_OCB:
                case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_ADHOC:
index aa918d7..4d2160c 100644 (file)
@@ -1334,7 +1334,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
                        wstats.qual.qual = sig + 110;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case CFG80211_SIGNAL_TYPE_UNSPEC:
                if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) {
                        wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
@@ -1343,7 +1343,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
                        wstats.qual.qual = sinfo.signal;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                wstats.qual.updated |= IW_QUAL_LEVEL_INVALID;
                wstats.qual.updated |= IW_QUAL_QUAL_INVALID;
index 7fb3276..8e1a49b 100644 (file)
@@ -98,7 +98,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,
                                        *vc_fac_mask |= X25_MASK_REVERSE;
                                        break;
                                }
-                               /*fall through */
+                               fallthrough;
                        case X25_FAC_THROUGHPUT:
                                facilities->throughput = p[1];
                                *vc_fac_mask |= X25_MASK_THROUGHPUT;
index 4d3bb46..e1c4197 100644 (file)
@@ -349,7 +349,7 @@ static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametyp
 
                case X25_RESET_REQUEST:
                        x25_write_internal(sk, X25_RESET_CONFIRMATION);
-                       /* fall through */
+                       fallthrough;
                case X25_RESET_CONFIRMATION: {
                        x25_stop_timer(sk);
                        x25->condition = 0x00;
index d5280fd..d622c25 100644 (file)
@@ -3410,7 +3410,7 @@ decode_session6(struct sk_buff *skb, struct flowi *fl, bool reverse)
                switch (nexthdr) {
                case NEXTHDR_FRAGMENT:
                        onlyproto = 1;
-                       /* fall through */
+                       fallthrough;
                case NEXTHDR_ROUTING:
                case NEXTHDR_HOP:
                case NEXTHDR_DEST:
index 7d71537..4b22ace 100644 (file)
@@ -483,7 +483,7 @@ int main(int argc, char **argv)
                                        "Option -%c requires an argument.\n\n",
                                        optopt);
                case 'h':
-                       // fallthrough
+                       fallthrough;
                default:
                        Usage();
                        return 0;
index 62c2756..95e4cdb 100644 (file)
@@ -66,7 +66,6 @@ KBUILD_CFLAGS += -Wnested-externs
 KBUILD_CFLAGS += -Wshadow
 KBUILD_CFLAGS += $(call cc-option, -Wlogical-op)
 KBUILD_CFLAGS += -Wmissing-field-initializers
-KBUILD_CFLAGS += -Wsign-compare
 KBUILD_CFLAGS += -Wtype-limits
 KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
 KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
@@ -87,6 +86,7 @@ KBUILD_CFLAGS += -Wpacked
 KBUILD_CFLAGS += -Wpadded
 KBUILD_CFLAGS += -Wpointer-arith
 KBUILD_CFLAGS += -Wredundant-decls
+KBUILD_CFLAGS += -Wsign-compare
 KBUILD_CFLAGS += -Wswitch-default
 KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat)
 
index b071bf4..3bc48c7 100644 (file)
@@ -71,7 +71,7 @@ static void drain_openssl_errors(void)
 static const char *key_pass;
 static BIO *wb;
 static char *cert_dst;
-int kbuild_verbose;
+static int kbuild_verbose;
 
 static void write_cert(X509 *x509)
 {
index 7a85c4e..057c6ca 100644 (file)
@@ -25,9 +25,9 @@ static struct resword {
        { "__int128_t", BUILTIN_INT_KEYW },
        { "__uint128_t", BUILTIN_INT_KEYW },
 
-       // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict".  KAO
+       // According to rth, c99 defines "_Bool", "__restrict", "__restrict__", "restrict".  KAO
        { "_Bool", BOOL_KEYW },
-       { "_restrict", RESTRICT_KEYW },
+       { "__restrict", RESTRICT_KEYW },
        { "__restrict__", RESTRICT_KEYW },
        { "restrict", RESTRICT_KEYW },
        { "asm", ASM_KEYW },
index bc390df..8638785 100644 (file)
@@ -885,7 +885,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
                connect(action, SIGNAL(toggled(bool)),
                        parent(), SLOT(setShowName(bool)));
                connect(parent(), SIGNAL(showNameChanged(bool)),
-                       action, SLOT(setOn(bool)));
+                       action, SLOT(setChecked(bool)));
                action->setChecked(showName);
                headerPopup->addAction(action);
 
@@ -894,7 +894,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
                connect(action, SIGNAL(toggled(bool)),
                        parent(), SLOT(setShowRange(bool)));
                connect(parent(), SIGNAL(showRangeChanged(bool)),
-                       action, SLOT(setOn(bool)));
+                       action, SLOT(setChecked(bool)));
                action->setChecked(showRange);
                headerPopup->addAction(action);
 
@@ -903,7 +903,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
                connect(action, SIGNAL(toggled(bool)),
                        parent(), SLOT(setShowData(bool)));
                connect(parent(), SIGNAL(showDataChanged(bool)),
-                       action, SLOT(setOn(bool)));
+                       action, SLOT(setChecked(bool)));
                action->setChecked(showData);
                headerPopup->addAction(action);
        }
@@ -1012,6 +1012,16 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
                configSettings->endGroup();
                connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
        }
+
+       contextMenu = createStandardContextMenu();
+       QAction *action = new QAction("Show Debug Info", contextMenu);
+
+       action->setCheckable(true);
+       connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
+       connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool)));
+       action->setChecked(showDebug());
+       contextMenu->addSeparator();
+       contextMenu->addAction(action);
 }
 
 void ConfigInfoView::saveSettings(void)
@@ -1066,80 +1076,80 @@ void ConfigInfoView::symbolInfo(void)
 void ConfigInfoView::menuInfo(void)
 {
        struct symbol* sym;
-       QString head, debug, help;
+       QString info;
+       QTextStream stream(&info);
 
        sym = _menu->sym;
        if (sym) {
                if (_menu->prompt) {
-                       head += "<big><b>";
-                       head += print_filter(_menu->prompt->text);
-                       head += "</b></big>";
+                       stream << "<big><b>";
+                       stream << print_filter(_menu->prompt->text);
+                       stream << "</b></big>";
                        if (sym->name) {
-                               head += " (";
+                               stream << " (";
                                if (showDebug())
-                                       head += QString().sprintf("<a href=\"s%s\">", sym->name);
-                               head += print_filter(sym->name);
+                                       stream << "<a href=\"s" << sym->name << "\">";
+                               stream << print_filter(sym->name);
                                if (showDebug())
-                                       head += "</a>";
-                               head += ")";
+                                       stream << "</a>";
+                               stream << ")";
                        }
                } else if (sym->name) {
-                       head += "<big><b>";
+                       stream << "<big><b>";
                        if (showDebug())
-                               head += QString().sprintf("<a href=\"s%s\">", sym->name);
-                       head += print_filter(sym->name);
+                               stream << "<a href=\"s" << sym->name << "\">";
+                       stream << print_filter(sym->name);
                        if (showDebug())
-                               head += "</a>";
-                       head += "</b></big>";
+                               stream << "</a>";
+                       stream << "</b></big>";
                }
-               head += "<br><br>";
+               stream << "<br><br>";
 
                if (showDebug())
-                       debug = debug_info(sym);
+                       stream << debug_info(sym);
 
-               struct gstr help_gstr = str_new();
-               menu_get_ext_help(_menu, &help_gstr);
-               help = print_filter(str_get(&help_gstr));
-               str_free(&help_gstr);
        } else if (_menu->prompt) {
-               head += "<big><b>";
-               head += print_filter(_menu->prompt->text);
-               head += "</b></big><br><br>";
+               stream << "<big><b>";
+               stream << print_filter(_menu->prompt->text);
+               stream << "</b></big><br><br>";
                if (showDebug()) {
                        if (_menu->prompt->visible.expr) {
-                               debug += "&nbsp;&nbsp;dep: ";
-                               expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
-                               debug += "<br><br>";
+                               stream << "&nbsp;&nbsp;dep: ";
+                               expr_print(_menu->prompt->visible.expr,
+                                          expr_print_help, &stream, E_NONE);
+                               stream << "<br><br>";
                        }
                }
        }
        if (showDebug())
-               debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
+               stream << "defined at " << _menu->file->name << ":"
+                      << _menu->lineno << "<br><br>";
 
-       setText(head + debug + help);
+       setText(info);
 }
 
 QString ConfigInfoView::debug_info(struct symbol *sym)
 {
        QString debug;
+       QTextStream stream(&debug);
 
-       debug += "type: ";
-       debug += print_filter(sym_type_name(sym->type));
+       stream << "type: ";
+       stream << print_filter(sym_type_name(sym->type));
        if (sym_is_choice(sym))
-               debug += " (choice)";
+               stream << " (choice)";
        debug += "<br>";
        if (sym->rev_dep.expr) {
-               debug += "reverse dep: ";
-               expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE);
-               debug += "<br>";
+               stream << "reverse dep: ";
+               expr_print(sym->rev_dep.expr, expr_print_help, &stream, E_NONE);
+               stream << "<br>";
        }
        for (struct property *prop = sym->prop; prop; prop = prop->next) {
                switch (prop->type) {
                case P_PROMPT:
                case P_MENU:
-                       debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
-                       debug += print_filter(prop->text);
-                       debug += "</a><br>";
+                       stream << "prompt: <a href=\"m" << sym->name << "\">";
+                       stream << print_filter(prop->text);
+                       stream << "</a><br>";
                        break;
                case P_DEFAULT:
                case P_SELECT:
@@ -1147,30 +1157,33 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
                case P_COMMENT:
                case P_IMPLY:
                case P_SYMBOL:
-                       debug += prop_get_type_name(prop->type);
-                       debug += ": ";
-                       expr_print(prop->expr, expr_print_help, &debug, E_NONE);
-                       debug += "<br>";
+                       stream << prop_get_type_name(prop->type);
+                       stream << ": ";
+                       expr_print(prop->expr, expr_print_help,
+                                  &stream, E_NONE);
+                       stream << "<br>";
                        break;
                case P_CHOICE:
                        if (sym_is_choice(sym)) {
-                               debug += "choice: ";
-                               expr_print(prop->expr, expr_print_help, &debug, E_NONE);
-                               debug += "<br>";
+                               stream << "choice: ";
+                               expr_print(prop->expr, expr_print_help,
+                                          &stream, E_NONE);
+                               stream << "<br>";
                        }
                        break;
                default:
-                       debug += "unknown property: ";
-                       debug += prop_get_type_name(prop->type);
-                       debug += "<br>";
+                       stream << "unknown property: ";
+                       stream << prop_get_type_name(prop->type);
+                       stream << "<br>";
                }
                if (prop->visible.expr) {
-                       debug += "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
-                       expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE);
-                       debug += "<br>";
+                       stream << "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
+                       expr_print(prop->visible.expr, expr_print_help,
+                                  &stream, E_NONE);
+                       stream << "<br>";
                }
        }
-       debug += "<br>";
+       stream << "<br>";
 
        return debug;
 }
@@ -1208,15 +1221,15 @@ QString ConfigInfoView::print_filter(const QString &str)
 
 void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str)
 {
-       QString* text = reinterpret_cast<QString*>(data);
-       QString str2 = print_filter(str);
+       QTextStream *stream = reinterpret_cast<QTextStream *>(data);
 
        if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
-               *text += QString().sprintf("<a href=\"s%s\">", sym->name);
-               *text += str2;
-               *text += "</a>";
-       } else
-               *text += str2;
+               *stream << "<a href=\"s" << sym->name << "\">";
+               *stream << print_filter(str);
+               *stream << "</a>";
+       } else {
+               *stream << print_filter(str);
+       }
 }
 
 void ConfigInfoView::clicked(const QUrl &url)
@@ -1228,7 +1241,6 @@ void ConfigInfoView::clicked(const QUrl &url)
        struct menu *m = NULL;
 
        if (count < 1) {
-               qInfo() << "Clicked link is empty";
                delete[] data;
                return;
        }
@@ -1241,7 +1253,6 @@ void ConfigInfoView::clicked(const QUrl &url)
        strcat(data, "$");
        result = sym_re_search(data);
        if (!result) {
-               qInfo() << "Clicked symbol is invalid:" << data;
                delete[] data;
                return;
        }
@@ -1268,23 +1279,10 @@ void ConfigInfoView::clicked(const QUrl &url)
        delete data;
 }
 
-QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
-{
-       QMenu* popup = Parent::createStandardContextMenu(pos);
-       QAction* action = new QAction("Show Debug Info", popup);
-
-       action->setCheckable(true);
-       connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
-       connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
-       action->setChecked(showDebug());
-       popup->addSeparator();
-       popup->addAction(action);
-       return popup;
-}
-
-void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e)
+void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
 {
-       Parent::contextMenuEvent(e);
+       contextMenu->popup(event->globalPos());
+       event->accept();
 }
 
 ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
index 461df64..f97376a 100644 (file)
@@ -30,7 +30,7 @@ public:
 };
 
 enum colIdx {
-       promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
+       promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx
 };
 enum listMode {
        singleMode, menuMode, symbolMode, fullMode, listMode
@@ -215,6 +215,7 @@ public:
 class ConfigInfoView : public QTextBrowser {
        Q_OBJECT
        typedef class QTextBrowser Parent;
+       QMenu *contextMenu;
 public:
        ConfigInfoView(QWidget* parent, const char *name = 0);
        bool showDebug(void) const { return _showDebug; }
@@ -235,8 +236,7 @@ protected:
        QString debug_info(struct symbol *sym);
        static QString print_filter(const QString &str);
        static void expr_print_help(void *data, struct symbol *sym, const char *str);
-       QMenu *createStandardContextMenu(const QPoint & pos);
-       void contextMenuEvent(QContextMenuEvent *e);
+       void contextMenuEvent(QContextMenuEvent *event);
 
        struct symbol *sym;
        struct menu *_menu;
index 7b0e13c..f919ebd 100644 (file)
@@ -577,7 +577,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
                        stack = NULL;
                        break;
                }
-               /* fall through - to X_NAME */
+               fallthrough;    /* to X_NAME */
        case AA_X_NAME:
                if (xindex & AA_X_CHILD)
                        /* released by caller */
index 30c246a..fa49b81 100644 (file)
@@ -292,13 +292,13 @@ void aa_apply_modes_to_perms(struct aa_profile *profile, struct aa_perms *perms)
        switch (AUDIT_MODE(profile)) {
        case AUDIT_ALL:
                perms->audit = ALL_PERMS_MASK;
-               /* fall through */
+               fallthrough;
        case AUDIT_NOQUIET:
                perms->quiet = 0;
                break;
        case AUDIT_QUIET:
                perms->audit = 0;
-               /* fall through */
+               fallthrough;
        case AUDIT_QUIET_DENIED:
                perms->quiet = ALL_PERMS_MASK;
                break;
index 372d163..b8848f5 100644 (file)
@@ -223,7 +223,7 @@ static int xattr_verify(enum ima_hooks func, struct integrity_iint_cache *iint,
        case IMA_XATTR_DIGEST_NG:
                /* first byte contains algorithm id */
                hash_start = 1;
-               /* fall through */
+               fallthrough;
        case IMA_XATTR_DIGEST:
                if (iint->flags & IMA_DIGSIG_REQUIRED) {
                        *cause = "IMA-signature-required";
@@ -395,7 +395,7 @@ int ima_appraise_measurement(enum ima_hooks func,
                /* It's fine not to have xattrs when using a modsig. */
                if (try_modsig)
                        break;
-               /* fall through */
+               fallthrough;
        case INTEGRITY_NOLABEL:         /* No security.evm xattr. */
                cause = "missing-HMAC";
                goto out;
index 07f0336..b4de330 100644 (file)
@@ -1279,12 +1279,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
                case Opt_uid_gt:
                case Opt_euid_gt:
                        entry->uid_op = &uid_gt;
-                       /* fall through */
+                       fallthrough;
                case Opt_uid_lt:
                case Opt_euid_lt:
                        if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
                                entry->uid_op = &uid_lt;
-                       /* fall through */
+                       fallthrough;
                case Opt_uid_eq:
                case Opt_euid_eq:
                        uid_token = (token == Opt_uid_eq) ||
@@ -1313,11 +1313,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
                        break;
                case Opt_fowner_gt:
                        entry->fowner_op = &uid_gt;
-                       /* fall through */
+                       fallthrough;
                case Opt_fowner_lt:
                        if (token == Opt_fowner_lt)
                                entry->fowner_op = &uid_lt;
-                       /* fall through */
+                       fallthrough;
                case Opt_fowner_eq:
                        ima_log_string_op(ab, "fowner", args[0].from,
                                          entry->fowner_op);
index 41a5f43..c022ee9 100644 (file)
@@ -77,7 +77,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
                /* skip ':' and '\0' */
                buf_ptr += 2;
                buflen -= buf_ptr - field_data->data;
-               /* fall through */
+               fallthrough;
        case DATA_FMT_DIGEST:
        case DATA_FMT_HEX:
                if (!buflen)
index 7e0232d..1fe8b93 100644 (file)
@@ -465,7 +465,7 @@ key_ref_t search_cred_keyrings_rcu(struct keyring_search_context *ctx)
                case -EAGAIN: /* no key */
                        if (ret)
                                break;
-                       /* fall through */
+                       fallthrough;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;
@@ -487,7 +487,7 @@ key_ref_t search_cred_keyrings_rcu(struct keyring_search_context *ctx)
                case -EAGAIN: /* no key */
                        if (ret)
                                break;
-                       /* fall through */
+                       fallthrough;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;
@@ -509,7 +509,7 @@ key_ref_t search_cred_keyrings_rcu(struct keyring_search_context *ctx)
                case -EAGAIN: /* no key */
                        if (ret)
                                break;
-                       /* fall through */
+                       fallthrough;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;
index e1b9f1a..2da4404 100644 (file)
@@ -295,26 +295,26 @@ static int construct_get_dest_keyring(struct key **_dest_keyring)
                                }
                        }
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_THREAD_KEYRING:
                        dest_keyring = key_get(cred->thread_keyring);
                        if (dest_keyring)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_PROCESS_KEYRING:
                        dest_keyring = key_get(cred->process_keyring);
                        if (dest_keyring)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_SESSION_KEYRING:
                        dest_keyring = key_get(cred->session_keyring);
 
                        if (dest_keyring)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
                        ret = look_up_user_keyrings(NULL, &dest_keyring);
                        if (ret < 0)
index ca90102..a340986 100644 (file)
@@ -3606,26 +3606,20 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case FIONREAD:
-       /* fall through */
        case FIBMAP:
-       /* fall through */
        case FIGETBSZ:
-       /* fall through */
        case FS_IOC_GETFLAGS:
-       /* fall through */
        case FS_IOC_GETVERSION:
                error = file_has_perm(cred, file, FILE__GETATTR);
                break;
 
        case FS_IOC_SETFLAGS:
-       /* fall through */
        case FS_IOC_SETVERSION:
                error = file_has_perm(cred, file, FILE__SETATTR);
                break;
 
        /* sys_ioctl() checks */
        case FIONBIO:
-       /* fall through */
        case FIOASYNC:
                error = file_has_perm(cred, file, 0);
                break;
@@ -3783,7 +3777,7 @@ static int selinux_file_fcntl(struct file *file, unsigned int cmd,
                        err = file_has_perm(cred, file, FILE__WRITE);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case F_SETOWN:
        case F_SETSIG:
        case F_GETFL:
index 408d306..d338962 100644 (file)
@@ -535,7 +535,7 @@ int mls_compute_sid(struct policydb *p,
                                                  scontext, tcontext);
                }
 
-               /* Fallthrough */
+               fallthrough;
        case AVTAB_CHANGE:
                if ((tclass == p->process_class) || sock)
                        /* Use the process MLS attributes. */
@@ -546,8 +546,6 @@ int mls_compute_sid(struct policydb *p,
        case AVTAB_MEMBER:
                /* Use the process effective MLS attributes. */
                return mls_context_cpy_low(newcontext, scontext);
-
-       /* fall through */
        }
        return -EINVAL;
 }
index 8ffbf95..8c0893e 100644 (file)
@@ -3365,7 +3365,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
                 * to set mount options simulate setting the
                 * superblock default.
                 */
-               /* Fall through */
+               fallthrough;
        default:
                /*
                 * This isn't an understood special case.
index c16b8c1..4bee32b 100644 (file)
@@ -1240,7 +1240,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
                        tomoyo_set_space(head);
                        tomoyo_set_string(head, cond->transit->name);
                }
-               /* fall through */
+               fallthrough;
        case 1:
                {
                        const u16 condc = cond->condc;
@@ -1345,12 +1345,12 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
                        }
                }
                head->r.cond_step++;
-               /* fall through */
+               fallthrough;
        case 2:
                if (!tomoyo_flush(head))
                        break;
                head->r.cond_step++;
-               /* fall through */
+               fallthrough;
        case 3:
                if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
                        tomoyo_io_printf(head, " grant_log=%s",
@@ -1639,7 +1639,7 @@ static void tomoyo_read_domain(struct tomoyo_io_buffer *head)
                                        tomoyo_set_string(head, tomoyo_dif[i]);
                        head->r.index = 0;
                        head->r.step++;
-                       /* fall through */
+                       fallthrough;
                case 1:
                        while (head->r.index < TOMOYO_MAX_ACL_GROUPS) {
                                i = head->r.index++;
@@ -1652,14 +1652,14 @@ static void tomoyo_read_domain(struct tomoyo_io_buffer *head)
                        head->r.index = 0;
                        head->r.step++;
                        tomoyo_set_lf(head);
-                       /* fall through */
+                       fallthrough;
                case 2:
                        if (!tomoyo_read_domain2(head, &domain->acl_info_list))
                                return;
                        head->r.step++;
                        if (!tomoyo_set_lf(head))
                                return;
-                       /* fall through */
+                       fallthrough;
                case 3:
                        head->r.step = 0;
                        if (head->r.print_this_domain_only)
@@ -2088,7 +2088,7 @@ int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...)
                /* Check max_learning_entry parameter. */
                if (tomoyo_domain_quota_is_ok(r))
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
@@ -2710,13 +2710,13 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,
                case TOMOYO_DOMAINPOLICY:
                        if (tomoyo_select_domain(head, cp0))
                                continue;
-                       /* fall through */
+                       fallthrough;
                case TOMOYO_EXCEPTIONPOLICY:
                        if (!strcmp(cp0, "select transition_only")) {
                                head->r.print_transition_related_only = true;
                                continue;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        if (!tomoyo_manager()) {
                                error = -EPERM;
index 86f7d1b..051f729 100644 (file)
@@ -927,7 +927,7 @@ int tomoyo_path2_perm(const u8 operation, const struct path *path1,
        case TOMOYO_TYPE_LINK:
                if (!d_is_dir(path1->dentry))
                        break;
-               /* fall through */
+               fallthrough;
        case TOMOYO_TYPE_PIVOT_ROOT:
                tomoyo_add_slash(&buf1);
                tomoyo_add_slash(&buf2);
index 09ddab5..9766f6a 100644 (file)
@@ -46,6 +46,18 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
        INIT_LIST_HEAD(&bus->hlink_list);
        init_waitqueue_head(&bus->rirb_wq);
        bus->irq = -1;
+
+       /*
+        * Default value of '8' is as per the HD audio specification (Rev 1.0a).
+        * Following relation is used to derive STRIPE control value.
+        *  For sample rate <= 48K:
+        *   { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }
+        *  For sample rate > 48K:
+        *   { ((num_channels * bits_per_sample * rate/48000) /
+        *      number of SDOs) >= 8 }
+        */
+       bus->sdo_limit = 8;
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
index 011b17c..b98449f 100644 (file)
@@ -529,17 +529,6 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
 
        bus->chip_init = true;
 
-       /*
-        * Default value of '8' is as per the HD audio specification (Rev 1.0a).
-        * Following relation is used to derive STRIPE control value.
-        *  For sample rate <= 48K:
-        *   { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }
-        *  For sample rate > 48K:
-        *   { ((num_channels * bits_per_sample * rate/48000) /
-        *      number of SDOs) >= 8 }
-        */
-       bus->sdo_limit = 8;
-
        return true;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_bus_init_chip);
index 5363d88..2e5a5c5 100644 (file)
@@ -308,7 +308,7 @@ static inline int verify_mpu401(const struct snd_mpu401 *mpu)
 }
 
 /*
- * This is apparently the standard way to initailise an MPU-401
+ * This is apparently the standard way to initialise an MPU-401
  */
 static inline void initialise_mpu401(const struct snd_mpu401 *mpu)
 {
@@ -339,7 +339,7 @@ static void soundscape_free(struct snd_card *c)
 }
 
 /*
- * Tell the SoundScape to begin a DMA tranfer using the given channel.
+ * Tell the SoundScape to begin a DMA transfer using the given channel.
  * All locking issues are left to the caller.
  */
 static void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg)
@@ -803,7 +803,7 @@ static int mpu401_open(struct snd_mpu401 *mpu)
 }
 
 /*
- * Initialse an MPU-401 subdevice for MIDI support on the SoundScape.
+ * Initialise an MPU-401 subdevice for MIDI support on the SoundScape.
  */
 static int create_mpu401(struct snd_card *card, int devnum,
                         unsigned long port, int irq)
index 7f9d352..a1fa983 100644 (file)
@@ -7694,6 +7694,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
        SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
+       SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
+       SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
        SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
@@ -7955,6 +7957,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
        {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
        {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
        {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
+       {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
        {}
 };
 #define ALC225_STANDARD_PINS \
index b8161a0..58bb49f 100644 (file)
@@ -227,14 +227,14 @@ static int snd_ps3_program_dma(struct snd_ps3_card_info *card,
        switch (filltype) {
        case SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL:
                silent = 1;
-               /* intentionally fall thru */
+               fallthrough;
        case SND_PS3_DMA_FILLTYPE_FIRSTFILL:
                ch0_kick_event = PS3_AUDIO_KICK_EVENT_ALWAYS;
                break;
 
        case SND_PS3_DMA_FILLTYPE_SILENT_RUNNING:
                silent = 1;
-               /* intentionally fall thru */
+               fallthrough;
        case SND_PS3_DMA_FILLTYPE_RUNNING:
                ch0_kick_event = PS3_AUDIO_KICK_EVENT_SERIALOUT0_EMPTY;
                break;
index 55815fd..406526e 100644 (file)
@@ -138,7 +138,7 @@ static int acp3x_1015_hw_params(struct snd_pcm_substream *substream,
        srate = params_rate(params);
 
        for_each_rtd_codec_dais(rtd, i, codec_dai) {
-               if (strcmp(codec_dai->component->name, "rt1015-aif"))
+               if (strcmp(codec_dai->name, "rt1015-aif"))
                        continue;
                ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
                if (ret < 0)
index 623dfd3..7b14d9a 100644 (file)
@@ -314,40 +314,30 @@ static int acp_pdm_dma_close(struct snd_soc_component *component,
        return 0;
 }
 
-static int acp_pdm_dai_hw_params(struct snd_pcm_substream *substream,
-                                struct snd_pcm_hw_params *params,
-                                struct snd_soc_dai *dai)
+static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream,
+                              int cmd, struct snd_soc_dai *dai)
 {
        struct pdm_stream_instance *rtd;
+       int ret;
+       bool pdm_status;
        unsigned int ch_mask;
 
        rtd = substream->runtime->private_data;
-       switch (params_channels(params)) {
+       ret = 0;
+       switch (substream->runtime->channels) {
        case TWO_CH:
                ch_mask = 0x00;
                break;
        default:
                return -EINVAL;
        }
-       rn_writel(ch_mask, rtd->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS);
-       rn_writel(PDM_DECIMATION_FACTOR, rtd->acp_base +
-                 ACP_WOV_PDM_DECIMATION_FACTOR);
-       return 0;
-}
-
-static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream,
-                              int cmd, struct snd_soc_dai *dai)
-{
-       struct pdm_stream_instance *rtd;
-       int ret;
-       bool pdm_status;
-
-       rtd = substream->runtime->private_data;
-       ret = 0;
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_RESUME:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+               rn_writel(ch_mask, rtd->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS);
+               rn_writel(PDM_DECIMATION_FACTOR, rtd->acp_base +
+                         ACP_WOV_PDM_DECIMATION_FACTOR);
                rtd->bytescount = acp_pdm_get_byte_count(rtd,
                                                         substream->stream);
                pdm_status = check_pdm_dma_status(rtd->acp_base);
@@ -369,7 +359,6 @@ static int acp_pdm_dai_trigger(struct snd_pcm_substream *substream,
 }
 
 static struct snd_soc_dai_ops acp_pdm_dai_ops = {
-       .hw_params = acp_pdm_dai_hw_params,
        .trigger   = acp_pdm_dai_trigger,
 };
 
index 3cb6388..04acc18 100644 (file)
@@ -536,7 +536,7 @@ static int mchp_i2s_mcc_hw_params(struct snd_pcm_substream *substream,
                /* cpu is BCLK master */
                mrb |= MCHP_I2SMCC_MRB_CLKSEL_INT;
                set_divs = 1;
-               /* fall through */
+               fallthrough;
        case SND_SOC_DAIFMT_CBM_CFM:
                /* cpu is slave */
                mra |= MCHP_I2SMCC_MRA_MODE_SLAVE;
index c0a28f0..298689a 100644 (file)
@@ -202,7 +202,7 @@ static int jz4770_codec_set_bias_level(struct snd_soc_component *codec,
                                   REG_CR_VIC_SB_SLEEP, REG_CR_VIC_SB_SLEEP);
                regmap_update_bits(regmap, JZ4770_CODEC_REG_CR_VIC,
                                   REG_CR_VIC_SB, REG_CR_VIC_SB);
-       /* fall-through */
+               fallthrough;
        default:
                break;
        }
index 4428c62..3ddd822 100644 (file)
@@ -19,8 +19,8 @@
 
 #define CDC_D_REVISION1                        (0xf000)
 #define CDC_D_PERPH_SUBTYPE            (0xf005)
-#define CDC_D_INT_EN_SET               (0x015)
-#define CDC_D_INT_EN_CLR               (0x016)
+#define CDC_D_INT_EN_SET               (0xf015)
+#define CDC_D_INT_EN_CLR               (0xf016)
 #define MBHC_SWITCH_INT                        BIT(7)
 #define MBHC_MIC_ELECTRICAL_INS_REM_DET        BIT(6)
 #define MBHC_BUTTON_PRESS_DET          BIT(5)
index f0da559..b8845f4 100644 (file)
@@ -401,7 +401,7 @@ static int pcm186x_set_fmt(struct snd_soc_dai *dai, unsigned int format)
                break;
        case SND_SOC_DAIFMT_DSP_A:
                priv->tdm_offset += 1;
-               /* fall through */
+               fallthrough;
                /* DSP_A uses the same basic config as DSP_B
                 * except we need to shift the TDM output by one BCK cycle
                 */
index 68a3b48..3bce9a1 100644 (file)
@@ -412,8 +412,12 @@ int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
                  struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+       struct wm8994 *control = dev_get_drvdata(component->dev->parent);
        int i;
 
+       if (control->type != WM8958)
+               return 0;
+
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
        case SND_SOC_DAPM_PRE_PMU:
index 317916c..0623a22 100644 (file)
@@ -151,7 +151,6 @@ static const struct reg_default wm8962_reg[] = {
        { 40, 0x0000 },   /* R40    - SPKOUTL volume */
        { 41, 0x0000 },   /* R41    - SPKOUTR volume */
 
-       { 48, 0x0000 },   /* R48    - Additional control(4) */
        { 49, 0x0010 },   /* R49    - Class D Control 1 */
        { 51, 0x0003 },   /* R51    - Class D Control 2 */
 
@@ -842,6 +841,7 @@ static bool wm8962_readable_register(struct device *dev, unsigned int reg)
        case WM8962_SPKOUTL_VOLUME:
        case WM8962_SPKOUTR_VOLUME:
        case WM8962_THERMAL_SHUTDOWN_STATUS:
+       case WM8962_ADDITIONAL_CONTROL_4:
        case WM8962_CLASS_D_CONTROL_1:
        case WM8962_CLASS_D_CONTROL_2:
        case WM8962_CLOCKING_4:
index a84ae87..038be66 100644 (file)
 #define WM8994_NUM_DRC 3
 #define WM8994_NUM_EQ  3
 
-static struct {
+struct wm8994_reg_mask {
        unsigned int reg;
        unsigned int mask;
-} wm8994_vu_bits[] = {
+};
+
+static struct wm8994_reg_mask wm8994_vu_bits[] = {
        { WM8994_LEFT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
        { WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
        { WM8994_LEFT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
@@ -60,14 +62,10 @@ static struct {
 
        { WM8994_AIF1_DAC1_LEFT_VOLUME, WM8994_AIF1DAC1_VU },
        { WM8994_AIF1_DAC1_RIGHT_VOLUME, WM8994_AIF1DAC1_VU },
-       { WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
-       { WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
        { WM8994_AIF2_DAC_LEFT_VOLUME, WM8994_AIF2DAC_VU },
        { WM8994_AIF2_DAC_RIGHT_VOLUME, WM8994_AIF2DAC_VU },
        { WM8994_AIF1_ADC1_LEFT_VOLUME, WM8994_AIF1ADC1_VU },
        { WM8994_AIF1_ADC1_RIGHT_VOLUME, WM8994_AIF1ADC1_VU },
-       { WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
-       { WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
        { WM8994_AIF2_ADC_LEFT_VOLUME, WM8994_AIF2ADC_VU },
        { WM8994_AIF2_ADC_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
        { WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_VU },
@@ -76,6 +74,14 @@ static struct {
        { WM8994_DAC2_RIGHT_VOLUME, WM8994_DAC2_VU },
 };
 
+/* VU bitfields for ADC2, DAC2 not available on WM1811 */
+static struct wm8994_reg_mask wm8994_adc2_dac2_vu_bits[] = {
+       { WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
+       { WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
+       { WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
+       { WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
+};
+
 static int wm8994_drc_base[] = {
        WM8994_AIF1_DRC1_1,
        WM8994_AIF1_DRC2_1,
@@ -1030,6 +1036,26 @@ static bool wm8994_check_class_w_digital(struct snd_soc_component *component)
        return true;
 }
 
+static void wm8994_update_vu_bits(struct snd_soc_component *component)
+{
+       struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component);
+       struct wm8994 *control = wm8994->wm8994;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
+               snd_soc_component_write(component, wm8994_vu_bits[i].reg,
+                                       snd_soc_component_read(component,
+                                                      wm8994_vu_bits[i].reg));
+       if (control->type == WM1811)
+               return;
+
+       for (i = 0; i < ARRAY_SIZE(wm8994_adc2_dac2_vu_bits); i++)
+               snd_soc_component_write(component,
+                               wm8994_adc2_dac2_vu_bits[i].reg,
+                               snd_soc_component_read(component,
+                                       wm8994_adc2_dac2_vu_bits[i].reg));
+}
+
 static int aif_mclk_set(struct snd_soc_component *component, int aif, bool enable)
 {
        struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component);
@@ -1076,7 +1102,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
        struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component);
        struct wm8994 *control = wm8994->wm8994;
        int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
-       int ret, i;
+       int ret;
        int dac;
        int adc;
        int val;
@@ -1144,10 +1170,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
                break;
 
        case SND_SOC_DAPM_POST_PMU:
-               for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
-                       snd_soc_component_write(component, wm8994_vu_bits[i].reg,
-                                     snd_soc_component_read(component,
-                                                  wm8994_vu_bits[i].reg));
+               wm8994_update_vu_bits(component);
                break;
 
        case SND_SOC_DAPM_PRE_PMD:
@@ -1181,7 +1204,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
                      struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
-       int ret, i;
+       int ret;
        int dac;
        int adc;
        int val;
@@ -1237,10 +1260,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
                break;
 
        case SND_SOC_DAPM_POST_PMU:
-               for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
-                       snd_soc_component_write(component, wm8994_vu_bits[i].reg,
-                                     snd_soc_component_read(component,
-                                                  wm8994_vu_bits[i].reg));
+               wm8994_update_vu_bits(component);
                break;
 
        case SND_SOC_DAPM_PRE_PMD:
@@ -4346,6 +4366,14 @@ static int wm8994_component_probe(struct snd_soc_component *component)
                                    wm8994_vu_bits[i].mask,
                                    wm8994_vu_bits[i].mask);
 
+       if (control->type != WM1811) {
+               for (i = 0; i < ARRAY_SIZE(wm8994_adc2_dac2_vu_bits); i++)
+                       snd_soc_component_update_bits(component,
+                                       wm8994_adc2_dac2_vu_bits[i].reg,
+                                       wm8994_adc2_dac2_vu_bits[i].mask,
+                                       wm8994_adc2_dac2_vu_bits[i].mask);
+       }
+
        /* Set the low bit of the 3D stereo depth so TLV matches */
        snd_soc_component_update_bits(component, WM8994_AIF1_DAC1_FILTERS_2,
                            1 << WM8994_AIF1DAC1_3D_GAIN_SHIFT,
index de136c0..52adedc 100644 (file)
@@ -73,6 +73,7 @@ struct cpu_priv {
  * @codec_priv: CODEC private data
  * @cpu_priv: CPU private data
  * @card: ASoC card structure
+ * @streams: Mask of current active streams
  * @sample_rate: Current sample rate
  * @sample_format: Current sample format
  * @asrc_rate: ASRC sample rate used by Back-Ends
@@ -89,6 +90,7 @@ struct fsl_asoc_card_priv {
        struct codec_priv codec_priv;
        struct cpu_priv cpu_priv;
        struct snd_soc_card card;
+       u8 streams;
        u32 sample_rate;
        snd_pcm_format_t sample_format;
        u32 asrc_rate;
@@ -151,21 +153,17 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
        bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+       struct codec_priv *codec_priv = &priv->codec_priv;
        struct cpu_priv *cpu_priv = &priv->cpu_priv;
        struct device *dev = rtd->card->dev;
+       unsigned int pll_out;
        int ret;
 
        priv->sample_rate = params_rate(params);
        priv->sample_format = params_format(params);
+       priv->streams |= BIT(substream->stream);
 
-       /*
-        * If codec-dai is DAI Master and all configurations are already in the
-        * set_bias_level(), bypass the remaining settings in hw_params().
-        * Note: (dai_fmt & CBM_CFM) includes CBM_CFM and CBM_CFS.
-        */
-       if ((priv->card.set_bias_level &&
-            priv->dai_fmt & SND_SOC_DAIFMT_CBM_CFM) ||
-           fsl_asoc_card_is_ac97(priv))
+       if (fsl_asoc_card_is_ac97(priv))
                return 0;
 
        /* Specific configurations of DAIs starts from here */
@@ -174,7 +172,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
                                     cpu_priv->sysclk_dir[tx]);
        if (ret && ret != -ENOTSUPP) {
                dev_err(dev, "failed to set sysclk for cpu dai\n");
-               return ret;
+               goto fail;
        }
 
        if (cpu_priv->slot_width) {
@@ -182,6 +180,68 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
                                               cpu_priv->slot_width);
                if (ret && ret != -ENOTSUPP) {
                        dev_err(dev, "failed to set TDM slot for cpu dai\n");
+                       goto fail;
+               }
+       }
+
+       /* Specific configuration for PLL */
+       if (codec_priv->pll_id && codec_priv->fll_id) {
+               if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
+                       pll_out = priv->sample_rate * 384;
+               else
+                       pll_out = priv->sample_rate * 256;
+
+               ret = snd_soc_dai_set_pll(asoc_rtd_to_codec(rtd, 0),
+                                         codec_priv->pll_id,
+                                         codec_priv->mclk_id,
+                                         codec_priv->mclk_freq, pll_out);
+               if (ret) {
+                       dev_err(dev, "failed to start FLL: %d\n", ret);
+                       goto fail;
+               }
+
+               ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0),
+                                            codec_priv->fll_id,
+                                            pll_out, SND_SOC_CLOCK_IN);
+
+               if (ret && ret != -ENOTSUPP) {
+                       dev_err(dev, "failed to set SYSCLK: %d\n", ret);
+                       goto fail;
+               }
+       }
+
+       return 0;
+
+fail:
+       priv->streams &= ~BIT(substream->stream);
+       return ret;
+}
+
+static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream)
+{
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+       struct codec_priv *codec_priv = &priv->codec_priv;
+       struct device *dev = rtd->card->dev;
+       int ret;
+
+       priv->streams &= ~BIT(substream->stream);
+
+       if (!priv->streams && codec_priv->pll_id && codec_priv->fll_id) {
+               /* Force freq to be 0 to avoid error message in codec */
+               ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0),
+                                            codec_priv->mclk_id,
+                                            0,
+                                            SND_SOC_CLOCK_IN);
+               if (ret) {
+                       dev_err(dev, "failed to switch away from FLL: %d\n", ret);
+                       return ret;
+               }
+
+               ret = snd_soc_dai_set_pll(asoc_rtd_to_codec(rtd, 0),
+                                         codec_priv->pll_id, 0, 0, 0);
+               if (ret && ret != -ENOTSUPP) {
+                       dev_err(dev, "failed to stop FLL: %d\n", ret);
                        return ret;
                }
        }
@@ -191,6 +251,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
 
 static const struct snd_soc_ops fsl_asoc_card_ops = {
        .hw_params = fsl_asoc_card_hw_params,
+       .hw_free = fsl_asoc_card_hw_free,
 };
 
 static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
@@ -254,75 +315,6 @@ static struct snd_soc_dai_link fsl_asoc_card_dai[] = {
        },
 };
 
-static int fsl_asoc_card_set_bias_level(struct snd_soc_card *card,
-                                       struct snd_soc_dapm_context *dapm,
-                                       enum snd_soc_bias_level level)
-{
-       struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card);
-       struct snd_soc_pcm_runtime *rtd;
-       struct snd_soc_dai *codec_dai;
-       struct codec_priv *codec_priv = &priv->codec_priv;
-       struct device *dev = card->dev;
-       unsigned int pll_out;
-       int ret;
-
-       rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
-       codec_dai = asoc_rtd_to_codec(rtd, 0);
-       if (dapm->dev != codec_dai->dev)
-               return 0;
-
-       switch (level) {
-       case SND_SOC_BIAS_PREPARE:
-               if (dapm->bias_level != SND_SOC_BIAS_STANDBY)
-                       break;
-
-               if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
-                       pll_out = priv->sample_rate * 384;
-               else
-                       pll_out = priv->sample_rate * 256;
-
-               ret = snd_soc_dai_set_pll(codec_dai, codec_priv->pll_id,
-                                         codec_priv->mclk_id,
-                                         codec_priv->mclk_freq, pll_out);
-               if (ret) {
-                       dev_err(dev, "failed to start FLL: %d\n", ret);
-                       return ret;
-               }
-
-               ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->fll_id,
-                                            pll_out, SND_SOC_CLOCK_IN);
-               if (ret && ret != -ENOTSUPP) {
-                       dev_err(dev, "failed to set SYSCLK: %d\n", ret);
-                       return ret;
-               }
-               break;
-
-       case SND_SOC_BIAS_STANDBY:
-               if (dapm->bias_level != SND_SOC_BIAS_PREPARE)
-                       break;
-
-               ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id,
-                                            codec_priv->mclk_freq,
-                                            SND_SOC_CLOCK_IN);
-               if (ret && ret != -ENOTSUPP) {
-                       dev_err(dev, "failed to switch away from FLL: %d\n", ret);
-                       return ret;
-               }
-
-               ret = snd_soc_dai_set_pll(codec_dai, codec_priv->pll_id, 0, 0, 0);
-               if (ret) {
-                       dev_err(dev, "failed to stop FLL: %d\n", ret);
-                       return ret;
-               }
-               break;
-
-       default:
-               break;
-       }
-
-       return 0;
-}
-
 static int fsl_asoc_card_audmux_init(struct device_node *np,
                                     struct fsl_asoc_card_priv *priv)
 {
@@ -611,7 +603,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
        /* Diversify the card configurations */
        if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
                codec_dai_name = "cs42888";
-               priv->card.set_bias_level = NULL;
                priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq;
                priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq;
                priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
@@ -628,26 +619,22 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
                priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
        } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) {
                codec_dai_name = "wm8962";
-               priv->card.set_bias_level = fsl_asoc_card_set_bias_level;
                priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK;
                priv->codec_priv.fll_id = WM8962_SYSCLK_FLL;
                priv->codec_priv.pll_id = WM8962_FLL;
                priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
        } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) {
                codec_dai_name = "wm8960-hifi";
-               priv->card.set_bias_level = fsl_asoc_card_set_bias_level;
                priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO;
                priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO;
                priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
        } else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) {
                codec_dai_name = "ac97-hifi";
-               priv->card.set_bias_level = NULL;
                priv->dai_fmt = SND_SOC_DAIFMT_AC97;
                priv->card.dapm_routes = audio_map_ac97;
                priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_ac97);
        } else if (of_device_is_compatible(np, "fsl,imx-audio-mqs")) {
                codec_dai_name = "fsl-mqs-dai";
-               priv->card.set_bias_level = NULL;
                priv->dai_fmt = SND_SOC_DAIFMT_LEFT_J |
                                SND_SOC_DAIFMT_CBS_CFS |
                                SND_SOC_DAIFMT_NB_NF;
@@ -657,7 +644,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
                priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
        } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8524")) {
                codec_dai_name = "wm8524-hifi";
-               priv->card.set_bias_level = NULL;
                priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
                priv->dai_link[1].dpcm_capture = 0;
                priv->dai_link[2].dpcm_capture = 0;
index d8b9c65..404be27 100644 (file)
@@ -898,7 +898,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
                                        "missing baudclk for master mode\n");
                                return -EINVAL;
                        }
-                       /* fall through */
+                       fallthrough;
                case SND_SOC_DAIFMT_CBM_CFS:
                        ssi->i2s_net |= SSI_SCR_I2S_MODE_MASTER;
                        break;
index 9e4f66b..2319848 100644 (file)
@@ -339,7 +339,6 @@ static int psc_dma_new(struct snd_soc_component *component,
 static void psc_dma_free(struct snd_soc_component *component,
                         struct snd_pcm *pcm)
 {
-       struct snd_soc_pcm_runtime *rtd = pcm->private_data;
        struct snd_pcm_substream *substream;
        int stream;
 
index fd5dcd6..907f5f1 100644 (file)
@@ -261,13 +261,13 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
        switch (params_format(params)) {
        case SNDRV_PCM_FORMAT_U16_LE:
                signed_data = HII2S_I2S_CFG__S2_CODEC_DATA_FORMAT;
-               /* fall through */
+               fallthrough;
        case SNDRV_PCM_FORMAT_S16_LE:
                bits = HII2S_BITS_16;
                break;
        case SNDRV_PCM_FORMAT_U24_LE:
                signed_data = HII2S_I2S_CFG__S2_CODEC_DATA_FORMAT;
-               /* fall through */
+               fallthrough;
        case SNDRV_PCM_FORMAT_S24_LE:
                bits = HII2S_BITS_24;
                break;
index 49b9f18..b1cac7a 100644 (file)
@@ -331,7 +331,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
 
        ret_val = power_up_sst(stream);
        if (ret_val < 0)
-               return ret_val;
+               goto out_power_up;
 
        /* Make sure, that the period size is always even */
        snd_pcm_hw_constraint_step(substream->runtime, 0,
@@ -340,8 +340,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
        return snd_pcm_hw_constraint_integer(runtime,
                         SNDRV_PCM_HW_PARAM_PERIODS);
 out_ops:
-       kfree(stream);
        mutex_unlock(&sst_lock);
+out_power_up:
+       kfree(stream);
        return ret_val;
 }
 
index 54a66cc..d2cda33 100644 (file)
@@ -181,7 +181,7 @@ static int sst_byt_pcm_trigger(struct snd_soc_component *component,
                break;
        case SNDRV_PCM_TRIGGER_SUSPEND:
                pdata->restore_stream = false;
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                sst_byt_stream_pause(byt, pcm_data->stream);
                break;
index 414ae4b..7ae34b4 100644 (file)
@@ -573,7 +573,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
                        break;
                default:
                        dev_err(dev, "get speaker GPIO failed: %d\n", ret);
-                       /* fall through */
+                       fallthrough;
                case -EPROBE_DEFER:
                        return ret;
                }
index 4e28975..688b5e0 100644 (file)
@@ -1009,7 +1009,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
                        default:
                                dev_err(&pdev->dev, "Failed to get ext-amp-enable GPIO: %d\n",
                                        ret_val);
-                               /* fall through */
+                               fallthrough;
                        case -EPROBE_DEFER:
                                put_device(codec_dev);
                                return ret_val;
@@ -1029,7 +1029,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
                        default:
                                dev_err(&pdev->dev, "Failed to get hp-detect GPIO: %d\n",
                                        ret_val);
-                               /* fall through */
+                               fallthrough;
                        case -EPROBE_DEFER:
                                put_device(codec_dev);
                                return ret_val;
index 5dee55e..bbe8d78 100644 (file)
@@ -488,7 +488,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
                                                        stream->lpib);
                        snd_hdac_ext_stream_set_lpib(stream, stream->lpib);
                }
-               /* fall through */
+               fallthrough;
 
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
index 36df309..c8664ab 100644 (file)
@@ -58,17 +58,17 @@ int axg_tdm_set_tdm_slots(struct snd_soc_dai *dai, u32 *tx_mask,
        switch (slot_width) {
        case 0:
                slot_width = 32;
-               /* Fall-through */
+               fallthrough;
        case 32:
                fmt |= SNDRV_PCM_FMTBIT_S32_LE;
-               /* Fall-through */
+               fallthrough;
        case 24:
                fmt |= SNDRV_PCM_FMTBIT_S24_LE;
                fmt |= SNDRV_PCM_FMTBIT_S20_LE;
-               /* Fall-through */
+               fallthrough;
        case 16:
                fmt |= SNDRV_PCM_FMTBIT_S16_LE;
-               /* Fall-through */
+               fallthrough;
        case 8:
                fmt |= SNDRV_PCM_FMTBIT_S8;
                break;
@@ -133,7 +133,7 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
        case SND_SOC_DAIFMT_CBS_CFM:
        case SND_SOC_DAIFMT_CBM_CFS:
                dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
-               /* Fall-through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index d1e09ad..c4e7307 100644 (file)
@@ -488,7 +488,7 @@ static int pxa_ssp_configure_dai_fmt(struct ssp_priv *priv)
 
        case SND_SOC_DAIFMT_DSP_A:
                sspsp |= SSPSP_FSRT;
-               /* fall through */
+               fallthrough;
        case SND_SOC_DAIFMT_DSP_B:
                sscr0 |= SSCR0_MOD | SSCR0_PSP;
                sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
index 2a5302f..0168af8 100644 (file)
@@ -1150,206 +1150,206 @@ static int q6afe_of_xlate_dai_name(struct snd_soc_component *component,
 }
 
 static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = {
-       SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_1_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_2_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_3_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_4_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_5_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_IN("SLIMBUS_6_RX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_TX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_TX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_2_TX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_TX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_TX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_TX", NULL, 0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_TX", NULL, 0, 0, 0, 0),
+       SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_1_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_2_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_3_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_4_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_5_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_IN("SLIMBUS_6_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_2_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_MI2S_RX", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_MI2S_TX", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_MI2S_RX", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_MI2S_TX", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_MI2S_RX", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_MI2S_TX", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_MI2S_RX_SD1",
                        "Secondary MI2S Playback SD1",
-                       0, 0, 0, 0),
+                       0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRI_MI2S_RX", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRI_MI2S_TX", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
 
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_0", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_1", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_2", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_3", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_4", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_5", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_6", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_7", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_0", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_1", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_2", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_3", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_4", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_5", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_6", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_7", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
 
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_0", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_1", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_2", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_3", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_4", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_5", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_6", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_7", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_0", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_1", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_2", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_3", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_4", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_5", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_6", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_7", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
 
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_0", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_1", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_2", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_3", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_4", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_5", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_6", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_7", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_0", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_1", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_2", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_3", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_4", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_5", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_6", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_7", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
 
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_0", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_1", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_2", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_3", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_4", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_5", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_6", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_7", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_0", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_1", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_2", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_3", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_4", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_5", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_6", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_7", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
 
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_0", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_1", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_2", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_3", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_4", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_5", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_6", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_7", NULL,
-                            0, 0, 0, 0),
+                            0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_0", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_1", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_2", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_3", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_4", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_5", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_6", NULL,
-                                               0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
        SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_7", NULL,
-                                               0, 0, 0, 0),
-       SND_SOC_DAPM_AIF_OUT("DISPLAY_PORT_RX", "NULL", 0, 0, 0, 0),
+                                               0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("DISPLAY_PORT_RX", "NULL", 0, SND_SOC_NOPM, 0, 0),
 };
 
 static const struct snd_soc_component_driver q6afe_dai_component = {
index eaa95b5..25d23e0 100644 (file)
@@ -973,6 +973,20 @@ static int msm_routing_probe(struct snd_soc_component *c)
        return 0;
 }
 
+static unsigned int q6routing_reg_read(struct snd_soc_component *component,
+                                      unsigned int reg)
+{
+       /* default value */
+       return 0;
+}
+
+static int q6routing_reg_write(struct snd_soc_component *component,
+                              unsigned int reg, unsigned int val)
+{
+       /* dummy */
+       return 0;
+}
+
 static const struct snd_soc_component_driver msm_soc_routing_component = {
        .probe = msm_routing_probe,
        .name = DRV_NAME,
@@ -981,6 +995,8 @@ static const struct snd_soc_component_driver msm_soc_routing_component = {
        .num_dapm_widgets = ARRAY_SIZE(msm_qdsp6_widgets),
        .dapm_routes = intercon,
        .num_dapm_routes = ARRAY_SIZE(intercon),
+       .read = q6routing_reg_read,
+       .write = q6routing_reg_write,
 };
 
 static int q6pcm_routing_probe(struct platform_device *pdev)
index 1707414..5adb293 100644 (file)
@@ -229,13 +229,13 @@ static int rockchip_pdm_hw_params(struct snd_pcm_substream *substream,
        switch (params_channels(params)) {
        case 8:
                val |= PDM_PATH3_EN;
-               /* fallthrough */
+               fallthrough;
        case 6:
                val |= PDM_PATH2_EN;
-               /* fallthrough */
+               fallthrough;
        case 4:
                val |= PDM_PATH1_EN;
-               /* fallthrough */
+               fallthrough;
        case 2:
                val |= PDM_PATH0_EN;
                break;
index 1431be4..a2221eb 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_SOC_SAMSUNG
        tristate "ASoC support for Samsung"
-       depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
+       depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
        depends on COMMON_CLK
        select SND_SOC_GENERIC_DMAENGINE_PCM
        help
index b8f0057..8aa78ff 100644 (file)
@@ -15,9 +15,6 @@
 #include <sound/jack.h>
 
 #include "regs-iis.h"
-#include <asm/mach-types.h>
-
-#include <mach/gpio-samsung.h>
 #include "s3c24xx-i2s.h"
 
 static const unsigned int rates[] = {
@@ -31,6 +28,8 @@ static const struct snd_pcm_hw_constraint_list hw_rates = {
        .list = rates,
 };
 
+static struct gpio_desc *gpiod_speaker_power;
+
 static struct snd_soc_jack hp_jack;
 
 static struct snd_soc_jack_pin hp_jack_pins[] = {
@@ -47,7 +46,6 @@ static struct snd_soc_jack_pin hp_jack_pins[] = {
 
 static struct snd_soc_jack_gpio hp_jack_gpios[] = {
        {
-               .gpio                   = S3C2410_GPG(4),
                .name                   = "hp-gpio",
                .report                 = SND_JACK_HEADPHONE,
                .invert                 = 1,
@@ -123,9 +121,9 @@ static int h1940_spk_power(struct snd_soc_dapm_widget *w,
                                struct snd_kcontrol *kcontrol, int event)
 {
        if (SND_SOC_DAPM_EVENT_ON(event))
-               gpio_set_value(S3C_GPIO_END + 9, 1);
+               gpiod_set_value(gpiod_speaker_power, 1);
        else
-               gpio_set_value(S3C_GPIO_END + 9, 0);
+               gpiod_set_value(gpiod_speaker_power, 0);
 
        return 0;
 }
@@ -151,8 +149,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
        {"VINM", NULL, "Mic Jack"},
 };
 
-static struct platform_device *s3c24xx_snd_device;
-
 static int h1940_uda1380_init(struct snd_soc_pcm_runtime *rtd)
 {
        snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
@@ -194,55 +190,34 @@ static struct snd_soc_card h1940_asoc = {
        .num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
-static int __init h1940_init(void)
+static int h1940_probe(struct platform_device *pdev)
 {
-       int ret;
+       struct device *dev = &pdev->dev;
 
-       if (!machine_is_h1940())
-               return -ENODEV;
+       h1940_asoc.dev = dev;
+       hp_jack_gpios[0].gpiod_dev = dev;
+       gpiod_speaker_power = devm_gpiod_get(&pdev->dev, "speaker-power",
+                                            GPIOD_OUT_LOW);
 
-       /* configure some gpios */
-       ret = gpio_request(S3C_GPIO_END + 9, "speaker-power");
-       if (ret)
-               goto err_out;
-
-       ret = gpio_direction_output(S3C_GPIO_END + 9, 0);
-       if (ret)
-               goto err_gpio;
-
-       s3c24xx_snd_device = platform_device_alloc("soc-audio", -1);
-       if (!s3c24xx_snd_device) {
-               ret = -ENOMEM;
-               goto err_gpio;
+       if (IS_ERR(gpiod_speaker_power)) {
+               dev_err(dev, "Could not get gpio\n");
+               return PTR_ERR(gpiod_speaker_power);
        }
 
-       platform_set_drvdata(s3c24xx_snd_device, &h1940_asoc);
-       ret = platform_device_add(s3c24xx_snd_device);
-
-       if (ret)
-               goto err_plat;
-
-       return 0;
-
-err_plat:
-       platform_device_put(s3c24xx_snd_device);
-err_gpio:
-       gpio_free(S3C_GPIO_END + 9);
-
-err_out:
-       return ret;
-}
-
-static void __exit h1940_exit(void)
-{
-       platform_device_unregister(s3c24xx_snd_device);
-       gpio_free(S3C_GPIO_END + 9);
+       return devm_snd_soc_register_card(dev, &h1940_asoc);
 }
 
-module_init(h1940_init);
-module_exit(h1940_exit);
+static struct platform_driver h1940_audio_driver = {
+       .driver = {
+               .name = "h1940-audio",
+               .pm = &snd_soc_pm_ops,
+       },
+       .probe = h1940_probe,
+};
+module_platform_driver(h1940_audio_driver);
 
 /* Module information */
 MODULE_AUTHOR("Arnaud Patard, Vasily Khoruzhick");
 MODULE_DESCRIPTION("ALSA SoC H1940");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:h1940-audio");
index 80ecb5c..df53d4e 100644 (file)
@@ -733,7 +733,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
        switch (params_channels(params)) {
        case 6:
                val |= MOD_DC2_EN;
-               /* Fall through */
+               fallthrough;
        case 4:
                val |= MOD_DC1_EN;
                break;
index 54317e0..9266070 100644 (file)
 
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 
 #include <sound/soc.h>
 
-#include <mach/gpio-samsung.h>
-#include <asm/mach-types.h>
 #include "regs-iis.h"
-
 #include "../codecs/wm8753.h"
 #include "s3c24xx-i2s.h"
 
@@ -166,6 +163,7 @@ static struct snd_soc_ops neo1973_voice_ops = {
        .hw_free = neo1973_voice_hw_free,
 };
 
+static struct gpio_desc *gpiod_hp_in, *gpiod_amp_shut;
 static int gta02_speaker_enabled;
 
 static int lm4853_set_spk(struct snd_kcontrol *kcontrol,
@@ -173,7 +171,7 @@ static int lm4853_set_spk(struct snd_kcontrol *kcontrol,
 {
        gta02_speaker_enabled = ucontrol->value.integer.value[0];
 
-       gpio_set_value(S3C2410_GPJ(2), !gta02_speaker_enabled);
+       gpiod_set_value(gpiod_hp_in, !gta02_speaker_enabled);
 
        return 0;
 }
@@ -188,7 +186,7 @@ static int lm4853_get_spk(struct snd_kcontrol *kcontrol,
 static int lm4853_event(struct snd_soc_dapm_widget *w,
                        struct snd_kcontrol *k, int event)
 {
-       gpio_set_value(S3C2410_GPJ(1), SND_SOC_DAPM_EVENT_OFF(event));
+       gpiod_set_value(gpiod_amp_shut, SND_SOC_DAPM_EVENT_OFF(event));
 
        return 0;
 }
@@ -308,13 +306,8 @@ static struct snd_soc_codec_conf neo1973_codec_conf[] = {
        },
 };
 
-static const struct gpio neo1973_gta02_gpios[] = {
-       { S3C2410_GPJ(2), GPIOF_OUT_INIT_HIGH, "GTA02_HP_IN" },
-       { S3C2410_GPJ(1), GPIOF_OUT_INIT_HIGH, "GTA02_AMP_SHUT" },
-};
-
 static struct snd_soc_card neo1973 = {
-       .name = "neo1973",
+       .name = "neo1973gta02",
        .owner = THIS_MODULE,
        .dai_link = neo1973_dai,
        .num_links = ARRAY_SIZE(neo1973_dai),
@@ -332,62 +325,36 @@ static struct snd_soc_card neo1973 = {
        .fully_routed = true,
 };
 
-static struct platform_device *neo1973_snd_device;
-
-static int __init neo1973_init(void)
+static int neo1973_probe(struct platform_device *pdev)
 {
-       int ret;
-
-       if (!machine_is_neo1973_gta02())
-               return -ENODEV;
+       struct device *dev = &pdev->dev;
 
-       if (machine_is_neo1973_gta02()) {
-               neo1973.name = "neo1973gta02";
-               neo1973.num_aux_devs = 1;
-
-               ret = gpio_request_array(neo1973_gta02_gpios,
-                               ARRAY_SIZE(neo1973_gta02_gpios));
-               if (ret)
-                       return ret;
+       gpiod_hp_in = devm_gpiod_get(dev, "hp", GPIOD_OUT_HIGH);
+       if (IS_ERR(gpiod_hp_in)) {
+               dev_err(dev, "missing gpio %s\n", "hp");
+               return PTR_ERR(gpiod_hp_in);
        }
-
-       neo1973_snd_device = platform_device_alloc("soc-audio", -1);
-       if (!neo1973_snd_device) {
-               ret = -ENOMEM;
-               goto err_gpio_free;
+       gpiod_amp_shut = devm_gpiod_get(dev, "amp-shut", GPIOD_OUT_HIGH);
+       if (IS_ERR(gpiod_amp_shut)) {
+               dev_err(dev, "missing gpio %s\n", "amp-shut");
+               return PTR_ERR(gpiod_amp_shut);
        }
 
-       platform_set_drvdata(neo1973_snd_device, &neo1973);
-       ret = platform_device_add(neo1973_snd_device);
-
-       if (ret)
-               goto err_put_device;
-
-       return 0;
-
-err_put_device:
-       platform_device_put(neo1973_snd_device);
-err_gpio_free:
-       if (machine_is_neo1973_gta02()) {
-               gpio_free_array(neo1973_gta02_gpios,
-                               ARRAY_SIZE(neo1973_gta02_gpios));
-       }
-       return ret;
+       neo1973.dev = dev;
+       return devm_snd_soc_register_card(dev, &neo1973);
 }
-module_init(neo1973_init);
-
-static void __exit neo1973_exit(void)
-{
-       platform_device_unregister(neo1973_snd_device);
 
-       if (machine_is_neo1973_gta02()) {
-               gpio_free_array(neo1973_gta02_gpios,
-                               ARRAY_SIZE(neo1973_gta02_gpios));
-       }
-}
-module_exit(neo1973_exit);
+struct platform_driver neo1973_audio = {
+       .driver = {
+               .name = "neo1973-audio",
+               .pm = &snd_soc_pm_ops,
+       },
+       .probe = neo1973_probe,
+};
+module_platform_driver(neo1973_audio);
 
 /* Module information */
 MODULE_AUTHOR("Graeme Gregory, graeme@openmoko.org, www.openmoko.org");
 MODULE_DESCRIPTION("ALSA SoC WM8753 Neo1973 and Frerunner");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:neo1973-audio");
index 08f7c82..400a7f7 100644 (file)
 //          Vasily Khoruzhick <anarsoul@gmail.com>
 
 #include <linux/types.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 
 #include <sound/soc.h>
 #include <sound/jack.h>
 
-#include <mach/gpio-samsung.h>
 #include "regs-iis.h"
-#include <asm/mach-types.h>
-
 #include "s3c24xx-i2s.h"
 
 static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd);
@@ -58,7 +55,6 @@ static struct snd_soc_jack_pin hp_jack_pins[] = {
 
 static struct snd_soc_jack_gpio hp_jack_gpios[] = {
        [0] = {
-               .gpio                   = S3C2410_GPG(12),
                .name                   = "hp-gpio",
                .report                 = SND_JACK_HEADPHONE,
                .invert                 = 1,
@@ -123,8 +119,6 @@ static struct snd_soc_card rx1950_asoc = {
        .num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
-static struct platform_device *s3c24xx_snd_device;
-
 static int rx1950_startup(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
@@ -134,13 +128,15 @@ static int rx1950_startup(struct snd_pcm_substream *substream)
                                        &hw_rates);
 }
 
+struct gpio_desc *gpiod_speaker_power;
+
 static int rx1950_spk_power(struct snd_soc_dapm_widget *w,
                                struct snd_kcontrol *kcontrol, int event)
 {
        if (SND_SOC_DAPM_EVENT_ON(event))
-               gpio_set_value(S3C2410_GPA(1), 1);
+               gpiod_set_value(gpiod_speaker_power, 1);
        else
-               gpio_set_value(S3C2410_GPA(1), 0);
+               gpiod_set_value(gpiod_speaker_power, 0);
 
        return 0;
 }
@@ -214,57 +210,35 @@ static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd)
        return 0;
 }
 
-static int __init rx1950_init(void)
+static int rx1950_probe(struct platform_device *pdev)
 {
-       int ret;
-
-       if (!machine_is_rx1950())
-               return -ENODEV;
+       struct device *dev = &pdev->dev;
 
        /* configure some gpios */
-       ret = gpio_request(S3C2410_GPA(1), "speaker-power");
-       if (ret)
-               goto err_gpio;
-
-       ret = gpio_direction_output(S3C2410_GPA(1), 0);
-       if (ret)
-               goto err_gpio_conf;
-
-       s3c24xx_snd_device = platform_device_alloc("soc-audio", -1);
-       if (!s3c24xx_snd_device) {
-               ret = -ENOMEM;
-               goto err_plat_alloc;
-       }
-
-       platform_set_drvdata(s3c24xx_snd_device, &rx1950_asoc);
-       ret = platform_device_add(s3c24xx_snd_device);
-
-       if (ret) {
-               platform_device_put(s3c24xx_snd_device);
-               goto err_plat_add;
+       gpiod_speaker_power = devm_gpiod_get(dev, "speaker-power", GPIOD_OUT_LOW);
+       if (IS_ERR(gpiod_speaker_power)) {
+               dev_err(dev, "cannot get gpio\n");
+               return PTR_ERR(gpiod_speaker_power);
        }
 
-       return 0;
-
-err_plat_add:
-err_plat_alloc:
-err_gpio_conf:
-       gpio_free(S3C2410_GPA(1));
+       hp_jack_gpios[0].gpiod_dev = dev;
+       rx1950_asoc.dev = dev;
 
-err_gpio:
-       return ret;
+       return devm_snd_soc_register_card(dev, &rx1950_asoc);
 }
 
-static void __exit rx1950_exit(void)
-{
-       platform_device_unregister(s3c24xx_snd_device);
-       gpio_free(S3C2410_GPA(1));
-}
+struct platform_driver rx1950_audio = {
+       .driver = {
+               .name = "rx1950-audio",
+               .pm = &snd_soc_pm_ops,
+       },
+       .probe = rx1950_probe,
+};
 
-module_init(rx1950_init);
-module_exit(rx1950_exit);
+module_platform_driver(rx1950_audio);
 
 /* Module information */
 MODULE_AUTHOR("Vasily Khoruzhick");
 MODULE_DESCRIPTION("ALSA SoC RX1950");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:rx1950-audio");
index ed21786..e948118 100644 (file)
@@ -616,8 +616,7 @@ int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info,
 EXPORT_SYMBOL_GPL(s3c_i2sv2_iis_calc_rate);
 
 int s3c_i2sv2_probe(struct snd_soc_dai *dai,
-                   struct s3c_i2sv2_info *i2s,
-                   unsigned long base)
+                   struct s3c_i2sv2_info *i2s)
 {
        struct device *dev = dai->dev;
        unsigned int iismod;
index fe42b77..8c6fc0d 100644 (file)
@@ -83,8 +83,7 @@ extern int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info,
  * @base: The base address for the registers.
  */
 extern int s3c_i2sv2_probe(struct snd_soc_dai *dai,
-                          struct s3c_i2sv2_info *i2s,
-                          unsigned long base);
+                          struct s3c_i2sv2_info *i2s);
 
 /**
  * s3c_i2sv2_cleanup - cleanup resources allocated in s3c_i2sv2_probe
index b35d828..81f416a 100644 (file)
@@ -19,9 +19,6 @@
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
-#include <mach/gpio-samsung.h>
-#include <plat/gpio-cfg.h>
-
 #include "dma.h"
 #include "regs-i2s-v2.h"
 #include "s3c2412-i2s.h"
@@ -49,7 +46,7 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
        snd_soc_dai_init_dma_data(dai, &s3c2412_i2s_pcm_stereo_out,
                                        &s3c2412_i2s_pcm_stereo_in);
 
-       ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS);
+       ret = s3c_i2sv2_probe(dai, &s3c2412_i2s);
        if (ret)
                return ret;
 
@@ -70,10 +67,6 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
        if (ret)
                goto err;
 
-       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
-       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
-                             S3C_GPIO_PULL_NONE);
-
        return 0;
 
 err:
index 60bfaed..50c0800 100644 (file)
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
-#include <mach/gpio-samsung.h>
-#include <plat/gpio-cfg.h>
 #include "regs-iis.h"
-
 #include "dma.h"
 #include "s3c24xx-i2s.h"
 
@@ -348,10 +345,6 @@ static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
        if (ret)
                return ret;
 
-       /* Configure the I2S pins (GPE0...GPE4) in correct mode */
-       s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
-                             S3C_GPIO_PULL_NONE);
-
        writel(S3C2410_IISCON_IISEN, s3c24xx_i2s.regs + S3C2410_IISCON);
 
        s3c24xx_snd_txctrl(0);
index f0b4f4b..5504b92 100644 (file)
@@ -406,7 +406,7 @@ static unsigned int soc_component_read_no_lock(
                ret = -EIO;
 
        if (ret < 0)
-               soc_component_ret(component, ret);
+               return soc_component_ret(component, ret);
 
        return val;
 }
index 2fe1b2e..663e383 100644 (file)
@@ -618,7 +618,7 @@ int snd_soc_suspend(struct device *dev)
                                                "ASoC: idle_bias_off CODEC on over suspend\n");
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
 
                        case SND_SOC_BIAS_OFF:
                                snd_soc_component_suspend(component);
index cee9986..5b60379 100644 (file)
@@ -1057,7 +1057,7 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
                                        ec->hdr.name);
                                goto err_denum;
                        }
-                       /* fall through */
+                       fallthrough;
                case SND_SOC_TPLG_CTL_ENUM:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
@@ -1445,7 +1445,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
                                        ec->hdr.name);
                                goto err_se;
                        }
-                       /* fall through */
+                       fallthrough;
                case SND_SOC_TPLG_CTL_ENUM:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
index df1c699..c6cb8c2 100644 (file)
@@ -310,7 +310,7 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
                        return ret;
                }
 
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                snd_hdac_ext_link_stream_start(link_dev);
@@ -333,7 +333,7 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
 
                link_dev->link_prepared = 0;
 
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                snd_hdac_ext_link_stream_clear(link_dev);
                break;
index d730e43..71c3f29 100644 (file)
@@ -361,7 +361,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
                        return ret;
                }
 
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_START:
                if (spcm->stream[substream->stream].suspend_ignored) {
                        /*
@@ -386,7 +386,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
                        spcm->stream[substream->stream].suspend_ignored = true;
                        return 0;
                }
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_STOP:
                stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP;
                ipc_first = true;
index fe71171..0cbe31e 100644 (file)
@@ -71,7 +71,7 @@ static int tegra186_dspk_put_control(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
-static int tegra186_dspk_runtime_suspend(struct device *dev)
+static int __maybe_unused tegra186_dspk_runtime_suspend(struct device *dev)
 {
        struct tegra186_dspk *dspk = dev_get_drvdata(dev);
 
@@ -83,7 +83,7 @@ static int tegra186_dspk_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int tegra186_dspk_runtime_resume(struct device *dev)
+static int __maybe_unused tegra186_dspk_runtime_resume(struct device *dev)
 {
        struct tegra186_dspk *dspk = dev_get_drvdata(dev);
        int err;
index 4894e8e..1268046 100644 (file)
@@ -219,7 +219,7 @@ static const struct regmap_config tegra186_admaif_regmap_config = {
        .cache_type             = REGCACHE_FLAT,
 };
 
-static int tegra_admaif_runtime_suspend(struct device *dev)
+static int __maybe_unused tegra_admaif_runtime_suspend(struct device *dev)
 {
        struct tegra_admaif *admaif = dev_get_drvdata(dev);
 
@@ -229,7 +229,7 @@ static int tegra_admaif_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int tegra_admaif_runtime_resume(struct device *dev)
+static int __maybe_unused tegra_admaif_runtime_resume(struct device *dev)
 {
        struct tegra_admaif *admaif = dev_get_drvdata(dev);
 
index 5123a96..66287a7 100644 (file)
@@ -564,7 +564,7 @@ static const struct of_device_id tegra_ahub_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_ahub_of_match);
 
-static int tegra_ahub_runtime_suspend(struct device *dev)
+static int __maybe_unused tegra_ahub_runtime_suspend(struct device *dev)
 {
        struct tegra_ahub *ahub = dev_get_drvdata(dev);
 
@@ -576,7 +576,7 @@ static int tegra_ahub_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int tegra_ahub_runtime_resume(struct device *dev)
+static int __maybe_unused tegra_ahub_runtime_resume(struct device *dev)
 {
        struct tegra_ahub *ahub = dev_get_drvdata(dev);
        int err;
index d682414..a661f40 100644 (file)
@@ -40,7 +40,7 @@ static const struct reg_default tegra210_dmic_reg_defaults[] = {
        { TEGRA210_DMIC_LP_BIQUAD_1_COEF_4, 0x0 },
 };
 
-static int tegra210_dmic_runtime_suspend(struct device *dev)
+static int __maybe_unused tegra210_dmic_runtime_suspend(struct device *dev)
 {
        struct tegra210_dmic *dmic = dev_get_drvdata(dev);
 
@@ -52,7 +52,7 @@ static int tegra210_dmic_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int tegra210_dmic_runtime_resume(struct device *dev)
+static int __maybe_unused tegra210_dmic_runtime_resume(struct device *dev)
 {
        struct tegra210_dmic *dmic = dev_get_drvdata(dev);
        int err;
index 7220921..a383bd5 100644 (file)
@@ -164,7 +164,7 @@ static int tegra210_i2s_init(struct snd_soc_dapm_widget *w,
        return tegra210_i2s_sw_reset(compnt, is_playback);
 }
 
-static int tegra210_i2s_runtime_suspend(struct device *dev)
+static int __maybe_unused tegra210_i2s_runtime_suspend(struct device *dev)
 {
        struct tegra210_i2s *i2s = dev_get_drvdata(dev);
 
@@ -176,7 +176,7 @@ static int tegra210_i2s_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int tegra210_i2s_runtime_resume(struct device *dev)
+static int __maybe_unused tegra210_i2s_runtime_resume(struct device *dev)
 {
        struct tegra210_i2s *i2s = dev_get_drvdata(dev);
        int err;
index d89b5c9..dd34504 100644 (file)
@@ -289,7 +289,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
                 * rate is lowered.
                 */
                inv_fs = true;
-               /* fall through */
+               fallthrough;
        case SND_SOC_DAIFMT_DSP_A:
                dev->mode = MOD_DSP_A;
                break;
index 2802a33..ed217b3 100644 (file)
@@ -46,7 +46,7 @@ static void n810_ext_control(struct snd_soc_dapm_context *dapm)
        switch (n810_jack_func) {
        case N810_JACK_HS:
                line1l = 1;
-               /* fall through */
+               fallthrough;
        case N810_JACK_HP:
                hp = 1;
                break;
index 01abf1b..a26588e 100644 (file)
@@ -203,10 +203,10 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
        switch (channels) {
        case 6:
                dmic->ch_enabled |= OMAP_DMIC_UP3_ENABLE;
-               /* fall through */
+               fallthrough;
        case 4:
                dmic->ch_enabled |= OMAP_DMIC_UP2_ENABLE;
-               /* fall through */
+               fallthrough;
        case 2:
                dmic->ch_enabled |= OMAP_DMIC_UP1_ENABLE;
                break;
index d482b62..fafb299 100644 (file)
@@ -309,19 +309,19 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
                        /* up to 3 channels for capture */
                        return -EINVAL;
                link_mask |= 1 << 4;
-               /* fall through */
+               fallthrough;
        case 4:
                if (stream == SNDRV_PCM_STREAM_CAPTURE)
                        /* up to 3 channels for capture */
                        return -EINVAL;
                link_mask |= 1 << 3;
-               /* fall through */
+               fallthrough;
        case 3:
                link_mask |= 1 << 2;
-               /* fall through */
+               fallthrough;
        case 2:
                link_mask |= 1 << 1;
-               /* fall through */
+               fallthrough;
        case 1:
                link_mask |= 1 << 0;
                break;
index 2176a95..a2629cc 100644 (file)
@@ -55,7 +55,7 @@ static void rx51_ext_control(struct snd_soc_dapm_context *dapm)
                break;
        case RX51_JACK_HS:
                hs = 1;
-               /* fall through */
+               fallthrough;
        case RX51_JACK_HP:
                hp = 1;
                break;
index 568cde6..1c1a44e 100644 (file)
@@ -294,7 +294,7 @@ static int zx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
                        zx_i2s_rx_dma_en(zx_i2s->reg_base, true);
                else
                        zx_i2s_tx_dma_en(zx_i2s->reg_base, true);
-       /* fall thru */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_RESUME:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                if (capture)
@@ -308,7 +308,7 @@ static int zx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
                        zx_i2s_rx_dma_en(zx_i2s->reg_base, false);
                else
                        zx_i2s_tx_dma_en(zx_i2s->reg_base, false);
-       /* fall thru */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_SUSPEND:
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                if (capture)
index a3a07c0..b4168bd 100644 (file)
@@ -218,7 +218,7 @@ static int zx_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
                val = readl_relaxed(zx_spdif->reg_base + ZX_FIFOCTRL);
                val |= ZX_FIFOCTRL_TX_FIFO_RST;
                writel_relaxed(val, zx_spdif->reg_base + ZX_FIFOCTRL);
-       /* fall thru */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_RESUME:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                zx_spdif_cfg_tx(zx_spdif->reg_base, true);
index 6b0f3a8..81e987e 100644 (file)
@@ -2371,7 +2371,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
        int num_ins;
        struct usb_mixer_elem_info *cval;
        struct snd_kcontrol *kctl;
-       int i, err, nameid, type, len;
+       int i, err, nameid, type, len, val;
        const struct procunit_info *info;
        const struct procunit_value_info *valinfo;
        const struct usbmix_name_map *map;
@@ -2474,6 +2474,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
                        break;
                }
 
+               err = get_cur_ctl_value(cval, cval->control << 8, &val);
+               if (err < 0) {
+                       usb_mixer_elem_info_free(cval);
+                       return -EINVAL;
+               }
+
                kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
                if (!kctl) {
                        usb_mixer_elem_info_free(cval);
index d79e3dd..f4fb002 100644 (file)
@@ -2678,6 +2678,10 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                .ifnum = QUIRK_ANY_INTERFACE,
                .type = QUIRK_COMPOSITE,
                .data = (const struct snd_usb_audio_quirk[]) {
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_STANDARD_MIXER,
+                       },
                        {
                                .ifnum = 0,
                                .type = QUIRK_AUDIO_FIXED_ENDPOINT,
@@ -2690,6 +2694,32 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                                        .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
                                        .endpoint = 0x01,
                                        .ep_attr = USB_ENDPOINT_XFER_ISOC,
+                                       .datainterval = 1,
+                                       .maxpacksize = 0x024c,
+                                       .rates = SNDRV_PCM_RATE_44100 |
+                                                SNDRV_PCM_RATE_48000,
+                                       .rate_min = 44100,
+                                       .rate_max = 48000,
+                                       .nr_rates = 2,
+                                       .rate_table = (unsigned int[]) {
+                                               44100, 48000
+                                       }
+                               }
+                       },
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
+                               .data = &(const struct audioformat) {
+                                       .formats = SNDRV_PCM_FMTBIT_S24_3LE,
+                                       .channels = 2,
+                                       .iface = 0,
+                                       .altsetting = 1,
+                                       .altset_idx = 1,
+                                       .attributes = 0,
+                                       .endpoint = 0x82,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC,
+                                       .datainterval = 1,
+                                       .maxpacksize = 0x0126,
                                        .rates = SNDRV_PCM_RATE_44100 |
                                                 SNDRV_PCM_RATE_48000,
                                        .rate_min = 44100,
@@ -3714,8 +3744,8 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
  * they pretend to be 96kHz mono as a workaround for stereo being broken
  * by that...
  *
- * They also have swapped L-R channels, but that's for userspace to deal
- * with.
+ * They also have an issue with initial stream alignment that causes the
+ * channels to be swapped and out of phase, which is dealt with in quirks.c.
  */
 {
        .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
index ede162f..0e93107 100644 (file)
@@ -67,7 +67,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d,
        if (!info->btf_id || !info->nr_func_info ||
            btf__get_from_id(info->btf_id, &prog_btf))
                goto print;
-       finfo = (struct bpf_func_info *)info->func_info;
+       finfo = u64_to_ptr(info->func_info);
        func_type = btf__type_by_id(prog_btf, finfo->type_id);
        if (!func_type || !btf_is_func(func_type))
                goto print;
index 8a4c2b3..f611846 100644 (file)
@@ -143,6 +143,20 @@ static int codegen_datasec_def(struct bpf_object *obj,
                              var_name, align);
                        return -EINVAL;
                }
+               /* Assume 32-bit architectures when generating data section
+                * struct memory layout. Given bpftool can't know which target
+                * host architecture it's emitting skeleton for, we need to be
+                * conservative and assume 32-bit one to ensure enough padding
+                * bytes are generated for pointer and long types. This will
+                * still work correctly for 64-bit architectures, because in
+                * the worst case we'll generate unnecessary padding field,
+                * which on 64-bit architectures is not strictly necessary and
+                * would be handled by natural 8-byte alignment. But it still
+                * will be a correct memory layout, based on recorded offsets
+                * in BTF.
+                */
+               if (align > 4)
+                       align = 4;
 
                align_off = (off + align - 1) / align * align;
                if (align_off != need_off) {
@@ -397,7 +411,7 @@ static int do_skeleton(int argc, char **argv)
                {                                                           \n\
                        struct %1$s *obj;                                   \n\
                                                                            \n\
-                       obj = (typeof(obj))calloc(1, sizeof(*obj));         \n\
+                       obj = (struct %1$s *)calloc(1, sizeof(*obj));       \n\
                        if (!obj)                                           \n\
                                return NULL;                                \n\
                        if (%1$s__create_skeleton(obj))                     \n\
@@ -461,7 +475,7 @@ static int do_skeleton(int argc, char **argv)
                {                                                           \n\
                        struct bpf_object_skeleton *s;                      \n\
                                                                            \n\
-                       s = (typeof(s))calloc(1, sizeof(*s));               \n\
+                       s = (struct bpf_object_skeleton *)calloc(1, sizeof(*s));\n\
                        if (!s)                                             \n\
                                return -1;                                  \n\
                        obj->skeleton = s;                                  \n\
@@ -479,7 +493,7 @@ static int do_skeleton(int argc, char **argv)
                                /* maps */                                  \n\
                                s->map_cnt = %zu;                           \n\
                                s->map_skel_sz = sizeof(*s->maps);          \n\
-                               s->maps = (typeof(s->maps))calloc(s->map_cnt, s->map_skel_sz);\n\
+                               s->maps = (struct bpf_map_skeleton *)calloc(s->map_cnt, s->map_skel_sz);\n\
                                if (!s->maps)                               \n\
                                        goto err;                           \n\
                        ",
@@ -515,7 +529,7 @@ static int do_skeleton(int argc, char **argv)
                                /* programs */                              \n\
                                s->prog_cnt = %zu;                          \n\
                                s->prog_skel_sz = sizeof(*s->progs);        \n\
-                               s->progs = (typeof(s->progs))calloc(s->prog_cnt, s->prog_skel_sz);\n\
+                               s->progs = (struct bpf_prog_skeleton *)calloc(s->prog_cnt, s->prog_skel_sz);\n\
                                if (!s->progs)                              \n\
                                        goto err;                           \n\
                        ",
index 1b79375..a89f09e 100644 (file)
@@ -106,7 +106,7 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)
        switch (info->type) {
        case BPF_LINK_TYPE_RAW_TRACEPOINT:
                jsonw_string_field(json_wtr, "tp_name",
-                                  (const char *)info->raw_tracepoint.tp_name);
+                                  u64_to_ptr(info->raw_tracepoint.tp_name));
                break;
        case BPF_LINK_TYPE_TRACING:
                err = get_prog_info(info->prog_id, &prog_info);
@@ -185,7 +185,7 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)
        switch (info->type) {
        case BPF_LINK_TYPE_RAW_TRACEPOINT:
                printf("\n\ttp '%s'  ",
-                      (const char *)info->raw_tracepoint.tp_name);
+                      (const char *)u64_to_ptr(info->raw_tracepoint.tp_name));
                break;
        case BPF_LINK_TYPE_TRACING:
                err = get_prog_info(info->prog_id, &prog_info);
index e3a79b5..c46e521 100644 (file)
 /* Make sure we do not use kernel-only integer typedefs */
 #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
 
-#define ptr_to_u64(ptr)        ((__u64)(unsigned long)(ptr))
+static inline __u64 ptr_to_u64(const void *ptr)
+{
+       return (__u64)(unsigned long)ptr;
+}
+
+static inline void *u64_to_ptr(__u64 ptr)
+{
+       return (void *)(unsigned long)ptr;
+}
 
 #define NEXT_ARG()     ({ argc--; argv++; if (argc < 0) usage(); })
 #define NEXT_ARGP()    ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); })
index e3b1163..df7d8ec 100644 (file)
@@ -134,6 +134,8 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
        while (true) {
                ret = read(fd, buf, sizeof(buf));
                if (ret < 0) {
+                       if (errno == EAGAIN)
+                               continue;
                        err = -errno;
                        p_err("failed to read PID iterator output: %d", err);
                        goto out;
index 158995d..d393eb8 100644 (file)
@@ -428,14 +428,14 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
                        p_info("no instructions returned");
                        return -1;
                }
-               buf = (unsigned char *)(info->jited_prog_insns);
+               buf = u64_to_ptr(info->jited_prog_insns);
                member_len = info->jited_prog_len;
        } else {        /* DUMP_XLATED */
                if (info->xlated_prog_len == 0 || !info->xlated_prog_insns) {
                        p_err("error retrieving insn dump: kernel.kptr_restrict set?");
                        return -1;
                }
-               buf = (unsigned char *)info->xlated_prog_insns;
+               buf = u64_to_ptr(info->xlated_prog_insns);
                member_len = info->xlated_prog_len;
        }
 
@@ -444,7 +444,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
                return -1;
        }
 
-       func_info = (void *)info->func_info;
+       func_info = u64_to_ptr(info->func_info);
 
        if (info->nr_line_info) {
                prog_linfo = bpf_prog_linfo__new(info);
@@ -462,7 +462,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
 
                n = write(fd, buf, member_len);
                close(fd);
-               if (n != member_len) {
+               if (n != (ssize_t)member_len) {
                        p_err("error writing output file: %s",
                              n < 0 ? strerror(errno) : "short write");
                        return -1;
@@ -492,13 +492,13 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
                        __u32 i;
                        if (info->nr_jited_ksyms) {
                                kernel_syms_load(&dd);
-                               ksyms = (__u64 *) info->jited_ksyms;
+                               ksyms = u64_to_ptr(info->jited_ksyms);
                        }
 
                        if (json_output)
                                jsonw_start_array(json_wtr);
 
-                       lens = (__u32 *) info->jited_func_lens;
+                       lens = u64_to_ptr(info->jited_func_lens);
                        for (i = 0; i < info->nr_jited_func_lens; i++) {
                                if (ksyms) {
                                        sym = kernel_syms_search(&dd, ksyms[i]);
@@ -559,7 +559,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
        } else {
                kernel_syms_load(&dd);
                dd.nr_jited_ksyms = info->nr_jited_ksyms;
-               dd.jited_ksyms = (__u64 *) info->jited_ksyms;
+               dd.jited_ksyms = u64_to_ptr(info->jited_ksyms);
                dd.btf = btf;
                dd.func_info = func_info;
                dd.finfo_rec_size = info->func_info_rec_size;
@@ -1681,7 +1681,7 @@ static char *profile_target_name(int tgt_fd)
                goto out;
        }
 
-       func_info = (struct bpf_func_info *)(info_linear->info.func_info);
+       func_info = u64_to_ptr(info_linear->info.func_info);
        t = btf__type_by_id(btf, func_info[0].type_id);
        if (!t) {
                p_err("btf %d doesn't have type %d",
index 4d9ecb9..0def0bb 100644 (file)
@@ -233,6 +233,39 @@ static struct btf_id *add_symbol(struct rb_root *root, char *name, size_t size)
        return btf_id__add(root, id, false);
 }
 
+/*
+ * The data of compressed section should be aligned to 4
+ * (for 32bit) or 8 (for 64 bit) bytes. The binutils ld
+ * sets sh_addralign to 1, which makes libelf fail with
+ * misaligned section error during the update:
+ *    FAILED elf_update(WRITE): invalid section alignment
+ *
+ * While waiting for ld fix, we fix the compressed sections
+ * sh_addralign value manualy.
+ */
+static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh)
+{
+       int expected = gelf_getclass(elf) == ELFCLASS32 ? 4 : 8;
+
+       if (!(sh->sh_flags & SHF_COMPRESSED))
+               return 0;
+
+       if (sh->sh_addralign == expected)
+               return 0;
+
+       pr_debug2(" - fixing wrong alignment sh_addralign %u, expected %u\n",
+                 sh->sh_addralign, expected);
+
+       sh->sh_addralign = expected;
+
+       if (gelf_update_shdr(scn, sh) == 0) {
+               printf("FAILED cannot update section header: %s\n",
+                       elf_errmsg(-1));
+               return -1;
+       }
+       return 0;
+}
+
 static int elf_collect(struct object *obj)
 {
        Elf_Scn *scn = NULL;
@@ -309,6 +342,9 @@ static int elf_collect(struct object *obj)
                        obj->efile.idlist_shndx = idx;
                        obj->efile.idlist_addr  = sh.sh_addr;
                }
+
+               if (compressed_section_fix(elf, scn, &sh))
+                       return -1;
        }
 
        return 0;
index 0480f89..b6238b2 100644 (file)
@@ -767,7 +767,7 @@ union bpf_attr {
  *
  *             Also, note that **bpf_trace_printk**\ () is slow, and should
  *             only be used for debugging purposes. For this reason, a notice
- *             bloc (spanning several lines) is printed to kernel logs and
+ *             block (spanning several lines) is printed to kernel logs and
  *             states that the helper should not be used "for production use"
  *             the first time this helper is used (or more precisely, when
  *             **trace_printk**\ () buffers are allocated). For passing values
@@ -1033,14 +1033,14 @@ union bpf_attr {
  *
  *                     int ret;
  *                     struct bpf_tunnel_key key = {};
- *                     
+ *
  *                     ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
  *                     if (ret < 0)
  *                             return TC_ACT_SHOT;     // drop packet
- *                     
+ *
  *                     if (key.remote_ipv4 != 0x0a000001)
  *                             return TC_ACT_SHOT;     // drop packet
- *                     
+ *
  *                     return TC_ACT_OK;               // accept packet
  *
  *             This interface can also be used with all encapsulation devices
@@ -1147,7 +1147,7 @@ union bpf_attr {
  *     Description
  *             Retrieve the realm or the route, that is to say the
  *             **tclassid** field of the destination for the *skb*. The
- *             indentifier retrieved is a user-provided tag, similar to the
+ *             identifier retrieved is a user-provided tag, similar to the
  *             one used with the net_cls cgroup (see description for
  *             **bpf_get_cgroup_classid**\ () helper), but here this tag is
  *             held by a route (a destination entry), not by a task.
index bc14db7..e9a4ecd 100644 (file)
@@ -40,7 +40,7 @@
  * Helper macro to manipulate data structures
  */
 #ifndef offsetof
-#define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
+#define offsetof(TYPE, MEMBER) ((unsigned long)&((TYPE *)0)->MEMBER)
 #endif
 #ifndef container_of
 #define container_of(ptr, type, member)                                \
index 4843e44..7dfca70 100644 (file)
@@ -41,6 +41,7 @@ struct btf {
        __u32 types_size;
        __u32 data_size;
        int fd;
+       int ptr_sz;
 };
 
 static inline __u64 ptr_to_u64(const void *ptr)
@@ -221,6 +222,70 @@ const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 type_id)
        return btf->types[type_id];
 }
 
+static int determine_ptr_size(const struct btf *btf)
+{
+       const struct btf_type *t;
+       const char *name;
+       int i;
+
+       for (i = 1; i <= btf->nr_types; i++) {
+               t = btf__type_by_id(btf, i);
+               if (!btf_is_int(t))
+                       continue;
+
+               name = btf__name_by_offset(btf, t->name_off);
+               if (!name)
+                       continue;
+
+               if (strcmp(name, "long int") == 0 ||
+                   strcmp(name, "long unsigned int") == 0) {
+                       if (t->size != 4 && t->size != 8)
+                               continue;
+                       return t->size;
+               }
+       }
+
+       return -1;
+}
+
+static size_t btf_ptr_sz(const struct btf *btf)
+{
+       if (!btf->ptr_sz)
+               ((struct btf *)btf)->ptr_sz = determine_ptr_size(btf);
+       return btf->ptr_sz < 0 ? sizeof(void *) : btf->ptr_sz;
+}
+
+/* Return pointer size this BTF instance assumes. The size is heuristically
+ * determined by looking for 'long' or 'unsigned long' integer type and
+ * recording its size in bytes. If BTF type information doesn't have any such
+ * type, this function returns 0. In the latter case, native architecture's
+ * pointer size is assumed, so will be either 4 or 8, depending on
+ * architecture that libbpf was compiled for. It's possible to override
+ * guessed value by using btf__set_pointer_size() API.
+ */
+size_t btf__pointer_size(const struct btf *btf)
+{
+       if (!btf->ptr_sz)
+               ((struct btf *)btf)->ptr_sz = determine_ptr_size(btf);
+
+       if (btf->ptr_sz < 0)
+               /* not enough BTF type info to guess */
+               return 0;
+
+       return btf->ptr_sz;
+}
+
+/* Override or set pointer size in bytes. Only values of 4 and 8 are
+ * supported.
+ */
+int btf__set_pointer_size(struct btf *btf, size_t ptr_sz)
+{
+       if (ptr_sz != 4 && ptr_sz != 8)
+               return -EINVAL;
+       btf->ptr_sz = ptr_sz;
+       return 0;
+}
+
 static bool btf_type_is_void(const struct btf_type *t)
 {
        return t == &btf_void || btf_is_fwd(t);
@@ -253,7 +318,7 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id)
                        size = t->size;
                        goto done;
                case BTF_KIND_PTR:
-                       size = sizeof(void *);
+                       size = btf_ptr_sz(btf);
                        goto done;
                case BTF_KIND_TYPEDEF:
                case BTF_KIND_VOLATILE:
@@ -293,9 +358,9 @@ int btf__align_of(const struct btf *btf, __u32 id)
        switch (kind) {
        case BTF_KIND_INT:
        case BTF_KIND_ENUM:
-               return min(sizeof(void *), (size_t)t->size);
+               return min(btf_ptr_sz(btf), (size_t)t->size);
        case BTF_KIND_PTR:
-               return sizeof(void *);
+               return btf_ptr_sz(btf);
        case BTF_KIND_TYPEDEF:
        case BTF_KIND_VOLATILE:
        case BTF_KIND_CONST:
@@ -533,6 +598,18 @@ struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext)
        if (IS_ERR(btf))
                goto done;
 
+       switch (gelf_getclass(elf)) {
+       case ELFCLASS32:
+               btf__set_pointer_size(btf, 4);
+               break;
+       case ELFCLASS64:
+               btf__set_pointer_size(btf, 8);
+               break;
+       default:
+               pr_warn("failed to get ELF class (bitness) for %s\n", path);
+               break;
+       }
+
        if (btf_ext && btf_ext_data) {
                *btf_ext = btf_ext__new(btf_ext_data->d_buf,
                                        btf_ext_data->d_size);
index f4a1a1d..1ca1444 100644 (file)
@@ -76,6 +76,8 @@ LIBBPF_API __s32 btf__find_by_name_kind(const struct btf *btf,
 LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf);
 LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf,
                                                  __u32 id);
+LIBBPF_API size_t btf__pointer_size(const struct btf *btf);
+LIBBPF_API int btf__set_pointer_size(struct btf *btf, size_t ptr_sz);
 LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
 LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
 LIBBPF_API int btf__align_of(const struct btf *btf, __u32 id);
index cf71116..57c00fa 100644 (file)
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <linux/err.h>
 #include <linux/btf.h>
+#include <linux/kernel.h>
 #include "btf.h"
 #include "hashmap.h"
 #include "libbpf.h"
@@ -60,6 +61,7 @@ struct btf_dump {
        const struct btf_ext *btf_ext;
        btf_dump_printf_fn_t printf_fn;
        struct btf_dump_opts opts;
+       int ptr_sz;
        bool strip_mods;
 
        /* per-type auxiliary state */
@@ -138,6 +140,7 @@ struct btf_dump *btf_dump__new(const struct btf *btf,
        d->btf_ext = btf_ext;
        d->printf_fn = printf_fn;
        d->opts.ctx = opts ? opts->ctx : NULL;
+       d->ptr_sz = btf__pointer_size(btf) ? : sizeof(void *);
 
        d->type_names = hashmap__new(str_hash_fn, str_equal_fn, NULL);
        if (IS_ERR(d->type_names)) {
@@ -549,6 +552,9 @@ static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr)
        }
 }
 
+static void btf_dump_emit_missing_aliases(struct btf_dump *d, __u32 id,
+                                         const struct btf_type *t);
+
 static void btf_dump_emit_struct_fwd(struct btf_dump *d, __u32 id,
                                     const struct btf_type *t);
 static void btf_dump_emit_struct_def(struct btf_dump *d, __u32 id,
@@ -671,6 +677,9 @@ static void btf_dump_emit_type(struct btf_dump *d, __u32 id, __u32 cont_id)
 
        switch (kind) {
        case BTF_KIND_INT:
+               /* Emit type alias definitions if necessary */
+               btf_dump_emit_missing_aliases(d, id, t);
+
                tstate->emit_state = EMITTED;
                break;
        case BTF_KIND_ENUM:
@@ -797,7 +806,7 @@ static void btf_dump_emit_bit_padding(const struct btf_dump *d,
                                      int align, int lvl)
 {
        int off_diff = m_off - cur_off;
-       int ptr_bits = sizeof(void *) * 8;
+       int ptr_bits = d->ptr_sz * 8;
 
        if (off_diff <= 0)
                /* no gap */
@@ -870,7 +879,7 @@ static void btf_dump_emit_struct_def(struct btf_dump *d,
                        btf_dump_printf(d, ": %d", m_sz);
                        off = m_off + m_sz;
                } else {
-                       m_sz = max(0, btf__resolve_size(d->btf, m->type));
+                       m_sz = max((__s64)0, btf__resolve_size(d->btf, m->type));
                        off = m_off + m_sz * 8;
                }
                btf_dump_printf(d, ";");
@@ -890,6 +899,32 @@ static void btf_dump_emit_struct_def(struct btf_dump *d,
                btf_dump_printf(d, " __attribute__((packed))");
 }
 
+static const char *missing_base_types[][2] = {
+       /*
+        * GCC emits typedefs to its internal __PolyX_t types when compiling Arm
+        * SIMD intrinsics. Alias them to standard base types.
+        */
+       { "__Poly8_t",          "unsigned char" },
+       { "__Poly16_t",         "unsigned short" },
+       { "__Poly64_t",         "unsigned long long" },
+       { "__Poly128_t",        "unsigned __int128" },
+};
+
+static void btf_dump_emit_missing_aliases(struct btf_dump *d, __u32 id,
+                                         const struct btf_type *t)
+{
+       const char *name = btf_dump_type_name(d, id);
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(missing_base_types); i++) {
+               if (strcmp(name, missing_base_types[i][0]) == 0) {
+                       btf_dump_printf(d, "typedef %s %s;\n\n",
+                                       missing_base_types[i][1], name);
+                       break;
+               }
+       }
+}
+
 static void btf_dump_emit_enum_fwd(struct btf_dump *d, __u32 id,
                                   const struct btf_type *t)
 {
index 0a06124..0ad0b04 100644 (file)
@@ -2264,7 +2264,7 @@ static int bpf_object__init_user_btf_maps(struct bpf_object *obj, bool strict,
                data = elf_getdata(scn, NULL);
        if (!scn || !data) {
                pr_warn("failed to get Elf_Data from map section %d (%s)\n",
-                       obj->efile.maps_shndx, MAPS_ELF_SEC);
+                       obj->efile.btf_maps_shndx, MAPS_ELF_SEC);
                return -EINVAL;
        }
 
@@ -2434,6 +2434,8 @@ static int bpf_object__init_btf(struct bpf_object *obj,
                                BTF_ELF_SEC, err);
                        goto out;
                }
+               /* enforce 8-byte pointers for BPF-targeted BTFs */
+               btf__set_pointer_size(obj->btf, 8);
                err = 0;
        }
        if (btf_ext_data) {
@@ -2542,6 +2544,8 @@ static int bpf_object__sanitize_and_load_btf(struct bpf_object *obj)
                if (IS_ERR(kern_btf))
                        return PTR_ERR(kern_btf);
 
+               /* enforce 8-byte pointers for BPF-targeted BTFs */
+               btf__set_pointer_size(obj->btf, 8);
                bpf_object__sanitize_btf(obj, kern_btf);
        }
 
@@ -3478,10 +3482,11 @@ bpf_object__probe_global_data(struct bpf_object *obj)
 
        map = bpf_create_map_xattr(&map_attr);
        if (map < 0) {
-               cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg));
+               ret = -errno;
+               cp = libbpf_strerror_r(ret, errmsg, sizeof(errmsg));
                pr_warn("Error in %s():%s(%d). Couldn't create simple array map.\n",
-                       __func__, cp, errno);
-               return -errno;
+                       __func__, cp, -ret);
+               return ret;
        }
 
        insns[0].imm = map;
@@ -5194,7 +5199,8 @@ static int bpf_object__collect_st_ops_relos(struct bpf_object *obj,
 static int bpf_object__collect_map_relos(struct bpf_object *obj,
                                         GElf_Shdr *shdr, Elf_Data *data)
 {
-       int i, j, nrels, new_sz, ptr_sz = sizeof(void *);
+       const int bpf_ptr_sz = 8, host_ptr_sz = sizeof(void *);
+       int i, j, nrels, new_sz;
        const struct btf_var_secinfo *vi = NULL;
        const struct btf_type *sec, *var, *def;
        const struct btf_member *member;
@@ -5243,7 +5249,7 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
 
                        vi = btf_var_secinfos(sec) + map->btf_var_idx;
                        if (vi->offset <= rel.r_offset &&
-                           rel.r_offset + sizeof(void *) <= vi->offset + vi->size)
+                           rel.r_offset + bpf_ptr_sz <= vi->offset + vi->size)
                                break;
                }
                if (j == obj->nr_maps) {
@@ -5279,17 +5285,20 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
                        return -EINVAL;
 
                moff = rel.r_offset - vi->offset - moff;
-               if (moff % ptr_sz)
+               /* here we use BPF pointer size, which is always 64 bit, as we
+                * are parsing ELF that was built for BPF target
+                */
+               if (moff % bpf_ptr_sz)
                        return -EINVAL;
-               moff /= ptr_sz;
+               moff /= bpf_ptr_sz;
                if (moff >= map->init_slots_sz) {
                        new_sz = moff + 1;
-                       tmp = realloc(map->init_slots, new_sz * ptr_sz);
+                       tmp = realloc(map->init_slots, new_sz * host_ptr_sz);
                        if (!tmp)
                                return -ENOMEM;
                        map->init_slots = tmp;
                        memset(map->init_slots + map->init_slots_sz, 0,
-                              (new_sz - map->init_slots_sz) * ptr_sz);
+                              (new_sz - map->init_slots_sz) * host_ptr_sz);
                        map->init_slots_sz = new_sz;
                }
                map->init_slots[moff] = targ_map;
@@ -6012,9 +6021,10 @@ int bpf_program__pin_instance(struct bpf_program *prog, const char *path,
        }
 
        if (bpf_obj_pin(prog->instances.fds[instance], path)) {
-               cp = libbpf_strerror_r(errno, errmsg, sizeof(errmsg));
+               err = -errno;
+               cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg));
                pr_warn("failed to pin program: %s\n", cp);
-               return -errno;
+               return err;
        }
        pr_debug("pinned program '%s'\n", path);
 
index 0c4722b..e35bd6c 100644 (file)
@@ -295,5 +295,7 @@ LIBBPF_0.1.0 {
                bpf_program__set_sk_lookup;
                btf__parse;
                btf__parse_raw;
+               btf__pointer_size;
                btf__set_fd;
+               btf__set_pointer_size;
 } LIBBPF_0.0.9;
index 1bb204c..9a0946d 100644 (file)
@@ -6,7 +6,6 @@ test_lpm_map
 test_tag
 FEATURE-DUMP.libbpf
 fixdep
-test_align
 test_dev_cgroup
 /test_progs*
 test_tcpbpf_user
index a83b582..fc946b7 100644 (file)
@@ -32,7 +32,7 @@ LDLIBS += -lcap -lelf -lz -lrt -lpthread
 
 # Order correspond to 'make run_tests' order
 TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
-       test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \
+       test_verifier_log test_dev_cgroup test_tcpbpf_user \
        test_sock test_btf test_sockmap get_cgroup_id_user test_socket_cookie \
        test_cgroup_storage \
        test_netcnt test_tcpnotify_user test_sock_fields test_sysctl \
index 7afa416..284d592 100644 (file)
@@ -159,15 +159,15 @@ void test_bpf_obj_id(void)
                /* Check getting link info */
                info_len = sizeof(struct bpf_link_info) * 2;
                bzero(&link_infos[i], info_len);
-               link_infos[i].raw_tracepoint.tp_name = (__u64)&tp_name;
+               link_infos[i].raw_tracepoint.tp_name = ptr_to_u64(&tp_name);
                link_infos[i].raw_tracepoint.tp_name_len = sizeof(tp_name);
                err = bpf_obj_get_info_by_fd(bpf_link__fd(links[i]),
                                             &link_infos[i], &info_len);
                if (CHECK(err ||
                          link_infos[i].type != BPF_LINK_TYPE_RAW_TRACEPOINT ||
                          link_infos[i].prog_id != prog_infos[i].id ||
-                         link_infos[i].raw_tracepoint.tp_name != (__u64)&tp_name ||
-                         strcmp((char *)link_infos[i].raw_tracepoint.tp_name,
+                         link_infos[i].raw_tracepoint.tp_name != ptr_to_u64(&tp_name) ||
+                         strcmp(u64_to_ptr(link_infos[i].raw_tracepoint.tp_name),
                                 "sys_enter") ||
                          info_len != sizeof(struct bpf_link_info),
                          "get-link-info(fd)",
@@ -178,7 +178,7 @@ void test_bpf_obj_id(void)
                          link_infos[i].type, BPF_LINK_TYPE_RAW_TRACEPOINT,
                          link_infos[i].id,
                          link_infos[i].prog_id, prog_infos[i].id,
-                         (char *)link_infos[i].raw_tracepoint.tp_name,
+                         (const char *)u64_to_ptr(link_infos[i].raw_tracepoint.tp_name),
                          "sys_enter"))
                        goto done;
 
index cb33a7e..39fb81d 100644 (file)
@@ -12,15 +12,16 @@ void btf_dump_printf(void *ctx, const char *fmt, va_list args)
 static struct btf_dump_test_case {
        const char *name;
        const char *file;
+       bool known_ptr_sz;
        struct btf_dump_opts opts;
 } btf_dump_test_cases[] = {
-       {"btf_dump: syntax", "btf_dump_test_case_syntax", {}},
-       {"btf_dump: ordering", "btf_dump_test_case_ordering", {}},
-       {"btf_dump: padding", "btf_dump_test_case_padding", {}},
-       {"btf_dump: packing", "btf_dump_test_case_packing", {}},
-       {"btf_dump: bitfields", "btf_dump_test_case_bitfields", {}},
-       {"btf_dump: multidim", "btf_dump_test_case_multidim", {}},
-       {"btf_dump: namespacing", "btf_dump_test_case_namespacing", {}},
+       {"btf_dump: syntax", "btf_dump_test_case_syntax", true, {}},
+       {"btf_dump: ordering", "btf_dump_test_case_ordering", false, {}},
+       {"btf_dump: padding", "btf_dump_test_case_padding", true, {}},
+       {"btf_dump: packing", "btf_dump_test_case_packing", true, {}},
+       {"btf_dump: bitfields", "btf_dump_test_case_bitfields", true, {}},
+       {"btf_dump: multidim", "btf_dump_test_case_multidim", false, {}},
+       {"btf_dump: namespacing", "btf_dump_test_case_namespacing", false, {}},
 };
 
 static int btf_dump_all_types(const struct btf *btf,
@@ -62,6 +63,18 @@ static int test_btf_dump_case(int n, struct btf_dump_test_case *t)
                goto done;
        }
 
+       /* tests with t->known_ptr_sz have no "long" or "unsigned long" type,
+        * so it's impossible to determine correct pointer size; but if they
+        * do, it should be 8 regardless of host architecture, becaues BPF
+        * target is always 64-bit
+        */
+       if (!t->known_ptr_sz) {
+               btf__set_pointer_size(btf, 8);
+       } else {
+               CHECK(btf__pointer_size(btf) != 8, "ptr_sz", "exp %d, got %zu\n",
+                     8, btf__pointer_size(btf));
+       }
+
        snprintf(out_file, sizeof(out_file), "/tmp/%s.output.XXXXXX", t->file);
        fd = mkstemp(out_file);
        if (CHECK(fd < 0, "create_tmp", "failed to create file: %d\n", fd)) {
index b093787..1931a15 100644 (file)
@@ -159,8 +159,8 @@ void test_core_extern(void)
                exp = (uint64_t *)&t->data;
                for (j = 0; j < n; j++) {
                        CHECK(got[j] != exp[j], "check_res",
-                             "result #%d: expected %lx, but got %lx\n",
-                              j, exp[j], got[j]);
+                             "result #%d: expected %llx, but got %llx\n",
+                              j, (__u64)exp[j], (__u64)got[j]);
                }
 cleanup:
                test_core_extern__destroy(skel);
index 084ed26..a54eafc 100644 (file)
                .union_sz = sizeof(((type *)0)->union_field),           \
                .arr_sz = sizeof(((type *)0)->arr_field),               \
                .arr_elem_sz = sizeof(((type *)0)->arr_field[0]),       \
-               .ptr_sz = sizeof(((type *)0)->ptr_field),               \
-               .enum_sz = sizeof(((type *)0)->enum_field),     \
+               .ptr_sz = 8, /* always 8-byte pointer for BPF */        \
+               .enum_sz = sizeof(((type *)0)->enum_field),             \
        }
 
 #define SIZE_CASE(name) {                                              \
@@ -432,20 +432,20 @@ static struct core_reloc_test_case test_cases[] = {
                .sb4 = -1,
                .sb20 = -0x17654321,
                .u32 = 0xBEEF,
-               .s32 = -0x3FEDCBA987654321,
+               .s32 = -0x3FEDCBA987654321LL,
        }),
        BITFIELDS_CASE(bitfields___bitfield_vs_int, {
-               .ub1 = 0xFEDCBA9876543210,
+               .ub1 = 0xFEDCBA9876543210LL,
                .ub2 = 0xA6,
-               .ub7 = -0x7EDCBA987654321,
-               .sb4 = -0x6123456789ABCDE,
-               .sb20 = 0xD00D,
+               .ub7 = -0x7EDCBA987654321LL,
+               .sb4 = -0x6123456789ABCDELL,
+               .sb20 = 0xD00DLL,
                .u32 = -0x76543,
-               .s32 = 0x0ADEADBEEFBADB0B,
+               .s32 = 0x0ADEADBEEFBADB0BLL,
        }),
        BITFIELDS_CASE(bitfields___just_big_enough, {
-               .ub1 = 0xF,
-               .ub2 = 0x0812345678FEDCBA,
+               .ub1 = 0xFLL,
+               .ub2 = 0x0812345678FEDCBALL,
        }),
        BITFIELDS_ERR_CASE(bitfields___err_too_big_bitfield),
 
index a895bfe..197d0d2 100644 (file)
@@ -16,7 +16,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file,
        __u32 duration = 0, retval;
        struct bpf_map *data_map;
        const int zero = 0;
-       u64 *result = NULL;
+       __u64 *result = NULL;
 
        err = bpf_prog_load(target_obj_file, BPF_PROG_TYPE_UNSPEC,
                            &pkt_obj, &pkt_fd);
@@ -29,7 +29,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file,
 
        link = calloc(sizeof(struct bpf_link *), prog_cnt);
        prog = calloc(sizeof(struct bpf_program *), prog_cnt);
-       result = malloc((prog_cnt + 32 /* spare */) * sizeof(u64));
+       result = malloc((prog_cnt + 32 /* spare */) * sizeof(__u64));
        if (CHECK(!link || !prog || !result, "alloc_memory",
                  "failed to alloc memory"))
                goto close_prog;
@@ -72,7 +72,7 @@ static void test_fexit_bpf2bpf_common(const char *obj_file,
                goto close_prog;
 
        for (i = 0; i < prog_cnt; i++)
-               if (CHECK(result[i] != 1, "result", "fexit_bpf2bpf failed err %ld\n",
+               if (CHECK(result[i] != 1, "result", "fexit_bpf2bpf failed err %llu\n",
                          result[i]))
                        goto close_prog;
 
index f11f187..cd6dc80 100644 (file)
@@ -591,7 +591,7 @@ void test_flow_dissector(void)
                CHECK_ATTR(tattr.data_size_out != sizeof(flow_keys) ||
                           err || tattr.retval != 1,
                           tests[i].name,
-                          "err %d errno %d retval %d duration %d size %u/%lu\n",
+                          "err %d errno %d retval %d duration %d size %u/%zu\n",
                           err, errno, tattr.retval, tattr.duration,
                           tattr.data_size_out, sizeof(flow_keys));
                CHECK_FLOW_KEYS(tests[i].name, flow_keys, tests[i].keys);
index e3cb62b..9efa7e5 100644 (file)
@@ -5,7 +5,7 @@
 static void test_global_data_number(struct bpf_object *obj, __u32 duration)
 {
        int i, err, map_fd;
-       uint64_t num;
+       __u64 num;
 
        map_fd = bpf_find_map(__func__, obj, "result_number");
        if (CHECK_FAIL(map_fd < 0))
@@ -14,7 +14,7 @@ static void test_global_data_number(struct bpf_object *obj, __u32 duration)
        struct {
                char *name;
                uint32_t key;
-               uint64_t num;
+               __u64 num;
        } tests[] = {
                { "relocate .bss reference",     0, 0 },
                { "relocate .data reference",    1, 42 },
@@ -32,7 +32,7 @@ static void test_global_data_number(struct bpf_object *obj, __u32 duration)
        for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
                err = bpf_map_lookup_elem(map_fd, &tests[i].key, &num);
                CHECK(err || num != tests[i].num, tests[i].name,
-                     "err %d result %lx expected %lx\n",
+                     "err %d result %llx expected %llx\n",
                      err, num, tests[i].num);
        }
 }
index 43d0b55..9c3c5c0 100644 (file)
@@ -21,7 +21,7 @@ void test_mmap(void)
        const long page_size = sysconf(_SC_PAGE_SIZE);
        int err, duration = 0, i, data_map_fd, data_map_id, tmp_fd, rdmap_fd;
        struct bpf_map *data_map, *bss_map;
-       void *bss_mmaped = NULL, *map_mmaped = NULL, *tmp1, *tmp2;
+       void *bss_mmaped = NULL, *map_mmaped = NULL, *tmp0, *tmp1, *tmp2;
        struct test_mmap__bss *bss_data;
        struct bpf_map_info map_info;
        __u32 map_info_sz = sizeof(map_info);
@@ -183,16 +183,23 @@ void test_mmap(void)
 
        /* check some more advanced mmap() manipulations */
 
+       tmp0 = mmap(NULL, 4 * page_size, PROT_READ, MAP_SHARED | MAP_ANONYMOUS,
+                         -1, 0);
+       if (CHECK(tmp0 == MAP_FAILED, "adv_mmap0", "errno %d\n", errno))
+               goto cleanup;
+
        /* map all but last page: pages 1-3 mapped */
-       tmp1 = mmap(NULL, 3 * page_size, PROT_READ, MAP_SHARED,
+       tmp1 = mmap(tmp0, 3 * page_size, PROT_READ, MAP_SHARED | MAP_FIXED,
                          data_map_fd, 0);
-       if (CHECK(tmp1 == MAP_FAILED, "adv_mmap1", "errno %d\n", errno))
+       if (CHECK(tmp0 != tmp1, "adv_mmap1", "tmp0: %p, tmp1: %p\n", tmp0, tmp1)) {
+               munmap(tmp0, 4 * page_size);
                goto cleanup;
+       }
 
        /* unmap second page: pages 1, 3 mapped */
        err = munmap(tmp1 + page_size, page_size);
        if (CHECK(err, "adv_mmap2", "errno %d\n", errno)) {
-               munmap(tmp1, map_sz);
+               munmap(tmp1, 4 * page_size);
                goto cleanup;
        }
 
@@ -201,7 +208,7 @@ void test_mmap(void)
                    MAP_SHARED | MAP_FIXED, data_map_fd, 0);
        if (CHECK(tmp2 == MAP_FAILED, "adv_mmap3", "errno %d\n", errno)) {
                munmap(tmp1, page_size);
-               munmap(tmp1 + 2*page_size, page_size);
+               munmap(tmp1 + 2*page_size, 2 * page_size);
                goto cleanup;
        }
        CHECK(tmp1 + page_size != tmp2, "adv_mmap4",
@@ -211,7 +218,7 @@ void test_mmap(void)
        tmp2 = mmap(tmp1, 4 * page_size, PROT_READ, MAP_SHARED | MAP_FIXED,
                    data_map_fd, 0);
        if (CHECK(tmp2 == MAP_FAILED, "adv_mmap5", "errno %d\n", errno)) {
-               munmap(tmp1, 3 * page_size); /* unmap page 1 */
+               munmap(tmp1, 4 * page_size); /* unmap page 1 */
                goto cleanup;
        }
        CHECK(tmp1 != tmp2, "adv_mmap6", "tmp1: %p, tmp2: %p\n", tmp1, tmp2);
index dde2b7a..935a294 100644 (file)
@@ -28,7 +28,7 @@ void test_prog_run_xattr(void)
              "err %d errno %d retval %d\n", err, errno, tattr.retval);
 
        CHECK_ATTR(tattr.data_size_out != sizeof(pkt_v4), "data_size_out",
-             "incorrect output size, want %lu have %u\n",
+             "incorrect output size, want %zu have %u\n",
              sizeof(pkt_v4), tattr.data_size_out);
 
        CHECK_ATTR(buf[5] != 0, "overflow",
index c571584..9ff0412 100644 (file)
@@ -309,6 +309,7 @@ static void v4_to_v6(struct sockaddr_storage *ss)
        v6->sin6_addr.s6_addr[10] = 0xff;
        v6->sin6_addr.s6_addr[11] = 0xff;
        memcpy(&v6->sin6_addr.s6_addr[12], &v4.sin_addr.s_addr, 4);
+       memset(&v6->sin6_addr.s6_addr[0], 0, 10);
 }
 
 static int udp_recv_send(int server_fd)
index 25de86a..fafedda 100644 (file)
@@ -81,7 +81,7 @@ void test_skb_ctx(void)
 
        CHECK_ATTR(tattr.ctx_size_out != sizeof(skb),
                   "ctx_size_out",
-                  "incorrect output size, want %lu have %u\n",
+                  "incorrect output size, want %zu have %u\n",
                   sizeof(skb), tattr.ctx_size_out);
 
        for (i = 0; i < 5; i++)
index 25b0685..193002b 100644 (file)
@@ -19,7 +19,7 @@ static int libbpf_debug_print(enum libbpf_print_level level,
        log_buf = va_arg(args, char *);
        if (!log_buf)
                goto out;
-       if (strstr(log_buf, err_str) == 0)
+       if (err_str && strstr(log_buf, err_str) == 0)
                found = true;
 out:
        printf(format, log_buf);
index c75525e..dd324b4 100644 (file)
@@ -44,25 +44,25 @@ void test_varlen(void)
        CHECK_VAL(bss->payload1_len2, size2);
        CHECK_VAL(bss->total1, size1 + size2);
        CHECK(memcmp(bss->payload1, exp_str, size1 + size2), "content_check",
-             "doesn't match!");
+             "doesn't match!\n");
 
        CHECK_VAL(data->payload2_len1, size1);
        CHECK_VAL(data->payload2_len2, size2);
        CHECK_VAL(data->total2, size1 + size2);
        CHECK(memcmp(data->payload2, exp_str, size1 + size2), "content_check",
-             "doesn't match!");
+             "doesn't match!\n");
 
        CHECK_VAL(data->payload3_len1, size1);
        CHECK_VAL(data->payload3_len2, size2);
        CHECK_VAL(data->total3, size1 + size2);
        CHECK(memcmp(data->payload3, exp_str, size1 + size2), "content_check",
-             "doesn't match!");
+             "doesn't match!\n");
 
        CHECK_VAL(data->payload4_len1, size1);
        CHECK_VAL(data->payload4_len2, size2);
        CHECK_VAL(data->total4, size1 + size2);
        CHECK(memcmp(data->payload4, exp_str, size1 + size2), "content_check",
-             "doesn't match!");
+             "doesn't match!\n");
 cleanup:
        test_varlen__destroy(skel);
 }
index 34d8471..69139ed 100644 (file)
@@ -1,5 +1,10 @@
 #include <stdint.h>
 #include <stdbool.h>
+
+void preserce_ptr_sz_fn(long x) {}
+
+#define __bpf_aligned __attribute__((aligned(8)))
+
 /*
  * KERNEL
  */
@@ -444,51 +449,51 @@ struct core_reloc_primitives {
        char a;
        int b;
        enum core_reloc_primitives_enum c;
-       void *d;
-       int (*f)(const char *);
+       void *d __bpf_aligned;
+       int (*f)(const char *) __bpf_aligned;
 };
 
 struct core_reloc_primitives___diff_enum_def {
        char a;
        int b;
-       void *d;
-       int (*f)(const char *);
+       void *d __bpf_aligned;
+       int (*f)(const char *) __bpf_aligned;
        enum {
                X = 100,
                Y = 200,
-       } c; /* inline enum def with differing set of values */
+       } c __bpf_aligned; /* inline enum def with differing set of values */
 };
 
 struct core_reloc_primitives___diff_func_proto {
-       void (*f)(int); /* incompatible function prototype */
-       void *d;
-       enum core_reloc_primitives_enum c;
+       void (*f)(int) __bpf_aligned; /* incompatible function prototype */
+       void *d __bpf_aligned;
+       enum core_reloc_primitives_enum c __bpf_aligned;
        int b;
        char a;
 };
 
 struct core_reloc_primitives___diff_ptr_type {
-       const char * const d; /* different pointee type + modifiers */
-       char a;
+       const char * const d __bpf_aligned; /* different pointee type + modifiers */
+       char a __bpf_aligned;
        int b;
        enum core_reloc_primitives_enum c;
-       int (*f)(const char *);
+       int (*f)(const char *) __bpf_aligned;
 };
 
 struct core_reloc_primitives___err_non_enum {
        char a[1];
        int b;
        int c; /* int instead of enum */
-       void *d;
-       int (*f)(const char *);
+       void *d __bpf_aligned;
+       int (*f)(const char *) __bpf_aligned;
 };
 
 struct core_reloc_primitives___err_non_int {
        char a[1];
-       int *b; /* ptr instead of int */
-       enum core_reloc_primitives_enum c;
-       void *d;
-       int (*f)(const char *);
+       int *b __bpf_aligned; /* ptr instead of int */
+       enum core_reloc_primitives_enum c __bpf_aligned;
+       void *d __bpf_aligned;
+       int (*f)(const char *) __bpf_aligned;
 };
 
 struct core_reloc_primitives___err_non_ptr {
@@ -496,7 +501,7 @@ struct core_reloc_primitives___err_non_ptr {
        int b;
        enum core_reloc_primitives_enum c;
        int d; /* int instead of ptr */
-       int (*f)(const char *);
+       int (*f)(const char *) __bpf_aligned;
 };
 
 /*
@@ -507,7 +512,7 @@ struct core_reloc_mods_output {
 };
 
 typedef const int int_t;
-typedef const char *char_ptr_t;
+typedef const char *char_ptr_t __bpf_aligned;
 typedef const int arr_t[7];
 
 struct core_reloc_mods_substruct {
@@ -523,9 +528,9 @@ typedef struct {
 struct core_reloc_mods {
        int a;
        int_t b;
-       char *c;
+       char *c __bpf_aligned;
        char_ptr_t d;
-       int e[3];
+       int e[3] __bpf_aligned;
        arr_t f;
        struct core_reloc_mods_substruct g;
        core_reloc_mods_substruct_t h;
@@ -535,9 +540,9 @@ struct core_reloc_mods {
 struct core_reloc_mods___mod_swap {
        int b;
        int_t a;
-       char *d;
+       char *d __bpf_aligned;
        char_ptr_t c;
-       int f[3];
+       int f[3] __bpf_aligned;
        arr_t e;
        struct {
                int y;
@@ -555,7 +560,7 @@ typedef arr1_t arr2_t;
 typedef arr2_t arr3_t;
 typedef arr3_t arr4_t;
 
-typedef const char * const volatile fancy_char_ptr_t;
+typedef const char * const volatile fancy_char_ptr_t __bpf_aligned;
 
 typedef core_reloc_mods_substruct_t core_reloc_mods_substruct_tt;
 
@@ -567,7 +572,7 @@ struct core_reloc_mods___typedefs {
        arr4_t e;
        fancy_char_ptr_t d;
        fancy_char_ptr_t c;
-       int3_t b;
+       int3_t b __bpf_aligned;
        int3_t a;
 };
 
@@ -739,19 +744,19 @@ struct core_reloc_bitfields___bit_sz_change {
        int8_t          sb4: 1;         /*  4 ->  1 */
        int32_t         sb20: 30;       /* 20 -> 30 */
        /* non-bitfields */
-       uint16_t        u32;            /* 32 -> 16 */
-       int64_t         s32;            /* 32 -> 64 */
+       uint16_t        u32;                    /* 32 -> 16 */
+       int64_t         s32 __bpf_aligned;      /* 32 -> 64 */
 };
 
 /* turn bitfield into non-bitfield and vice versa */
 struct core_reloc_bitfields___bitfield_vs_int {
        uint64_t        ub1;            /*  3 -> 64 non-bitfield */
        uint8_t         ub2;            /* 20 ->  8 non-bitfield */
-       int64_t         ub7;            /*  7 -> 64 non-bitfield signed */
-       int64_t         sb4;            /*  4 -> 64 non-bitfield signed */
-       uint64_t        sb20;           /* 20 -> 16 non-bitfield unsigned */
-       int32_t         u32: 20;        /* 32 non-bitfield -> 20 bitfield */
-       uint64_t        s32: 60;        /* 32 non-bitfield -> 60 bitfield */
+       int64_t         ub7 __bpf_aligned;      /*  7 -> 64 non-bitfield signed */
+       int64_t         sb4 __bpf_aligned;      /*  4 -> 64 non-bitfield signed */
+       uint64_t        sb20 __bpf_aligned;     /* 20 -> 16 non-bitfield unsigned */
+       int32_t         u32: 20;                /* 32 non-bitfield -> 20 bitfield */
+       uint64_t        s32: 60 __bpf_aligned;  /* 32 non-bitfield -> 60 bitfield */
 };
 
 struct core_reloc_bitfields___just_big_enough {
index 1f1966e..3e6912e 100644 (file)
@@ -54,6 +54,7 @@ SEC("sockops")
 int bpf_testcb(struct bpf_sock_ops *skops)
 {
        char header[sizeof(struct ipv6hdr) + sizeof(struct tcphdr)];
+       struct bpf_sock_ops *reuse = skops;
        struct tcphdr *thdr;
        int good_call_rv = 0;
        int bad_call_rv = 0;
@@ -62,6 +63,46 @@ int bpf_testcb(struct bpf_sock_ops *skops)
        int v = 0;
        int op;
 
+       /* Test reading fields in bpf_sock_ops using single register */
+       asm volatile (
+               "%[reuse] = *(u32 *)(%[reuse] +96)"
+               : [reuse] "+r"(reuse)
+               :);
+
+       asm volatile (
+               "%[op] = *(u32 *)(%[skops] +96)"
+               : [op] "+r"(op)
+               : [skops] "r"(skops)
+               :);
+
+       asm volatile (
+               "r9 = %[skops];\n"
+               "r8 = *(u32 *)(r9 +164);\n"
+               "*(u32 *)(r9 +164) = r8;\n"
+               :: [skops] "r"(skops)
+               : "r9", "r8");
+
+       asm volatile (
+               "r1 = %[skops];\n"
+               "r1 = *(u64 *)(r1 +184);\n"
+               "if r1 == 0 goto +1;\n"
+               "r1 = *(u32 *)(r1 +4);\n"
+               :: [skops] "r"(skops):"r1");
+
+       asm volatile (
+               "r9 = %[skops];\n"
+               "r9 = *(u64 *)(r9 +184);\n"
+               "if r9 == 0 goto +1;\n"
+               "r9 = *(u32 *)(r9 +4);\n"
+               :: [skops] "r"(skops):"r9");
+
+       asm volatile (
+               "r1 = %[skops];\n"
+               "r2 = *(u64 *)(r1 +184);\n"
+               "if r2 == 0 goto +1;\n"
+               "r2 = *(u32 *)(r2 +4);\n"
+               :: [skops] "r"(skops):"r1", "r2");
+
        op = (int) skops->op;
 
        update_event_map(op);
index cd4b72c..913acdf 100644 (file)
@@ -15,9 +15,9 @@ int test_pid = 0;
 bool capture = false;
 
 /* .bss */
-long payload1_len1 = 0;
-long payload1_len2 = 0;
-long total1 = 0;
+__u64 payload1_len1 = 0;
+__u64 payload1_len2 = 0;
+__u64 total1 = 0;
 char payload1[MAX_LEN + MAX_LEN] = {};
 
 /* .data */
index 305fae8..c75fc64 100644 (file)
@@ -3883,7 +3883,7 @@ static int test_big_btf_info(unsigned int test_num)
        info_garbage.garbage = 0;
        err = bpf_obj_get_info_by_fd(btf_fd, info, &info_len);
        if (CHECK(err || info_len != sizeof(*info),
-                 "err:%d errno:%d info_len:%u sizeof(*info):%lu",
+                 "err:%d errno:%d info_len:%u sizeof(*info):%zu",
                  err, errno, info_len, sizeof(*info))) {
                err = -1;
                goto done;
@@ -4094,7 +4094,7 @@ static int do_test_get_info(unsigned int test_num)
        if (CHECK(err || !info.id || info_len != sizeof(info) ||
                  info.btf_size != raw_btf_size ||
                  (ret = memcmp(raw_btf, user_btf, expected_nbytes)),
-                 "err:%d errno:%d info.id:%u info_len:%u sizeof(info):%lu raw_btf_size:%u info.btf_size:%u expected_nbytes:%u memcmp:%d",
+                 "err:%d errno:%d info.id:%u info_len:%u sizeof(info):%zu raw_btf_size:%u info.btf_size:%u expected_nbytes:%u memcmp:%d",
                  err, errno, info.id, info_len, sizeof(info),
                  raw_btf_size, info.btf_size, expected_nbytes, ret)) {
                err = -1;
@@ -4730,7 +4730,7 @@ ssize_t get_pprint_expected_line(enum pprint_mapv_kind_t mapv_kind,
 
                nexpected_line = snprintf(expected_line, line_size,
                                          "%s%u: {%u,0,%d,0x%x,0x%x,0x%x,"
-                                         "{%lu|[%u,%u,%u,%u,%u,%u,%u,%u]},%s,"
+                                         "{%llu|[%u,%u,%u,%u,%u,%u,%u,%u]},%s,"
                                          "%u,0x%x,[[%d,%d],[%d,%d]]}\n",
                                          percpu_map ? "\tcpu" : "",
                                          percpu_map ? cpu : next_key,
@@ -4738,7 +4738,7 @@ ssize_t get_pprint_expected_line(enum pprint_mapv_kind_t mapv_kind,
                                          v->unused_bits2a,
                                          v->bits28,
                                          v->unused_bits2b,
-                                         v->ui64,
+                                         (__u64)v->ui64,
                                          v->ui8a[0], v->ui8a[1],
                                          v->ui8a[2], v->ui8a[3],
                                          v->ui8a[4], v->ui8a[5],
index 6e09bf7..dbb820d 100644 (file)
@@ -135,6 +135,11 @@ static inline __u64 ptr_to_u64(const void *ptr)
        return (__u64) (unsigned long) ptr;
 }
 
+static inline void *u64_to_ptr(__u64 ptr)
+{
+       return (void *) (unsigned long) ptr;
+}
+
 int bpf_find_map(const char *test, struct bpf_object *obj, const char *name);
 int compare_map_keys(int map1_fd, int map2_fd);
 int compare_stack_ips(int smap_fd, int amap_fd, int stack_trace_len);
index 8162c58..b8d14f9 100644 (file)
@@ -40,11 +40,11 @@ static void guest_code(void)
 
        /* Single step test, covers 2 basic instructions and 2 emulated */
        asm volatile("ss_start: "
-                    "xor %%rax,%%rax\n\t"
+                    "xor %%eax,%%eax\n\t"
                     "cpuid\n\t"
                     "movl $0x1a0,%%ecx\n\t"
                     "rdmsr\n\t"
-                    : : : "rax", "ecx");
+                    : : : "eax", "ebx", "ecx", "edx");
 
        /* DR6.BD test */
        asm volatile("bd_start: mov %%dr0, %%rax" : : : "rax");
index 18c5de5..bf361f3 100755 (executable)
@@ -180,6 +180,8 @@ setup()
                        ;;
                r[12]) ip netns exec $ns sysctl -q -w net.ipv4.ip_forward=1
                       ip netns exec $ns sysctl -q -w net.ipv4.conf.all.send_redirects=1
+                      ip netns exec $ns sysctl -q -w net.ipv4.conf.default.rp_filter=0
+                      ip netns exec $ns sysctl -q -w net.ipv4.conf.all.rp_filter=0
 
                       ip netns exec $ns sysctl -q -w net.ipv6.conf.all.forwarding=1
                       ip netns exec $ns sysctl -q -w net.ipv6.route.mtu_expires=10
index d3e0809..a47d1d8 100755 (executable)
@@ -2,13 +2,18 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 # This tests basic flowtable functionality.
-# Creates following topology:
+# Creates following default topology:
 #
 # Originator (MTU 9000) <-Router1-> MTU 1500 <-Router2-> Responder (MTU 2000)
 # Router1 is the one doing flow offloading, Router2 has no special
 # purpose other than having a link that is smaller than either Originator
 # and responder, i.e. TCPMSS announced values are too large and will still
 # result in fragmentation and/or PMTU discovery.
+#
+# You can check with different Orgininator/Link/Responder MTU eg:
+# sh nft_flowtable.sh -o1000 -l500 -r100
+#
+
 
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
@@ -21,29 +26,18 @@ ns2out=""
 
 log_netns=$(sysctl -n net.netfilter.nf_log_all_netns)
 
-nft --version > /dev/null 2>&1
-if [ $? -ne 0 ];then
-       echo "SKIP: Could not run test without nft tool"
-       exit $ksft_skip
-fi
-
-ip -Version > /dev/null 2>&1
-if [ $? -ne 0 ];then
-       echo "SKIP: Could not run test without ip tool"
-       exit $ksft_skip
-fi
-
-which nc > /dev/null 2>&1
-if [ $? -ne 0 ];then
-       echo "SKIP: Could not run test without nc (netcat)"
-       exit $ksft_skip
-fi
+checktool (){
+       $1 > /dev/null 2>&1
+       if [ $? -ne 0 ];then
+               echo "SKIP: Could not $2"
+               exit $ksft_skip
+       fi
+}
 
-ip netns add nsr1
-if [ $? -ne 0 ];then
-       echo "SKIP: Could not create net namespace"
-       exit $ksft_skip
-fi
+checktool "nft --version" "run test without nft tool"
+checktool "ip -Version" "run test without ip tool"
+checktool "which nc" "run test without nc (netcat)"
+checktool "ip netns add nsr1" "create net namespace"
 
 ip netns add ns1
 ip netns add ns2
@@ -89,11 +83,24 @@ ip -net nsr2 addr add dead:2::1/64 dev veth1
 # ns2 is going via nsr2 with a smaller mtu, so that TCPMSS announced by both peers
 # is NOT the lowest link mtu.
 
-ip -net nsr1 link set veth0 mtu 9000
-ip -net ns1 link set eth0 mtu 9000
+omtu=9000
+lmtu=1500
+rmtu=2000
+
+while getopts "o:l:r:" o
+do
+       case $o in
+               o) omtu=$OPTARG;;
+               l) lmtu=$OPTARG;;
+               r) rmtu=$OPTARG;;
+       esac
+done
+
+ip -net nsr1 link set veth0 mtu $omtu
+ip -net ns1 link set eth0 mtu $omtu
 
-ip -net nsr2 link set veth1 mtu 2000
-ip -net ns2 link set eth0 mtu 2000
+ip -net nsr2 link set veth1 mtu $rmtu
+ip -net ns2 link set eth0 mtu $rmtu
 
 # transfer-net between nsr1 and nsr2.
 # these addresses are not used for connections.
@@ -147,7 +154,7 @@ table inet filter {
       # as PMTUd is off.
       # This rule is deleted for the last test, when we expect PMTUd
       # to kick in and ensure all packets meet mtu requirements.
-      meta length gt 1500 accept comment something-to-grep-for
+      meta length gt $lmtu accept comment something-to-grep-for
 
       # next line blocks connection w.o. working offload.
       # we only do this for reverse dir, because we expect packets to
@@ -243,8 +250,14 @@ test_tcp_forwarding_ip()
 
        sleep 3
 
-       kill $lpid
-       kill $cpid
+       if ps -p $lpid > /dev/null;then
+               kill $lpid
+       fi
+
+       if ps -p $cpid > /dev/null;then
+               kill $cpid
+       fi
+
        wait
 
        check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"
index 91c775c..aac4a59 100644 (file)
@@ -2,6 +2,7 @@
 hugetlb_vs_thp_test
 subpage_prot
 tempfile
+prot_sao
 segv_errors
 wild_bctr
 large_vm_fork_separation
index 250ce17..defe488 100644 (file)
@@ -2,7 +2,7 @@
 noarg:
        $(MAKE) -C ../
 
-TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot segv_errors wild_bctr \
+TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr \
                  large_vm_fork_separation bad_accesses pkey_exec_prot \
                  pkey_siginfo stack_expansion_signal stack_expansion_ldst
 
@@ -14,6 +14,8 @@ include ../../lib.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
+$(OUTPUT)/prot_sao: ../utils.c
+
 $(OUTPUT)/wild_bctr: CFLAGS += -m64
 $(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64
 $(OUTPUT)/bad_accesses: CFLAGS += -m64
diff --git a/tools/testing/selftests/powerpc/mm/prot_sao.c b/tools/testing/selftests/powerpc/mm/prot_sao.c
new file mode 100644 (file)
index 0000000..e0cf8eb
--- /dev/null
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright 2016, Michael Ellerman, IBM Corp.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include <asm/cputable.h>
+
+#include "utils.h"
+
+#define SIZE (64 * 1024)
+
+int test_prot_sao(void)
+{
+       char *p;
+
+       /* SAO was introduced in 2.06 and removed in 3.1 */
+       SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||
+               have_hwcap2(PPC_FEATURE2_ARCH_3_1));
+
+       /*
+        * Ensure we can ask for PROT_SAO.
+        * We can't really verify that it does the right thing, but at least we
+        * confirm the kernel will accept it.
+        */
+       p = mmap(NULL, SIZE, PROT_READ | PROT_WRITE | PROT_SAO,
+                MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+       FAIL_IF(p == MAP_FAILED);
+
+       /* Write to the mapping, to at least cause a fault */
+       memset(p, 0xaa, SIZE);
+
+       return 0;
+}
+
+int main(void)
+{
+       return test_harness(test_prot_sao, "prot-sao");
+}
diff --git a/tools/usb/Build b/tools/usb/Build
new file mode 100644 (file)
index 0000000..2ad6f97
--- /dev/null
@@ -0,0 +1,2 @@
+testusb-y += testusb.o
+ffs-test-y += ffs-test.o
index 01d758d..1b128e5 100644 (file)
@@ -1,14 +1,51 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for USB tools
+include ../scripts/Makefile.include
 
-PTHREAD_LIBS = -lpthread
-WARNINGS = -Wall -Wextra
-CFLAGS = $(WARNINGS) -g -I../include
-LDFLAGS = $(PTHREAD_LIBS)
+bindir ?= /usr/bin
 
-all: testusb ffs-test
-%: %.c
-       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+endif
+
+# Do not use make's built-in rules
+# (this improves performance and avoids hard-to-debug behaviour);
+MAKEFLAGS += -r
+
+override CFLAGS += -O2 -Wall -Wextra -g -D_GNU_SOURCE -I$(OUTPUT)include -I$(srctree)/tools/include
+override LDFLAGS += -lpthread
+
+ALL_TARGETS := testusb ffs-test
+ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
+
+all: $(ALL_PROGRAMS)
+
+export srctree OUTPUT CC LD CFLAGS
+include $(srctree)/tools/build/Makefile.include
+
+TESTUSB_IN := $(OUTPUT)testusb-in.o
+$(TESTUSB_IN): FORCE
+       $(Q)$(MAKE) $(build)=testusb
+$(OUTPUT)testusb: $(TESTUSB_IN)
+       $(QUIET_LINK)$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+
+FFS_TEST_IN := $(OUTPUT)ffs-test-in.o
+$(FFS_TEST_IN): FORCE
+       $(Q)$(MAKE) $(build)=ffs-test
+$(OUTPUT)ffs-test: $(FFS_TEST_IN)
+       $(QUIET_LINK)$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
 
 clean:
-       $(RM) testusb ffs-test
+       rm -f $(ALL_PROGRAMS)
+       find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete -o -name '\.*.o.cmd' -delete
+
+install: $(ALL_PROGRAMS)
+       install -d -m 755 $(DESTDIR)$(bindir);          \
+       for program in $(ALL_PROGRAMS); do              \
+               install $$program $(DESTDIR)$(bindir);  \
+       done
+
+FORCE:
+
+.PHONY: all install clean FORCE prepare
index 737666d..67cd0b8 100644 (file)
@@ -482,7 +482,8 @@ static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
         * count is also read inside the mmu_lock critical section.
         */
        kvm->mmu_notifier_count++;
-       need_tlb_flush = kvm_unmap_hva_range(kvm, range->start, range->end);
+       need_tlb_flush = kvm_unmap_hva_range(kvm, range->start, range->end,
+                                            range->flags);
        need_tlb_flush |= kvm->tlbs_dirty;
        /* we've to flush the tlb before the pages can be freed */
        if (need_tlb_flush)