aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio.txt6
-rw-r--r--Documentation/devicetree/bindings/gpio/mrvl-gpio.txt7
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt107
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt5
-rw-r--r--MAINTAINERS4
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Makefile2
-rw-r--r--arch/alpha/include/asm/floppy.h2
-rw-r--r--arch/alpha/kernel/irq.c7
-rw-r--r--arch/alpha/kernel/irq_alpha.c10
-rw-r--r--arch/alpha/kernel/sys_nautilus.c5
-rw-r--r--arch/alpha/kernel/sys_titan.c14
-rw-r--r--arch/arm/Kconfig14
-rw-r--r--arch/arm/Kconfig.debug9
-rw-r--r--arch/arm/boot/dts/Makefile6
-rw-r--r--arch/arm/boot/dts/armada-370-mirabox.dts2
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi6
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi4
-rw-r--r--arch/arm/boot/dts/kirkwood-cloudbox.dts89
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts180
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2mini.dts1
-rw-r--r--arch/arm/boot/dts/mmp2.dtsi2
-rw-r--r--arch/arm/boot/dts/orion5x.dtsi9
-rw-r--r--arch/arm/boot/dts/pxa168.dtsi2
-rw-r--r--arch/arm/boot/dts/pxa910.dtsi2
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen-reference.dts47
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi98
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts66
-rw-r--r--arch/arm/boot/dts/sh73a0-reference.dtsi24
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi44
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi4
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi4
-rw-r--r--arch/arm/boot/dts/spear310.dtsi4
-rw-r--r--arch/arm/boot/dts/spear320.dtsi4
-rw-r--r--arch/arm/configs/da8xx_omapl_defconfig1
-rw-r--r--arch/arm/configs/davinci_all_defconfig1
-rw-r--r--arch/arm/configs/kirkwood_defconfig53
-rw-r--r--arch/arm/configs/msm_defconfig154
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/arm/include/asm/delay.h2
-rw-r--r--arch/arm/include/asm/highmem.h7
-rw-r--r--arch/arm/include/asm/mmu_context.h2
-rw-r--r--arch/arm/include/asm/tlbflush.h15
-rw-r--r--arch/arm/include/debug/pxa.S33
-rw-r--r--arch/arm/kernel/entry-common.S12
-rw-r--r--arch/arm/kernel/head.S2
-rw-r--r--arch/arm/kernel/hw_breakpoint.c6
-rw-r--r--arch/arm/kernel/setup.c24
-rw-r--r--arch/arm/kernel/smp.c3
-rw-r--r--arch/arm/kernel/smp_tlb.c66
-rw-r--r--arch/arm/kvm/vgic.c35
-rw-r--r--arch/arm/lib/delay.c8
-rw-r--r--arch/arm/mach-cns3xxx/core.c16
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/cns3xxx.h16
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c6
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c7
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c25
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c7
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c15
-rw-r--r--arch/arm/mach-davinci/devices.c2
-rw-r--r--arch/arm/mach-davinci/usb.c2
-rw-r--r--arch/arm/mach-ep93xx/include/mach/uncompress.h10
-rw-r--r--arch/arm/mach-imx/common.h2
-rw-r--r--arch/arm/mach-imx/hotplug.c12
-rw-r--r--arch/arm/mach-imx/src.c12
-rw-r--r--arch/arm/mach-kirkwood/Kconfig334
-rw-r--r--arch/arm/mach-kirkwood/Makefile42
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c18
-rw-r--r--arch/arm/mach-kirkwood/board-ns2.c3
-rw-r--r--arch/arm/mach-kirkwood/board-readynas.c28
-rw-r--r--arch/arm/mach-kirkwood/common.h12
-rw-r--r--arch/arm/mach-kirkwood/guruplug-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c1
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c1
-rw-r--r--arch/arm/mach-mmp/aspenite.c7
-rw-r--r--arch/arm/mach-mmp/avengers_lite.c7
-rw-r--r--arch/arm/mach-mmp/brownstone.c7
-rw-r--r--arch/arm/mach-mmp/clock-mmp2.c2
-rw-r--r--arch/arm/mach-mmp/clock-pxa168.c2
-rw-r--r--arch/arm/mach-mmp/clock-pxa910.c2
-rw-r--r--arch/arm/mach-mmp/flint.c7
-rw-r--r--arch/arm/mach-mmp/gplugd.c7
-rw-r--r--arch/arm/mach-mmp/include/mach/debug-macro.S30
-rw-r--r--arch/arm/mach-mmp/jasper.c8
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c4
-rw-r--r--arch/arm/mach-mmp/mmp2-dt.c2
-rw-r--r--arch/arm/mach-mmp/mmp2.c2
-rw-r--r--arch/arm/mach-mmp/pxa168.c2
-rw-r--r--arch/arm/mach-mmp/pxa910.c2
-rw-r--r--arch/arm/mach-mmp/tavorevb.c7
-rw-r--r--arch/arm/mach-mmp/teton_bga.c7
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c7
-rw-r--r--arch/arm/mach-msm/timer.c5
-rw-r--r--arch/arm/mach-mvebu/irq-armada-370-xp.c8
-rw-r--r--arch/arm/mach-omap1/clock_data.c12
-rw-r--r--arch/arm/mach-omap1/include/mach/usb.h2
-rw-r--r--arch/arm/mach-omap1/usb.c6
-rw-r--r--arch/arm/mach-omap2/Makefile3
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c6
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c4
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c56
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c53
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c20
-rw-r--r--arch/arm/mach-omap2/common.h3
-rw-r--r--arch/arm/mach-omap2/io.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c7
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c7
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c6
-rw-r--r--arch/arm/mach-omap2/timer.c4
-rw-r--r--arch/arm/mach-pxa/Kconfig2
-rw-r--r--arch/arm/mach-pxa/devices.c29
-rw-r--r--arch/arm/mach-pxa/devices.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/debug-macro.S23
-rw-r--r--arch/arm/mach-pxa/pxa25x.c11
-rw-r--r--arch/arm/mach-pxa/pxa27x.c7
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c23
-rw-r--r--arch/arm/mach-pxa/pxa930.c17
-rw-r--r--arch/arm/mach-shmobile/Kconfig27
-rw-r--r--arch/arm/mach-shmobile/Makefile9
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c172
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c91
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c300
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c52
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c208
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c107
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c230
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c104
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c75
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c87
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c13
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c8
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c7
-rw-r--r--arch/arm/mach-shmobile/headsmp-scu.S (renamed from arch/arm/mach-shmobile/headsmp-sh73a0.S)15
-rw-r--r--arch/arm/mach-shmobile/hotplug.c68
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h21
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7740.h74
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h324
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h29
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h363
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7779.c27
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c8
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c4
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c104
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c36
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c86
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c129
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c36
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c1
-rw-r--r--arch/arm/mach-ux500/board-mop500.c12
-rw-r--r--arch/arm/mach-ux500/board-mop500.h1
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c5
-rw-r--r--arch/arm/mm/cache-l2x0.c11
-rw-r--r--arch/arm/mm/context.c3
-rw-r--r--arch/arm/mm/mmu.c73
-rw-r--r--arch/arm/mm/proc-v7.S19
-rw-r--r--arch/mips/Kconfig7
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c5
-rw-r--r--arch/mips/bcm63xx/nvram.c7
-rw-r--r--arch/mips/bcm63xx/setup.c2
-rw-r--r--arch/mips/cavium-octeon/setup.c5
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h4
-rw-r--r--arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h4
-rw-r--r--arch/mips/include/asm/mipsregs.h209
-rw-r--r--arch/mips/include/asm/signal.h2
-rw-r--r--arch/mips/include/uapi/asm/signal.h8
-rw-r--r--arch/mips/kernel/Makefile25
-rw-r--r--arch/mips/kernel/cpu-probe.c13
-rw-r--r--arch/mips/kernel/linux32.c2
-rw-r--r--arch/mips/kernel/mcount.S11
-rw-r--r--arch/mips/kernel/proc.c2
-rw-r--r--arch/mips/kernel/traps.c2
-rw-r--r--arch/mips/lib/bitops.c16
-rw-r--r--arch/mips/lib/csum_partial.S4
-rw-r--r--arch/mips/mm/c-r4k.c6
-rw-r--r--arch/mips/mm/sc-mips.c6
-rw-r--r--arch/mips/pci/pci-alchemy.c4
-rw-r--r--arch/s390/include/asm/pgtable.h4
-rw-r--r--arch/s390/lib/uaccess_pt.c83
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c13
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c13
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c11
-rw-r--r--arch/sh/kernel/cpu/sh3/pinmux-sh7720.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c13
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c13
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-shx3.c17
-rw-r--r--arch/tile/kernel/setup.c25
-rw-r--r--arch/x86/boot/compressed/Makefile5
-rw-r--r--arch/x86/include/asm/syscall.h4
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/x86.c13
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/acpi_i2c.c2
-rw-r--r--drivers/acpi/pci_root.c76
-rw-r--r--drivers/acpi/processor_idle.c13
-rw-r--r--drivers/base/power/qos.c60
-rw-r--r--drivers/base/regmap/regcache-rbtree.c2
-rw-r--r--drivers/base/regmap/regmap.c9
-rw-r--r--drivers/block/aoe/aoecmd.c3
-rw-r--r--drivers/block/loop.c9
-rw-r--r--drivers/char/hw_random/core.c9
-rw-r--r--drivers/char/virtio_console.c44
-rw-r--r--drivers/clk/mmp/clk-mmp2.c2
-rw-r--r--drivers/clk/mmp/clk-pxa168.c2
-rw-r--r--drivers/clk/mmp/clk-pxa910.c2
-rw-r--r--drivers/clk/tegra/clk-tegra20.c2
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c10
-rw-r--r--drivers/cpufreq/cpufreq_governor.h6
-rw-r--r--drivers/dma/Kconfig1
-rw-r--r--drivers/eisa/pci_eisa.c67
-rw-r--r--drivers/gpio/gpio-ich.c2
-rw-r--r--drivers/gpio/gpio-pl061.c117
-rw-r--r--drivers/gpio/gpio-pxa.c151
-rw-r--r--drivers/gpio/gpio-stmpe.c15
-rw-r--r--drivers/gpio/gpiolib-of.c15
-rw-r--r--drivers/gpu/drm/drm_crtc.c2
-rw-r--r--drivers/gpu/drm/drm_fops.c6
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c2
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c40
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/base.c17
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c18
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c32
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c26
-rw-r--r--drivers/hid/hid-core.c13
-rw-r--r--drivers/hid/hid-ids.h5
-rw-r--r--drivers/hid/hid-magicmouse.c29
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c1
-rw-r--r--drivers/infiniband/hw/qib/qib_sd7220.c2
-rw-r--r--drivers/md/dm-cache-target.c51
-rw-r--r--drivers/media/platform/Kconfig2
-rw-r--r--drivers/media/radio/radio-ma901.c11
-rw-r--r--drivers/net/bonding/bond_main.c5
-rw-r--r--drivers/net/bonding/bond_sysfs.c92
-rw-r--r--drivers/net/can/sja1000/Kconfig1
-rw-r--r--drivers/net/can/sja1000/plx_pci.c4
-rw-r--r--drivers/net/can/sja1000/sja1000.c6
-rw-r--r--drivers/net/can/sja1000/sja1000.h2
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e.h3
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e_main.c20
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c7
-rw-r--r--drivers/net/ethernet/calxeda/xgmac.c9
-rw-r--r--drivers/net/ethernet/davicom/dm9000.c214
-rw-r--r--drivers/net/ethernet/davicom/dm9000.h11
-rw-r--r--drivers/net/ethernet/freescale/fec.c82
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_ethtool.c14
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c7
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c7
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c11
-rw-r--r--drivers/net/ethernet/marvell/sky2.c2
-rw-r--r--drivers/net/ethernet/marvell/sky2.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c4
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c28
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c28
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h2
-rw-r--r--drivers/net/ethernet/ti/cpsw.c2
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c2
-rw-r--r--drivers/net/usb/smsc75xx.c12
-rw-r--r--drivers/net/wireless/ath/ath9k/link.c3
-rw-r--r--drivers/net/wireless/b43/dma.c65
-rw-r--r--drivers/net/wireless/b43/phy_n.c8
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c369
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c64
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c9
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c18
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/ucode.c4
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c13
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c3
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c1
-rw-r--r--drivers/nfc/microread/mei.c38
-rw-r--r--drivers/pci/pci-acpi.c15
-rw-r--r--drivers/pci/pci-driver.c5
-rw-r--r--drivers/pci/pcie/portdrv_pci.c13
-rw-r--r--drivers/pci/rom.c67
-rw-r--r--drivers/pinctrl/Kconfig1
-rw-r--r--drivers/pinctrl/core.c39
-rw-r--r--drivers/pinctrl/devicetree.c4
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-mvebu.c6
-rw-r--r--drivers/pinctrl/pinconf-generic.c14
-rw-r--r--drivers/pinctrl/pinconf.c2
-rw-r--r--drivers/pinctrl/pinconf.h8
-rw-r--r--drivers/pinctrl/pinctrl-abx500.c7
-rw-r--r--drivers/pinctrl/pinctrl-at91.c6
-rw-r--r--drivers/pinctrl/pinctrl-bcm2835.c6
-rw-r--r--drivers/pinctrl/pinctrl-exynos5440.c6
-rw-r--r--drivers/pinctrl/pinctrl-falcon.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx.c6
-rw-r--r--drivers/pinctrl/pinctrl-lantiq.c4
-rw-r--r--drivers/pinctrl/pinctrl-mxs.c6
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c6
-rw-r--r--drivers/pinctrl/pinctrl-pxa3xx.c4
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c6
-rw-r--r--drivers/pinctrl/pinctrl-single.c515
-rw-r--r--drivers/pinctrl/pinctrl-sirf.c4
-rw-r--r--drivers/pinctrl/pinctrl-sunxi.c978
-rw-r--r--drivers/pinctrl/pinctrl-tegra.c6
-rw-r--r--drivers/pinctrl/pinctrl-u300.c6
-rw-r--r--drivers/pinctrl/pinctrl-xway.c2
-rw-r--r--drivers/pinctrl/sh-pfc/Kconfig1
-rw-r--r--drivers/pinctrl/sh-pfc/core.c261
-rw-r--r--drivers/pinctrl/sh-pfc/core.h54
-rw-r--r--drivers/pinctrl/sh-pfc/gpio.c363
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-r8a7740.c694
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-r8a7779.c1648
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7203.c488
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7264.c460
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7269.c624
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7372.c323
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh73a0.c2656
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7720.c333
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7722.c480
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7723.c642
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7724.c638
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7734.c55
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7757.c620
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7785.c354
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7786.c296
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-shx3.c148
-rw-r--r--drivers/pinctrl/sh-pfc/pinctrl.c484
-rw-r--r--drivers/pinctrl/sh-pfc/sh_pfc.h135
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c4
-rw-r--r--drivers/rtc/rtc-at91rm9200.c50
-rw-r--r--drivers/rtc/rtc-at91rm9200.h1
-rw-r--r--drivers/s390/block/scm_blk.c11
-rw-r--r--drivers/s390/block/scm_drv.c2
-rw-r--r--drivers/s390/char/tty3270.c16
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c6
-rw-r--r--drivers/scsi/fcoe/fcoe.c15
-rw-r--r--drivers/scsi/fcoe/fcoe_ctlr.c60
-rw-r--r--drivers/scsi/libfc/fc_disc.c26
-rw-r--r--drivers/spi/Kconfig3
-rw-r--r--drivers/spi/spi-bcm63xx.c3
-rw-r--r--drivers/spi/spi-mpc512x-psc.c2
-rw-r--r--drivers/spi/spi-pxa2xx.c1
-rw-r--r--drivers/spi/spi-s3c64xx.c41
-rw-r--r--drivers/spi/spi-tegra20-slink.c25
-rw-r--r--drivers/spi/spi.c17
-rw-r--r--drivers/usb/core/port.c1
-rw-r--r--drivers/video/fbmon.c2
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c1
-rw-r--r--drivers/video/uvesafb.c3
-rw-r--r--firmware/Makefile2
-rw-r--r--firmware/qlogic/sd7220.fw.ihex (renamed from firmware/intel/sd7220.fw.ihex)0
-rw-r--r--fs/block_dev.c1
-rw-r--r--fs/ext4/extents.c11
-rw-r--r--fs/ext4/indirect.c4
-rw-r--r--fs/gfs2/file.c5
-rw-r--r--fs/gfs2/incore.h1
-rw-r--r--fs/gfs2/lock_dlm.c39
-rw-r--r--fs/gfs2/rgrp.c32
-rw-r--r--fs/nfsd/nfs4xdr.c2
-rw-r--r--fs/reiserfs/xattr.c4
-rw-r--r--fs/ubifs/super.c12
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/devfreq.h16
-rw-r--r--include/linux/gpio-pxa.h1
-rw-r--r--include/linux/kvm_host.h2
-rw-r--r--include/linux/kvm_types.h1
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/pinctrl/pinctrl.h6
-rw-r--r--include/linux/signal.h4
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/scsi/libfc.h3
-rw-r--r--[-rwxr-xr-x]include/sound/max98090.h0
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--ipc/msg.c1
-rw-r--r--mm/mmap.c2
-rw-r--r--mm/nommu.c2
-rw-r--r--net/core/dev.c8
-rw-r--r--net/core/dev_addr_lists.c6
-rw-r--r--net/core/flow.c2
-rw-r--r--net/core/rtnetlink.c4
-rw-r--r--net/ipv4/devinet.c6
-rw-r--r--net/ipv6/addrconf.c27
-rw-r--r--net/ipv6/ip6_input.c12
-rw-r--r--net/ipv6/netfilter/ip6t_NPT.c2
-rw-r--r--net/key/af_key.c1
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/chan.c17
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/iface.c37
-rw-r--r--net/mac80211/mesh.c3
-rw-r--r--net/mac80211/mlme.c6
-rw-r--r--net/mac80211/offchannel.c23
-rw-r--r--net/mac80211/rx.c14
-rw-r--r--net/mac80211/sta_info.c12
-rw-r--r--net/netfilter/nf_conntrack_standalone.c1
-rw-r--r--net/netfilter/nfnetlink_acct.c2
-rw-r--r--net/netfilter/nfnetlink_queue_core.c4
-rw-r--r--net/nfc/llcp/llcp.c8
-rw-r--r--net/nfc/llcp/sock.c6
-rw-r--r--net/sched/sch_cbq.c5
-rw-r--r--net/sched/sch_fq_codel.c2
-rw-r--r--net/sched/sch_generic.c2
-rw-r--r--net/unix/af_unix.c6
-rw-r--r--net/vmw_vsock/af_vsock.c6
-rw-r--r--net/vmw_vsock/vmci_transport.c31
-rw-r--r--net/vmw_vsock/vsock_addr.c10
-rw-r--r--net/vmw_vsock/vsock_addr.h2
-rw-r--r--net/wireless/core.c64
-rw-r--r--net/wireless/core.h3
-rw-r--r--net/wireless/nl80211.c52
-rw-r--r--net/wireless/scan.c24
-rw-r--r--net/wireless/sme.c6
-rw-r--r--net/wireless/trace.h5
-rw-r--r--net/wireless/wext-sme.c6
-rw-r--r--net/xfrm/xfrm_replay.c66
-rw-r--r--sound/pci/hda/hda_codec.c2
-rw-r--r--sound/pci/hda/hda_eld.c2
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/hda_intel.c6
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--[-rwxr-xr-x]sound/soc/codecs/max98090.c0
-rw-r--r--[-rwxr-xr-x]sound/soc/codecs/max98090.h0
-rw-r--r--sound/soc/codecs/si476x.c1
-rw-r--r--sound/soc/codecs/wm_adsp.c5
-rw-r--r--sound/soc/fsl/imx-ssi.c5
-rw-r--r--sound/soc/fsl/pcm030-audio-fabric.c2
-rw-r--r--sound/soc/sh/dma-sh7760.c4
-rw-r--r--sound/soc/soc-core.c8
-rw-r--r--sound/soc/soc-dapm.c14
-rw-r--r--sound/soc/spear/spear_pcm.c12
-rw-r--r--sound/usb/clock.c45
-rw-r--r--virt/kvm/kvm_main.c47
437 files changed, 14402 insertions, 8103 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index a33628759d36..d933af370697 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -98,7 +98,7 @@ announce the pinrange to the pin ctrl subsystem. For example,
98 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank"; 98 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
99 reg = <0x1460 0x18>; 99 reg = <0x1460 0x18>;
100 gpio-controller; 100 gpio-controller;
101 gpio-ranges = <&pinctrl1 20 10>, <&pinctrl2 50 20>; 101 gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
102 102
103 } 103 }
104 104
@@ -107,8 +107,8 @@ where,
107 107
108 Next values specify the base pin and number of pins for the range 108 Next values specify the base pin and number of pins for the range
109 handled by 'qe_pio_e' gpio. In the given example from base pin 20 to 109 handled by 'qe_pio_e' gpio. In the given example from base pin 20 to
110 pin 29 under pinctrl1 and pin 50 to pin 69 under pinctrl2 is handled 110 pin 29 under pinctrl1 with gpio offset 0 and pin 50 to pin 69 under
111 by this gpio controller. 111 pinctrl2 with gpio offset 10 is handled by this gpio controller.
112 112
113The pinctrl node must have "#gpio-range-cells" property to show number of 113The pinctrl node must have "#gpio-range-cells" property to show number of
114arguments to pass with phandle from gpio controllers node. 114arguments to pass with phandle from gpio controllers node.
diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
index e13787498bcf..9b3f1d4a88d6 100644
--- a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
@@ -1,7 +1,10 @@
1* Marvell PXA GPIO controller 1* Marvell PXA GPIO controller
2 2
3Required properties: 3Required properties:
4- compatible : Should be "mrvl,pxa-gpio" or "mrvl,mmp-gpio" 4- compatible : Should be "intel,pxa25x-gpio", "intel,pxa26x-gpio",
5 "intel,pxa27x-gpio", "intel,pxa3xx-gpio",
6 "marvell,pxa93x-gpio", "marvell,mmp-gpio" or
7 "marvell,mmp2-gpio".
5- reg : Address and length of the register set for the device 8- reg : Address and length of the register set for the device
6- interrupts : Should be the port interrupt shared by all gpio pins. 9- interrupts : Should be the port interrupt shared by all gpio pins.
7 There're three gpio interrupts in arch-pxa, and they're gpio0, 10 There're three gpio interrupts in arch-pxa, and they're gpio0,
@@ -18,7 +21,7 @@ Required properties:
18Example: 21Example:
19 22
20 gpio: gpio@d4019000 { 23 gpio: gpio@d4019000 {
21 compatible = "mrvl,mmp-gpio"; 24 compatible = "marvell,mmp-gpio";
22 reg = <0xd4019000 0x1000>; 25 reg = <0xd4019000 0x1000>;
23 interrupts = <49>; 26 interrupts = <49>;
24 interrupt-name = "gpio_mux"; 27 interrupt-name = "gpio_mux";
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
index 2c81e45f1374..fa1746b639b9 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
@@ -1,7 +1,9 @@
1One-register-per-pin type device tree based pinctrl driver 1One-register-per-pin type device tree based pinctrl driver
2 2
3Required properties: 3Required properties:
4- compatible : "pinctrl-single" 4- compatible : "pinctrl-single" or "pinconf-single".
5 "pinctrl-single" means that pinconf isn't supported.
6 "pinconf-single" means that generic pinconf is supported.
5 7
6- reg : offset and length of the register set for the mux registers 8- reg : offset and length of the register set for the mux registers
7 9
@@ -14,9 +16,61 @@ Optional properties:
14- pinctrl-single,function-off : function off mode for disabled state if 16- pinctrl-single,function-off : function off mode for disabled state if
15 available and same for all registers; if not specified, disabling of 17 available and same for all registers; if not specified, disabling of
16 pin functions is ignored 18 pin functions is ignored
19
17- pinctrl-single,bit-per-mux : boolean to indicate that one register controls 20- pinctrl-single,bit-per-mux : boolean to indicate that one register controls
18 more than one pin 21 more than one pin
19 22
23- pinctrl-single,drive-strength : array of value that are used to configure
24 drive strength in the pinmux register. They're value of drive strength
25 current and drive strength mask.
26
27 /* drive strength current, mask */
28 pinctrl-single,power-source = <0x30 0xf0>;
29
30- pinctrl-single,bias-pullup : array of value that are used to configure the
31 input bias pullup in the pinmux register.
32
33 /* input, enabled pullup bits, disabled pullup bits, mask */
34 pinctrl-single,bias-pullup = <0 1 0 1>;
35
36- pinctrl-single,bias-pulldown : array of value that are used to configure the
37 input bias pulldown in the pinmux register.
38
39 /* input, enabled pulldown bits, disabled pulldown bits, mask */
40 pinctrl-single,bias-pulldown = <2 2 0 2>;
41
42 * Two bits to control input bias pullup and pulldown: User should use
43 pinctrl-single,bias-pullup & pinctrl-single,bias-pulldown. One bit means
44 pullup, and the other one bit means pulldown.
45 * Three bits to control input bias enable, pullup and pulldown. User should
46 use pinctrl-single,bias-pullup & pinctrl-single,bias-pulldown. Input bias
47 enable bit should be included in pullup or pulldown bits.
48 * Although driver could set PIN_CONFIG_BIAS_DISABLE, there's no property as
49 pinctrl-single,bias-disable. Because pinctrl single driver could implement
50 it by calling pulldown, pullup disabled.
51
52- pinctrl-single,input-schmitt : array of value that are used to configure
53 input schmitt in the pinmux register. In some silicons, there're two input
54 schmitt value (rising-edge & falling-edge) in the pinmux register.
55
56 /* input schmitt value, mask */
57 pinctrl-single,input-schmitt = <0x30 0x70>;
58
59- pinctrl-single,input-schmitt-enable : array of value that are used to
60 configure input schmitt enable or disable in the pinmux register.
61
62 /* input, enable bits, disable bits, mask */
63 pinctrl-single,input-schmitt-enable = <0x30 0x40 0 0x70>;
64
65- pinctrl-single,gpio-range : list of value that are used to configure a GPIO
66 range. They're value of subnode phandle, pin base in pinctrl device, pin
67 number in this range, GPIO function value of this GPIO range.
68 The number of parameters is depend on #pinctrl-single,gpio-range-cells
69 property.
70
71 /* pin base, nr pins & gpio function */
72 pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1>;
73
20This driver assumes that there is only one register for each pin (unless the 74This driver assumes that there is only one register for each pin (unless the
21pinctrl-single,bit-per-mux is set), and uses the common pinctrl bindings as 75pinctrl-single,bit-per-mux is set), and uses the common pinctrl bindings as
22specified in the pinctrl-bindings.txt document in this directory. 76specified in the pinctrl-bindings.txt document in this directory.
@@ -42,6 +96,20 @@ Where 0xdc is the offset from the pinctrl register base address for the
42device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to 96device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to
43be used when applying this change to the register. 97be used when applying this change to the register.
44 98
99
100Optional sub-node: In case some pins could be configured as GPIO in the pinmux
101register, those pins could be defined as a GPIO range. This sub-node is required
102by pinctrl-single,gpio-range property.
103
104Required properties in sub-node:
105- #pinctrl-single,gpio-range-cells : the number of parameters after phandle in
106 pinctrl-single,gpio-range property.
107
108 range: gpio-range {
109 #pinctrl-single,gpio-range-cells = <3>;
110 };
111
112
45Example: 113Example:
46 114
47/* SoC common file */ 115/* SoC common file */
@@ -76,6 +144,29 @@ control_devconf0: pinmux@48002274 {
76 pinctrl-single,function-mask = <0x5F>; 144 pinctrl-single,function-mask = <0x5F>;
77}; 145};
78 146
147/* third controller instance for pins in gpio domain */
148pmx_gpio: pinmux@d401e000 {
149 compatible = "pinconf-single";
150 reg = <0xd401e000 0x0330>;
151 #address-cells = <1>;
152 #size-cells = <1>;
153 ranges;
154
155 pinctrl-single,register-width = <32>;
156 pinctrl-single,function-mask = <7>;
157
158 /* sparse GPIO range could be supported */
159 pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1
160 &range 12 1 0 &range 13 29 1
161 &range 43 1 0 &range 44 49 1
162 &range 94 1 1 &range 96 2 1>;
163
164 range: gpio-range {
165 #pinctrl-single,gpio-range-cells = <3>;
166 };
167};
168
169
79/* board specific .dts file */ 170/* board specific .dts file */
80 171
81&pmx_core { 172&pmx_core {
@@ -96,6 +187,15 @@ control_devconf0: pinmux@48002274 {
96 >; 187 >;
97 }; 188 };
98 189
190 uart0_pins: pinmux_uart0_pins {
191 pinctrl-single,pins = <
192 0x208 0 /* UART0_RXD (IOCFG138) */
193 0x20c 0 /* UART0_TXD (IOCFG139) */
194 >;
195 pinctrl-single,bias-pulldown = <0 2 2>;
196 pinctrl-single,bias-pullup = <0 1 1>;
197 };
198
99 /* map uart2 pins */ 199 /* map uart2 pins */
100 uart2_pins: pinmux_uart2_pins { 200 uart2_pins: pinmux_uart2_pins {
101 pinctrl-single,pins = < 201 pinctrl-single,pins = <
@@ -122,6 +222,11 @@ control_devconf0: pinmux@48002274 {
122 222
123}; 223};
124 224
225&uart1 {
226 pinctrl-names = "default";
227 pinctrl-0 = <&uart0_pins>;
228};
229
125&uart2 { 230&uart2 {
126 pinctrl-names = "default"; 231 pinctrl-names = "default";
127 pinctrl-0 = <&uart2_pins>; 232 pinctrl-0 = <&uart2_pins>;
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 4499bd948860..95731a08f257 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -890,9 +890,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
890 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) 890 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off)
891 power_save - Automatic power-saving timeout (in second, 0 = 891 power_save - Automatic power-saving timeout (in second, 0 =
892 disable) 892 disable)
893 power_save_controller - Support runtime D3 of HD-audio controller 893 power_save_controller - Reset HD-audio controller in power-saving mode
894 (-1 = on for supported chip (default), false = off, 894 (default = on)
895 true = force to on even for unsupported hardware)
896 align_buffer_size - Force rounding of buffer/period sizes to multiples 895 align_buffer_size - Force rounding of buffer/period sizes to multiples
897 of 128 bytes. This is more efficient in terms of memory 896 of 128 bytes. This is more efficient in terms of memory
898 access but isn't required by the HDA spec and prevents 897 access but isn't required by the HDA spec and prevents
diff --git a/MAINTAINERS b/MAINTAINERS
index 74e58a4d035b..836a6183c37f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5065,9 +5065,8 @@ S: Maintained
5065F: drivers/net/ethernet/marvell/sk* 5065F: drivers/net/ethernet/marvell/sk*
5066 5066
5067MARVELL LIBERTAS WIRELESS DRIVER 5067MARVELL LIBERTAS WIRELESS DRIVER
5068M: Dan Williams <dcbw@redhat.com>
5069L: libertas-dev@lists.infradead.org 5068L: libertas-dev@lists.infradead.org
5070S: Maintained 5069S: Orphan
5071F: drivers/net/wireless/libertas/ 5070F: drivers/net/wireless/libertas/
5072 5071
5073MARVELL MV643XX ETHERNET DRIVER 5072MARVELL MV643XX ETHERNET DRIVER
@@ -5569,6 +5568,7 @@ F: include/uapi/linux/if_*
5569F: include/uapi/linux/netdevice.h 5568F: include/uapi/linux/netdevice.h
5570 5569
5571NETXEN (1/10) GbE SUPPORT 5570NETXEN (1/10) GbE SUPPORT
5571M: Manish Chopra <manish.chopra@qlogic.com>
5572M: Sony Chacko <sony.chacko@qlogic.com> 5572M: Sony Chacko <sony.chacko@qlogic.com>
5573M: Rajesh Borundia <rajesh.borundia@qlogic.com> 5573M: Rajesh Borundia <rajesh.borundia@qlogic.com>
5574L: netdev@vger.kernel.org 5574L: netdev@vger.kernel.org
diff --git a/Makefile b/Makefile
index 58a165b02af1..6db672b15bda 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 9 2PATCHLEVEL = 9
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc5 4EXTRAVERSION = -rc6
5NAME = Unicycling Gorilla 5NAME = Unicycling Gorilla
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 4759fe751aa1..2cc3cc519c54 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -12,7 +12,7 @@ NM := $(NM) -B
12 12
13LDFLAGS_vmlinux := -static -N #-relax 13LDFLAGS_vmlinux := -static -N #-relax
14CHECKFLAGS += -D__alpha__ -m64 14CHECKFLAGS += -D__alpha__ -m64
15cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data 15cflags-y := -pipe -mno-fp-regs -ffixed-8
16cflags-y += $(call cc-option, -fno-jump-tables) 16cflags-y += $(call cc-option, -fno-jump-tables)
17 17
18cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 18cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 46cefbd50e73..bae97eb19d26 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -26,7 +26,7 @@
26#define fd_disable_irq() disable_irq(FLOPPY_IRQ) 26#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
27#define fd_cacheflush(addr,size) /* nothing */ 27#define fd_cacheflush(addr,size) /* nothing */
28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\ 28#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\
29 IRQF_DISABLED, "floppy", NULL) 29 0, "floppy", NULL)
30#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) 30#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL)
31 31
32#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index 2872accd2215..7b2be251c30f 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -117,13 +117,6 @@ handle_irq(int irq)
117 return; 117 return;
118 } 118 }
119 119
120 /*
121 * From here we must proceed with IPL_MAX. Note that we do not
122 * explicitly enable interrupts afterwards - some MILO PALcode
123 * (namely LX164 one) seems to have severe problems with RTI
124 * at IPL 0.
125 */
126 local_irq_disable();
127 irq_enter(); 120 irq_enter();
128 generic_handle_irq_desc(irq, desc); 121 generic_handle_irq_desc(irq, desc);
129 irq_exit(); 122 irq_exit();
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index 772ddfdb71a8..f433fc11877a 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -45,6 +45,14 @@ do_entInt(unsigned long type, unsigned long vector,
45 unsigned long la_ptr, struct pt_regs *regs) 45 unsigned long la_ptr, struct pt_regs *regs)
46{ 46{
47 struct pt_regs *old_regs; 47 struct pt_regs *old_regs;
48
49 /*
50 * Disable interrupts during IRQ handling.
51 * Note that there is no matching local_irq_enable() due to
52 * severe problems with RTI at IPL0 and some MILO PALcode
53 * (namely LX164).
54 */
55 local_irq_disable();
48 switch (type) { 56 switch (type) {
49 case 0: 57 case 0:
50#ifdef CONFIG_SMP 58#ifdef CONFIG_SMP
@@ -62,7 +70,6 @@ do_entInt(unsigned long type, unsigned long vector,
62 { 70 {
63 long cpu; 71 long cpu;
64 72
65 local_irq_disable();
66 smp_percpu_timer_interrupt(regs); 73 smp_percpu_timer_interrupt(regs);
67 cpu = smp_processor_id(); 74 cpu = smp_processor_id();
68 if (cpu != boot_cpuid) { 75 if (cpu != boot_cpuid) {
@@ -222,7 +229,6 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr,
222 229
223struct irqaction timer_irqaction = { 230struct irqaction timer_irqaction = {
224 .handler = timer_interrupt, 231 .handler = timer_interrupt,
225 .flags = IRQF_DISABLED,
226 .name = "timer", 232 .name = "timer",
227}; 233};
228 234
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4d4c046f708d..1383f8601a93 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -188,6 +188,10 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
188extern void free_reserved_mem(void *, void *); 188extern void free_reserved_mem(void *, void *);
189extern void pcibios_claim_one_bus(struct pci_bus *); 189extern void pcibios_claim_one_bus(struct pci_bus *);
190 190
191static struct resource irongate_io = {
192 .name = "Irongate PCI IO",
193 .flags = IORESOURCE_IO,
194};
191static struct resource irongate_mem = { 195static struct resource irongate_mem = {
192 .name = "Irongate PCI MEM", 196 .name = "Irongate PCI MEM",
193 .flags = IORESOURCE_MEM, 197 .flags = IORESOURCE_MEM,
@@ -209,6 +213,7 @@ nautilus_init_pci(void)
209 213
210 irongate = pci_get_bus_and_slot(0, 0); 214 irongate = pci_get_bus_and_slot(0, 0);
211 bus->self = irongate; 215 bus->self = irongate;
216 bus->resource[0] = &irongate_io;
212 bus->resource[1] = &irongate_mem; 217 bus->resource[1] = &irongate_mem;
213 218
214 pci_bus_size_bridges(bus); 219 pci_bus_size_bridges(bus);
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 5cf4a481b8c5..a53cf03f49d5 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -280,15 +280,15 @@ titan_late_init(void)
280 * all reported to the kernel as machine checks, so the handler 280 * all reported to the kernel as machine checks, so the handler
281 * is a nop so it can be called to count the individual events. 281 * is a nop so it can be called to count the individual events.
282 */ 282 */
283 titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED, 283 titan_request_irq(63+16, titan_intr_nop, 0,
284 "CChip Error", NULL); 284 "CChip Error", NULL);
285 titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED, 285 titan_request_irq(62+16, titan_intr_nop, 0,
286 "PChip 0 H_Error", NULL); 286 "PChip 0 H_Error", NULL);
287 titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED, 287 titan_request_irq(61+16, titan_intr_nop, 0,
288 "PChip 1 H_Error", NULL); 288 "PChip 1 H_Error", NULL);
289 titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED, 289 titan_request_irq(60+16, titan_intr_nop, 0,
290 "PChip 0 C_Error", NULL); 290 "PChip 0 C_Error", NULL);
291 titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED, 291 titan_request_irq(59+16, titan_intr_nop, 0,
292 "PChip 1 C_Error", NULL); 292 "PChip 1 C_Error", NULL);
293 293
294 /* 294 /*
@@ -348,9 +348,9 @@ privateer_init_pci(void)
348 * Hook a couple of extra err interrupts that the 348 * Hook a couple of extra err interrupts that the
349 * common titan code won't. 349 * common titan code won't.
350 */ 350 */
351 titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED, 351 titan_request_irq(53+16, titan_intr_nop, 0,
352 "NMI", NULL); 352 "NMI", NULL);
353 titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED, 353 titan_request_irq(50+16, titan_intr_nop, 0,
354 "Temperature Warning", NULL); 354 "Temperature Warning", NULL);
355 355
356 /* 356 /*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 13b739469c51..1cacda426a0e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1183,9 +1183,9 @@ config ARM_NR_BANKS
1183 default 8 1183 default 8
1184 1184
1185config IWMMXT 1185config IWMMXT
1186 bool "Enable iWMMXt support" 1186 bool "Enable iWMMXt support" if !CPU_PJ4
1187 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 1187 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4
1188 default y if PXA27x || PXA3xx || ARCH_MMP 1188 default y if PXA27x || PXA3xx || ARCH_MMP || CPU_PJ4
1189 help 1189 help
1190 Enable support for iWMMXt context switching at run time if 1190 Enable support for iWMMXt context switching at run time if
1191 running on a CPU that supports it. 1191 running on a CPU that supports it.
@@ -1439,6 +1439,16 @@ config ARM_ERRATA_775420
1439 to deadlock. This workaround puts DSB before executing ISB if 1439 to deadlock. This workaround puts DSB before executing ISB if
1440 an abort may occur on cache maintenance. 1440 an abort may occur on cache maintenance.
1441 1441
1442config ARM_ERRATA_798181
1443 bool "ARM errata: TLBI/DSB failure on Cortex-A15"
1444 depends on CPU_V7 && SMP
1445 help
1446 On Cortex-A15 (r0p0..r3p2) the TLBI*IS/DSB operations are not
1447 adequately shooting down all use of the old entries. This
1448 option enables the Linux kernel workaround for this erratum
1449 which sends an IPI to the CPUs that are running the same ASID
1450 as the one being invalidated.
1451
1442endmenu 1452endmenu
1443 1453
1444source "arch/arm/common/Kconfig" 1454source "arch/arm/common/Kconfig"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9b31f4311ea2..e5d2e6bbe76f 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -312,6 +312,13 @@ choice
312 Say Y here if you want kernel low-level debugging support 312 Say Y here if you want kernel low-level debugging support
313 on PicoXcell based platforms. 313 on PicoXcell based platforms.
314 314
315 config DEBUG_PXA_UART1
316 depends on ARCH_PXA
317 bool "Use PXA UART1 for low-level debug"
318 help
319 Say Y here if you want kernel low-level debugging support
320 on PXA UART1.
321
315 config DEBUG_REALVIEW_STD_PORT 322 config DEBUG_REALVIEW_STD_PORT
316 bool "RealView Default UART" 323 bool "RealView Default UART"
317 depends on ARCH_REALVIEW 324 depends on ARCH_REALVIEW
@@ -593,6 +600,8 @@ config DEBUG_LL_INCLUDE
593 default "debug/mvebu.S" if DEBUG_MVEBU_UART 600 default "debug/mvebu.S" if DEBUG_MVEBU_UART
594 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 601 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
595 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART 602 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
603 default "debug/pxa.S" if DEBUG_PXA_UART1 || DEBUG_MMP_UART2 || \
604 DEBUG_MMP_UART3
596 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART 605 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
597 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1 606 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
598 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ 607 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 9c6255884cbb..c160215ab6d0 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -51,7 +51,8 @@ dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
51dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 51dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
52 integratorcp.dtb 52 integratorcp.dtb
53dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 53dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
54dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ 54dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
55 kirkwood-dns320.dtb \
55 kirkwood-dns325.dtb \ 56 kirkwood-dns325.dtb \
56 kirkwood-dockstar.dtb \ 57 kirkwood-dockstar.dtb \
57 kirkwood-dreamplug.dtb \ 58 kirkwood-dreamplug.dtb \
@@ -65,6 +66,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
65 kirkwood-lschlv2.dtb \ 66 kirkwood-lschlv2.dtb \
66 kirkwood-lsxhl.dtb \ 67 kirkwood-lsxhl.dtb \
67 kirkwood-mplcec4.dtb \ 68 kirkwood-mplcec4.dtb \
69 kirkwood-netgear_readynas_duo_v2.dtb \
68 kirkwood-ns2.dtb \ 70 kirkwood-ns2.dtb \
69 kirkwood-ns2lite.dtb \ 71 kirkwood-ns2lite.dtb \
70 kirkwood-ns2max.dtb \ 72 kirkwood-ns2max.dtb \
@@ -136,7 +138,9 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
136 ccu9540.dtb 138 ccu9540.dtb
137dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 139dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
138 r8a7740-armadillo800eva.dtb \ 140 r8a7740-armadillo800eva.dtb \
141 r8a7779-marzen-reference.dtb \
139 sh73a0-kzm9g.dtb \ 142 sh73a0-kzm9g.dtb \
143 sh73a0-kzm9g-reference.dtb \
140 sh7372-mackerel.dtb 144 sh7372-mackerel.dtb
141dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \ 145dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
142 socfpga_vt.dtb 146 socfpga_vt.dtb
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
index dd0c57dd9f30..3234875824dc 100644
--- a/arch/arm/boot/dts/armada-370-mirabox.dts
+++ b/arch/arm/boot/dts/armada-370-mirabox.dts
@@ -54,7 +54,7 @@
54 }; 54 };
55 55
56 mvsdio@d00d4000 { 56 mvsdio@d00d4000 {
57 pinctrl-0 = <&sdio_pins2>; 57 pinctrl-0 = <&sdio_pins3>;
58 pinctrl-names = "default"; 58 pinctrl-names = "default";
59 status = "okay"; 59 status = "okay";
60 /* 60 /*
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 8188d138020e..a195debb67d3 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -59,6 +59,12 @@
59 "mpp50", "mpp51", "mpp52"; 59 "mpp50", "mpp51", "mpp52";
60 marvell,function = "sd0"; 60 marvell,function = "sd0";
61 }; 61 };
62
63 sdio_pins3: sdio-pins3 {
64 marvell,pins = "mpp48", "mpp49", "mpp50",
65 "mpp51", "mpp52", "mpp53";
66 marvell,function = "sd0";
67 };
62 }; 68 };
63 69
64 gpio0: gpio@d0018100 { 70 gpio0: gpio@d0018100 {
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 9de93096601a..aaa63d0a8096 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -191,8 +191,8 @@
191 191
192 prcmu: prcmu@80157000 { 192 prcmu: prcmu@80157000 {
193 compatible = "stericsson,db8500-prcmu"; 193 compatible = "stericsson,db8500-prcmu";
194 reg = <0x80157000 0x1000>; 194 reg = <0x80157000 0x1000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>;
195 reg-names = "prcmu"; 195 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
196 interrupts = <0 47 0x4>; 196 interrupts = <0 47 0x4>;
197 #address-cells = <1>; 197 #address-cells = <1>;
198 #size-cells = <1>; 198 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/kirkwood-cloudbox.dts b/arch/arm/boot/dts/kirkwood-cloudbox.dts
new file mode 100644
index 000000000000..5f21d4e427b0
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
@@ -0,0 +1,89 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
5
6/ {
7 model = "LaCie CloudBox";
8 compatible = "lacie,cloudbox", "marvell,kirkwood-88f6702", "marvell,kirkwood";
9
10 memory {
11 device_type = "memory";
12 reg = <0x00000000 0x10000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyS0,115200n8";
17 };
18
19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21 pinctrl-0 = < &pmx_spi &pmx_uart0
22 &pmx_cloudbox_sata0 >;
23 pinctrl-names = "default";
24
25 pmx_cloudbox_sata0: pmx-cloudbox-sata0 {
26 marvell,pins = "mpp15";
27 marvell,function = "sata0";
28 };
29 };
30
31 serial@12000 {
32 clock-frequency = <166666667>;
33 status = "okay";
34 };
35
36 sata@80000 {
37 status = "okay";
38 nr-ports = <1>;
39 };
40
41 spi@10600 {
42 status = "okay";
43
44 flash@0 {
45 #address-cells = <1>;
46 #size-cells = <1>;
47 compatible = "mx25l4005a";
48 reg = <0>;
49 spi-max-frequency = <20000000>;
50 mode = <0>;
51
52 partition@0 {
53 reg = <0x0 0x80000>;
54 label = "u-boot";
55 };
56 };
57 };
58 };
59
60 gpio_keys {
61 compatible = "gpio-keys";
62 #address-cells = <1>;
63 #size-cells = <0>;
64
65 button@1 {
66 label = "Power push button";
67 linux,code = <116>;
68 gpios = <&gpio0 16 1>;
69 };
70 };
71
72 gpio-leds {
73 compatible = "gpio-leds";
74
75 red-fail {
76 label = "cloudbox:red:fail";
77 gpios = <&gpio0 14 0>;
78 };
79 blue-sata {
80 label = "cloudbox:blue:sata";
81 gpios = <&gpio0 15 0>;
82 };
83 };
84
85 gpio_poweroff {
86 compatible = "gpio-poweroff";
87 gpios = <&gpio0 17 0>;
88 };
89};
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index bd83b8fc7c83..c3573be7b92c 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -77,6 +77,7 @@
77 }; 77 };
78 78
79 nand@3000000 { 79 nand@3000000 {
80 chip-delay = <40>;
80 status = "okay"; 81 status = "okay";
81 82
82 partition@0 { 83 partition@0 {
diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
new file mode 100644
index 000000000000..1ca66ab83ad6
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
@@ -0,0 +1,180 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6282.dtsi"
5
6/ {
7 model = "NETGEAR ReadyNAS Duo v2";
8 compatible = "netgear,readynas-duo-v2", "netgear,readynas", "marvell,kirkwood-88f6282", "marvell,kirkwood";
9
10 memory { /* 256 MB */
11 device_type = "memory";
12 reg = <0x00000000 0x10000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyS0,115200n8 earlyprintk";
17 };
18
19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_uart0
23 &pmx_button_power
24 &pmx_button_backup
25 &pmx_button_reset
26 &pmx_led_blue_power
27 &pmx_led_blue_activity
28 &pmx_led_blue_disk1
29 &pmx_led_blue_disk2
30 &pmx_led_blue_backup >;
31 pinctrl-names = "default";
32
33 pmx_button_power: pmx-button-power {
34 marvell,pins = "mpp47";
35 marvell,function = "gpio";
36 };
37 pmx_button_backup: pmx-button-backup {
38 marvell,pins = "mpp45";
39 marvell,function = "gpio";
40 };
41 pmx_button_reset: pmx-button-reset {
42 marvell,pins = "mpp13";
43 marvell,function = "gpio";
44 };
45 pmx_led_blue_power: pmx-led-blue-power {
46 marvell,pins = "mpp31";
47 marvell,function = "gpio";
48 };
49 pmx_led_blue_activity: pmx-led-blue-activity {
50 marvell,pins = "mpp38";
51 marvell,function = "gpio";
52 };
53 pmx_led_blue_disk1: pmx-led-blue-disk1 {
54 marvell,pins = "mpp23";
55 marvell,function = "gpio";
56 };
57 pmx_led_blue_disk2: pmx-led-blue-disk2 {
58 marvell,pins = "mpp22";
59 marvell,function = "gpio";
60 };
61 pmx_led_blue_backup: pmx-led-blue-backup {
62 marvell,pins = "mpp29";
63 marvell,function = "gpio";
64 };
65 };
66
67 i2c@11000 {
68 status = "okay";
69
70 rs5c372a: rs5c372a@32 {
71 compatible = "ricoh,rs5c372a";
72 reg = <0x32>;
73 };
74 };
75
76 serial@12000 {
77 status = "okay";
78 };
79
80 nand@3000000 {
81 status = "okay";
82
83 partition@0 {
84 label = "u-boot";
85 reg = <0x0000000 0x180000>;
86 read-only;
87 };
88
89 partition@180000 {
90 label = "u-boot-env";
91 reg = <0x180000 0x20000>;
92 };
93
94 partition@200000 {
95 label = "uImage";
96 reg = <0x0200000 0x600000>;
97 };
98
99 partition@800000 {
100 label = "minirootfs";
101 reg = <0x0800000 0x1000000>;
102 };
103
104 partition@1800000 {
105 label = "jffs2";
106 reg = <0x1800000 0x6800000>;
107 };
108 };
109
110 sata@80000 {
111 status = "okay";
112 nr-ports = <2>;
113 };
114 };
115
116 gpio-leds {
117 compatible = "gpio-leds";
118
119 power_led {
120 label = "status:blue:power_led";
121 gpios = <&gpio0 31 1>; /* GPIO 31 Active Low */
122 linux,default-trigger = "default-on";
123 };
124 activity_led {
125 label = "status:blue:activity_led";
126 gpios = <&gpio1 6 1>; /* GPIO 38 Active Low */
127 };
128 disk1_led {
129 label = "status:blue:disk1_led";
130 gpios = <&gpio0 23 1>; /* GPIO 23 Active Low */
131 };
132 disk2_led {
133 label = "status:blue:disk2_led";
134 gpios = <&gpio0 22 1>; /* GPIO 22 Active Low */
135 };
136 backup_led {
137 label = "status:blue:backup_led";
138 gpios = <&gpio0 29 1>; /* GPIO 29 Active Low*/
139 };
140 };
141
142 gpio_keys {
143 compatible = "gpio-keys";
144 #address-cells = <1>;
145 #size-cells = <0>;
146 button@1 {
147 label = "Power Button";
148 linux,code = <116>; /* KEY_POWER */
149 gpios = <&gpio1 15 1>;
150 };
151 button@2 {
152 label = "Reset Button";
153 linux,code = <0x198>; /* KEY_RESTART */
154 gpios = <&gpio0 13 1>;
155 };
156 button@3 {
157 label = "Backup Button";
158 linux,code = <133>; /* KEY_COPY */
159 gpios = <&gpio1 13 1>;
160 };
161 };
162
163 regulators {
164 compatible = "simple-bus";
165 #address-cells = <1>;
166 #size-cells = <0>;
167
168 usb_power: regulator@1 {
169 compatible = "regulator-fixed";
170 reg = <1>;
171 regulator-name = "USB 3.0 Power";
172 regulator-min-microvolt = <5000000>;
173 regulator-max-microvolt = <5000000>;
174 enable-active-high;
175 regulator-always-on;
176 regulator-boot-on;
177 gpio = <&gpio1 14 0>;
178 };
179 };
180};
diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
index b79f5eb25589..adab1ab25733 100644
--- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
@@ -3,6 +3,7 @@
3/include/ "kirkwood-ns2-common.dtsi" 3/include/ "kirkwood-ns2-common.dtsi"
4 4
5/ { 5/ {
6 /* This machine is embedded in the first LaCie CloudBox product. */
6 model = "LaCie Network Space Mini v2"; 7 model = "LaCie Network Space Mini v2";
7 compatible = "lacie,netspace_mini_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood"; 8 compatible = "lacie,netspace_mini_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
8 9
diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi
index 1429ac05b36d..4e8b08c628c7 100644
--- a/arch/arm/boot/dts/mmp2.dtsi
+++ b/arch/arm/boot/dts/mmp2.dtsi
@@ -160,7 +160,7 @@
160 }; 160 };
161 161
162 gpio@d4019000 { 162 gpio@d4019000 {
163 compatible = "mrvl,mmp-gpio"; 163 compatible = "marvell,mmp2-gpio";
164 #address-cells = <1>; 164 #address-cells = <1>;
165 #size-cells = <1>; 165 #size-cells = <1>;
166 reg = <0xd4019000 0x1000>; 166 reg = <0xd4019000 0x1000>;
diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi
index 8aad00f81ed9..f7bec3b1ba32 100644
--- a/arch/arm/boot/dts/orion5x.dtsi
+++ b/arch/arm/boot/dts/orion5x.dtsi
@@ -13,6 +13,9 @@
13 compatible = "marvell,orion5x"; 13 compatible = "marvell,orion5x";
14 interrupt-parent = <&intc>; 14 interrupt-parent = <&intc>;
15 15
16 aliases {
17 gpio0 = &gpio0;
18 };
16 intc: interrupt-controller { 19 intc: interrupt-controller {
17 compatible = "marvell,orion-intc", "marvell,intc"; 20 compatible = "marvell,orion-intc", "marvell,intc";
18 interrupt-controller; 21 interrupt-controller;
@@ -32,7 +35,9 @@
32 #gpio-cells = <2>; 35 #gpio-cells = <2>;
33 gpio-controller; 36 gpio-controller;
34 reg = <0x10100 0x40>; 37 reg = <0x10100 0x40>;
35 ngpio = <32>; 38 ngpios = <32>;
39 interrupt-controller;
40 #interrupt-cells = <2>;
36 interrupts = <6>, <7>, <8>, <9>; 41 interrupts = <6>, <7>, <8>, <9>;
37 }; 42 };
38 43
@@ -91,7 +96,7 @@
91 reg = <0x90000 0x10000>, 96 reg = <0x90000 0x10000>,
92 <0xf2200000 0x800>; 97 <0xf2200000 0x800>;
93 reg-names = "regs", "sram"; 98 reg-names = "regs", "sram";
94 interrupts = <22>; 99 interrupts = <28>;
95 status = "okay"; 100 status = "okay";
96 }; 101 };
97 }; 102 };
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
index 31a718696080..975dad21ac38 100644
--- a/arch/arm/boot/dts/pxa168.dtsi
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -77,7 +77,7 @@
77 }; 77 };
78 78
79 gpio@d4019000 { 79 gpio@d4019000 {
80 compatible = "mrvl,mmp-gpio"; 80 compatible = "marvell,mmp-gpio";
81 #address-cells = <1>; 81 #address-cells = <1>;
82 #size-cells = <1>; 82 #size-cells = <1>;
83 reg = <0xd4019000 0x1000>; 83 reg = <0xd4019000 0x1000>;
diff --git a/arch/arm/boot/dts/pxa910.dtsi b/arch/arm/boot/dts/pxa910.dtsi
index 825aaca33034..0247c622f580 100644
--- a/arch/arm/boot/dts/pxa910.dtsi
+++ b/arch/arm/boot/dts/pxa910.dtsi
@@ -89,7 +89,7 @@
89 }; 89 };
90 90
91 gpio@d4019000 { 91 gpio@d4019000 {
92 compatible = "mrvl,mmp-gpio"; 92 compatible = "marvell,mmp-gpio";
93 #address-cells = <1>; 93 #address-cells = <1>;
94 #size-cells = <1>; 94 #size-cells = <1>;
95 reg = <0xd4019000 0x1000>; 95 reg = <0xd4019000 0x1000>;
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
new file mode 100644
index 000000000000..72be4c87cfb5
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -0,0 +1,47 @@
1/*
2 * Reference Device Tree Source for the Marzen board
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/dts-v1/;
13/include/ "r8a7779.dtsi"
14
15/ {
16 model = "marzen";
17 compatible = "renesas,marzen-reference", "renesas,r8a7779";
18
19 chosen {
20 bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on";
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0x60000000 0x40000000>;
26 };
27
28 fixedregulator3v3: fixedregulator@0 {
29 compatible = "regulator-fixed";
30 regulator-name = "fixed-3.3V";
31 regulator-min-microvolt = <3300000>;
32 regulator-max-microvolt = <3300000>;
33 regulator-boot-on;
34 regulator-always-on;
35 };
36
37 lan0@18000000 {
38 compatible = "smsc,lan9220", "smsc,lan9115";
39 reg = <0x18000000 0x100>;
40 phy-mode = "mii";
41 interrupt-parent = <&gic>;
42 interrupts = <0 28 0x4>;
43 reg-io-width = <4>;
44 vddvario-supply = <&fixedregulator3v3>;
45 vdd33a-supply = <&fixedregulator3v3>;
46 };
47};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
new file mode 100644
index 000000000000..fe5c6f213271
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -0,0 +1,98 @@
1/*
2 * Device Tree Source for Renesas r8a7779
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/include/ "skeleton.dtsi"
13
14/ {
15 compatible = "renesas,r8a7779";
16
17 cpus {
18 #address-cells = <1>;
19 #size-cells = <0>;
20
21 cpu@0 {
22 device_type = "cpu";
23 compatible = "arm,cortex-a9";
24 reg = <0>;
25 };
26 cpu@1 {
27 device_type = "cpu";
28 compatible = "arm,cortex-a9";
29 reg = <1>;
30 };
31 cpu@2 {
32 device_type = "cpu";
33 compatible = "arm,cortex-a9";
34 reg = <2>;
35 };
36 cpu@3 {
37 device_type = "cpu";
38 compatible = "arm,cortex-a9";
39 reg = <3>;
40 };
41 };
42
43 gic: interrupt-controller@f0001000 {
44 compatible = "arm,cortex-a9-gic";
45 #interrupt-cells = <3>;
46 interrupt-controller;
47 reg = <0xf0001000 0x1000>,
48 <0xf0000100 0x100>;
49 };
50
51 i2c0: i2c@0xffc70000 {
52 #address-cells = <1>;
53 #size-cells = <0>;
54 compatible = "renesas,rmobile-iic";
55 reg = <0xffc70000 0x1000>;
56 interrupt-parent = <&gic>;
57 interrupts = <0 79 0x4>;
58 };
59
60 i2c1: i2c@0xffc71000 {
61 #address-cells = <1>;
62 #size-cells = <0>;
63 compatible = "renesas,rmobile-iic";
64 reg = <0xffc71000 0x1000>;
65 interrupt-parent = <&gic>;
66 interrupts = <0 82 0x4>;
67 };
68
69 i2c2: i2c@0xffc72000 {
70 #address-cells = <1>;
71 #size-cells = <0>;
72 compatible = "renesas,rmobile-iic";
73 reg = <0xffc72000 0x1000>;
74 interrupt-parent = <&gic>;
75 interrupts = <0 80 0x4>;
76 };
77
78 i2c3: i2c@0xffc73000 {
79 #address-cells = <1>;
80 #size-cells = <0>;
81 compatible = "renesas,rmobile-iic";
82 reg = <0xffc73000 0x1000>;
83 interrupt-parent = <&gic>;
84 interrupts = <0 81 0x4>;
85 };
86
87 thermal@ffc48000 {
88 compatible = "renesas,rcar-thermal";
89 reg = <0xffc48000 0x38>;
90 };
91
92 sata: sata@fc600000 {
93 compatible = "renesas,rcar-sata";
94 reg = <0xfc600000 0x2000>;
95 interrupt-parent = <&gic>;
96 interrupts = <0 100 0x4>;
97 };
98};
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
new file mode 100644
index 000000000000..f33b5ccb7446
--- /dev/null
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -0,0 +1,66 @@
1/*
2 * Device Tree Source for the KZM-A9-GT board
3 *
4 * Copyright (C) 2012 Horms Solutions Ltd.
5 *
6 * Based on sh73a0-kzm9g.dts
7 * Copyright (C) 2012 Renesas Solutions Corp.
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13
14/dts-v1/;
15/include/ "sh73a0.dtsi"
16
17/ {
18 model = "KZM-A9-GT";
19 compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
20
21 chosen {
22 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x41000000 0x1e800000>;
28 };
29
30 reg_1p8v: regulator@0 {
31 compatible = "regulator-fixed";
32 regulator-name = "fixed-1.8V";
33 regulator-min-microvolt = <1800000>;
34 regulator-max-microvolt = <1800000>;
35 regulator-always-on;
36 regulator-boot-on;
37 };
38
39 reg_3p3v: regulator@1 {
40 compatible = "regulator-fixed";
41 regulator-name = "fixed-3.3V";
42 regulator-min-microvolt = <3300000>;
43 regulator-max-microvolt = <3300000>;
44 regulator-always-on;
45 regulator-boot-on;
46 };
47};
48
49&mmcif {
50 bus-width = <8>;
51 vmmc-supply = <&reg_1p8v>;
52 status = "okay";
53};
54
55&sdhi0 {
56 vmmc-supply = <&reg_3p3v>;
57 bus-width = <4>;
58 status = "okay";
59};
60
61&sdhi2 {
62 vmmc-supply = <&reg_3p3v>;
63 bus-width = <4>;
64 broken-cd;
65 status = "okay";
66};
diff --git a/arch/arm/boot/dts/sh73a0-reference.dtsi b/arch/arm/boot/dts/sh73a0-reference.dtsi
deleted file mode 100644
index d4bb0125b2b2..000000000000
--- a/arch/arm/boot/dts/sh73a0-reference.dtsi
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Device Tree Source for the SH73A0 SoC
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/include/ "sh73a0.dtsi"
12
13/ {
14 compatible = "renesas,sh73a0";
15
16 mmcif: mmcif@0x10010000 {
17 compatible = "renesas,sh-mmcif";
18 reg = <0xe6bd0000 0x100>;
19 interrupt-parent = <&gic>;
20 interrupts = <0 140 0x4
21 0 141 0x4>;
22 reg-io-width = <4>;
23 };
24};
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 8a59465d0231..3e4d383ac6d9 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -97,4 +97,48 @@
97 0 189 0x4 97 0 189 0x4
98 0 190 0x4>; 98 0 190 0x4>;
99 }; 99 };
100
101 mmcif: mmcif@0x10010000 {
102 compatible = "renesas,sh-mmcif";
103 reg = <0xe6bd0000 0x100>;
104 interrupt-parent = <&gic>;
105 interrupts = <0 140 0x4
106 0 141 0x4>;
107 reg-io-width = <4>;
108 status = "disabled";
109 };
110
111 sdhi0: sdhi@0xee100000 {
112 compatible = "renesas,r8a7740-sdhi";
113 reg = <0xee100000 0x100>;
114 interrupt-parent = <&gic>;
115 interrupts = <0 83 4
116 0 84 4
117 0 85 4>;
118 cap-sd-highspeed;
119 status = "disabled";
120 };
121
122 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
123 sdhi1: sdhi@0xee120000 {
124 compatible = "renesas,r8a7740-sdhi";
125 reg = <0xee120000 0x100>;
126 interrupt-parent = <&gic>;
127 interrupts = <0 88 4
128 0 89 4>;
129 toshiba,mmc-wrprotect-disable;
130 cap-sd-highspeed;
131 status = "disabled";
132 };
133
134 sdhi2: sdhi@0xee140000 {
135 compatible = "renesas,r8a7740-sdhi";
136 reg = <0xee140000 0x100>;
137 interrupt-parent = <&gic>;
138 interrupts = <0 104 4
139 0 105 4>;
140 toshiba,mmc-wrprotect-disable;
141 cap-sd-highspeed;
142 status = "disabled";
143 };
100}; 144};
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 1513c1927cc8..122ae94076c8 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -89,7 +89,7 @@
89 pinmux: pinmux@e0700000 { 89 pinmux: pinmux@e0700000 {
90 compatible = "st,spear1310-pinmux"; 90 compatible = "st,spear1310-pinmux";
91 reg = <0xe0700000 0x1000>; 91 reg = <0xe0700000 0x1000>;
92 #gpio-range-cells = <2>; 92 #gpio-range-cells = <3>;
93 }; 93 };
94 94
95 apb { 95 apb {
@@ -212,7 +212,7 @@
212 interrupt-controller; 212 interrupt-controller;
213 gpio-controller; 213 gpio-controller;
214 #gpio-cells = <2>; 214 #gpio-cells = <2>;
215 gpio-ranges = <&pinmux 0 246>; 215 gpio-ranges = <&pinmux 0 0 246>;
216 status = "disabled"; 216 status = "disabled";
217 217
218 st-plgpio,ngpio = <246>; 218 st-plgpio,ngpio = <246>;
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 34da11aa6795..c511c4772efd 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -63,7 +63,7 @@
63 pinmux: pinmux@e0700000 { 63 pinmux: pinmux@e0700000 {
64 compatible = "st,spear1340-pinmux"; 64 compatible = "st,spear1340-pinmux";
65 reg = <0xe0700000 0x1000>; 65 reg = <0xe0700000 0x1000>;
66 #gpio-range-cells = <2>; 66 #gpio-range-cells = <3>;
67 }; 67 };
68 68
69 pwm: pwm@e0180000 { 69 pwm: pwm@e0180000 {
@@ -127,7 +127,7 @@
127 interrupt-controller; 127 interrupt-controller;
128 gpio-controller; 128 gpio-controller;
129 #gpio-cells = <2>; 129 #gpio-cells = <2>;
130 gpio-ranges = <&pinmux 0 252>; 130 gpio-ranges = <&pinmux 0 0 252>;
131 status = "disabled"; 131 status = "disabled";
132 132
133 st-plgpio,ngpio = <250>; 133 st-plgpio,ngpio = <250>;
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index ab45b8c81982..95372080eea6 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -25,7 +25,7 @@
25 pinmux: pinmux@b4000000 { 25 pinmux: pinmux@b4000000 {
26 compatible = "st,spear310-pinmux"; 26 compatible = "st,spear310-pinmux";
27 reg = <0xb4000000 0x1000>; 27 reg = <0xb4000000 0x1000>;
28 #gpio-range-cells = <2>; 28 #gpio-range-cells = <3>;
29 }; 29 };
30 30
31 fsmc: flash@44000000 { 31 fsmc: flash@44000000 {
@@ -102,7 +102,7 @@
102 interrupt-controller; 102 interrupt-controller;
103 gpio-controller; 103 gpio-controller;
104 #gpio-cells = <2>; 104 #gpio-cells = <2>;
105 gpio-ranges = <&pinmux 0 102>; 105 gpio-ranges = <&pinmux 0 0 102>;
106 status = "disabled"; 106 status = "disabled";
107 107
108 st-plgpio,ngpio = <102>; 108 st-plgpio,ngpio = <102>;
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index caa5520b1fd4..ffea342aeec9 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -24,7 +24,7 @@
24 pinmux: pinmux@b3000000 { 24 pinmux: pinmux@b3000000 {
25 compatible = "st,spear320-pinmux"; 25 compatible = "st,spear320-pinmux";
26 reg = <0xb3000000 0x1000>; 26 reg = <0xb3000000 0x1000>;
27 #gpio-range-cells = <2>; 27 #gpio-range-cells = <3>;
28 }; 28 };
29 29
30 clcd@90000000 { 30 clcd@90000000 {
@@ -130,7 +130,7 @@
130 interrupt-controller; 130 interrupt-controller;
131 gpio-controller; 131 gpio-controller;
132 #gpio-cells = <2>; 132 #gpio-cells = <2>;
133 gpio-ranges = <&pinmux 0 102>; 133 gpio-ranges = <&pinmux 0 0 102>;
134 status = "disabled"; 134 status = "disabled";
135 135
136 st-plgpio,ngpio = <102>; 136 st-plgpio,ngpio = <102>;
diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig
index 9aaad36a1728..7c868139bdb0 100644
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ b/arch/arm/configs/da8xx_omapl_defconfig
@@ -5,6 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_CGROUPS=y
8CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
9CONFIG_EXPERT=y 10CONFIG_EXPERT=y
10CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 3edc78a40b66..c86fd75e181a 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -5,6 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_CGROUPS=y
8CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
9CONFIG_EXPERT=y 10CONFIG_EXPERT=y
10CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 13482ea58b09..7205a7a889a5 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -10,45 +10,48 @@ CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
12CONFIG_ARCH_KIRKWOOD=y 12CONFIG_ARCH_KIRKWOOD=y
13CONFIG_MACH_D2NET_V2=y
13CONFIG_MACH_DB88F6281_BP=y 14CONFIG_MACH_DB88F6281_BP=y
15CONFIG_MACH_DOCKSTAR=y
16CONFIG_MACH_ESATA_SHEEVAPLUG=y
17CONFIG_MACH_GURUPLUG=y
18CONFIG_MACH_INETSPACE_V2=y
19CONFIG_MACH_MV88F6281GTW_GE=y
20CONFIG_MACH_NET2BIG_V2=y
21CONFIG_MACH_NET5BIG_V2=y
22CONFIG_MACH_NETSPACE_MAX_V2=y
23CONFIG_MACH_NETSPACE_V2=y
24CONFIG_MACH_OPENRD_BASE=y
25CONFIG_MACH_OPENRD_CLIENT=y
26CONFIG_MACH_OPENRD_ULTIMATE=y
14CONFIG_MACH_RD88F6192_NAS=y 27CONFIG_MACH_RD88F6192_NAS=y
15CONFIG_MACH_RD88F6281=y 28CONFIG_MACH_RD88F6281=y
16CONFIG_MACH_MV88F6281GTW_GE=y
17CONFIG_MACH_SHEEVAPLUG=y 29CONFIG_MACH_SHEEVAPLUG=y
18CONFIG_MACH_ESATA_SHEEVAPLUG=y 30CONFIG_MACH_T5325=y
19CONFIG_MACH_GURUPLUG=y 31CONFIG_MACH_TS219=y
20CONFIG_MACH_DREAMPLUG_DT=y 32CONFIG_MACH_TS41X=y
21CONFIG_MACH_ICONNECT_DT=y 33CONFIG_MACH_CLOUDBOX_DT=y
22CONFIG_MACH_DLINK_KIRKWOOD_DT=y 34CONFIG_MACH_DLINK_KIRKWOOD_DT=y
23CONFIG_MACH_IB62X0_DT=y
24CONFIG_MACH_TS219_DT=y
25CONFIG_MACH_DOCKSTAR_DT=y 35CONFIG_MACH_DOCKSTAR_DT=y
36CONFIG_MACH_DREAMPLUG_DT=y
26CONFIG_MACH_GOFLEXNET_DT=y 37CONFIG_MACH_GOFLEXNET_DT=y
27CONFIG_MACH_LSXL_DT=y 38CONFIG_MACH_GURUPLUG_DT=y
39CONFIG_MACH_IB62X0_DT=y
40CONFIG_MACH_ICONNECT_DT=y
41CONFIG_MACH_INETSPACE_V2_DT=y
28CONFIG_MACH_IOMEGA_IX2_200_DT=y 42CONFIG_MACH_IOMEGA_IX2_200_DT=y
29CONFIG_MACH_KM_KIRKWOOD_DT=y 43CONFIG_MACH_KM_KIRKWOOD_DT=y
30CONFIG_MACH_INETSPACE_V2_DT=y 44CONFIG_MACH_LSXL_DT=y
31CONFIG_MACH_MPLCEC4_DT=y 45CONFIG_MACH_MPLCEC4_DT=y
32CONFIG_MACH_NETSPACE_V2_DT=y
33CONFIG_MACH_NETSPACE_MAX_V2_DT=y
34CONFIG_MACH_NETSPACE_LITE_V2_DT=y 46CONFIG_MACH_NETSPACE_LITE_V2_DT=y
47CONFIG_MACH_NETSPACE_MAX_V2_DT=y
35CONFIG_MACH_NETSPACE_MINI_V2_DT=y 48CONFIG_MACH_NETSPACE_MINI_V2_DT=y
49CONFIG_MACH_NETSPACE_V2_DT=y
50CONFIG_MACH_NSA310_DT=y
36CONFIG_MACH_OPENBLOCKS_A6_DT=y 51CONFIG_MACH_OPENBLOCKS_A6_DT=y
52CONFIG_MACH_READYNAS_DT=y
37CONFIG_MACH_TOPKICK_DT=y 53CONFIG_MACH_TOPKICK_DT=y
38CONFIG_MACH_TS219=y 54CONFIG_MACH_TS219_DT=y
39CONFIG_MACH_TS41X=y
40CONFIG_MACH_DOCKSTAR=y
41CONFIG_MACH_OPENRD_BASE=y
42CONFIG_MACH_OPENRD_CLIENT=y
43CONFIG_MACH_OPENRD_ULTIMATE=y
44CONFIG_MACH_NETSPACE_V2=y
45CONFIG_MACH_INETSPACE_V2=y
46CONFIG_MACH_NETSPACE_MAX_V2=y
47CONFIG_MACH_D2NET_V2=y
48CONFIG_MACH_NET2BIG_V2=y
49CONFIG_MACH_NET5BIG_V2=y
50CONFIG_MACH_T5325=y
51CONFIG_MACH_NSA310_DT=y
52# CONFIG_CPU_FEROCEON_OLD_ID is not set 55# CONFIG_CPU_FEROCEON_OLD_ID is not set
53CONFIG_PREEMPT=y 56CONFIG_PREEMPT=y
54CONFIG_AEABI=y 57CONFIG_AEABI=y
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index 2b8f7affc1eb..44f929167d7e 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -1,72 +1,136 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
2CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
3CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
4CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
5CONFIG_SLAB=y 7CONFIG_SYSCTL_SYSCALL=y
6# CONFIG_BLK_DEV_BSG is not set 8CONFIG_KALLSYMS_ALL=y
7# CONFIG_IOSCHED_DEADLINE is not set 9CONFIG_EMBEDDED=y
8# CONFIG_IOSCHED_CFQ is not set 10# CONFIG_SLUB_DEBUG is not set
11# CONFIG_COMPAT_BRK is not set
12CONFIG_PROFILING=y
13CONFIG_OPROFILE=y
14CONFIG_KPROBES=y
15CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y
17CONFIG_MODULE_FORCE_UNLOAD=y
18CONFIG_MODVERSIONS=y
19CONFIG_PARTITION_ADVANCED=y
9CONFIG_ARCH_MSM=y 20CONFIG_ARCH_MSM=y
10CONFIG_MACH_HALIBUT=y 21CONFIG_ARCH_MSM8X60=y
11CONFIG_NO_HZ=y 22CONFIG_ARCH_MSM8960=y
12CONFIG_HIGH_RES_TIMERS=y 23CONFIG_SMP=y
13CONFIG_PREEMPT=y 24CONFIG_PREEMPT=y
14CONFIG_AEABI=y 25CONFIG_AEABI=y
15# CONFIG_OABI_COMPAT is not set 26CONFIG_HIGHMEM=y
16CONFIG_ZBOOT_ROM_TEXT=0x0 27CONFIG_HIGHPTE=y
17CONFIG_ZBOOT_ROM_BSS=0x0 28CONFIG_CLEANCACHE=y
18CONFIG_CMDLINE="mem=64M console=ttyMSM,115200n8" 29CONFIG_CC_STACKPROTECTOR=y
19CONFIG_PM=y 30CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_AUTO_ZRELADDR=y
33CONFIG_VFP=y
34CONFIG_NEON=y
35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
20CONFIG_NET=y 36CONFIG_NET=y
37CONFIG_PACKET=y
21CONFIG_UNIX=y 38CONFIG_UNIX=y
22CONFIG_INET=y 39CONFIG_INET=y
40CONFIG_IP_ADVANCED_ROUTER=y
41CONFIG_IP_MULTIPLE_TABLES=y
42CONFIG_IP_ROUTE_VERBOSE=y
43CONFIG_IP_PNP=y
44CONFIG_IP_PNP_DHCP=y
23# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
24# CONFIG_INET_XFRM_MODE_TUNNEL is not set 46# CONFIG_INET_XFRM_MODE_TUNNEL is not set
25# CONFIG_INET_XFRM_MODE_BEET is not set 47# CONFIG_INET_XFRM_MODE_BEET is not set
26# CONFIG_INET_DIAG is not set 48# CONFIG_INET_LRO is not set
27# CONFIG_IPV6 is not set 49# CONFIG_IPV6 is not set
28CONFIG_MTD=y 50CONFIG_CFG80211=y
29CONFIG_MTD_PARTITIONS=y 51CONFIG_RFKILL=y
30CONFIG_MTD_CMDLINE_PARTS=y 52CONFIG_BLK_DEV_LOOP=y
31CONFIG_MTD_CHAR=y 53CONFIG_BLK_DEV_RAM=y
32CONFIG_MTD_BLOCK=y 54CONFIG_SCSI=y
55CONFIG_SCSI_TGT=y
56CONFIG_BLK_DEV_SD=y
57CONFIG_CHR_DEV_SG=y
58CONFIG_CHR_DEV_SCH=y
59CONFIG_SCSI_MULTI_LUN=y
60CONFIG_SCSI_CONSTANTS=y
61CONFIG_SCSI_LOGGING=y
62CONFIG_SCSI_SCAN_ASYNC=y
33CONFIG_NETDEVICES=y 63CONFIG_NETDEVICES=y
34CONFIG_DUMMY=y 64CONFIG_DUMMY=y
35CONFIG_NET_ETHERNET=y 65CONFIG_PHYLIB=y
36CONFIG_SMC91X=y 66CONFIG_SLIP=y
37CONFIG_PPP=y 67CONFIG_SLIP_COMPRESSED=y
38CONFIG_PPP_ASYNC=y 68CONFIG_SLIP_MODE_SLIP6=y
39CONFIG_PPP_DEFLATE=y 69CONFIG_USB_USBNET=y
40CONFIG_PPP_BSDCOMP=y 70# CONFIG_USB_NET_AX8817X is not set
41# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 71# CONFIG_USB_NET_ZAURUS is not set
42CONFIG_INPUT_EVDEV=y 72CONFIG_INPUT_EVDEV=y
43# CONFIG_KEYBOARD_ATKBD is not set 73# CONFIG_KEYBOARD_ATKBD is not set
44# CONFIG_INPUT_MOUSE is not set 74# CONFIG_MOUSE_PS2 is not set
75CONFIG_INPUT_JOYSTICK=y
45CONFIG_INPUT_TOUCHSCREEN=y 76CONFIG_INPUT_TOUCHSCREEN=y
46CONFIG_INPUT_MISC=y 77CONFIG_INPUT_MISC=y
47# CONFIG_SERIO is not set 78CONFIG_INPUT_UINPUT=y
48CONFIG_VT_HW_CONSOLE_BINDING=y 79CONFIG_SERIO_LIBPS2=y
80# CONFIG_LEGACY_PTYS is not set
49CONFIG_SERIAL_MSM=y 81CONFIG_SERIAL_MSM=y
50CONFIG_SERIAL_MSM_CONSOLE=y 82CONFIG_SERIAL_MSM_CONSOLE=y
51# CONFIG_LEGACY_PTYS is not set 83CONFIG_HW_RANDOM=y
52# CONFIG_HW_RANDOM is not set
53CONFIG_I2C=y 84CONFIG_I2C=y
54# CONFIG_HWMON is not set 85CONFIG_I2C_CHARDEV=y
55CONFIG_VIDEO_OUTPUT_CONTROL=y 86CONFIG_SPI=y
87CONFIG_SSBI=y
88CONFIG_DEBUG_GPIO=y
89CONFIG_GPIO_SYSFS=y
90CONFIG_POWER_SUPPLY=y
91CONFIG_THERMAL=y
92CONFIG_REGULATOR=y
93CONFIG_MEDIA_SUPPORT=y
56CONFIG_FB=y 94CONFIG_FB=y
57CONFIG_FB_MODE_HELPERS=y 95CONFIG_SOUND=y
58CONFIG_FB_TILEBLITTING=y 96CONFIG_SND=y
59CONFIG_FB_MSM=y 97CONFIG_SND_DYNAMIC_MINORS=y
60# CONFIG_VGA_CONSOLE is not set 98# CONFIG_SND_ARM is not set
61CONFIG_FRAMEBUFFER_CONSOLE=y 99# CONFIG_SND_SPI is not set
100# CONFIG_SND_USB is not set
101CONFIG_SND_SOC=y
102CONFIG_HID_BATTERY_STRENGTH=y
103CONFIG_USB=y
104CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
105CONFIG_USB_MON=y
106CONFIG_USB_EHCI_HCD=y
107CONFIG_USB_EHCI_MSM=y
108CONFIG_USB_ACM=y
109CONFIG_USB_SERIAL=y
110CONFIG_USB_GADGET=y
111CONFIG_USB_GADGET_DEBUG_FILES=y
112CONFIG_USB_GADGET_VBUS_DRAW=500
62CONFIG_NEW_LEDS=y 113CONFIG_NEW_LEDS=y
63CONFIG_LEDS_CLASS=y 114CONFIG_RTC_CLASS=y
64CONFIG_INOTIFY=y 115CONFIG_STAGING=y
116CONFIG_MSM_IOMMU=y
117CONFIG_EXT2_FS=y
118CONFIG_EXT2_FS_XATTR=y
119CONFIG_EXT3_FS=y
120# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
121CONFIG_EXT4_FS=y
122CONFIG_FUSE_FS=y
123CONFIG_VFAT_FS=y
65CONFIG_TMPFS=y 124CONFIG_TMPFS=y
125CONFIG_NFS_FS=y
126CONFIG_NFS_V3_ACL=y
127CONFIG_NFS_V4=y
128CONFIG_CIFS=y
129CONFIG_PRINTK_TIME=y
66CONFIG_MAGIC_SYSRQ=y 130CONFIG_MAGIC_SYSRQ=y
67CONFIG_DEBUG_KERNEL=y 131CONFIG_LOCKUP_DETECTOR=y
68CONFIG_SCHEDSTATS=y 132# CONFIG_DETECT_HUNG_TASK is not set
69CONFIG_DEBUG_MUTEXES=y 133# CONFIG_SCHED_DEBUG is not set
70CONFIG_DEBUG_SPINLOCK_SLEEP=y 134CONFIG_TIMER_STATS=y
71CONFIG_DEBUG_INFO=y 135CONFIG_DEBUG_INFO=y
72CONFIG_DEBUG_LL=y 136CONFIG_DYNAMIC_DEBUG=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index bd07864f14a0..33903ca0d879 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -93,6 +93,7 @@ CONFIG_BLK_DEV_RAM_SIZE=16384
93CONFIG_SENSORS_LIS3LV02D=m 93CONFIG_SENSORS_LIS3LV02D=m
94CONFIG_SENSORS_TSL2550=m 94CONFIG_SENSORS_TSL2550=m
95CONFIG_SENSORS_LIS3_I2C=m 95CONFIG_SENSORS_LIS3_I2C=m
96CONFIG_BMP085_I2C=m
96CONFIG_SCSI=y 97CONFIG_SCSI=y
97CONFIG_BLK_DEV_SD=y 98CONFIG_BLK_DEV_SD=y
98CONFIG_SCSI_MULTI_LUN=y 99CONFIG_SCSI_MULTI_LUN=y
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index 720799fd3a81..dff714d886d5 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -24,7 +24,7 @@ extern struct arm_delay_ops {
24 void (*delay)(unsigned long); 24 void (*delay)(unsigned long);
25 void (*const_udelay)(unsigned long); 25 void (*const_udelay)(unsigned long);
26 void (*udelay)(unsigned long); 26 void (*udelay)(unsigned long);
27 bool const_clock; 27 unsigned long ticks_per_jiffy;
28} arm_delay_ops; 28} arm_delay_ops;
29 29
30#define __delay(n) arm_delay_ops.delay(n) 30#define __delay(n) arm_delay_ops.delay(n)
diff --git a/arch/arm/include/asm/highmem.h b/arch/arm/include/asm/highmem.h
index 8c5e828f484d..91b99abe7a95 100644
--- a/arch/arm/include/asm/highmem.h
+++ b/arch/arm/include/asm/highmem.h
@@ -41,6 +41,13 @@ extern void kunmap_high(struct page *page);
41#endif 41#endif
42#endif 42#endif
43 43
44/*
45 * Needed to be able to broadcast the TLB invalidation for kmap.
46 */
47#ifdef CONFIG_ARM_ERRATA_798181
48#undef ARCH_NEEDS_KMAP_HIGH_GET
49#endif
50
44#ifdef ARCH_NEEDS_KMAP_HIGH_GET 51#ifdef ARCH_NEEDS_KMAP_HIGH_GET
45extern void *kmap_high_get(struct page *page); 52extern void *kmap_high_get(struct page *page);
46#else 53#else
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 863a6611323c..a7b85e0d0cc1 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -27,6 +27,8 @@ void __check_vmalloc_seq(struct mm_struct *mm);
27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); 27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
28#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) 28#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
29 29
30DECLARE_PER_CPU(atomic64_t, active_asids);
31
30#else /* !CONFIG_CPU_HAS_ASID */ 32#else /* !CONFIG_CPU_HAS_ASID */
31 33
32#ifdef CONFIG_MMU 34#ifdef CONFIG_MMU
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 4db8c8820f0d..9e9c041358ca 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -450,6 +450,21 @@ static inline void local_flush_bp_all(void)
450 isb(); 450 isb();
451} 451}
452 452
453#ifdef CONFIG_ARM_ERRATA_798181
454static inline void dummy_flush_tlb_a15_erratum(void)
455{
456 /*
457 * Dummy TLBIMVAIS. Using the unmapped address 0 and ASID 0.
458 */
459 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
460 dsb();
461}
462#else
463static inline void dummy_flush_tlb_a15_erratum(void)
464{
465}
466#endif
467
453/* 468/*
454 * flush_pmd_entry 469 * flush_pmd_entry
455 * 470 *
diff --git a/arch/arm/include/debug/pxa.S b/arch/arm/include/debug/pxa.S
new file mode 100644
index 000000000000..e1e795aa3d7f
--- /dev/null
+++ b/arch/arm/include/debug/pxa.S
@@ -0,0 +1,33 @@
1/*
2 * Early serial output macro for Marvell PXA/MMP SoC
3 *
4 * Copyright (C) 1994-1999 Russell King
5 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
6 *
7 * Copyright (C) 2013 Haojian Zhuang
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#if defined(CONFIG_DEBUG_PXA_UART1)
15#define PXA_UART_REG_PHYS_BASE 0x40100000
16#define PXA_UART_REG_VIRT_BASE 0xf2100000
17#elif defined(CONFIG_DEBUG_MMP_UART2)
18#define PXA_UART_REG_PHYS_BASE 0xd4017000
19#define PXA_UART_REG_VIRT_BASE 0xfe017000
20#elif defined(CONFIG_DEBUG_MMP_UART3)
21#define PXA_UART_REG_PHYS_BASE 0xd4018000
22#define PXA_UART_REG_VIRT_BASE 0xfe018000
23#else
24#error "Select uart for DEBUG_LL"
25#endif
26
27 .macro addruart, rp, rv, tmp
28 ldr \rp, =PXA_UART_REG_PHYS_BASE
29 ldr \rv, =PXA_UART_REG_VIRT_BASE
30 .endm
31
32#define UART_SHIFT 2
33#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 3248cde504ed..fefd7f971437 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -276,7 +276,13 @@ ENDPROC(ftrace_graph_caller_old)
276 */ 276 */
277 277
278.macro mcount_enter 278.macro mcount_enter
279/*
280 * This pad compensates for the push {lr} at the call site. Note that we are
281 * unable to unwind through a function which does not otherwise save its lr.
282 */
283 UNWIND(.pad #4)
279 stmdb sp!, {r0-r3, lr} 284 stmdb sp!, {r0-r3, lr}
285 UNWIND(.save {r0-r3, lr})
280.endm 286.endm
281 287
282.macro mcount_get_lr reg 288.macro mcount_get_lr reg
@@ -289,6 +295,7 @@ ENDPROC(ftrace_graph_caller_old)
289.endm 295.endm
290 296
291ENTRY(__gnu_mcount_nc) 297ENTRY(__gnu_mcount_nc)
298UNWIND(.fnstart)
292#ifdef CONFIG_DYNAMIC_FTRACE 299#ifdef CONFIG_DYNAMIC_FTRACE
293 mov ip, lr 300 mov ip, lr
294 ldmia sp!, {lr} 301 ldmia sp!, {lr}
@@ -296,17 +303,22 @@ ENTRY(__gnu_mcount_nc)
296#else 303#else
297 __mcount 304 __mcount
298#endif 305#endif
306UNWIND(.fnend)
299ENDPROC(__gnu_mcount_nc) 307ENDPROC(__gnu_mcount_nc)
300 308
301#ifdef CONFIG_DYNAMIC_FTRACE 309#ifdef CONFIG_DYNAMIC_FTRACE
302ENTRY(ftrace_caller) 310ENTRY(ftrace_caller)
311UNWIND(.fnstart)
303 __ftrace_caller 312 __ftrace_caller
313UNWIND(.fnend)
304ENDPROC(ftrace_caller) 314ENDPROC(ftrace_caller)
305#endif 315#endif
306 316
307#ifdef CONFIG_FUNCTION_GRAPH_TRACER 317#ifdef CONFIG_FUNCTION_GRAPH_TRACER
308ENTRY(ftrace_graph_caller) 318ENTRY(ftrace_graph_caller)
319UNWIND(.fnstart)
309 __ftrace_graph_caller 320 __ftrace_graph_caller
321UNWIND(.fnend)
310ENDPROC(ftrace_graph_caller) 322ENDPROC(ftrace_graph_caller)
311#endif 323#endif
312 324
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index e0eb9a1cae77..8bac553fe213 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -267,7 +267,7 @@ __create_page_tables:
267 addne r6, r6, #1 << SECTION_SHIFT 267 addne r6, r6, #1 << SECTION_SHIFT
268 strne r6, [r3] 268 strne r6, [r3]
269 269
270#if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8) 270#if defined(CONFIG_ARM_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8)
271 sub r4, r4, #4 @ Fixup page table pointer 271 sub r4, r4, #4 @ Fixup page table pointer
272 @ for 64-bit descriptors 272 @ for 64-bit descriptors
273#endif 273#endif
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 96093b75ab90..5dc1aa6f0f7d 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -966,7 +966,7 @@ static void reset_ctrl_regs(void *unused)
966 } 966 }
967 967
968 if (err) { 968 if (err) {
969 pr_warning("CPU %d debug is powered down!\n", cpu); 969 pr_warn_once("CPU %d debug is powered down!\n", cpu);
970 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); 970 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
971 return; 971 return;
972 } 972 }
@@ -987,7 +987,7 @@ clear_vcr:
987 isb(); 987 isb();
988 988
989 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { 989 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
990 pr_warning("CPU %d failed to disable vector catch\n", cpu); 990 pr_warn_once("CPU %d failed to disable vector catch\n", cpu);
991 return; 991 return;
992 } 992 }
993 993
@@ -1007,7 +1007,7 @@ clear_vcr:
1007 } 1007 }
1008 1008
1009 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { 1009 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
1010 pr_warning("CPU %d failed to clear debug register pairs\n", cpu); 1010 pr_warn_once("CPU %d failed to clear debug register pairs\n", cpu);
1011 return; 1011 return;
1012 } 1012 }
1013 1013
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 3f6cbb2e3eda..d343a6c3a6d1 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -353,6 +353,23 @@ void __init early_print(const char *str, ...)
353 printk("%s", buf); 353 printk("%s", buf);
354} 354}
355 355
356static void __init cpuid_init_hwcaps(void)
357{
358 unsigned int divide_instrs;
359
360 if (cpu_architecture() < CPU_ARCH_ARMv7)
361 return;
362
363 divide_instrs = (read_cpuid_ext(CPUID_EXT_ISAR0) & 0x0f000000) >> 24;
364
365 switch (divide_instrs) {
366 case 2:
367 elf_hwcap |= HWCAP_IDIVA;
368 case 1:
369 elf_hwcap |= HWCAP_IDIVT;
370 }
371}
372
356static void __init feat_v6_fixup(void) 373static void __init feat_v6_fixup(void)
357{ 374{
358 int id = read_cpuid_id(); 375 int id = read_cpuid_id();
@@ -483,8 +500,11 @@ static void __init setup_processor(void)
483 snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c", 500 snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c",
484 list->elf_name, ENDIANNESS); 501 list->elf_name, ENDIANNESS);
485 elf_hwcap = list->elf_hwcap; 502 elf_hwcap = list->elf_hwcap;
503
504 cpuid_init_hwcaps();
505
486#ifndef CONFIG_ARM_THUMB 506#ifndef CONFIG_ARM_THUMB
487 elf_hwcap &= ~HWCAP_THUMB; 507 elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT);
488#endif 508#endif
489 509
490 feat_v6_fixup(); 510 feat_v6_fixup();
@@ -524,7 +544,7 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
524 size -= start & ~PAGE_MASK; 544 size -= start & ~PAGE_MASK;
525 bank->start = PAGE_ALIGN(start); 545 bank->start = PAGE_ALIGN(start);
526 546
527#ifndef CONFIG_LPAE 547#ifndef CONFIG_ARM_LPAE
528 if (bank->start + size < bank->start) { 548 if (bank->start + size < bank->start) {
529 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " 549 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
530 "32-bit physical address space\n", (long long)start); 550 "32-bit physical address space\n", (long long)start);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 79078edbb9bc..1f2ccccaf009 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -673,9 +673,6 @@ static int cpufreq_callback(struct notifier_block *nb,
673 if (freq->flags & CPUFREQ_CONST_LOOPS) 673 if (freq->flags & CPUFREQ_CONST_LOOPS)
674 return NOTIFY_OK; 674 return NOTIFY_OK;
675 675
676 if (arm_delay_ops.const_clock)
677 return NOTIFY_OK;
678
679 if (!per_cpu(l_p_j_ref, cpu)) { 676 if (!per_cpu(l_p_j_ref, cpu)) {
680 per_cpu(l_p_j_ref, cpu) = 677 per_cpu(l_p_j_ref, cpu) =
681 per_cpu(cpu_data, cpu).loops_per_jiffy; 678 per_cpu(cpu_data, cpu).loops_per_jiffy;
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index bd0300531399..e82e1d248772 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -12,6 +12,7 @@
12 12
13#include <asm/smp_plat.h> 13#include <asm/smp_plat.h>
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15#include <asm/mmu_context.h>
15 16
16/**********************************************************************/ 17/**********************************************************************/
17 18
@@ -69,12 +70,72 @@ static inline void ipi_flush_bp_all(void *ignored)
69 local_flush_bp_all(); 70 local_flush_bp_all();
70} 71}
71 72
73#ifdef CONFIG_ARM_ERRATA_798181
74static int erratum_a15_798181(void)
75{
76 unsigned int midr = read_cpuid_id();
77
78 /* Cortex-A15 r0p0..r3p2 affected */
79 if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2)
80 return 0;
81 return 1;
82}
83#else
84static int erratum_a15_798181(void)
85{
86 return 0;
87}
88#endif
89
90static void ipi_flush_tlb_a15_erratum(void *arg)
91{
92 dmb();
93}
94
95static void broadcast_tlb_a15_erratum(void)
96{
97 if (!erratum_a15_798181())
98 return;
99
100 dummy_flush_tlb_a15_erratum();
101 smp_call_function_many(cpu_online_mask, ipi_flush_tlb_a15_erratum,
102 NULL, 1);
103}
104
105static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
106{
107 int cpu;
108 cpumask_t mask = { CPU_BITS_NONE };
109
110 if (!erratum_a15_798181())
111 return;
112
113 dummy_flush_tlb_a15_erratum();
114 for_each_online_cpu(cpu) {
115 if (cpu == smp_processor_id())
116 continue;
117 /*
118 * We only need to send an IPI if the other CPUs are running
119 * the same ASID as the one being invalidated. There is no
120 * need for locking around the active_asids check since the
121 * switch_mm() function has at least one dmb() (as required by
122 * this workaround) in case a context switch happens on
123 * another CPU after the condition below.
124 */
125 if (atomic64_read(&mm->context.id) ==
126 atomic64_read(&per_cpu(active_asids, cpu)))
127 cpumask_set_cpu(cpu, &mask);
128 }
129 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
130}
131
72void flush_tlb_all(void) 132void flush_tlb_all(void)
73{ 133{
74 if (tlb_ops_need_broadcast()) 134 if (tlb_ops_need_broadcast())
75 on_each_cpu(ipi_flush_tlb_all, NULL, 1); 135 on_each_cpu(ipi_flush_tlb_all, NULL, 1);
76 else 136 else
77 local_flush_tlb_all(); 137 local_flush_tlb_all();
138 broadcast_tlb_a15_erratum();
78} 139}
79 140
80void flush_tlb_mm(struct mm_struct *mm) 141void flush_tlb_mm(struct mm_struct *mm)
@@ -83,6 +144,7 @@ void flush_tlb_mm(struct mm_struct *mm)
83 on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1); 144 on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1);
84 else 145 else
85 local_flush_tlb_mm(mm); 146 local_flush_tlb_mm(mm);
147 broadcast_tlb_mm_a15_erratum(mm);
86} 148}
87 149
88void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) 150void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
@@ -95,6 +157,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
95 &ta, 1); 157 &ta, 1);
96 } else 158 } else
97 local_flush_tlb_page(vma, uaddr); 159 local_flush_tlb_page(vma, uaddr);
160 broadcast_tlb_mm_a15_erratum(vma->vm_mm);
98} 161}
99 162
100void flush_tlb_kernel_page(unsigned long kaddr) 163void flush_tlb_kernel_page(unsigned long kaddr)
@@ -105,6 +168,7 @@ void flush_tlb_kernel_page(unsigned long kaddr)
105 on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1); 168 on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1);
106 } else 169 } else
107 local_flush_tlb_kernel_page(kaddr); 170 local_flush_tlb_kernel_page(kaddr);
171 broadcast_tlb_a15_erratum();
108} 172}
109 173
110void flush_tlb_range(struct vm_area_struct *vma, 174void flush_tlb_range(struct vm_area_struct *vma,
@@ -119,6 +183,7 @@ void flush_tlb_range(struct vm_area_struct *vma,
119 &ta, 1); 183 &ta, 1);
120 } else 184 } else
121 local_flush_tlb_range(vma, start, end); 185 local_flush_tlb_range(vma, start, end);
186 broadcast_tlb_mm_a15_erratum(vma->vm_mm);
122} 187}
123 188
124void flush_tlb_kernel_range(unsigned long start, unsigned long end) 189void flush_tlb_kernel_range(unsigned long start, unsigned long end)
@@ -130,6 +195,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
130 on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1); 195 on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
131 } else 196 } else
132 local_flush_tlb_kernel_range(start, end); 197 local_flush_tlb_kernel_range(start, end);
198 broadcast_tlb_a15_erratum();
133} 199}
134 200
135void flush_bp_all(void) 201void flush_bp_all(void)
diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
index c9a17316e9fe..0e4cfe123b38 100644
--- a/arch/arm/kvm/vgic.c
+++ b/arch/arm/kvm/vgic.c
@@ -883,8 +883,7 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
883 lr, irq, vgic_cpu->vgic_lr[lr]); 883 lr, irq, vgic_cpu->vgic_lr[lr]);
884 BUG_ON(!test_bit(lr, vgic_cpu->lr_used)); 884 BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
885 vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT; 885 vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT;
886 886 return true;
887 goto out;
888 } 887 }
889 888
890 /* Try to use another LR for this interrupt */ 889 /* Try to use another LR for this interrupt */
@@ -898,7 +897,6 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
898 vgic_cpu->vgic_irq_lr_map[irq] = lr; 897 vgic_cpu->vgic_irq_lr_map[irq] = lr;
899 set_bit(lr, vgic_cpu->lr_used); 898 set_bit(lr, vgic_cpu->lr_used);
900 899
901out:
902 if (!vgic_irq_is_edge(vcpu, irq)) 900 if (!vgic_irq_is_edge(vcpu, irq))
903 vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI; 901 vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI;
904 902
@@ -1018,21 +1016,6 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1018 1016
1019 kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr); 1017 kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr);
1020 1018
1021 /*
1022 * We do not need to take the distributor lock here, since the only
1023 * action we perform is clearing the irq_active_bit for an EOIed
1024 * level interrupt. There is a potential race with
1025 * the queuing of an interrupt in __kvm_vgic_flush_hwstate(), where we
1026 * check if the interrupt is already active. Two possibilities:
1027 *
1028 * - The queuing is occurring on the same vcpu: cannot happen,
1029 * as we're already in the context of this vcpu, and
1030 * executing the handler
1031 * - The interrupt has been migrated to another vcpu, and we
1032 * ignore this interrupt for this run. Big deal. It is still
1033 * pending though, and will get considered when this vcpu
1034 * exits.
1035 */
1036 if (vgic_cpu->vgic_misr & GICH_MISR_EOI) { 1019 if (vgic_cpu->vgic_misr & GICH_MISR_EOI) {
1037 /* 1020 /*
1038 * Some level interrupts have been EOIed. Clear their 1021 * Some level interrupts have been EOIed. Clear their
@@ -1054,6 +1037,13 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1054 } else { 1037 } else {
1055 vgic_cpu_irq_clear(vcpu, irq); 1038 vgic_cpu_irq_clear(vcpu, irq);
1056 } 1039 }
1040
1041 /*
1042 * Despite being EOIed, the LR may not have
1043 * been marked as empty.
1044 */
1045 set_bit(lr, (unsigned long *)vgic_cpu->vgic_elrsr);
1046 vgic_cpu->vgic_lr[lr] &= ~GICH_LR_ACTIVE_BIT;
1057 } 1047 }
1058 } 1048 }
1059 1049
@@ -1064,9 +1054,8 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1064} 1054}
1065 1055
1066/* 1056/*
1067 * Sync back the VGIC state after a guest run. We do not really touch 1057 * Sync back the VGIC state after a guest run. The distributor lock is
1068 * the distributor here (the irq_pending_on_cpu bit is safe to set), 1058 * needed so we don't get preempted in the middle of the state processing.
1069 * so there is no need for taking its lock.
1070 */ 1059 */
1071static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) 1060static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
1072{ 1061{
@@ -1112,10 +1101,14 @@ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
1112 1101
1113void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) 1102void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
1114{ 1103{
1104 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1105
1115 if (!irqchip_in_kernel(vcpu->kvm)) 1106 if (!irqchip_in_kernel(vcpu->kvm))
1116 return; 1107 return;
1117 1108
1109 spin_lock(&dist->lock);
1118 __kvm_vgic_sync_hwstate(vcpu); 1110 __kvm_vgic_sync_hwstate(vcpu);
1111 spin_unlock(&dist->lock);
1119} 1112}
1120 1113
1121int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu) 1114int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 6b93f6a1a3c7..64dbfa57204a 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -58,7 +58,7 @@ static void __timer_delay(unsigned long cycles)
58static void __timer_const_udelay(unsigned long xloops) 58static void __timer_const_udelay(unsigned long xloops)
59{ 59{
60 unsigned long long loops = xloops; 60 unsigned long long loops = xloops;
61 loops *= loops_per_jiffy; 61 loops *= arm_delay_ops.ticks_per_jiffy;
62 __timer_delay(loops >> UDELAY_SHIFT); 62 __timer_delay(loops >> UDELAY_SHIFT);
63} 63}
64 64
@@ -73,11 +73,13 @@ void __init register_current_timer_delay(const struct delay_timer *timer)
73 pr_info("Switching to timer-based delay loop\n"); 73 pr_info("Switching to timer-based delay loop\n");
74 delay_timer = timer; 74 delay_timer = timer;
75 lpj_fine = timer->freq / HZ; 75 lpj_fine = timer->freq / HZ;
76 loops_per_jiffy = lpj_fine; 76
77 /* cpufreq may scale loops_per_jiffy, so keep a private copy */
78 arm_delay_ops.ticks_per_jiffy = lpj_fine;
77 arm_delay_ops.delay = __timer_delay; 79 arm_delay_ops.delay = __timer_delay;
78 arm_delay_ops.const_udelay = __timer_const_udelay; 80 arm_delay_ops.const_udelay = __timer_const_udelay;
79 arm_delay_ops.udelay = __timer_udelay; 81 arm_delay_ops.udelay = __timer_udelay;
80 arm_delay_ops.const_clock = true; 82
81 delay_calibrated = true; 83 delay_calibrated = true;
82 } else { 84 } else {
83 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); 85 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index e698f26cc0cb..52e4bb5cf12d 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -22,19 +22,9 @@
22 22
23static struct map_desc cns3xxx_io_desc[] __initdata = { 23static struct map_desc cns3xxx_io_desc[] __initdata = {
24 { 24 {
25 .virtual = CNS3XXX_TC11MP_TWD_BASE_VIRT, 25 .virtual = CNS3XXX_TC11MP_SCU_BASE_VIRT,
26 .pfn = __phys_to_pfn(CNS3XXX_TC11MP_TWD_BASE), 26 .pfn = __phys_to_pfn(CNS3XXX_TC11MP_SCU_BASE),
27 .length = SZ_4K, 27 .length = SZ_8K,
28 .type = MT_DEVICE,
29 }, {
30 .virtual = CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT,
31 .pfn = __phys_to_pfn(CNS3XXX_TC11MP_GIC_CPU_BASE),
32 .length = SZ_4K,
33 .type = MT_DEVICE,
34 }, {
35 .virtual = CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT,
36 .pfn = __phys_to_pfn(CNS3XXX_TC11MP_GIC_DIST_BASE),
37 .length = SZ_4K,
38 .type = MT_DEVICE, 28 .type = MT_DEVICE,
39 }, { 29 }, {
40 .virtual = CNS3XXX_TIMER1_2_3_BASE_VIRT, 30 .virtual = CNS3XXX_TIMER1_2_3_BASE_VIRT,
diff --git a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
index 191c8e57f289..b1021aafa481 100644
--- a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
+++ b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
@@ -94,10 +94,10 @@
94#define RTC_INTR_STS_OFFSET 0x34 94#define RTC_INTR_STS_OFFSET 0x34
95 95
96#define CNS3XXX_MISC_BASE 0x76000000 /* Misc Control */ 96#define CNS3XXX_MISC_BASE 0x76000000 /* Misc Control */
97#define CNS3XXX_MISC_BASE_VIRT 0xFFF07000 /* Misc Control */ 97#define CNS3XXX_MISC_BASE_VIRT 0xFB000000 /* Misc Control */
98 98
99#define CNS3XXX_PM_BASE 0x77000000 /* Power Management Control */ 99#define CNS3XXX_PM_BASE 0x77000000 /* Power Management Control */
100#define CNS3XXX_PM_BASE_VIRT 0xFFF08000 100#define CNS3XXX_PM_BASE_VIRT 0xFB001000
101 101
102#define PM_CLK_GATE_OFFSET 0x00 102#define PM_CLK_GATE_OFFSET 0x00
103#define PM_SOFT_RST_OFFSET 0x04 103#define PM_SOFT_RST_OFFSET 0x04
@@ -109,7 +109,7 @@
109#define PM_PLL_HM_PD_OFFSET 0x1C 109#define PM_PLL_HM_PD_OFFSET 0x1C
110 110
111#define CNS3XXX_UART0_BASE 0x78000000 /* UART 0 */ 111#define CNS3XXX_UART0_BASE 0x78000000 /* UART 0 */
112#define CNS3XXX_UART0_BASE_VIRT 0xFFF09000 112#define CNS3XXX_UART0_BASE_VIRT 0xFB002000
113 113
114#define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */ 114#define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */
115#define CNS3XXX_UART1_BASE_VIRT 0xFFF0A000 115#define CNS3XXX_UART1_BASE_VIRT 0xFFF0A000
@@ -130,7 +130,7 @@
130#define CNS3XXX_I2S_BASE_VIRT 0xFFF10000 130#define CNS3XXX_I2S_BASE_VIRT 0xFFF10000
131 131
132#define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */ 132#define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */
133#define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFFF10800 133#define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFB003000
134 134
135#define TIMER1_COUNTER_OFFSET 0x00 135#define TIMER1_COUNTER_OFFSET 0x00
136#define TIMER1_AUTO_RELOAD_OFFSET 0x04 136#define TIMER1_AUTO_RELOAD_OFFSET 0x04
@@ -227,16 +227,16 @@
227 * Testchip peripheral and fpga gic regions 227 * Testchip peripheral and fpga gic regions
228 */ 228 */
229#define CNS3XXX_TC11MP_SCU_BASE 0x90000000 /* IRQ, Test chip */ 229#define CNS3XXX_TC11MP_SCU_BASE 0x90000000 /* IRQ, Test chip */
230#define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFF000000 230#define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFB004000
231 231
232#define CNS3XXX_TC11MP_GIC_CPU_BASE 0x90000100 /* Test chip interrupt controller CPU interface */ 232#define CNS3XXX_TC11MP_GIC_CPU_BASE 0x90000100 /* Test chip interrupt controller CPU interface */
233#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT 0xFF000100 233#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x100)
234 234
235#define CNS3XXX_TC11MP_TWD_BASE 0x90000600 235#define CNS3XXX_TC11MP_TWD_BASE 0x90000600
236#define CNS3XXX_TC11MP_TWD_BASE_VIRT 0xFF000600 236#define CNS3XXX_TC11MP_TWD_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x600)
237 237
238#define CNS3XXX_TC11MP_GIC_DIST_BASE 0x90001000 /* Test chip interrupt controller distributor */ 238#define CNS3XXX_TC11MP_GIC_DIST_BASE 0x90001000 /* Test chip interrupt controller distributor */
239#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT 0xFF001000 239#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000)
240 240
241#define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */ 241#define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */
242#define CNS3XXX_TC11MP_L220_BASE_VIRT 0xFF002000 242#define CNS3XXX_TC11MP_L220_BASE_VIRT 0xFF002000
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 12e6f756361d..1332de8c52c9 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -297,11 +297,7 @@ static const short da830_evm_emif25_pins[] = {
297 -1 297 -1
298}; 298};
299 299
300#if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE) 300#define HAS_MMC IS_ENABLED(CONFIG_MMC_DAVINCI)
301#define HAS_MMC 1
302#else
303#define HAS_MMC 0
304#endif
305 301
306#ifdef CONFIG_DA830_UI_NAND 302#ifdef CONFIG_DA830_UI_NAND
307static struct mtd_partition da830_evm_nand_partitions[] = { 303static struct mtd_partition da830_evm_nand_partitions[] = {
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index ba739e5ac3fb..8a24b6c6339f 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -335,12 +335,7 @@ static const short da850_evm_nor_pins[] = {
335 -1 335 -1
336}; 336};
337 337
338#if defined(CONFIG_MMC_DAVINCI) || \ 338#define HAS_MMC IS_ENABLED(CONFIG_MMC_DAVINCI)
339 defined(CONFIG_MMC_DAVINCI_MODULE)
340#define HAS_MMC 1
341#else
342#define HAS_MMC 0
343#endif
344 339
345static inline void da850_evm_setup_nor_nand(void) 340static inline void da850_evm_setup_nor_nand(void)
346{ 341{
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index c0206d5f2bf6..fc8e38e31b89 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -749,26 +749,11 @@ static int davinci_phy_fixup(struct phy_device *phydev)
749 return 0; 749 return 0;
750} 750}
751 751
752#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 752#define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
753 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 753
754#define HAS_ATA 1 754#define HAS_NOR IS_ENABLED(CONFIG_MTD_PHYSMAP)
755#else 755
756#define HAS_ATA 0 756#define HAS_NAND IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
757#endif
758
759#if defined(CONFIG_MTD_PHYSMAP) || \
760 defined(CONFIG_MTD_PHYSMAP_MODULE)
761#define HAS_NOR 1
762#else
763#define HAS_NOR 0
764#endif
765
766#if defined(CONFIG_MTD_NAND_DAVINCI) || \
767 defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
768#define HAS_NAND 1
769#else
770#define HAS_NAND 0
771#endif
772 757
773static __init void davinci_evm_init(void) 758static __init void davinci_evm_init(void)
774{ 759{
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index de7adff324dc..03785e0e9429 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -117,12 +117,7 @@ static struct platform_device davinci_nand_device = {
117 }, 117 },
118}; 118};
119 119
120#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 120#define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
121 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
122#define HAS_ATA 1
123#else
124#define HAS_ATA 0
125#endif
126 121
127/* CPLD Register 0 bits to control ATA */ 122/* CPLD Register 0 bits to control ATA */
128#define DM646X_EVM_ATA_RST BIT(0) 123#define DM646X_EVM_ATA_RST BIT(0)
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index b70e83c03bed..2bc112adf565 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -166,20 +166,9 @@ static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
166 .wires = 4, 166 .wires = 4,
167}; 167};
168 168
169#define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
169 170
170#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 171#define HAS_NAND IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
171 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
172#define HAS_ATA 1
173#else
174#define HAS_ATA 0
175#endif
176
177#if defined(CONFIG_MTD_NAND_DAVINCI) || \
178 defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
179#define HAS_NAND 1
180#else
181#define HAS_NAND 0
182#endif
183 172
184static __init void davinci_ntosd2_init(void) 173static __init void davinci_ntosd2_init(void)
185{ 174{
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index f6927df2dda8..a7068a3aa9d3 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -119,7 +119,7 @@ void __init davinci_init_ide(void)
119 platform_device_register(&ide_device); 119 platform_device_register(&ide_device);
120} 120}
121 121
122#if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE) 122#if IS_ENABLED(CONFIG_MMC_DAVINCI)
123 123
124static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32); 124static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32);
125 125
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 2b4c648f99b6..b0a6b522575f 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -18,7 +18,7 @@
18#define DA8XX_USB0_BASE 0x01e00000 18#define DA8XX_USB0_BASE 0x01e00000
19#define DA8XX_USB1_BASE 0x01e25000 19#define DA8XX_USB1_BASE 0x01e25000
20 20
21#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 21#if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
22static struct musb_hdrc_eps_bits musb_eps[] = { 22static struct musb_hdrc_eps_bits musb_eps[] = {
23 { "ep1_tx", 8, }, 23 { "ep1_tx", 8, },
24 { "ep1_rx", 8, }, 24 { "ep1_rx", 8, },
diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h
index d2afb4dd82ab..b5cc77d2380b 100644
--- a/arch/arm/mach-ep93xx/include/mach/uncompress.h
+++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h
@@ -47,9 +47,13 @@ static void __raw_writel(unsigned int value, unsigned int ptr)
47 47
48static inline void putc(int c) 48static inline void putc(int c)
49{ 49{
50 /* Transmit fifo not full? */ 50 int i;
51 while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF) 51
52 ; 52 for (i = 0; i < 10000; i++) {
53 /* Transmit fifo not full? */
54 if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))
55 break;
56 }
53 57
54 __raw_writeb(c, PHYS_UART_DATA); 58 __raw_writeb(c, PHYS_UART_DATA);
55} 59}
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 5a800bfcec5b..5bf4a97ab241 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -110,6 +110,8 @@ void tzic_handle_irq(struct pt_regs *);
110 110
111extern void imx_enable_cpu(int cpu, bool enable); 111extern void imx_enable_cpu(int cpu, bool enable);
112extern void imx_set_cpu_jump(int cpu, void *jump_addr); 112extern void imx_set_cpu_jump(int cpu, void *jump_addr);
113extern u32 imx_get_cpu_arg(int cpu);
114extern void imx_set_cpu_arg(int cpu, u32 arg);
113extern void v7_cpu_resume(void); 115extern void v7_cpu_resume(void);
114extern u32 *pl310_get_save_ptr(void); 116extern u32 *pl310_get_save_ptr(void);
115#ifdef CONFIG_SMP 117#ifdef CONFIG_SMP
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 7bc5fe15dda2..361a253e2b63 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -46,11 +46,23 @@ static inline void cpu_enter_lowpower(void)
46void imx_cpu_die(unsigned int cpu) 46void imx_cpu_die(unsigned int cpu)
47{ 47{
48 cpu_enter_lowpower(); 48 cpu_enter_lowpower();
49 /*
50 * We use the cpu jumping argument register to sync with
51 * imx_cpu_kill() which is running on cpu0 and waiting for
52 * the register being cleared to kill the cpu.
53 */
54 imx_set_cpu_arg(cpu, ~0);
49 cpu_do_idle(); 55 cpu_do_idle();
50} 56}
51 57
52int imx_cpu_kill(unsigned int cpu) 58int imx_cpu_kill(unsigned int cpu)
53{ 59{
60 unsigned long timeout = jiffies + msecs_to_jiffies(50);
61
62 while (imx_get_cpu_arg(cpu) == 0)
63 if (time_after(jiffies, timeout))
64 return 0;
54 imx_enable_cpu(cpu, false); 65 imx_enable_cpu(cpu, false);
66 imx_set_cpu_arg(cpu, 0);
55 return 1; 67 return 1;
56} 68}
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
index e15f1555c59b..09a742f8c7ab 100644
--- a/arch/arm/mach-imx/src.c
+++ b/arch/arm/mach-imx/src.c
@@ -43,6 +43,18 @@ void imx_set_cpu_jump(int cpu, void *jump_addr)
43 src_base + SRC_GPR1 + cpu * 8); 43 src_base + SRC_GPR1 + cpu * 8);
44} 44}
45 45
46u32 imx_get_cpu_arg(int cpu)
47{
48 cpu = cpu_logical_map(cpu);
49 return readl_relaxed(src_base + SRC_GPR1 + cpu * 8 + 4);
50}
51
52void imx_set_cpu_arg(int cpu, u32 arg)
53{
54 cpu = cpu_logical_map(cpu);
55 writel_relaxed(arg, src_base + SRC_GPR1 + cpu * 8 + 4);
56}
57
46void imx_src_prepare_restart(void) 58void imx_src_prepare_restart(void)
47{ 59{
48 u32 val; 60 u32 val;
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 7b6a64bc5f40..7509a89af967 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -2,23 +2,41 @@ if ARCH_KIRKWOOD
2 2
3menu "Marvell Kirkwood Implementations" 3menu "Marvell Kirkwood Implementations"
4 4
5config MACH_D2NET_V2
6 bool "LaCie d2 Network v2 NAS Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 LaCie d2 Network v2 NAS.
10
5config MACH_DB88F6281_BP 11config MACH_DB88F6281_BP
6 bool "Marvell DB-88F6281-BP Development Board" 12 bool "Marvell DB-88F6281-BP Development Board"
7 help 13 help
8 Say 'Y' here if you want your kernel to support the 14 Say 'Y' here if you want your kernel to support the
9 Marvell DB-88F6281-BP Development Board. 15 Marvell DB-88F6281-BP Development Board.
10 16
11config MACH_RD88F6192_NAS 17config MACH_DOCKSTAR
12 bool "Marvell RD-88F6192-NAS Reference Board" 18 bool "Seagate FreeAgent DockStar"
13 help 19 help
14 Say 'Y' here if you want your kernel to support the 20 Say 'Y' here if you want your kernel to support the
15 Marvell RD-88F6192-NAS Reference Board. 21 Seagate FreeAgent DockStar.
16 22
17config MACH_RD88F6281 23config MACH_ESATA_SHEEVAPLUG
18 bool "Marvell RD-88F6281 Reference Board" 24 bool "Marvell eSATA SheevaPlug Reference Board"
19 help 25 help
20 Say 'Y' here if you want your kernel to support the 26 Say 'Y' here if you want your kernel to support the
21 Marvell RD-88F6281 Reference Board. 27 Marvell eSATA SheevaPlug Reference Board.
28
29config MACH_GURUPLUG
30 bool "Marvell GuruPlug Reference Board"
31 help
32 Say 'Y' here if you want your kernel to support the
33 Marvell GuruPlug Reference Board.
34
35config MACH_INETSPACE_V2
36 bool "LaCie Internet Space v2 NAS Board"
37 help
38 Say 'Y' here if you want your kernel to support the
39 LaCie Internet Space v2 NAS.
22 40
23config MACH_MV88F6281GTW_GE 41config MACH_MV88F6281GTW_GE
24 bool "Marvell 88F6281 GTW GE Board" 42 bool "Marvell 88F6281 GTW GE Board"
@@ -26,23 +44,93 @@ config MACH_MV88F6281GTW_GE
26 Say 'Y' here if you want your kernel to support the 44 Say 'Y' here if you want your kernel to support the
27 Marvell 88F6281 GTW GE Board. 45 Marvell 88F6281 GTW GE Board.
28 46
47config MACH_NET2BIG_V2
48 bool "LaCie 2Big Network v2 NAS Board"
49 help
50 Say 'Y' here if you want your kernel to support the
51 LaCie 2Big Network v2 NAS.
52
53config MACH_NET5BIG_V2
54 bool "LaCie 5Big Network v2 NAS Board"
55 help
56 Say 'Y' here if you want your kernel to support the
57 LaCie 5Big Network v2 NAS.
58
59config MACH_NETSPACE_MAX_V2
60 bool "LaCie Network Space Max v2 NAS Board"
61 help
62 Say 'Y' here if you want your kernel to support the
63 LaCie Network Space Max v2 NAS.
64
65config MACH_NETSPACE_V2
66 bool "LaCie Network Space v2 NAS Board"
67 help
68 Say 'Y' here if you want your kernel to support the
69 LaCie Network Space v2 NAS.
70
71config MACH_OPENRD
72 bool
73
74config MACH_OPENRD_BASE
75 bool "Marvell OpenRD Base Board"
76 select MACH_OPENRD
77 help
78 Say 'Y' here if you want your kernel to support the
79 Marvell OpenRD Base Board.
80
81config MACH_OPENRD_CLIENT
82 bool "Marvell OpenRD Client Board"
83 select MACH_OPENRD
84 help
85 Say 'Y' here if you want your kernel to support the
86 Marvell OpenRD Client Board.
87
88config MACH_OPENRD_ULTIMATE
89 bool "Marvell OpenRD Ultimate Board"
90 select MACH_OPENRD
91 help
92 Say 'Y' here if you want your kernel to support the
93 Marvell OpenRD Ultimate Board.
94
95config MACH_RD88F6192_NAS
96 bool "Marvell RD-88F6192-NAS Reference Board"
97 help
98 Say 'Y' here if you want your kernel to support the
99 Marvell RD-88F6192-NAS Reference Board.
100
101config MACH_RD88F6281
102 bool "Marvell RD-88F6281 Reference Board"
103 help
104 Say 'Y' here if you want your kernel to support the
105 Marvell RD-88F6281 Reference Board.
106
29config MACH_SHEEVAPLUG 107config MACH_SHEEVAPLUG
30 bool "Marvell SheevaPlug Reference Board" 108 bool "Marvell SheevaPlug Reference Board"
31 help 109 help
32 Say 'Y' here if you want your kernel to support the 110 Say 'Y' here if you want your kernel to support the
33 Marvell SheevaPlug Reference Board. 111 Marvell SheevaPlug Reference Board.
34 112
35config MACH_ESATA_SHEEVAPLUG 113config MACH_T5325
36 bool "Marvell eSATA SheevaPlug Reference Board" 114 bool "HP t5325 Thin Client"
37 help 115 help
38 Say 'Y' here if you want your kernel to support the 116 Say 'Y' here if you want your kernel to support the
39 Marvell eSATA SheevaPlug Reference Board. 117 HP t5325 Thin Client.
40 118
41config MACH_GURUPLUG 119config MACH_TS219
42 bool "Marvell GuruPlug Reference Board" 120 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
43 help 121 help
44 Say 'Y' here if you want your kernel to support the 122 Say 'Y' here if you want your kernel to support the
45 Marvell GuruPlug Reference Board. 123 QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
124 TS-219P+ Turbo NAS devices.
125
126config MACH_TS41X
127 bool "QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo NAS"
128 help
129 Say 'Y' here if you want your kernel to support the
130 QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
131 NAS devices.
132
133comment "Device tree entries"
46 134
47config ARCH_KIRKWOOD_DT 135config ARCH_KIRKWOOD_DT
48 bool "Marvell Kirkwood Flattened Device Tree" 136 bool "Marvell Kirkwood Flattened Device Tree"
@@ -58,12 +146,27 @@ config ARCH_KIRKWOOD_DT
58 Say 'Y' here if you want your kernel to support the 146 Say 'Y' here if you want your kernel to support the
59 Marvell Kirkwood using flattened device tree. 147 Marvell Kirkwood using flattened device tree.
60 148
61config MACH_GURUPLUG_DT 149config MACH_CLOUDBOX_DT
62 bool "Marvell GuruPlug Reference Board (Flattened Device Tree)" 150 bool "LaCie CloudBox NAS (Flattened Device Tree)"
151 select ARCH_KIRKWOOD_DT
152 help
153 Say 'Y' here if you want your kernel to support the LaCie
154 CloudBox NAS, using Flattened Device Tree.
155
156config MACH_DLINK_KIRKWOOD_DT
157 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
63 select ARCH_KIRKWOOD_DT 158 select ARCH_KIRKWOOD_DT
64 help 159 help
65 Say 'Y' here if you want your kernel to support the 160 Say 'Y' here if you want your kernel to support the
66 Marvell GuruPlug Reference Board (Flattened Device Tree). 161 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
162 using Flattened Device Tree.
163
164config MACH_DOCKSTAR_DT
165 bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
166 select ARCH_KIRKWOOD_DT
167 help
168 Say 'Y' here if you want your kernel to support the
169 Seagate FreeAgent Dockstar (Flattened Device Tree).
67 170
68config MACH_DREAMPLUG_DT 171config MACH_DREAMPLUG_DT
69 bool "Marvell DreamPlug (Flattened Device Tree)" 172 bool "Marvell DreamPlug (Flattened Device Tree)"
@@ -72,19 +175,19 @@ config MACH_DREAMPLUG_DT
72 Say 'Y' here if you want your kernel to support the 175 Say 'Y' here if you want your kernel to support the
73 Marvell DreamPlug (Flattened Device Tree). 176 Marvell DreamPlug (Flattened Device Tree).
74 177
75config MACH_ICONNECT_DT 178config MACH_GOFLEXNET_DT
76 bool "Iomega Iconnect (Flattened Device Tree)" 179 bool "Seagate GoFlex Net (Flattened Device Tree)"
77 select ARCH_KIRKWOOD_DT 180 select ARCH_KIRKWOOD_DT
78 help 181 help
79 Say 'Y' here to enable Iomega Iconnect support. 182 Say 'Y' here if you want your kernel to support the
183 Seagate GoFlex Net (Flattened Device Tree).
80 184
81config MACH_DLINK_KIRKWOOD_DT 185config MACH_GURUPLUG_DT
82 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" 186 bool "Marvell GuruPlug Reference Board (Flattened Device Tree)"
83 select ARCH_KIRKWOOD_DT 187 select ARCH_KIRKWOOD_DT
84 help 188 help
85 Say 'Y' here if you want your kernel to support the 189 Say 'Y' here if you want your kernel to support the
86 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325, 190 Marvell GuruPlug Reference Board (Flattened Device Tree).
87 using Flattened Device Tree.
88 191
89config MACH_IB62X0_DT 192config MACH_IB62X0_DT
90 bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)" 193 bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)"
@@ -94,41 +197,18 @@ config MACH_IB62X0_DT
94 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using 197 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
95 Flattened Device Tree. 198 Flattened Device Tree.
96 199
97config MACH_TS219_DT 200config MACH_ICONNECT_DT
98 bool "Device Tree for QNAP TS-11X, TS-21X NAS" 201 bool "Iomega Iconnect (Flattened Device Tree)"
99 select ARCH_KIRKWOOD_DT
100 select ARM_APPENDED_DTB
101 select ARM_ATAG_DTB_COMPAT
102 help
103 Say 'Y' here if you want your kernel to support the QNAP
104 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
105 TS-219P+ Turbo NAS devices using Fattened Device Tree.
106 There are two different Device Tree descriptions, depending
107 on if the device is based on an if the board uses the MV6281
108 or MV6282. If you have the wrong one, the buttons will not
109 work.
110
111config MACH_DOCKSTAR_DT
112 bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
113 select ARCH_KIRKWOOD_DT
114 help
115 Say 'Y' here if you want your kernel to support the
116 Seagate FreeAgent Dockstar (Flattened Device Tree).
117
118config MACH_GOFLEXNET_DT
119 bool "Seagate GoFlex Net (Flattened Device Tree)"
120 select ARCH_KIRKWOOD_DT 202 select ARCH_KIRKWOOD_DT
121 help 203 help
122 Say 'Y' here if you want your kernel to support the 204 Say 'Y' here to enable Iomega Iconnect support.
123 Seagate GoFlex Net (Flattened Device Tree).
124 205
125config MACH_LSXL_DT 206config MACH_INETSPACE_V2_DT
126 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)" 207 bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
127 select ARCH_KIRKWOOD_DT 208 select ARCH_KIRKWOOD_DT
128 help 209 help
129 Say 'Y' here if you want your kernel to support the 210 Say 'Y' here if you want your kernel to support the LaCie
130 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using 211 Internet Space v2 NAS, using Flattened Device Tree.
131 Flattened Device Tree.
132 212
133config MACH_IOMEGA_IX2_200_DT 213config MACH_IOMEGA_IX2_200_DT
134 bool "Iomega StorCenter ix2-200 (Flattened Device Tree)" 214 bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
@@ -144,12 +224,13 @@ config MACH_KM_KIRKWOOD_DT
144 Say 'Y' here if you want your kernel to support the 224 Say 'Y' here if you want your kernel to support the
145 Keymile Kirkwood Reference Desgin, using Flattened Device Tree. 225 Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
146 226
147config MACH_INETSPACE_V2_DT 227config MACH_LSXL_DT
148 bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" 228 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
149 select ARCH_KIRKWOOD_DT 229 select ARCH_KIRKWOOD_DT
150 help 230 help
151 Say 'Y' here if you want your kernel to support the LaCie 231 Say 'Y' here if you want your kernel to support the
152 Internet Space v2 NAS, using Flattened Device Tree. 232 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
233 Flattened Device Tree.
153 234
154config MACH_MPLCEC4_DT 235config MACH_MPLCEC4_DT
155 bool "MPL CEC4 (Flattened Device Tree)" 236 bool "MPL CEC4 (Flattened Device Tree)"
@@ -158,12 +239,12 @@ config MACH_MPLCEC4_DT
158 Say 'Y' here if you want your kernel to support the 239 Say 'Y' here if you want your kernel to support the
159 MPL CEC4 (Flattened Device Tree). 240 MPL CEC4 (Flattened Device Tree).
160 241
161config MACH_NETSPACE_V2_DT 242config MACH_NETSPACE_LITE_V2_DT
162 bool "LaCie Network Space v2 NAS (Flattened Device Tree)" 243 bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
163 select ARCH_KIRKWOOD_DT 244 select ARCH_KIRKWOOD_DT
164 help 245 help
165 Say 'Y' here if you want your kernel to support the LaCie 246 Say 'Y' here if you want your kernel to support the LaCie
166 Network Space v2 NAS, using Flattened Device Tree. 247 Network Space Lite v2 NAS, using Flattened Device Tree.
167 248
168config MACH_NETSPACE_MAX_V2_DT 249config MACH_NETSPACE_MAX_V2_DT
169 bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" 250 bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
@@ -172,128 +253,69 @@ config MACH_NETSPACE_MAX_V2_DT
172 Say 'Y' here if you want your kernel to support the LaCie 253 Say 'Y' here if you want your kernel to support the LaCie
173 Network Space Max v2 NAS, using Flattened Device Tree. 254 Network Space Max v2 NAS, using Flattened Device Tree.
174 255
175config MACH_NETSPACE_LITE_V2_DT
176 bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
177 select ARCH_KIRKWOOD_DT
178 help
179 Say 'Y' here if you want your kernel to support the LaCie
180 Network Space Lite v2 NAS, using Flattened Device Tree.
181
182config MACH_NETSPACE_MINI_V2_DT 256config MACH_NETSPACE_MINI_V2_DT
183 bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)" 257 bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)"
184 select ARCH_KIRKWOOD_DT 258 select ARCH_KIRKWOOD_DT
185 help 259 help
186 Say 'Y' here if you want your kernel to support the LaCie 260 Say 'Y' here if you want your kernel to support the LaCie
187 Network Space Mini v2 NAS (aka SafeBox), using Flattened 261 Network Space Mini v2 NAS using Flattened Device Tree.
188 Device Tree.
189 262
190config MACH_OPENBLOCKS_A6_DT 263 This board is embedded in a product named CloudBox, which
191 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)" 264 provides automatic backup on a 100GB cloud storage. This
192 select ARCH_KIRKWOOD_DT 265 should not confused with a more recent LaCie NAS also named
193 help 266 CloudBox. For this last, the disk capacity is 1TB or above.
194 Say 'Y' here if you want your kernel to support the
195 Plat'Home OpenBlocks A6 (Flattened Device Tree).
196 267
197config MACH_TOPKICK_DT 268config MACH_NETSPACE_V2_DT
198 bool "USI Topkick (Flattened Device Tree)" 269 bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
199 select ARCH_KIRKWOOD_DT 270 select ARCH_KIRKWOOD_DT
200 help 271 help
201 Say 'Y' here if you want your kernel to support the 272 Say 'Y' here if you want your kernel to support the LaCie
202 USI Topkick, using Flattened Device Tree 273 Network Space v2 NAS, using Flattened Device Tree.
203
204config MACH_TS219
205 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
206 help
207 Say 'Y' here if you want your kernel to support the
208 QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
209 TS-219P+ Turbo NAS devices.
210
211config MACH_TS41X
212 bool "QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo NAS"
213 help
214 Say 'Y' here if you want your kernel to support the
215 QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
216 NAS devices.
217
218config MACH_DOCKSTAR
219 bool "Seagate FreeAgent DockStar"
220 help
221 Say 'Y' here if you want your kernel to support the
222 Seagate FreeAgent DockStar.
223
224config MACH_OPENRD
225 bool
226
227config MACH_OPENRD_BASE
228 bool "Marvell OpenRD Base Board"
229 select MACH_OPENRD
230 help
231 Say 'Y' here if you want your kernel to support the
232 Marvell OpenRD Base Board.
233
234config MACH_OPENRD_CLIENT
235 bool "Marvell OpenRD Client Board"
236 select MACH_OPENRD
237 help
238 Say 'Y' here if you want your kernel to support the
239 Marvell OpenRD Client Board.
240
241config MACH_OPENRD_ULTIMATE
242 bool "Marvell OpenRD Ultimate Board"
243 select MACH_OPENRD
244 help
245 Say 'Y' here if you want your kernel to support the
246 Marvell OpenRD Ultimate Board.
247
248config MACH_NETSPACE_V2
249 bool "LaCie Network Space v2 NAS Board"
250 help
251 Say 'Y' here if you want your kernel to support the
252 LaCie Network Space v2 NAS.
253
254config MACH_INETSPACE_V2
255 bool "LaCie Internet Space v2 NAS Board"
256 help
257 Say 'Y' here if you want your kernel to support the
258 LaCie Internet Space v2 NAS.
259
260config MACH_NETSPACE_MAX_V2
261 bool "LaCie Network Space Max v2 NAS Board"
262 help
263 Say 'Y' here if you want your kernel to support the
264 LaCie Network Space Max v2 NAS.
265 274
266config MACH_D2NET_V2 275config MACH_NSA310_DT
267 bool "LaCie d2 Network v2 NAS Board" 276 bool "ZyXEL NSA-310 (Flattened Device Tree)"
277 select ARCH_KIRKWOOD_DT
278 select ARM_ATAG_DTB_COMPAT
268 help 279 help
269 Say 'Y' here if you want your kernel to support the 280 Say 'Y' here if you want your kernel to support the
270 LaCie d2 Network v2 NAS. 281 ZyXEL NSA-310 board (Flattened Device Tree).
271 282
272config MACH_NET2BIG_V2 283config MACH_OPENBLOCKS_A6_DT
273 bool "LaCie 2Big Network v2 NAS Board" 284 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
285 select ARCH_KIRKWOOD_DT
274 help 286 help
275 Say 'Y' here if you want your kernel to support the 287 Say 'Y' here if you want your kernel to support the
276 LaCie 2Big Network v2 NAS. 288 Plat'Home OpenBlocks A6 (Flattened Device Tree).
277 289
278config MACH_NET5BIG_V2 290config MACH_READYNAS_DT
279 bool "LaCie 5Big Network v2 NAS Board" 291 bool "NETGEAR ReadyNAS Duo v2 (Flattened Device Tree)"
292 select ARCH_KIRKWOOD_DT
293 select ARM_APPENDED_DTB
294 select ARM_ATAG_DTB_COMPAT
280 help 295 help
281 Say 'Y' here if you want your kernel to support the 296 Say 'Y' here if you want your kernel to support the
282 LaCie 5Big Network v2 NAS. 297 NETGEAR ReadyNAS Duo v2 using Fattened Device Tree.
283 298
284config MACH_T5325 299config MACH_TOPKICK_DT
285 bool "HP t5325 Thin Client" 300 bool "USI Topkick (Flattened Device Tree)"
301 select ARCH_KIRKWOOD_DT
286 help 302 help
287 Say 'Y' here if you want your kernel to support the 303 Say 'Y' here if you want your kernel to support the
288 HP t5325 Thin Client. 304 USI Topkick, using Flattened Device Tree
289 305
290config MACH_NSA310_DT 306config MACH_TS219_DT
291 bool "ZyXEL NSA-310 (Flattened Device Tree)" 307 bool "Device Tree for QNAP TS-11X, TS-21X NAS"
292 select ARCH_KIRKWOOD_DT 308 select ARCH_KIRKWOOD_DT
309 select ARM_APPENDED_DTB
293 select ARM_ATAG_DTB_COMPAT 310 select ARM_ATAG_DTB_COMPAT
294 help 311 help
295 Say 'Y' here if you want your kernel to support the 312 Say 'Y' here if you want your kernel to support the QNAP
296 ZyXEL NSA-310 board (Flattened Device Tree). 313 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
314 TS-219P+ Turbo NAS devices using Fattened Device Tree.
315 There are two different Device Tree descriptions, depending
316 on if the device is based on an if the board uses the MV6281
317 or MV6282. If you have the wrong one, the buttons will not
318 work.
297 319
298endmenu 320endmenu
299 321
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 4cc4bee4d0cf..cdbca328a412 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,42 +1,44 @@
1obj-y += common.o addr-map.o irq.o pcie.o mpp.o 1obj-y += common.o addr-map.o irq.o pcie.o mpp.o
2 2
3obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
3obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o 4obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o
4obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o 5obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
5obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o
6obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
7obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
8obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o 6obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
9obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o 7obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
10obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
11obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
12obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
13obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
14obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
15obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o 8obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
16obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o 9obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
17obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
18obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 10obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
19obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 11obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
12obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o
13obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
14obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
15obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o
16obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o
17obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
20obj-$(CONFIG_MACH_T5325) += t5325-setup.o 18obj-$(CONFIG_MACH_T5325) += t5325-setup.o
19obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
20obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
21 21
22obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 22obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
23obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o 23obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
24obj-$(CONFIG_MACH_GURUPLUG_DT) += board-guruplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 24obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
29obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o 25obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
26obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
30obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o 27obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
31obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o 28obj-$(CONFIG_MACH_GURUPLUG_DT) += board-guruplug.o
29obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
30obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
31obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o
32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o 32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o 33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o
34obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o 34obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
35obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o 35obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o
36obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
38obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o 36obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
39obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o 38obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
39obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
40obj-$(CONFIG_MACH_NSA310_DT) += board-nsa310.o 40obj-$(CONFIG_MACH_NSA310_DT) += board-nsa310.o
41obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o 41obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
42obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o
42obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o 43obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
44obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index d367aa6b47bb..7904758e771f 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -139,16 +139,20 @@ static void __init kirkwood_dt_init(void)
139 if (of_machine_is_compatible("keymile,km_kirkwood")) 139 if (of_machine_is_compatible("keymile,km_kirkwood"))
140 km_kirkwood_init(); 140 km_kirkwood_init();
141 141
142 if (of_machine_is_compatible("lacie,inetspace_v2") || 142 if (of_machine_is_compatible("lacie,cloudbox") ||
143 of_machine_is_compatible("lacie,netspace_v2") || 143 of_machine_is_compatible("lacie,inetspace_v2") ||
144 of_machine_is_compatible("lacie,netspace_max_v2") ||
145 of_machine_is_compatible("lacie,netspace_lite_v2") || 144 of_machine_is_compatible("lacie,netspace_lite_v2") ||
146 of_machine_is_compatible("lacie,netspace_mini_v2")) 145 of_machine_is_compatible("lacie,netspace_max_v2") ||
146 of_machine_is_compatible("lacie,netspace_mini_v2") ||
147 of_machine_is_compatible("lacie,netspace_v2"))
147 ns2_init(); 148 ns2_init();
148 149
149 if (of_machine_is_compatible("mpl,cec4")) 150 if (of_machine_is_compatible("mpl,cec4"))
150 mplcec4_init(); 151 mplcec4_init();
151 152
153 if (of_machine_is_compatible("netgear,readynas-duo-v2"))
154 netgear_readynas_init();
155
152 if (of_machine_is_compatible("plathome,openblocks-a6")) 156 if (of_machine_is_compatible("plathome,openblocks-a6"))
153 openblocks_a6_init(); 157 openblocks_a6_init();
154 158
@@ -171,12 +175,14 @@ static const char * const kirkwood_dt_board_compat[] = {
171 "buffalo,lsxl", 175 "buffalo,lsxl",
172 "iom,ix2-200", 176 "iom,ix2-200",
173 "keymile,km_kirkwood", 177 "keymile,km_kirkwood",
178 "lacie,cloudbox",
174 "lacie,inetspace_v2", 179 "lacie,inetspace_v2",
175 "lacie,netspace_max_v2",
176 "lacie,netspace_v2",
177 "lacie,netspace_lite_v2", 180 "lacie,netspace_lite_v2",
181 "lacie,netspace_max_v2",
178 "lacie,netspace_mini_v2", 182 "lacie,netspace_mini_v2",
183 "lacie,netspace_v2",
179 "mpl,cec4", 184 "mpl,cec4",
185 "netgear,readynas-duo-v2",
180 "plathome,openblocks-a6", 186 "plathome,openblocks-a6",
181 "usi,topkick", 187 "usi,topkick",
182 "zyxel,nsa310", 188 "zyxel,nsa310",
diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
index f2ea3b7ad726..f8f660525ace 100644
--- a/arch/arm/mach-kirkwood/board-ns2.c
+++ b/arch/arm/mach-kirkwood/board-ns2.c
@@ -27,7 +27,8 @@ void __init ns2_init(void)
27 /* 27 /*
28 * Basic setup. Needs to be called early. 28 * Basic setup. Needs to be called early.
29 */ 29 */
30 if (of_machine_is_compatible("lacie,netspace_lite_v2") || 30 if (of_machine_is_compatible("lacie,cloudbox") ||
31 of_machine_is_compatible("lacie,netspace_lite_v2") ||
31 of_machine_is_compatible("lacie,netspace_mini_v2")) 32 of_machine_is_compatible("lacie,netspace_mini_v2"))
32 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); 33 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
33 kirkwood_ge00_init(&ns2_ge00_data); 34 kirkwood_ge00_init(&ns2_ge00_data);
diff --git a/arch/arm/mach-kirkwood/board-readynas.c b/arch/arm/mach-kirkwood/board-readynas.c
new file mode 100644
index 000000000000..fb42c20e273f
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-readynas.c
@@ -0,0 +1,28 @@
1/*
2 * NETGEAR ReadyNAS Duo v2 Board setup for drivers not already
3 * converted to DT.
4 *
5 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mv643xx_eth.h>
17#include <mach/kirkwood.h>
18#include "common.h"
19
20static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = {
21 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
22};
23
24void __init netgear_readynas_init(void)
25{
26 kirkwood_ge00_init(&netgear_readynas_ge00_data);
27 kirkwood_pcie_init(KW_PCIE0);
28}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 5ed70565c843..3147be2f34da 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -141,12 +141,24 @@ void openblocks_a6_init(void);
141static inline void openblocks_a6_init(void) {}; 141static inline void openblocks_a6_init(void) {};
142#endif 142#endif
143 143
144#ifdef CONFIG_MACH_READYNAS_DT
145void netgear_readynas_init(void);
146#else
147static inline void netgear_readynas_init(void) {};
148#endif
149
144#ifdef CONFIG_MACH_TOPKICK_DT 150#ifdef CONFIG_MACH_TOPKICK_DT
145void usi_topkick_init(void); 151void usi_topkick_init(void);
146#else 152#else
147static inline void usi_topkick_init(void) {}; 153static inline void usi_topkick_init(void) {};
148#endif 154#endif
149 155
156#ifdef CONFIG_MACH_CLOUDBOX_DT
157void cloudbox_init(void);
158#else
159static inline void cloudbox_init(void) {};
160#endif
161
150/* early init functions not converted to fdt yet */ 162/* early init functions not converted to fdt yet */
151char *kirkwood_id(void); 163char *kirkwood_id(void);
152void kirkwood_l2_init(void); 164void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/guruplug-setup.c b/arch/arm/mach-kirkwood/guruplug-setup.c
index 1c6e736cbbf8..08dd739aa709 100644
--- a/arch/arm/mach-kirkwood/guruplug-setup.c
+++ b/arch/arm/mach-kirkwood/guruplug-setup.c
@@ -53,6 +53,8 @@ static struct mv_sata_platform_data guruplug_sata_data = {
53 53
54static struct mvsdio_platform_data guruplug_mvsdio_data = { 54static struct mvsdio_platform_data guruplug_mvsdio_data = {
55 /* unfortunately the CD signal has not been connected */ 55 /* unfortunately the CD signal has not been connected */
56 .gpio_card_detect = -1,
57 .gpio_write_protect = -1,
56}; 58};
57 59
58static struct gpio_led guruplug_led_pins[] = { 60static struct gpio_led guruplug_led_pins[] = {
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index 8ddd69fdc937..6a6eb548307d 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -55,6 +55,7 @@ static struct mv_sata_platform_data openrd_sata_data = {
55 55
56static struct mvsdio_platform_data openrd_mvsdio_data = { 56static struct mvsdio_platform_data openrd_mvsdio_data = {
57 .gpio_card_detect = 29, /* MPP29 used as SD card detect */ 57 .gpio_card_detect = 29, /* MPP29 used as SD card detect */
58 .gpio_write_protect = -1,
58}; 59};
59 60
60static unsigned int openrd_mpp_config[] __initdata = { 61static unsigned int openrd_mpp_config[] __initdata = {
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index c7d93b48926b..d24223166e06 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -69,6 +69,7 @@ static struct mv_sata_platform_data rd88f6281_sata_data = {
69 69
70static struct mvsdio_platform_data rd88f6281_mvsdio_data = { 70static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
71 .gpio_card_detect = 28, 71 .gpio_card_detect = 28,
72 .gpio_write_protect = -1,
72}; 73};
73 74
74static unsigned int rd88f6281_mpp_config[] __initdata = { 75static unsigned int rd88f6281_mpp_config[] __initdata = {
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 9f64d5632e07..fa21aac52467 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -9,6 +9,7 @@
9 * publishhed by the Free Software Foundation. 9 * publishhed by the Free Software Foundation.
10 */ 10 */
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/gpio-pxa.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -110,6 +111,10 @@ static unsigned long common_pin_config[] __initdata = {
110 GPIO121_KP_MKIN4, 111 GPIO121_KP_MKIN4,
111}; 112};
112 113
114static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
115 .irq_base = MMP_GPIO_TO_IRQ(0),
116};
117
113static struct smc91x_platdata smc91x_info = { 118static struct smc91x_platdata smc91x_info = {
114 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 119 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
115}; 120};
@@ -248,6 +253,8 @@ static void __init common_init(void)
248 pxa168_add_nand(&aspenite_nand_info); 253 pxa168_add_nand(&aspenite_nand_info);
249 pxa168_add_fb(&aspenite_lcd_info); 254 pxa168_add_fb(&aspenite_lcd_info);
250 pxa168_add_keypad(&aspenite_keypad_info); 255 pxa168_add_keypad(&aspenite_keypad_info);
256 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
257 sizeof(struct pxa_gpio_platform_data));
251 platform_device_register(&pxa168_device_gpio); 258 platform_device_register(&pxa168_device_gpio);
252 259
253 /* off-chip devices */ 260 /* off-chip devices */
diff --git a/arch/arm/mach-mmp/avengers_lite.c b/arch/arm/mach-mmp/avengers_lite.c
index 1f94957b56ae..a451a0f4d512 100644
--- a/arch/arm/mach-mmp/avengers_lite.c
+++ b/arch/arm/mach-mmp/avengers_lite.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/gpio-pxa.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
@@ -32,12 +33,18 @@ static unsigned long avengers_lite_pin_config_V16F[] __initdata = {
32 GPIO89_UART2_RXD, 33 GPIO89_UART2_RXD,
33}; 34};
34 35
36static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
37 .irq_base = MMP_GPIO_TO_IRQ(0),
38};
39
35static void __init avengers_lite_init(void) 40static void __init avengers_lite_init(void)
36{ 41{
37 mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F)); 42 mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F));
38 43
39 /* on-chip devices */ 44 /* on-chip devices */
40 pxa168_add_uart(2); 45 pxa168_add_uart(2);
46 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
47 sizeof(struct pxa_gpio_platform_data));
41 platform_device_register(&pxa168_device_gpio); 48 platform_device_register(&pxa168_device_gpio);
42} 49}
43 50
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index 2358011c7d8e..ac25544b8cdb 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/gpio-pxa.h>
17#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
18#include <linux/regulator/max8649.h> 19#include <linux/regulator/max8649.h>
19#include <linux/regulator/fixed.h> 20#include <linux/regulator/fixed.h>
@@ -104,6 +105,10 @@ static unsigned long brownstone_pin_config[] __initdata = {
104 GPIO89_GPIO, 105 GPIO89_GPIO,
105}; 106};
106 107
108static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
109 .irq_base = MMP_GPIO_TO_IRQ(0),
110};
111
107static struct regulator_consumer_supply max8649_supply[] = { 112static struct regulator_consumer_supply max8649_supply[] = {
108 REGULATOR_SUPPLY("vcc_core", NULL), 113 REGULATOR_SUPPLY("vcc_core", NULL),
109}; 114};
@@ -202,6 +207,8 @@ static void __init brownstone_init(void)
202 /* on-chip devices */ 207 /* on-chip devices */
203 mmp2_add_uart(1); 208 mmp2_add_uart(1);
204 mmp2_add_uart(3); 209 mmp2_add_uart(3);
210 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
211 sizeof(struct pxa_gpio_platform_data));
205 platform_device_register(&mmp2_device_gpio); 212 platform_device_register(&mmp2_device_gpio);
206 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); 213 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
207 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 214 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
diff --git a/arch/arm/mach-mmp/clock-mmp2.c b/arch/arm/mach-mmp/clock-mmp2.c
index 21d22002cd19..53d77cbd6000 100644
--- a/arch/arm/mach-mmp/clock-mmp2.c
+++ b/arch/arm/mach-mmp/clock-mmp2.c
@@ -98,7 +98,7 @@ static struct clk_lookup mmp2_clkregs[] = {
98 INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL), 98 INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
99 INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL), 99 INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
100 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 100 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
101 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 101 INIT_CLKREG(&clk_gpio, "mmp2-gpio", NULL),
102 INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"), 102 INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"),
103 INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"), 103 INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"),
104 INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"), 104 INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"),
diff --git a/arch/arm/mach-mmp/clock-pxa168.c b/arch/arm/mach-mmp/clock-pxa168.c
index 5e6c18ccebd4..c572f219ae26 100644
--- a/arch/arm/mach-mmp/clock-pxa168.c
+++ b/arch/arm/mach-mmp/clock-pxa168.c
@@ -78,7 +78,7 @@ static struct clk_lookup pxa168_clkregs[] = {
78 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL), 78 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
79 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 79 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
80 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), 80 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
81 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 81 INIT_CLKREG(&clk_gpio, "mmp-gpio", NULL),
82 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 82 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
83 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 83 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
84 INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"), 84 INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"),
diff --git a/arch/arm/mach-mmp/clock-pxa910.c b/arch/arm/mach-mmp/clock-pxa910.c
index 933ea71d0b56..379e1df61c70 100644
--- a/arch/arm/mach-mmp/clock-pxa910.c
+++ b/arch/arm/mach-mmp/clock-pxa910.c
@@ -56,7 +56,7 @@ static struct clk_lookup pxa910_clkregs[] = {
56 INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL), 56 INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
57 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), 57 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
58 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 58 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
59 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 59 INIT_CLKREG(&clk_gpio, "mmp-gpio", NULL),
60 INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"), 60 INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"),
61 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 61 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
62}; 62};
diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
index 754c352dd02b..6291c33d83e2 100644
--- a/arch/arm/mach-mmp/flint.c
+++ b/arch/arm/mach-mmp/flint.c
@@ -16,6 +16,7 @@
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/gpio-pxa.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
@@ -77,6 +78,10 @@ static unsigned long flint_pin_config[] __initdata = {
77 GPIO160_ND_RDY1, 78 GPIO160_ND_RDY1,
78}; 79};
79 80
81static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
82 .irq_base = MMP_GPIO_TO_IRQ(0),
83};
84
80static struct smc91x_platdata flint_smc91x_info = { 85static struct smc91x_platdata flint_smc91x_info = {
81 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 86 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
82}; 87};
@@ -111,6 +116,8 @@ static void __init flint_init(void)
111 /* on-chip devices */ 116 /* on-chip devices */
112 mmp2_add_uart(1); 117 mmp2_add_uart(1);
113 mmp2_add_uart(2); 118 mmp2_add_uart(2);
119 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
120 sizeof(struct pxa_gpio_platform_data));
114 platform_device_register(&mmp2_device_gpio); 121 platform_device_register(&mmp2_device_gpio);
115 122
116 /* off-chip devices */ 123 /* off-chip devices */
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index f62b68d926f4..d81b2475e67e 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <linux/gpio-pxa.h>
14 15
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
16#include <asm/mach-types.h> 17#include <asm/mach-types.h>
@@ -128,6 +129,10 @@ static unsigned long gplugd_pin_config[] __initdata = {
128 GPIO116_I2S_TXD 129 GPIO116_I2S_TXD
129}; 130};
130 131
132static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
133 .irq_base = MMP_GPIO_TO_IRQ(0),
134};
135
131static struct i2c_board_info gplugd_i2c_board_info[] = { 136static struct i2c_board_info gplugd_i2c_board_info[] = {
132 { 137 {
133 .type = "isl1208", 138 .type = "isl1208",
@@ -186,6 +191,8 @@ static void __init gplugd_init(void)
186 pxa168_add_uart(3); 191 pxa168_add_uart(3);
187 pxa168_add_ssp(1); 192 pxa168_add_ssp(1);
188 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); 193 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
194 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
195 sizeof(struct pxa_gpio_platform_data));
189 platform_device_register(&pxa168_device_gpio); 196 platform_device_register(&pxa168_device_gpio);
190 197
191 pxa168_add_eth(&gplugd_eth_platform_data); 198 pxa168_add_eth(&gplugd_eth_platform_data);
diff --git a/arch/arm/mach-mmp/include/mach/debug-macro.S b/arch/arm/mach-mmp/include/mach/debug-macro.S
deleted file mode 100644
index 5c3cc29688ab..000000000000
--- a/arch/arm/mach-mmp/include/mach/debug-macro.S
+++ /dev/null
@@ -1,30 +0,0 @@
1/* arch/arm/mach-mmp/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copied from arch/arm/mach-pxa/include/mach/debug.S
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#if defined(CONFIG_DEBUG_MMP_UART2)
13#define MMP_UART_OFFSET 0x00017000
14#elif defined(CONFIG_DEBUG_MMP_UART3)
15#define MMP_UART_OFFSET 0x00018000
16#else
17#error "Select uart for DEBUG_LL"
18#endif
19
20#include <mach/addr-map.h>
21
22 .macro addruart, rp, rv, tmp
23 ldr \rp, =APB_PHYS_BASE @ physical
24 ldr \rv, =APB_VIRT_BASE @ virtual
25 orr \rp, \rp, #MMP_UART_OFFSET
26 orr \rv, \rv, #MMP_UART_OFFSET
27 .endm
28
29#define UART_SHIFT 2
30#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c
index 66634fd0ecb0..0e9e5c05b37c 100644
--- a/arch/arm/mach-mmp/jasper.c
+++ b/arch/arm/mach-mmp/jasper.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/gpio-pxa.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
@@ -99,6 +100,10 @@ static unsigned long jasper_pin_config[] __initdata = {
99 GPIO151_MMC3_CLK, 100 GPIO151_MMC3_CLK,
100}; 101};
101 102
103static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
104 .irq_base = MMP_GPIO_TO_IRQ(0),
105};
106
102static struct regulator_consumer_supply max8649_supply[] = { 107static struct regulator_consumer_supply max8649_supply[] = {
103 REGULATOR_SUPPLY("vcc_core", NULL), 108 REGULATOR_SUPPLY("vcc_core", NULL),
104}; 109};
@@ -165,6 +170,9 @@ static void __init jasper_init(void)
165 mmp2_add_uart(1); 170 mmp2_add_uart(1);
166 mmp2_add_uart(3); 171 mmp2_add_uart(3);
167 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info)); 172 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
173 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
174 sizeof(struct pxa_gpio_platform_data));
175 platform_device_register(&mmp2_device_gpio);
168 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 176 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
169 177
170 regulator_has_full_constraints(); 178 regulator_has_full_constraints();
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
index d063efa0a4f1..b37915dc4470 100644
--- a/arch/arm/mach-mmp/mmp-dt.c
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = {
28 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL), 28 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
29 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), 29 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
30 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL), 30 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
31 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), 31 OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
32 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), 32 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
33 {} 33 {}
34}; 34};
@@ -39,7 +39,7 @@ static const struct of_dev_auxdata pxa910_auxdata_lookup[] __initconst = {
39 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL), 39 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL),
40 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), 40 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
41 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL), 41 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL),
42 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), 42 OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
43 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), 43 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
44 {} 44 {}
45}; 45};
diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c
index fad431aa6e09..4ac256720f7d 100644
--- a/arch/arm/mach-mmp/mmp2-dt.c
+++ b/arch/arm/mach-mmp/mmp2-dt.c
@@ -31,7 +31,7 @@ static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = {
31 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL), 31 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL),
32 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), 32 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
33 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL), 33 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
34 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), 34 OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp2-gpio", NULL),
35 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), 35 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
36 {} 36 {}
37}; 37};
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index d94d114eef7b..c7592f168bbd 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -164,7 +164,7 @@ struct resource mmp2_resource_gpio[] = {
164}; 164};
165 165
166struct platform_device mmp2_device_gpio = { 166struct platform_device mmp2_device_gpio = {
167 .name = "pxa-gpio", 167 .name = "mmp2-gpio",
168 .id = -1, 168 .id = -1,
169 .num_resources = ARRAY_SIZE(mmp2_resource_gpio), 169 .num_resources = ARRAY_SIZE(mmp2_resource_gpio),
170 .resource = mmp2_resource_gpio, 170 .resource = mmp2_resource_gpio,
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 9bc7b86a86a7..a30dcf3b7d9e 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -125,7 +125,7 @@ struct resource pxa168_resource_gpio[] = {
125}; 125};
126 126
127struct platform_device pxa168_device_gpio = { 127struct platform_device pxa168_device_gpio = {
128 .name = "pxa-gpio", 128 .name = "mmp-gpio",
129 .id = -1, 129 .id = -1,
130 .num_resources = ARRAY_SIZE(pxa168_resource_gpio), 130 .num_resources = ARRAY_SIZE(pxa168_resource_gpio),
131 .resource = pxa168_resource_gpio, 131 .resource = pxa168_resource_gpio,
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 36cb321a3d70..ce6393acad86 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -152,7 +152,7 @@ struct resource pxa910_resource_gpio[] = {
152}; 152};
153 153
154struct platform_device pxa910_device_gpio = { 154struct platform_device pxa910_device_gpio = {
155 .name = "pxa-gpio", 155 .name = "mmp-gpio",
156 .id = -1, 156 .id = -1,
157 .num_resources = ARRAY_SIZE(pxa910_resource_gpio), 157 .num_resources = ARRAY_SIZE(pxa910_resource_gpio),
158 .resource = pxa910_resource_gpio, 158 .resource = pxa910_resource_gpio,
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index 4c127d23955d..cdfc9bfee1a4 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -8,6 +8,7 @@
8 * publishhed by the Free Software Foundation. 8 * publishhed by the Free Software Foundation.
9 */ 9 */
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/gpio-pxa.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -60,6 +61,10 @@ static unsigned long tavorevb_pin_config[] __initdata = {
60 DF_RDY0_DF_RDY0, 61 DF_RDY0_DF_RDY0,
61}; 62};
62 63
64static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
65 .irq_base = MMP_GPIO_TO_IRQ(0),
66};
67
63static struct smc91x_platdata tavorevb_smc91x_info = { 68static struct smc91x_platdata tavorevb_smc91x_info = {
64 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 69 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
65}; 70};
@@ -93,6 +98,8 @@ static void __init tavorevb_init(void)
93 98
94 /* on-chip devices */ 99 /* on-chip devices */
95 pxa910_add_uart(1); 100 pxa910_add_uart(1);
101 platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
102 sizeof(struct pxa_gpio_platform_data));
96 platform_device_register(&pxa910_device_gpio); 103 platform_device_register(&pxa910_device_gpio);
97 104
98 /* off-chip devices */ 105 /* off-chip devices */
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index 8609967975ed..e4d95b4c6bb2 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/gpio-pxa.h>
19#include <linux/input.h> 20#include <linux/input.h>
20#include <linux/platform_data/keypad-pxa27x.h> 21#include <linux/platform_data/keypad-pxa27x.h>
21#include <linux/i2c.h> 22#include <linux/i2c.h>
@@ -49,6 +50,10 @@ static unsigned long teton_bga_pin_config[] __initdata = {
49 GPIO78_GPIO, 50 GPIO78_GPIO,
50}; 51};
51 52
53static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
54 .irq_base = MMP_GPIO_TO_IRQ(0),
55};
56
52static unsigned int teton_bga_matrix_key_map[] = { 57static unsigned int teton_bga_matrix_key_map[] = {
53 KEY(0, 6, KEY_ESC), 58 KEY(0, 6, KEY_ESC),
54 KEY(0, 7, KEY_ENTER), 59 KEY(0, 7, KEY_ENTER),
@@ -79,6 +84,8 @@ static void __init teton_bga_init(void)
79 pxa168_add_uart(1); 84 pxa168_add_uart(1);
80 pxa168_add_keypad(&teton_bga_keypad_info); 85 pxa168_add_keypad(&teton_bga_keypad_info);
81 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info)); 86 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
87 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
88 sizeof(struct pxa_gpio_platform_data));
82 platform_device_register(&pxa168_device_gpio); 89 platform_device_register(&pxa168_device_gpio);
83} 90}
84 91
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 22a9058f9f4d..6aa788872921 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -17,6 +17,7 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/i2c/pca953x.h> 18#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/gpio-pxa.h>
20#include <linux/mfd/88pm860x.h> 21#include <linux/mfd/88pm860x.h>
21#include <linux/platform_data/mv_usb.h> 22#include <linux/platform_data/mv_usb.h>
22#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
@@ -75,6 +76,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
75 DF_RDY0_DF_RDY0, 76 DF_RDY0_DF_RDY0,
76}; 77};
77 78
79static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
80 .irq_base = MMP_GPIO_TO_IRQ(0),
81};
82
78static struct mtd_partition ttc_dkb_onenand_partitions[] = { 83static struct mtd_partition ttc_dkb_onenand_partitions[] = {
79 { 84 {
80 .name = "bootloader", 85 .name = "bootloader",
@@ -284,6 +289,8 @@ static void __init ttc_dkb_init(void)
284 289
285 /* off-chip devices */ 290 /* off-chip devices */
286 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); 291 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
292 platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
293 sizeof(struct pxa_gpio_platform_data));
287 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); 294 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
288 295
289#ifdef CONFIG_USB_MV_UDC 296#ifdef CONFIG_USB_MV_UDC
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 2969027f02fa..f9fd77e8f1f5 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -62,7 +62,10 @@ static int msm_timer_set_next_event(unsigned long cycles,
62{ 62{
63 u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); 63 u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE);
64 64
65 writel_relaxed(0, event_base + TIMER_CLEAR); 65 ctrl &= ~TIMER_ENABLE_EN;
66 writel_relaxed(ctrl, event_base + TIMER_ENABLE);
67
68 writel_relaxed(ctrl, event_base + TIMER_CLEAR);
66 writel_relaxed(cycles, event_base + TIMER_MATCH_VAL); 69 writel_relaxed(cycles, event_base + TIMER_MATCH_VAL);
67 writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE); 70 writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE);
68 return 0; 71 return 0;
diff --git a/arch/arm/mach-mvebu/irq-armada-370-xp.c b/arch/arm/mach-mvebu/irq-armada-370-xp.c
index 274ff58271de..6a9195e10579 100644
--- a/arch/arm/mach-mvebu/irq-armada-370-xp.c
+++ b/arch/arm/mach-mvebu/irq-armada-370-xp.c
@@ -44,6 +44,8 @@
44 44
45#define ARMADA_370_XP_MAX_PER_CPU_IRQS (28) 45#define ARMADA_370_XP_MAX_PER_CPU_IRQS (28)
46 46
47#define ARMADA_370_XP_TIMER0_PER_CPU_IRQ (5)
48
47#define ACTIVE_DOORBELLS (8) 49#define ACTIVE_DOORBELLS (8)
48 50
49static DEFINE_RAW_SPINLOCK(irq_controller_lock); 51static DEFINE_RAW_SPINLOCK(irq_controller_lock);
@@ -62,7 +64,7 @@ static void armada_370_xp_irq_mask(struct irq_data *d)
62#ifdef CONFIG_SMP 64#ifdef CONFIG_SMP
63 irq_hw_number_t hwirq = irqd_to_hwirq(d); 65 irq_hw_number_t hwirq = irqd_to_hwirq(d);
64 66
65 if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS) 67 if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
66 writel(hwirq, main_int_base + 68 writel(hwirq, main_int_base +
67 ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); 69 ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS);
68 else 70 else
@@ -79,7 +81,7 @@ static void armada_370_xp_irq_unmask(struct irq_data *d)
79#ifdef CONFIG_SMP 81#ifdef CONFIG_SMP
80 irq_hw_number_t hwirq = irqd_to_hwirq(d); 82 irq_hw_number_t hwirq = irqd_to_hwirq(d);
81 83
82 if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS) 84 if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
83 writel(hwirq, main_int_base + 85 writel(hwirq, main_int_base +
84 ARMADA_370_XP_INT_SET_ENABLE_OFFS); 86 ARMADA_370_XP_INT_SET_ENABLE_OFFS);
85 else 87 else
@@ -147,7 +149,7 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
147 writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS); 149 writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS);
148 irq_set_status_flags(virq, IRQ_LEVEL); 150 irq_set_status_flags(virq, IRQ_LEVEL);
149 151
150 if (hw < ARMADA_370_XP_MAX_PER_CPU_IRQS) { 152 if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) {
151 irq_set_percpu_devid(virq); 153 irq_set_percpu_devid(virq);
152 irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip, 154 irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip,
153 handle_percpu_devid_irq); 155 handle_percpu_devid_irq);
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index cb7c6ae2e3fc..6c4f766365a2 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -543,15 +543,6 @@ static struct clk usb_dc_ck = {
543 /* Direct from ULPD, no parent */ 543 /* Direct from ULPD, no parent */
544 .rate = 48000000, 544 .rate = 48000000,
545 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), 545 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
546 .enable_bit = USB_REQ_EN_SHIFT,
547};
548
549static struct clk usb_dc_ck7xx = {
550 .name = "usb_dc_ck",
551 .ops = &clkops_generic,
552 /* Direct from ULPD, no parent */
553 .rate = 48000000,
554 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
555 .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, 546 .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT,
556}; 547};
557 548
@@ -727,8 +718,7 @@ static struct omap_clk omap_clks[] = {
727 CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310), 718 CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
728 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310), 719 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
729 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX), 720 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
730 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX), 721 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX | CK_7XX),
731 CLK(NULL, "usb_dc_ck", &usb_dc_ck7xx, CK_7XX),
732 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310), 722 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
733 CLK(NULL, "mclk", &mclk_16xx, CK_16XX), 723 CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
734 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310), 724 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
diff --git a/arch/arm/mach-omap1/include/mach/usb.h b/arch/arm/mach-omap1/include/mach/usb.h
index 753cd5ce6949..45e5ac707cbb 100644
--- a/arch/arm/mach-omap1/include/mach/usb.h
+++ b/arch/arm/mach-omap1/include/mach/usb.h
@@ -2,7 +2,7 @@
2 * FIXME correct answer depends on hmc_mode, 2 * FIXME correct answer depends on hmc_mode,
3 * as does (on omap1) any nonzero value for config->otg port number 3 * as does (on omap1) any nonzero value for config->otg port number
4 */ 4 */
5#ifdef CONFIG_USB_GADGET_OMAP 5#if IS_ENABLED(CONFIG_USB_OMAP)
6#define is_usb0_device(config) 1 6#define is_usb0_device(config) 1
7#else 7#else
8#define is_usb0_device(config) 0 8#define is_usb0_device(config) 0
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c
index 1a1db5971cd9..4118db50d5e8 100644
--- a/arch/arm/mach-omap1/usb.c
+++ b/arch/arm/mach-omap1/usb.c
@@ -123,7 +123,7 @@ omap_otg_init(struct omap_usb_config *config)
123 syscon = omap_readl(OTG_SYSCON_1); 123 syscon = omap_readl(OTG_SYSCON_1);
124 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; 124 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN;
125 125
126#ifdef CONFIG_USB_GADGET_OMAP 126#if IS_ENABLED(CONFIG_USB_OMAP)
127 if (config->otg || config->register_dev) { 127 if (config->otg || config->register_dev) {
128 struct platform_device *udc_device = config->udc_device; 128 struct platform_device *udc_device = config->udc_device;
129 int status; 129 int status;
@@ -169,7 +169,7 @@ omap_otg_init(struct omap_usb_config *config)
169void omap_otg_init(struct omap_usb_config *config) {} 169void omap_otg_init(struct omap_usb_config *config) {}
170#endif 170#endif
171 171
172#ifdef CONFIG_USB_GADGET_OMAP 172#if IS_ENABLED(CONFIG_USB_OMAP)
173 173
174static struct resource udc_resources[] = { 174static struct resource udc_resources[] = {
175 /* order is significant! */ 175 /* order is significant! */
@@ -600,7 +600,7 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config)
600 while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK)) 600 while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK))
601 cpu_relax(); 601 cpu_relax();
602 602
603#ifdef CONFIG_USB_GADGET_OMAP 603#if IS_ENABLED(CONFIG_USB_OMAP)
604 if (config->register_dev) { 604 if (config->register_dev) {
605 int status; 605 int status;
606 606
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b068b7fe99ef..62bb352c2d37 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,7 +229,6 @@ obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
229obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 229obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
230obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 230obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
231obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 231obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
232obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
233obj-$(CONFIG_MACH_OVERO) += board-overo.o 232obj-$(CONFIG_MACH_OVERO) += board-overo.o
234obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o 233obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
235obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o 234obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
@@ -255,8 +254,6 @@ obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o
255obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o 254obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
256obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o 255obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o
257 256
258obj-$(CONFIG_MACH_PCM049) += board-omap4pcm049.o
259
260obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o 257obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
261 258
262obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o 259obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 35f3ad0cb7c7..00d72902ef4f 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -291,6 +291,10 @@ static struct platform_device sdp4430_leds_pwm = {
291 }, 291 },
292}; 292};
293 293
294/* Dummy regulator for pwm-backlight driver */
295static struct regulator_consumer_supply backlight_supply =
296 REGULATOR_SUPPLY("enable", "pwm-backlight");
297
294static struct platform_pwm_backlight_data sdp4430_backlight_data = { 298static struct platform_pwm_backlight_data sdp4430_backlight_data = {
295 .max_brightness = 127, 299 .max_brightness = 127,
296 .dft_brightness = 127, 300 .dft_brightness = 127,
@@ -718,6 +722,8 @@ static void __init omap_4430sdp_init(void)
718 722
719 omap4_i2c_init(); 723 omap4_i2c_init();
720 omap_sfh7741prox_init(); 724 omap_sfh7741prox_init();
725 regulator_register_always_on(0, "backlight-enable",
726 &backlight_supply, 1, 0);
721 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 727 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
722 omap_serial_init(); 728 omap_serial_init();
723 omap_sdrc_init(NULL, NULL); 729 omap_sdrc_init(NULL, NULL);
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 3a077df6b8df..1a884670a6c4 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -547,12 +547,16 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {
547 REGULATOR_SUPPLY("DVDD", "2-0019"), 547 REGULATOR_SUPPLY("DVDD", "2-0019"),
548 /* Si4713 IO supply */ 548 /* Si4713 IO supply */
549 REGULATOR_SUPPLY("vio", "2-0063"), 549 REGULATOR_SUPPLY("vio", "2-0063"),
550 /* lis3lv02d */
551 REGULATOR_SUPPLY("Vdd_IO", "3-001d"),
550}; 552};
551 553
552static struct regulator_consumer_supply rx51_vaux1_consumers[] = { 554static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
553 REGULATOR_SUPPLY("vdds_sdi", "omapdss"), 555 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
554 /* Si4713 supply */ 556 /* Si4713 supply */
555 REGULATOR_SUPPLY("vdd", "2-0063"), 557 REGULATOR_SUPPLY("vdd", "2-0063"),
558 /* lis3lv02d */
559 REGULATOR_SUPPLY("Vdd", "3-001d"),
556}; 560};
557 561
558static struct regulator_init_data rx51_vaux1 = { 562static struct regulator_init_data rx51_vaux1 = {
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index 8cef477d6b00..9a7174faac51 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -12,7 +12,6 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/i2c/twl.h>
16#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
17#include <linux/platform_data/spi-omap2-mcspi.h> 16#include <linux/platform_data/spi-omap2-mcspi.h>
18#include <video/omapdss.h> 17#include <video/omapdss.h>
@@ -49,59 +48,6 @@ static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev)
49{ 48{
50} 49}
51 50
52/* Register offsets in TWL4030_MODULE_INTBR */
53#define TWL_INTBR_PMBR1 0xD
54#define TWL_INTBR_GPBR1 0xC
55
56/* Register offsets in TWL_MODULE_PWM */
57#define TWL_LED_PWMON 0x3
58#define TWL_LED_PWMOFF 0x4
59
60static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level)
61{
62#ifdef CONFIG_TWL4030_CORE
63 unsigned char c;
64 u8 mux_pwm, enb_pwm;
65
66 if (level > 100)
67 return -1;
68
69 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &mux_pwm, TWL_INTBR_PMBR1);
70 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &enb_pwm, TWL_INTBR_GPBR1);
71
72 if (level == 0) {
73 /* disable pwm1 output and clock */
74 enb_pwm = enb_pwm & 0xF5;
75 /* change pwm1 pin to gpio pin */
76 mux_pwm = mux_pwm & 0xCF;
77 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
78 enb_pwm, TWL_INTBR_GPBR1);
79 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
80 mux_pwm, TWL_INTBR_PMBR1);
81 return 0;
82 }
83
84 if (!((enb_pwm & 0xA) && (mux_pwm & 0x30))) {
85 /* change gpio pin to pwm1 pin */
86 mux_pwm = mux_pwm | 0x30;
87 /* enable pwm1 output and clock*/
88 enb_pwm = enb_pwm | 0x0A;
89 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
90 mux_pwm, TWL_INTBR_PMBR1);
91 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
92 enb_pwm, TWL_INTBR_GPBR1);
93 }
94
95 c = ((50 * (100 - level)) / 100) + 1;
96 twl_i2c_write_u8(TWL_MODULE_PWM, 0x7F, TWL_LED_PWMOFF);
97 twl_i2c_write_u8(TWL_MODULE_PWM, c, TWL_LED_PWMON);
98#else
99 pr_warn("Backlight not enabled\n");
100#endif
101
102 return 0;
103}
104
105static struct omap_dss_device zoom_lcd_device = { 51static struct omap_dss_device zoom_lcd_device = {
106 .name = "lcd", 52 .name = "lcd",
107 .driver_name = "NEC_8048_panel", 53 .driver_name = "NEC_8048_panel",
@@ -109,8 +55,6 @@ static struct omap_dss_device zoom_lcd_device = {
109 .phy.dpi.data_lines = 24, 55 .phy.dpi.data_lines = 24,
110 .platform_enable = zoom_panel_enable_lcd, 56 .platform_enable = zoom_panel_enable_lcd,
111 .platform_disable = zoom_panel_disable_lcd, 57 .platform_disable = zoom_panel_disable_lcd,
112 .max_backlight_level = 100,
113 .set_backlight = zoom_set_bl_intensity,
114}; 58};
115 59
116static struct omap_dss_device *zoom_dss_devices[] = { 60static struct omap_dss_device *zoom_dss_devices[] = {
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index cdc0c1021863..a90375d5b2b6 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -22,6 +22,9 @@
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/platform_data/omap-twl4030.h> 23#include <linux/platform_data/omap-twl4030.h>
24#include <linux/usb/phy.h> 24#include <linux/usb/phy.h>
25#include <linux/pwm.h>
26#include <linux/leds_pwm.h>
27#include <linux/pwm_backlight.h>
25 28
26#include <asm/mach-types.h> 29#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
@@ -193,6 +196,53 @@ static struct platform_device omap_vwlan_device = {
193 }, 196 },
194}; 197};
195 198
199static struct pwm_lookup zoom_pwm_lookup[] = {
200 PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "zoom::keypad"),
201 PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", "backlight"),
202};
203
204static struct led_pwm zoom_pwm_leds[] = {
205 {
206 .name = "zoom::keypad",
207 .max_brightness = 127,
208 .pwm_period_ns = 7812500,
209 },
210};
211
212static struct led_pwm_platform_data zoom_pwm_data = {
213 .num_leds = ARRAY_SIZE(zoom_pwm_leds),
214 .leds = zoom_pwm_leds,
215};
216
217static struct platform_device zoom_leds_pwm = {
218 .name = "leds_pwm",
219 .id = -1,
220 .dev = {
221 .platform_data = &zoom_pwm_data,
222 },
223};
224
225static struct platform_pwm_backlight_data zoom_backlight_data = {
226 .pwm_id = 1,
227 .max_brightness = 127,
228 .dft_brightness = 127,
229 .pwm_period_ns = 7812500,
230};
231
232static struct platform_device zoom_backlight_pwm = {
233 .name = "pwm-backlight",
234 .id = -1,
235 .dev = {
236 .platform_data = &zoom_backlight_data,
237 },
238};
239
240static struct platform_device *zoom_devices[] __initdata = {
241 &omap_vwlan_device,
242 &zoom_leds_pwm,
243 &zoom_backlight_pwm,
244};
245
196static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = { 246static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
197 .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */ 247 .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
198}; 248};
@@ -301,7 +351,8 @@ void __init zoom_peripherals_init(void)
301 351
302 omap_hsmmc_init(mmc); 352 omap_hsmmc_init(mmc);
303 omap_i2c_init(); 353 omap_i2c_init();
304 platform_device_register(&omap_vwlan_device); 354 pwm_add_table(zoom_pwm_lookup, ARRAY_SIZE(zoom_pwm_lookup));
355 platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
305 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 356 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
306 usb_musb_init(NULL); 357 usb_musb_init(NULL);
307 enable_board_wakeup_source(); 358 enable_board_wakeup_source();
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
index 3d58f335f173..0c6834ae1fc4 100644
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -52,6 +52,13 @@
52 */ 52 */
53#define OMAP4_DPLL_ABE_DEFFREQ 98304000 53#define OMAP4_DPLL_ABE_DEFFREQ 98304000
54 54
55/*
56 * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section
57 * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred
58 * locked frequency for the USB DPLL is 960MHz.
59 */
60#define OMAP4_DPLL_USB_DEFFREQ 960000000
61
55/* Root clocks */ 62/* Root clocks */
56 63
57DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); 64DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
@@ -1011,6 +1018,10 @@ DEFINE_CLK_OMAP_MUX(hsmmc2_fclk, "l3_init_clkdm", hsmmc1_fclk_sel,
1011 OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK, 1018 OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
1012 hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops); 1019 hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops);
1013 1020
1021DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
1022 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1023 OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
1024
1014DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0, 1025DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
1015 OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL, 1026 OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
1016 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL); 1027 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
@@ -1538,6 +1549,7 @@ static struct omap_clk omap44xx_clks[] = {
1538 CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk, CK_443X), 1549 CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk, CK_443X),
1539 CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk, CK_443X), 1550 CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk, CK_443X),
1540 CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk, CK_443X), 1551 CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk, CK_443X),
1552 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
1541 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X), 1553 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
1542 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X), 1554 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
1543 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X), 1555 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
@@ -1705,5 +1717,13 @@ int __init omap4xxx_clk_init(void)
1705 if (rc) 1717 if (rc)
1706 pr_err("%s: failed to configure ABE DPLL!\n", __func__); 1718 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
1707 1719
1720 /*
1721 * Lock USB DPLL on OMAP4 devices so that the L3INIT power
1722 * domain can transition to retention state when not in use.
1723 */
1724 rc = clk_set_rate(&dpll_usb_ck, OMAP4_DPLL_USB_DEFFREQ);
1725 if (rc)
1726 pr_err("%s: failed to configure USB DPLL!\n", __func__);
1727
1708 return 0; 1728 return 0;
1709} 1729}
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 40f4a03d728f..d6ba13e1c540 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -293,5 +293,8 @@ extern void omap_reserve(void);
293struct omap_hwmod; 293struct omap_hwmod;
294extern int omap_dss_reset(struct omap_hwmod *); 294extern int omap_dss_reset(struct omap_hwmod *);
295 295
296/* SoC specific clock initializer */
297extern int (*omap_clk_init)(void);
298
296#endif /* __ASSEMBLER__ */ 299#endif /* __ASSEMBLER__ */
297#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 300#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 2c3fdd65387b..5c445ca1e271 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -55,6 +55,12 @@
55#include "prm44xx.h" 55#include "prm44xx.h"
56 56
57/* 57/*
58 * omap_clk_init: points to a function that does the SoC-specific
59 * clock initializations
60 */
61int (*omap_clk_init)(void);
62
63/*
58 * The machine specific code may provide the extra mapping besides the 64 * The machine specific code may provide the extra mapping besides the
59 * default mapping provided here. 65 * default mapping provided here.
60 */ 66 */
@@ -397,7 +403,7 @@ void __init omap2420_init_early(void)
397 omap242x_clockdomains_init(); 403 omap242x_clockdomains_init();
398 omap2420_hwmod_init(); 404 omap2420_hwmod_init();
399 omap_hwmod_init_postsetup(); 405 omap_hwmod_init_postsetup();
400 omap2420_clk_init(); 406 omap_clk_init = omap2420_clk_init;
401} 407}
402 408
403void __init omap2420_init_late(void) 409void __init omap2420_init_late(void)
@@ -427,7 +433,7 @@ void __init omap2430_init_early(void)
427 omap243x_clockdomains_init(); 433 omap243x_clockdomains_init();
428 omap2430_hwmod_init(); 434 omap2430_hwmod_init();
429 omap_hwmod_init_postsetup(); 435 omap_hwmod_init_postsetup();
430 omap2430_clk_init(); 436 omap_clk_init = omap2430_clk_init;
431} 437}
432 438
433void __init omap2430_init_late(void) 439void __init omap2430_init_late(void)
@@ -462,7 +468,7 @@ void __init omap3_init_early(void)
462 omap3xxx_clockdomains_init(); 468 omap3xxx_clockdomains_init();
463 omap3xxx_hwmod_init(); 469 omap3xxx_hwmod_init();
464 omap_hwmod_init_postsetup(); 470 omap_hwmod_init_postsetup();
465 omap3xxx_clk_init(); 471 omap_clk_init = omap3xxx_clk_init;
466} 472}
467 473
468void __init omap3430_init_early(void) 474void __init omap3430_init_early(void)
@@ -500,7 +506,7 @@ void __init ti81xx_init_early(void)
500 omap3xxx_clockdomains_init(); 506 omap3xxx_clockdomains_init();
501 omap3xxx_hwmod_init(); 507 omap3xxx_hwmod_init();
502 omap_hwmod_init_postsetup(); 508 omap_hwmod_init_postsetup();
503 omap3xxx_clk_init(); 509 omap_clk_init = omap3xxx_clk_init;
504} 510}
505 511
506void __init omap3_init_late(void) 512void __init omap3_init_late(void)
@@ -568,7 +574,7 @@ void __init am33xx_init_early(void)
568 am33xx_clockdomains_init(); 574 am33xx_clockdomains_init();
569 am33xx_hwmod_init(); 575 am33xx_hwmod_init();
570 omap_hwmod_init_postsetup(); 576 omap_hwmod_init_postsetup();
571 am33xx_clk_init(); 577 omap_clk_init = am33xx_clk_init;
572} 578}
573#endif 579#endif
574 580
@@ -593,7 +599,7 @@ void __init omap4430_init_early(void)
593 omap44xx_clockdomains_init(); 599 omap44xx_clockdomains_init();
594 omap44xx_hwmod_init(); 600 omap44xx_hwmod_init();
595 omap_hwmod_init_postsetup(); 601 omap_hwmod_init_postsetup();
596 omap4xxx_clk_init(); 602 omap_clk_init = omap4xxx_clk_init;
597} 603}
598 604
599void __init omap4430_init_late(void) 605void __init omap4430_init_late(void)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index c2c798c08c2b..a202a4785104 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1368,7 +1368,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
1368 } 1368 }
1369 1369
1370 if (sf & SYSC_HAS_MIDLEMODE) { 1370 if (sf & SYSC_HAS_MIDLEMODE) {
1371 if (oh->flags & HWMOD_SWSUP_MSTANDBY) { 1371 if (oh->flags & HWMOD_FORCE_MSTANDBY) {
1372 idlemode = HWMOD_IDLEMODE_FORCE;
1373 } else if (oh->flags & HWMOD_SWSUP_MSTANDBY) {
1372 idlemode = HWMOD_IDLEMODE_NO; 1374 idlemode = HWMOD_IDLEMODE_NO;
1373 } else { 1375 } else {
1374 if (sf & SYSC_HAS_ENAWAKEUP) 1376 if (sf & SYSC_HAS_ENAWAKEUP)
@@ -1440,7 +1442,8 @@ static void _idle_sysc(struct omap_hwmod *oh)
1440 } 1442 }
1441 1443
1442 if (sf & SYSC_HAS_MIDLEMODE) { 1444 if (sf & SYSC_HAS_MIDLEMODE) {
1443 if (oh->flags & HWMOD_SWSUP_MSTANDBY) { 1445 if ((oh->flags & HWMOD_SWSUP_MSTANDBY) ||
1446 (oh->flags & HWMOD_FORCE_MSTANDBY)) {
1444 idlemode = HWMOD_IDLEMODE_FORCE; 1447 idlemode = HWMOD_IDLEMODE_FORCE;
1445 } else { 1448 } else {
1446 if (sf & SYSC_HAS_ENAWAKEUP) 1449 if (sf & SYSC_HAS_ENAWAKEUP)
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d43d9b608eda..d5dc935f6060 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -427,8 +427,8 @@ struct omap_hwmod_omap4_prcm {
427 * 427 *
428 * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out 428 * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out
429 * of idle, rather than relying on module smart-idle 429 * of idle, rather than relying on module smart-idle
430 * HWMOD_SWSUP_MSTDBY: omap_hwmod code should manually bring module in and out 430 * HWMOD_SWSUP_MSTANDBY: omap_hwmod code should manually bring module in and
431 * of standby, rather than relying on module smart-standby 431 * out of standby, rather than relying on module smart-standby
432 * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for 432 * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for
433 * SDRAM controller, etc. XXX probably belongs outside the main hwmod file 433 * SDRAM controller, etc. XXX probably belongs outside the main hwmod file
434 * XXX Should be HWMOD_SETUP_NO_RESET 434 * XXX Should be HWMOD_SETUP_NO_RESET
@@ -459,6 +459,10 @@ struct omap_hwmod_omap4_prcm {
459 * correctly, or this is being abused to deal with some PM latency 459 * correctly, or this is being abused to deal with some PM latency
460 * issues -- but we're currently suffering from a shortage of 460 * issues -- but we're currently suffering from a shortage of
461 * folks who are able to track these issues down properly. 461 * folks who are able to track these issues down properly.
462 * HWMOD_FORCE_MSTANDBY: Always keep MIDLEMODE bits cleared so that device
463 * is kept in force-standby mode. Failing to do so causes PM problems
464 * with musb on OMAP3630 at least. Note that musb has a dedicated register
465 * to control MSTANDBY signal when MIDLEMODE is set to force-standby.
462 */ 466 */
463#define HWMOD_SWSUP_SIDLE (1 << 0) 467#define HWMOD_SWSUP_SIDLE (1 << 0)
464#define HWMOD_SWSUP_MSTANDBY (1 << 1) 468#define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -471,6 +475,7 @@ struct omap_hwmod_omap4_prcm {
471#define HWMOD_16BIT_REG (1 << 8) 475#define HWMOD_16BIT_REG (1 << 8)
472#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9) 476#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9)
473#define HWMOD_BLOCK_WFI (1 << 10) 477#define HWMOD_BLOCK_WFI (1 << 10)
478#define HWMOD_FORCE_MSTANDBY (1 << 11)
474 479
475/* 480/*
476 * omap_hwmod._int_flags definitions 481 * omap_hwmod._int_flags definitions
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index ac7e03ec952f..5112d04e7b79 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1707,9 +1707,14 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
1707 * Erratum ID: i479 idle_req / idle_ack mechanism potentially 1707 * Erratum ID: i479 idle_req / idle_ack mechanism potentially
1708 * broken when autoidle is enabled 1708 * broken when autoidle is enabled
1709 * workaround is to disable the autoidle bit at module level. 1709 * workaround is to disable the autoidle bit at module level.
1710 *
1711 * Enabling the device in any other MIDLEMODE setting but force-idle
1712 * causes core_pwrdm not enter idle states at least on OMAP3630.
1713 * Note that musb has OTG_FORCESTDBY register that controls MSTANDBY
1714 * signal when MIDLEMODE is set to force-idle.
1710 */ 1715 */
1711 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE 1716 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
1712 | HWMOD_SWSUP_MSTANDBY, 1717 | HWMOD_FORCE_MSTANDBY,
1713}; 1718};
1714 1719
1715/* usb_otg_hs */ 1720/* usb_otg_hs */
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 0e47d2e1687c..9e0576569e07 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2714,6 +2714,10 @@ static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
2714 { } 2714 { }
2715}; 2715};
2716 2716
2717static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = {
2718 { .role = "48mhz", .clk = "ocp2scp_usb_phy_phy_48m" },
2719};
2720
2717/* ocp2scp_usb_phy */ 2721/* ocp2scp_usb_phy */
2718static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { 2722static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2719 .name = "ocp2scp_usb_phy", 2723 .name = "ocp2scp_usb_phy",
@@ -2728,6 +2732,8 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2728 }, 2732 },
2729 }, 2733 },
2730 .dev_attr = ocp2scp_dev_attr, 2734 .dev_attr = ocp2scp_dev_attr,
2735 .opt_clks = ocp2scp_usb_phy_opt_clks,
2736 .opt_clks_cnt = ARRAY_SIZE(ocp2scp_usb_phy_opt_clks),
2731}; 2737};
2732 2738
2733/* 2739/*
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 2bdd4cf17a8f..f62b509ed08d 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -547,6 +547,8 @@ static inline void __init realtime_counter_init(void)
547 clksrc_nr, clksrc_src) \ 547 clksrc_nr, clksrc_src) \
548void __init omap##name##_gptimer_timer_init(void) \ 548void __init omap##name##_gptimer_timer_init(void) \
549{ \ 549{ \
550 if (omap_clk_init) \
551 omap_clk_init(); \
550 omap_dmtimer_init(); \ 552 omap_dmtimer_init(); \
551 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 553 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
552 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ 554 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \
@@ -556,6 +558,8 @@ void __init omap##name##_gptimer_timer_init(void) \
556 clksrc_nr, clksrc_src) \ 558 clksrc_nr, clksrc_src) \
557void __init omap##name##_sync32k_timer_init(void) \ 559void __init omap##name##_sync32k_timer_init(void) \
558{ \ 560{ \
561 if (omap_clk_init) \
562 omap_clk_init(); \
559 omap_dmtimer_init(); \ 563 omap_dmtimer_init(); \
560 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 564 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
561 /* Enable the use of clocksource="gp_timer" kernel parameter */ \ 565 /* Enable the use of clocksource="gp_timer" kernel parameter */ \
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 86eec4159cbc..9075461999c1 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -51,11 +51,13 @@ config MACH_LITTLETON
51config MACH_TAVOREVB 51config MACH_TAVOREVB
52 bool "PXA930 Evaluation Board (aka TavorEVB)" 52 bool "PXA930 Evaluation Board (aka TavorEVB)"
53 select CPU_PXA930 53 select CPU_PXA930
54 select CPU_PXA935
54 select PXA3xx 55 select PXA3xx
55 56
56config MACH_SAAR 57config MACH_SAAR
57 bool "PXA930 Handheld Platform (aka SAAR)" 58 bool "PXA930 Handheld Platform (aka SAAR)"
58 select CPU_PXA930 59 select CPU_PXA930
60 select CPU_PXA935
59 select PXA3xx 61 select PXA3xx
60 62
61comment "Third Party Dev Platforms (sorted by vendor name)" 63comment "Third Party Dev Platforms (sorted by vendor name)"
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index daa86d39ed9e..666094315ab1 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -1107,8 +1107,33 @@ struct resource pxa_resource_gpio[] = {
1107 }, 1107 },
1108}; 1108};
1109 1109
1110struct platform_device pxa_device_gpio = { 1110struct platform_device pxa25x_device_gpio = {
1111 .name = "pxa-gpio", 1111#ifdef CONFIG_CPU_PXA26x
1112 .name = "pxa26x-gpio",
1113#else
1114 .name = "pxa25x-gpio",
1115#endif
1116 .id = -1,
1117 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1118 .resource = pxa_resource_gpio,
1119};
1120
1121struct platform_device pxa27x_device_gpio = {
1122 .name = "pxa27x-gpio",
1123 .id = -1,
1124 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1125 .resource = pxa_resource_gpio,
1126};
1127
1128struct platform_device pxa3xx_device_gpio = {
1129 .name = "pxa3xx-gpio",
1130 .id = -1,
1131 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1132 .resource = pxa_resource_gpio,
1133};
1134
1135struct platform_device pxa93x_device_gpio = {
1136 .name = "pxa93x-gpio",
1112 .id = -1, 1137 .id = -1,
1113 .num_resources = ARRAY_SIZE(pxa_resource_gpio), 1138 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1114 .resource = pxa_resource_gpio, 1139 .resource = pxa_resource_gpio,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 1475db107254..0f3fd0d65b12 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -16,7 +16,6 @@ extern struct platform_device pxa_device_ficp;
16extern struct platform_device sa1100_device_rtc; 16extern struct platform_device sa1100_device_rtc;
17extern struct platform_device pxa_device_rtc; 17extern struct platform_device pxa_device_rtc;
18extern struct platform_device pxa_device_ac97; 18extern struct platform_device pxa_device_ac97;
19extern struct platform_device pxa_device_gpio;
20 19
21extern struct platform_device pxa27x_device_i2c_power; 20extern struct platform_device pxa27x_device_i2c_power;
22extern struct platform_device pxa27x_device_ohci; 21extern struct platform_device pxa27x_device_ohci;
@@ -46,4 +45,9 @@ extern struct platform_device pxa_device_asoc_ssp2;
46extern struct platform_device pxa_device_asoc_ssp3; 45extern struct platform_device pxa_device_asoc_ssp3;
47extern struct platform_device pxa_device_asoc_ssp4; 46extern struct platform_device pxa_device_asoc_ssp4;
48 47
48extern struct platform_device pxa25x_device_gpio;
49extern struct platform_device pxa27x_device_gpio;
50extern struct platform_device pxa3xx_device_gpio;
51extern struct platform_device pxa93x_device_gpio;
52
49void __init pxa_register_device(struct platform_device *dev, void *data); 53void __init pxa_register_device(struct platform_device *dev, void *data);
diff --git a/arch/arm/mach-pxa/include/mach/debug-macro.S b/arch/arm/mach-pxa/include/mach/debug-macro.S
deleted file mode 100644
index 70b112e8ef68..000000000000
--- a/arch/arm/mach-pxa/include/mach/debug-macro.S
+++ /dev/null
@@ -1,23 +0,0 @@
1/* arch/arm/mach-pxa/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include "hardware.h"
15
16 .macro addruart, rp, rv, tmp
17 mov \rp, #0x00100000
18 orr \rv, \rp, #io_p2v(0x40000000) @ virtual
19 orr \rp, \rp, #0x40000000 @ physical
20 .endm
21
22#define UART_SHIFT 2
23#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 3f5171eaf67b..f2c28972084d 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -208,7 +208,11 @@ static struct clk_lookup pxa25x_clkregs[] = {
208 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"), 208 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), 209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), 210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
211 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), 211#ifdef CONFIG_CPU_PXA26x
212 INIT_CLKREG(&clk_dummy, "pxa26x-gpio", NULL),
213#else
214 INIT_CLKREG(&clk_dummy, "pxa25x-gpio", NULL),
215#endif
212 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 216 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
213}; 217};
214 218
@@ -340,7 +344,8 @@ void __init pxa25x_map_io(void)
340} 344}
341 345
342static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = { 346static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = {
343 .gpio_set_wake = gpio_set_wake, 347 .irq_base = PXA_GPIO_TO_IRQ(0),
348 .gpio_set_wake = gpio_set_wake,
344}; 349};
345 350
346static struct platform_device *pxa25x_devices[] __initdata = { 351static struct platform_device *pxa25x_devices[] __initdata = {
@@ -375,7 +380,7 @@ static int __init pxa25x_init(void)
375 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 380 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
376 register_syscore_ops(&pxa2xx_clock_syscore_ops); 381 register_syscore_ops(&pxa2xx_clock_syscore_ops);
377 382
378 pxa_register_device(&pxa_device_gpio, &pxa25x_gpio_info); 383 pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
379 ret = platform_add_devices(pxa25x_devices, 384 ret = platform_add_devices(pxa25x_devices,
380 ARRAY_SIZE(pxa25x_devices)); 385 ARRAY_SIZE(pxa25x_devices));
381 if (ret) 386 if (ret)
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 3203a9f5b4a2..301471a07a10 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -237,7 +237,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
237 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"), 237 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
238 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), 238 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
239 INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), 239 INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL),
240 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), 240 INIT_CLKREG(&clk_dummy, "pxa27x-gpio", NULL),
241 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 241 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
242}; 242};
243 243
@@ -431,7 +431,8 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
431} 431}
432 432
433static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { 433static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
434 .gpio_set_wake = gpio_set_wake, 434 .irq_base = PXA_GPIO_TO_IRQ(0),
435 .gpio_set_wake = gpio_set_wake,
435}; 436};
436 437
437static struct platform_device *devices[] __initdata = { 438static struct platform_device *devices[] __initdata = {
@@ -470,7 +471,7 @@ static int __init pxa27x_init(void)
470 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 471 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
471 register_syscore_ops(&pxa2xx_clock_syscore_ops); 472 register_syscore_ops(&pxa2xx_clock_syscore_ops);
472 473
473 pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info); 474 pxa_register_device(&pxa27x_device_gpio, &pxa27x_gpio_info);
474 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 475 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
475 } 476 }
476 477
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 656a1bb16d14..87011f3de69d 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/gpio-pxa.h>
18#include <linux/pm.h> 19#include <linux/pm.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/irq.h> 21#include <linux/irq.h>
@@ -92,7 +93,8 @@ static struct clk_lookup pxa3xx_clkregs[] = {
92 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL), 93 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
93 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), 94 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
94 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), 95 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL),
95 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), 96 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa3xx-gpio", NULL),
97 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa93x-gpio", NULL),
96 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 98 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
97}; 99};
98 100
@@ -435,8 +437,11 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
435 pxa_register_device(&pxa3xx_device_i2c_power, info); 437 pxa_register_device(&pxa3xx_device_i2c_power, info);
436} 438}
437 439
440static struct pxa_gpio_platform_data pxa3xx_gpio_pdata = {
441 .irq_base = PXA_GPIO_TO_IRQ(0),
442};
443
438static struct platform_device *devices[] __initdata = { 444static struct platform_device *devices[] __initdata = {
439 &pxa_device_gpio,
440 &pxa27x_device_udc, 445 &pxa27x_device_udc,
441 &pxa_device_pmu, 446 &pxa_device_pmu,
442 &pxa_device_i2s, 447 &pxa_device_i2s,
@@ -482,8 +487,18 @@ static int __init pxa3xx_init(void)
482 register_syscore_ops(&pxa3xx_mfp_syscore_ops); 487 register_syscore_ops(&pxa3xx_mfp_syscore_ops);
483 register_syscore_ops(&pxa3xx_clock_syscore_ops); 488 register_syscore_ops(&pxa3xx_clock_syscore_ops);
484 489
485 if (!of_have_populated_dt()) 490 if (of_have_populated_dt())
486 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 491 return 0;
492
493 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
494 if (ret)
495 return ret;
496 if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320()) {
497 platform_device_add_data(&pxa3xx_device_gpio,
498 &pxa3xx_gpio_pdata,
499 sizeof(pxa3xx_gpio_pdata));
500 ret = platform_device_register(&pxa3xx_device_gpio);
501 }
487 } 502 }
488 503
489 return ret; 504 return ret;
diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c
index 8aeacf908784..ab624487cf39 100644
--- a/arch/arm/mach-pxa/pxa930.c
+++ b/arch/arm/mach-pxa/pxa930.c
@@ -12,12 +12,15 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/irq.h>
17#include <linux/gpio-pxa.h>
18#include <linux/platform_device.h>
18 19
19#include <mach/pxa930.h> 20#include <mach/pxa930.h>
20 21
22#include "devices.h"
23
21static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = { 24static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
22 25
23 MFP_ADDR(GPIO0, 0x02e0), 26 MFP_ADDR(GPIO0, 0x02e0),
@@ -190,11 +193,21 @@ static struct mfp_addr_map pxa935_mfp_addr_map[] __initdata = {
190 MFP_ADDR_END, 193 MFP_ADDR_END,
191}; 194};
192 195
196static struct pxa_gpio_platform_data pxa93x_gpio_pdata = {
197 .irq_base = PXA_GPIO_TO_IRQ(0),
198};
199
193static int __init pxa930_init(void) 200static int __init pxa930_init(void)
194{ 201{
202 int ret = 0;
203
195 if (cpu_is_pxa93x()) { 204 if (cpu_is_pxa93x()) {
196 mfp_init_base(io_p2v(MFPR_BASE)); 205 mfp_init_base(io_p2v(MFPR_BASE));
197 mfp_init_addr(pxa930_mfp_addr_map); 206 mfp_init_addr(pxa930_mfp_addr_map);
207 platform_device_add_data(&pxa93x_device_gpio,
208 &pxa93x_gpio_pdata,
209 sizeof(pxa93x_gpio_pdata));
210 ret = platform_device_register(&pxa93x_device_gpio);
198 } 211 }
199 212
200 if (cpu_is_pxa935()) 213 if (cpu_is_pxa935())
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 9255546e7bf6..ab2bb71db9b2 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -102,6 +102,19 @@ config MACH_MARZEN
102 select ARCH_REQUIRE_GPIOLIB 102 select ARCH_REQUIRE_GPIOLIB
103 select REGULATOR_FIXED_VOLTAGE if REGULATOR 103 select REGULATOR_FIXED_VOLTAGE if REGULATOR
104 104
105config MACH_MARZEN_REFERENCE
106 bool "MARZEN board - Reference Device Tree Implementation"
107 depends on ARCH_R8A7779
108 select ARCH_REQUIRE_GPIOLIB
109 select REGULATOR_FIXED_VOLTAGE if REGULATOR
110 select USE_OF
111 ---help---
112 Use reference implementation of Marzen board support
113 which makes use of device tree at the expense
114 of not supporting a number of devices.
115
116 This is intended to aid developers
117
105config MACH_KZM9D 118config MACH_KZM9D
106 bool "KZM9D board" 119 bool "KZM9D board"
107 depends on ARCH_EMEV2 120 depends on ARCH_EMEV2
@@ -116,6 +129,20 @@ config MACH_KZM9G
116 select SND_SOC_AK4642 if SND_SIMPLE_CARD 129 select SND_SOC_AK4642 if SND_SIMPLE_CARD
117 select USE_OF 130 select USE_OF
118 131
132config MACH_KZM9G_REFERENCE
133 bool "KZM-A9-GT board - Reference Device Tree Implementation"
134 depends on ARCH_SH73A0
135 select ARCH_REQUIRE_GPIOLIB
136 select REGULATOR_FIXED_VOLTAGE if REGULATOR
137 select SND_SOC_AK4642 if SND_SIMPLE_CARD
138 select USE_OF
139 ---help---
140 Use reference implementation of KZM-A9-GT board support
141 which makes as greater use of device tree at the expense
142 of not supporting a number of devices.
143
144 This is intended to aid developers
145
119comment "SH-Mobile System Configuration" 146comment "SH-Mobile System Configuration"
120 147
121config CPU_HAS_INTEVT 148config CPU_HAS_INTEVT
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index e1fac57514b9..c621edfa6ead 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -14,10 +14,9 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o
14 14
15# SMP objects 15# SMP objects
16smp-y := platsmp.o headsmp.o 16smp-y := platsmp.o headsmp.o
17smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o 17smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o
18smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-sh73a0.o 18smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o
19smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o 19smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o
20smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o
21 20
22# IRQ objects 21# IRQ objects
23obj-$(CONFIG_ARCH_SH7372) += entry-intc.o 22obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
@@ -39,9 +38,11 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
39obj-$(CONFIG_MACH_KOTA2) += board-kota2.o 38obj-$(CONFIG_MACH_KOTA2) += board-kota2.o
40obj-$(CONFIG_MACH_BONITO) += board-bonito.o 39obj-$(CONFIG_MACH_BONITO) += board-bonito.o
41obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 40obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
41obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
42obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 42obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
43obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 43obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
44obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 44obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
45obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
45 46
46# Framework support 47# Framework support
47obj-$(CONFIG_SMP) += $(smp-y) 48obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 8ff53a19c48c..c7540710906f 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -23,6 +23,8 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/pinctrl/machine.h>
27#include <linux/pinctrl/pinconf-generic.h>
26#include <linux/platform_device.h> 28#include <linux/platform_device.h>
27#include <linux/delay.h> 29#include <linux/delay.h>
28#include <linux/io.h> 30#include <linux/io.h>
@@ -304,9 +306,9 @@ static int lcd_backlight_set_brightness(int brightness)
304 306
305 if (brightness == 0) { 307 if (brightness == 0) {
306 /* Reset the chip */ 308 /* Reset the chip */
307 gpio_set_value(GPIO_PORT235, 0); 309 gpio_set_value(235, 0);
308 mdelay(24); 310 mdelay(24);
309 gpio_set_value(GPIO_PORT235, 1); 311 gpio_set_value(235, 1);
310 return 0; 312 return 0;
311 } 313 }
312 314
@@ -406,7 +408,7 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
406 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 408 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
407 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 409 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
408 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 410 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
409 .cd_gpio = GPIO_PORT251, 411 .cd_gpio = 251,
410}; 412};
411 413
412static struct resource sdhi0_resources[] = { 414static struct resource sdhi0_resources[] = {
@@ -461,7 +463,7 @@ static struct regulator_init_data cn4_power_init_data = {
461static struct fixed_voltage_config cn4_power_info = { 463static struct fixed_voltage_config cn4_power_info = {
462 .supply_name = "CN4 SD/MMC Vdd", 464 .supply_name = "CN4 SD/MMC Vdd",
463 .microvolts = 3300000, 465 .microvolts = 3300000,
464 .gpio = GPIO_PORT114, 466 .gpio = 114,
465 .enable_high = 1, 467 .enable_high = 1,
466 .init_data = &cn4_power_init_data, 468 .init_data = &cn4_power_init_data,
467}; 469};
@@ -479,10 +481,10 @@ static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
479 static int power_gpio = -EINVAL; 481 static int power_gpio = -EINVAL;
480 482
481 if (power_gpio < 0) { 483 if (power_gpio < 0) {
482 int ret = gpio_request_one(GPIO_PORT114, GPIOF_OUT_INIT_LOW, 484 int ret = gpio_request_one(114, GPIOF_OUT_INIT_LOW,
483 "sdhi1_power"); 485 "sdhi1_power");
484 if (!ret) 486 if (!ret)
485 power_gpio = GPIO_PORT114; 487 power_gpio = 114;
486 } 488 }
487 489
488 /* 490 /*
@@ -493,7 +495,7 @@ static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
493 * regulator driver. We have to live with the race in case the driver 495 * regulator driver. We have to live with the race in case the driver
494 * gets unloaded and the GPIO freed between these two steps. 496 * gets unloaded and the GPIO freed between these two steps.
495 */ 497 */
496 gpio_set_value(GPIO_PORT114, state); 498 gpio_set_value(114, state);
497} 499}
498 500
499static struct sh_mobile_sdhi_info sh_sdhi1_info = { 501static struct sh_mobile_sdhi_info sh_sdhi1_info = {
@@ -550,6 +552,77 @@ static struct platform_device *ag5evm_devices[] __initdata = {
550 &sdhi1_device, 552 &sdhi1_device,
551}; 553};
552 554
555static unsigned long pin_pullup_conf[] = {
556 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
557};
558
559static const struct pinctrl_map ag5evm_pinctrl_map[] = {
560 /* FSIA */
561 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
562 "fsia_mclk_in", "fsia"),
563 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
564 "fsia_sclk_in", "fsia"),
565 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
566 "fsia_data_in", "fsia"),
567 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
568 "fsia_data_out", "fsia"),
569 /* I2C2 & I2C3 */
570 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.2", "pfc-sh73a0",
571 "i2c2_0", "i2c2"),
572 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
573 "i2c3_0", "i2c3"),
574 /* IrDA */
575 PIN_MAP_MUX_GROUP_DEFAULT("sh_irda.0", "pfc-sh73a0",
576 "irda_0", "irda"),
577 /* KEYSC */
578 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
579 "keysc_in8", "keysc"),
580 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
581 "keysc_out04", "keysc"),
582 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
583 "keysc_out5", "keysc"),
584 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
585 "keysc_out6_0", "keysc"),
586 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
587 "keysc_out7_0", "keysc"),
588 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
589 "keysc_out8_0", "keysc"),
590 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
591 "keysc_out9_2", "keysc"),
592 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
593 "keysc_in8", pin_pullup_conf),
594 /* MMCIF */
595 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
596 "mmc0_data8_0", "mmc0"),
597 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
598 "mmc0_ctrl_0", "mmc0"),
599 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
600 "PORT279", pin_pullup_conf),
601 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
602 "mmc0_data8_0", pin_pullup_conf),
603 /* SCIFA2 */
604 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
605 "scifa2_data_0", "scifa2"),
606 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
607 "scifa2_ctrl_0", "scifa2"),
608 /* SDHI0 (CN15 [SD I/F]) */
609 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
610 "sdhi0_data4", "sdhi0"),
611 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
612 "sdhi0_ctrl", "sdhi0"),
613 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
614 "sdhi0_wp", "sdhi0"),
615 /* SDHI1 (CN4 [WLAN I/F]) */
616 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
617 "sdhi1_data4", "sdhi1"),
618 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
619 "sdhi1_ctrl", "sdhi1"),
620 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
621 "sdhi1_data4", pin_pullup_conf),
622 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
623 "PORT263", pin_pullup_conf),
624};
625
553static void __init ag5evm_init(void) 626static void __init ag5evm_init(void)
554{ 627{
555 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, 628 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
@@ -558,96 +631,27 @@ static void __init ag5evm_init(void)
558 ARRAY_SIZE(fixed2v8_power_consumers), 3300000); 631 ARRAY_SIZE(fixed2v8_power_consumers), 3300000);
559 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 632 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
560 633
634 pinctrl_register_mappings(ag5evm_pinctrl_map,
635 ARRAY_SIZE(ag5evm_pinctrl_map));
561 sh73a0_pinmux_init(); 636 sh73a0_pinmux_init();
562 637
563 /* enable SCIFA2 */
564 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
565 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
566 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
567 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
568
569 /* enable KEYSC */
570 gpio_request(GPIO_FN_KEYIN0_PU, NULL);
571 gpio_request(GPIO_FN_KEYIN1_PU, NULL);
572 gpio_request(GPIO_FN_KEYIN2_PU, NULL);
573 gpio_request(GPIO_FN_KEYIN3_PU, NULL);
574 gpio_request(GPIO_FN_KEYIN4_PU, NULL);
575 gpio_request(GPIO_FN_KEYIN5_PU, NULL);
576 gpio_request(GPIO_FN_KEYIN6_PU, NULL);
577 gpio_request(GPIO_FN_KEYIN7_PU, NULL);
578 gpio_request(GPIO_FN_KEYOUT0, NULL);
579 gpio_request(GPIO_FN_KEYOUT1, NULL);
580 gpio_request(GPIO_FN_KEYOUT2, NULL);
581 gpio_request(GPIO_FN_KEYOUT3, NULL);
582 gpio_request(GPIO_FN_KEYOUT4, NULL);
583 gpio_request(GPIO_FN_KEYOUT5, NULL);
584 gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
585 gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
586 gpio_request(GPIO_FN_KEYOUT8, NULL);
587 gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL);
588
589 /* enable I2C channel 2 and 3 */
590 gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL);
591 gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL);
592 gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL);
593 gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL);
594
595 /* enable MMCIF */ 638 /* enable MMCIF */
596 gpio_request(GPIO_FN_MMCCLK0, NULL); 639 gpio_request_one(208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
597 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
598 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
599 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
600 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
601 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
602 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
603 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
604 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
605 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
606 gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
607 640
608 /* enable SMSC911X */ 641 /* enable SMSC911X */
609 gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */ 642 gpio_request_one(144, GPIOF_IN, NULL); /* PINTA2 */
610 gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */ 643 gpio_request_one(145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
611
612 /* FSI A */
613 gpio_request(GPIO_FN_FSIACK, NULL);
614 gpio_request(GPIO_FN_FSIAILR, NULL);
615 gpio_request(GPIO_FN_FSIAIBT, NULL);
616 gpio_request(GPIO_FN_FSIAISLD, NULL);
617 gpio_request(GPIO_FN_FSIAOSLD, NULL);
618
619 /* IrDA */
620 gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL);
621 gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL);
622 gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
623 644
624 /* LCD panel */ 645 /* LCD panel */
625 gpio_request_one(GPIO_PORT217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */ 646 gpio_request_one(217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
626 mdelay(1); 647 mdelay(1);
627 gpio_set_value(GPIO_PORT217, 1); 648 gpio_set_value(217, 1);
628 mdelay(100); 649 mdelay(100);
629 650
630 /* LCD backlight controller */ 651 /* LCD backlight controller */
631 gpio_request_one(GPIO_PORT235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */ 652 gpio_request_one(235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
632 lcd_backlight_set_brightness(0); 653 lcd_backlight_set_brightness(0);
633 654
634 /* enable SDHI0 on CN15 [SD I/F] */
635 gpio_request(GPIO_FN_SDHIWP0, NULL);
636 gpio_request(GPIO_FN_SDHICMD0, NULL);
637 gpio_request(GPIO_FN_SDHICLK0, NULL);
638 gpio_request(GPIO_FN_SDHID0_3, NULL);
639 gpio_request(GPIO_FN_SDHID0_2, NULL);
640 gpio_request(GPIO_FN_SDHID0_1, NULL);
641 gpio_request(GPIO_FN_SDHID0_0, NULL);
642
643 /* enable SDHI1 on CN4 [WLAN I/F] */
644 gpio_request(GPIO_FN_SDHICLK1, NULL);
645 gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
646 gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
647 gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
648 gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
649 gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
650
651#ifdef CONFIG_CACHE_L2X0 655#ifdef CONFIG_CACHE_L2X0
652 /* Shared attribute override enable, 64K*8way */ 656 /* Shared attribute override enable, 64K*8way */
653 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff); 657 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 38f1259a0daf..45f78cadec1d 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -34,6 +34,7 @@
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/i2c/tsc2007.h> 35#include <linux/i2c/tsc2007.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/pinctrl/machine.h>
37#include <linux/regulator/fixed.h> 38#include <linux/regulator/fixed.h>
38#include <linux/regulator/machine.h> 39#include <linux/regulator/machine.h>
39#include <linux/smsc911x.h> 40#include <linux/smsc911x.h>
@@ -273,11 +274,11 @@ static struct platform_device smc911x_device = {
273 274
274/* 275/*
275 * The card detect pin of the top SD/MMC slot (CN7) is active low and is 276 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
276 * connected to GPIO A22 of SH7372 (GPIO_PORT41). 277 * connected to GPIO A22 of SH7372 (GPIO 41).
277 */ 278 */
278static int slot_cn7_get_cd(struct platform_device *pdev) 279static int slot_cn7_get_cd(struct platform_device *pdev)
279{ 280{
280 return !gpio_get_value(GPIO_PORT41); 281 return !gpio_get_value(41);
281} 282}
282/* MERAM */ 283/* MERAM */
283static struct sh_mobile_meram_info meram_info = { 284static struct sh_mobile_meram_info meram_info = {
@@ -838,22 +839,22 @@ static struct platform_device fsi_hdmi_device = {
838static struct gpio_led ap4evb_leds[] = { 839static struct gpio_led ap4evb_leds[] = {
839 { 840 {
840 .name = "led4", 841 .name = "led4",
841 .gpio = GPIO_PORT185, 842 .gpio = 185,
842 .default_state = LEDS_GPIO_DEFSTATE_ON, 843 .default_state = LEDS_GPIO_DEFSTATE_ON,
843 }, 844 },
844 { 845 {
845 .name = "led2", 846 .name = "led2",
846 .gpio = GPIO_PORT186, 847 .gpio = 186,
847 .default_state = LEDS_GPIO_DEFSTATE_ON, 848 .default_state = LEDS_GPIO_DEFSTATE_ON,
848 }, 849 },
849 { 850 {
850 .name = "led3", 851 .name = "led3",
851 .gpio = GPIO_PORT187, 852 .gpio = 187,
852 .default_state = LEDS_GPIO_DEFSTATE_ON, 853 .default_state = LEDS_GPIO_DEFSTATE_ON,
853 }, 854 },
854 { 855 {
855 .name = "led1", 856 .name = "led1",
856 .gpio = GPIO_PORT188, 857 .gpio = 188,
857 .default_state = LEDS_GPIO_DEFSTATE_ON, 858 .default_state = LEDS_GPIO_DEFSTATE_ON,
858 } 859 }
859}; 860};
@@ -1026,10 +1027,10 @@ out:
1026/* TouchScreen */ 1027/* TouchScreen */
1027#ifdef CONFIG_AP4EVB_QHD 1028#ifdef CONFIG_AP4EVB_QHD
1028# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123 1029# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
1029# define GPIO_TSC_PORT GPIO_PORT123 1030# define GPIO_TSC_PORT 123
1030#else /* WVGA */ 1031#else /* WVGA */
1031# define GPIO_TSC_IRQ GPIO_FN_IRQ7_40 1032# define GPIO_TSC_IRQ GPIO_FN_IRQ7_40
1032# define GPIO_TSC_PORT GPIO_PORT40 1033# define GPIO_TSC_PORT 40
1033#endif 1034#endif
1034 1035
1035#define IRQ28 evt2irq(0x3380) /* IRQ28A */ 1036#define IRQ28 evt2irq(0x3380) /* IRQ28A */
@@ -1084,6 +1085,28 @@ static struct i2c_board_info i2c1_devices[] = {
1084}; 1085};
1085 1086
1086 1087
1088static const struct pinctrl_map ap4evb_pinctrl_map[] = {
1089 /* MMCIF */
1090 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1091 "mmc0_data8_0", "mmc0"),
1092 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1093 "mmc0_ctrl_0", "mmc0"),
1094 /* SDHI0 */
1095 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1096 "sdhi0_data4", "sdhi0"),
1097 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1098 "sdhi0_ctrl", "sdhi0"),
1099 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1100 "sdhi0_cd", "sdhi0"),
1101 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1102 "sdhi0_wp", "sdhi0"),
1103 /* SDHI1 */
1104 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1105 "sdhi1_data4", "sdhi1"),
1106 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1107 "sdhi1_ctrl", "sdhi1"),
1108};
1109
1087#define GPIO_PORT9CR IOMEM(0xE6051009) 1110#define GPIO_PORT9CR IOMEM(0xE6051009)
1088#define GPIO_PORT10CR IOMEM(0xE605100A) 1111#define GPIO_PORT10CR IOMEM(0xE605100A)
1089#define USCCR1 IOMEM(0xE6058144) 1112#define USCCR1 IOMEM(0xE6058144)
@@ -1110,6 +1133,8 @@ static void __init ap4evb_init(void)
1110 /* External clock source */ 1133 /* External clock source */
1111 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1134 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1112 1135
1136 pinctrl_register_mappings(ap4evb_pinctrl_map,
1137 ARRAY_SIZE(ap4evb_pinctrl_map));
1113 sh7372_pinmux_init(); 1138 sh7372_pinmux_init();
1114 1139
1115 /* enable SCIFA0 */ 1140 /* enable SCIFA0 */
@@ -1121,40 +1146,10 @@ static void __init ap4evb_init(void)
1121 gpio_request(GPIO_FN_IRQ6_39, NULL); 1146 gpio_request(GPIO_FN_IRQ6_39, NULL);
1122 1147
1123 /* enable Debug switch (S6) */ 1148 /* enable Debug switch (S6) */
1124 gpio_request_one(GPIO_PORT32, GPIOF_IN | GPIOF_EXPORT, NULL); 1149 gpio_request_one(32, GPIOF_IN | GPIOF_EXPORT, NULL);
1125 gpio_request_one(GPIO_PORT33, GPIOF_IN | GPIOF_EXPORT, NULL); 1150 gpio_request_one(33, GPIOF_IN | GPIOF_EXPORT, NULL);
1126 gpio_request_one(GPIO_PORT34, GPIOF_IN | GPIOF_EXPORT, NULL); 1151 gpio_request_one(34, GPIOF_IN | GPIOF_EXPORT, NULL);
1127 gpio_request_one(GPIO_PORT35, GPIOF_IN | GPIOF_EXPORT, NULL); 1152 gpio_request_one(35, GPIOF_IN | GPIOF_EXPORT, NULL);
1128
1129 /* SDHI0 */
1130 gpio_request(GPIO_FN_SDHICD0, NULL);
1131 gpio_request(GPIO_FN_SDHIWP0, NULL);
1132 gpio_request(GPIO_FN_SDHICMD0, NULL);
1133 gpio_request(GPIO_FN_SDHICLK0, NULL);
1134 gpio_request(GPIO_FN_SDHID0_3, NULL);
1135 gpio_request(GPIO_FN_SDHID0_2, NULL);
1136 gpio_request(GPIO_FN_SDHID0_1, NULL);
1137 gpio_request(GPIO_FN_SDHID0_0, NULL);
1138
1139 /* SDHI1 */
1140 gpio_request(GPIO_FN_SDHICMD1, NULL);
1141 gpio_request(GPIO_FN_SDHICLK1, NULL);
1142 gpio_request(GPIO_FN_SDHID1_3, NULL);
1143 gpio_request(GPIO_FN_SDHID1_2, NULL);
1144 gpio_request(GPIO_FN_SDHID1_1, NULL);
1145 gpio_request(GPIO_FN_SDHID1_0, NULL);
1146
1147 /* MMCIF */
1148 gpio_request(GPIO_FN_MMCD0_0, NULL);
1149 gpio_request(GPIO_FN_MMCD0_1, NULL);
1150 gpio_request(GPIO_FN_MMCD0_2, NULL);
1151 gpio_request(GPIO_FN_MMCD0_3, NULL);
1152 gpio_request(GPIO_FN_MMCD0_4, NULL);
1153 gpio_request(GPIO_FN_MMCD0_5, NULL);
1154 gpio_request(GPIO_FN_MMCD0_6, NULL);
1155 gpio_request(GPIO_FN_MMCD0_7, NULL);
1156 gpio_request(GPIO_FN_MMCCMD0, NULL);
1157 gpio_request(GPIO_FN_MMCCLK0, NULL);
1158 1153
1159 /* USB enable */ 1154 /* USB enable */
1160 gpio_request(GPIO_FN_VBUS0_1, NULL); 1155 gpio_request(GPIO_FN_VBUS0_1, NULL);
@@ -1172,15 +1167,15 @@ static void __init ap4evb_init(void)
1172 gpio_request(GPIO_FN_FSIAILR, NULL); 1167 gpio_request(GPIO_FN_FSIAILR, NULL);
1173 gpio_request(GPIO_FN_FSIAISLD, NULL); 1168 gpio_request(GPIO_FN_FSIAISLD, NULL);
1174 gpio_request(GPIO_FN_FSIAOSLD, NULL); 1169 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1175 gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ 1170 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1176 1171
1177 gpio_request(GPIO_PORT9, NULL); 1172 gpio_request(9, NULL);
1178 gpio_request(GPIO_PORT10, NULL); 1173 gpio_request(10, NULL);
1179 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1174 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1180 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1175 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1181 1176
1182 /* card detect pin for MMC slot (CN7) */ 1177 /* card detect pin for MMC slot (CN7) */
1183 gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL); 1178 gpio_request_one(41, GPIOF_IN, NULL);
1184 1179
1185 /* setup FSI2 port B (HDMI) */ 1180 /* setup FSI2 port B (HDMI) */
1186 gpio_request(GPIO_FN_FSIBCK, NULL); 1181 gpio_request(GPIO_FN_FSIBCK, NULL);
@@ -1268,8 +1263,8 @@ static void __init ap4evb_init(void)
1268 gpio_request(GPIO_FN_LCDDISP, NULL); 1263 gpio_request(GPIO_FN_LCDDISP, NULL);
1269 gpio_request(GPIO_FN_LCDDCK, NULL); 1264 gpio_request(GPIO_FN_LCDDCK, NULL);
1270 1265
1271 gpio_request_one(GPIO_PORT189, GPIOF_OUT_INIT_HIGH, NULL); /* backlight */ 1266 gpio_request_one(189, GPIOF_OUT_INIT_HIGH, NULL); /* backlight */
1272 gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1267 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1273 1268
1274 lcdc_info.clock_source = LCDC_CLK_BUS; 1269 lcdc_info.clock_source = LCDC_CLK_BUS;
1275 lcdc_info.ch[0].interface_type = RGB18; 1270 lcdc_info.ch[0].interface_type = RGB18;
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index f2ec0777cfbe..7a78f9486684 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -28,7 +28,10 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/regulator/driver.h>
32#include <linux/pinctrl/machine.h>
31#include <linux/regulator/fixed.h> 33#include <linux/regulator/fixed.h>
34#include <linux/regulator/gpio-regulator.h>
32#include <linux/regulator/machine.h> 35#include <linux/regulator/machine.h>
33#include <linux/sh_eth.h> 36#include <linux/sh_eth.h>
34#include <linux/videodev2.h> 37#include <linux/videodev2.h>
@@ -227,7 +230,7 @@ static void usbhsf_power_ctrl(struct platform_device *pdev,
227 230
228static int usbhsf_get_vbus(struct platform_device *pdev) 231static int usbhsf_get_vbus(struct platform_device *pdev)
229{ 232{
230 return gpio_get_value(GPIO_PORT209); 233 return gpio_get_value(209);
231} 234}
232 235
233static irqreturn_t usbhsf_interrupt(int irq, void *data) 236static irqreturn_t usbhsf_interrupt(int irq, void *data)
@@ -535,10 +538,10 @@ static struct platform_device hdmi_lcdc_device = {
535 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ } 538 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }
536 539
537static struct gpio_keys_button gpio_buttons[] = { 540static struct gpio_keys_button gpio_buttons[] = {
538 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW3", .wakeup = 1), 541 GPIO_KEY(KEY_POWER, 99, "SW3", .wakeup = 1),
539 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW4"), 542 GPIO_KEY(KEY_BACK, 100, "SW4"),
540 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW5"), 543 GPIO_KEY(KEY_MENU, 97, "SW5"),
541 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW6"), 544 GPIO_KEY(KEY_HOME, 98, "SW6"),
542}; 545};
543 546
544static struct gpio_keys_platform_data gpio_key_info = { 547static struct gpio_keys_platform_data gpio_key_info = {
@@ -554,15 +557,119 @@ static struct platform_device gpio_keys_device = {
554 }, 557 },
555}; 558};
556 559
557/* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */ 560/* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
558static struct regulator_consumer_supply fixed3v3_power_consumers[] = 561static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
559{ 562 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
563 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
564};
565
566/* Fixed 3.3V regulator to be used by SDHI0 */
567static struct regulator_consumer_supply vcc_sdhi0_consumers[] = {
560 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 568 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
569};
570
571static struct regulator_init_data vcc_sdhi0_init_data = {
572 .constraints = {
573 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
574 },
575 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
576 .consumer_supplies = vcc_sdhi0_consumers,
577};
578
579static struct fixed_voltage_config vcc_sdhi0_info = {
580 .supply_name = "SDHI0 Vcc",
581 .microvolts = 3300000,
582 .gpio = GPIO_PORT75,
583 .enable_high = 1,
584 .init_data = &vcc_sdhi0_init_data,
585};
586
587static struct platform_device vcc_sdhi0 = {
588 .name = "reg-fixed-voltage",
589 .id = 1,
590 .dev = {
591 .platform_data = &vcc_sdhi0_info,
592 },
593};
594
595/* 1.8 / 3.3V SDHI0 VccQ regulator */
596static struct regulator_consumer_supply vccq_sdhi0_consumers[] = {
561 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), 597 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
598};
599
600static struct regulator_init_data vccq_sdhi0_init_data = {
601 .constraints = {
602 .input_uV = 3300000,
603 .min_uV = 1800000,
604 .max_uV = 3300000,
605 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
606 REGULATOR_CHANGE_STATUS,
607 },
608 .num_consumer_supplies = ARRAY_SIZE(vccq_sdhi0_consumers),
609 .consumer_supplies = vccq_sdhi0_consumers,
610};
611
612static struct gpio vccq_sdhi0_gpios[] = {
613 {GPIO_PORT17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" },
614};
615
616static struct gpio_regulator_state vccq_sdhi0_states[] = {
617 { .value = 3300000, .gpios = (0 << 0) },
618 { .value = 1800000, .gpios = (1 << 0) },
619};
620
621static struct gpio_regulator_config vccq_sdhi0_info = {
622 .supply_name = "vqmmc",
623
624 .enable_gpio = GPIO_PORT74,
625 .enable_high = 1,
626 .enabled_at_boot = 0,
627
628 .gpios = vccq_sdhi0_gpios,
629 .nr_gpios = ARRAY_SIZE(vccq_sdhi0_gpios),
630
631 .states = vccq_sdhi0_states,
632 .nr_states = ARRAY_SIZE(vccq_sdhi0_states),
633
634 .type = REGULATOR_VOLTAGE,
635 .init_data = &vccq_sdhi0_init_data,
636};
637
638static struct platform_device vccq_sdhi0 = {
639 .name = "gpio-regulator",
640 .id = -1,
641 .dev = {
642 .platform_data = &vccq_sdhi0_info,
643 },
644};
645
646/* Fixed 3.3V regulator to be used by SDHI1 */
647static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
562 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), 648 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
563 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), 649};
564 REGULATOR_SUPPLY("vmmc", "sh_mmcif"), 650
565 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"), 651static struct regulator_init_data vcc_sdhi1_init_data = {
652 .constraints = {
653 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
654 },
655 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
656 .consumer_supplies = vcc_sdhi1_consumers,
657};
658
659static struct fixed_voltage_config vcc_sdhi1_info = {
660 .supply_name = "SDHI1 Vcc",
661 .microvolts = 3300000,
662 .gpio = GPIO_PORT16,
663 .enable_high = 1,
664 .init_data = &vcc_sdhi1_init_data,
665};
666
667static struct platform_device vcc_sdhi1 = {
668 .name = "reg-fixed-voltage",
669 .id = 2,
670 .dev = {
671 .platform_data = &vcc_sdhi1_info,
672 },
566}; 673};
567 674
568/* SDHI0 */ 675/* SDHI0 */
@@ -578,10 +685,10 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
578static struct sh_mobile_sdhi_info sdhi0_info = { 685static struct sh_mobile_sdhi_info sdhi0_info = {
579 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 686 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
580 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 687 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
581 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\ 688 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
582 MMC_CAP_NEEDS_POLL, 689 MMC_CAP_POWER_OFF_CARD,
583 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 690 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
584 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 691 .cd_gpio = GPIO_PORT167,
585}; 692};
586 693
587static struct resource sdhi0_resources[] = { 694static struct resource sdhi0_resources[] = {
@@ -620,9 +727,11 @@ static struct platform_device sdhi0_device = {
620static struct sh_mobile_sdhi_info sdhi1_info = { 727static struct sh_mobile_sdhi_info sdhi1_info = {
621 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 728 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
622 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 729 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
623 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 730 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
624 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 731 MMC_CAP_POWER_OFF_CARD,
625 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 732 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
733 /* Port72 cannot generate IRQs, will be used in polling mode. */
734 .cd_gpio = GPIO_PORT72,
626}; 735};
627 736
628static struct resource sdhi1_resources[] = { 737static struct resource sdhi1_resources[] = {
@@ -656,10 +765,20 @@ static struct platform_device sdhi1_device = {
656 .resource = sdhi1_resources, 765 .resource = sdhi1_resources,
657}; 766};
658 767
768static const struct pinctrl_map eva_sdhi1_pinctrl_map[] = {
769 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
770 "sdhi1_data4", "sdhi1"),
771 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
772 "sdhi1_ctrl", "sdhi1"),
773 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
774 "sdhi1_cd", "sdhi1"),
775 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
776 "sdhi1_wp", "sdhi1"),
777};
778
659/* MMCIF */ 779/* MMCIF */
660static struct sh_mmcif_plat_data sh_mmcif_plat = { 780static struct sh_mmcif_plat_data sh_mmcif_plat = {
661 .sup_pclk = 0, 781 .sup_pclk = 0,
662 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
663 .caps = MMC_CAP_4_BIT_DATA | 782 .caps = MMC_CAP_4_BIT_DATA |
664 MMC_CAP_8_BIT_DATA | 783 MMC_CAP_8_BIT_DATA |
665 MMC_CAP_NONREMOVABLE, 784 MMC_CAP_NONREMOVABLE,
@@ -708,9 +827,9 @@ static int mt9t111_power(struct device *dev, int mode)
708 /* video1 (= CON1 camera) expect 24MHz */ 827 /* video1 (= CON1 camera) expect 24MHz */
709 clk_set_rate(mclk, clk_round_rate(mclk, 24000000)); 828 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
710 clk_enable(mclk); 829 clk_enable(mclk);
711 gpio_set_value(GPIO_PORT158, 1); 830 gpio_set_value(158, 1);
712 } else { 831 } else {
713 gpio_set_value(GPIO_PORT158, 0); 832 gpio_set_value(158, 0);
714 clk_disable(mclk); 833 clk_disable(mclk);
715 } 834 }
716 835
@@ -864,8 +983,8 @@ static struct platform_device fsi_hdmi_device = {
864 983
865/* RTC: RTC connects i2c-gpio. */ 984/* RTC: RTC connects i2c-gpio. */
866static struct i2c_gpio_platform_data i2c_gpio_data = { 985static struct i2c_gpio_platform_data i2c_gpio_data = {
867 .sda_pin = GPIO_PORT208, 986 .sda_pin = 208,
868 .scl_pin = GPIO_PORT91, 987 .scl_pin = 91,
869 .udelay = 5, /* 100 kHz */ 988 .udelay = 5, /* 100 kHz */
870}; 989};
871 990
@@ -902,6 +1021,8 @@ static struct platform_device *eva_devices[] __initdata = {
902 &lcdc0_device, 1021 &lcdc0_device,
903 &gpio_keys_device, 1022 &gpio_keys_device,
904 &sh_eth_device, 1023 &sh_eth_device,
1024 &vcc_sdhi0,
1025 &vccq_sdhi0,
905 &sdhi0_device, 1026 &sdhi0_device,
906 &sh_mmcif_device, 1027 &sh_mmcif_device,
907 &hdmi_device, 1028 &hdmi_device,
@@ -914,6 +1035,28 @@ static struct platform_device *eva_devices[] __initdata = {
914 &i2c_gpio_device, 1035 &i2c_gpio_device,
915}; 1036};
916 1037
1038static const struct pinctrl_map eva_pinctrl_map[] = {
1039 /* LCD0 */
1040 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1041 "lcd0_data24_0", "lcd0"),
1042 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1043 "lcd0_lclk_1", "lcd0"),
1044 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1045 "lcd0_sync", "lcd0"),
1046 /* MMCIF */
1047 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1048 "mmc0_data8_1", "mmc0"),
1049 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1050 "mmc0_ctrl_1", "mmc0"),
1051 /* SDHI0 */
1052 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1053 "sdhi0_data4", "sdhi0"),
1054 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1055 "sdhi0_ctrl", "sdhi0"),
1056 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1057 "sdhi0_wp", "sdhi0"),
1058};
1059
917static void __init eva_clock_init(void) 1060static void __init eva_clock_init(void)
918{ 1061{
919 struct clk *system = clk_get(NULL, "system_clk"); 1062 struct clk *system = clk_get(NULL, "system_clk");
@@ -961,6 +1104,8 @@ static void __init eva_init(void)
961 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 1104 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
962 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 1105 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
963 1106
1107 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
1108
964 r8a7740_pinmux_init(); 1109 r8a7740_pinmux_init();
965 r8a7740_meram_workaround(); 1110 r8a7740_meram_workaround();
966 1111
@@ -970,42 +1115,13 @@ static void __init eva_init(void)
970 1115
971 /* LCDC0 */ 1116 /* LCDC0 */
972 gpio_request(GPIO_FN_LCDC0_SELECT, NULL); 1117 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
973 gpio_request(GPIO_FN_LCD0_D0, NULL); 1118
974 gpio_request(GPIO_FN_LCD0_D1, NULL); 1119 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
975 gpio_request(GPIO_FN_LCD0_D2, NULL); 1120 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
976 gpio_request(GPIO_FN_LCD0_D3, NULL);
977 gpio_request(GPIO_FN_LCD0_D4, NULL);
978 gpio_request(GPIO_FN_LCD0_D5, NULL);
979 gpio_request(GPIO_FN_LCD0_D6, NULL);
980 gpio_request(GPIO_FN_LCD0_D7, NULL);
981 gpio_request(GPIO_FN_LCD0_D8, NULL);
982 gpio_request(GPIO_FN_LCD0_D9, NULL);
983 gpio_request(GPIO_FN_LCD0_D10, NULL);
984 gpio_request(GPIO_FN_LCD0_D11, NULL);
985 gpio_request(GPIO_FN_LCD0_D12, NULL);
986 gpio_request(GPIO_FN_LCD0_D13, NULL);
987 gpio_request(GPIO_FN_LCD0_D14, NULL);
988 gpio_request(GPIO_FN_LCD0_D15, NULL);
989 gpio_request(GPIO_FN_LCD0_D16, NULL);
990 gpio_request(GPIO_FN_LCD0_D17, NULL);
991 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
992 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
993 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
994 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
995 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
996 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
997 gpio_request(GPIO_FN_LCD0_DCK, NULL);
998 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
999 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
1000 gpio_request(GPIO_FN_LCD0_DISP, NULL);
1001 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
1002
1003 gpio_request_one(GPIO_PORT61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1004 gpio_request_one(GPIO_PORT202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
1005 1121
1006 /* Touchscreen */ 1122 /* Touchscreen */
1007 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */ 1123 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
1008 gpio_request_one(GPIO_PORT166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */ 1124 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
1009 1125
1010 /* GETHER */ 1126 /* GETHER */
1011 gpio_request(GPIO_FN_ET_CRS, NULL); 1127 gpio_request(GPIO_FN_ET_CRS, NULL);
@@ -1028,12 +1144,12 @@ static void __init eva_init(void)
1028 gpio_request(GPIO_FN_ET_RX_DV, NULL); 1144 gpio_request(GPIO_FN_ET_RX_DV, NULL);
1029 gpio_request(GPIO_FN_ET_RX_CLK, NULL); 1145 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
1030 1146
1031 gpio_request_one(GPIO_PORT18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ 1147 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
1032 1148
1033 /* USB */ 1149 /* USB */
1034 gpio_request_one(GPIO_PORT159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */ 1150 gpio_request_one(159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */
1035 1151
1036 if (gpio_get_value(GPIO_PORT159)) { 1152 if (gpio_get_value(159)) {
1037 /* USB Host */ 1153 /* USB Host */
1038 } else { 1154 } else {
1039 /* USB Func */ 1155 /* USB Func */
@@ -1042,47 +1158,15 @@ static void __init eva_init(void)
1042 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide 1158 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide
1043 * USB connection/disconnection (usbhsf_get_vbus()). 1159 * USB connection/disconnection (usbhsf_get_vbus()).
1044 * This means we needs to select GPIO_FN_IRQ7_PORT209 first, 1160 * This means we needs to select GPIO_FN_IRQ7_PORT209 first,
1045 * and select GPIO_PORT209 here 1161 * and select GPIO 209 here
1046 */ 1162 */
1047 gpio_request(GPIO_FN_IRQ7_PORT209, NULL); 1163 gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
1048 gpio_request_one(GPIO_PORT209, GPIOF_IN, NULL); 1164 gpio_request_one(209, GPIOF_IN, NULL);
1049 1165
1050 platform_device_register(&usbhsf_device); 1166 platform_device_register(&usbhsf_device);
1051 usb = &usbhsf_device; 1167 usb = &usbhsf_device;
1052 } 1168 }
1053 1169
1054 /* SDHI0 */
1055 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
1056 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
1057 gpio_request(GPIO_FN_SDHI0_D0, NULL);
1058 gpio_request(GPIO_FN_SDHI0_D1, NULL);
1059 gpio_request(GPIO_FN_SDHI0_D2, NULL);
1060 gpio_request(GPIO_FN_SDHI0_D3, NULL);
1061 gpio_request(GPIO_FN_SDHI0_WP, NULL);
1062
1063 gpio_request_one(GPIO_PORT17, GPIOF_OUT_INIT_LOW, NULL); /* SDHI0_18/33_B */
1064 gpio_request_one(GPIO_PORT74, GPIOF_OUT_INIT_HIGH, NULL); /* SDHI0_PON */
1065 gpio_request_one(GPIO_PORT75, GPIOF_OUT_INIT_HIGH, NULL); /* SDSLOT1_PON */
1066
1067 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
1068
1069 /*
1070 * MMCIF
1071 *
1072 * Here doesn't care SW1.4 status,
1073 * since CON2 is not mounted.
1074 */
1075 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
1076 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
1077 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
1078 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
1079 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
1080 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
1081 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
1082 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
1083 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
1084 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
1085
1086 /* CEU0 */ 1170 /* CEU0 */
1087 gpio_request(GPIO_FN_VIO0_D7, NULL); 1171 gpio_request(GPIO_FN_VIO0_D7, NULL);
1088 gpio_request(GPIO_FN_VIO0_D6, NULL); 1172 gpio_request(GPIO_FN_VIO0_D6, NULL);
@@ -1099,10 +1183,10 @@ static void __init eva_init(void)
1099 gpio_request(GPIO_FN_VIO_CKO, NULL); 1183 gpio_request(GPIO_FN_VIO_CKO, NULL);
1100 1184
1101 /* CON1/CON15 Camera */ 1185 /* CON1/CON15 Camera */
1102 gpio_request_one(GPIO_PORT173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */ 1186 gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */
1103 gpio_request_one(GPIO_PORT172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */ 1187 gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
1104 /* see mt9t111_power() */ 1188 /* see mt9t111_power() */
1105 gpio_request_one(GPIO_PORT158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */ 1189 gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */
1106 1190
1107 /* FSI-WM8978 */ 1191 /* FSI-WM8978 */
1108 gpio_request(GPIO_FN_FSIAIBT, NULL); 1192 gpio_request(GPIO_FN_FSIAIBT, NULL);
@@ -1111,8 +1195,8 @@ static void __init eva_init(void)
1111 gpio_request(GPIO_FN_FSIAOSLD, NULL); 1195 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1112 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL); 1196 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
1113 1197
1114 gpio_request(GPIO_PORT7, NULL); 1198 gpio_request(7, NULL);
1115 gpio_request(GPIO_PORT8, NULL); 1199 gpio_request(8, NULL);
1116 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */ 1200 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1117 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */ 1201 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
1118 1202
@@ -1129,29 +1213,21 @@ static void __init eva_init(void)
1129 * DBGMD/LCDC0/FSIA MUX 1213 * DBGMD/LCDC0/FSIA MUX
1130 * DBGMD_SELECT_B should be set after setting PFC Function. 1214 * DBGMD_SELECT_B should be set after setting PFC Function.
1131 */ 1215 */
1132 gpio_request_one(GPIO_PORT176, GPIOF_OUT_INIT_HIGH, NULL); 1216 gpio_request_one(176, GPIOF_OUT_INIT_HIGH, NULL);
1133 1217
1134 /* 1218 /*
1135 * We can switch CON8/CON14 by SW1.5, 1219 * We can switch CON8/CON14 by SW1.5,
1136 * but it needs after DBGMD_SELECT_B 1220 * but it needs after DBGMD_SELECT_B
1137 */ 1221 */
1138 gpio_request_one(GPIO_PORT6, GPIOF_IN, NULL); 1222 gpio_request_one(6, GPIOF_IN, NULL);
1139 if (gpio_get_value(GPIO_PORT6)) { 1223 if (gpio_get_value(6)) {
1140 /* CON14 enable */ 1224 /* CON14 enable */
1141 } else { 1225 } else {
1142 /* CON8 (SDHI1) enable */ 1226 /* CON8 (SDHI1) enable */
1143 gpio_request(GPIO_FN_SDHI1_CLK, NULL); 1227 pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
1144 gpio_request(GPIO_FN_SDHI1_CMD, NULL); 1228 ARRAY_SIZE(eva_sdhi1_pinctrl_map));
1145 gpio_request(GPIO_FN_SDHI1_D0, NULL);
1146 gpio_request(GPIO_FN_SDHI1_D1, NULL);
1147 gpio_request(GPIO_FN_SDHI1_D2, NULL);
1148 gpio_request(GPIO_FN_SDHI1_D3, NULL);
1149 gpio_request(GPIO_FN_SDHI1_CD, NULL);
1150 gpio_request(GPIO_FN_SDHI1_WP, NULL);
1151
1152 /* SDSLOT2_PON */
1153 gpio_request_one(GPIO_PORT16, GPIOF_OUT_INIT_HIGH, NULL);
1154 1229
1230 platform_device_register(&vcc_sdhi1);
1155 platform_device_register(&sdhi1_device); 1231 platform_device_register(&sdhi1_device);
1156 } 1232 }
1157 1233
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index e50f86691539..70d992c540ae 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/pinctrl/machine.h>
27#include <linux/platform_device.h> 28#include <linux/platform_device.h>
28#include <linux/gpio.h> 29#include <linux/gpio.h>
29#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
@@ -288,6 +289,16 @@ static struct platform_device lcdc0_device = {
288 }, 289 },
289}; 290};
290 291
292static const struct pinctrl_map lcdc0_pinctrl_map[] = {
293 /* LCD0 */
294 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
295 "lcd0_data24_1", "lcd0"),
296 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
297 "lcd0_lclk_1", "lcd0"),
298 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
299 "lcd0_sync", "lcd0"),
300};
301
291/* 302/*
292 * SMSC 9221 303 * SMSC 9221
293 */ 304 */
@@ -392,8 +403,8 @@ static void __init bonito_init(void)
392 /* 403 /*
393 * base board settings 404 * base board settings
394 */ 405 */
395 gpio_request_one(GPIO_PORT176, GPIOF_IN, NULL); 406 gpio_request_one(176, GPIOF_IN, NULL);
396 if (!gpio_get_value(GPIO_PORT176)) { 407 if (!gpio_get_value(176)) {
397 u16 bsw2; 408 u16 bsw2;
398 u16 bsw3; 409 u16 bsw3;
399 u16 bsw4; 410 u16 bsw4;
@@ -430,38 +441,11 @@ static void __init bonito_init(void)
430 */ 441 */
431 if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */ 442 if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */
432 BIT_ON(bsw2, 2)) { /* S38.2 = OFF */ 443 BIT_ON(bsw2, 2)) { /* S38.2 = OFF */
433 gpio_request(GPIO_FN_LCDC0_SELECT, NULL); 444 pinctrl_register_mappings(lcdc0_pinctrl_map,
434 gpio_request(GPIO_FN_LCD0_D0, NULL); 445 ARRAY_SIZE(lcdc0_pinctrl_map));
435 gpio_request(GPIO_FN_LCD0_D1, NULL); 446 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
436 gpio_request(GPIO_FN_LCD0_D2, NULL); 447
437 gpio_request(GPIO_FN_LCD0_D3, NULL); 448 gpio_request_one(61, GPIOF_OUT_INIT_HIGH,
438 gpio_request(GPIO_FN_LCD0_D4, NULL);
439 gpio_request(GPIO_FN_LCD0_D5, NULL);
440 gpio_request(GPIO_FN_LCD0_D6, NULL);
441 gpio_request(GPIO_FN_LCD0_D7, NULL);
442 gpio_request(GPIO_FN_LCD0_D8, NULL);
443 gpio_request(GPIO_FN_LCD0_D9, NULL);
444 gpio_request(GPIO_FN_LCD0_D10, NULL);
445 gpio_request(GPIO_FN_LCD0_D11, NULL);
446 gpio_request(GPIO_FN_LCD0_D12, NULL);
447 gpio_request(GPIO_FN_LCD0_D13, NULL);
448 gpio_request(GPIO_FN_LCD0_D14, NULL);
449 gpio_request(GPIO_FN_LCD0_D15, NULL);
450 gpio_request(GPIO_FN_LCD0_D16, NULL);
451 gpio_request(GPIO_FN_LCD0_D17, NULL);
452 gpio_request(GPIO_FN_LCD0_D18_PORT163, NULL);
453 gpio_request(GPIO_FN_LCD0_D19_PORT162, NULL);
454 gpio_request(GPIO_FN_LCD0_D20_PORT161, NULL);
455 gpio_request(GPIO_FN_LCD0_D21_PORT158, NULL);
456 gpio_request(GPIO_FN_LCD0_D22_PORT160, NULL);
457 gpio_request(GPIO_FN_LCD0_D23_PORT159, NULL);
458 gpio_request(GPIO_FN_LCD0_DCK, NULL);
459 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
460 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
461 gpio_request(GPIO_FN_LCD0_DISP, NULL);
462 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
463
464 gpio_request_one(GPIO_PORT61, GPIOF_OUT_INIT_HIGH,
465 NULL); /* LCDDON */ 449 NULL); /* LCDDON */
466 450
467 /* backlight on */ 451 /* backlight on */
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index 2ccc860403ef..ef5ca0ef0cb5 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -24,6 +24,8 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/pinctrl/machine.h>
28#include <linux/pinctrl/pinconf-generic.h>
27#include <linux/platform_device.h> 29#include <linux/platform_device.h>
28#include <linux/delay.h> 30#include <linux/delay.h>
29#include <linux/io.h> 31#include <linux/io.h>
@@ -135,17 +137,17 @@ static struct platform_device keysc_device = {
135#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } 137#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
136 138
137static struct gpio_keys_button gpio_buttons[] = { 139static struct gpio_keys_button gpio_buttons[] = {
138 GPIO_KEY(KEY_VOLUMEUP, GPIO_PORT56, "+"), /* S2: VOL+ [IRQ9] */ 140 GPIO_KEY(KEY_VOLUMEUP, 56, "+"), /* S2: VOL+ [IRQ9] */
139 GPIO_KEY(KEY_VOLUMEDOWN, GPIO_PORT54, "-"), /* S3: VOL- [IRQ10] */ 141 GPIO_KEY(KEY_VOLUMEDOWN, 54, "-"), /* S3: VOL- [IRQ10] */
140 GPIO_KEY(KEY_MENU, GPIO_PORT27, "Menu"), /* S4: MENU [IRQ30] */ 142 GPIO_KEY(KEY_MENU, 27, "Menu"), /* S4: MENU [IRQ30] */
141 GPIO_KEY(KEY_HOMEPAGE, GPIO_PORT26, "Home"), /* S5: HOME [IRQ31] */ 143 GPIO_KEY(KEY_HOMEPAGE, 26, "Home"), /* S5: HOME [IRQ31] */
142 GPIO_KEY(KEY_BACK, GPIO_PORT11, "Back"), /* S6: BACK [IRQ0] */ 144 GPIO_KEY(KEY_BACK, 11, "Back"), /* S6: BACK [IRQ0] */
143 GPIO_KEY(KEY_PHONE, GPIO_PORT238, "Tel"), /* S7: TEL [IRQ11] */ 145 GPIO_KEY(KEY_PHONE, 238, "Tel"), /* S7: TEL [IRQ11] */
144 GPIO_KEY(KEY_POWER, GPIO_PORT239, "C1"), /* S8: CAM [IRQ13] */ 146 GPIO_KEY(KEY_POWER, 239, "C1"), /* S8: CAM [IRQ13] */
145 GPIO_KEY(KEY_MAIL, GPIO_PORT224, "Mail"), /* S9: MAIL [IRQ3] */ 147 GPIO_KEY(KEY_MAIL, 224, "Mail"), /* S9: MAIL [IRQ3] */
146 /* Omitted button "C3?": GPIO_PORT223 - S10: CUST [IRQ8] */ 148 /* Omitted button "C3?": 223 - S10: CUST [IRQ8] */
147 GPIO_KEY(KEY_CAMERA, GPIO_PORT164, "C2"), /* S11: CAM_HALF [IRQ25] */ 149 GPIO_KEY(KEY_CAMERA, 164, "C2"), /* S11: CAM_HALF [IRQ25] */
148 /* Omitted button "?": GPIO_PORT152 - S12: CAM_FULL [No IRQ] */ 150 /* Omitted button "?": 152 - S12: CAM_FULL [No IRQ] */
149}; 151};
150 152
151static struct gpio_keys_platform_data gpio_key_info = { 153static struct gpio_keys_platform_data gpio_key_info = {
@@ -165,9 +167,9 @@ static struct platform_device gpio_keys_device = {
165#define GPIO_LED(n, g) { .name = n, .gpio = g } 167#define GPIO_LED(n, g) { .name = n, .gpio = g }
166 168
167static struct gpio_led gpio_leds[] = { 169static struct gpio_led gpio_leds[] = {
168 GPIO_LED("G", GPIO_PORT20), /* PORT20 [GPO0] -> LED7 -> "G" */ 170 GPIO_LED("G", 20), /* PORT20 [GPO0] -> LED7 -> "G" */
169 GPIO_LED("H", GPIO_PORT21), /* PORT21 [GPO1] -> LED8 -> "H" */ 171 GPIO_LED("H", 21), /* PORT21 [GPO1] -> LED8 -> "H" */
170 GPIO_LED("J", GPIO_PORT22), /* PORT22 [GPO2] -> LED9 -> "J" */ 172 GPIO_LED("J", 22), /* PORT22 [GPO2] -> LED9 -> "J" */
171}; 173};
172 174
173static struct gpio_led_platform_data gpio_leds_info = { 175static struct gpio_led_platform_data gpio_leds_info = {
@@ -187,7 +189,7 @@ static struct platform_device gpio_leds_device = {
187static struct led_renesas_tpu_config led_renesas_tpu12_pdata = { 189static struct led_renesas_tpu_config led_renesas_tpu12_pdata = {
188 .name = "V2513", 190 .name = "V2513",
189 .pin_gpio_fn = GPIO_FN_TPU1TO2, 191 .pin_gpio_fn = GPIO_FN_TPU1TO2,
190 .pin_gpio = GPIO_PORT153, 192 .pin_gpio = 153,
191 .channel_offset = 0x90, 193 .channel_offset = 0x90,
192 .timer_bit = 2, 194 .timer_bit = 2,
193 .max_brightness = 1000, 195 .max_brightness = 1000,
@@ -215,7 +217,7 @@ static struct platform_device leds_tpu12_device = {
215static struct led_renesas_tpu_config led_renesas_tpu41_pdata = { 217static struct led_renesas_tpu_config led_renesas_tpu41_pdata = {
216 .name = "V2514", 218 .name = "V2514",
217 .pin_gpio_fn = GPIO_FN_TPU4TO1, 219 .pin_gpio_fn = GPIO_FN_TPU4TO1,
218 .pin_gpio = GPIO_PORT199, 220 .pin_gpio = 199,
219 .channel_offset = 0x50, 221 .channel_offset = 0x50,
220 .timer_bit = 1, 222 .timer_bit = 1,
221 .max_brightness = 1000, 223 .max_brightness = 1000,
@@ -243,7 +245,7 @@ static struct platform_device leds_tpu41_device = {
243static struct led_renesas_tpu_config led_renesas_tpu21_pdata = { 245static struct led_renesas_tpu_config led_renesas_tpu21_pdata = {
244 .name = "V2515", 246 .name = "V2515",
245 .pin_gpio_fn = GPIO_FN_TPU2TO1, 247 .pin_gpio_fn = GPIO_FN_TPU2TO1,
246 .pin_gpio = GPIO_PORT197, 248 .pin_gpio = 197,
247 .channel_offset = 0x50, 249 .channel_offset = 0x50,
248 .timer_bit = 1, 250 .timer_bit = 1,
249 .max_brightness = 1000, 251 .max_brightness = 1000,
@@ -271,7 +273,7 @@ static struct platform_device leds_tpu21_device = {
271static struct led_renesas_tpu_config led_renesas_tpu30_pdata = { 273static struct led_renesas_tpu_config led_renesas_tpu30_pdata = {
272 .name = "KEYLED", 274 .name = "KEYLED",
273 .pin_gpio_fn = GPIO_FN_TPU3TO0, 275 .pin_gpio_fn = GPIO_FN_TPU3TO0,
274 .pin_gpio = GPIO_PORT163, 276 .pin_gpio = 163,
275 .channel_offset = 0x10, 277 .channel_offset = 0x10,
276 .timer_bit = 0, 278 .timer_bit = 0,
277 .max_brightness = 1000, 279 .max_brightness = 1000,
@@ -433,6 +435,85 @@ static struct platform_device *kota2_devices[] __initdata = {
433 &sdhi1_device, 435 &sdhi1_device,
434}; 436};
435 437
438static unsigned long pin_pullup_conf[] = {
439 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
440};
441
442static const struct pinctrl_map kota2_pinctrl_map[] = {
443 /* KEYSC */
444 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
445 "keysc_in8", "keysc"),
446 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
447 "keysc_out04", "keysc"),
448 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
449 "keysc_out5", "keysc"),
450 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
451 "keysc_out6_0", "keysc"),
452 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
453 "keysc_out7_0", "keysc"),
454 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
455 "keysc_out8_0", "keysc"),
456 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
457 "keysc_in8", pin_pullup_conf),
458 /* MMCIF */
459 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
460 "mmc0_data8_0", "mmc0"),
461 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
462 "mmc0_ctrl_0", "mmc0"),
463 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
464 "PORT279", pin_pullup_conf),
465 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
466 "mmc0_data8_0", pin_pullup_conf),
467 /* SCIFA2 (UART2) */
468 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
469 "scifa2_data_0", "scifa2"),
470 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
471 "scifa2_ctrl_0", "scifa2"),
472 /* SCIFA4 (UART1) */
473 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
474 "scifa4_data", "scifa4"),
475 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
476 "scifa4_ctrl", "scifa4"),
477 /* SCIFB (BT) */
478 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
479 "scifb_data_0", "scifb"),
480 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
481 "scifb_clk_0", "scifb"),
482 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
483 "scifb_ctrl_0", "scifb"),
484 /* SDHI0 (microSD) */
485 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
486 "sdhi0_data4", "sdhi0"),
487 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
488 "sdhi0_ctrl", "sdhi0"),
489 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
490 "sdhi0_cd", "sdhi0"),
491 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
492 "sdhi0_data4", pin_pullup_conf),
493 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
494 "PORT256", pin_pullup_conf),
495 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
496 "PORT251", pin_pullup_conf),
497 /* SDHI1 (BCM4330) */
498 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
499 "sdhi1_data4", "sdhi1"),
500 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
501 "sdhi1_ctrl", "sdhi1"),
502 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
503 "sdhi1_data4", pin_pullup_conf),
504 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
505 "PORT263", pin_pullup_conf),
506 /* SMSC911X */
507 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
508 "bsc_data_0_7", "bsc"),
509 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
510 "bsc_data_8_15", "bsc"),
511 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
512 "bsc_cs5_a", "bsc"),
513 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
514 "bsc_we0", "bsc"),
515};
516
436static void __init kota2_init(void) 517static void __init kota2_init(void)
437{ 518{
438 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, 519 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
@@ -441,97 +522,16 @@ static void __init kota2_init(void)
441 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 522 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
442 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 523 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
443 524
525 pinctrl_register_mappings(kota2_pinctrl_map,
526 ARRAY_SIZE(kota2_pinctrl_map));
444 sh73a0_pinmux_init(); 527 sh73a0_pinmux_init();
445 528
446 /* SCIFA2 (UART2) */
447 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
448 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
449 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
450 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
451
452 /* SCIFA4 (UART1) */
453 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
454 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
455 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
456 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
457
458 /* SMSC911X */ 529 /* SMSC911X */
459 gpio_request(GPIO_FN_D0_NAF0, NULL); 530 gpio_request_one(144, GPIOF_IN, NULL); /* PINTA2 */
460 gpio_request(GPIO_FN_D1_NAF1, NULL); 531 gpio_request_one(145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
461 gpio_request(GPIO_FN_D2_NAF2, NULL);
462 gpio_request(GPIO_FN_D3_NAF3, NULL);
463 gpio_request(GPIO_FN_D4_NAF4, NULL);
464 gpio_request(GPIO_FN_D5_NAF5, NULL);
465 gpio_request(GPIO_FN_D6_NAF6, NULL);
466 gpio_request(GPIO_FN_D7_NAF7, NULL);
467 gpio_request(GPIO_FN_D8_NAF8, NULL);
468 gpio_request(GPIO_FN_D9_NAF9, NULL);
469 gpio_request(GPIO_FN_D10_NAF10, NULL);
470 gpio_request(GPIO_FN_D11_NAF11, NULL);
471 gpio_request(GPIO_FN_D12_NAF12, NULL);
472 gpio_request(GPIO_FN_D13_NAF13, NULL);
473 gpio_request(GPIO_FN_D14_NAF14, NULL);
474 gpio_request(GPIO_FN_D15_NAF15, NULL);
475 gpio_request(GPIO_FN_CS5A_, NULL);
476 gpio_request(GPIO_FN_WE0__FWE, NULL);
477 gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */
478 gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
479
480 /* KEYSC */
481 gpio_request(GPIO_FN_KEYIN0_PU, NULL);
482 gpio_request(GPIO_FN_KEYIN1_PU, NULL);
483 gpio_request(GPIO_FN_KEYIN2_PU, NULL);
484 gpio_request(GPIO_FN_KEYIN3_PU, NULL);
485 gpio_request(GPIO_FN_KEYIN4_PU, NULL);
486 gpio_request(GPIO_FN_KEYIN5_PU, NULL);
487 gpio_request(GPIO_FN_KEYIN6_PU, NULL);
488 gpio_request(GPIO_FN_KEYIN7_PU, NULL);
489 gpio_request(GPIO_FN_KEYOUT0, NULL);
490 gpio_request(GPIO_FN_KEYOUT1, NULL);
491 gpio_request(GPIO_FN_KEYOUT2, NULL);
492 gpio_request(GPIO_FN_KEYOUT3, NULL);
493 gpio_request(GPIO_FN_KEYOUT4, NULL);
494 gpio_request(GPIO_FN_KEYOUT5, NULL);
495 gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
496 gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
497 gpio_request(GPIO_FN_KEYOUT8, NULL);
498 532
499 /* MMCIF */ 533 /* MMCIF */
500 gpio_request(GPIO_FN_MMCCLK0, NULL); 534 gpio_request_one(208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
501 gpio_request(GPIO_FN_MMCD0_0, NULL);
502 gpio_request(GPIO_FN_MMCD0_1, NULL);
503 gpio_request(GPIO_FN_MMCD0_2, NULL);
504 gpio_request(GPIO_FN_MMCD0_3, NULL);
505 gpio_request(GPIO_FN_MMCD0_4, NULL);
506 gpio_request(GPIO_FN_MMCD0_5, NULL);
507 gpio_request(GPIO_FN_MMCD0_6, NULL);
508 gpio_request(GPIO_FN_MMCD0_7, NULL);
509 gpio_request(GPIO_FN_MMCCMD0, NULL);
510 gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
511
512 /* SDHI0 (microSD) */
513 gpio_request(GPIO_FN_SDHICD0_PU, NULL);
514 gpio_request(GPIO_FN_SDHICMD0_PU, NULL);
515 gpio_request(GPIO_FN_SDHICLK0, NULL);
516 gpio_request(GPIO_FN_SDHID0_3_PU, NULL);
517 gpio_request(GPIO_FN_SDHID0_2_PU, NULL);
518 gpio_request(GPIO_FN_SDHID0_1_PU, NULL);
519 gpio_request(GPIO_FN_SDHID0_0_PU, NULL);
520
521 /* SCIFB (BT) */
522 gpio_request(GPIO_FN_PORT159_SCIFB_SCK, NULL);
523 gpio_request(GPIO_FN_PORT160_SCIFB_TXD, NULL);
524 gpio_request(GPIO_FN_PORT161_SCIFB_CTS_, NULL);
525 gpio_request(GPIO_FN_PORT162_SCIFB_RXD, NULL);
526 gpio_request(GPIO_FN_PORT163_SCIFB_RTS_, NULL);
527
528 /* SDHI1 (BCM4330) */
529 gpio_request(GPIO_FN_SDHICLK1, NULL);
530 gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
531 gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
532 gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
533 gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
534 gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
535 535
536#ifdef CONFIG_CACHE_L2X0 536#ifdef CONFIG_CACHE_L2X0
537 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 537 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
new file mode 100644
index 000000000000..aefa50d385b7
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -0,0 +1,107 @@
1/*
2 * KZM-A9-GT board support - Reference Device Tree Implementation
3 *
4 * Copyright (C) 2012 Horms Solutions Ltd.
5 *
6 * Based on board-kzm9g.c
7 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <linux/delay.h>
24#include <linux/gpio.h>
25#include <linux/io.h>
26#include <linux/irq.h>
27#include <linux/irqchip.h>
28#include <linux/input.h>
29#include <linux/of_platform.h>
30#include <linux/pinctrl/machine.h>
31#include <linux/pinctrl/pinconf-generic.h>
32#include <mach/sh73a0.h>
33#include <mach/common.h>
34#include <asm/hardware/cache-l2x0.h>
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37
38static unsigned long pin_pullup_conf[] = {
39 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
40};
41
42static const struct pinctrl_map kzm_pinctrl_map[] = {
43 PIN_MAP_MUX_GROUP_DEFAULT("e6826000.i2c", "pfc-sh73a0",
44 "i2c3_1", "i2c3"),
45 /* MMCIF */
46 PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
47 "mmc0_data8_0", "mmc0"),
48 PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
49 "mmc0_ctrl_0", "mmc0"),
50 PIN_MAP_CONFIGS_PIN_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
51 "PORT279", pin_pullup_conf),
52 PIN_MAP_CONFIGS_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
53 "mmc0_data8_0", pin_pullup_conf),
54 /* SCIFA4 */
55 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
56 "scifa4_data", "scifa4"),
57 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
58 "scifa4_ctrl", "scifa4"),
59 /* SDHI0 */
60 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
61 "sdhi0_data4", "sdhi0"),
62 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
63 "sdhi0_ctrl", "sdhi0"),
64 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
65 "sdhi0_cd", "sdhi0"),
66 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
67 "sdhi0_wp", "sdhi0"),
68 /* SDHI2 */
69 PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0",
70 "sdhi2_data4", "sdhi2"),
71 PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0",
72 "sdhi2_ctrl", "sdhi2"),
73};
74
75static void __init kzm_init(void)
76{
77 sh73a0_add_standard_devices_dt();
78 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
79 sh73a0_pinmux_init();
80
81 /* enable SD */
82 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
83 gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */
84
85 gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */
86
87#ifdef CONFIG_CACHE_L2X0
88 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
89 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
90#endif
91}
92
93static const char *kzm9g_boards_compat_dt[] __initdata = {
94 "renesas,kzm9g-reference",
95 NULL,
96};
97
98DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
99 .smp = smp_ops(sh73a0_smp_ops),
100 .map_io = sh73a0_map_io,
101 .init_early = sh73a0_init_delay,
102 .nr_irqs = NR_IRQS_LEGACY,
103 .init_irq = irqchip_init,
104 .init_machine = kzm_init,
105 .init_time = shmobile_timer_init,
106 .dt_compat = kzm9g_boards_compat_dt,
107MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 7f3a6b7e7b7c..77a66ac12417 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -30,6 +30,8 @@
30#include <linux/mmc/sh_mmcif.h> 30#include <linux/mmc/sh_mmcif.h>
31#include <linux/mmc/sh_mobile_sdhi.h> 31#include <linux/mmc/sh_mobile_sdhi.h>
32#include <linux/mfd/tmio.h> 32#include <linux/mfd/tmio.h>
33#include <linux/pinctrl/machine.h>
34#include <linux/pinctrl/pinconf-generic.h>
33#include <linux/platform_device.h> 35#include <linux/platform_device.h>
34#include <linux/regulator/fixed.h> 36#include <linux/regulator/fixed.h>
35#include <linux/regulator/machine.h> 37#include <linux/regulator/machine.h>
@@ -61,8 +63,8 @@
61 63
62/* Dummy supplies, where voltage doesn't matter */ 64/* Dummy supplies, where voltage doesn't matter */
63static struct regulator_consumer_supply dummy_supplies[] = { 65static struct regulator_consumer_supply dummy_supplies[] = {
64 REGULATOR_SUPPLY("vddvario", "smsc911x"), 66 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
65 REGULATOR_SUPPLY("vdd33a", "smsc911x"), 67 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
66}; 68};
67 69
68/* 70/*
@@ -373,13 +375,64 @@ static struct platform_device mmc_device = {
373 .resource = sh_mmcif_resources, 375 .resource = sh_mmcif_resources,
374}; 376};
375 377
376/* Fixed 2.8V regulators to be used by SDHI0 and SDHI2 */ 378/* Fixed 3.3V regulators to be used by SDHI0 */
377static struct regulator_consumer_supply fixed2v8_power_consumers[] = 379static struct regulator_consumer_supply vcc_sdhi0_consumers[] =
378{ 380{
379 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 381 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
380 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), 382};
383
384static struct regulator_init_data vcc_sdhi0_init_data = {
385 .constraints = {
386 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
387 },
388 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
389 .consumer_supplies = vcc_sdhi0_consumers,
390};
391
392static struct fixed_voltage_config vcc_sdhi0_info = {
393 .supply_name = "SDHI0 Vcc",
394 .microvolts = 3300000,
395 .gpio = 15,
396 .enable_high = 1,
397 .init_data = &vcc_sdhi0_init_data,
398};
399
400static struct platform_device vcc_sdhi0 = {
401 .name = "reg-fixed-voltage",
402 .id = 0,
403 .dev = {
404 .platform_data = &vcc_sdhi0_info,
405 },
406};
407
408/* Fixed 3.3V regulators to be used by SDHI2 */
409static struct regulator_consumer_supply vcc_sdhi2_consumers[] =
410{
381 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"), 411 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
382 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"), 412};
413
414static struct regulator_init_data vcc_sdhi2_init_data = {
415 .constraints = {
416 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
417 },
418 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers),
419 .consumer_supplies = vcc_sdhi2_consumers,
420};
421
422static struct fixed_voltage_config vcc_sdhi2_info = {
423 .supply_name = "SDHI2 Vcc",
424 .microvolts = 3300000,
425 .gpio = 14,
426 .enable_high = 1,
427 .init_data = &vcc_sdhi2_init_data,
428};
429
430static struct platform_device vcc_sdhi2 = {
431 .name = "reg-fixed-voltage",
432 .id = 1,
433 .dev = {
434 .platform_data = &vcc_sdhi2_info,
435 },
383}; 436};
384 437
385/* SDHI */ 438/* SDHI */
@@ -387,8 +440,8 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
387 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 440 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
388 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 441 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
389 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 442 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
390 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 443 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
391 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 444 MMC_CAP_POWER_OFF_CARD,
392}; 445};
393 446
394static struct resource sdhi0_resources[] = { 447static struct resource sdhi0_resources[] = {
@@ -431,9 +484,8 @@ static struct sh_mobile_sdhi_info sdhi2_info = {
431 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | 484 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
432 TMIO_MMC_USE_GPIO_CD | 485 TMIO_MMC_USE_GPIO_CD |
433 TMIO_MMC_WRPROTECT_DISABLE, 486 TMIO_MMC_WRPROTECT_DISABLE,
434 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 487 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD,
435 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 488 .cd_gpio = 13,
436 .cd_gpio = GPIO_PORT13,
437}; 489};
438 490
439static struct resource sdhi2_resources[] = { 491static struct resource sdhi2_resources[] = {
@@ -592,6 +644,8 @@ static struct platform_device *kzm_devices[] __initdata = {
592 &usbhs_device, 644 &usbhs_device,
593 &lcdc_device, 645 &lcdc_device,
594 &mmc_device, 646 &mmc_device,
647 &vcc_sdhi0,
648 &vcc_sdhi2,
595 &sdhi0_device, 649 &sdhi0_device,
596 &sdhi2_device, 650 &sdhi2_device,
597 &gpio_keys_device, 651 &gpio_keys_device,
@@ -599,6 +653,64 @@ static struct platform_device *kzm_devices[] __initdata = {
599 &fsi_ak4648_device, 653 &fsi_ak4648_device,
600}; 654};
601 655
656static unsigned long pin_pullup_conf[] = {
657 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
658};
659
660static const struct pinctrl_map kzm_pinctrl_map[] = {
661 /* FSIA (AK4648) */
662 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
663 "fsia_mclk_in", "fsia"),
664 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
665 "fsia_sclk_in", "fsia"),
666 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
667 "fsia_data_in", "fsia"),
668 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
669 "fsia_data_out", "fsia"),
670 /* I2C3 */
671 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
672 "i2c3_1", "i2c3"),
673 /* LCD */
674 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
675 "lcd_data24", "lcd"),
676 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
677 "lcd_sync", "lcd"),
678 /* MMCIF */
679 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
680 "mmc0_data8_0", "mmc0"),
681 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
682 "mmc0_ctrl_0", "mmc0"),
683 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
684 "PORT279", pin_pullup_conf),
685 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
686 "mmc0_data8_0", pin_pullup_conf),
687 /* SCIFA4 */
688 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
689 "scifa4_data", "scifa4"),
690 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
691 "scifa4_ctrl", "scifa4"),
692 /* SDHI0 */
693 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
694 "sdhi0_data4", "sdhi0"),
695 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
696 "sdhi0_ctrl", "sdhi0"),
697 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
698 "sdhi0_cd", "sdhi0"),
699 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
700 "sdhi0_wp", "sdhi0"),
701 /* SDHI2 */
702 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
703 "sdhi2_data4", "sdhi2"),
704 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
705 "sdhi2_ctrl", "sdhi2"),
706 /* SMSC */
707 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
708 "bsc_cs4", "bsc"),
709 /* USB */
710 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0",
711 "usb_vbus", "usb"),
712};
713
602/* 714/*
603 * FIXME 715 * FIXME
604 * 716 *
@@ -654,106 +766,26 @@ device_initcall(as3711_enable_lcdc_backlight);
654 766
655static void __init kzm_init(void) 767static void __init kzm_init(void)
656{ 768{
657 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, 769 regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
658 ARRAY_SIZE(fixed1v8_power_consumers), 1800000); 770 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
659 regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers, 771 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
660 ARRAY_SIZE(fixed2v8_power_consumers), 2800000);
661 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
662 772
663 sh73a0_pinmux_init(); 773 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
664
665 /* enable SCIFA4 */
666 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
667 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
668 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
669 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
670 774
671 /* CS4 for SMSC/USB */ 775 sh73a0_pinmux_init();
672 gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
673 776
674 /* SMSC */ 777 /* SMSC */
675 gpio_request_one(GPIO_PORT224, GPIOF_IN, NULL); /* IRQ3 */ 778 gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */
676 779
677 /* LCDC */ 780 /* LCDC */
678 gpio_request(GPIO_FN_LCDD23, NULL); 781 gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
679 gpio_request(GPIO_FN_LCDD22, NULL); 782 gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
680 gpio_request(GPIO_FN_LCDD21, NULL);
681 gpio_request(GPIO_FN_LCDD20, NULL);
682 gpio_request(GPIO_FN_LCDD19, NULL);
683 gpio_request(GPIO_FN_LCDD18, NULL);
684 gpio_request(GPIO_FN_LCDD17, NULL);
685 gpio_request(GPIO_FN_LCDD16, NULL);
686 gpio_request(GPIO_FN_LCDD15, NULL);
687 gpio_request(GPIO_FN_LCDD14, NULL);
688 gpio_request(GPIO_FN_LCDD13, NULL);
689 gpio_request(GPIO_FN_LCDD12, NULL);
690 gpio_request(GPIO_FN_LCDD11, NULL);
691 gpio_request(GPIO_FN_LCDD10, NULL);
692 gpio_request(GPIO_FN_LCDD9, NULL);
693 gpio_request(GPIO_FN_LCDD8, NULL);
694 gpio_request(GPIO_FN_LCDD7, NULL);
695 gpio_request(GPIO_FN_LCDD6, NULL);
696 gpio_request(GPIO_FN_LCDD5, NULL);
697 gpio_request(GPIO_FN_LCDD4, NULL);
698 gpio_request(GPIO_FN_LCDD3, NULL);
699 gpio_request(GPIO_FN_LCDD2, NULL);
700 gpio_request(GPIO_FN_LCDD1, NULL);
701 gpio_request(GPIO_FN_LCDD0, NULL);
702 gpio_request(GPIO_FN_LCDDISP, NULL);
703 gpio_request(GPIO_FN_LCDDCK, NULL);
704
705 gpio_request_one(GPIO_PORT222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
706 gpio_request_one(GPIO_PORT226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
707 783
708 /* Touchscreen */ 784 /* Touchscreen */
709 gpio_request_one(GPIO_PORT223, GPIOF_IN, NULL); /* IRQ8 */ 785 gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */
710
711 /* enable MMCIF */
712 gpio_request(GPIO_FN_MMCCLK0, NULL);
713 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
714 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
715 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
716 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
717 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
718 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
719 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
720 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
721 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
722 786
723 /* enable SD */ 787 /* enable SD */
724 gpio_request(GPIO_FN_SDHIWP0, NULL);
725 gpio_request(GPIO_FN_SDHICD0, NULL);
726 gpio_request(GPIO_FN_SDHICMD0, NULL);
727 gpio_request(GPIO_FN_SDHICLK0, NULL);
728 gpio_request(GPIO_FN_SDHID0_3, NULL);
729 gpio_request(GPIO_FN_SDHID0_2, NULL);
730 gpio_request(GPIO_FN_SDHID0_1, NULL);
731 gpio_request(GPIO_FN_SDHID0_0, NULL);
732 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL); 788 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
733 gpio_request_one(GPIO_PORT15, GPIOF_OUT_INIT_HIGH, NULL); /* power */
734
735 /* enable Micro SD */
736 gpio_request(GPIO_FN_SDHID2_0, NULL);
737 gpio_request(GPIO_FN_SDHID2_1, NULL);
738 gpio_request(GPIO_FN_SDHID2_2, NULL);
739 gpio_request(GPIO_FN_SDHID2_3, NULL);
740 gpio_request(GPIO_FN_SDHICMD2, NULL);
741 gpio_request(GPIO_FN_SDHICLK2, NULL);
742 gpio_request_one(GPIO_PORT14, GPIOF_OUT_INIT_HIGH, NULL); /* power */
743
744 /* I2C 3 */
745 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
746 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
747
748 /* enable FSI2 port A (ak4648) */
749 gpio_request(GPIO_FN_FSIACK, NULL);
750 gpio_request(GPIO_FN_FSIAILR, NULL);
751 gpio_request(GPIO_FN_FSIAIBT, NULL);
752 gpio_request(GPIO_FN_FSIAISLD, NULL);
753 gpio_request(GPIO_FN_FSIAOSLD, NULL);
754
755 /* enable USB */
756 gpio_request(GPIO_FN_VBUS_0, NULL);
757 789
758#ifdef CONFIG_CACHE_L2X0 790#ifdef CONFIG_CACHE_L2X0
759 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 791 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index db968a585ff0..1a9c75383ca0 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -40,6 +40,7 @@
40#include <linux/mtd/partitions.h> 40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/mtd/sh_flctl.h> 42#include <linux/mtd/sh_flctl.h>
43#include <linux/pinctrl/machine.h>
43#include <linux/pm_clock.h> 44#include <linux/pm_clock.h>
44#include <linux/regulator/fixed.h> 45#include <linux/regulator/fixed.h>
45#include <linux/regulator/machine.h> 46#include <linux/regulator/machine.h>
@@ -363,7 +364,7 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
363 364
364static int mackerel_set_brightness(int brightness) 365static int mackerel_set_brightness(int brightness)
365{ 366{
366 gpio_set_value(GPIO_PORT31, brightness); 367 gpio_set_value(31, brightness);
367 368
368 return 0; 369 return 0;
369} 370}
@@ -819,22 +820,22 @@ static struct platform_device usbhs1_device = {
819static struct gpio_led mackerel_leds[] = { 820static struct gpio_led mackerel_leds[] = {
820 { 821 {
821 .name = "led0", 822 .name = "led0",
822 .gpio = GPIO_PORT0, 823 .gpio = 0,
823 .default_state = LEDS_GPIO_DEFSTATE_ON, 824 .default_state = LEDS_GPIO_DEFSTATE_ON,
824 }, 825 },
825 { 826 {
826 .name = "led1", 827 .name = "led1",
827 .gpio = GPIO_PORT1, 828 .gpio = 1,
828 .default_state = LEDS_GPIO_DEFSTATE_ON, 829 .default_state = LEDS_GPIO_DEFSTATE_ON,
829 }, 830 },
830 { 831 {
831 .name = "led2", 832 .name = "led2",
832 .gpio = GPIO_PORT2, 833 .gpio = 2,
833 .default_state = LEDS_GPIO_DEFSTATE_ON, 834 .default_state = LEDS_GPIO_DEFSTATE_ON,
834 }, 835 },
835 { 836 {
836 .name = "led3", 837 .name = "led3",
837 .gpio = GPIO_PORT159, 838 .gpio = 159,
838 .default_state = LEDS_GPIO_DEFSTATE_ON, 839 .default_state = LEDS_GPIO_DEFSTATE_ON,
839 } 840 }
840}; 841};
@@ -964,11 +965,11 @@ static struct platform_device nand_flash_device = {
964 965
965/* 966/*
966 * The card detect pin of the top SD/MMC slot (CN7) is active low and is 967 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
967 * connected to GPIO A22 of SH7372 (GPIO_PORT41). 968 * connected to GPIO A22 of SH7372 (GPIO 41).
968 */ 969 */
969static int slot_cn7_get_cd(struct platform_device *pdev) 970static int slot_cn7_get_cd(struct platform_device *pdev)
970{ 971{
971 return !gpio_get_value(GPIO_PORT41); 972 return !gpio_get_value(41);
972} 973}
973 974
974/* SDHI0 */ 975/* SDHI0 */
@@ -977,7 +978,7 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
977 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 978 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
978 .tmio_flags = TMIO_MMC_USE_GPIO_CD, 979 .tmio_flags = TMIO_MMC_USE_GPIO_CD,
979 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 980 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
980 .cd_gpio = GPIO_PORT172, 981 .cd_gpio = 172,
981}; 982};
982 983
983static struct resource sdhi0_resources[] = { 984static struct resource sdhi0_resources[] = {
@@ -1060,11 +1061,11 @@ static struct platform_device sdhi1_device = {
1060 1061
1061/* 1062/*
1062 * The card detect pin of the top SD/MMC slot (CN23) is active low and is 1063 * The card detect pin of the top SD/MMC slot (CN23) is active low and is
1063 * connected to GPIO SCIFB_SCK of SH7372 (GPIO_PORT162). 1064 * connected to GPIO SCIFB_SCK of SH7372 (162).
1064 */ 1065 */
1065static int slot_cn23_get_cd(struct platform_device *pdev) 1066static int slot_cn23_get_cd(struct platform_device *pdev)
1066{ 1067{
1067 return !gpio_get_value(GPIO_PORT162); 1068 return !gpio_get_value(162);
1068} 1069}
1069 1070
1070/* SDHI2 */ 1071/* SDHI2 */
@@ -1142,7 +1143,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
1142 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, 1143 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
1143}; 1144};
1144 1145
1145static struct platform_device sh_mmcif_device = { 1146static struct platform_device sh_mmcif_device __maybe_unused = {
1146 .name = "sh_mmcif", 1147 .name = "sh_mmcif",
1147 .id = 0, 1148 .id = 0,
1148 .dev = { 1149 .dev = {
@@ -1328,6 +1329,33 @@ static struct i2c_board_info i2c1_devices[] = {
1328 }, 1329 },
1329}; 1330};
1330 1331
1332static const struct pinctrl_map mackerel_pinctrl_map[] = {
1333 /* MMCIF */
1334 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1335 "mmc0_data8_0", "mmc0"),
1336 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1337 "mmc0_ctrl_0", "mmc0"),
1338 /* SDHI0 */
1339 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1340 "sdhi0_data4", "sdhi0"),
1341 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1342 "sdhi0_ctrl", "sdhi0"),
1343 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1344 "sdhi0_wp", "sdhi0"),
1345 /* SDHI1 */
1346#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1347 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1348 "sdhi1_data4", "sdhi1"),
1349 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1350 "sdhi1_ctrl", "sdhi1"),
1351#endif
1352 /* SDHI2 */
1353 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh7372",
1354 "sdhi2_data4", "sdhi2"),
1355 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh7372",
1356 "sdhi2_ctrl", "sdhi2"),
1357};
1358
1331#define GPIO_PORT9CR IOMEM(0xE6051009) 1359#define GPIO_PORT9CR IOMEM(0xE6051009)
1332#define GPIO_PORT10CR IOMEM(0xE605100A) 1360#define GPIO_PORT10CR IOMEM(0xE605100A)
1333#define GPIO_PORT167CR IOMEM(0xE60520A7) 1361#define GPIO_PORT167CR IOMEM(0xE60520A7)
@@ -1364,6 +1392,8 @@ static void __init mackerel_init(void)
1364 /* External clock source */ 1392 /* External clock source */
1365 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1393 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1366 1394
1395 pinctrl_register_mappings(mackerel_pinctrl_map,
1396 ARRAY_SIZE(mackerel_pinctrl_map));
1367 sh7372_pinmux_init(); 1397 sh7372_pinmux_init();
1368 1398
1369 /* enable SCIFA0 */ 1399 /* enable SCIFA0 */
@@ -1403,9 +1433,9 @@ static void __init mackerel_init(void)
1403 gpio_request(GPIO_FN_LCDDCK, NULL); 1433 gpio_request(GPIO_FN_LCDDCK, NULL);
1404 1434
1405 /* backlight, off by default */ 1435 /* backlight, off by default */
1406 gpio_request_one(GPIO_PORT31, GPIOF_OUT_INIT_LOW, NULL); 1436 gpio_request_one(31, GPIOF_OUT_INIT_LOW, NULL);
1407 1437
1408 gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1438 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1409 1439
1410 /* USBHS0 */ 1440 /* USBHS0 */
1411 gpio_request(GPIO_FN_VBUS0_0, NULL); 1441 gpio_request(GPIO_FN_VBUS0_0, NULL);
@@ -1421,10 +1451,10 @@ static void __init mackerel_init(void)
1421 gpio_request(GPIO_FN_FSIAILR, NULL); 1451 gpio_request(GPIO_FN_FSIAILR, NULL);
1422 gpio_request(GPIO_FN_FSIAISLD, NULL); 1452 gpio_request(GPIO_FN_FSIAISLD, NULL);
1423 gpio_request(GPIO_FN_FSIAOSLD, NULL); 1453 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1424 gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ 1454 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1425 1455
1426 gpio_request(GPIO_PORT9, NULL); 1456 gpio_request(9, NULL);
1427 gpio_request(GPIO_PORT10, NULL); 1457 gpio_request(10, NULL);
1428 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1458 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1429 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1459 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1430 1460
@@ -1453,52 +1483,14 @@ static void __init mackerel_init(void)
1453 gpio_request(GPIO_FN_IRQ21, NULL); 1483 gpio_request(GPIO_FN_IRQ21, NULL);
1454 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); 1484 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
1455 1485
1456 /* enable SDHI0 */
1457 gpio_request(GPIO_FN_SDHIWP0, NULL);
1458 gpio_request(GPIO_FN_SDHICMD0, NULL);
1459 gpio_request(GPIO_FN_SDHICLK0, NULL);
1460 gpio_request(GPIO_FN_SDHID0_3, NULL);
1461 gpio_request(GPIO_FN_SDHID0_2, NULL);
1462 gpio_request(GPIO_FN_SDHID0_1, NULL);
1463 gpio_request(GPIO_FN_SDHID0_0, NULL);
1464
1465 /* SDHI0 PORT172 card-detect IRQ26 */ 1486 /* SDHI0 PORT172 card-detect IRQ26 */
1466 gpio_request(GPIO_FN_IRQ26_172, NULL); 1487 gpio_request(GPIO_FN_IRQ26_172, NULL);
1467 1488
1468#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1469 /* enable SDHI1 */
1470 gpio_request(GPIO_FN_SDHICMD1, NULL);
1471 gpio_request(GPIO_FN_SDHICLK1, NULL);
1472 gpio_request(GPIO_FN_SDHID1_3, NULL);
1473 gpio_request(GPIO_FN_SDHID1_2, NULL);
1474 gpio_request(GPIO_FN_SDHID1_1, NULL);
1475 gpio_request(GPIO_FN_SDHID1_0, NULL);
1476#endif
1477 /* card detect pin for MMC slot (CN7) */ 1489 /* card detect pin for MMC slot (CN7) */
1478 gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL); 1490 gpio_request_one(41, GPIOF_IN, NULL);
1479
1480 /* enable SDHI2 */
1481 gpio_request(GPIO_FN_SDHICMD2, NULL);
1482 gpio_request(GPIO_FN_SDHICLK2, NULL);
1483 gpio_request(GPIO_FN_SDHID2_3, NULL);
1484 gpio_request(GPIO_FN_SDHID2_2, NULL);
1485 gpio_request(GPIO_FN_SDHID2_1, NULL);
1486 gpio_request(GPIO_FN_SDHID2_0, NULL);
1487 1491
1488 /* card detect pin for microSD slot (CN23) */ 1492 /* card detect pin for microSD slot (CN23) */
1489 gpio_request_one(GPIO_PORT162, GPIOF_IN, NULL); 1493 gpio_request_one(162, GPIOF_IN, NULL);
1490
1491 /* MMCIF */
1492 gpio_request(GPIO_FN_MMCD0_0, NULL);
1493 gpio_request(GPIO_FN_MMCD0_1, NULL);
1494 gpio_request(GPIO_FN_MMCD0_2, NULL);
1495 gpio_request(GPIO_FN_MMCD0_3, NULL);
1496 gpio_request(GPIO_FN_MMCD0_4, NULL);
1497 gpio_request(GPIO_FN_MMCD0_5, NULL);
1498 gpio_request(GPIO_FN_MMCD0_6, NULL);
1499 gpio_request(GPIO_FN_MMCD0_7, NULL);
1500 gpio_request(GPIO_FN_MMCCMD0, NULL);
1501 gpio_request(GPIO_FN_MMCCLK0, NULL);
1502 1494
1503 /* FLCTL */ 1495 /* FLCTL */
1504 gpio_request(GPIO_FN_D0_NAF0, NULL); 1496 gpio_request(GPIO_FN_D0_NAF0, NULL);
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
new file mode 100644
index 000000000000..480d882e42c7
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -0,0 +1,75 @@
1/*
2 * marzen board support - Reference DT implementation
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Simon Horman
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <linux/pinctrl/machine.h>
23#include <mach/r8a7779.h>
24#include <mach/common.h>
25#include <mach/irqs.h>
26#include <asm/irq.h>
27#include <asm/mach/arch.h>
28
29static const struct pinctrl_map marzen_pinctrl_map[] = {
30 /* SCIF2 (CN18: DEBUG0) */
31 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
32 "scif2_data_c", "scif2"),
33 /* SCIF4 (CN19: DEBUG1) */
34 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
35 "scif4_data", "scif4"),
36 /* SDHI0 */
37 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
38 "sdhi0_data4", "sdhi0"),
39 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
40 "sdhi0_ctrl", "sdhi0"),
41 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
42 "sdhi0_cd", "sdhi0"),
43 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
44 "sdhi0_wp", "sdhi0"),
45 /* SMSC */
46 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
47 "intc_irq1_b", "intc"),
48 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
49 "lbsc_ex_cs0", "lbsc"),
50};
51
52static void __init marzen_init(void)
53{
54 pinctrl_register_mappings(marzen_pinctrl_map,
55 ARRAY_SIZE(marzen_pinctrl_map));
56 r8a7779_pinmux_init();
57
58 r8a7779_add_standard_devices_dt();
59}
60
61static const char *marzen_boards_compat_dt[] __initdata = {
62 "renesas,marzen-reference",
63 NULL,
64};
65
66DT_MACHINE_START(MARZEN, "marzen")
67 .smp = smp_ops(r8a7779_smp_ops),
68 .map_io = r8a7779_map_io,
69 .init_early = r8a7779_init_delay,
70 .nr_irqs = NR_IRQS_LEGACY,
71 .init_irq = r8a7779_init_irq_dt,
72 .init_machine = marzen_init,
73 .init_time = shmobile_timer_init,
74 .dt_compat = marzen_boards_compat_dt,
75MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index fec49ebc359a..2333a2d7c937 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -25,8 +25,8 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/gpio.h>
29#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/pinctrl/machine.h>
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
@@ -67,7 +67,7 @@ static struct resource smsc911x_resources[] = {
67 .flags = IORESOURCE_MEM, 67 .flags = IORESOURCE_MEM,
68 }, 68 },
69 [1] = { 69 [1] = {
70 .start = gic_spi(28), /* IRQ 1 */ 70 .start = gic_iid(0x3c), /* IRQ 1 */
71 .flags = IORESOURCE_IRQ, 71 .flags = IORESOURCE_IRQ,
72 }, 72 },
73}; 73};
@@ -97,7 +97,7 @@ static struct resource sdhi0_resources[] = {
97 .flags = IORESOURCE_MEM, 97 .flags = IORESOURCE_MEM,
98 }, 98 },
99 [1] = { 99 [1] = {
100 .start = gic_spi(104), 100 .start = gic_iid(0x88),
101 .flags = IORESOURCE_IRQ, 101 .flags = IORESOURCE_IRQ,
102 }, 102 },
103}; 103};
@@ -215,7 +215,7 @@ static struct resource ehci0_resources[] = {
215 .flags = IORESOURCE_MEM, 215 .flags = IORESOURCE_MEM,
216 }, 216 },
217 [1] = { 217 [1] = {
218 .start = gic_spi(44), 218 .start = gic_iid(0x4c),
219 .flags = IORESOURCE_IRQ, 219 .flags = IORESOURCE_IRQ,
220 }, 220 },
221}; 221};
@@ -239,7 +239,7 @@ static struct resource ehci1_resources[] = {
239 .flags = IORESOURCE_MEM, 239 .flags = IORESOURCE_MEM,
240 }, 240 },
241 [1] = { 241 [1] = {
242 .start = gic_spi(45), 242 .start = gic_iid(0x4d),
243 .flags = IORESOURCE_IRQ, 243 .flags = IORESOURCE_IRQ,
244 }, 244 },
245}; 245};
@@ -269,7 +269,7 @@ static struct resource ohci0_resources[] = {
269 .flags = IORESOURCE_MEM, 269 .flags = IORESOURCE_MEM,
270 }, 270 },
271 [1] = { 271 [1] = {
272 .start = gic_spi(44), 272 .start = gic_iid(0x4c),
273 .flags = IORESOURCE_IRQ, 273 .flags = IORESOURCE_IRQ,
274 }, 274 },
275}; 275};
@@ -293,7 +293,7 @@ static struct resource ohci1_resources[] = {
293 .flags = IORESOURCE_MEM, 293 .flags = IORESOURCE_MEM,
294 }, 294 },
295 [1] = { 295 [1] = {
296 .start = gic_spi(45), 296 .start = gic_iid(0x4d),
297 .flags = IORESOURCE_IRQ, 297 .flags = IORESOURCE_IRQ,
298 }, 298 },
299}; 299};
@@ -327,6 +327,41 @@ void __init marzen_init_late(void)
327 ARRAY_SIZE(marzen_late_devices)); 327 ARRAY_SIZE(marzen_late_devices));
328} 328}
329 329
330static const struct pinctrl_map marzen_pinctrl_map[] = {
331 /* HSPI0 */
332 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
333 "hspi0", "hspi0"),
334 /* SCIF2 (CN18: DEBUG0) */
335 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
336 "scif2_data_c", "scif2"),
337 /* SCIF4 (CN19: DEBUG1) */
338 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
339 "scif4_data", "scif4"),
340 /* SDHI0 */
341 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
342 "sdhi0_data4", "sdhi0"),
343 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
344 "sdhi0_ctrl", "sdhi0"),
345 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
346 "sdhi0_cd", "sdhi0"),
347 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
348 "sdhi0_wp", "sdhi0"),
349 /* SMSC */
350 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
351 "intc_irq1_b", "intc"),
352 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
353 "lbsc_ex_cs0", "lbsc"),
354 /* USB0 */
355 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
356 "usb0", "usb0"),
357 /* USB1 */
358 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
359 "usb1", "usb1"),
360 /* USB2 */
361 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.1", "pfc-r8a7779",
362 "usb2", "usb2"),
363};
364
330static void __init marzen_init(void) 365static void __init marzen_init(void)
331{ 366{
332 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 367 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
@@ -334,44 +369,10 @@ static void __init marzen_init(void)
334 regulator_register_fixed(1, dummy_supplies, 369 regulator_register_fixed(1, dummy_supplies,
335 ARRAY_SIZE(dummy_supplies)); 370 ARRAY_SIZE(dummy_supplies));
336 371
372 pinctrl_register_mappings(marzen_pinctrl_map,
373 ARRAY_SIZE(marzen_pinctrl_map));
337 r8a7779_pinmux_init(); 374 r8a7779_pinmux_init();
338 375
339 /* SCIF2 (CN18: DEBUG0) */
340 gpio_request(GPIO_FN_TX2_C, NULL);
341 gpio_request(GPIO_FN_RX2_C, NULL);
342
343 /* SCIF4 (CN19: DEBUG1) */
344 gpio_request(GPIO_FN_TX4, NULL);
345 gpio_request(GPIO_FN_RX4, NULL);
346
347 /* LAN89218 */
348 gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
349 gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
350
351 /* SD0 (CN20) */
352 gpio_request(GPIO_FN_SD0_CLK, NULL);
353 gpio_request(GPIO_FN_SD0_CMD, NULL);
354 gpio_request(GPIO_FN_SD0_DAT0, NULL);
355 gpio_request(GPIO_FN_SD0_DAT1, NULL);
356 gpio_request(GPIO_FN_SD0_DAT2, NULL);
357 gpio_request(GPIO_FN_SD0_DAT3, NULL);
358 gpio_request(GPIO_FN_SD0_CD, NULL);
359 gpio_request(GPIO_FN_SD0_WP, NULL);
360
361 /* HSPI 0 */
362 gpio_request(GPIO_FN_HSPI_CLK0, NULL);
363 gpio_request(GPIO_FN_HSPI_CS0, NULL);
364 gpio_request(GPIO_FN_HSPI_TX0, NULL);
365 gpio_request(GPIO_FN_HSPI_RX0, NULL);
366
367 /* USB (CN21) */
368 gpio_request(GPIO_FN_USB_OVC0, NULL);
369 gpio_request(GPIO_FN_USB_OVC1, NULL);
370 gpio_request(GPIO_FN_USB_OVC2, NULL);
371
372 /* USB (CN22) */
373 gpio_request(GPIO_FN_USB_PENC2, NULL);
374
375 r8a7779_add_standard_devices(); 376 r8a7779_add_standard_devices();
376 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 377 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
377} 378}
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 19ce885a3b43..1feb9a2286a8 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -593,29 +593,42 @@ static struct clk_lookup lookups[] = {
593 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]), 593 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
594 594
595 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), 595 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
596 CLKDEV_DEV_ID("e6c80000.sci", &mstp_clks[MSTP200]),
596 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), 597 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
598 CLKDEV_DEV_ID("e6c70000.sci", &mstp_clks[MSTP201]),
597 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), 599 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
600 CLKDEV_DEV_ID("e6c60000.sci", &mstp_clks[MSTP202]),
598 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 601 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
602 CLKDEV_DEV_ID("e6c50000.sci", &mstp_clks[MSTP203]),
599 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 603 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
604 CLKDEV_DEV_ID("e6c40000.sci", &mstp_clks[MSTP204]),
600 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), 605 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
606 CLKDEV_DEV_ID("e6c30000.sci", &mstp_clks[MSTP206]),
601 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), 607 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]),
608 CLKDEV_DEV_ID("e6cb0000.sci", &mstp_clks[MSTP207]),
602 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), 609 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]),
603 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), 610 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]),
604 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), 611 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]),
605 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), 612 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
606 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), 613 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
614 CLKDEV_DEV_ID("e6cd0000.sci", &mstp_clks[MSTP222]),
607 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 615 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
616 CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]),
608 617
609 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), 618 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
610 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), 619 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
611 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), 620 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
612 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]), 621 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
613 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 622 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
623 CLKDEV_DEV_ID("e6850000.sdhi", &mstp_clks[MSTP314]),
614 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 624 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
625 CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]),
615 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 626 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
627 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]),
616 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]), 628 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]),
617 629
618 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), 630 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
631 CLKDEV_DEV_ID("e6870000.sdhi", &mstp_clks[MSTP415]),
619 632
620 /* ICK */ 633 /* ICK */
621 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), 634 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 1db36537255c..d9edeaf66007 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -87,7 +87,8 @@ static struct clk div4_clks[DIV4_NR] = {
87}; 87};
88 88
89enum { MSTP323, MSTP322, MSTP321, MSTP320, 89enum { MSTP323, MSTP322, MSTP321, MSTP320,
90 MSTP101, MSTP100, 90 MSTP115,
91 MSTP103, MSTP101, MSTP100,
91 MSTP030, 92 MSTP030,
92 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 93 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
93 MSTP016, MSTP015, MSTP014, 94 MSTP016, MSTP015, MSTP014,
@@ -99,6 +100,8 @@ static struct clk mstp_clks[MSTP_NR] = {
99 [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ 100 [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */
100 [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ 101 [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */
101 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ 102 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */
103 [MSTP115] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 15, 0), /* SATA */
104 [MSTP103] = SH_CLK_MSTP32(&div4_clks[DIV4_S], MSTPCR1, 3, 0), /* DU */
102 [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */ 105 [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */
103 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */ 106 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */
104 [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ 107 [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */
@@ -156,6 +159,8 @@ static struct clk_lookup lookups[] = {
156 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), 159 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]),
157 160
158 /* MSTP32 clocks */ 161 /* MSTP32 clocks */
162 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
163 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
159 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ 164 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
160 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ 165 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
161 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 166 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
@@ -180,6 +185,7 @@ static struct clk_lookup lookups[] = {
180 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 185 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
181 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 186 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
182 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ 187 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
188 CLKDEV_DEV_ID("rcar-du.0", &mstp_clks[MSTP103]), /* DU */
183}; 189};
184 190
185void __init r8a7779_clock_init(void) 191void __init r8a7779_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index afa5423a0f93..71843dd39e16 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -265,12 +265,12 @@ enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
265 265
266static struct clk div4_clks[DIV4_NR] = { 266static struct clk div4_clks[DIV4_NR] = {
267 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT), 267 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT),
268 [DIV4_ZG] = DIV4(FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT), 268 [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT),
269 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT), 269 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
270 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT), 270 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT),
271 [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0), 271 [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0),
272 [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0), 272 [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0),
273 [DIV4_Z] = DIV4(FRQCRB, 24, 0x97f, 0), 273 [DIV4_Z] = SH_CLK_DIV4(&pll0_clk, FRQCRB, 24, 0x97f, 0),
274 [DIV4_ZTR] = DIV4(FRQCRB, 20, 0xdff, 0), 274 [DIV4_ZTR] = DIV4(FRQCRB, 20, 0xdff, 0),
275 [DIV4_ZT] = DIV4(FRQCRB, 16, 0xdff, 0), 275 [DIV4_ZT] = DIV4(FRQCRB, 16, 0xdff, 0),
276 [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0), 276 [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0),
@@ -581,10 +581,13 @@ static struct clk_lookup lookups[] = {
581 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ 581 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
582 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ 582 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
583 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 583 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
584 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), /* SDHI0 */
584 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 585 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
586 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), /* SDHI1 */
585 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ 587 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
586 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */ 588 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */
587 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ 589 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
590 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */
588 CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */ 591 CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */
589 CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */ 592 CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */
590 CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ 593 CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */
diff --git a/arch/arm/mach-shmobile/headsmp-sh73a0.S b/arch/arm/mach-shmobile/headsmp-scu.S
index bec4c0d9b713..7d113f898e7f 100644
--- a/arch/arm/mach-shmobile/headsmp-sh73a0.S
+++ b/arch/arm/mach-shmobile/headsmp-scu.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * SMP support for SoC sh73a0 2 * Shared SCU setup for mach-shmobile
3 * 3 *
4 * Copyright (C) 2012 Bastian Hecht 4 * Copyright (C) 2012 Bastian Hecht
5 * 5 *
@@ -35,11 +35,12 @@
35 * the physical address as the MMU is still turned off. 35 * the physical address as the MMU is still turned off.
36 */ 36 */
37 .align 12 37 .align 12
38ENTRY(sh73a0_secondary_vector) 38ENTRY(shmobile_secondary_vector_scu)
39 mrc p15, 0, r0, c0, c0, 5 @ read MIPDR 39 mrc p15, 0, r0, c0, c0, 5 @ read MIPDR
40 and r0, r0, #3 @ mask out cpu ID 40 and r0, r0, #3 @ mask out cpu ID
41 lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits 41 lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits
42 mov r1, #0xf0000000 @ SCU base address 42 ldr r1, 2f
43 ldr r1, [r1] @ SCU base address
43 ldr r2, [r1, #8] @ SCU Power Status Register 44 ldr r2, [r1, #8] @ SCU Power Status Register
44 mov r3, #3 45 mov r3, #3
45 bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode) 46 bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode)
@@ -47,4 +48,10 @@ ENTRY(sh73a0_secondary_vector)
47 48
48 ldr pc, 1f 49 ldr pc, 1f
491: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET 501: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET
50ENDPROC(sh73a0_secondary_vector) 512: .long shmobile_scu_base - PAGE_OFFSET + PLAT_PHYS_OFFSET
52ENDPROC(shmobile_secondary_vector_scu)
53
54 .text
55 .globl shmobile_scu_base
56shmobile_scu_base:
57 .space 4
diff --git a/arch/arm/mach-shmobile/hotplug.c b/arch/arm/mach-shmobile/hotplug.c
deleted file mode 100644
index a1524e3367b0..000000000000
--- a/arch/arm/mach-shmobile/hotplug.c
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * SMP support for R-Mobile / SH-Mobile
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * Based on realview, Copyright (C) 2002 ARM Ltd, All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/smp.h>
15#include <linux/cpumask.h>
16#include <linux/delay.h>
17#include <linux/of.h>
18#include <mach/common.h>
19#include <mach/r8a7779.h>
20#include <mach/emev2.h>
21#include <asm/cacheflush.h>
22#include <asm/mach-types.h>
23
24static cpumask_t dead_cpus;
25
26void shmobile_cpu_die(unsigned int cpu)
27{
28 /* hardware shutdown code running on the CPU that is being offlined */
29 flush_cache_all();
30 dsb();
31
32 /* notify platform_cpu_kill() that hardware shutdown is finished */
33 cpumask_set_cpu(cpu, &dead_cpus);
34
35 /* wait for SoC code in platform_cpu_kill() to shut off CPU core
36 * power. CPU bring up starts from the reset vector.
37 */
38 while (1) {
39 /*
40 * here's the WFI
41 */
42 asm(".word 0xe320f003\n"
43 :
44 :
45 : "memory", "cc");
46 }
47}
48
49int shmobile_cpu_disable(unsigned int cpu)
50{
51 cpumask_clear_cpu(cpu, &dead_cpus);
52 /*
53 * we don't allow CPU 0 to be shutdown (it is still too special
54 * e.g. clock tick interrupts)
55 */
56 return cpu == 0 ? -EPERM : 0;
57}
58
59int shmobile_cpu_disable_any(unsigned int cpu)
60{
61 cpumask_clear_cpu(cpu, &dead_cpus);
62 return 0;
63}
64
65int shmobile_cpu_is_dead(unsigned int cpu)
66{
67 return cpumask_test_cpu(cpu, &dead_cpus);
68}
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index e48606d8a2be..86fcdf9fde1b 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -8,6 +8,7 @@ extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
8struct twd_local_timer; 8struct twd_local_timer;
9extern void shmobile_setup_console(void); 9extern void shmobile_setup_console(void);
10extern void shmobile_secondary_vector(void); 10extern void shmobile_secondary_vector(void);
11extern void shmobile_secondary_vector_scu(void);
11struct clk; 12struct clk;
12extern int shmobile_clk_init(void); 13extern int shmobile_clk_init(void);
13extern void shmobile_handle_irq_intc(struct pt_regs *); 14extern void shmobile_handle_irq_intc(struct pt_regs *);
@@ -33,23 +34,23 @@ extern int sh7372_do_idle_sysc(unsigned long sleep_mode);
33extern struct clk sh7372_extal1_clk; 34extern struct clk sh7372_extal1_clk;
34extern struct clk sh7372_extal2_clk; 35extern struct clk sh7372_extal2_clk;
35 36
37extern void sh73a0_init_delay(void);
36extern void sh73a0_init_irq(void); 38extern void sh73a0_init_irq(void);
37extern void sh73a0_init_irq_dt(void); 39extern void sh73a0_init_irq_dt(void);
38extern void sh73a0_map_io(void); 40extern void sh73a0_map_io(void);
39extern void sh73a0_earlytimer_init(void); 41extern void sh73a0_earlytimer_init(void);
40extern void sh73a0_add_early_devices(void); 42extern void sh73a0_add_early_devices(void);
41extern void sh73a0_add_early_devices_dt(void);
42extern void sh73a0_add_standard_devices(void); 43extern void sh73a0_add_standard_devices(void);
43extern void sh73a0_add_standard_devices_dt(void); 44extern void sh73a0_add_standard_devices_dt(void);
44extern void sh73a0_clock_init(void); 45extern void sh73a0_clock_init(void);
45extern void sh73a0_pinmux_init(void); 46extern void sh73a0_pinmux_init(void);
46extern void sh73a0_pm_init(void); 47extern void sh73a0_pm_init(void);
47extern void sh73a0_secondary_vector(void);
48extern struct clk sh73a0_extal1_clk; 48extern struct clk sh73a0_extal1_clk;
49extern struct clk sh73a0_extal2_clk; 49extern struct clk sh73a0_extal2_clk;
50extern struct clk sh73a0_extcki_clk; 50extern struct clk sh73a0_extcki_clk;
51extern struct clk sh73a0_extalr_clk; 51extern struct clk sh73a0_extalr_clk;
52 52
53extern void r8a7740_meram_workaround(void);
53extern void r8a7740_init_irq(void); 54extern void r8a7740_init_irq(void);
54extern void r8a7740_map_io(void); 55extern void r8a7740_map_io(void);
55extern void r8a7740_add_early_devices(void); 56extern void r8a7740_add_early_devices(void);
@@ -58,16 +59,17 @@ extern void r8a7740_clock_init(u8 md_ck);
58extern void r8a7740_pinmux_init(void); 59extern void r8a7740_pinmux_init(void);
59extern void r8a7740_pm_init(void); 60extern void r8a7740_pm_init(void);
60 61
62extern void r8a7779_init_delay(void);
61extern void r8a7779_init_irq(void); 63extern void r8a7779_init_irq(void);
64extern void r8a7779_init_irq_dt(void);
62extern void r8a7779_map_io(void); 65extern void r8a7779_map_io(void);
63extern void r8a7779_earlytimer_init(void); 66extern void r8a7779_earlytimer_init(void);
64extern void r8a7779_add_early_devices(void); 67extern void r8a7779_add_early_devices(void);
65extern void r8a7779_add_standard_devices(void); 68extern void r8a7779_add_standard_devices(void);
69extern void r8a7779_add_standard_devices_dt(void);
66extern void r8a7779_clock_init(void); 70extern void r8a7779_clock_init(void);
67extern void r8a7779_pinmux_init(void); 71extern void r8a7779_pinmux_init(void);
68extern void r8a7779_pm_init(void); 72extern void r8a7779_pm_init(void);
69extern void r8a7740_meram_workaround(void);
70
71extern void r8a7779_register_twd(void); 73extern void r8a7779_register_twd(void);
72 74
73#ifdef CONFIG_SUSPEND 75#ifdef CONFIG_SUSPEND
@@ -82,16 +84,7 @@ int shmobile_cpuidle_init(void);
82static inline int shmobile_cpuidle_init(void) { return 0; } 84static inline int shmobile_cpuidle_init(void) { return 0; }
83#endif 85#endif
84 86
85extern void shmobile_cpu_die(unsigned int cpu); 87extern void __iomem *shmobile_scu_base;
86extern int shmobile_cpu_disable(unsigned int cpu);
87extern int shmobile_cpu_disable_any(unsigned int cpu);
88
89#ifdef CONFIG_HOTPLUG_CPU
90extern int shmobile_cpu_is_dead(unsigned int cpu);
91#else
92static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; }
93#endif
94
95extern void shmobile_smp_init_cpus(unsigned int ncores); 88extern void shmobile_smp_init_cpus(unsigned int ncores);
96 89
97static inline void __init shmobile_init_late(void) 90static inline void __init shmobile_init_late(void)
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index 06a5da3c3050..992ed213cec1 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -5,6 +5,7 @@
5 5
6/* GIC */ 6/* GIC */
7#define gic_spi(nr) ((nr) + 32) 7#define gic_spi(nr) ((nr) + 32)
8#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
8 9
9/* INTCS */ 10/* INTCS */
10#define INTCS_VECT_BASE 0x3400 11#define INTCS_VECT_BASE 0x3400
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
index 59d252f4cf97..c2583610ad36 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
@@ -241,48 +241,9 @@ enum {
241 241
242 /* LCD0 */ 242 /* LCD0 */
243 GPIO_FN_LCDC0_SELECT, 243 GPIO_FN_LCDC0_SELECT,
244 GPIO_FN_LCD0_D0, GPIO_FN_LCD0_D1, GPIO_FN_LCD0_D2,
245 GPIO_FN_LCD0_D3, GPIO_FN_LCD0_D4, GPIO_FN_LCD0_D5,
246 GPIO_FN_LCD0_D6, GPIO_FN_LCD0_D7, GPIO_FN_LCD0_D8,
247 GPIO_FN_LCD0_D9, GPIO_FN_LCD0_D10, GPIO_FN_LCD0_D11,
248 GPIO_FN_LCD0_D12, GPIO_FN_LCD0_D13, GPIO_FN_LCD0_D14,
249 GPIO_FN_LCD0_D15, GPIO_FN_LCD0_D16, GPIO_FN_LCD0_D17,
250 GPIO_FN_LCD0_DON, GPIO_FN_LCD0_VCPWC, GPIO_FN_LCD0_VEPWC,
251
252 GPIO_FN_LCD0_DCK, GPIO_FN_LCD0_VSYN, /* for RGB */
253 GPIO_FN_LCD0_HSYN, GPIO_FN_LCD0_DISP, /* for RGB */
254
255 GPIO_FN_LCD0_WR, GPIO_FN_LCD0_RD, /* for SYS */
256 GPIO_FN_LCD0_CS, GPIO_FN_LCD0_RS, /* for SYS */
257
258 GPIO_FN_LCD0_D18_PORT163, GPIO_FN_LCD0_D19_PORT162,
259 GPIO_FN_LCD0_D20_PORT161, GPIO_FN_LCD0_D21_PORT158,
260 GPIO_FN_LCD0_D22_PORT160, GPIO_FN_LCD0_D23_PORT159,
261 GPIO_FN_LCD0_LCLK_PORT165, /* MSEL5CR_6_1 */
262
263 GPIO_FN_LCD0_D18_PORT40, GPIO_FN_LCD0_D19_PORT4,
264 GPIO_FN_LCD0_D20_PORT3, GPIO_FN_LCD0_D21_PORT2,
265 GPIO_FN_LCD0_D22_PORT0, GPIO_FN_LCD0_D23_PORT1,
266 GPIO_FN_LCD0_LCLK_PORT102, /* MSEL5CR_6_0 */
267 244
268 /* LCD1 */ 245 /* LCD1 */
269 GPIO_FN_LCDC1_SELECT, 246 GPIO_FN_LCDC1_SELECT,
270 GPIO_FN_LCD1_D0, GPIO_FN_LCD1_D1, GPIO_FN_LCD1_D2,
271 GPIO_FN_LCD1_D3, GPIO_FN_LCD1_D4, GPIO_FN_LCD1_D5,
272 GPIO_FN_LCD1_D6, GPIO_FN_LCD1_D7, GPIO_FN_LCD1_D8,
273 GPIO_FN_LCD1_D9, GPIO_FN_LCD1_D10, GPIO_FN_LCD1_D11,
274 GPIO_FN_LCD1_D12, GPIO_FN_LCD1_D13, GPIO_FN_LCD1_D14,
275 GPIO_FN_LCD1_D15, GPIO_FN_LCD1_D16, GPIO_FN_LCD1_D17,
276 GPIO_FN_LCD1_D18, GPIO_FN_LCD1_D19, GPIO_FN_LCD1_D20,
277 GPIO_FN_LCD1_D21, GPIO_FN_LCD1_D22, GPIO_FN_LCD1_D23,
278 GPIO_FN_LCD1_DON, GPIO_FN_LCD1_VCPWC,
279 GPIO_FN_LCD1_LCLK, GPIO_FN_LCD1_VEPWC,
280
281 GPIO_FN_LCD1_DCK, GPIO_FN_LCD1_VSYN, /* for RGB */
282 GPIO_FN_LCD1_HSYN, GPIO_FN_LCD1_DISP, /* for RGB */
283
284 GPIO_FN_LCD1_WR, GPIO_FN_LCD1_RD, /* for SYS */
285 GPIO_FN_LCD1_CS, GPIO_FN_LCD1_RS, /* for SYS */
286 247
287 /* RSPI */ 248 /* RSPI */
288 GPIO_FN_RSPI_SSL0_A, GPIO_FN_RSPI_SSL1_A, 249 GPIO_FN_RSPI_SSL0_A, GPIO_FN_RSPI_SSL1_A,
@@ -346,26 +307,6 @@ enum {
346 GPIO_FN_SIM_D_PORT22, /* SIM_D Port 22/199 */ 307 GPIO_FN_SIM_D_PORT22, /* SIM_D Port 22/199 */
347 GPIO_FN_SIM_D_PORT199, 308 GPIO_FN_SIM_D_PORT199,
348 309
349 /* SDHI0 */
350 GPIO_FN_SDHI0_D0, GPIO_FN_SDHI0_D1, GPIO_FN_SDHI0_D2,
351 GPIO_FN_SDHI0_D3, GPIO_FN_SDHI0_CD, GPIO_FN_SDHI0_WP,
352 GPIO_FN_SDHI0_CMD, GPIO_FN_SDHI0_CLK,
353
354 /* SDHI1 */
355 GPIO_FN_SDHI1_D0, GPIO_FN_SDHI1_D1, GPIO_FN_SDHI1_D2,
356 GPIO_FN_SDHI1_D3, GPIO_FN_SDHI1_CD, GPIO_FN_SDHI1_WP,
357 GPIO_FN_SDHI1_CMD, GPIO_FN_SDHI1_CLK,
358
359 /* SDHI2 */
360 GPIO_FN_SDHI2_D0, GPIO_FN_SDHI2_D1, GPIO_FN_SDHI2_D2,
361 GPIO_FN_SDHI2_D3, GPIO_FN_SDHI2_CLK, GPIO_FN_SDHI2_CMD,
362
363 GPIO_FN_SDHI2_CD_PORT24, /* MSEL5CR_19_0 */
364 GPIO_FN_SDHI2_WP_PORT25,
365
366 GPIO_FN_SDHI2_WP_PORT177, /* MSEL5CR_19_1 */
367 GPIO_FN_SDHI2_CD_PORT202,
368
369 /* MSIOF2 */ 310 /* MSIOF2 */
370 GPIO_FN_MSIOF2_TXD, GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TSCK, 311 GPIO_FN_MSIOF2_TXD, GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TSCK,
371 GPIO_FN_MSIOF2_SS2, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_SS1, 312 GPIO_FN_MSIOF2_SS2, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_SS1,
@@ -417,21 +358,6 @@ enum {
417 GPIO_FN_MEMC_DREQ1, 358 GPIO_FN_MEMC_DREQ1,
418 GPIO_FN_MEMC_A0, 359 GPIO_FN_MEMC_A0,
419 360
420 /* MMC */
421 GPIO_FN_MMC0_D0_PORT68, GPIO_FN_MMC0_D1_PORT69,
422 GPIO_FN_MMC0_D2_PORT70, GPIO_FN_MMC0_D3_PORT71,
423 GPIO_FN_MMC0_D4_PORT72, GPIO_FN_MMC0_D5_PORT73,
424 GPIO_FN_MMC0_D6_PORT74, GPIO_FN_MMC0_D7_PORT75,
425 GPIO_FN_MMC0_CLK_PORT66,
426 GPIO_FN_MMC0_CMD_PORT67, /* MSEL4CR_15_0 */
427
428 GPIO_FN_MMC1_D0_PORT149, GPIO_FN_MMC1_D1_PORT148,
429 GPIO_FN_MMC1_D2_PORT147, GPIO_FN_MMC1_D3_PORT146,
430 GPIO_FN_MMC1_D4_PORT145, GPIO_FN_MMC1_D5_PORT144,
431 GPIO_FN_MMC1_D6_PORT143, GPIO_FN_MMC1_D7_PORT142,
432 GPIO_FN_MMC1_CLK_PORT103,
433 GPIO_FN_MMC1_CMD_PORT104, /* MSEL4CR_15_1 */
434
435 /* MSIOF0 */ 361 /* MSIOF0 */
436 GPIO_FN_MSIOF0_SS1, GPIO_FN_MSIOF0_SS2, 362 GPIO_FN_MSIOF0_SS1, GPIO_FN_MSIOF0_SS2,
437 GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_TXD, 363 GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_TXD,
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 8ab0cd6ad6b0..8ea0ad18cdff 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -71,128 +71,125 @@ enum {
71 GPIO_FN_A19, 71 GPIO_FN_A19,
72 72
73 /* IPSR0 */ 73 /* IPSR0 */
74 GPIO_FN_USB_PENC2, GPIO_FN_SCK0, GPIO_FN_PWM1, GPIO_FN_PWMFSW0, 74 GPIO_FN_PWM1, GPIO_FN_PWMFSW0,
75 GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS, GPIO_FN_SD1_DAT2, 75 GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS,
76 GPIO_FN_MMC0_D2, GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF, 76 GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF,
77 GPIO_FN_HCTS1, GPIO_FN_TX4_C, GPIO_FN_A0, GPIO_FN_SD1_DAT3, 77 GPIO_FN_HCTS1, GPIO_FN_A0,
78 GPIO_FN_MMC0_D3, GPIO_FN_FD3, GPIO_FN_A20, GPIO_FN_TX5_D, 78 GPIO_FN_FD3, GPIO_FN_A20,
79 GPIO_FN_HSPI_TX2_B, GPIO_FN_A21, GPIO_FN_SCK5_D, GPIO_FN_HSPI_CLK2_B, 79 GPIO_FN_A21,
80 GPIO_FN_A22, GPIO_FN_RX5_D, GPIO_FN_HSPI_RX2_B, GPIO_FN_VI1_R0, 80 GPIO_FN_A22, GPIO_FN_VI1_R0,
81 GPIO_FN_A23, GPIO_FN_FCLE, GPIO_FN_HSPI_CLK2, GPIO_FN_VI1_R1, 81 GPIO_FN_A23, GPIO_FN_FCLE, GPIO_FN_VI1_R1,
82 GPIO_FN_A24, GPIO_FN_SD1_CD, GPIO_FN_MMC0_D4, GPIO_FN_FD4, 82 GPIO_FN_A24, GPIO_FN_FD4,
83 GPIO_FN_HSPI_CS2, GPIO_FN_VI1_R2, GPIO_FN_SSI_WS78_B, GPIO_FN_A25, 83 GPIO_FN_VI1_R2, GPIO_FN_SSI_WS78_B, GPIO_FN_A25,
84 GPIO_FN_SD1_WP, GPIO_FN_MMC0_D5, GPIO_FN_FD5, GPIO_FN_HSPI_RX2, 84 GPIO_FN_FD5,
85 GPIO_FN_VI1_R3, GPIO_FN_TX5_B, GPIO_FN_SSI_SDATA7_B, GPIO_FN_CTS0_B, 85 GPIO_FN_VI1_R3, GPIO_FN_SSI_SDATA7_B,
86 GPIO_FN_CLKOUT, GPIO_FN_TX3C_IRDA_TX_C, GPIO_FN_PWM0_B, GPIO_FN_CS0, 86 GPIO_FN_CLKOUT, GPIO_FN_PWM0_B,
87 GPIO_FN_HSPI_CS2_B, GPIO_FN_CS1_A26, GPIO_FN_HSPI_TX2,
88 GPIO_FN_SDSELF_B, GPIO_FN_RD_WR, GPIO_FN_FWE, GPIO_FN_ATAG0, 87 GPIO_FN_SDSELF_B, GPIO_FN_RD_WR, GPIO_FN_FWE, GPIO_FN_ATAG0,
89 GPIO_FN_VI1_R7, GPIO_FN_HRTS1, GPIO_FN_RX4_C, 88 GPIO_FN_VI1_R7, GPIO_FN_HRTS1,
90 89
91 /* IPSR1 */ 90 /* IPSR1 */
92 GPIO_FN_EX_CS0, GPIO_FN_RX3_C_IRDA_RX_C, GPIO_FN_MMC0_D6, 91 GPIO_FN_FD6, GPIO_FN_FD7,
93 GPIO_FN_FD6, GPIO_FN_EX_CS1, GPIO_FN_MMC0_D7, GPIO_FN_FD7, 92 GPIO_FN_FALE,
94 GPIO_FN_EX_CS2, GPIO_FN_SD1_CLK, GPIO_FN_MMC0_CLK, GPIO_FN_FALE, 93 GPIO_FN_ATACS00,
95 GPIO_FN_ATACS00, GPIO_FN_EX_CS3, GPIO_FN_SD1_CMD, GPIO_FN_MMC0_CMD, 94 GPIO_FN_FRE, GPIO_FN_ATACS10, GPIO_FN_VI1_R4,
96 GPIO_FN_FRE, GPIO_FN_ATACS10, GPIO_FN_VI1_R4, GPIO_FN_RX5_B, 95 GPIO_FN_HSCK1, GPIO_FN_SSI_SDATA8_B,
97 GPIO_FN_HSCK1, GPIO_FN_SSI_SDATA8_B, GPIO_FN_RTS0_B_TANS_B, 96 GPIO_FN_SSI_SDATA9,
98 GPIO_FN_SSI_SDATA9, GPIO_FN_EX_CS4, GPIO_FN_SD1_DAT0, GPIO_FN_MMC0_D0, 97 GPIO_FN_FD0, GPIO_FN_ATARD0, GPIO_FN_VI1_R5,
99 GPIO_FN_FD0, GPIO_FN_ATARD0, GPIO_FN_VI1_R5, GPIO_FN_SCK5_B, 98 GPIO_FN_HTX1, GPIO_FN_SSI_SCK9,
100 GPIO_FN_HTX1, GPIO_FN_TX2_E, GPIO_FN_TX0_B, GPIO_FN_SSI_SCK9, 99 GPIO_FN_FD1,
101 GPIO_FN_EX_CS5, GPIO_FN_SD1_DAT1, GPIO_FN_MMC0_D1, GPIO_FN_FD1, 100 GPIO_FN_ATAWR0, GPIO_FN_VI1_R6, GPIO_FN_HRX1,
102 GPIO_FN_ATAWR0, GPIO_FN_VI1_R6, GPIO_FN_HRX1, GPIO_FN_RX2_E, 101 GPIO_FN_SSI_WS9, GPIO_FN_MLB_CLK, GPIO_FN_PWM2,
103 GPIO_FN_RX0_B, GPIO_FN_SSI_WS9, GPIO_FN_MLB_CLK, GPIO_FN_PWM2, 102 GPIO_FN_MLB_SIG, GPIO_FN_PWM3,
104 GPIO_FN_SCK4, GPIO_FN_MLB_SIG, GPIO_FN_PWM3, GPIO_FN_TX4, 103 GPIO_FN_MLB_DAT, GPIO_FN_PWM4, GPIO_FN_HTX0,
105 GPIO_FN_MLB_DAT, GPIO_FN_PWM4, GPIO_FN_RX4, GPIO_FN_HTX0, 104 GPIO_FN_SDATA, GPIO_FN_SUB_TCK,
106 GPIO_FN_TX1, GPIO_FN_SDATA, GPIO_FN_CTS0_C, GPIO_FN_SUB_TCK,
107 GPIO_FN_CC5_STATE2, GPIO_FN_CC5_STATE10, GPIO_FN_CC5_STATE18, 105 GPIO_FN_CC5_STATE2, GPIO_FN_CC5_STATE10, GPIO_FN_CC5_STATE18,
108 GPIO_FN_CC5_STATE26, GPIO_FN_CC5_STATE34, 106 GPIO_FN_CC5_STATE26, GPIO_FN_CC5_STATE34,
109 107
110 /* IPSR2 */ 108 /* IPSR2 */
111 GPIO_FN_HRX0, GPIO_FN_RX1, GPIO_FN_SCKZ, GPIO_FN_RTS0_C_TANS_C, 109 GPIO_FN_HRX0, GPIO_FN_SCKZ,
112 GPIO_FN_SUB_TDI, GPIO_FN_CC5_STATE3, GPIO_FN_CC5_STATE11, 110 GPIO_FN_SUB_TDI, GPIO_FN_CC5_STATE3, GPIO_FN_CC5_STATE11,
113 GPIO_FN_CC5_STATE19, GPIO_FN_CC5_STATE27, GPIO_FN_CC5_STATE35, 111 GPIO_FN_CC5_STATE19, GPIO_FN_CC5_STATE27, GPIO_FN_CC5_STATE35,
114 GPIO_FN_HSCK0, GPIO_FN_SCK1, GPIO_FN_MTS, GPIO_FN_PWM5, 112 GPIO_FN_HSCK0, GPIO_FN_MTS, GPIO_FN_PWM5,
115 GPIO_FN_SCK0_C, GPIO_FN_SSI_SDATA9_B, GPIO_FN_SUB_TDO, 113 GPIO_FN_SSI_SDATA9_B, GPIO_FN_SUB_TDO,
116 GPIO_FN_CC5_STATE0, GPIO_FN_CC5_STATE8, GPIO_FN_CC5_STATE16, 114 GPIO_FN_CC5_STATE0, GPIO_FN_CC5_STATE8, GPIO_FN_CC5_STATE16,
117 GPIO_FN_CC5_STATE24, GPIO_FN_CC5_STATE32, GPIO_FN_HCTS0, GPIO_FN_CTS1, 115 GPIO_FN_CC5_STATE24, GPIO_FN_CC5_STATE32, GPIO_FN_HCTS0,
118 GPIO_FN_STM, GPIO_FN_PWM0_D, GPIO_FN_RX0_C, GPIO_FN_SCIF_CLK_C, 116 GPIO_FN_STM, GPIO_FN_PWM0_D, GPIO_FN_SCIF_CLK_C,
119 GPIO_FN_SUB_TRST, GPIO_FN_TCLK1_B, GPIO_FN_CC5_OSCOUT, GPIO_FN_HRTS0, 117 GPIO_FN_SUB_TRST, GPIO_FN_TCLK1_B, GPIO_FN_CC5_OSCOUT, GPIO_FN_HRTS0,
120 GPIO_FN_RTS1_TANS, GPIO_FN_MDATA, GPIO_FN_TX0_C, GPIO_FN_SUB_TMS, 118 GPIO_FN_MDATA, GPIO_FN_SUB_TMS,
121 GPIO_FN_CC5_STATE1, GPIO_FN_CC5_STATE9, GPIO_FN_CC5_STATE17, 119 GPIO_FN_CC5_STATE1, GPIO_FN_CC5_STATE9, GPIO_FN_CC5_STATE17,
122 GPIO_FN_CC5_STATE25, GPIO_FN_CC5_STATE33, GPIO_FN_DU0_DR0, 120 GPIO_FN_CC5_STATE25, GPIO_FN_CC5_STATE33,
123 GPIO_FN_LCDOUT0, GPIO_FN_DREQ0, GPIO_FN_GPS_CLK_B, GPIO_FN_AUDATA0, 121 GPIO_FN_LCDOUT0, GPIO_FN_DREQ0, GPIO_FN_GPS_CLK_B, GPIO_FN_AUDATA0,
124 GPIO_FN_TX5_C, GPIO_FN_DU0_DR1, GPIO_FN_LCDOUT1, GPIO_FN_DACK0, 122 GPIO_FN_LCDOUT1, GPIO_FN_DACK0,
125 GPIO_FN_DRACK0, GPIO_FN_GPS_SIGN_B, GPIO_FN_AUDATA1, GPIO_FN_RX5_C, 123 GPIO_FN_DRACK0, GPIO_FN_GPS_SIGN_B, GPIO_FN_AUDATA1,
126 GPIO_FN_DU0_DR2, GPIO_FN_LCDOUT2, GPIO_FN_DU0_DR3, GPIO_FN_LCDOUT3, 124 GPIO_FN_LCDOUT2, GPIO_FN_LCDOUT3,
127 GPIO_FN_DU0_DR4, GPIO_FN_LCDOUT4, GPIO_FN_DU0_DR5, GPIO_FN_LCDOUT5, 125 GPIO_FN_LCDOUT4, GPIO_FN_LCDOUT5,
128 GPIO_FN_DU0_DR6, GPIO_FN_LCDOUT6, GPIO_FN_DU0_DR7, GPIO_FN_LCDOUT7, 126 GPIO_FN_LCDOUT6, GPIO_FN_LCDOUT7,
129 GPIO_FN_DU0_DG0, GPIO_FN_LCDOUT8, GPIO_FN_DREQ1, GPIO_FN_SCL2, 127 GPIO_FN_LCDOUT8, GPIO_FN_DREQ1, GPIO_FN_SCL2,
130 GPIO_FN_AUDATA2, 128 GPIO_FN_AUDATA2,
131 129
132 /* IPSR3 */ 130 /* IPSR3 */
133 GPIO_FN_DU0_DG1, GPIO_FN_LCDOUT9, GPIO_FN_DACK1, GPIO_FN_SDA2, 131 GPIO_FN_LCDOUT9, GPIO_FN_DACK1, GPIO_FN_SDA2,
134 GPIO_FN_AUDATA3, GPIO_FN_DU0_DG2, GPIO_FN_LCDOUT10, GPIO_FN_DU0_DG3, 132 GPIO_FN_AUDATA3, GPIO_FN_LCDOUT10,
135 GPIO_FN_LCDOUT11, GPIO_FN_DU0_DG4, GPIO_FN_LCDOUT12, GPIO_FN_DU0_DG5, 133 GPIO_FN_LCDOUT11, GPIO_FN_LCDOUT12,
136 GPIO_FN_LCDOUT13, GPIO_FN_DU0_DG6, GPIO_FN_LCDOUT14, GPIO_FN_DU0_DG7, 134 GPIO_FN_LCDOUT13, GPIO_FN_LCDOUT14,
137 GPIO_FN_LCDOUT15, GPIO_FN_DU0_DB0, GPIO_FN_LCDOUT16, GPIO_FN_EX_WAIT1, 135 GPIO_FN_LCDOUT15, GPIO_FN_LCDOUT16, GPIO_FN_EX_WAIT1,
138 GPIO_FN_SCL1, GPIO_FN_TCLK1, GPIO_FN_AUDATA4, GPIO_FN_DU0_DB1, 136 GPIO_FN_SCL1, GPIO_FN_TCLK1, GPIO_FN_AUDATA4,
139 GPIO_FN_LCDOUT17, GPIO_FN_EX_WAIT2, GPIO_FN_SDA1, GPIO_FN_GPS_MAG_B, 137 GPIO_FN_LCDOUT17, GPIO_FN_EX_WAIT2, GPIO_FN_SDA1, GPIO_FN_GPS_MAG_B,
140 GPIO_FN_AUDATA5, GPIO_FN_SCK5_C, GPIO_FN_DU0_DB2, GPIO_FN_LCDOUT18, 138 GPIO_FN_AUDATA5, GPIO_FN_LCDOUT18,
141 GPIO_FN_DU0_DB3, GPIO_FN_LCDOUT19, GPIO_FN_DU0_DB4, GPIO_FN_LCDOUT20, 139 GPIO_FN_LCDOUT19, GPIO_FN_LCDOUT20,
142 GPIO_FN_DU0_DB5, GPIO_FN_LCDOUT21, GPIO_FN_DU0_DB6, GPIO_FN_LCDOUT22, 140 GPIO_FN_LCDOUT21, GPIO_FN_LCDOUT22,
143 GPIO_FN_DU0_DB7, GPIO_FN_LCDOUT23, GPIO_FN_DU0_DOTCLKIN, 141 GPIO_FN_LCDOUT23,
144 GPIO_FN_QSTVA_QVS, GPIO_FN_TX3_D_IRDA_TX_D, GPIO_FN_SCL3_B, 142 GPIO_FN_QSTVA_QVS, GPIO_FN_SCL3_B,
145 GPIO_FN_DU0_DOTCLKOUT0, GPIO_FN_QCLK, GPIO_FN_DU0_DOTCLKOUT1, 143 GPIO_FN_QCLK,
146 GPIO_FN_QSTVB_QVE, GPIO_FN_RX3_D_IRDA_RX_D, GPIO_FN_SDA3_B, 144 GPIO_FN_QSTVB_QVE, GPIO_FN_SDA3_B,
147 GPIO_FN_SDA2_C, GPIO_FN_DACK0_B, GPIO_FN_DRACK0_B, 145 GPIO_FN_SDA2_C, GPIO_FN_DACK0_B, GPIO_FN_DRACK0_B,
148 GPIO_FN_DU0_EXHSYNC_DU0_HSYNC, GPIO_FN_QSTH_QHS, 146 GPIO_FN_QSTH_QHS,
149 GPIO_FN_DU0_EXVSYNC_DU0_VSYNC, GPIO_FN_QSTB_QHE, 147 GPIO_FN_QSTB_QHE,
150 GPIO_FN_DU0_EXODDF_DU0_ODDF_DISP_CDE, GPIO_FN_QCPV_QDE, 148 GPIO_FN_QCPV_QDE,
151 GPIO_FN_CAN1_TX, GPIO_FN_TX2_C, GPIO_FN_SCL2_C, GPIO_FN_REMOCON, 149 GPIO_FN_CAN1_TX, GPIO_FN_SCL2_C, GPIO_FN_REMOCON,
152 150
153 /* IPSR4 */ 151 /* IPSR4 */
154 GPIO_FN_DU0_DISP, GPIO_FN_QPOLA, GPIO_FN_CAN_CLK_C, GPIO_FN_SCK2_C, 152 GPIO_FN_QPOLA, GPIO_FN_CAN_CLK_C,
155 GPIO_FN_DU0_CDE, GPIO_FN_QPOLB, GPIO_FN_CAN1_RX, GPIO_FN_RX2_C, 153 GPIO_FN_QPOLB, GPIO_FN_CAN1_RX,
156 GPIO_FN_DREQ0_B, GPIO_FN_SSI_SCK78_B, GPIO_FN_SCK0_B, GPIO_FN_DU1_DR0, 154 GPIO_FN_DREQ0_B, GPIO_FN_SSI_SCK78_B,
157 GPIO_FN_VI2_DATA0_VI2_B0, GPIO_FN_PWM6, GPIO_FN_SD3_CLK, 155 GPIO_FN_VI2_DATA0_VI2_B0, GPIO_FN_PWM6,
158 GPIO_FN_TX3_E_IRDA_TX_E, GPIO_FN_AUDCK, GPIO_FN_PWMFSW0_B, 156 GPIO_FN_AUDCK, GPIO_FN_PWMFSW0_B,
159 GPIO_FN_DU1_DR1, GPIO_FN_VI2_DATA1_VI2_B1, GPIO_FN_PWM0, 157 GPIO_FN_VI2_DATA1_VI2_B1, GPIO_FN_PWM0,
160 GPIO_FN_SD3_CMD, GPIO_FN_RX3_E_IRDA_RX_E, GPIO_FN_AUDSYNC, 158 GPIO_FN_AUDSYNC,
161 GPIO_FN_CTS0_D, GPIO_FN_DU1_DR2, GPIO_FN_VI2_G0, GPIO_FN_DU1_DR3, 159 GPIO_FN_VI2_G0,
162 GPIO_FN_VI2_G1, GPIO_FN_DU1_DR4, GPIO_FN_VI2_G2, GPIO_FN_DU1_DR5, 160 GPIO_FN_VI2_G1, GPIO_FN_VI2_G2,
163 GPIO_FN_VI2_G3, GPIO_FN_DU1_DR6, GPIO_FN_VI2_G4, GPIO_FN_DU1_DR7, 161 GPIO_FN_VI2_G3, GPIO_FN_VI2_G4,
164 GPIO_FN_VI2_G5, GPIO_FN_DU1_DG0, GPIO_FN_VI2_DATA2_VI2_B2, 162 GPIO_FN_VI2_G5, GPIO_FN_VI2_DATA2_VI2_B2,
165 GPIO_FN_SCL1_B, GPIO_FN_SD3_DAT2, GPIO_FN_SCK3_E, GPIO_FN_AUDATA6, 163 GPIO_FN_SCL1_B, GPIO_FN_AUDATA6,
166 GPIO_FN_TX0_D, GPIO_FN_DU1_DG1, GPIO_FN_VI2_DATA3_VI2_B3, 164 GPIO_FN_VI2_DATA3_VI2_B3,
167 GPIO_FN_SDA1_B, GPIO_FN_SD3_DAT3, GPIO_FN_SCK5, GPIO_FN_AUDATA7, 165 GPIO_FN_SDA1_B, GPIO_FN_AUDATA7,
168 GPIO_FN_RX0_D, GPIO_FN_DU1_DG2, GPIO_FN_VI2_G6, GPIO_FN_DU1_DG3, 166 GPIO_FN_VI2_G6,
169 GPIO_FN_VI2_G7, GPIO_FN_DU1_DG4, GPIO_FN_VI2_R0, GPIO_FN_DU1_DG5, 167 GPIO_FN_VI2_G7, GPIO_FN_VI2_R0,
170 GPIO_FN_VI2_R1, GPIO_FN_DU1_DG6, GPIO_FN_VI2_R2, GPIO_FN_DU1_DG7, 168 GPIO_FN_VI2_R1, GPIO_FN_VI2_R2,
171 GPIO_FN_VI2_R3, GPIO_FN_DU1_DB0, GPIO_FN_VI2_DATA4_VI2_B4, 169 GPIO_FN_VI2_R3, GPIO_FN_VI2_DATA4_VI2_B4,
172 GPIO_FN_SCL2_B, GPIO_FN_SD3_DAT0, GPIO_FN_TX5, GPIO_FN_SCK0_D, 170 GPIO_FN_SCL2_B,
173 171
174 /* IPSR5 */ 172 /* IPSR5 */
175 GPIO_FN_DU1_DB1, GPIO_FN_VI2_DATA5_VI2_B5, GPIO_FN_SDA2_B, 173 GPIO_FN_VI2_DATA5_VI2_B5, GPIO_FN_SDA2_B,
176 GPIO_FN_SD3_DAT1, GPIO_FN_RX5, GPIO_FN_RTS0_D_TANS_D, 174 GPIO_FN_VI2_R4, GPIO_FN_VI2_R5,
177 GPIO_FN_DU1_DB2, GPIO_FN_VI2_R4, GPIO_FN_DU1_DB3, GPIO_FN_VI2_R5, 175 GPIO_FN_VI2_R6, GPIO_FN_VI2_R7,
178 GPIO_FN_DU1_DB4, GPIO_FN_VI2_R6, GPIO_FN_DU1_DB5, GPIO_FN_VI2_R7, 176 GPIO_FN_SCL2_D, GPIO_FN_SDA2_D,
179 GPIO_FN_DU1_DB6, GPIO_FN_SCL2_D, GPIO_FN_DU1_DB7, GPIO_FN_SDA2_D, 177 GPIO_FN_VI2_CLKENB,
180 GPIO_FN_DU1_DOTCLKIN, GPIO_FN_VI2_CLKENB, GPIO_FN_HSPI_CS1, 178 GPIO_FN_SCL1_D, GPIO_FN_VI2_FIELD,
181 GPIO_FN_SCL1_D, GPIO_FN_DU1_DOTCLKOUT, GPIO_FN_VI2_FIELD, 179 GPIO_FN_SDA1_D, GPIO_FN_VI2_HSYNC,
182 GPIO_FN_SDA1_D, GPIO_FN_DU1_EXHSYNC_DU1_HSYNC, GPIO_FN_VI2_HSYNC, 180 GPIO_FN_VI3_HSYNC, GPIO_FN_VI2_VSYNC,
183 GPIO_FN_VI3_HSYNC, GPIO_FN_DU1_EXVSYNC_DU1_VSYNC, GPIO_FN_VI2_VSYNC, 181 GPIO_FN_VI3_VSYNC,
184 GPIO_FN_VI3_VSYNC, GPIO_FN_DU1_EXODDF_DU1_ODDF_DISP_CDE, 182 GPIO_FN_VI2_CLK,
185 GPIO_FN_VI2_CLK, GPIO_FN_TX3_B_IRDA_TX_B, GPIO_FN_SD3_CD, 183 GPIO_FN_VI1_CLKENB, GPIO_FN_VI3_CLKENB,
186 GPIO_FN_HSPI_TX1, GPIO_FN_VI1_CLKENB, GPIO_FN_VI3_CLKENB, 184 GPIO_FN_AUDIO_CLKC, GPIO_FN_SPEEDIN,
187 GPIO_FN_AUDIO_CLKC, GPIO_FN_TX2_D, GPIO_FN_SPEEDIN, 185 GPIO_FN_GPS_SIGN_D, GPIO_FN_VI2_DATA6_VI2_B6,
188 GPIO_FN_GPS_SIGN_D, GPIO_FN_DU1_DISP, GPIO_FN_VI2_DATA6_VI2_B6, 186 GPIO_FN_TCLK0, GPIO_FN_QSTVA_B_QVS_B,
189 GPIO_FN_TCLK0, GPIO_FN_QSTVA_B_QVS_B, GPIO_FN_HSPI_CLK1, 187 GPIO_FN_AUDIO_CLKOUT_B, GPIO_FN_GPS_MAG_D,
190 GPIO_FN_SCK2_D, GPIO_FN_AUDIO_CLKOUT_B, GPIO_FN_GPS_MAG_D, 188 GPIO_FN_VI2_DATA7_VI2_B7,
191 GPIO_FN_DU1_CDE, GPIO_FN_VI2_DATA7_VI2_B7, GPIO_FN_RX3_B_IRDA_RX_B, 189 GPIO_FN_VI1_FIELD, GPIO_FN_VI3_FIELD,
192 GPIO_FN_SD3_WP, GPIO_FN_HSPI_RX1, GPIO_FN_VI1_FIELD, GPIO_FN_VI3_FIELD, 190 GPIO_FN_AUDIO_CLKOUT, GPIO_FN_GPS_CLK_C,
193 GPIO_FN_AUDIO_CLKOUT, GPIO_FN_RX2_D, GPIO_FN_GPS_CLK_C,
194 GPIO_FN_GPS_CLK_D, GPIO_FN_AUDIO_CLKA, GPIO_FN_CAN_TXCLK, 191 GPIO_FN_GPS_CLK_D, GPIO_FN_AUDIO_CLKA, GPIO_FN_CAN_TXCLK,
195 GPIO_FN_AUDIO_CLKB, GPIO_FN_USB_OVC2, GPIO_FN_CAN_DEBUGOUT0, 192 GPIO_FN_AUDIO_CLKB, GPIO_FN_CAN_DEBUGOUT0,
196 GPIO_FN_MOUT0, 193 GPIO_FN_MOUT0,
197 194
198 /* IPSR6 */ 195 /* IPSR6 */
@@ -208,85 +205,84 @@ enum {
208 GPIO_FN_CAN_CLK_B, GPIO_FN_IECLK, GPIO_FN_SCIF_CLK_B, GPIO_FN_TCLK0_B, 205 GPIO_FN_CAN_CLK_B, GPIO_FN_IECLK, GPIO_FN_SCIF_CLK_B, GPIO_FN_TCLK0_B,
209 GPIO_FN_SSI_SDATA4, GPIO_FN_CAN_DEBUGOUT9, GPIO_FN_SSI_SDATA9_C, 206 GPIO_FN_SSI_SDATA4, GPIO_FN_CAN_DEBUGOUT9, GPIO_FN_SSI_SDATA9_C,
210 GPIO_FN_SSI_SCK5, GPIO_FN_ADICLK, GPIO_FN_CAN_DEBUGOUT10, 207 GPIO_FN_SSI_SCK5, GPIO_FN_ADICLK, GPIO_FN_CAN_DEBUGOUT10,
211 GPIO_FN_SCK3, GPIO_FN_TCLK0_D, GPIO_FN_SSI_WS5, GPIO_FN_ADICS_SAMP, 208 GPIO_FN_TCLK0_D, GPIO_FN_SSI_WS5, GPIO_FN_ADICS_SAMP,
212 GPIO_FN_CAN_DEBUGOUT11, GPIO_FN_TX3_IRDA_TX, GPIO_FN_SSI_SDATA5, 209 GPIO_FN_CAN_DEBUGOUT11, GPIO_FN_SSI_SDATA5,
213 GPIO_FN_ADIDATA, GPIO_FN_CAN_DEBUGOUT12, GPIO_FN_RX3_IRDA_RX, 210 GPIO_FN_ADIDATA, GPIO_FN_CAN_DEBUGOUT12,
214 GPIO_FN_SSI_SCK6, GPIO_FN_ADICHS0, GPIO_FN_CAN0_TX, GPIO_FN_IERX_B, 211 GPIO_FN_SSI_SCK6, GPIO_FN_ADICHS0, GPIO_FN_CAN0_TX, GPIO_FN_IERX_B,
215 212
216 /* IPSR7 */ 213 /* IPSR7 */
217 GPIO_FN_SSI_WS6, GPIO_FN_ADICHS1, GPIO_FN_CAN0_RX, GPIO_FN_IETX_B, 214 GPIO_FN_SSI_WS6, GPIO_FN_ADICHS1, GPIO_FN_CAN0_RX, GPIO_FN_IETX_B,
218 GPIO_FN_SSI_SDATA6, GPIO_FN_ADICHS2, GPIO_FN_CAN_CLK, GPIO_FN_IECLK_B, 215 GPIO_FN_SSI_SDATA6, GPIO_FN_ADICHS2, GPIO_FN_CAN_CLK, GPIO_FN_IECLK_B,
219 GPIO_FN_SSI_SCK78, GPIO_FN_CAN_DEBUGOUT13, GPIO_FN_IRQ0_B, 216 GPIO_FN_SSI_SCK78, GPIO_FN_CAN_DEBUGOUT13,
220 GPIO_FN_SSI_SCK9_B, GPIO_FN_HSPI_CLK1_C, GPIO_FN_SSI_WS78, 217 GPIO_FN_SSI_SCK9_B, GPIO_FN_SSI_WS78,
221 GPIO_FN_CAN_DEBUGOUT14, GPIO_FN_IRQ1_B, GPIO_FN_SSI_WS9_B, 218 GPIO_FN_CAN_DEBUGOUT14, GPIO_FN_SSI_WS9_B,
222 GPIO_FN_HSPI_CS1_C, GPIO_FN_SSI_SDATA7, GPIO_FN_CAN_DEBUGOUT15, 219 GPIO_FN_SSI_SDATA7, GPIO_FN_CAN_DEBUGOUT15,
223 GPIO_FN_IRQ2_B, GPIO_FN_TCLK1_C, GPIO_FN_HSPI_TX1_C, 220 GPIO_FN_TCLK1_C,
224 GPIO_FN_SSI_SDATA8, GPIO_FN_VSP, GPIO_FN_IRQ3_B, GPIO_FN_HSPI_RX1_C, 221 GPIO_FN_SSI_SDATA8, GPIO_FN_VSP,
225 GPIO_FN_SD0_CLK, GPIO_FN_ATACS01, GPIO_FN_SCK1_B, GPIO_FN_SD0_CMD, 222 GPIO_FN_ATACS01,
226 GPIO_FN_ATACS11, GPIO_FN_TX1_B, GPIO_FN_CC5_TDO, GPIO_FN_SD0_DAT0, 223 GPIO_FN_ATACS11, GPIO_FN_CC5_TDO,
227 GPIO_FN_ATADIR1, GPIO_FN_RX1_B, GPIO_FN_CC5_TRST, GPIO_FN_SD0_DAT1, 224 GPIO_FN_ATADIR1, GPIO_FN_CC5_TRST,
228 GPIO_FN_ATAG1, GPIO_FN_SCK2_B, GPIO_FN_CC5_TMS, GPIO_FN_SD0_DAT2, 225 GPIO_FN_ATAG1, GPIO_FN_CC5_TMS,
229 GPIO_FN_ATARD1, GPIO_FN_TX2_B, GPIO_FN_CC5_TCK, GPIO_FN_SD0_DAT3, 226 GPIO_FN_ATARD1, GPIO_FN_CC5_TCK,
230 GPIO_FN_ATAWR1, GPIO_FN_RX2_B, GPIO_FN_CC5_TDI, GPIO_FN_SD0_CD, 227 GPIO_FN_ATAWR1, GPIO_FN_CC5_TDI,
231 GPIO_FN_DREQ2, GPIO_FN_RTS1_B_TANS_B, GPIO_FN_SD0_WP, GPIO_FN_DACK2, 228 GPIO_FN_DREQ2, GPIO_FN_DACK2,
232 GPIO_FN_CTS1_B,
233 229
234 /* IPSR8 */ 230 /* IPSR8 */
235 GPIO_FN_HSPI_CLK0, GPIO_FN_CTS0, GPIO_FN_USB_OVC0, GPIO_FN_AD_CLK, 231 GPIO_FN_AD_CLK,
236 GPIO_FN_CC5_STATE4, GPIO_FN_CC5_STATE12, GPIO_FN_CC5_STATE20, 232 GPIO_FN_CC5_STATE4, GPIO_FN_CC5_STATE12, GPIO_FN_CC5_STATE20,
237 GPIO_FN_CC5_STATE28, GPIO_FN_CC5_STATE36, GPIO_FN_HSPI_CS0, 233 GPIO_FN_CC5_STATE28, GPIO_FN_CC5_STATE36,
238 GPIO_FN_RTS0_TANS, GPIO_FN_USB_OVC1, GPIO_FN_AD_DI, 234 GPIO_FN_AD_DI,
239 GPIO_FN_CC5_STATE5, GPIO_FN_CC5_STATE13, GPIO_FN_CC5_STATE21, 235 GPIO_FN_CC5_STATE5, GPIO_FN_CC5_STATE13, GPIO_FN_CC5_STATE21,
240 GPIO_FN_CC5_STATE29, GPIO_FN_CC5_STATE37, GPIO_FN_HSPI_TX0, 236 GPIO_FN_CC5_STATE29, GPIO_FN_CC5_STATE37,
241 GPIO_FN_TX0, GPIO_FN_CAN_DEBUG_HW_TRIGGER, GPIO_FN_AD_DO, 237 GPIO_FN_CAN_DEBUG_HW_TRIGGER, GPIO_FN_AD_DO,
242 GPIO_FN_CC5_STATE6, GPIO_FN_CC5_STATE14, GPIO_FN_CC5_STATE22, 238 GPIO_FN_CC5_STATE6, GPIO_FN_CC5_STATE14, GPIO_FN_CC5_STATE22,
243 GPIO_FN_CC5_STATE30, GPIO_FN_CC5_STATE38, GPIO_FN_HSPI_RX0, 239 GPIO_FN_CC5_STATE30, GPIO_FN_CC5_STATE38,
244 GPIO_FN_RX0, GPIO_FN_CAN_STEP0, GPIO_FN_AD_NCS, GPIO_FN_CC5_STATE7, 240 GPIO_FN_CAN_STEP0, GPIO_FN_AD_NCS, GPIO_FN_CC5_STATE7,
245 GPIO_FN_CC5_STATE15, GPIO_FN_CC5_STATE23, GPIO_FN_CC5_STATE31, 241 GPIO_FN_CC5_STATE15, GPIO_FN_CC5_STATE23, GPIO_FN_CC5_STATE31,
246 GPIO_FN_CC5_STATE39, GPIO_FN_FMCLK, GPIO_FN_RDS_CLK, GPIO_FN_PCMOE, 242 GPIO_FN_CC5_STATE39, GPIO_FN_FMCLK, GPIO_FN_RDS_CLK, GPIO_FN_PCMOE,
247 GPIO_FN_BPFCLK, GPIO_FN_PCMWE, GPIO_FN_FMIN, GPIO_FN_RDS_DATA, 243 GPIO_FN_BPFCLK, GPIO_FN_PCMWE, GPIO_FN_FMIN, GPIO_FN_RDS_DATA,
248 GPIO_FN_VI0_CLK, GPIO_FN_MMC1_CLK, GPIO_FN_VI0_CLKENB, GPIO_FN_TX1_C, 244 GPIO_FN_VI0_CLK, GPIO_FN_VI0_CLKENB,
249 GPIO_FN_HTX1_B, GPIO_FN_MT1_SYNC, GPIO_FN_VI0_FIELD, GPIO_FN_RX1_C, 245 GPIO_FN_HTX1_B, GPIO_FN_MT1_SYNC, GPIO_FN_VI0_FIELD,
250 GPIO_FN_HRX1_B, GPIO_FN_VI0_HSYNC, GPIO_FN_VI0_DATA0_B_VI0_B0_B, 246 GPIO_FN_HRX1_B, GPIO_FN_VI0_HSYNC, GPIO_FN_VI0_DATA0_B_VI0_B0_B,
251 GPIO_FN_CTS1_C, GPIO_FN_TX4_D, GPIO_FN_MMC1_CMD, GPIO_FN_HSCK1_B, 247 GPIO_FN_HSCK1_B,
252 GPIO_FN_VI0_VSYNC, GPIO_FN_VI0_DATA1_B_VI0_B1_B, 248 GPIO_FN_VI0_VSYNC, GPIO_FN_VI0_DATA1_B_VI0_B1_B,
253 GPIO_FN_RTS1_C_TANS_C, GPIO_FN_RX4_D, GPIO_FN_PWMFSW0_C, 249 GPIO_FN_PWMFSW0_C,
254 250
255 /* IPSR9 */ 251 /* IPSR9 */
256 GPIO_FN_VI0_DATA0_VI0_B0, GPIO_FN_HRTS1_B, GPIO_FN_MT1_VCXO, 252 GPIO_FN_VI0_DATA0_VI0_B0, GPIO_FN_HRTS1_B, GPIO_FN_MT1_VCXO,
257 GPIO_FN_VI0_DATA1_VI0_B1, GPIO_FN_HCTS1_B, GPIO_FN_MT1_PWM, 253 GPIO_FN_VI0_DATA1_VI0_B1, GPIO_FN_HCTS1_B, GPIO_FN_MT1_PWM,
258 GPIO_FN_VI0_DATA2_VI0_B2, GPIO_FN_MMC1_D0, GPIO_FN_VI0_DATA3_VI0_B3, 254 GPIO_FN_VI0_DATA2_VI0_B2, GPIO_FN_VI0_DATA3_VI0_B3,
259 GPIO_FN_MMC1_D1, GPIO_FN_VI0_DATA4_VI0_B4, GPIO_FN_MMC1_D2, 255 GPIO_FN_VI0_DATA4_VI0_B4,
260 GPIO_FN_VI0_DATA5_VI0_B5, GPIO_FN_MMC1_D3, GPIO_FN_VI0_DATA6_VI0_B6, 256 GPIO_FN_VI0_DATA5_VI0_B5, GPIO_FN_VI0_DATA6_VI0_B6,
261 GPIO_FN_MMC1_D4, GPIO_FN_ARM_TRACEDATA_0, GPIO_FN_VI0_DATA7_VI0_B7, 257 GPIO_FN_ARM_TRACEDATA_0, GPIO_FN_VI0_DATA7_VI0_B7,
262 GPIO_FN_MMC1_D5, GPIO_FN_ARM_TRACEDATA_1, GPIO_FN_VI0_G0, 258 GPIO_FN_ARM_TRACEDATA_1, GPIO_FN_VI0_G0,
263 GPIO_FN_SSI_SCK78_C, GPIO_FN_IRQ0, GPIO_FN_ARM_TRACEDATA_2, 259 GPIO_FN_SSI_SCK78_C, GPIO_FN_ARM_TRACEDATA_2,
264 GPIO_FN_VI0_G1, GPIO_FN_SSI_WS78_C, GPIO_FN_IRQ1, 260 GPIO_FN_VI0_G1, GPIO_FN_SSI_WS78_C,
265 GPIO_FN_ARM_TRACEDATA_3, GPIO_FN_VI0_G2, GPIO_FN_ETH_TXD1, 261 GPIO_FN_ARM_TRACEDATA_3, GPIO_FN_VI0_G2, GPIO_FN_ETH_TXD1,
266 GPIO_FN_MMC1_D6, GPIO_FN_ARM_TRACEDATA_4, GPIO_FN_TS_SPSYNC0, 262 GPIO_FN_ARM_TRACEDATA_4, GPIO_FN_TS_SPSYNC0,
267 GPIO_FN_VI0_G3, GPIO_FN_ETH_CRS_DV, GPIO_FN_MMC1_D7, 263 GPIO_FN_VI0_G3, GPIO_FN_ETH_CRS_DV,
268 GPIO_FN_ARM_TRACEDATA_5, GPIO_FN_TS_SDAT0, GPIO_FN_VI0_G4, 264 GPIO_FN_ARM_TRACEDATA_5, GPIO_FN_TS_SDAT0, GPIO_FN_VI0_G4,
269 GPIO_FN_ETH_TX_EN, GPIO_FN_SD2_DAT0_B, GPIO_FN_ARM_TRACEDATA_6, 265 GPIO_FN_ETH_TX_EN, GPIO_FN_ARM_TRACEDATA_6,
270 GPIO_FN_VI0_G5, GPIO_FN_ETH_RX_ER, GPIO_FN_SD2_DAT1_B, 266 GPIO_FN_VI0_G5, GPIO_FN_ETH_RX_ER,
271 GPIO_FN_ARM_TRACEDATA_7, GPIO_FN_VI0_G6, GPIO_FN_ETH_RXD0, 267 GPIO_FN_ARM_TRACEDATA_7, GPIO_FN_VI0_G6, GPIO_FN_ETH_RXD0,
272 GPIO_FN_SD2_DAT2_B, GPIO_FN_ARM_TRACEDATA_8, GPIO_FN_VI0_G7, 268 GPIO_FN_ARM_TRACEDATA_8, GPIO_FN_VI0_G7,
273 GPIO_FN_ETH_RXD1, GPIO_FN_SD2_DAT3_B, GPIO_FN_ARM_TRACEDATA_9, 269 GPIO_FN_ETH_RXD1, GPIO_FN_ARM_TRACEDATA_9,
274 270
275 /* IPSR10 */ 271 /* IPSR10 */
276 GPIO_FN_VI0_R0, GPIO_FN_SSI_SDATA7_C, GPIO_FN_SCK1_C, GPIO_FN_DREQ1_B, 272 GPIO_FN_VI0_R0, GPIO_FN_SSI_SDATA7_C, GPIO_FN_DREQ1_B,
277 GPIO_FN_ARM_TRACEDATA_10, GPIO_FN_DREQ0_C, GPIO_FN_VI0_R1, 273 GPIO_FN_ARM_TRACEDATA_10, GPIO_FN_DREQ0_C, GPIO_FN_VI0_R1,
278 GPIO_FN_SSI_SDATA8_C, GPIO_FN_DACK1_B, GPIO_FN_ARM_TRACEDATA_11, 274 GPIO_FN_SSI_SDATA8_C, GPIO_FN_DACK1_B, GPIO_FN_ARM_TRACEDATA_11,
279 GPIO_FN_DACK0_C, GPIO_FN_DRACK0_C, GPIO_FN_VI0_R2, GPIO_FN_ETH_LINK, 275 GPIO_FN_DACK0_C, GPIO_FN_DRACK0_C, GPIO_FN_VI0_R2, GPIO_FN_ETH_LINK,
280 GPIO_FN_SD2_CLK_B, GPIO_FN_IRQ2, GPIO_FN_ARM_TRACEDATA_12, 276 GPIO_FN_ARM_TRACEDATA_12,
281 GPIO_FN_VI0_R3, GPIO_FN_ETH_MAGIC, GPIO_FN_SD2_CMD_B, GPIO_FN_IRQ3, 277 GPIO_FN_VI0_R3, GPIO_FN_ETH_MAGIC,
282 GPIO_FN_ARM_TRACEDATA_13, GPIO_FN_VI0_R4, GPIO_FN_ETH_REFCLK, 278 GPIO_FN_ARM_TRACEDATA_13, GPIO_FN_VI0_R4, GPIO_FN_ETH_REFCLK,
283 GPIO_FN_SD2_CD_B, GPIO_FN_HSPI_CLK1_B, GPIO_FN_ARM_TRACEDATA_14, 279 GPIO_FN_ARM_TRACEDATA_14,
284 GPIO_FN_MT1_CLK, GPIO_FN_TS_SCK0, GPIO_FN_VI0_R5, GPIO_FN_ETH_TXD0, 280 GPIO_FN_MT1_CLK, GPIO_FN_TS_SCK0, GPIO_FN_VI0_R5, GPIO_FN_ETH_TXD0,
285 GPIO_FN_SD2_WP_B, GPIO_FN_HSPI_CS1_B, GPIO_FN_ARM_TRACEDATA_15, 281 GPIO_FN_ARM_TRACEDATA_15,
286 GPIO_FN_MT1_D, GPIO_FN_TS_SDEN0, GPIO_FN_VI0_R6, GPIO_FN_ETH_MDC, 282 GPIO_FN_MT1_D, GPIO_FN_TS_SDEN0, GPIO_FN_VI0_R6, GPIO_FN_ETH_MDC,
287 GPIO_FN_DREQ2_C, GPIO_FN_HSPI_TX1_B, GPIO_FN_TRACECLK, 283 GPIO_FN_DREQ2_C, GPIO_FN_TRACECLK,
288 GPIO_FN_MT1_BEN, GPIO_FN_PWMFSW0_D, GPIO_FN_VI0_R7, GPIO_FN_ETH_MDIO, 284 GPIO_FN_MT1_BEN, GPIO_FN_PWMFSW0_D, GPIO_FN_VI0_R7, GPIO_FN_ETH_MDIO,
289 GPIO_FN_DACK2_C, GPIO_FN_HSPI_RX1_B, GPIO_FN_SCIF_CLK_D, 285 GPIO_FN_DACK2_C, GPIO_FN_SCIF_CLK_D,
290 GPIO_FN_TRACECTL, GPIO_FN_MT1_PEN, GPIO_FN_VI1_CLK, GPIO_FN_SIM_D, 286 GPIO_FN_TRACECTL, GPIO_FN_MT1_PEN, GPIO_FN_VI1_CLK, GPIO_FN_SIM_D,
291 GPIO_FN_SDA3, GPIO_FN_VI1_HSYNC, GPIO_FN_VI3_CLK, GPIO_FN_SSI_SCK4, 287 GPIO_FN_SDA3, GPIO_FN_VI1_HSYNC, GPIO_FN_VI3_CLK, GPIO_FN_SSI_SCK4,
292 GPIO_FN_GPS_SIGN_C, GPIO_FN_PWMFSW0_E, GPIO_FN_VI1_VSYNC, 288 GPIO_FN_GPS_SIGN_C, GPIO_FN_PWMFSW0_E, GPIO_FN_VI1_VSYNC,
@@ -294,35 +290,35 @@ enum {
294 GPIO_FN_GPS_MAG_C, GPIO_FN_SPV_TRST, GPIO_FN_SCL3, 290 GPIO_FN_GPS_MAG_C, GPIO_FN_SPV_TRST, GPIO_FN_SCL3,
295 291
296 /* IPSR11 */ 292 /* IPSR11 */
297 GPIO_FN_VI1_DATA0_VI1_B0, GPIO_FN_SD2_DAT0, GPIO_FN_SIM_RST, 293 GPIO_FN_VI1_DATA0_VI1_B0, GPIO_FN_SIM_RST,
298 GPIO_FN_SPV_TCK, GPIO_FN_ADICLK_B, GPIO_FN_VI1_DATA1_VI1_B1, 294 GPIO_FN_SPV_TCK, GPIO_FN_ADICLK_B, GPIO_FN_VI1_DATA1_VI1_B1,
299 GPIO_FN_SD2_DAT1, GPIO_FN_MT0_CLK, GPIO_FN_SPV_TMS, 295 GPIO_FN_MT0_CLK, GPIO_FN_SPV_TMS,
300 GPIO_FN_ADICS_B_SAMP_B, GPIO_FN_VI1_DATA2_VI1_B2, GPIO_FN_SD2_DAT2, 296 GPIO_FN_ADICS_B_SAMP_B, GPIO_FN_VI1_DATA2_VI1_B2,
301 GPIO_FN_MT0_D, GPIO_FN_SPVTDI, GPIO_FN_ADIDATA_B, 297 GPIO_FN_MT0_D, GPIO_FN_SPVTDI, GPIO_FN_ADIDATA_B,
302 GPIO_FN_VI1_DATA3_VI1_B3, GPIO_FN_SD2_DAT3, GPIO_FN_MT0_BEN, 298 GPIO_FN_VI1_DATA3_VI1_B3, GPIO_FN_MT0_BEN,
303 GPIO_FN_SPV_TDO, GPIO_FN_ADICHS0_B, GPIO_FN_VI1_DATA4_VI1_B4, 299 GPIO_FN_SPV_TDO, GPIO_FN_ADICHS0_B, GPIO_FN_VI1_DATA4_VI1_B4,
304 GPIO_FN_SD2_CLK, GPIO_FN_MT0_PEN, GPIO_FN_SPA_TRST, 300 GPIO_FN_MT0_PEN, GPIO_FN_SPA_TRST,
305 GPIO_FN_HSPI_CLK1_D, GPIO_FN_ADICHS1_B, GPIO_FN_VI1_DATA5_VI1_B5, 301 GPIO_FN_ADICHS1_B, GPIO_FN_VI1_DATA5_VI1_B5,
306 GPIO_FN_SD2_CMD, GPIO_FN_MT0_SYNC, GPIO_FN_SPA_TCK, 302 GPIO_FN_MT0_SYNC, GPIO_FN_SPA_TCK,
307 GPIO_FN_HSPI_CS1_D, GPIO_FN_ADICHS2_B, GPIO_FN_VI1_DATA6_VI1_B6, 303 GPIO_FN_ADICHS2_B, GPIO_FN_VI1_DATA6_VI1_B6,
308 GPIO_FN_SD2_CD, GPIO_FN_MT0_VCXO, GPIO_FN_SPA_TMS, GPIO_FN_HSPI_TX1_D, 304 GPIO_FN_MT0_VCXO, GPIO_FN_SPA_TMS,
309 GPIO_FN_VI1_DATA7_VI1_B7, GPIO_FN_SD2_WP, GPIO_FN_MT0_PWM, 305 GPIO_FN_VI1_DATA7_VI1_B7, GPIO_FN_MT0_PWM,
310 GPIO_FN_SPA_TDI, GPIO_FN_HSPI_RX1_D, GPIO_FN_VI1_G0, GPIO_FN_VI3_DATA0, 306 GPIO_FN_SPA_TDI, GPIO_FN_VI1_G0, GPIO_FN_VI3_DATA0,
311 GPIO_FN_DU1_DOTCLKOUT1, GPIO_FN_TS_SCK1, GPIO_FN_DREQ2_B, GPIO_FN_TX2, 307 GPIO_FN_TS_SCK1, GPIO_FN_DREQ2_B,
312 GPIO_FN_SPA_TDO, GPIO_FN_HCTS0_B, GPIO_FN_VI1_G1, GPIO_FN_VI3_DATA1, 308 GPIO_FN_SPA_TDO, GPIO_FN_HCTS0_B, GPIO_FN_VI1_G1, GPIO_FN_VI3_DATA1,
313 GPIO_FN_SSI_SCK1, GPIO_FN_TS_SDEN1, GPIO_FN_DACK2_B, GPIO_FN_RX2, 309 GPIO_FN_SSI_SCK1, GPIO_FN_TS_SDEN1, GPIO_FN_DACK2_B,
314 GPIO_FN_HRTS0_B, 310 GPIO_FN_HRTS0_B,
315 311
316 /* IPSR12 */ 312 /* IPSR12 */
317 GPIO_FN_VI1_G2, GPIO_FN_VI3_DATA2, GPIO_FN_SSI_WS1, GPIO_FN_TS_SPSYNC1, 313 GPIO_FN_VI1_G2, GPIO_FN_VI3_DATA2, GPIO_FN_SSI_WS1, GPIO_FN_TS_SPSYNC1,
318 GPIO_FN_SCK2, GPIO_FN_HSCK0_B, GPIO_FN_VI1_G3, GPIO_FN_VI3_DATA3, 314 GPIO_FN_HSCK0_B, GPIO_FN_VI1_G3, GPIO_FN_VI3_DATA3,
319 GPIO_FN_SSI_SCK2, GPIO_FN_TS_SDAT1, GPIO_FN_SCL1_C, GPIO_FN_HTX0_B, 315 GPIO_FN_SSI_SCK2, GPIO_FN_TS_SDAT1, GPIO_FN_SCL1_C, GPIO_FN_HTX0_B,
320 GPIO_FN_VI1_G4, GPIO_FN_VI3_DATA4, GPIO_FN_SSI_WS2, GPIO_FN_SDA1_C, 316 GPIO_FN_VI1_G4, GPIO_FN_VI3_DATA4, GPIO_FN_SSI_WS2, GPIO_FN_SDA1_C,
321 GPIO_FN_SIM_RST_B, GPIO_FN_HRX0_B, GPIO_FN_VI1_G5, GPIO_FN_VI3_DATA5, 317 GPIO_FN_SIM_RST_B, GPIO_FN_HRX0_B, GPIO_FN_VI1_G5, GPIO_FN_VI3_DATA5,
322 GPIO_FN_GPS_CLK, GPIO_FN_FSE, GPIO_FN_TX4_B, GPIO_FN_SIM_D_B, 318 GPIO_FN_GPS_CLK, GPIO_FN_FSE, GPIO_FN_SIM_D_B,
323 GPIO_FN_VI1_G6, GPIO_FN_VI3_DATA6, GPIO_FN_GPS_SIGN, GPIO_FN_FRB, 319 GPIO_FN_VI1_G6, GPIO_FN_VI3_DATA6, GPIO_FN_GPS_SIGN, GPIO_FN_FRB,
324 GPIO_FN_RX4_B, GPIO_FN_SIM_CLK_B, GPIO_FN_VI1_G7, GPIO_FN_VI3_DATA7, 320 GPIO_FN_SIM_CLK_B, GPIO_FN_VI1_G7, GPIO_FN_VI3_DATA7,
325 GPIO_FN_GPS_MAG, GPIO_FN_FCE, GPIO_FN_SCK4_B, 321 GPIO_FN_GPS_MAG, GPIO_FN_FCE,
326}; 322};
327 323
328struct platform_device; 324struct platform_device;
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index b582facc1cf6..7ded4ebaf5cc 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -294,21 +294,6 @@ enum {
294 GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, GPIO_FN_D14_NAF14, 294 GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, GPIO_FN_D14_NAF14,
295 GPIO_FN_D15_NAF15, 295 GPIO_FN_D15_NAF15,
296 296
297 /*
298 * MMCIF(1) (PORT 84, 85, 86, 87, 88, 89,
299 * 90, 91, 92, 99)
300 */
301 GPIO_FN_MMCD0_0, GPIO_FN_MMCD0_1, GPIO_FN_MMCD0_2,
302 GPIO_FN_MMCD0_3, GPIO_FN_MMCD0_4, GPIO_FN_MMCD0_5,
303 GPIO_FN_MMCD0_6, GPIO_FN_MMCD0_7,
304 GPIO_FN_MMCCMD0, GPIO_FN_MMCCLK0,
305
306 /* MMCIF(2) (PORT 54, 55, 56, 57, 58, 59, 60, 61, 66, 67) */
307 GPIO_FN_MMCD1_0, GPIO_FN_MMCD1_1, GPIO_FN_MMCD1_2,
308 GPIO_FN_MMCD1_3, GPIO_FN_MMCD1_4, GPIO_FN_MMCD1_5,
309 GPIO_FN_MMCD1_6, GPIO_FN_MMCD1_7,
310 GPIO_FN_MMCCLK1, GPIO_FN_MMCCMD1,
311
312 /* SPU2 (PORT 65) */ 297 /* SPU2 (PORT 65) */
313 GPIO_FN_VINT_I, 298 GPIO_FN_VINT_I,
314 299
@@ -416,20 +401,6 @@ enum {
416 /* HDMI (PORT 169, 170) */ 401 /* HDMI (PORT 169, 170) */
417 GPIO_FN_HDMI_HPD, GPIO_FN_HDMI_CEC, 402 GPIO_FN_HDMI_HPD, GPIO_FN_HDMI_CEC,
418 403
419 /* SDHI0 (PORT 171, 172, 173, 174, 175, 176, 177, 178) */
420 GPIO_FN_SDHICLK0, GPIO_FN_SDHICD0,
421 GPIO_FN_SDHICMD0, GPIO_FN_SDHIWP0,
422 GPIO_FN_SDHID0_0, GPIO_FN_SDHID0_1,
423 GPIO_FN_SDHID0_2, GPIO_FN_SDHID0_3,
424
425 /* SDHI1 (PORT 179, 180, 181, 182, 183, 184) */
426 GPIO_FN_SDHICLK1, GPIO_FN_SDHICMD1, GPIO_FN_SDHID1_0,
427 GPIO_FN_SDHID1_1, GPIO_FN_SDHID1_2, GPIO_FN_SDHID1_3,
428
429 /* SDHI2 (PORT 185, 186, 187, 188, 189, 190) */
430 GPIO_FN_SDHICLK2, GPIO_FN_SDHICMD2, GPIO_FN_SDHID2_0,
431 GPIO_FN_SDHID2_1, GPIO_FN_SDHID2_2, GPIO_FN_SDHID2_3,
432
433 /* SDENC see MSEL4CR 19 */ 404 /* SDENC see MSEL4CR 19 */
434 GPIO_FN_SDENC_CPG, 405 GPIO_FN_SDENC_CPG,
435 GPIO_FN_SDENC_DV_CLKI, 406 GPIO_FN_SDENC_DV_CLKI,
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index 606d31d02a4e..fbc1584d6712 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -94,8 +94,7 @@ enum {
94 GPIO_PORT305, GPIO_PORT306, GPIO_PORT307, GPIO_PORT308, GPIO_PORT309, 94 GPIO_PORT305, GPIO_PORT306, GPIO_PORT307, GPIO_PORT308, GPIO_PORT309,
95 95
96 /* Table 25-1 (Function 0-7) */ 96 /* Table 25-1 (Function 0-7) */
97 GPIO_FN_VBUS_0, 97 GPIO_FN_GPI0 = 310,
98 GPIO_FN_GPI0,
99 GPIO_FN_GPI1, 98 GPIO_FN_GPI1,
100 GPIO_FN_GPI2, 99 GPIO_FN_GPI2,
101 GPIO_FN_GPI3, 100 GPIO_FN_GPI3,
@@ -103,15 +102,11 @@ enum {
103 GPIO_FN_GPI5, 102 GPIO_FN_GPI5,
104 GPIO_FN_GPI6, 103 GPIO_FN_GPI6,
105 GPIO_FN_GPI7, 104 GPIO_FN_GPI7,
106 GPIO_FN_SCIFA7_RXD,
107 GPIO_FN_SCIFA7_CTS_,
108 GPIO_FN_GPO7, GPIO_FN_MFG0_OUT2, 105 GPIO_FN_GPO7, GPIO_FN_MFG0_OUT2,
109 GPIO_FN_GPO6, GPIO_FN_MFG1_OUT2, 106 GPIO_FN_GPO6, GPIO_FN_MFG1_OUT2,
110 GPIO_FN_GPO5, GPIO_FN_SCIFA0_SCK, GPIO_FN_FSICOSLDT3, \ 107 GPIO_FN_GPO5,
111 GPIO_FN_PORT16_VIO_CKOR, 108 GPIO_FN_PORT16_VIO_CKOR,
112 GPIO_FN_SCIFA0_TXD, 109 GPIO_FN_PORT19_VIO_CKO2,
113 GPIO_FN_SCIFA7_TXD,
114 GPIO_FN_SCIFA7_RTS_, GPIO_FN_PORT19_VIO_CKO2,
115 GPIO_FN_GPO0, 110 GPIO_FN_GPO0,
116 GPIO_FN_GPO1, 111 GPIO_FN_GPO1,
117 GPIO_FN_GPO2, GPIO_FN_STATUS0, 112 GPIO_FN_GPO2, GPIO_FN_STATUS0,
@@ -119,83 +114,44 @@ enum {
119 GPIO_FN_GPO4, GPIO_FN_STATUS2, 114 GPIO_FN_GPO4, GPIO_FN_STATUS2,
120 GPIO_FN_VINT, 115 GPIO_FN_VINT,
121 GPIO_FN_TCKON, 116 GPIO_FN_TCKON,
122 GPIO_FN_XDVFS1, GPIO_FN_PORT27_I2C_SCL2, GPIO_FN_PORT27_I2C_SCL3, \ 117 GPIO_FN_XDVFS1,
123 GPIO_FN_MFG0_OUT1, GPIO_FN_PORT27_IROUT, 118 GPIO_FN_MFG0_OUT1, GPIO_FN_PORT27_IROUT,
124 GPIO_FN_XDVFS2, GPIO_FN_PORT28_I2C_SDA2, GPIO_FN_PORT28_I2C_SDA3, \ 119 GPIO_FN_XDVFS2,
125 GPIO_FN_PORT28_TPU1TO1, 120 GPIO_FN_PORT28_TPU1TO1,
126 GPIO_FN_SIM_RST, GPIO_FN_PORT29_TPU1TO1, 121 GPIO_FN_SIM_RST, GPIO_FN_PORT29_TPU1TO1,
127 GPIO_FN_SIM_CLK, GPIO_FN_PORT30_VIO_CKOR, 122 GPIO_FN_SIM_CLK, GPIO_FN_PORT30_VIO_CKOR,
128 GPIO_FN_SIM_D, GPIO_FN_PORT31_IROUT, 123 GPIO_FN_SIM_D, GPIO_FN_PORT31_IROUT,
129 GPIO_FN_SCIFA4_TXD, 124 GPIO_FN_XWUP,
130 GPIO_FN_SCIFA4_RXD, GPIO_FN_XWUP,
131 GPIO_FN_SCIFA4_RTS_,
132 GPIO_FN_SCIFA4_CTS_,
133 GPIO_FN_FSIBOBT, GPIO_FN_FSIBIBT,
134 GPIO_FN_FSIBOLR, GPIO_FN_FSIBILR,
135 GPIO_FN_FSIBOSLD,
136 GPIO_FN_FSIBISLD,
137 GPIO_FN_VACK, 125 GPIO_FN_VACK,
138 GPIO_FN_XTAL1L, 126 GPIO_FN_XTAL1L,
139 GPIO_FN_SCIFA0_RTS_, GPIO_FN_FSICOSLDT2, 127 GPIO_FN_PORT49_IROUT,
140 GPIO_FN_SCIFA0_RXD, 128 GPIO_FN_BBIF2_TSYNC2, GPIO_FN_TPU2TO2,
141 GPIO_FN_SCIFA0_CTS_, GPIO_FN_FSICOSLDT1, 129
142 GPIO_FN_FSICOBT, GPIO_FN_FSICIBT, GPIO_FN_FSIDOBT, GPIO_FN_FSIDIBT, 130 GPIO_FN_BBIF2_TSCK2, GPIO_FN_TPU2TO3,
143 GPIO_FN_FSICOLR, GPIO_FN_FSICILR, GPIO_FN_FSIDOLR, GPIO_FN_FSIDILR, 131 GPIO_FN_BBIF2_TXD2,
144 GPIO_FN_FSICOSLD, GPIO_FN_PORT47_FSICSPDIF, 132 GPIO_FN_TPU3TO3,
145 GPIO_FN_FSICISLD, GPIO_FN_FSIDISLD, 133 GPIO_FN_TPU3TO2,
146 GPIO_FN_FSIACK, GPIO_FN_PORT49_IRDA_OUT, GPIO_FN_PORT49_IROUT, \ 134 GPIO_FN_TPU0TO0,
147 GPIO_FN_FSIAOMC,
148 GPIO_FN_FSIAOLR, GPIO_FN_BBIF2_TSYNC2, GPIO_FN_TPU2TO2, GPIO_FN_FSIAILR,
149
150 GPIO_FN_FSIAOBT, GPIO_FN_BBIF2_TSCK2, GPIO_FN_TPU2TO3, GPIO_FN_FSIAIBT,
151 GPIO_FN_FSIAOSLD, GPIO_FN_BBIF2_TXD2,
152 GPIO_FN_FSIASPDIF, GPIO_FN_PORT53_IRDA_IN, GPIO_FN_TPU3TO3, \
153 GPIO_FN_FSIBSPDIF, GPIO_FN_PORT53_FSICSPDIF,
154 GPIO_FN_FSIBCK, GPIO_FN_PORT54_IRDA_FIRSEL, GPIO_FN_TPU3TO2, \
155 GPIO_FN_FSIBOMC, GPIO_FN_FSICCK, GPIO_FN_FSICOMC,
156 GPIO_FN_FSIAISLD, GPIO_FN_TPU0TO0,
157 GPIO_FN_A0, GPIO_FN_BS_, 135 GPIO_FN_A0, GPIO_FN_BS_,
158 GPIO_FN_A12, GPIO_FN_PORT58_KEYOUT7, GPIO_FN_TPU4TO2, 136 GPIO_FN_A12, GPIO_FN_TPU4TO2,
159 GPIO_FN_A13, GPIO_FN_PORT59_KEYOUT6, GPIO_FN_TPU0TO1, 137 GPIO_FN_A13, GPIO_FN_TPU0TO1,
160 GPIO_FN_A14, GPIO_FN_KEYOUT5, 138 GPIO_FN_A14,
161 GPIO_FN_A15, GPIO_FN_KEYOUT4, 139 GPIO_FN_A15,
162 GPIO_FN_A16, GPIO_FN_KEYOUT3, GPIO_FN_MSIOF0_SS1, 140 GPIO_FN_A16, GPIO_FN_MSIOF0_SS1,
163 GPIO_FN_A17, GPIO_FN_KEYOUT2, GPIO_FN_MSIOF0_TSYNC, 141 GPIO_FN_A17, GPIO_FN_MSIOF0_TSYNC,
164 GPIO_FN_A18, GPIO_FN_KEYOUT1, GPIO_FN_MSIOF0_TSCK, 142 GPIO_FN_A18, GPIO_FN_MSIOF0_TSCK,
165 GPIO_FN_A19, GPIO_FN_KEYOUT0, GPIO_FN_MSIOF0_TXD, 143 GPIO_FN_A19, GPIO_FN_MSIOF0_TXD,
166 GPIO_FN_A20, GPIO_FN_KEYIN0, GPIO_FN_MSIOF0_RSCK, 144 GPIO_FN_A20, GPIO_FN_MSIOF0_RSCK,
167 GPIO_FN_A21, GPIO_FN_KEYIN1, GPIO_FN_MSIOF0_RSYNC, 145 GPIO_FN_A21, GPIO_FN_MSIOF0_RSYNC,
168 GPIO_FN_A22, GPIO_FN_KEYIN2, GPIO_FN_MSIOF0_MCK0, 146 GPIO_FN_A22, GPIO_FN_MSIOF0_MCK0,
169 GPIO_FN_A23, GPIO_FN_KEYIN3, GPIO_FN_MSIOF0_MCK1, 147 GPIO_FN_A23, GPIO_FN_MSIOF0_MCK1,
170 GPIO_FN_A24, GPIO_FN_KEYIN4, GPIO_FN_MSIOF0_RXD, 148 GPIO_FN_A24, GPIO_FN_MSIOF0_RXD,
171 GPIO_FN_A25, GPIO_FN_KEYIN5, GPIO_FN_MSIOF0_SS2, 149 GPIO_FN_A25, GPIO_FN_MSIOF0_SS2,
172 GPIO_FN_A26, GPIO_FN_KEYIN6, 150 GPIO_FN_A26,
173 GPIO_FN_KEYIN7, 151 GPIO_FN_FCE1_,
174 GPIO_FN_D0_NAF0, 152 GPIO_FN_DACK0,
175 GPIO_FN_D1_NAF1, 153 GPIO_FN_FCE0_,
176 GPIO_FN_D2_NAF2,
177 GPIO_FN_D3_NAF3,
178 GPIO_FN_D4_NAF4,
179 GPIO_FN_D5_NAF5,
180 GPIO_FN_D6_NAF6,
181 GPIO_FN_D7_NAF7,
182 GPIO_FN_D8_NAF8,
183 GPIO_FN_D9_NAF9,
184 GPIO_FN_D10_NAF10,
185 GPIO_FN_D11_NAF11,
186 GPIO_FN_D12_NAF12,
187 GPIO_FN_D13_NAF13,
188 GPIO_FN_D14_NAF14,
189 GPIO_FN_D15_NAF15,
190 GPIO_FN_CS4_,
191 GPIO_FN_CS5A_, GPIO_FN_PORT91_RDWR,
192 GPIO_FN_CS5B_, GPIO_FN_FCE1_,
193 GPIO_FN_CS6B_, GPIO_FN_DACK0,
194 GPIO_FN_FCE0_, GPIO_FN_CS6A_,
195 GPIO_FN_WAIT_, GPIO_FN_DREQ0, 154 GPIO_FN_WAIT_, GPIO_FN_DREQ0,
196 GPIO_FN_RD__FSC,
197 GPIO_FN_WE0__FWE, GPIO_FN_RDWR_FWE,
198 GPIO_FN_WE1_,
199 GPIO_FN_FRB, 155 GPIO_FN_FRB,
200 GPIO_FN_CKO, 156 GPIO_FN_CKO,
201 GPIO_FN_NBRSTOUT_, 157 GPIO_FN_NBRSTOUT_,
@@ -204,145 +160,118 @@ enum {
204 GPIO_FN_BBIF2_RXD, 160 GPIO_FN_BBIF2_RXD,
205 GPIO_FN_BBIF2_SYNC, 161 GPIO_FN_BBIF2_SYNC,
206 GPIO_FN_BBIF2_SCK, 162 GPIO_FN_BBIF2_SCK,
207 GPIO_FN_SCIFA3_CTS_, GPIO_FN_MFG3_IN2, 163 GPIO_FN_MFG3_IN2,
208 GPIO_FN_SCIFA3_RXD, GPIO_FN_MFG3_IN1, 164 GPIO_FN_MFG3_IN1,
209 GPIO_FN_BBIF1_SS2, GPIO_FN_SCIFA3_RTS_, GPIO_FN_MFG3_OUT1, 165 GPIO_FN_BBIF1_SS2, GPIO_FN_MFG3_OUT1,
210 GPIO_FN_SCIFA3_TXD,
211 GPIO_FN_HSI_RX_DATA, GPIO_FN_BBIF1_RXD, 166 GPIO_FN_HSI_RX_DATA, GPIO_FN_BBIF1_RXD,
212 GPIO_FN_HSI_TX_WAKE, GPIO_FN_BBIF1_TSCK, 167 GPIO_FN_HSI_TX_WAKE, GPIO_FN_BBIF1_TSCK,
213 GPIO_FN_HSI_TX_DATA, GPIO_FN_BBIF1_TSYNC, 168 GPIO_FN_HSI_TX_DATA, GPIO_FN_BBIF1_TSYNC,
214 GPIO_FN_HSI_TX_READY, GPIO_FN_BBIF1_TXD, 169 GPIO_FN_HSI_TX_READY, GPIO_FN_BBIF1_TXD,
215 GPIO_FN_HSI_RX_READY, GPIO_FN_BBIF1_RSCK, GPIO_FN_PORT115_I2C_SCL2, \ 170 GPIO_FN_HSI_RX_READY, GPIO_FN_BBIF1_RSCK,
216 GPIO_FN_PORT115_I2C_SCL3, 171 GPIO_FN_HSI_RX_WAKE, GPIO_FN_BBIF1_RSYNC,
217 GPIO_FN_HSI_RX_WAKE, GPIO_FN_BBIF1_RSYNC, GPIO_FN_PORT116_I2C_SDA2, \
218 GPIO_FN_PORT116_I2C_SDA3,
219 GPIO_FN_HSI_RX_FLAG, GPIO_FN_BBIF1_SS1, GPIO_FN_BBIF1_FLOW, 172 GPIO_FN_HSI_RX_FLAG, GPIO_FN_BBIF1_SS1, GPIO_FN_BBIF1_FLOW,
220 GPIO_FN_HSI_TX_FLAG, 173 GPIO_FN_HSI_TX_FLAG,
221 GPIO_FN_VIO_VD, GPIO_FN_PORT128_LCD2VSYN, GPIO_FN_VIO2_VD, \ 174 GPIO_FN_VIO_VD, GPIO_FN_VIO2_VD,
222 GPIO_FN_LCD2D0, 175
223 176 GPIO_FN_VIO_HD,
224 GPIO_FN_VIO_HD, GPIO_FN_PORT129_LCD2HSYN, GPIO_FN_PORT129_LCD2CS_, \ 177 GPIO_FN_VIO2_HD,
225 GPIO_FN_VIO2_HD, GPIO_FN_LCD2D1, 178 GPIO_FN_VIO_D0, GPIO_FN_PORT130_MSIOF2_RXD,
226 GPIO_FN_VIO_D0, GPIO_FN_PORT130_MSIOF2_RXD, GPIO_FN_LCD2D10, 179 GPIO_FN_VIO_D1, GPIO_FN_PORT131_MSIOF2_SS1,
227 GPIO_FN_VIO_D1, GPIO_FN_PORT131_KEYOUT6, GPIO_FN_PORT131_MSIOF2_SS1, \ 180 GPIO_FN_VIO_D2, GPIO_FN_PORT132_MSIOF2_SS2,
228 GPIO_FN_PORT131_KEYOUT11, GPIO_FN_LCD2D11, 181 GPIO_FN_VIO_D3, GPIO_FN_MSIOF2_TSYNC,
229 GPIO_FN_VIO_D2, GPIO_FN_PORT132_KEYOUT7, GPIO_FN_PORT132_MSIOF2_SS2, \ 182 GPIO_FN_VIO_D4, GPIO_FN_MSIOF2_TXD,
230 GPIO_FN_PORT132_KEYOUT10, GPIO_FN_LCD2D12, 183 GPIO_FN_VIO_D5, GPIO_FN_MSIOF2_TSCK,
231 GPIO_FN_VIO_D3, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_LCD2D13, 184 GPIO_FN_VIO_D6,
232 GPIO_FN_VIO_D4, GPIO_FN_MSIOF2_TXD, GPIO_FN_LCD2D14, 185 GPIO_FN_VIO_D7,
233 GPIO_FN_VIO_D5, GPIO_FN_MSIOF2_TSCK, GPIO_FN_LCD2D15, 186 GPIO_FN_VIO_D8, GPIO_FN_VIO2_D0,
234 GPIO_FN_VIO_D6, GPIO_FN_PORT136_KEYOUT8, GPIO_FN_LCD2D16, 187 GPIO_FN_VIO_D9, GPIO_FN_VIO2_D1,
235 GPIO_FN_VIO_D7, GPIO_FN_PORT137_KEYOUT9, GPIO_FN_LCD2D17, 188 GPIO_FN_VIO_D10, GPIO_FN_TPU0TO2, GPIO_FN_VIO2_D2,
236 GPIO_FN_VIO_D8, GPIO_FN_PORT138_KEYOUT8, GPIO_FN_VIO2_D0, \ 189 GPIO_FN_VIO_D11, GPIO_FN_TPU0TO3, GPIO_FN_VIO2_D3,
237 GPIO_FN_LCD2D6, 190 GPIO_FN_VIO_D12, GPIO_FN_VIO2_D4,
238 GPIO_FN_VIO_D9, GPIO_FN_PORT139_KEYOUT9, GPIO_FN_VIO2_D1, \ 191 GPIO_FN_VIO_D13,
239 GPIO_FN_LCD2D7, 192 GPIO_FN_VIO2_D5,
240 GPIO_FN_VIO_D10, GPIO_FN_TPU0TO2, GPIO_FN_VIO2_D2, GPIO_FN_LCD2D8, 193 GPIO_FN_VIO_D14, GPIO_FN_VIO2_D6,
241 GPIO_FN_VIO_D11, GPIO_FN_TPU0TO3, GPIO_FN_VIO2_D3, GPIO_FN_LCD2D9, 194 GPIO_FN_VIO_D15, GPIO_FN_TPU1TO3,
242 GPIO_FN_VIO_D12, GPIO_FN_PORT142_KEYOUT10, GPIO_FN_VIO2_D4, \ 195 GPIO_FN_VIO2_D7,
243 GPIO_FN_LCD2D2, 196 GPIO_FN_VIO_CLK,
244 GPIO_FN_VIO_D13, GPIO_FN_PORT143_KEYOUT11, GPIO_FN_PORT143_KEYOUT6, \ 197 GPIO_FN_VIO2_CLK,
245 GPIO_FN_VIO2_D5, GPIO_FN_LCD2D3, 198 GPIO_FN_VIO_FIELD, GPIO_FN_VIO2_FIELD,
246 GPIO_FN_VIO_D14, GPIO_FN_PORT144_KEYOUT7, GPIO_FN_VIO2_D6, \
247 GPIO_FN_LCD2D4,
248 GPIO_FN_VIO_D15, GPIO_FN_TPU1TO3, GPIO_FN_PORT145_LCD2DISP, \
249 GPIO_FN_PORT145_LCD2RS, GPIO_FN_VIO2_D7, GPIO_FN_LCD2D5,
250 GPIO_FN_VIO_CLK, GPIO_FN_LCD2DCK, GPIO_FN_PORT146_LCD2WR_, \
251 GPIO_FN_VIO2_CLK, GPIO_FN_LCD2D18,
252 GPIO_FN_VIO_FIELD, GPIO_FN_LCD2RD_, GPIO_FN_VIO2_FIELD, GPIO_FN_LCD2D19,
253 GPIO_FN_VIO_CKO, 199 GPIO_FN_VIO_CKO,
254 GPIO_FN_A27, GPIO_FN_PORT149_RDWR, GPIO_FN_MFG0_IN1, \ 200 GPIO_FN_A27, GPIO_FN_MFG0_IN1,
255 GPIO_FN_PORT149_KEYOUT9,
256 GPIO_FN_MFG0_IN2, 201 GPIO_FN_MFG0_IN2,
257 GPIO_FN_TS_SPSYNC3, GPIO_FN_MSIOF2_RSCK, 202 GPIO_FN_TS_SPSYNC3, GPIO_FN_MSIOF2_RSCK,
258 GPIO_FN_TS_SDAT3, GPIO_FN_MSIOF2_RSYNC, 203 GPIO_FN_TS_SDAT3, GPIO_FN_MSIOF2_RSYNC,
259 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT153_MSIOF2_SS1, 204 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT153_MSIOF2_SS1,
260 GPIO_FN_SCIFA2_TXD1, GPIO_FN_MSIOF2_MCK0, 205 GPIO_FN_MSIOF2_MCK0,
261 GPIO_FN_SCIFA2_RXD1, GPIO_FN_MSIOF2_MCK1, 206 GPIO_FN_MSIOF2_MCK1,
262 GPIO_FN_SCIFA2_RTS1_, GPIO_FN_PORT156_MSIOF2_SS2, 207 GPIO_FN_PORT156_MSIOF2_SS2,
263 GPIO_FN_SCIFA2_CTS1_, GPIO_FN_PORT157_MSIOF2_RXD, 208 GPIO_FN_PORT157_MSIOF2_RXD,
264 GPIO_FN_DINT_, GPIO_FN_SCIFA2_SCK1, GPIO_FN_TS_SCK3, 209 GPIO_FN_DINT_, GPIO_FN_TS_SCK3,
265 GPIO_FN_PORT159_SCIFB_SCK, GPIO_FN_PORT159_SCIFA5_SCK, GPIO_FN_NMI, 210 GPIO_FN_NMI,
266 GPIO_FN_PORT160_SCIFB_TXD, GPIO_FN_PORT160_SCIFA5_TXD,
267 GPIO_FN_PORT161_SCIFB_CTS_, GPIO_FN_PORT161_SCIFA5_CTS_,
268 GPIO_FN_PORT162_SCIFB_RXD, GPIO_FN_PORT162_SCIFA5_RXD,
269 GPIO_FN_PORT163_SCIFB_RTS_, GPIO_FN_PORT163_SCIFA5_RTS_, \
270 GPIO_FN_TPU3TO0, 211 GPIO_FN_TPU3TO0,
271 GPIO_FN_LCDD0, 212 GPIO_FN_BBIF2_TSYNC1,
272 GPIO_FN_LCDD1, GPIO_FN_PORT193_SCIFA5_CTS_, GPIO_FN_BBIF2_TSYNC1, 213 GPIO_FN_BBIF2_TSCK1,
273 GPIO_FN_LCDD2, GPIO_FN_PORT194_SCIFA5_RTS_, GPIO_FN_BBIF2_TSCK1, 214 GPIO_FN_BBIF2_TXD1,
274 GPIO_FN_LCDD3, GPIO_FN_PORT195_SCIFA5_RXD, GPIO_FN_BBIF2_TXD1, 215 GPIO_FN_MFG2_OUT2,
275 GPIO_FN_LCDD4, GPIO_FN_PORT196_SCIFA5_TXD,
276 GPIO_FN_LCDD5, GPIO_FN_PORT197_SCIFA5_SCK, GPIO_FN_MFG2_OUT2, \
277 GPIO_FN_TPU2TO1, 216 GPIO_FN_TPU2TO1,
278 GPIO_FN_LCDD6, 217 GPIO_FN_TPU4TO1, GPIO_FN_MFG4_OUT2,
279 GPIO_FN_LCDD7, GPIO_FN_TPU4TO1, GPIO_FN_MFG4_OUT2, 218 GPIO_FN_D16,
280 GPIO_FN_LCDD8, GPIO_FN_D16, 219 GPIO_FN_D17,
281 GPIO_FN_LCDD9, GPIO_FN_D17, 220 GPIO_FN_D18,
282 GPIO_FN_LCDD10, GPIO_FN_D18, 221 GPIO_FN_D19,
283 GPIO_FN_LCDD11, GPIO_FN_D19, 222 GPIO_FN_D20,
284 GPIO_FN_LCDD12, GPIO_FN_D20, 223 GPIO_FN_D21,
285 GPIO_FN_LCDD13, GPIO_FN_D21, 224 GPIO_FN_D22,
286 GPIO_FN_LCDD14, GPIO_FN_D22, 225 GPIO_FN_PORT207_MSIOF0L_SS1, GPIO_FN_D23,
287 GPIO_FN_LCDD15, GPIO_FN_PORT207_MSIOF0L_SS1, GPIO_FN_D23, 226 GPIO_FN_PORT208_MSIOF0L_SS2, GPIO_FN_D24,
288 GPIO_FN_LCDD16, GPIO_FN_PORT208_MSIOF0L_SS2, GPIO_FN_D24, 227 GPIO_FN_D25,
289 GPIO_FN_LCDD17, GPIO_FN_D25, 228 GPIO_FN_DREQ2, GPIO_FN_PORT210_MSIOF0L_SS1, GPIO_FN_D26,
290 GPIO_FN_LCDD18, GPIO_FN_DREQ2, GPIO_FN_PORT210_MSIOF0L_SS1, GPIO_FN_D26, 229 GPIO_FN_PORT211_MSIOF0L_SS2, GPIO_FN_D27,
291 GPIO_FN_LCDD19, GPIO_FN_PORT211_MSIOF0L_SS2, GPIO_FN_D27, 230 GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0, GPIO_FN_D28,
292 GPIO_FN_LCDD20, GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0, GPIO_FN_D28, 231 GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1, GPIO_FN_D29,
293 GPIO_FN_LCDD21, GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1, GPIO_FN_D29, 232 GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_RSCK, GPIO_FN_D30,
294 GPIO_FN_LCDD22, GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_RSCK, GPIO_FN_D30, 233 GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_RSYNC, GPIO_FN_D31,
295 GPIO_FN_LCDD23, GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_RSYNC, GPIO_FN_D31, 234 GPIO_FN_DACK2,
296 GPIO_FN_LCDDCK, GPIO_FN_LCDWR_, 235 GPIO_FN_MSIOF0L_TSYNC, GPIO_FN_VIO2_FIELD3,
297 GPIO_FN_LCDRD_, GPIO_FN_DACK2, GPIO_FN_PORT217_LCD2RS, \ 236 GPIO_FN_DACK3,
298 GPIO_FN_MSIOF0L_TSYNC, GPIO_FN_VIO2_FIELD3, GPIO_FN_PORT217_LCD2DISP,
299 GPIO_FN_LCDHSYN, GPIO_FN_LCDCS_, GPIO_FN_LCDCS2_, GPIO_FN_DACK3, \
300 GPIO_FN_PORT218_VIO_CKOR, 237 GPIO_FN_PORT218_VIO_CKOR,
301 GPIO_FN_LCDDISP, GPIO_FN_LCDRS, GPIO_FN_PORT219_LCD2WR_, \
302 GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_TSCK, GPIO_FN_VIO2_CLK3, \ 238 GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_TSCK, GPIO_FN_VIO2_CLK3, \
303 GPIO_FN_LCD2DCK_2, 239 GPIO_FN_DREQ1,
304 GPIO_FN_LCDVSYN, GPIO_FN_LCDVSYN2,
305 GPIO_FN_LCDLCLK, GPIO_FN_DREQ1, GPIO_FN_PORT221_LCD2CS_, \
306 GPIO_FN_PWEN, GPIO_FN_MSIOF0L_RXD, GPIO_FN_VIO2_HD3, \ 240 GPIO_FN_PWEN, GPIO_FN_MSIOF0L_RXD, GPIO_FN_VIO2_HD3, \
307 GPIO_FN_PORT221_LCD2HSYN, 241 GPIO_FN_DACK1, GPIO_FN_OVCN,
308 GPIO_FN_LCDDON, GPIO_FN_LCDDON2, GPIO_FN_DACK1, GPIO_FN_OVCN, \ 242 GPIO_FN_MSIOF0L_TXD, GPIO_FN_VIO2_VD3,
309 GPIO_FN_MSIOF0L_TXD, GPIO_FN_VIO2_VD3, GPIO_FN_PORT222_LCD2VSYN, 243
310 244 GPIO_FN_OVCN2,
311 GPIO_FN_SCIFA1_TXD, GPIO_FN_OVCN2, 245 GPIO_FN_EXTLP, GPIO_FN_PORT226_VIO_CKO2,
312 GPIO_FN_EXTLP, GPIO_FN_SCIFA1_SCK, GPIO_FN_PORT226_VIO_CKO2, 246 GPIO_FN_IDIN,
313 GPIO_FN_SCIFA1_RTS_, GPIO_FN_IDIN, 247 GPIO_FN_MFG1_IN1,
314 GPIO_FN_SCIFA1_RXD, 248 GPIO_FN_MSIOF1_TXD,
315 GPIO_FN_SCIFA1_CTS_, GPIO_FN_MFG1_IN1, 249 GPIO_FN_MSIOF1_TSYNC,
316 GPIO_FN_MSIOF1_TXD, GPIO_FN_SCIFA2_TXD2, 250 GPIO_FN_MSIOF1_TSCK,
317 GPIO_FN_MSIOF1_TSYNC, GPIO_FN_SCIFA2_CTS2_, 251 GPIO_FN_MSIOF1_RXD,
318 GPIO_FN_MSIOF1_TSCK, GPIO_FN_SCIFA2_SCK2, 252 GPIO_FN_MSIOF1_RSCK, GPIO_FN_VIO2_CLK2,
319 GPIO_FN_MSIOF1_RXD, GPIO_FN_SCIFA2_RXD2,
320 GPIO_FN_MSIOF1_RSCK, GPIO_FN_SCIFA2_RTS2_, GPIO_FN_VIO2_CLK2, \
321 GPIO_FN_LCD2D20,
322 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_MFG1_IN2, GPIO_FN_VIO2_VD2, \ 253 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_MFG1_IN2, GPIO_FN_VIO2_VD2, \
323 GPIO_FN_LCD2D21, 254 GPIO_FN_MSIOF1_MCK0,
324 GPIO_FN_MSIOF1_MCK0, GPIO_FN_PORT236_I2C_SDA2, 255 GPIO_FN_MSIOF1_MCK1,
325 GPIO_FN_MSIOF1_MCK1, GPIO_FN_PORT237_I2C_SCL2, 256 GPIO_FN_MSIOF1_SS1, GPIO_FN_VIO2_FIELD2,
326 GPIO_FN_MSIOF1_SS1, GPIO_FN_VIO2_FIELD2, GPIO_FN_LCD2D22, 257 GPIO_FN_MSIOF1_SS2, GPIO_FN_VIO2_HD2,
327 GPIO_FN_MSIOF1_SS2, GPIO_FN_VIO2_HD2, GPIO_FN_LCD2D23, 258 GPIO_FN_PORT241_IROUT, GPIO_FN_MFG4_OUT1, \
328 GPIO_FN_SCIFA6_TXD,
329 GPIO_FN_PORT241_IRDA_OUT, GPIO_FN_PORT241_IROUT, GPIO_FN_MFG4_OUT1, \
330 GPIO_FN_TPU4TO0, 259 GPIO_FN_TPU4TO0,
331 GPIO_FN_PORT242_IRDA_IN, GPIO_FN_MFG4_IN2, 260 GPIO_FN_MFG4_IN2,
332 GPIO_FN_PORT243_IRDA_FIRSEL, GPIO_FN_PORT243_VIO_CKO2, 261 GPIO_FN_PORT243_VIO_CKO2,
333 GPIO_FN_PORT244_SCIFA5_CTS_, GPIO_FN_MFG2_IN1, \ 262 GPIO_FN_MFG2_IN1,
334 GPIO_FN_PORT244_SCIFB_CTS_, GPIO_FN_MSIOF2R_RXD, 263 GPIO_FN_MSIOF2R_RXD,
335 GPIO_FN_PORT245_SCIFA5_RTS_, GPIO_FN_MFG2_IN2, \ 264 GPIO_FN_MFG2_IN2,
336 GPIO_FN_PORT245_SCIFB_RTS_, GPIO_FN_MSIOF2R_TXD, 265 GPIO_FN_MSIOF2R_TXD,
337 GPIO_FN_PORT246_SCIFA5_RXD, GPIO_FN_MFG1_OUT1, \ 266 GPIO_FN_MFG1_OUT1,
338 GPIO_FN_PORT246_SCIFB_RXD, GPIO_FN_TPU1TO0, 267 GPIO_FN_TPU1TO0,
339 GPIO_FN_PORT247_SCIFA5_TXD, GPIO_FN_MFG3_OUT2, \ 268 GPIO_FN_MFG3_OUT2,
340 GPIO_FN_PORT247_SCIFB_TXD, GPIO_FN_TPU3TO1, 269 GPIO_FN_TPU3TO1,
341 GPIO_FN_PORT248_SCIFA5_SCK, GPIO_FN_MFG2_OUT1, \ 270 GPIO_FN_MFG2_OUT1,
342 GPIO_FN_PORT248_SCIFB_SCK, GPIO_FN_TPU2TO0, \ 271 GPIO_FN_TPU2TO0,
343 GPIO_FN_PORT248_I2C_SCL3, GPIO_FN_MSIOF2R_TSCK, 272 GPIO_FN_MSIOF2R_TSCK,
344 GPIO_FN_PORT249_IROUT, GPIO_FN_MFG4_IN1, \ 273 GPIO_FN_PORT249_IROUT, GPIO_FN_MFG4_IN1, \
345 GPIO_FN_PORT249_I2C_SDA3, GPIO_FN_MSIOF2R_TSYNC, 274 GPIO_FN_MSIOF2R_TSYNC,
346 GPIO_FN_SDHICLK0, 275 GPIO_FN_SDHICLK0,
347 GPIO_FN_SDHICD0, 276 GPIO_FN_SDHICD0,
348 GPIO_FN_SDHID0_0, 277 GPIO_FN_SDHID0_0,
@@ -435,54 +364,12 @@ enum {
435 GPIO_FN_IRQ9_MEM_INT, 364 GPIO_FN_IRQ9_MEM_INT,
436 GPIO_FN_IRQ9_MCP_INT, 365 GPIO_FN_IRQ9_MCP_INT,
437 GPIO_FN_A11, 366 GPIO_FN_A11,
438 GPIO_FN_KEYOUT8,
439 GPIO_FN_TPU4TO3, 367 GPIO_FN_TPU4TO3,
440 GPIO_FN_RESETA_N_PU_ON, 368 GPIO_FN_RESETA_N_PU_ON,
441 GPIO_FN_RESETA_N_PU_OFF, 369 GPIO_FN_RESETA_N_PU_OFF,
442 GPIO_FN_EDBGREQ_PD, 370 GPIO_FN_EDBGREQ_PD,
443 GPIO_FN_EDBGREQ_PU, 371 GPIO_FN_EDBGREQ_PU,
444 372
445 /* Functions with pull-ups */
446 GPIO_FN_KEYIN0_PU,
447 GPIO_FN_KEYIN1_PU,
448 GPIO_FN_KEYIN2_PU,
449 GPIO_FN_KEYIN3_PU,
450 GPIO_FN_KEYIN4_PU,
451 GPIO_FN_KEYIN5_PU,
452 GPIO_FN_KEYIN6_PU,
453 GPIO_FN_KEYIN7_PU,
454 GPIO_FN_SDHICD0_PU,
455 GPIO_FN_SDHID0_0_PU,
456 GPIO_FN_SDHID0_1_PU,
457 GPIO_FN_SDHID0_2_PU,
458 GPIO_FN_SDHID0_3_PU,
459 GPIO_FN_SDHICMD0_PU,
460 GPIO_FN_SDHIWP0_PU,
461 GPIO_FN_SDHID1_0_PU,
462 GPIO_FN_SDHID1_1_PU,
463 GPIO_FN_SDHID1_2_PU,
464 GPIO_FN_SDHID1_3_PU,
465 GPIO_FN_SDHICMD1_PU,
466 GPIO_FN_SDHID2_0_PU,
467 GPIO_FN_SDHID2_1_PU,
468 GPIO_FN_SDHID2_2_PU,
469 GPIO_FN_SDHID2_3_PU,
470 GPIO_FN_SDHICMD2_PU,
471 GPIO_FN_MMCCMD0_PU,
472 GPIO_FN_MMCCMD1_PU,
473 GPIO_FN_MMCD0_0_PU,
474 GPIO_FN_MMCD0_1_PU,
475 GPIO_FN_MMCD0_2_PU,
476 GPIO_FN_MMCD0_3_PU,
477 GPIO_FN_MMCD0_4_PU,
478 GPIO_FN_MMCD0_5_PU,
479 GPIO_FN_MMCD0_6_PU,
480 GPIO_FN_MMCD0_7_PU,
481 GPIO_FN_FSIACK_PU,
482 GPIO_FN_FSIAILR_PU,
483 GPIO_FN_FSIAIBT_PU,
484 GPIO_FN_FSIAISLD_PU,
485
486 /* end of GPIO */ 373 /* end of GPIO */
487 GPIO_NR, 374 GPIO_NR,
488}; 375};
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 8807c27f71f9..f9cc4bc9c798 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/irqchip/arm-gic.h> 25#include <linux/irqchip/arm-gic.h>
26#include <mach/common.h> 26#include <mach/common.h>
27#include <linux/irqchip.h>
27#include <mach/intc.h> 28#include <mach/intc.h>
28#include <mach/r8a7779.h> 29#include <mach/r8a7779.h>
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
@@ -43,13 +44,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
43 return 0; /* always allow wakeup */ 44 return 0; /* always allow wakeup */
44} 45}
45 46
46void __init r8a7779_init_irq(void) 47static void __init r8a7779_init_irq_common(void)
47{ 48{
48 void __iomem *gic_dist_base = IOMEM(0xf0001000);
49 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
50
51 /* use GIC to handle interrupts */
52 gic_init(0, 29, gic_dist_base, gic_cpu_base);
53 gic_arch_extn.irq_set_wake = r8a7779_set_wake; 49 gic_arch_extn.irq_set_wake = r8a7779_set_wake;
54 50
55 /* route all interrupts to ARM */ 51 /* route all interrupts to ARM */
@@ -63,3 +59,22 @@ void __init r8a7779_init_irq(void)
63 __raw_writel(0xbffffffc, INT2SMSKCR3); 59 __raw_writel(0xbffffffc, INT2SMSKCR3);
64 __raw_writel(0x003fee3f, INT2SMSKCR4); 60 __raw_writel(0x003fee3f, INT2SMSKCR4);
65} 61}
62
63void __init r8a7779_init_irq(void)
64{
65 void __iomem *gic_dist_base = IOMEM(0xf0001000);
66 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
67
68 /* use GIC to handle interrupts */
69 gic_init(0, 29, gic_dist_base, gic_cpu_base);
70
71 r8a7779_init_irq_common();
72}
73
74#ifdef CONFIG_OF
75void __init r8a7779_init_irq_dt(void)
76{
77 irqchip_init();
78 r8a7779_init_irq_common();
79}
80#endif
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 91faba666d46..a81a1d804e2e 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -460,11 +460,3 @@ void __init sh73a0_init_irq(void)
460 sh73a0_pint1_cascade.handler = sh73a0_pint1_demux; 460 sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;
461 setup_irq(gic_spi(34), &sh73a0_pint1_cascade); 461 setup_irq(gic_spi(34), &sh73a0_pint1_cascade);
462} 462}
463
464#ifdef CONFIG_OF
465void __init sh73a0_init_irq_dt(void)
466{
467 irqchip_init();
468 gic_arch_extn.irq_set_wake = sh73a0_set_wake;
469}
470#endif
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 47662a581c0a..e4545c152722 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -404,7 +404,7 @@ void __init emev2_add_standard_devices(void)
404 ARRAY_SIZE(emev2_late_devices)); 404 ARRAY_SIZE(emev2_late_devices));
405} 405}
406 406
407void __init emev2_init_delay(void) 407static void __init emev2_init_delay(void)
408{ 408{
409 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ 409 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
410} 410}
@@ -439,7 +439,7 @@ static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
439 { } 439 { }
440}; 440};
441 441
442void __init emev2_add_standard_devices_dt(void) 442static void __init emev2_add_standard_devices_dt(void)
443{ 443{
444 of_platform_populate(NULL, of_default_bus_match_table, 444 of_platform_populate(NULL, of_default_bus_match_table,
445 emev2_auxdata_lookup, NULL); 445 emev2_auxdata_lookup, NULL);
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index c54ff9b29fe5..042df35e71a0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/of_platform.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/delay.h> 26#include <linux/delay.h>
26#include <linux/input.h> 27#include <linux/input.h>
@@ -28,6 +29,7 @@
28#include <linux/serial_sci.h> 29#include <linux/serial_sci.h>
29#include <linux/sh_intc.h> 30#include <linux/sh_intc.h>
30#include <linux/sh_timer.h> 31#include <linux/sh_timer.h>
32#include <linux/dma-mapping.h>
31#include <mach/hardware.h> 33#include <mach/hardware.h>
32#include <mach/irqs.h> 34#include <mach/irqs.h>
33#include <mach/r8a7779.h> 35#include <mach/r8a7779.h>
@@ -91,7 +93,7 @@ static struct plat_sci_port scif0_platform_data = {
91 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 93 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
92 .scbrr_algo_id = SCBRR_ALGO_2, 94 .scbrr_algo_id = SCBRR_ALGO_2,
93 .type = PORT_SCIF, 95 .type = PORT_SCIF,
94 .irqs = SCIx_IRQ_MUXED(gic_spi(88)), 96 .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)),
95}; 97};
96 98
97static struct platform_device scif0_device = { 99static struct platform_device scif0_device = {
@@ -108,7 +110,7 @@ static struct plat_sci_port scif1_platform_data = {
108 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 110 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
109 .scbrr_algo_id = SCBRR_ALGO_2, 111 .scbrr_algo_id = SCBRR_ALGO_2,
110 .type = PORT_SCIF, 112 .type = PORT_SCIF,
111 .irqs = SCIx_IRQ_MUXED(gic_spi(89)), 113 .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)),
112}; 114};
113 115
114static struct platform_device scif1_device = { 116static struct platform_device scif1_device = {
@@ -125,7 +127,7 @@ static struct plat_sci_port scif2_platform_data = {
125 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 127 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
126 .scbrr_algo_id = SCBRR_ALGO_2, 128 .scbrr_algo_id = SCBRR_ALGO_2,
127 .type = PORT_SCIF, 129 .type = PORT_SCIF,
128 .irqs = SCIx_IRQ_MUXED(gic_spi(90)), 130 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)),
129}; 131};
130 132
131static struct platform_device scif2_device = { 133static struct platform_device scif2_device = {
@@ -142,7 +144,7 @@ static struct plat_sci_port scif3_platform_data = {
142 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 144 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
143 .scbrr_algo_id = SCBRR_ALGO_2, 145 .scbrr_algo_id = SCBRR_ALGO_2,
144 .type = PORT_SCIF, 146 .type = PORT_SCIF,
145 .irqs = SCIx_IRQ_MUXED(gic_spi(91)), 147 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)),
146}; 148};
147 149
148static struct platform_device scif3_device = { 150static struct platform_device scif3_device = {
@@ -159,7 +161,7 @@ static struct plat_sci_port scif4_platform_data = {
159 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 161 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
160 .scbrr_algo_id = SCBRR_ALGO_2, 162 .scbrr_algo_id = SCBRR_ALGO_2,
161 .type = PORT_SCIF, 163 .type = PORT_SCIF,
162 .irqs = SCIx_IRQ_MUXED(gic_spi(92)), 164 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)),
163}; 165};
164 166
165static struct platform_device scif4_device = { 167static struct platform_device scif4_device = {
@@ -176,7 +178,7 @@ static struct plat_sci_port scif5_platform_data = {
176 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 178 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
177 .scbrr_algo_id = SCBRR_ALGO_2, 179 .scbrr_algo_id = SCBRR_ALGO_2,
178 .type = PORT_SCIF, 180 .type = PORT_SCIF,
179 .irqs = SCIx_IRQ_MUXED(gic_spi(93)), 181 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)),
180}; 182};
181 183
182static struct platform_device scif5_device = { 184static struct platform_device scif5_device = {
@@ -203,7 +205,7 @@ static struct resource tmu00_resources[] = {
203 .flags = IORESOURCE_MEM, 205 .flags = IORESOURCE_MEM,
204 }, 206 },
205 [1] = { 207 [1] = {
206 .start = gic_spi(32), 208 .start = gic_iid(0x40),
207 .flags = IORESOURCE_IRQ, 209 .flags = IORESOURCE_IRQ,
208 }, 210 },
209}; 211};
@@ -233,7 +235,7 @@ static struct resource tmu01_resources[] = {
233 .flags = IORESOURCE_MEM, 235 .flags = IORESOURCE_MEM,
234 }, 236 },
235 [1] = { 237 [1] = {
236 .start = gic_spi(33), 238 .start = gic_iid(0x41),
237 .flags = IORESOURCE_IRQ, 239 .flags = IORESOURCE_IRQ,
238 }, 240 },
239}; 241};
@@ -255,7 +257,7 @@ static struct resource rcar_i2c0_res[] = {
255 .end = 0xffc70fff, 257 .end = 0xffc70fff,
256 .flags = IORESOURCE_MEM, 258 .flags = IORESOURCE_MEM,
257 }, { 259 }, {
258 .start = gic_spi(79), 260 .start = gic_iid(0x6f),
259 .flags = IORESOURCE_IRQ, 261 .flags = IORESOURCE_IRQ,
260 }, 262 },
261}; 263};
@@ -273,7 +275,7 @@ static struct resource rcar_i2c1_res[] = {
273 .end = 0xffc71fff, 275 .end = 0xffc71fff,
274 .flags = IORESOURCE_MEM, 276 .flags = IORESOURCE_MEM,
275 }, { 277 }, {
276 .start = gic_spi(82), 278 .start = gic_iid(0x72),
277 .flags = IORESOURCE_IRQ, 279 .flags = IORESOURCE_IRQ,
278 }, 280 },
279}; 281};
@@ -291,7 +293,7 @@ static struct resource rcar_i2c2_res[] = {
291 .end = 0xffc72fff, 293 .end = 0xffc72fff,
292 .flags = IORESOURCE_MEM, 294 .flags = IORESOURCE_MEM,
293 }, { 295 }, {
294 .start = gic_spi(80), 296 .start = gic_iid(0x70),
295 .flags = IORESOURCE_IRQ, 297 .flags = IORESOURCE_IRQ,
296 }, 298 },
297}; 299};
@@ -309,7 +311,7 @@ static struct resource rcar_i2c3_res[] = {
309 .end = 0xffc73fff, 311 .end = 0xffc73fff,
310 .flags = IORESOURCE_MEM, 312 .flags = IORESOURCE_MEM,
311 }, { 313 }, {
312 .start = gic_spi(81), 314 .start = gic_iid(0x71),
313 .flags = IORESOURCE_IRQ, 315 .flags = IORESOURCE_IRQ,
314 }, 316 },
315}; 317};
@@ -321,7 +323,31 @@ static struct platform_device i2c3_device = {
321 .num_resources = ARRAY_SIZE(rcar_i2c3_res), 323 .num_resources = ARRAY_SIZE(rcar_i2c3_res),
322}; 324};
323 325
324static struct platform_device *r8a7779_early_devices[] __initdata = { 326static struct resource sata_resources[] = {
327 [0] = {
328 .name = "rcar-sata",
329 .start = 0xfc600000,
330 .end = 0xfc601fff,
331 .flags = IORESOURCE_MEM,
332 },
333 [1] = {
334 .start = gic_iid(0x84),
335 .flags = IORESOURCE_IRQ,
336 },
337};
338
339static struct platform_device sata_device = {
340 .name = "sata_rcar",
341 .id = -1,
342 .resource = sata_resources,
343 .num_resources = ARRAY_SIZE(sata_resources),
344 .dev = {
345 .dma_mask = &sata_device.dev.coherent_dma_mask,
346 .coherent_dma_mask = DMA_BIT_MASK(32),
347 },
348};
349
350static struct platform_device *r8a7779_devices_dt[] __initdata = {
325 &scif0_device, 351 &scif0_device,
326 &scif1_device, 352 &scif1_device,
327 &scif2_device, 353 &scif2_device,
@@ -330,13 +356,14 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
330 &scif5_device, 356 &scif5_device,
331 &tmu00_device, 357 &tmu00_device,
332 &tmu01_device, 358 &tmu01_device,
359};
360
361static struct platform_device *r8a7779_late_devices[] __initdata = {
333 &i2c0_device, 362 &i2c0_device,
334 &i2c1_device, 363 &i2c1_device,
335 &i2c2_device, 364 &i2c2_device,
336 &i2c3_device, 365 &i2c3_device,
337}; 366 &sata_device,
338
339static struct platform_device *r8a7779_late_devices[] __initdata = {
340}; 367};
341 368
342void __init r8a7779_add_standard_devices(void) 369void __init r8a7779_add_standard_devices(void)
@@ -349,8 +376,8 @@ void __init r8a7779_add_standard_devices(void)
349 376
350 r8a7779_init_pm_domains(); 377 r8a7779_init_pm_domains();
351 378
352 platform_add_devices(r8a7779_early_devices, 379 platform_add_devices(r8a7779_devices_dt,
353 ARRAY_SIZE(r8a7779_early_devices)); 380 ARRAY_SIZE(r8a7779_devices_dt));
354 platform_add_devices(r8a7779_late_devices, 381 platform_add_devices(r8a7779_late_devices,
355 ARRAY_SIZE(r8a7779_late_devices)); 382 ARRAY_SIZE(r8a7779_late_devices));
356} 383}
@@ -367,8 +394,8 @@ void __init r8a7779_earlytimer_init(void)
367 394
368void __init r8a7779_add_early_devices(void) 395void __init r8a7779_add_early_devices(void)
369{ 396{
370 early_platform_add_devices(r8a7779_early_devices, 397 early_platform_add_devices(r8a7779_devices_dt,
371 ARRAY_SIZE(r8a7779_early_devices)); 398 ARRAY_SIZE(r8a7779_devices_dt));
372 399
373 /* Early serial console setup is not included here due to 400 /* Early serial console setup is not included here due to
374 * memory map collisions. The SCIF serial ports in r8a7779 401 * memory map collisions. The SCIF serial ports in r8a7779
@@ -386,3 +413,40 @@ void __init r8a7779_add_early_devices(void)
386 * command line in case of the marzen board. 413 * command line in case of the marzen board.
387 */ 414 */
388} 415}
416
417#ifdef CONFIG_USE_OF
418void __init r8a7779_init_delay(void)
419{
420 shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
421}
422
423static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
424 {},
425};
426
427void __init r8a7779_add_standard_devices_dt(void)
428{
429 /* clocks are setup late during boot in the case of DT */
430 r8a7779_clock_init();
431
432 platform_add_devices(r8a7779_devices_dt,
433 ARRAY_SIZE(r8a7779_devices_dt));
434 of_platform_populate(NULL, of_default_bus_match_table,
435 r8a7779_auxdata_lookup, NULL);
436}
437
438static const char *r8a7779_compat_dt[] __initdata = {
439 "renesas,r8a7779",
440 NULL,
441};
442
443DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
444 .map_io = r8a7779_map_io,
445 .init_early = r8a7779_init_delay,
446 .nr_irqs = NR_IRQS_LEGACY,
447 .init_irq = r8a7779_init_irq_dt,
448 .init_machine = r8a7779_add_standard_devices_dt,
449 .init_time = shmobile_timer_init,
450 .dt_compat = r8a7779_compat_dt,
451MACHINE_END
452#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index bdab575f88bc..2257a915746d 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/irqchip.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/of_platform.h> 27#include <linux/of_platform.h>
27#include <linux/delay.h> 28#include <linux/delay.h>
@@ -810,7 +811,7 @@ static struct platform_device ipmmu_device = {
810 .num_resources = ARRAY_SIZE(ipmmu_resources), 811 .num_resources = ARRAY_SIZE(ipmmu_resources),
811}; 812};
812 813
813static struct platform_device *sh73a0_early_devices_dt[] __initdata = { 814static struct platform_device *sh73a0_devices_dt[] __initdata = {
814 &scif0_device, 815 &scif0_device,
815 &scif1_device, 816 &scif1_device,
816 &scif2_device, 817 &scif2_device,
@@ -847,8 +848,8 @@ void __init sh73a0_add_standard_devices(void)
847 /* Clear software reset bit on SY-DMAC module */ 848 /* Clear software reset bit on SY-DMAC module */
848 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); 849 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
849 850
850 platform_add_devices(sh73a0_early_devices_dt, 851 platform_add_devices(sh73a0_devices_dt,
851 ARRAY_SIZE(sh73a0_early_devices_dt)); 852 ARRAY_SIZE(sh73a0_devices_dt));
852 platform_add_devices(sh73a0_early_devices, 853 platform_add_devices(sh73a0_early_devices,
853 ARRAY_SIZE(sh73a0_early_devices)); 854 ARRAY_SIZE(sh73a0_early_devices));
854 platform_add_devices(sh73a0_late_devices, 855 platform_add_devices(sh73a0_late_devices,
@@ -867,8 +868,8 @@ void __init sh73a0_earlytimer_init(void)
867 868
868void __init sh73a0_add_early_devices(void) 869void __init sh73a0_add_early_devices(void)
869{ 870{
870 early_platform_add_devices(sh73a0_early_devices_dt, 871 early_platform_add_devices(sh73a0_devices_dt,
871 ARRAY_SIZE(sh73a0_early_devices_dt)); 872 ARRAY_SIZE(sh73a0_devices_dt));
872 early_platform_add_devices(sh73a0_early_devices, 873 early_platform_add_devices(sh73a0_early_devices,
873 ARRAY_SIZE(sh73a0_early_devices)); 874 ARRAY_SIZE(sh73a0_early_devices));
874 875
@@ -878,23 +879,9 @@ void __init sh73a0_add_early_devices(void)
878 879
879#ifdef CONFIG_USE_OF 880#ifdef CONFIG_USE_OF
880 881
881/* Please note that the clock initialisation shcheme used in 882void __init sh73a0_init_delay(void)
882 * sh73a0_add_early_devices_dt() and sh73a0_add_standard_devices_dt()
883 * does not work with SMP as there is a yet to be resolved lock-up in
884 * workqueue initialisation.
885 *
886 * CONFIG_SMP should be disabled when using this code.
887 */
888
889void __init sh73a0_add_early_devices_dt(void)
890{ 883{
891 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */ 884 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
892
893 early_platform_add_devices(sh73a0_early_devices_dt,
894 ARRAY_SIZE(sh73a0_early_devices_dt));
895
896 /* setup early console here as well */
897 shmobile_setup_console();
898} 885}
899 886
900static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = { 887static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = {
@@ -906,8 +893,8 @@ void __init sh73a0_add_standard_devices_dt(void)
906 /* clocks are setup late during boot in the case of DT */ 893 /* clocks are setup late during boot in the case of DT */
907 sh73a0_clock_init(); 894 sh73a0_clock_init();
908 895
909 platform_add_devices(sh73a0_early_devices_dt, 896 platform_add_devices(sh73a0_devices_dt,
910 ARRAY_SIZE(sh73a0_early_devices_dt)); 897 ARRAY_SIZE(sh73a0_devices_dt));
911 of_platform_populate(NULL, of_default_bus_match_table, 898 of_platform_populate(NULL, of_default_bus_match_table,
912 sh73a0_auxdata_lookup, NULL); 899 sh73a0_auxdata_lookup, NULL);
913} 900}
@@ -918,10 +905,11 @@ static const char *sh73a0_boards_compat_dt[] __initdata = {
918}; 905};
919 906
920DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") 907DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
908 .smp = smp_ops(sh73a0_smp_ops),
921 .map_io = sh73a0_map_io, 909 .map_io = sh73a0_map_io,
922 .init_early = sh73a0_add_early_devices_dt, 910 .init_early = sh73a0_init_delay,
923 .nr_irqs = NR_IRQS_LEGACY, 911 .nr_irqs = NR_IRQS_LEGACY,
924 .init_irq = sh73a0_init_irq_dt, 912 .init_irq = irqchip_init,
925 .init_machine = sh73a0_add_standard_devices_dt, 913 .init_machine = sh73a0_add_standard_devices_dt,
926 .init_time = shmobile_timer_init, 914 .init_time = shmobile_timer_init,
927 .dt_compat = sh73a0_boards_compat_dt, 915 .dt_compat = sh73a0_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 953eb1f9388d..8225c16b371b 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -28,63 +28,9 @@
28#include <mach/emev2.h> 28#include <mach/emev2.h>
29#include <asm/smp_plat.h> 29#include <asm/smp_plat.h>
30#include <asm/smp_scu.h> 30#include <asm/smp_scu.h>
31#include <asm/cacheflush.h>
32 31
33#define EMEV2_SCU_BASE 0x1e000000 32#define EMEV2_SCU_BASE 0x1e000000
34 33
35static DEFINE_SPINLOCK(scu_lock);
36static void __iomem *scu_base;
37
38static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
39{
40 unsigned long tmp;
41
42 /* we assume this code is running on a different cpu
43 * than the one that is changing coherency setting */
44 spin_lock(&scu_lock);
45 tmp = readl(scu_base + 8);
46 tmp &= ~clr;
47 tmp |= set;
48 writel(tmp, scu_base + 8);
49 spin_unlock(&scu_lock);
50
51}
52
53static unsigned int __init emev2_get_core_count(void)
54{
55 if (!scu_base) {
56 scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
57 emev2_clock_init(); /* need ioremapped SMU */
58 }
59
60 WARN_ON_ONCE(!scu_base);
61
62 return scu_base ? scu_get_core_count(scu_base) : 1;
63}
64
65static int emev2_platform_cpu_kill(unsigned int cpu)
66{
67 return 0; /* not supported yet */
68}
69
70static int __maybe_unused emev2_cpu_kill(unsigned int cpu)
71{
72 int k;
73
74 /* this function is running on another CPU than the offline target,
75 * here we need wait for shutdown code in platform_cpu_die() to
76 * finish before asking SoC-specific code to power off the CPU core.
77 */
78 for (k = 0; k < 1000; k++) {
79 if (shmobile_cpu_is_dead(cpu))
80 return emev2_platform_cpu_kill(cpu);
81 mdelay(1);
82 }
83
84 return 0;
85}
86
87
88static void __cpuinit emev2_secondary_init(unsigned int cpu) 34static void __cpuinit emev2_secondary_init(unsigned int cpu)
89{ 35{
90 gic_secondary_init(0); 36 gic_secondary_init(0);
@@ -92,31 +38,30 @@ static void __cpuinit emev2_secondary_init(unsigned int cpu)
92 38
93static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle) 39static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
94{ 40{
95 cpu = cpu_logical_map(cpu); 41 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu)));
96
97 /* enable cache coherency */
98 modify_scu_cpu_psr(0, 3 << (cpu * 8));
99
100 /* Tell ROM loader about our vector (in headsmp.S) */
101 emev2_set_boot_vector(__pa(shmobile_secondary_vector));
102
103 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
104 return 0; 42 return 0;
105} 43}
106 44
107static void __init emev2_smp_prepare_cpus(unsigned int max_cpus) 45static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
108{ 46{
109 int cpu = cpu_logical_map(0); 47 scu_enable(shmobile_scu_base);
110 48
111 scu_enable(scu_base); 49 /* Tell ROM loader about our vector (in headsmp-scu.S) */
50 emev2_set_boot_vector(__pa(shmobile_secondary_vector_scu));
112 51
113 /* enable cache coherency on CPU0 */ 52 /* enable cache coherency on booting CPU */
114 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 53 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
115} 54}
116 55
117static void __init emev2_smp_init_cpus(void) 56static void __init emev2_smp_init_cpus(void)
118{ 57{
119 unsigned int ncores = emev2_get_core_count(); 58 unsigned int ncores;
59
60 /* setup EMEV2 specific SCU base */
61 shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
62 emev2_clock_init(); /* need ioremapped SMU */
63
64 ncores = shmobile_scu_base ? scu_get_core_count(shmobile_scu_base) : 1;
120 65
121 shmobile_smp_init_cpus(ncores); 66 shmobile_smp_init_cpus(ncores);
122} 67}
@@ -126,9 +71,4 @@ struct smp_operations emev2_smp_ops __initdata = {
126 .smp_prepare_cpus = emev2_smp_prepare_cpus, 71 .smp_prepare_cpus = emev2_smp_prepare_cpus,
127 .smp_secondary_init = emev2_secondary_init, 72 .smp_secondary_init = emev2_secondary_init,
128 .smp_boot_secondary = emev2_boot_secondary, 73 .smp_boot_secondary = emev2_boot_secondary,
129#ifdef CONFIG_HOTPLUG_CPU
130 .cpu_kill = emev2_cpu_kill,
131 .cpu_die = shmobile_cpu_die,
132 .cpu_disable = shmobile_cpu_disable,
133#endif
134}; 74};
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 3a4acf23edcf..ea4535a5c4e2 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -26,11 +26,13 @@
26#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/r8a7779.h> 28#include <mach/r8a7779.h>
29#include <asm/cacheflush.h>
29#include <asm/smp_plat.h> 30#include <asm/smp_plat.h>
30#include <asm/smp_scu.h> 31#include <asm/smp_scu.h>
31#include <asm/smp_twd.h> 32#include <asm/smp_twd.h>
32 33
33#define AVECR IOMEM(0xfe700040) 34#define AVECR IOMEM(0xfe700040)
35#define R8A7779_SCU_BASE 0xf0000000
34 36
35static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { 37static struct r8a7779_pm_ch r8a7779_ch_cpu1 = {
36 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 38 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
@@ -56,44 +58,14 @@ static struct r8a7779_pm_ch *r8a7779_ch_cpu[4] = {
56 [3] = &r8a7779_ch_cpu3, 58 [3] = &r8a7779_ch_cpu3,
57}; 59};
58 60
59static void __iomem *scu_base_addr(void)
60{
61 return (void __iomem *)0xf0000000;
62}
63
64static DEFINE_SPINLOCK(scu_lock);
65static unsigned long tmp;
66
67#ifdef CONFIG_HAVE_ARM_TWD 61#ifdef CONFIG_HAVE_ARM_TWD
68static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 62static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, R8A7779_SCU_BASE + 0x600, 29);
69
70void __init r8a7779_register_twd(void) 63void __init r8a7779_register_twd(void)
71{ 64{
72 twd_local_timer_register(&twd_local_timer); 65 twd_local_timer_register(&twd_local_timer);
73} 66}
74#endif 67#endif
75 68
76static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
77{
78 void __iomem *scu_base = scu_base_addr();
79
80 spin_lock(&scu_lock);
81 tmp = __raw_readl(scu_base + 8);
82 tmp &= ~clr;
83 tmp |= set;
84 spin_unlock(&scu_lock);
85
86 /* disable cache coherency after releasing the lock */
87 __raw_writel(tmp, scu_base + 8);
88}
89
90static unsigned int __init r8a7779_get_core_count(void)
91{
92 void __iomem *scu_base = scu_base_addr();
93
94 return scu_get_core_count(scu_base);
95}
96
97static int r8a7779_platform_cpu_kill(unsigned int cpu) 69static int r8a7779_platform_cpu_kill(unsigned int cpu)
98{ 70{
99 struct r8a7779_pm_ch *ch = NULL; 71 struct r8a7779_pm_ch *ch = NULL;
@@ -101,9 +73,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
101 73
102 cpu = cpu_logical_map(cpu); 74 cpu = cpu_logical_map(cpu);
103 75
104 /* disable cache coherency */
105 modify_scu_cpu_psr(3 << (cpu * 8), 0);
106
107 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 76 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
108 ch = r8a7779_ch_cpu[cpu]; 77 ch = r8a7779_ch_cpu[cpu];
109 78
@@ -113,25 +82,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
113 return ret ? ret : 1; 82 return ret ? ret : 1;
114} 83}
115 84
116static int __maybe_unused r8a7779_cpu_kill(unsigned int cpu)
117{
118 int k;
119
120 /* this function is running on another CPU than the offline target,
121 * here we need wait for shutdown code in platform_cpu_die() to
122 * finish before asking SoC-specific code to power off the CPU core.
123 */
124 for (k = 0; k < 1000; k++) {
125 if (shmobile_cpu_is_dead(cpu))
126 return r8a7779_platform_cpu_kill(cpu);
127
128 mdelay(1);
129 }
130
131 return 0;
132}
133
134
135static void __cpuinit r8a7779_secondary_init(unsigned int cpu) 85static void __cpuinit r8a7779_secondary_init(unsigned int cpu)
136{ 86{
137 gic_secondary_init(0); 87 gic_secondary_init(0);
@@ -144,9 +94,6 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
144 94
145 cpu = cpu_logical_map(cpu); 95 cpu = cpu_logical_map(cpu);
146 96
147 /* enable cache coherency */
148 modify_scu_cpu_psr(0, 3 << (cpu * 8));
149
150 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 97 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
151 ch = r8a7779_ch_cpu[cpu]; 98 ch = r8a7779_ch_cpu[cpu];
152 99
@@ -158,15 +105,13 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
158 105
159static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) 106static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
160{ 107{
161 int cpu = cpu_logical_map(0); 108 scu_enable(shmobile_scu_base);
162 109
163 scu_enable(scu_base_addr()); 110 /* Map the reset vector (in headsmp-scu.S) */
111 __raw_writel(__pa(shmobile_secondary_vector_scu), AVECR);
164 112
165 /* Map the reset vector (in headsmp.S) */ 113 /* enable cache coherency on booting CPU */
166 __raw_writel(__pa(shmobile_secondary_vector), AVECR); 114 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
167
168 /* enable cache coherency on CPU0 */
169 modify_scu_cpu_psr(0, 3 << (cpu * 8));
170 115
171 r8a7779_pm_init(); 116 r8a7779_pm_init();
172 117
@@ -178,10 +123,60 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
178 123
179static void __init r8a7779_smp_init_cpus(void) 124static void __init r8a7779_smp_init_cpus(void)
180{ 125{
181 unsigned int ncores = r8a7779_get_core_count(); 126 /* setup r8a7779 specific SCU base */
127 shmobile_scu_base = IOMEM(R8A7779_SCU_BASE);
128
129 shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base));
130}
182 131
183 shmobile_smp_init_cpus(ncores); 132#ifdef CONFIG_HOTPLUG_CPU
133static int r8a7779_scu_psr_core_disabled(int cpu)
134{
135 unsigned long mask = 3 << (cpu * 8);
136
137 if ((__raw_readl(shmobile_scu_base + 8) & mask) == mask)
138 return 1;
139
140 return 0;
141}
142
143static int r8a7779_cpu_kill(unsigned int cpu)
144{
145 int k;
146
147 /* this function is running on another CPU than the offline target,
148 * here we need wait for shutdown code in platform_cpu_die() to
149 * finish before asking SoC-specific code to power off the CPU core.
150 */
151 for (k = 0; k < 1000; k++) {
152 if (r8a7779_scu_psr_core_disabled(cpu))
153 return r8a7779_platform_cpu_kill(cpu);
154
155 mdelay(1);
156 }
157
158 return 0;
159}
160
161static void r8a7779_cpu_die(unsigned int cpu)
162{
163 dsb();
164 flush_cache_all();
165
166 /* disable cache coherency */
167 scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
168
169 /* Endless loop until power off from r8a7779_cpu_kill() */
170 while (1)
171 cpu_do_idle();
172}
173
174static int r8a7779_cpu_disable(unsigned int cpu)
175{
176 /* only CPU1->3 have power domains, do not allow hotplug of CPU0 */
177 return cpu == 0 ? -EPERM : 0;
184} 178}
179#endif /* CONFIG_HOTPLUG_CPU */
185 180
186struct smp_operations r8a7779_smp_ops __initdata = { 181struct smp_operations r8a7779_smp_ops __initdata = {
187 .smp_init_cpus = r8a7779_smp_init_cpus, 182 .smp_init_cpus = r8a7779_smp_init_cpus,
@@ -190,7 +185,7 @@ struct smp_operations r8a7779_smp_ops __initdata = {
190 .smp_boot_secondary = r8a7779_boot_secondary, 185 .smp_boot_secondary = r8a7779_boot_secondary,
191#ifdef CONFIG_HOTPLUG_CPU 186#ifdef CONFIG_HOTPLUG_CPU
192 .cpu_kill = r8a7779_cpu_kill, 187 .cpu_kill = r8a7779_cpu_kill,
193 .cpu_die = shmobile_cpu_die, 188 .cpu_die = r8a7779_cpu_die,
194 .cpu_disable = shmobile_cpu_disable, 189 .cpu_disable = r8a7779_cpu_disable,
195#endif 190#endif
196}; 191};
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index acb46a94ccdf..5ae502b16437 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -39,26 +39,16 @@
39 39
40#define PSTR_SHUTDOWN_MODE 3 40#define PSTR_SHUTDOWN_MODE 3
41 41
42static void __iomem *scu_base_addr(void) 42#define SH73A0_SCU_BASE 0xf0000000
43{
44 return (void __iomem *)0xf0000000;
45}
46 43
47#ifdef CONFIG_HAVE_ARM_TWD 44#ifdef CONFIG_HAVE_ARM_TWD
48static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 45static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, SH73A0_SCU_BASE + 0x600, 29);
49void __init sh73a0_register_twd(void) 46void __init sh73a0_register_twd(void)
50{ 47{
51 twd_local_timer_register(&twd_local_timer); 48 twd_local_timer_register(&twd_local_timer);
52} 49}
53#endif 50#endif
54 51
55static unsigned int __init sh73a0_get_core_count(void)
56{
57 void __iomem *scu_base = scu_base_addr();
58
59 return scu_get_core_count(scu_base);
60}
61
62static void __cpuinit sh73a0_secondary_init(unsigned int cpu) 52static void __cpuinit sh73a0_secondary_init(unsigned int cpu)
63{ 53{
64 gic_secondary_init(0); 54 gic_secondary_init(0);
@@ -78,21 +68,22 @@ static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct
78 68
79static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus) 69static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
80{ 70{
81 scu_enable(scu_base_addr()); 71 scu_enable(shmobile_scu_base);
82 72
83 /* Map the reset vector (in headsmp-sh73a0.S) */ 73 /* Map the reset vector (in headsmp-scu.S) */
84 __raw_writel(0, APARMBAREA); /* 4k */ 74 __raw_writel(0, APARMBAREA); /* 4k */
85 __raw_writel(__pa(sh73a0_secondary_vector), SBAR); 75 __raw_writel(__pa(shmobile_secondary_vector_scu), SBAR);
86 76
87 /* enable cache coherency on booting CPU */ 77 /* enable cache coherency on booting CPU */
88 scu_power_mode(scu_base_addr(), SCU_PM_NORMAL); 78 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
89} 79}
90 80
91static void __init sh73a0_smp_init_cpus(void) 81static void __init sh73a0_smp_init_cpus(void)
92{ 82{
93 unsigned int ncores = sh73a0_get_core_count(); 83 /* setup sh73a0 specific SCU base */
84 shmobile_scu_base = IOMEM(SH73A0_SCU_BASE);
94 85
95 shmobile_smp_init_cpus(ncores); 86 shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base));
96} 87}
97 88
98#ifdef CONFIG_HOTPLUG_CPU 89#ifdef CONFIG_HOTPLUG_CPU
@@ -128,11 +119,16 @@ static void sh73a0_cpu_die(unsigned int cpu)
128 flush_cache_all(); 119 flush_cache_all();
129 120
130 /* Set power off mode. This takes the CPU out of the MP cluster */ 121 /* Set power off mode. This takes the CPU out of the MP cluster */
131 scu_power_mode(scu_base_addr(), SCU_PM_POWEROFF); 122 scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
132 123
133 /* Enter shutdown mode */ 124 /* Enter shutdown mode */
134 cpu_do_idle(); 125 cpu_do_idle();
135} 126}
127
128static int sh73a0_cpu_disable(unsigned int cpu)
129{
130 return 0; /* CPU0 and CPU1 supported */
131}
136#endif /* CONFIG_HOTPLUG_CPU */ 132#endif /* CONFIG_HOTPLUG_CPU */
137 133
138struct smp_operations sh73a0_smp_ops __initdata = { 134struct smp_operations sh73a0_smp_ops __initdata = {
@@ -143,6 +139,6 @@ struct smp_operations sh73a0_smp_ops __initdata = {
143#ifdef CONFIG_HOTPLUG_CPU 139#ifdef CONFIG_HOTPLUG_CPU
144 .cpu_kill = sh73a0_cpu_kill, 140 .cpu_kill = sh73a0_cpu_kill,
145 .cpu_die = sh73a0_cpu_die, 141 .cpu_die = sh73a0_cpu_die,
146 .cpu_disable = shmobile_cpu_disable_any, 142 .cpu_disable = sh73a0_cpu_disable,
147#endif 143#endif
148}; 144};
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 051b62c27102..7f2cb6c5e2c1 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -81,7 +81,6 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
81#endif 81#endif
82 82
83struct mmci_platform_data mop500_sdi0_data = { 83struct mmci_platform_data mop500_sdi0_data = {
84 .ios_handler = mop500_sdi0_ios_handler,
85 .ocr_mask = MMC_VDD_29_30, 84 .ocr_mask = MMC_VDD_29_30,
86 .f_max = 50000000, 85 .f_max = 50000000,
87 .capabilities = MMC_CAP_4_BIT_DATA | 86 .capabilities = MMC_CAP_4_BIT_DATA |
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index b03457881c4b..87d2d7b38ce9 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/clk.h>
15#include <linux/io.h> 16#include <linux/io.h>
16#include <linux/i2c.h> 17#include <linux/i2c.h>
17#include <linux/platform_data/i2c-nomadik.h> 18#include <linux/platform_data/i2c-nomadik.h>
@@ -439,6 +440,15 @@ static void mop500_prox_deactivate(struct device *dev)
439 regulator_put(prox_regulator); 440 regulator_put(prox_regulator);
440} 441}
441 442
443void mop500_snowball_ethernet_clock_enable(void)
444{
445 struct clk *clk;
446
447 clk = clk_get_sys("fsmc", NULL);
448 if (!IS_ERR(clk))
449 clk_prepare_enable(clk);
450}
451
442static struct cryp_platform_data u8500_cryp1_platform_data = { 452static struct cryp_platform_data u8500_cryp1_platform_data = {
443 .mem_to_engine = { 453 .mem_to_engine = {
444 .dir = STEDMA40_MEM_TO_PERIPH, 454 .dir = STEDMA40_MEM_TO_PERIPH,
@@ -683,6 +693,8 @@ static void __init snowball_init_machine(void)
683 mop500_audio_init(parent); 693 mop500_audio_init(parent);
684 mop500_uart_init(parent); 694 mop500_uart_init(parent);
685 695
696 mop500_snowball_ethernet_clock_enable();
697
686 /* This board has full regulator constraints */ 698 /* This board has full regulator constraints */
687 regulator_has_full_constraints(); 699 regulator_has_full_constraints();
688} 700}
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index eaa605f5d90d..d38951be70df 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -104,6 +104,7 @@ void __init mop500_pinmaps_init(void);
104void __init snowball_pinmaps_init(void); 104void __init snowball_pinmaps_init(void);
105void __init hrefv60_pinmaps_init(void); 105void __init hrefv60_pinmaps_init(void);
106void mop500_audio_init(struct device *parent); 106void mop500_audio_init(struct device *parent);
107void mop500_snowball_ethernet_clock_enable(void);
107 108
108int __init mop500_uib_init(void); 109int __init mop500_uib_init(void);
109void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, 110void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 19235cf7bbe3..f1a581844372 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -312,9 +312,10 @@ static void __init u8500_init_machine(void)
312 /* Pinmaps must be in place before devices register */ 312 /* Pinmaps must be in place before devices register */
313 if (of_machine_is_compatible("st-ericsson,mop500")) 313 if (of_machine_is_compatible("st-ericsson,mop500"))
314 mop500_pinmaps_init(); 314 mop500_pinmaps_init();
315 else if (of_machine_is_compatible("calaosystems,snowball-a9500")) 315 else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
316 snowball_pinmaps_init(); 316 snowball_pinmaps_init();
317 else if (of_machine_is_compatible("st-ericsson,hrefv60+")) 317 mop500_snowball_ethernet_clock_enable();
318 } else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
318 hrefv60_pinmaps_init(); 319 hrefv60_pinmaps_init();
319 else if (of_machine_is_compatible("st-ericsson,ccu9540")) {} 320 else if (of_machine_is_compatible("st-ericsson,ccu9540")) {}
320 /* TODO: Add pinmaps for ccu9540 board. */ 321 /* TODO: Add pinmaps for ccu9540 board. */
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c2f37390308a..c465faca51b0 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -299,7 +299,7 @@ static void l2x0_unlock(u32 cache_id)
299 int lockregs; 299 int lockregs;
300 int i; 300 int i;
301 301
302 switch (cache_id) { 302 switch (cache_id & L2X0_CACHE_ID_PART_MASK) {
303 case L2X0_CACHE_ID_PART_L310: 303 case L2X0_CACHE_ID_PART_L310:
304 lockregs = 8; 304 lockregs = 8;
305 break; 305 break;
@@ -333,15 +333,14 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
333 if (cache_id_part_number_from_dt) 333 if (cache_id_part_number_from_dt)
334 cache_id = cache_id_part_number_from_dt; 334 cache_id = cache_id_part_number_from_dt;
335 else 335 else
336 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID) 336 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID);
337 & L2X0_CACHE_ID_PART_MASK;
338 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 337 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
339 338
340 aux &= aux_mask; 339 aux &= aux_mask;
341 aux |= aux_val; 340 aux |= aux_val;
342 341
343 /* Determine the number of ways */ 342 /* Determine the number of ways */
344 switch (cache_id) { 343 switch (cache_id & L2X0_CACHE_ID_PART_MASK) {
345 case L2X0_CACHE_ID_PART_L310: 344 case L2X0_CACHE_ID_PART_L310:
346 if (aux & (1 << 16)) 345 if (aux & (1 << 16))
347 ways = 16; 346 ways = 16;
@@ -725,7 +724,6 @@ static const struct l2x0_of_data pl310_data = {
725 .flush_all = l2x0_flush_all, 724 .flush_all = l2x0_flush_all,
726 .inv_all = l2x0_inv_all, 725 .inv_all = l2x0_inv_all,
727 .disable = l2x0_disable, 726 .disable = l2x0_disable,
728 .set_debug = pl310_set_debug,
729 }, 727 },
730}; 728};
731 729
@@ -814,9 +812,8 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
814 data->save(); 812 data->save();
815 813
816 of_init = true; 814 of_init = true;
817 l2x0_init(l2x0_base, aux_val, aux_mask);
818
819 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache)); 815 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
816 l2x0_init(l2x0_base, aux_val, aux_mask);
820 817
821 return 0; 818 return 0;
822} 819}
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index a5a4b2bc42ba..2ac37372ef52 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -48,7 +48,7 @@ static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
48static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION); 48static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
49static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); 49static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
50 50
51static DEFINE_PER_CPU(atomic64_t, active_asids); 51DEFINE_PER_CPU(atomic64_t, active_asids);
52static DEFINE_PER_CPU(u64, reserved_asids); 52static DEFINE_PER_CPU(u64, reserved_asids);
53static cpumask_t tlb_flush_pending; 53static cpumask_t tlb_flush_pending;
54 54
@@ -215,6 +215,7 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
215 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { 215 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
216 local_flush_bp_all(); 216 local_flush_bp_all();
217 local_flush_tlb_all(); 217 local_flush_tlb_all();
218 dummy_flush_tlb_a15_erratum();
218 } 219 }
219 220
220 atomic64_set(&per_cpu(active_asids, cpu), asid); 221 atomic64_set(&per_cpu(active_asids, cpu), asid);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e95a996ab78f..78978945492a 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -598,39 +598,60 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
598 } while (pte++, addr += PAGE_SIZE, addr != end); 598 } while (pte++, addr += PAGE_SIZE, addr != end);
599} 599}
600 600
601static void __init alloc_init_section(pud_t *pud, unsigned long addr, 601static void __init map_init_section(pmd_t *pmd, unsigned long addr,
602 unsigned long end, phys_addr_t phys, 602 unsigned long end, phys_addr_t phys,
603 const struct mem_type *type) 603 const struct mem_type *type)
604{ 604{
605 pmd_t *pmd = pmd_offset(pud, addr); 605#ifndef CONFIG_ARM_LPAE
606
607 /* 606 /*
608 * Try a section mapping - end, addr and phys must all be aligned 607 * In classic MMU format, puds and pmds are folded in to
609 * to a section boundary. Note that PMDs refer to the individual 608 * the pgds. pmd_offset gives the PGD entry. PGDs refer to a
610 * L1 entries, whereas PGDs refer to a group of L1 entries making 609 * group of L1 entries making up one logical pointer to
611 * up one logical pointer to an L2 table. 610 * an L2 table (2MB), where as PMDs refer to the individual
611 * L1 entries (1MB). Hence increment to get the correct
612 * offset for odd 1MB sections.
613 * (See arch/arm/include/asm/pgtable-2level.h)
612 */ 614 */
613 if (type->prot_sect && ((addr | end | phys) & ~SECTION_MASK) == 0) { 615 if (addr & SECTION_SIZE)
614 pmd_t *p = pmd; 616 pmd++;
615
616#ifndef CONFIG_ARM_LPAE
617 if (addr & SECTION_SIZE)
618 pmd++;
619#endif 617#endif
618 do {
619 *pmd = __pmd(phys | type->prot_sect);
620 phys += SECTION_SIZE;
621 } while (pmd++, addr += SECTION_SIZE, addr != end);
620 622
621 do { 623 flush_pmd_entry(pmd);
622 *pmd = __pmd(phys | type->prot_sect); 624}
623 phys += SECTION_SIZE;
624 } while (pmd++, addr += SECTION_SIZE, addr != end);
625 625
626 flush_pmd_entry(p); 626static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
627 } else { 627 unsigned long end, phys_addr_t phys,
628 const struct mem_type *type)
629{
630 pmd_t *pmd = pmd_offset(pud, addr);
631 unsigned long next;
632
633 do {
628 /* 634 /*
629 * No need to loop; pte's aren't interested in the 635 * With LPAE, we must loop over to map
630 * individual L1 entries. 636 * all the pmds for the given range.
631 */ 637 */
632 alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type); 638 next = pmd_addr_end(addr, end);
633 } 639
640 /*
641 * Try a section mapping - addr, next and phys must all be
642 * aligned to a section boundary.
643 */
644 if (type->prot_sect &&
645 ((addr | next | phys) & ~SECTION_MASK) == 0) {
646 map_init_section(pmd, addr, next, phys, type);
647 } else {
648 alloc_init_pte(pmd, addr, next,
649 __phys_to_pfn(phys), type);
650 }
651
652 phys += next - addr;
653
654 } while (pmd++, addr = next, addr != end);
634} 655}
635 656
636static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, 657static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
@@ -641,7 +662,7 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
641 662
642 do { 663 do {
643 next = pud_addr_end(addr, end); 664 next = pud_addr_end(addr, end);
644 alloc_init_section(pud, addr, next, phys, type); 665 alloc_init_pmd(pud, addr, next, phys, type);
645 phys += next - addr; 666 phys += next - addr;
646 } while (pud++, addr = next, addr != end); 667 } while (pud++, addr = next, addr != end);
647} 668}
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 3a3c015f8d5c..f584d3f5b37c 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -420,7 +420,7 @@ __v7_pj4b_proc_info:
420__v7_ca7mp_proc_info: 420__v7_ca7mp_proc_info:
421 .long 0x410fc070 421 .long 0x410fc070
422 .long 0xff0ffff0 422 .long 0xff0ffff0
423 __v7_proc __v7_ca7mp_setup, hwcaps = HWCAP_IDIV 423 __v7_proc __v7_ca7mp_setup
424 .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info 424 .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info
425 425
426 /* 426 /*
@@ -430,10 +430,25 @@ __v7_ca7mp_proc_info:
430__v7_ca15mp_proc_info: 430__v7_ca15mp_proc_info:
431 .long 0x410fc0f0 431 .long 0x410fc0f0
432 .long 0xff0ffff0 432 .long 0xff0ffff0
433 __v7_proc __v7_ca15mp_setup, hwcaps = HWCAP_IDIV 433 __v7_proc __v7_ca15mp_setup
434 .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info 434 .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
435 435
436 /* 436 /*
437 * Qualcomm Inc. Krait processors.
438 */
439 .type __krait_proc_info, #object
440__krait_proc_info:
441 .long 0x510f0400 @ Required ID value
442 .long 0xff0ffc00 @ Mask for ID
443 /*
444 * Some Krait processors don't indicate support for SDIV and UDIV
445 * instructions in the ARM instruction set, even though they actually
446 * do support them.
447 */
448 __v7_proc __v7_setup, hwcaps = HWCAP_IDIV
449 .size __krait_proc_info, . - __krait_proc_info
450
451 /*
437 * Match any ARMv7 processor core. 452 * Match any ARMv7 processor core.
438 */ 453 */
439 .type __v7_proc_info, #object 454 .type __v7_proc_info, #object
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index cd2e21ff562a..51244bf97271 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -18,7 +18,7 @@ config MIPS
18 select HAVE_KRETPROBES 18 select HAVE_KRETPROBES
19 select HAVE_DEBUG_KMEMLEAK 19 select HAVE_DEBUG_KMEMLEAK
20 select ARCH_BINFMT_ELF_RANDOMIZE_PIE 20 select ARCH_BINFMT_ELF_RANDOMIZE_PIE
21 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 21 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT
22 select RTC_LIB if !MACH_LOONGSON 22 select RTC_LIB if !MACH_LOONGSON
23 select GENERIC_ATOMIC64 if !64BIT 23 select GENERIC_ATOMIC64 if !64BIT
24 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 24 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
@@ -657,7 +657,7 @@ config SNI_RM
657 bool "SNI RM200/300/400" 657 bool "SNI RM200/300/400"
658 select FW_ARC if CPU_LITTLE_ENDIAN 658 select FW_ARC if CPU_LITTLE_ENDIAN
659 select FW_ARC32 if CPU_LITTLE_ENDIAN 659 select FW_ARC32 if CPU_LITTLE_ENDIAN
660 select SNIPROM if CPU_BIG_ENDIAN 660 select FW_SNIPROM if CPU_BIG_ENDIAN
661 select ARCH_MAY_HAVE_PC_FDC 661 select ARCH_MAY_HAVE_PC_FDC
662 select BOOT_ELF32 662 select BOOT_ELF32
663 select CEVT_R4K 663 select CEVT_R4K
@@ -1144,7 +1144,7 @@ config DEFAULT_SGI_PARTITION
1144config FW_ARC32 1144config FW_ARC32
1145 bool 1145 bool
1146 1146
1147config SNIPROM 1147config FW_SNIPROM
1148 bool 1148 bool
1149 1149
1150config BOOT_ELF32 1150config BOOT_ELF32
@@ -1493,7 +1493,6 @@ config CPU_XLP
1493 select CPU_SUPPORTS_32BIT_KERNEL 1493 select CPU_SUPPORTS_32BIT_KERNEL
1494 select CPU_SUPPORTS_64BIT_KERNEL 1494 select CPU_SUPPORTS_64BIT_KERNEL
1495 select CPU_SUPPORTS_HIGHMEM 1495 select CPU_SUPPORTS_HIGHMEM
1496 select CPU_HAS_LLSC
1497 select WEAK_ORDERING 1496 select WEAK_ORDERING
1498 select WEAK_REORDERING_BEYOND_LLSC 1497 select WEAK_REORDERING_BEYOND_LLSC
1499 select CPU_HAS_PREFETCH 1498 select CPU_HAS_PREFETCH
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index ed1949c29508..9aa7d44898ed 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -745,10 +745,7 @@ void __init board_prom_init(void)
745 strcpy(cfe_version, "unknown"); 745 strcpy(cfe_version, "unknown");
746 printk(KERN_INFO PFX "CFE version: %s\n", cfe_version); 746 printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
747 747
748 if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) { 748 bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
749 printk(KERN_ERR PFX "invalid nvram checksum\n");
750 return;
751 }
752 749
753 board_name = bcm63xx_nvram_get_name(); 750 board_name = bcm63xx_nvram_get_name();
754 /* find board by name */ 751 /* find board by name */
diff --git a/arch/mips/bcm63xx/nvram.c b/arch/mips/bcm63xx/nvram.c
index 620611680839..a4b8864f9307 100644
--- a/arch/mips/bcm63xx/nvram.c
+++ b/arch/mips/bcm63xx/nvram.c
@@ -38,7 +38,7 @@ struct bcm963xx_nvram {
38static struct bcm963xx_nvram nvram; 38static struct bcm963xx_nvram nvram;
39static int mac_addr_used; 39static int mac_addr_used;
40 40
41int __init bcm63xx_nvram_init(void *addr) 41void __init bcm63xx_nvram_init(void *addr)
42{ 42{
43 unsigned int check_len; 43 unsigned int check_len;
44 u32 crc, expected_crc; 44 u32 crc, expected_crc;
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr)
60 crc = crc32_le(~0, (u8 *)&nvram, check_len); 60 crc = crc32_le(~0, (u8 *)&nvram, check_len);
61 61
62 if (crc != expected_crc) 62 if (crc != expected_crc)
63 return -EINVAL; 63 pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
64 64 expected_crc, crc);
65 return 0;
66} 65}
67 66
68u8 *bcm63xx_nvram_get_name(void) 67u8 *bcm63xx_nvram_get_name(void)
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c
index 314231be788c..35e18e98beb9 100644
--- a/arch/mips/bcm63xx/setup.c
+++ b/arch/mips/bcm63xx/setup.c
@@ -157,4 +157,4 @@ int __init bcm63xx_register_devices(void)
157 return board_register_devices(); 157 return board_register_devices();
158} 158}
159 159
160device_initcall(bcm63xx_register_devices); 160arch_initcall(bcm63xx_register_devices);
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index c594a3d4f743..b0baa299f899 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -174,7 +174,10 @@ static int octeon_kexec_prepare(struct kimage *image)
174 174
175static void octeon_generic_shutdown(void) 175static void octeon_generic_shutdown(void)
176{ 176{
177 int cpu, i; 177 int i;
178#ifdef CONFIG_SMP
179 int cpu;
180#endif
178 struct cvmx_bootmem_desc *bootmem_desc; 181 struct cvmx_bootmem_desc *bootmem_desc;
179 void *named_block_array_ptr; 182 void *named_block_array_ptr;
180 183
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
index 62d6a3b4d3b7..4e0b6bc1165e 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
@@ -9,10 +9,8 @@
9 * 9 *
10 * Initialized the local nvram copy from the target address and checks 10 * Initialized the local nvram copy from the target address and checks
11 * its checksum. 11 * its checksum.
12 *
13 * Returns 0 on success.
14 */ 12 */
15int __init bcm63xx_nvram_init(void *nvram); 13void bcm63xx_nvram_init(void *nvram);
16 14
17/** 15/**
18 * bcm63xx_nvram_get_name() - returns the board name according to nvram 16 * bcm63xx_nvram_get_name() - returns the board name according to nvram
diff --git a/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h b/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
index d9c828419037..193c0912d38e 100644
--- a/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h
@@ -28,11 +28,7 @@
28/* #define cpu_has_prefetch ? */ 28/* #define cpu_has_prefetch ? */
29#define cpu_has_mcheck 1 29#define cpu_has_mcheck 1
30/* #define cpu_has_ejtag ? */ 30/* #define cpu_has_ejtag ? */
31#ifdef CONFIG_CPU_HAS_LLSC
32#define cpu_has_llsc 1 31#define cpu_has_llsc 1
33#else
34#define cpu_has_llsc 0
35#endif
36/* #define cpu_has_vtag_icache ? */ 32/* #define cpu_has_vtag_icache ? */
37/* #define cpu_has_dc_aliases ? */ 33/* #define cpu_has_dc_aliases ? */
38/* #define cpu_has_ic_fills_f_dc ? */ 34/* #define cpu_has_ic_fills_f_dc ? */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 12b70c25906a..0da44d422f5b 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -1166,7 +1166,10 @@ do { \
1166 unsigned int __dspctl; \ 1166 unsigned int __dspctl; \
1167 \ 1167 \
1168 __asm__ __volatile__( \ 1168 __asm__ __volatile__( \
1169 " .set push \n" \
1170 " .set dsp \n" \
1169 " rddsp %0, %x1 \n" \ 1171 " rddsp %0, %x1 \n" \
1172 " .set pop \n" \
1170 : "=r" (__dspctl) \ 1173 : "=r" (__dspctl) \
1171 : "i" (mask)); \ 1174 : "i" (mask)); \
1172 __dspctl; \ 1175 __dspctl; \
@@ -1175,30 +1178,198 @@ do { \
1175#define wrdsp(val, mask) \ 1178#define wrdsp(val, mask) \
1176do { \ 1179do { \
1177 __asm__ __volatile__( \ 1180 __asm__ __volatile__( \
1181 " .set push \n" \
1182 " .set dsp \n" \
1178 " wrdsp %0, %x1 \n" \ 1183 " wrdsp %0, %x1 \n" \
1184 " .set pop \n" \
1179 : \ 1185 : \
1180 : "r" (val), "i" (mask)); \ 1186 : "r" (val), "i" (mask)); \
1181} while (0) 1187} while (0)
1182 1188
1183#define mflo0() ({ long mflo0; __asm__("mflo %0, $ac0" : "=r" (mflo0)); mflo0;}) 1189#define mflo0() \
1184#define mflo1() ({ long mflo1; __asm__("mflo %0, $ac1" : "=r" (mflo1)); mflo1;}) 1190({ \
1185#define mflo2() ({ long mflo2; __asm__("mflo %0, $ac2" : "=r" (mflo2)); mflo2;}) 1191 long mflo0; \
1186#define mflo3() ({ long mflo3; __asm__("mflo %0, $ac3" : "=r" (mflo3)); mflo3;}) 1192 __asm__( \
1187 1193 " .set push \n" \
1188#define mfhi0() ({ long mfhi0; __asm__("mfhi %0, $ac0" : "=r" (mfhi0)); mfhi0;}) 1194 " .set dsp \n" \
1189#define mfhi1() ({ long mfhi1; __asm__("mfhi %0, $ac1" : "=r" (mfhi1)); mfhi1;}) 1195 " mflo %0, $ac0 \n" \
1190#define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;}) 1196 " .set pop \n" \
1191#define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;}) 1197 : "=r" (mflo0)); \
1192 1198 mflo0; \
1193#define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x)) 1199})
1194#define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x)) 1200
1195#define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x)) 1201#define mflo1() \
1196#define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x)) 1202({ \
1197 1203 long mflo1; \
1198#define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x)) 1204 __asm__( \
1199#define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x)) 1205 " .set push \n" \
1200#define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x)) 1206 " .set dsp \n" \
1201#define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x)) 1207 " mflo %0, $ac1 \n" \
1208 " .set pop \n" \
1209 : "=r" (mflo1)); \
1210 mflo1; \
1211})
1212
1213#define mflo2() \
1214({ \
1215 long mflo2; \
1216 __asm__( \
1217 " .set push \n" \
1218 " .set dsp \n" \
1219 " mflo %0, $ac2 \n" \
1220 " .set pop \n" \
1221 : "=r" (mflo2)); \
1222 mflo2; \
1223})
1224
1225#define mflo3() \
1226({ \
1227 long mflo3; \
1228 __asm__( \
1229 " .set push \n" \
1230 " .set dsp \n" \
1231 " mflo %0, $ac3 \n" \
1232 " .set pop \n" \
1233 : "=r" (mflo3)); \
1234 mflo3; \
1235})
1236
1237#define mfhi0() \
1238({ \
1239 long mfhi0; \
1240 __asm__( \
1241 " .set push \n" \
1242 " .set dsp \n" \
1243 " mfhi %0, $ac0 \n" \
1244 " .set pop \n" \
1245 : "=r" (mfhi0)); \
1246 mfhi0; \
1247})
1248
1249#define mfhi1() \
1250({ \
1251 long mfhi1; \
1252 __asm__( \
1253 " .set push \n" \
1254 " .set dsp \n" \
1255 " mfhi %0, $ac1 \n" \
1256 " .set pop \n" \
1257 : "=r" (mfhi1)); \
1258 mfhi1; \
1259})
1260
1261#define mfhi2() \
1262({ \
1263 long mfhi2; \
1264 __asm__( \
1265 " .set push \n" \
1266 " .set dsp \n" \
1267 " mfhi %0, $ac2 \n" \
1268 " .set pop \n" \
1269 : "=r" (mfhi2)); \
1270 mfhi2; \
1271})
1272
1273#define mfhi3() \
1274({ \
1275 long mfhi3; \
1276 __asm__( \
1277 " .set push \n" \
1278 " .set dsp \n" \
1279 " mfhi %0, $ac3 \n" \
1280 " .set pop \n" \
1281 : "=r" (mfhi3)); \
1282 mfhi3; \
1283})
1284
1285
1286#define mtlo0(x) \
1287({ \
1288 __asm__( \
1289 " .set push \n" \
1290 " .set dsp \n" \
1291 " mtlo %0, $ac0 \n" \
1292 " .set pop \n" \
1293 : \
1294 : "r" (x)); \
1295})
1296
1297#define mtlo1(x) \
1298({ \
1299 __asm__( \
1300 " .set push \n" \
1301 " .set dsp \n" \
1302 " mtlo %0, $ac1 \n" \
1303 " .set pop \n" \
1304 : \
1305 : "r" (x)); \
1306})
1307
1308#define mtlo2(x) \
1309({ \
1310 __asm__( \
1311 " .set push \n" \
1312 " .set dsp \n" \
1313 " mtlo %0, $ac2 \n" \
1314 " .set pop \n" \
1315 : \
1316 : "r" (x)); \
1317})
1318
1319#define mtlo3(x) \
1320({ \
1321 __asm__( \
1322 " .set push \n" \
1323 " .set dsp \n" \
1324 " mtlo %0, $ac3 \n" \
1325 " .set pop \n" \
1326 : \
1327 : "r" (x)); \
1328})
1329
1330#define mthi0(x) \
1331({ \
1332 __asm__( \
1333 " .set push \n" \
1334 " .set dsp \n" \
1335 " mthi %0, $ac0 \n" \
1336 " .set pop \n" \
1337 : \
1338 : "r" (x)); \
1339})
1340
1341#define mthi1(x) \
1342({ \
1343 __asm__( \
1344 " .set push \n" \
1345 " .set dsp \n" \
1346 " mthi %0, $ac1 \n" \
1347 " .set pop \n" \
1348 : \
1349 : "r" (x)); \
1350})
1351
1352#define mthi2(x) \
1353({ \
1354 __asm__( \
1355 " .set push \n" \
1356 " .set dsp \n" \
1357 " mthi %0, $ac2 \n" \
1358 " .set pop \n" \
1359 : \
1360 : "r" (x)); \
1361})
1362
1363#define mthi3(x) \
1364({ \
1365 __asm__( \
1366 " .set push \n" \
1367 " .set dsp \n" \
1368 " mthi %0, $ac3 \n" \
1369 " .set pop \n" \
1370 : \
1371 : "r" (x)); \
1372})
1202 1373
1203#else 1374#else
1204 1375
diff --git a/arch/mips/include/asm/signal.h b/arch/mips/include/asm/signal.h
index 197f6367c201..8efe5a9e2c3e 100644
--- a/arch/mips/include/asm/signal.h
+++ b/arch/mips/include/asm/signal.h
@@ -21,6 +21,6 @@
21#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
22#include <asm/siginfo.h> 22#include <asm/siginfo.h>
23 23
24#define __ARCH_HAS_ODD_SIGACTION 24#define __ARCH_HAS_IRIX_SIGACTION
25 25
26#endif /* _ASM_SIGNAL_H */ 26#endif /* _ASM_SIGNAL_H */
diff --git a/arch/mips/include/uapi/asm/signal.h b/arch/mips/include/uapi/asm/signal.h
index d6b18b4d0f3a..addb9f556b71 100644
--- a/arch/mips/include/uapi/asm/signal.h
+++ b/arch/mips/include/uapi/asm/signal.h
@@ -72,6 +72,12 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
72 * 72 *
73 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single 73 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
74 * Unix names RESETHAND and NODEFER respectively. 74 * Unix names RESETHAND and NODEFER respectively.
75 *
76 * SA_RESTORER used to be defined as 0x04000000 but only the O32 ABI ever
77 * supported its use and no libc was using it, so the entire sa-restorer
78 * functionality was removed with lmo commit 39bffc12c3580ab for 2.5.48
79 * retaining only the SA_RESTORER definition as a reminder to avoid
80 * accidental reuse of the mask bit.
75 */ 81 */
76#define SA_ONSTACK 0x08000000 82#define SA_ONSTACK 0x08000000
77#define SA_RESETHAND 0x80000000 83#define SA_RESETHAND 0x80000000
@@ -84,8 +90,6 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
84#define SA_NOMASK SA_NODEFER 90#define SA_NOMASK SA_NODEFER
85#define SA_ONESHOT SA_RESETHAND 91#define SA_ONESHOT SA_RESETHAND
86 92
87#define SA_RESTORER 0x04000000 /* Only for o32 */
88
89#define MINSIGSTKSZ 2048 93#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192 94#define SIGSTKSZ 8192
91 95
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index f81d98f6184c..de75fb50562b 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -100,29 +100,16 @@ obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_mipsxx.o
100obj-$(CONFIG_JUMP_LABEL) += jump_label.o 100obj-$(CONFIG_JUMP_LABEL) += jump_label.o
101 101
102# 102#
103# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is safe 103# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is not
104# to enable DSP assembler support here even if the MIPS Release 2 CPU we 104# safe to unconditionnaly use the assembler -mdsp / -mdspr2 switches
105# are targetting does not support DSP because all code-paths making use of 105# here because the compiler may use DSP ASE instructions (such as lwx) in
106# it properly check that the running CPU *actually does* support these 106# code paths where we cannot check that the CPU we are running on supports it.
107# instructions. 107# Proper abstraction using HAVE_AS_DSP and macros is done in
108# arch/mips/include/asm/mipsregs.h.
108# 109#
109ifeq ($(CONFIG_CPU_MIPSR2), y) 110ifeq ($(CONFIG_CPU_MIPSR2), y)
110CFLAGS_DSP = -DHAVE_AS_DSP 111CFLAGS_DSP = -DHAVE_AS_DSP
111 112
112#
113# Check if assembler supports DSP ASE
114#
115ifeq ($(call cc-option-yn,-mdsp), y)
116CFLAGS_DSP += -mdsp
117endif
118
119#
120# Check if assembler supports DSP ASE Rev2
121#
122ifeq ($(call cc-option-yn,-mdspr2), y)
123CFLAGS_DSP += -mdspr2
124endif
125
126CFLAGS_signal.o = $(CFLAGS_DSP) 113CFLAGS_signal.o = $(CFLAGS_DSP)
127CFLAGS_signal32.o = $(CFLAGS_DSP) 114CFLAGS_signal32.o = $(CFLAGS_DSP)
128CFLAGS_process.o = $(CFLAGS_DSP) 115CFLAGS_process.o = $(CFLAGS_DSP)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 6bfccc227a95..5fe66a0c3224 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -580,6 +580,9 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
580 c->tlbsize = 48; 580 c->tlbsize = 48;
581 break; 581 break;
582 case PRID_IMP_VR41XX: 582 case PRID_IMP_VR41XX:
583 set_isa(c, MIPS_CPU_ISA_III);
584 c->options = R4K_OPTS;
585 c->tlbsize = 32;
583 switch (c->processor_id & 0xf0) { 586 switch (c->processor_id & 0xf0) {
584 case PRID_REV_VR4111: 587 case PRID_REV_VR4111:
585 c->cputype = CPU_VR4111; 588 c->cputype = CPU_VR4111;
@@ -604,6 +607,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
604 __cpu_name[cpu] = "NEC VR4131"; 607 __cpu_name[cpu] = "NEC VR4131";
605 } else { 608 } else {
606 c->cputype = CPU_VR4133; 609 c->cputype = CPU_VR4133;
610 c->options |= MIPS_CPU_LLSC;
607 __cpu_name[cpu] = "NEC VR4133"; 611 __cpu_name[cpu] = "NEC VR4133";
608 } 612 }
609 break; 613 break;
@@ -613,9 +617,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
613 __cpu_name[cpu] = "NEC Vr41xx"; 617 __cpu_name[cpu] = "NEC Vr41xx";
614 break; 618 break;
615 } 619 }
616 set_isa(c, MIPS_CPU_ISA_III);
617 c->options = R4K_OPTS;
618 c->tlbsize = 32;
619 break; 620 break;
620 case PRID_IMP_R4300: 621 case PRID_IMP_R4300:
621 c->cputype = CPU_R4300; 622 c->cputype = CPU_R4300;
@@ -1226,10 +1227,8 @@ __cpuinit void cpu_probe(void)
1226 if (c->options & MIPS_CPU_FPU) { 1227 if (c->options & MIPS_CPU_FPU) {
1227 c->fpu_id = cpu_get_fpu_id(); 1228 c->fpu_id = cpu_get_fpu_id();
1228 1229
1229 if (c->isa_level == MIPS_CPU_ISA_M32R1 || 1230 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1230 c->isa_level == MIPS_CPU_ISA_M32R2 || 1231 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
1231 c->isa_level == MIPS_CPU_ISA_M64R1 ||
1232 c->isa_level == MIPS_CPU_ISA_M64R2) {
1233 if (c->fpu_id & MIPS_FPIR_3D) 1232 if (c->fpu_id & MIPS_FPIR_3D)
1234 c->ases |= MIPS_ASE_MIPS3D; 1233 c->ases |= MIPS_ASE_MIPS3D;
1235 } 1234 }
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 8eeee1c860c0..db9655f08892 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -171,7 +171,7 @@ SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
171 err = compat_sys_shmctl(first, second, compat_ptr(ptr)); 171 err = compat_sys_shmctl(first, second, compat_ptr(ptr));
172 break; 172 break;
173 default: 173 default:
174 err = -EINVAL; 174 err = -ENOSYS;
175 break; 175 break;
176 } 176 }
177 177
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 165867673357..33d067148e61 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -46,10 +46,9 @@
46 PTR_L a5, PT_R9(sp) 46 PTR_L a5, PT_R9(sp)
47 PTR_L a6, PT_R10(sp) 47 PTR_L a6, PT_R10(sp)
48 PTR_L a7, PT_R11(sp) 48 PTR_L a7, PT_R11(sp)
49#else
50 PTR_ADDIU sp, PT_SIZE
51#endif 49#endif
52.endm 50 PTR_ADDIU sp, PT_SIZE
51 .endm
53 52
54 .macro RETURN_BACK 53 .macro RETURN_BACK
55 jr ra 54 jr ra
@@ -68,7 +67,11 @@ NESTED(ftrace_caller, PT_SIZE, ra)
68 .globl _mcount 67 .globl _mcount
69_mcount: 68_mcount:
70 b ftrace_stub 69 b ftrace_stub
71 addiu sp,sp,8 70#ifdef CONFIG_32BIT
71 addiu sp,sp,8
72#else
73 nop
74#endif
72 75
73 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */ 76 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */
74 lw t1, function_trace_stop 77 lw t1, function_trace_stop
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 135c4aadccbe..7a54f74b7818 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -67,7 +67,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
67 if (cpu_has_mips_r) { 67 if (cpu_has_mips_r) {
68 seq_printf(m, "isa\t\t\t:"); 68 seq_printf(m, "isa\t\t\t:");
69 if (cpu_has_mips_1) 69 if (cpu_has_mips_1)
70 seq_printf(m, "%s", "mips1"); 70 seq_printf(m, "%s", " mips1");
71 if (cpu_has_mips_2) 71 if (cpu_has_mips_2)
72 seq_printf(m, "%s", " mips2"); 72 seq_printf(m, "%s", " mips2");
73 if (cpu_has_mips_3) 73 if (cpu_has_mips_3)
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index a200b5bdbb87..c3abb88170fc 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1571,7 +1571,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu)
1571#ifdef CONFIG_64BIT 1571#ifdef CONFIG_64BIT
1572 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX; 1572 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
1573#endif 1573#endif
1574 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) 1574 if (current_cpu_data.isa_level & MIPS_CPU_ISA_IV)
1575 status_set |= ST0_XX; 1575 status_set |= ST0_XX;
1576 if (cpu_has_dsp) 1576 if (cpu_has_dsp)
1577 status_set |= ST0_MX; 1577 status_set |= ST0_MX;
diff --git a/arch/mips/lib/bitops.c b/arch/mips/lib/bitops.c
index 81f1dcfdcab8..a64daee740ee 100644
--- a/arch/mips/lib/bitops.c
+++ b/arch/mips/lib/bitops.c
@@ -90,12 +90,12 @@ int __mips_test_and_set_bit(unsigned long nr,
90 unsigned bit = nr & SZLONG_MASK; 90 unsigned bit = nr & SZLONG_MASK;
91 unsigned long mask; 91 unsigned long mask;
92 unsigned long flags; 92 unsigned long flags;
93 unsigned long res; 93 int res;
94 94
95 a += nr >> SZLONG_LOG; 95 a += nr >> SZLONG_LOG;
96 mask = 1UL << bit; 96 mask = 1UL << bit;
97 raw_local_irq_save(flags); 97 raw_local_irq_save(flags);
98 res = (mask & *a); 98 res = (mask & *a) != 0;
99 *a |= mask; 99 *a |= mask;
100 raw_local_irq_restore(flags); 100 raw_local_irq_restore(flags);
101 return res; 101 return res;
@@ -116,12 +116,12 @@ int __mips_test_and_set_bit_lock(unsigned long nr,
116 unsigned bit = nr & SZLONG_MASK; 116 unsigned bit = nr & SZLONG_MASK;
117 unsigned long mask; 117 unsigned long mask;
118 unsigned long flags; 118 unsigned long flags;
119 unsigned long res; 119 int res;
120 120
121 a += nr >> SZLONG_LOG; 121 a += nr >> SZLONG_LOG;
122 mask = 1UL << bit; 122 mask = 1UL << bit;
123 raw_local_irq_save(flags); 123 raw_local_irq_save(flags);
124 res = (mask & *a); 124 res = (mask & *a) != 0;
125 *a |= mask; 125 *a |= mask;
126 raw_local_irq_restore(flags); 126 raw_local_irq_restore(flags);
127 return res; 127 return res;
@@ -141,12 +141,12 @@ int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
141 unsigned bit = nr & SZLONG_MASK; 141 unsigned bit = nr & SZLONG_MASK;
142 unsigned long mask; 142 unsigned long mask;
143 unsigned long flags; 143 unsigned long flags;
144 unsigned long res; 144 int res;
145 145
146 a += nr >> SZLONG_LOG; 146 a += nr >> SZLONG_LOG;
147 mask = 1UL << bit; 147 mask = 1UL << bit;
148 raw_local_irq_save(flags); 148 raw_local_irq_save(flags);
149 res = (mask & *a); 149 res = (mask & *a) != 0;
150 *a &= ~mask; 150 *a &= ~mask;
151 raw_local_irq_restore(flags); 151 raw_local_irq_restore(flags);
152 return res; 152 return res;
@@ -166,12 +166,12 @@ int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
166 unsigned bit = nr & SZLONG_MASK; 166 unsigned bit = nr & SZLONG_MASK;
167 unsigned long mask; 167 unsigned long mask;
168 unsigned long flags; 168 unsigned long flags;
169 unsigned long res; 169 int res;
170 170
171 a += nr >> SZLONG_LOG; 171 a += nr >> SZLONG_LOG;
172 mask = 1UL << bit; 172 mask = 1UL << bit;
173 raw_local_irq_save(flags); 173 raw_local_irq_save(flags);
174 res = (mask & *a); 174 res = (mask & *a) != 0;
175 *a ^= mask; 175 *a ^= mask;
176 raw_local_irq_restore(flags); 176 raw_local_irq_restore(flags);
177 return res; 177 return res;
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index 507147aebd41..a6adffbb4e5f 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -270,7 +270,7 @@ LEAF(csum_partial)
270#endif 270#endif
271 271
272 /* odd buffer alignment? */ 272 /* odd buffer alignment? */
273#ifdef CPU_MIPSR2 273#ifdef CONFIG_CPU_MIPSR2
274 wsbh v1, sum 274 wsbh v1, sum
275 movn sum, v1, t7 275 movn sum, v1, t7
276#else 276#else
@@ -670,7 +670,7 @@ EXC( sb t0, NBYTES-2(dst), .Ls_exc)
670 addu sum, v1 670 addu sum, v1
671#endif 671#endif
672 672
673#ifdef CPU_MIPSR2 673#ifdef CONFIG_CPU_MIPSR2
674 wsbh v1, sum 674 wsbh v1, sum
675 movn sum, v1, odd 675 movn sum, v1, odd
676#else 676#else
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index ecca559b8d7b..2078915eacb9 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1247,10 +1247,8 @@ static void __cpuinit setup_scache(void)
1247 return; 1247 return;
1248 1248
1249 default: 1249 default:
1250 if (c->isa_level == MIPS_CPU_ISA_M32R1 || 1250 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1251 c->isa_level == MIPS_CPU_ISA_M32R2 || 1251 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
1252 c->isa_level == MIPS_CPU_ISA_M64R1 ||
1253 c->isa_level == MIPS_CPU_ISA_M64R2) {
1254#ifdef CONFIG_MIPS_CPU_SCACHE 1252#ifdef CONFIG_MIPS_CPU_SCACHE
1255 if (mips_sc_init ()) { 1253 if (mips_sc_init ()) {
1256 scache_size = c->scache.ways * c->scache.sets * c->scache.linesz; 1254 scache_size = c->scache.ways * c->scache.sets * c->scache.linesz;
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 93d937b4b1ba..df96da7e939b 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -98,10 +98,8 @@ static inline int __init mips_sc_probe(void)
98 c->scache.flags |= MIPS_CACHE_NOT_PRESENT; 98 c->scache.flags |= MIPS_CACHE_NOT_PRESENT;
99 99
100 /* Ignore anything but MIPSxx processors */ 100 /* Ignore anything but MIPSxx processors */
101 if (c->isa_level != MIPS_CPU_ISA_M32R1 && 101 if (!(c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
102 c->isa_level != MIPS_CPU_ISA_M32R2 && 102 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)))
103 c->isa_level != MIPS_CPU_ISA_M64R1 &&
104 c->isa_level != MIPS_CPU_ISA_M64R2)
105 return 0; 103 return 0;
106 104
107 /* Does this MIPS32/MIPS64 CPU have a config2 register? */ 105 /* Does this MIPS32/MIPS64 CPU have a config2 register? */
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c
index 38a80c83fd67..d1faece21b6a 100644
--- a/arch/mips/pci/pci-alchemy.c
+++ b/arch/mips/pci/pci-alchemy.c
@@ -19,7 +19,7 @@
19#include <asm/mach-au1x00/au1000.h> 19#include <asm/mach-au1x00/au1000.h>
20#include <asm/tlbmisc.h> 20#include <asm/tlbmisc.h>
21 21
22#ifdef CONFIG_DEBUG_PCI 22#ifdef CONFIG_PCI_DEBUG
23#define DBG(x...) printk(KERN_DEBUG x) 23#define DBG(x...) printk(KERN_DEBUG x)
24#else 24#else
25#define DBG(x...) do {} while (0) 25#define DBG(x...) do {} while (0)
@@ -162,7 +162,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
162 if (status & (1 << 29)) { 162 if (status & (1 << 29)) {
163 *data = 0xffffffff; 163 *data = 0xffffffff;
164 error = -1; 164 error = -1;
165 DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d", 165 DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d\n",
166 access_type, bus->number, device); 166 access_type, bus->number, device);
167 } else if ((status >> 28) & 0xf) { 167 } else if ((status >> 28) & 0xf) {
168 DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n", 168 DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n",
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 4a2930844d43..4a5443118cfb 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -344,6 +344,7 @@ extern unsigned long MODULES_END;
344#define _REGION3_ENTRY_CO 0x100 /* change-recording override */ 344#define _REGION3_ENTRY_CO 0x100 /* change-recording override */
345 345
346/* Bits in the segment table entry */ 346/* Bits in the segment table entry */
347#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */
347#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ 348#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
348#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */ 349#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */
349#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */ 350#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */
@@ -1531,7 +1532,8 @@ extern int s390_enable_sie(void);
1531/* 1532/*
1532 * No page table caches to initialise 1533 * No page table caches to initialise
1533 */ 1534 */
1534#define pgtable_cache_init() do { } while (0) 1535static inline void pgtable_cache_init(void) { }
1536static inline void check_pgt_cache(void) { }
1535 1537
1536#include <asm-generic/pgtable.h> 1538#include <asm-generic/pgtable.h>
1537 1539
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index dff631d34b45..466fb3383960 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -77,42 +77,69 @@ static size_t copy_in_kernel(size_t count, void __user *to,
77 * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address 77 * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address
78 * contains the (negative) exception code. 78 * contains the (negative) exception code.
79 */ 79 */
80static __always_inline unsigned long follow_table(struct mm_struct *mm, 80#ifdef CONFIG_64BIT
81 unsigned long addr, int write) 81static unsigned long follow_table(struct mm_struct *mm,
82 unsigned long address, int write)
82{ 83{
83 pgd_t *pgd; 84 unsigned long *table = (unsigned long *)__pa(mm->pgd);
84 pud_t *pud; 85
85 pmd_t *pmd; 86 switch (mm->context.asce_bits & _ASCE_TYPE_MASK) {
86 pte_t *ptep; 87 case _ASCE_TYPE_REGION1:
88 table = table + ((address >> 53) & 0x7ff);
89 if (unlikely(*table & _REGION_ENTRY_INV))
90 return -0x39UL;
91 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
92 case _ASCE_TYPE_REGION2:
93 table = table + ((address >> 42) & 0x7ff);
94 if (unlikely(*table & _REGION_ENTRY_INV))
95 return -0x3aUL;
96 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
97 case _ASCE_TYPE_REGION3:
98 table = table + ((address >> 31) & 0x7ff);
99 if (unlikely(*table & _REGION_ENTRY_INV))
100 return -0x3bUL;
101 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
102 case _ASCE_TYPE_SEGMENT:
103 table = table + ((address >> 20) & 0x7ff);
104 if (unlikely(*table & _SEGMENT_ENTRY_INV))
105 return -0x10UL;
106 if (unlikely(*table & _SEGMENT_ENTRY_LARGE)) {
107 if (write && (*table & _SEGMENT_ENTRY_RO))
108 return -0x04UL;
109 return (*table & _SEGMENT_ENTRY_ORIGIN_LARGE) +
110 (address & ~_SEGMENT_ENTRY_ORIGIN_LARGE);
111 }
112 table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN);
113 }
114 table = table + ((address >> 12) & 0xff);
115 if (unlikely(*table & _PAGE_INVALID))
116 return -0x11UL;
117 if (write && (*table & _PAGE_RO))
118 return -0x04UL;
119 return (*table & PAGE_MASK) + (address & ~PAGE_MASK);
120}
87 121
88 pgd = pgd_offset(mm, addr); 122#else /* CONFIG_64BIT */
89 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
90 return -0x3aUL;
91 123
92 pud = pud_offset(pgd, addr); 124static unsigned long follow_table(struct mm_struct *mm,
93 if (pud_none(*pud) || unlikely(pud_bad(*pud))) 125 unsigned long address, int write)
94 return -0x3bUL; 126{
127 unsigned long *table = (unsigned long *)__pa(mm->pgd);
95 128
96 pmd = pmd_offset(pud, addr); 129 table = table + ((address >> 20) & 0x7ff);
97 if (pmd_none(*pmd)) 130 if (unlikely(*table & _SEGMENT_ENTRY_INV))
98 return -0x10UL; 131 return -0x10UL;
99 if (pmd_large(*pmd)) { 132 table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN);
100 if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO)) 133 table = table + ((address >> 12) & 0xff);
101 return -0x04UL; 134 if (unlikely(*table & _PAGE_INVALID))
102 return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK);
103 }
104 if (unlikely(pmd_bad(*pmd)))
105 return -0x10UL;
106
107 ptep = pte_offset_map(pmd, addr);
108 if (!pte_present(*ptep))
109 return -0x11UL; 135 return -0x11UL;
110 if (write && (!pte_write(*ptep) || !pte_dirty(*ptep))) 136 if (write && (*table & _PAGE_RO))
111 return -0x04UL; 137 return -0x04UL;
112 138 return (*table & PAGE_MASK) + (address & ~PAGE_MASK);
113 return (pte_val(*ptep) & PAGE_MASK) + (addr & ~PAGE_MASK);
114} 139}
115 140
141#endif /* CONFIG_64BIT */
142
116static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, 143static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr,
117 size_t n, int write_user) 144 size_t n, int write_user)
118{ 145{
@@ -197,7 +224,7 @@ size_t copy_to_user_pt(size_t n, void __user *to, const void *from)
197 224
198static size_t clear_user_pt(size_t n, void __user *to) 225static size_t clear_user_pt(size_t n, void __user *to)
199{ 226{
200 void *zpage = &empty_zero_page; 227 void *zpage = (void *) empty_zero_page;
201 long done, size, ret; 228 long done, size, ret;
202 229
203 done = 0; 230 done = 0;
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c
index 96c6c2634cb4..eef17dcc3a41 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c
@@ -8,12 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7203_pfc_resources[] = {
18 [0] = {
19 .start = 0xfffe3800,
20 .end = 0xfffe3a9f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7203", NULL, 0); 27 return sh_pfc_register("pfc-sh7203", sh7203_pfc_resources,
28 ARRAY_SIZE(sh7203_pfc_resources));
18} 29}
19arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c
index b1b7c1bae127..569decbd6d93 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c
@@ -8,12 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7264_pfc_resources[] = {
18 [0] = {
19 .start = 0xfffe3800,
20 .end = 0xfffe393f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7264", NULL, 0); 27 return sh_pfc_register("pfc-sh7264", sh7264_pfc_resources,
28 ARRAY_SIZE(sh7264_pfc_resources));
18} 29}
19arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
index dc2a86830456..1825b0bd523d 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
@@ -13,8 +13,17 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <cpu/pfc.h> 14#include <cpu/pfc.h>
15 15
16static struct resource sh7269_pfc_resources[] = {
17 [0] = {
18 .start = 0xfffe3800,
19 .end = 0xfffe391f,
20 .flags = IORESOURCE_MEM,
21 },
22};
23
16static int __init plat_pinmux_setup(void) 24static int __init plat_pinmux_setup(void)
17{ 25{
18 return sh_pfc_register("pfc-sh7269", NULL, 0); 26 return sh_pfc_register("pfc-sh7269", sh7269_pfc_resources,
27 ARRAY_SIZE(sh7269_pfc_resources));
19} 28}
20arch_initcall(plat_pinmux_setup); 29arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c b/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c
index 7d3744ac7b08..26e90a66ebb7 100644
--- a/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c
@@ -8,13 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7720_pfc_resources[] = {
18 [0] = {
19 .start = 0xa4050100,
20 .end = 0xa405016f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7720", NULL, 0); 27 return sh_pfc_register("pfc-sh7720", sh7720_pfc_resources,
28 ARRAY_SIZE(sh7720_pfc_resources));
18} 29}
19
20arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
index d9bcc4290997..271bbc864929 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
@@ -1,10 +1,20 @@
1#include <linux/bug.h>
1#include <linux/init.h> 2#include <linux/init.h>
2#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/ioport.h>
3#include <cpu/pfc.h> 5#include <cpu/pfc.h>
4 6
7static struct resource sh7722_pfc_resources[] = {
8 [0] = {
9 .start = 0xa4050100,
10 .end = 0xa405018f,
11 .flags = IORESOURCE_MEM,
12 },
13};
14
5static int __init plat_pinmux_setup(void) 15static int __init plat_pinmux_setup(void)
6{ 16{
7 return sh_pfc_register("pfc-sh7722", NULL, 0); 17 return sh_pfc_register("pfc-sh7722", sh7722_pfc_resources,
18 ARRAY_SIZE(sh7722_pfc_resources));
8} 19}
9
10arch_initcall(plat_pinmux_setup); 20arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c
index bcec7ad7f783..99c637d5bf7a 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c
@@ -8,13 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7723_pfc_resources[] = {
18 [0] = {
19 .start = 0xa4050100,
20 .end = 0xa405016f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7723", NULL, 0); 27 return sh_pfc_register("pfc-sh7723", sh7723_pfc_resources,
28 ARRAY_SIZE(sh7723_pfc_resources));
18} 29}
19
20arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c
index 5c3541d6aed8..63be4749e341 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c
@@ -13,12 +13,23 @@
13 * for more details. 13 * for more details.
14 */ 14 */
15 15
16#include <linux/bug.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/ioport.h>
18#include <cpu/pfc.h> 20#include <cpu/pfc.h>
19 21
22static struct resource sh7724_pfc_resources[] = {
23 [0] = {
24 .start = 0xa4050100,
25 .end = 0xa405016f,
26 .flags = IORESOURCE_MEM,
27 },
28};
29
20static int __init plat_pinmux_setup(void) 30static int __init plat_pinmux_setup(void)
21{ 31{
22 return sh_pfc_register("pfc-sh7724", NULL, 0); 32 return sh_pfc_register("pfc-sh7724", sh7724_pfc_resources,
33 ARRAY_SIZE(sh7724_pfc_resources));
23} 34}
24arch_initcall(plat_pinmux_setup); 35arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
index cda6bd177b8c..567745d44221 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
@@ -13,12 +13,23 @@
13 * for more details. 13 * for more details.
14 */ 14 */
15 15
16#include <linux/bug.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/ioport.h>
18#include <cpu/pfc.h> 20#include <cpu/pfc.h>
19 21
22static struct resource sh7757_pfc_resources[] = {
23 [0] = {
24 .start = 0xffec0000,
25 .end = 0xffec008f,
26 .flags = IORESOURCE_MEM,
27 },
28};
29
20static int __init plat_pinmux_setup(void) 30static int __init plat_pinmux_setup(void)
21{ 31{
22 return sh_pfc_register("pfc-sh7757", NULL, 0); 32 return sh_pfc_register("pfc-sh7757", sh7757_pfc_resources,
33 ARRAY_SIZE(sh7757_pfc_resources));
23} 34}
24arch_initcall(plat_pinmux_setup); 35arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c
index 01055b809f64..e336ab8b5125 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c
@@ -8,13 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7785_pfc_resources[] = {
18 [0] = {
19 .start = 0xffe70000,
20 .end = 0xffe7008f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7785", NULL, 0); 27 return sh_pfc_register("pfc-sh7785", sh7785_pfc_resources,
28 ARRAY_SIZE(sh7785_pfc_resources));
18} 29}
19
20arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c
index 3061778d55da..9a459556a2f7 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c
@@ -13,13 +13,23 @@
13 * for more details. 13 * for more details.
14 */ 14 */
15 15
16#include <linux/bug.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/ioport.h>
18#include <cpu/pfc.h> 20#include <cpu/pfc.h>
19 21
22static struct resource sh7786_pfc_resources[] = {
23 [0] = {
24 .start = 0xffcc0000,
25 .end = 0xffcc008f,
26 .flags = IORESOURCE_MEM,
27 },
28};
29
20static int __init plat_pinmux_setup(void) 30static int __init plat_pinmux_setup(void)
21{ 31{
22 return sh_pfc_register("pfc-sh7786", NULL, 0); 32 return sh_pfc_register("pfc-sh7786", sh7786_pfc_resources,
33 ARRAY_SIZE(sh7786_pfc_resources));
23} 34}
24
25arch_initcall(plat_pinmux_setup); 35arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c b/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
index ace84acc55ea..444bf25c60fa 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
@@ -7,12 +7,23 @@
7 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details. 8 * for more details.
9 */ 9 */
10#include <linux/bug.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/ioport.h>
12#include <cpu/pfc.h> 14#include <cpu/pfc.h>
13 15
14static int __init shx3_pinmux_setup(void) 16static struct resource shx3_pfc_resources[] = {
17 [0] = {
18 .start = 0xffc70000,
19 .end = 0xffc7001f,
20 .flags = IORESOURCE_MEM,
21 },
22};
23
24static int __init plat_pinmux_setup(void)
15{ 25{
16 return sh_pfc_register("pfc-shx3", NULL, 0); 26 return sh_pfc_register("pfc-shx3", shx3_pfc_resources,
27 ARRAY_SIZE(shx3_pfc_resources));
17} 28}
18arch_initcall(shx3_pinmux_setup); 29arch_initcall(plat_pinmux_setup);
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index d1e15f7b59c6..7a5aa1a7864e 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -1004,15 +1004,8 @@ void __cpuinit setup_cpu(int boot)
1004 1004
1005#ifdef CONFIG_BLK_DEV_INITRD 1005#ifdef CONFIG_BLK_DEV_INITRD
1006 1006
1007/*
1008 * Note that the kernel can potentially support other compression
1009 * techniques than gz, though we don't do so by default. If we ever
1010 * decide to do so we can either look for other filename extensions,
1011 * or just allow a file with this name to be compressed with an
1012 * arbitrary compressor (somewhat counterintuitively).
1013 */
1014static int __initdata set_initramfs_file; 1007static int __initdata set_initramfs_file;
1015static char __initdata initramfs_file[128] = "initramfs.cpio.gz"; 1008static char __initdata initramfs_file[128] = "initramfs";
1016 1009
1017static int __init setup_initramfs_file(char *str) 1010static int __init setup_initramfs_file(char *str)
1018{ 1011{
@@ -1026,9 +1019,9 @@ static int __init setup_initramfs_file(char *str)
1026early_param("initramfs_file", setup_initramfs_file); 1019early_param("initramfs_file", setup_initramfs_file);
1027 1020
1028/* 1021/*
1029 * We look for an "initramfs.cpio.gz" file in the hvfs. 1022 * We look for a file called "initramfs" in the hvfs. If there is one, we
1030 * If there is one, we allocate some memory for it and it will be 1023 * allocate some memory for it and it will be unpacked to the initramfs.
1031 * unpacked to the initramfs. 1024 * If it's compressed, the initd code will uncompress it first.
1032 */ 1025 */
1033static void __init load_hv_initrd(void) 1026static void __init load_hv_initrd(void)
1034{ 1027{
@@ -1038,10 +1031,16 @@ static void __init load_hv_initrd(void)
1038 1031
1039 fd = hv_fs_findfile((HV_VirtAddr) initramfs_file); 1032 fd = hv_fs_findfile((HV_VirtAddr) initramfs_file);
1040 if (fd == HV_ENOENT) { 1033 if (fd == HV_ENOENT) {
1041 if (set_initramfs_file) 1034 if (set_initramfs_file) {
1042 pr_warning("No such hvfs initramfs file '%s'\n", 1035 pr_warning("No such hvfs initramfs file '%s'\n",
1043 initramfs_file); 1036 initramfs_file);
1044 return; 1037 return;
1038 } else {
1039 /* Try old backwards-compatible name. */
1040 fd = hv_fs_findfile((HV_VirtAddr)"initramfs.cpio.gz");
1041 if (fd == HV_ENOENT)
1042 return;
1043 }
1045 } 1044 }
1046 BUG_ON(fd < 0); 1045 BUG_ON(fd < 0);
1047 stat = hv_fs_fstat(fd); 1046 stat = hv_fs_fstat(fd);
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 8a84501acb1b..5ef205c5f37b 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -4,7 +4,7 @@
4# create a compressed vmlinux image from the original vmlinux 4# create a compressed vmlinux image from the original vmlinux
5# 5#
6 6
7targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o 7targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo
8 8
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
@@ -29,7 +29,6 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
29 $(obj)/piggy.o 29 $(obj)/piggy.o
30 30
31$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 31$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
32$(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone
33 32
34ifeq ($(CONFIG_EFI_STUB), y) 33ifeq ($(CONFIG_EFI_STUB), y)
35 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o 34 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
@@ -43,7 +42,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
43$(obj)/vmlinux.bin: vmlinux FORCE 42$(obj)/vmlinux.bin: vmlinux FORCE
44 $(call if_changed,objcopy) 43 $(call if_changed,objcopy)
45 44
46targets += vmlinux.bin.all vmlinux.relocs 45targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
47 46
48CMD_RELOCS = arch/x86/tools/relocs 47CMD_RELOCS = arch/x86/tools/relocs
49quiet_cmd_relocs = RELOCS $@ 48quiet_cmd_relocs = RELOCS $@
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index 1ace47b62592..2e188d68397c 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -29,13 +29,13 @@ extern const unsigned long sys_call_table[];
29 */ 29 */
30static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 30static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
31{ 31{
32 return regs->orig_ax & __SYSCALL_MASK; 32 return regs->orig_ax;
33} 33}
34 34
35static inline void syscall_rollback(struct task_struct *task, 35static inline void syscall_rollback(struct task_struct *task,
36 struct pt_regs *regs) 36 struct pt_regs *regs)
37{ 37{
38 regs->ax = regs->orig_ax & __SYSCALL_MASK; 38 regs->ax = regs->orig_ax;
39} 39}
40 40
41static inline long syscall_get_error(struct task_struct *task, 41static inline long syscall_get_error(struct task_struct *task,
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 02b51dd4e4ad..f77df1c5de6e 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1857,7 +1857,7 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data)
1857 if (!pv_eoi_enabled(vcpu)) 1857 if (!pv_eoi_enabled(vcpu))
1858 return 0; 1858 return 0;
1859 return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, 1859 return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data,
1860 addr); 1860 addr, sizeof(u8));
1861} 1861}
1862 1862
1863void kvm_lapic_init(void) 1863void kvm_lapic_init(void)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f19ac0aca60d..e1721324c271 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1823,7 +1823,8 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
1823 return 0; 1823 return 0;
1824 } 1824 }
1825 1825
1826 if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa)) 1826 if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa,
1827 sizeof(u32)))
1827 return 1; 1828 return 1;
1828 1829
1829 vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS); 1830 vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS);
@@ -1952,12 +1953,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
1952 1953
1953 gpa_offset = data & ~(PAGE_MASK | 1); 1954 gpa_offset = data & ~(PAGE_MASK | 1);
1954 1955
1955 /* Check that the address is 32-byte aligned. */
1956 if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1))
1957 break;
1958
1959 if (kvm_gfn_to_hva_cache_init(vcpu->kvm, 1956 if (kvm_gfn_to_hva_cache_init(vcpu->kvm,
1960 &vcpu->arch.pv_time, data & ~1ULL)) 1957 &vcpu->arch.pv_time, data & ~1ULL,
1958 sizeof(struct pvclock_vcpu_time_info)))
1961 vcpu->arch.pv_time_enabled = false; 1959 vcpu->arch.pv_time_enabled = false;
1962 else 1960 else
1963 vcpu->arch.pv_time_enabled = true; 1961 vcpu->arch.pv_time_enabled = true;
@@ -1977,7 +1975,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
1977 return 1; 1975 return 1;
1978 1976
1979 if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime, 1977 if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime,
1980 data & KVM_STEAL_VALID_BITS)) 1978 data & KVM_STEAL_VALID_BITS,
1979 sizeof(struct kvm_steal_time)))
1981 return 1; 1980 return 1;
1982 1981
1983 vcpu->arch.st.msr_val = data; 1982 vcpu->arch.st.msr_val = data;
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 92ed9692c47e..4bf68c8d4797 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -396,7 +396,7 @@ config ACPI_CUSTOM_METHOD
396 396
397config ACPI_BGRT 397config ACPI_BGRT
398 bool "Boottime Graphics Resource Table support" 398 bool "Boottime Graphics Resource Table support"
399 depends on EFI 399 depends on EFI && X86
400 help 400 help
401 This driver adds support for exposing the ACPI Boottime Graphics 401 This driver adds support for exposing the ACPI Boottime Graphics
402 Resource Table, which allows the operating system to obtain 402 Resource Table, which allows the operating system to obtain
diff --git a/drivers/acpi/acpi_i2c.c b/drivers/acpi/acpi_i2c.c
index 82045e3f5cac..a82c7626aa9b 100644
--- a/drivers/acpi/acpi_i2c.c
+++ b/drivers/acpi/acpi_i2c.c
@@ -90,7 +90,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adapter)
90 acpi_handle handle; 90 acpi_handle handle;
91 acpi_status status; 91 acpi_status status;
92 92
93 handle = ACPI_HANDLE(&adapter->dev); 93 handle = ACPI_HANDLE(adapter->dev.parent);
94 if (!handle) 94 if (!handle)
95 return; 95 return;
96 96
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 5ff173066127..6ae5e440436e 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -415,7 +415,6 @@ static int acpi_pci_root_add(struct acpi_device *device,
415 struct acpi_pci_root *root; 415 struct acpi_pci_root *root;
416 struct acpi_pci_driver *driver; 416 struct acpi_pci_driver *driver;
417 u32 flags, base_flags; 417 u32 flags, base_flags;
418 bool is_osc_granted = false;
419 418
420 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); 419 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
421 if (!root) 420 if (!root)
@@ -476,6 +475,30 @@ static int acpi_pci_root_add(struct acpi_device *device,
476 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; 475 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
477 acpi_pci_osc_support(root, flags); 476 acpi_pci_osc_support(root, flags);
478 477
478 /*
479 * TBD: Need PCI interface for enumeration/configuration of roots.
480 */
481
482 mutex_lock(&acpi_pci_root_lock);
483 list_add_tail(&root->node, &acpi_pci_roots);
484 mutex_unlock(&acpi_pci_root_lock);
485
486 /*
487 * Scan the Root Bridge
488 * --------------------
489 * Must do this prior to any attempt to bind the root device, as the
490 * PCI namespace does not get created until this call is made (and
491 * thus the root bridge's pci_dev does not exist).
492 */
493 root->bus = pci_acpi_scan_root(root);
494 if (!root->bus) {
495 printk(KERN_ERR PREFIX
496 "Bus %04x:%02x not present in PCI namespace\n",
497 root->segment, (unsigned int)root->secondary.start);
498 result = -ENODEV;
499 goto out_del_root;
500 }
501
479 /* Indicate support for various _OSC capabilities. */ 502 /* Indicate support for various _OSC capabilities. */
480 if (pci_ext_cfg_avail()) 503 if (pci_ext_cfg_avail())
481 flags |= OSC_EXT_PCI_CONFIG_SUPPORT; 504 flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
@@ -494,6 +517,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
494 flags = base_flags; 517 flags = base_flags;
495 } 518 }
496 } 519 }
520
497 if (!pcie_ports_disabled 521 if (!pcie_ports_disabled
498 && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { 522 && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
499 flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 523 flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
@@ -514,54 +538,28 @@ static int acpi_pci_root_add(struct acpi_device *device,
514 status = acpi_pci_osc_control_set(device->handle, &flags, 538 status = acpi_pci_osc_control_set(device->handle, &flags,
515 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); 539 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
516 if (ACPI_SUCCESS(status)) { 540 if (ACPI_SUCCESS(status)) {
517 is_osc_granted = true;
518 dev_info(&device->dev, 541 dev_info(&device->dev,
519 "ACPI _OSC control (0x%02x) granted\n", flags); 542 "ACPI _OSC control (0x%02x) granted\n", flags);
543 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
544 /*
545 * We have ASPM control, but the FADT indicates
546 * that it's unsupported. Clear it.
547 */
548 pcie_clear_aspm(root->bus);
549 }
520 } else { 550 } else {
521 is_osc_granted = false;
522 dev_info(&device->dev, 551 dev_info(&device->dev,
523 "ACPI _OSC request failed (%s), " 552 "ACPI _OSC request failed (%s), "
524 "returned control mask: 0x%02x\n", 553 "returned control mask: 0x%02x\n",
525 acpi_format_exception(status), flags); 554 acpi_format_exception(status), flags);
555 pr_info("ACPI _OSC control for PCIe not granted, "
556 "disabling ASPM\n");
557 pcie_no_aspm();
526 } 558 }
527 } else { 559 } else {
528 dev_info(&device->dev, 560 dev_info(&device->dev,
529 "Unable to request _OSC control " 561 "Unable to request _OSC control "
530 "(_OSC support mask: 0x%02x)\n", flags); 562 "(_OSC support mask: 0x%02x)\n", flags);
531 }
532
533 /*
534 * TBD: Need PCI interface for enumeration/configuration of roots.
535 */
536
537 mutex_lock(&acpi_pci_root_lock);
538 list_add_tail(&root->node, &acpi_pci_roots);
539 mutex_unlock(&acpi_pci_root_lock);
540
541 /*
542 * Scan the Root Bridge
543 * --------------------
544 * Must do this prior to any attempt to bind the root device, as the
545 * PCI namespace does not get created until this call is made (and
546 * thus the root bridge's pci_dev does not exist).
547 */
548 root->bus = pci_acpi_scan_root(root);
549 if (!root->bus) {
550 printk(KERN_ERR PREFIX
551 "Bus %04x:%02x not present in PCI namespace\n",
552 root->segment, (unsigned int)root->secondary.start);
553 result = -ENODEV;
554 goto out_del_root;
555 }
556
557 /* ASPM setting */
558 if (is_osc_granted) {
559 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM)
560 pcie_clear_aspm(root->bus);
561 } else {
562 pr_info("ACPI _OSC control for PCIe not granted, "
563 "disabling ASPM\n");
564 pcie_no_aspm();
565 } 563 }
566 564
567 pci_acpi_add_bus_pm_notifier(device, root->bus); 565 pci_acpi_add_bus_pm_notifier(device, root->bus);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index fc95308e9a11..ee255c60bdac 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -66,7 +66,8 @@ module_param(latency_factor, uint, 0644);
66 66
67static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); 67static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
68 68
69static struct acpi_processor_cx *acpi_cstate[CPUIDLE_STATE_MAX]; 69static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX],
70 acpi_cstate);
70 71
71static int disabled_by_idle_boot_param(void) 72static int disabled_by_idle_boot_param(void)
72{ 73{
@@ -722,7 +723,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
722 struct cpuidle_driver *drv, int index) 723 struct cpuidle_driver *drv, int index)
723{ 724{
724 struct acpi_processor *pr; 725 struct acpi_processor *pr;
725 struct acpi_processor_cx *cx = acpi_cstate[index]; 726 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
726 727
727 pr = __this_cpu_read(processors); 728 pr = __this_cpu_read(processors);
728 729
@@ -745,7 +746,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
745 */ 746 */
746static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) 747static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
747{ 748{
748 struct acpi_processor_cx *cx = acpi_cstate[index]; 749 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
749 750
750 ACPI_FLUSH_CPU_CACHE(); 751 ACPI_FLUSH_CPU_CACHE();
751 752
@@ -775,7 +776,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
775 struct cpuidle_driver *drv, int index) 776 struct cpuidle_driver *drv, int index)
776{ 777{
777 struct acpi_processor *pr; 778 struct acpi_processor *pr;
778 struct acpi_processor_cx *cx = acpi_cstate[index]; 779 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
779 780
780 pr = __this_cpu_read(processors); 781 pr = __this_cpu_read(processors);
781 782
@@ -833,7 +834,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
833 struct cpuidle_driver *drv, int index) 834 struct cpuidle_driver *drv, int index)
834{ 835{
835 struct acpi_processor *pr; 836 struct acpi_processor *pr;
836 struct acpi_processor_cx *cx = acpi_cstate[index]; 837 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
837 838
838 pr = __this_cpu_read(processors); 839 pr = __this_cpu_read(processors);
839 840
@@ -960,7 +961,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
960 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 961 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
961 continue; 962 continue;
962#endif 963#endif
963 acpi_cstate[count] = cx; 964 per_cpu(acpi_cstate[count], dev->cpu) = cx;
964 965
965 count++; 966 count++;
966 if (count == CPUIDLE_STATE_MAX) 967 if (count == CPUIDLE_STATE_MAX)
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 5f74587ef258..71671c42ef45 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -46,6 +46,7 @@
46#include "power.h" 46#include "power.h"
47 47
48static DEFINE_MUTEX(dev_pm_qos_mtx); 48static DEFINE_MUTEX(dev_pm_qos_mtx);
49static DEFINE_MUTEX(dev_pm_qos_sysfs_mtx);
49 50
50static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); 51static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers);
51 52
@@ -216,12 +217,17 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
216 struct pm_qos_constraints *c; 217 struct pm_qos_constraints *c;
217 struct pm_qos_flags *f; 218 struct pm_qos_flags *f;
218 219
219 mutex_lock(&dev_pm_qos_mtx); 220 mutex_lock(&dev_pm_qos_sysfs_mtx);
220 221
221 /* 222 /*
222 * If the device's PM QoS resume latency limit or PM QoS flags have been 223 * If the device's PM QoS resume latency limit or PM QoS flags have been
223 * exposed to user space, they have to be hidden at this point. 224 * exposed to user space, they have to be hidden at this point.
224 */ 225 */
226 pm_qos_sysfs_remove_latency(dev);
227 pm_qos_sysfs_remove_flags(dev);
228
229 mutex_lock(&dev_pm_qos_mtx);
230
225 __dev_pm_qos_hide_latency_limit(dev); 231 __dev_pm_qos_hide_latency_limit(dev);
226 __dev_pm_qos_hide_flags(dev); 232 __dev_pm_qos_hide_flags(dev);
227 233
@@ -254,6 +260,8 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
254 260
255 out: 261 out:
256 mutex_unlock(&dev_pm_qos_mtx); 262 mutex_unlock(&dev_pm_qos_mtx);
263
264 mutex_unlock(&dev_pm_qos_sysfs_mtx);
257} 265}
258 266
259/** 267/**
@@ -558,6 +566,14 @@ static void __dev_pm_qos_drop_user_request(struct device *dev,
558 kfree(req); 566 kfree(req);
559} 567}
560 568
569static void dev_pm_qos_drop_user_request(struct device *dev,
570 enum dev_pm_qos_req_type type)
571{
572 mutex_lock(&dev_pm_qos_mtx);
573 __dev_pm_qos_drop_user_request(dev, type);
574 mutex_unlock(&dev_pm_qos_mtx);
575}
576
561/** 577/**
562 * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. 578 * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space.
563 * @dev: Device whose PM QoS latency limit is to be exposed to user space. 579 * @dev: Device whose PM QoS latency limit is to be exposed to user space.
@@ -581,6 +597,8 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
581 return ret; 597 return ret;
582 } 598 }
583 599
600 mutex_lock(&dev_pm_qos_sysfs_mtx);
601
584 mutex_lock(&dev_pm_qos_mtx); 602 mutex_lock(&dev_pm_qos_mtx);
585 603
586 if (IS_ERR_OR_NULL(dev->power.qos)) 604 if (IS_ERR_OR_NULL(dev->power.qos))
@@ -591,26 +609,27 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
591 if (ret < 0) { 609 if (ret < 0) {
592 __dev_pm_qos_remove_request(req); 610 __dev_pm_qos_remove_request(req);
593 kfree(req); 611 kfree(req);
612 mutex_unlock(&dev_pm_qos_mtx);
594 goto out; 613 goto out;
595 } 614 }
596
597 dev->power.qos->latency_req = req; 615 dev->power.qos->latency_req = req;
616
617 mutex_unlock(&dev_pm_qos_mtx);
618
598 ret = pm_qos_sysfs_add_latency(dev); 619 ret = pm_qos_sysfs_add_latency(dev);
599 if (ret) 620 if (ret)
600 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 621 dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
601 622
602 out: 623 out:
603 mutex_unlock(&dev_pm_qos_mtx); 624 mutex_unlock(&dev_pm_qos_sysfs_mtx);
604 return ret; 625 return ret;
605} 626}
606EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); 627EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit);
607 628
608static void __dev_pm_qos_hide_latency_limit(struct device *dev) 629static void __dev_pm_qos_hide_latency_limit(struct device *dev)
609{ 630{
610 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) { 631 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req)
611 pm_qos_sysfs_remove_latency(dev);
612 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 632 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
613 }
614} 633}
615 634
616/** 635/**
@@ -619,9 +638,15 @@ static void __dev_pm_qos_hide_latency_limit(struct device *dev)
619 */ 638 */
620void dev_pm_qos_hide_latency_limit(struct device *dev) 639void dev_pm_qos_hide_latency_limit(struct device *dev)
621{ 640{
641 mutex_lock(&dev_pm_qos_sysfs_mtx);
642
643 pm_qos_sysfs_remove_latency(dev);
644
622 mutex_lock(&dev_pm_qos_mtx); 645 mutex_lock(&dev_pm_qos_mtx);
623 __dev_pm_qos_hide_latency_limit(dev); 646 __dev_pm_qos_hide_latency_limit(dev);
624 mutex_unlock(&dev_pm_qos_mtx); 647 mutex_unlock(&dev_pm_qos_mtx);
648
649 mutex_unlock(&dev_pm_qos_sysfs_mtx);
625} 650}
626EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); 651EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit);
627 652
@@ -649,6 +674,8 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
649 } 674 }
650 675
651 pm_runtime_get_sync(dev); 676 pm_runtime_get_sync(dev);
677 mutex_lock(&dev_pm_qos_sysfs_mtx);
678
652 mutex_lock(&dev_pm_qos_mtx); 679 mutex_lock(&dev_pm_qos_mtx);
653 680
654 if (IS_ERR_OR_NULL(dev->power.qos)) 681 if (IS_ERR_OR_NULL(dev->power.qos))
@@ -659,16 +686,19 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
659 if (ret < 0) { 686 if (ret < 0) {
660 __dev_pm_qos_remove_request(req); 687 __dev_pm_qos_remove_request(req);
661 kfree(req); 688 kfree(req);
689 mutex_unlock(&dev_pm_qos_mtx);
662 goto out; 690 goto out;
663 } 691 }
664
665 dev->power.qos->flags_req = req; 692 dev->power.qos->flags_req = req;
693
694 mutex_unlock(&dev_pm_qos_mtx);
695
666 ret = pm_qos_sysfs_add_flags(dev); 696 ret = pm_qos_sysfs_add_flags(dev);
667 if (ret) 697 if (ret)
668 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 698 dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
669 699
670 out: 700 out:
671 mutex_unlock(&dev_pm_qos_mtx); 701 mutex_unlock(&dev_pm_qos_sysfs_mtx);
672 pm_runtime_put(dev); 702 pm_runtime_put(dev);
673 return ret; 703 return ret;
674} 704}
@@ -676,10 +706,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags);
676 706
677static void __dev_pm_qos_hide_flags(struct device *dev) 707static void __dev_pm_qos_hide_flags(struct device *dev)
678{ 708{
679 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) { 709 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req)
680 pm_qos_sysfs_remove_flags(dev);
681 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 710 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
682 }
683} 711}
684 712
685/** 713/**
@@ -689,9 +717,15 @@ static void __dev_pm_qos_hide_flags(struct device *dev)
689void dev_pm_qos_hide_flags(struct device *dev) 717void dev_pm_qos_hide_flags(struct device *dev)
690{ 718{
691 pm_runtime_get_sync(dev); 719 pm_runtime_get_sync(dev);
720 mutex_lock(&dev_pm_qos_sysfs_mtx);
721
722 pm_qos_sysfs_remove_flags(dev);
723
692 mutex_lock(&dev_pm_qos_mtx); 724 mutex_lock(&dev_pm_qos_mtx);
693 __dev_pm_qos_hide_flags(dev); 725 __dev_pm_qos_hide_flags(dev);
694 mutex_unlock(&dev_pm_qos_mtx); 726 mutex_unlock(&dev_pm_qos_mtx);
727
728 mutex_unlock(&dev_pm_qos_sysfs_mtx);
695 pm_runtime_put(dev); 729 pm_runtime_put(dev);
696} 730}
697EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); 731EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index e6732cf7c06e..79f4fca9877a 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
398 base = 0; 398 base = 0;
399 399
400 if (max < rbnode->base_reg + rbnode->blklen) 400 if (max < rbnode->base_reg + rbnode->blklen)
401 end = rbnode->base_reg + rbnode->blklen - max; 401 end = max - rbnode->base_reg + 1;
402 else 402 else
403 end = rbnode->blklen; 403 end = rbnode->blklen;
404 404
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 3d2367501fd0..d34adef1e63e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -710,12 +710,12 @@ skip_format_initialization:
710 } 710 }
711 } 711 }
712 712
713 regmap_debugfs_init(map, config->name);
714
713 ret = regcache_init(map, config); 715 ret = regcache_init(map, config);
714 if (ret != 0) 716 if (ret != 0)
715 goto err_range; 717 goto err_range;
716 718
717 regmap_debugfs_init(map, config->name);
718
719 /* Add a devres resource for dev_get_regmap() */ 719 /* Add a devres resource for dev_get_regmap() */
720 m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); 720 m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
721 if (!m) { 721 if (!m) {
@@ -943,8 +943,7 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
943 unsigned int ival; 943 unsigned int ival;
944 int val_bytes = map->format.val_bytes; 944 int val_bytes = map->format.val_bytes;
945 for (i = 0; i < val_len / val_bytes; i++) { 945 for (i = 0; i < val_len / val_bytes; i++) {
946 memcpy(map->work_buf, val + (i * val_bytes), val_bytes); 946 ival = map->format.parse_val(val + (i * val_bytes));
947 ival = map->format.parse_val(map->work_buf);
948 ret = regcache_write(map, reg + (i * map->reg_stride), 947 ret = regcache_write(map, reg + (i * map->reg_stride),
949 ival); 948 ival);
950 if (ret) { 949 if (ret) {
@@ -1036,6 +1035,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
1036 kfree(async->work_buf); 1035 kfree(async->work_buf);
1037 kfree(async); 1036 kfree(async);
1038 } 1037 }
1038
1039 return ret;
1039 } 1040 }
1040 1041
1041 trace_regmap_hw_write_start(map->dev, reg, 1042 trace_regmap_hw_write_start(map->dev, reg,
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 25ef5c014fca..92b6d7c51e39 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -51,8 +51,9 @@ new_skb(ulong len)
51{ 51{
52 struct sk_buff *skb; 52 struct sk_buff *skb;
53 53
54 skb = alloc_skb(len, GFP_ATOMIC); 54 skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC);
55 if (skb) { 55 if (skb) {
56 skb_reserve(skb, MAX_HEADER);
56 skb_reset_mac_header(skb); 57 skb_reset_mac_header(skb);
57 skb_reset_network_header(skb); 58 skb_reset_network_header(skb);
58 skb->protocol = __constant_htons(ETH_P_AOE); 59 skb->protocol = __constant_htons(ETH_P_AOE);
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index fe5f6403417f..2c127f9c3f3b 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -922,6 +922,11 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
922 lo->lo_flags |= LO_FLAGS_PARTSCAN; 922 lo->lo_flags |= LO_FLAGS_PARTSCAN;
923 if (lo->lo_flags & LO_FLAGS_PARTSCAN) 923 if (lo->lo_flags & LO_FLAGS_PARTSCAN)
924 ioctl_by_bdev(bdev, BLKRRPART, 0); 924 ioctl_by_bdev(bdev, BLKRRPART, 0);
925
926 /* Grab the block_device to prevent its destruction after we
927 * put /dev/loopXX inode. Later in loop_clr_fd() we bdput(bdev).
928 */
929 bdgrab(bdev);
925 return 0; 930 return 0;
926 931
927out_clr: 932out_clr:
@@ -1031,8 +1036,10 @@ static int loop_clr_fd(struct loop_device *lo)
1031 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); 1036 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
1032 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); 1037 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
1033 memset(lo->lo_file_name, 0, LO_NAME_SIZE); 1038 memset(lo->lo_file_name, 0, LO_NAME_SIZE);
1034 if (bdev) 1039 if (bdev) {
1040 bdput(bdev);
1035 invalidate_bdev(bdev); 1041 invalidate_bdev(bdev);
1042 }
1036 set_capacity(lo->lo_disk, 0); 1043 set_capacity(lo->lo_disk, 0);
1037 loop_sysfs_exit(lo); 1044 loop_sysfs_exit(lo);
1038 if (bdev) { 1045 if (bdev) {
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 69ae5972713c..a0f7724852eb 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -380,6 +380,15 @@ void hwrng_unregister(struct hwrng *rng)
380} 380}
381EXPORT_SYMBOL_GPL(hwrng_unregister); 381EXPORT_SYMBOL_GPL(hwrng_unregister);
382 382
383static void __exit hwrng_exit(void)
384{
385 mutex_lock(&rng_mutex);
386 BUG_ON(current_rng);
387 kfree(rng_buffer);
388 mutex_unlock(&rng_mutex);
389}
390
391module_exit(hwrng_exit);
383 392
384MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); 393MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
385MODULE_LICENSE("GPL"); 394MODULE_LICENSE("GPL");
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index e905d5f53051..ce5f3fc25d6d 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -149,7 +149,8 @@ struct ports_device {
149 spinlock_t ports_lock; 149 spinlock_t ports_lock;
150 150
151 /* To protect the vq operations for the control channel */ 151 /* To protect the vq operations for the control channel */
152 spinlock_t cvq_lock; 152 spinlock_t c_ivq_lock;
153 spinlock_t c_ovq_lock;
153 154
154 /* The current config space is stored here */ 155 /* The current config space is stored here */
155 struct virtio_console_config config; 156 struct virtio_console_config config;
@@ -569,11 +570,14 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
569 vq = portdev->c_ovq; 570 vq = portdev->c_ovq;
570 571
571 sg_init_one(sg, &cpkt, sizeof(cpkt)); 572 sg_init_one(sg, &cpkt, sizeof(cpkt));
573
574 spin_lock(&portdev->c_ovq_lock);
572 if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { 575 if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) {
573 virtqueue_kick(vq); 576 virtqueue_kick(vq);
574 while (!virtqueue_get_buf(vq, &len)) 577 while (!virtqueue_get_buf(vq, &len))
575 cpu_relax(); 578 cpu_relax();
576 } 579 }
580 spin_unlock(&portdev->c_ovq_lock);
577 return 0; 581 return 0;
578} 582}
579 583
@@ -1436,7 +1440,7 @@ static int add_port(struct ports_device *portdev, u32 id)
1436 * rproc_serial does not want the console port, only 1440 * rproc_serial does not want the console port, only
1437 * the generic port implementation. 1441 * the generic port implementation.
1438 */ 1442 */
1439 port->host_connected = port->guest_connected = true; 1443 port->host_connected = true;
1440 else if (!use_multiport(port->portdev)) { 1444 else if (!use_multiport(port->portdev)) {
1441 /* 1445 /*
1442 * If we're not using multiport support, 1446 * If we're not using multiport support,
@@ -1709,23 +1713,23 @@ static void control_work_handler(struct work_struct *work)
1709 portdev = container_of(work, struct ports_device, control_work); 1713 portdev = container_of(work, struct ports_device, control_work);
1710 vq = portdev->c_ivq; 1714 vq = portdev->c_ivq;
1711 1715
1712 spin_lock(&portdev->cvq_lock); 1716 spin_lock(&portdev->c_ivq_lock);
1713 while ((buf = virtqueue_get_buf(vq, &len))) { 1717 while ((buf = virtqueue_get_buf(vq, &len))) {
1714 spin_unlock(&portdev->cvq_lock); 1718 spin_unlock(&portdev->c_ivq_lock);
1715 1719
1716 buf->len = len; 1720 buf->len = len;
1717 buf->offset = 0; 1721 buf->offset = 0;
1718 1722
1719 handle_control_message(portdev, buf); 1723 handle_control_message(portdev, buf);
1720 1724
1721 spin_lock(&portdev->cvq_lock); 1725 spin_lock(&portdev->c_ivq_lock);
1722 if (add_inbuf(portdev->c_ivq, buf) < 0) { 1726 if (add_inbuf(portdev->c_ivq, buf) < 0) {
1723 dev_warn(&portdev->vdev->dev, 1727 dev_warn(&portdev->vdev->dev,
1724 "Error adding buffer to queue\n"); 1728 "Error adding buffer to queue\n");
1725 free_buf(buf, false); 1729 free_buf(buf, false);
1726 } 1730 }
1727 } 1731 }
1728 spin_unlock(&portdev->cvq_lock); 1732 spin_unlock(&portdev->c_ivq_lock);
1729} 1733}
1730 1734
1731static void out_intr(struct virtqueue *vq) 1735static void out_intr(struct virtqueue *vq)
@@ -1752,13 +1756,23 @@ static void in_intr(struct virtqueue *vq)
1752 port->inbuf = get_inbuf(port); 1756 port->inbuf = get_inbuf(port);
1753 1757
1754 /* 1758 /*
1755 * Don't queue up data when port is closed. This condition 1759 * Normally the port should not accept data when the port is
1760 * closed. For generic serial ports, the host won't (shouldn't)
1761 * send data till the guest is connected. But this condition
1756 * can be reached when a console port is not yet connected (no 1762 * can be reached when a console port is not yet connected (no
1757 * tty is spawned) and the host sends out data to console 1763 * tty is spawned) and the other side sends out data over the
1758 * ports. For generic serial ports, the host won't 1764 * vring, or when a remote devices start sending data before
1759 * (shouldn't) send data till the guest is connected. 1765 * the ports are opened.
1766 *
1767 * A generic serial port will discard data if not connected,
1768 * while console ports and rproc-serial ports accepts data at
1769 * any time. rproc-serial is initiated with guest_connected to
1770 * false because port_fops_open expects this. Console ports are
1771 * hooked up with an HVC console and is initialized with
1772 * guest_connected to true.
1760 */ 1773 */
1761 if (!port->guest_connected) 1774
1775 if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev))
1762 discard_port_data(port); 1776 discard_port_data(port);
1763 1777
1764 spin_unlock_irqrestore(&port->inbuf_lock, flags); 1778 spin_unlock_irqrestore(&port->inbuf_lock, flags);
@@ -1986,10 +2000,12 @@ static int virtcons_probe(struct virtio_device *vdev)
1986 if (multiport) { 2000 if (multiport) {
1987 unsigned int nr_added_bufs; 2001 unsigned int nr_added_bufs;
1988 2002
1989 spin_lock_init(&portdev->cvq_lock); 2003 spin_lock_init(&portdev->c_ivq_lock);
2004 spin_lock_init(&portdev->c_ovq_lock);
1990 INIT_WORK(&portdev->control_work, &control_work_handler); 2005 INIT_WORK(&portdev->control_work, &control_work_handler);
1991 2006
1992 nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock); 2007 nr_added_bufs = fill_queue(portdev->c_ivq,
2008 &portdev->c_ivq_lock);
1993 if (!nr_added_bufs) { 2009 if (!nr_added_bufs) {
1994 dev_err(&vdev->dev, 2010 dev_err(&vdev->dev,
1995 "Error allocating buffers for control queue\n"); 2011 "Error allocating buffers for control queue\n");
@@ -2140,7 +2156,7 @@ static int virtcons_restore(struct virtio_device *vdev)
2140 return ret; 2156 return ret;
2141 2157
2142 if (use_multiport(portdev)) 2158 if (use_multiport(portdev))
2143 fill_queue(portdev->c_ivq, &portdev->cvq_lock); 2159 fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);
2144 2160
2145 list_for_each_entry(port, &portdev->ports, list) { 2161 list_for_each_entry(port, &portdev->ports, list) {
2146 port->in_vq = portdev->in_vqs[port->id]; 2162 port->in_vq = portdev->in_vqs[port->id];
diff --git a/drivers/clk/mmp/clk-mmp2.c b/drivers/clk/mmp/clk-mmp2.c
index ade435820c7e..d1f1a19d4351 100644
--- a/drivers/clk/mmp/clk-mmp2.c
+++ b/drivers/clk/mmp/clk-mmp2.c
@@ -221,7 +221,7 @@ void __init mmp2_clk_init(void)
221 221
222 clk = mmp_clk_register_apbc("gpio", "vctcxo", 222 clk = mmp_clk_register_apbc("gpio", "vctcxo",
223 apbc_base + APBC_GPIO, 10, 0, &clk_lock); 223 apbc_base + APBC_GPIO, 10, 0, &clk_lock);
224 clk_register_clkdev(clk, NULL, "pxa-gpio"); 224 clk_register_clkdev(clk, NULL, "mmp2-gpio");
225 225
226 clk = mmp_clk_register_apbc("kpc", "clk32", 226 clk = mmp_clk_register_apbc("kpc", "clk32",
227 apbc_base + APBC_KPC, 10, 0, &clk_lock); 227 apbc_base + APBC_KPC, 10, 0, &clk_lock);
diff --git a/drivers/clk/mmp/clk-pxa168.c b/drivers/clk/mmp/clk-pxa168.c
index e8d036c12cbf..28b3b51c794b 100644
--- a/drivers/clk/mmp/clk-pxa168.c
+++ b/drivers/clk/mmp/clk-pxa168.c
@@ -172,7 +172,7 @@ void __init pxa168_clk_init(void)
172 172
173 clk = mmp_clk_register_apbc("gpio", "vctcxo", 173 clk = mmp_clk_register_apbc("gpio", "vctcxo",
174 apbc_base + APBC_GPIO, 10, 0, &clk_lock); 174 apbc_base + APBC_GPIO, 10, 0, &clk_lock);
175 clk_register_clkdev(clk, NULL, "pxa-gpio"); 175 clk_register_clkdev(clk, NULL, "mmp-gpio");
176 176
177 clk = mmp_clk_register_apbc("kpc", "clk32", 177 clk = mmp_clk_register_apbc("kpc", "clk32",
178 apbc_base + APBC_KPC, 10, 0, &clk_lock); 178 apbc_base + APBC_KPC, 10, 0, &clk_lock);
diff --git a/drivers/clk/mmp/clk-pxa910.c b/drivers/clk/mmp/clk-pxa910.c
index 7048c31d6e7e..6ec05698ed38 100644
--- a/drivers/clk/mmp/clk-pxa910.c
+++ b/drivers/clk/mmp/clk-pxa910.c
@@ -177,7 +177,7 @@ void __init pxa910_clk_init(void)
177 177
178 clk = mmp_clk_register_apbc("gpio", "vctcxo", 178 clk = mmp_clk_register_apbc("gpio", "vctcxo",
179 apbc_base + APBC_GPIO, 10, 0, &clk_lock); 179 apbc_base + APBC_GPIO, 10, 0, &clk_lock);
180 clk_register_clkdev(clk, NULL, "pxa-gpio"); 180 clk_register_clkdev(clk, NULL, "mmp-gpio");
181 181
182 clk = mmp_clk_register_apbc("kpc", "clk32", 182 clk = mmp_clk_register_apbc("kpc", "clk32",
183 apbc_base + APBC_KPC, 10, 0, &clk_lock); 183 apbc_base + APBC_KPC, 10, 0, &clk_lock);
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index 1e2de7305362..f873dcefe0de 100644
--- a/drivers/clk/tegra/clk-tegra20.c
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -703,7 +703,7 @@ static void tegra20_pll_init(void)
703 clks[pll_a_out0] = clk; 703 clks[pll_a_out0] = clk;
704 704
705 /* PLLE */ 705 /* PLLE */
706 clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, NULL, 706 clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base,
707 0, 100000000, &pll_e_params, 707 0, 100000000, &pll_e_params,
708 0, pll_e_freq_table, NULL); 708 0, pll_e_freq_table, NULL);
709 clk_register_clkdev(clk, "pll_e", NULL); 709 clk_register_clkdev(clk, "pll_e", NULL);
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 4e5b7fb8927c..37d23a0f8c56 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -178,10 +178,16 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
178 178
179static int cpu0_cpufreq_probe(struct platform_device *pdev) 179static int cpu0_cpufreq_probe(struct platform_device *pdev)
180{ 180{
181 struct device_node *np; 181 struct device_node *np, *parent;
182 int ret; 182 int ret;
183 183
184 for_each_child_of_node(of_find_node_by_path("/cpus"), np) { 184 parent = of_find_node_by_path("/cpus");
185 if (!parent) {
186 pr_err("failed to find OF /cpus\n");
187 return -ENOENT;
188 }
189
190 for_each_child_of_node(parent, np) {
185 if (of_get_property(np, "operating-points", NULL)) 191 if (of_get_property(np, "operating-points", NULL))
186 break; 192 break;
187 } 193 }
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 46bde01eee62..cc4bd2f6838a 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -14,8 +14,8 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#ifndef _CPUFREQ_GOVERNER_H 17#ifndef _CPUFREQ_GOVERNOR_H
18#define _CPUFREQ_GOVERNER_H 18#define _CPUFREQ_GOVERNOR_H
19 19
20#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
21#include <linux/kobject.h> 21#include <linux/kobject.h>
@@ -175,4 +175,4 @@ bool need_load_eval(struct cpu_dbs_common_info *cdbs,
175 unsigned int sampling_rate); 175 unsigned int sampling_rate);
176int cpufreq_governor_dbs(struct dbs_data *dbs_data, 176int cpufreq_governor_dbs(struct dbs_data *dbs_data,
177 struct cpufreq_policy *policy, unsigned int event); 177 struct cpufreq_policy *policy, unsigned int event);
178#endif /* _CPUFREQ_GOVERNER_H */ 178#endif /* _CPUFREQ_GOVERNOR_H */
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 80b69971cf28..aeaea32bcfda 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -83,6 +83,7 @@ config INTEL_IOP_ADMA
83 83
84config DW_DMAC 84config DW_DMAC
85 tristate "Synopsys DesignWare AHB DMA support" 85 tristate "Synopsys DesignWare AHB DMA support"
86 depends on GENERIC_HARDIRQS
86 select DMA_ENGINE 87 select DMA_ENGINE
87 default y if CPU_AT32AP7000 88 default y if CPU_AT32AP7000
88 help 89 help
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c
index cdae207028a7..6c3fca97d346 100644
--- a/drivers/eisa/pci_eisa.c
+++ b/drivers/eisa/pci_eisa.c
@@ -19,10 +19,10 @@
19/* There is only *one* pci_eisa device per machine, right ? */ 19/* There is only *one* pci_eisa device per machine, right ? */
20static struct eisa_root_device pci_eisa_root; 20static struct eisa_root_device pci_eisa_root;
21 21
22static int __init pci_eisa_init(struct pci_dev *pdev, 22static int __init pci_eisa_init(struct pci_dev *pdev)
23 const struct pci_device_id *ent)
24{ 23{
25 int rc; 24 int rc, i;
25 struct resource *res, *bus_res = NULL;
26 26
27 if ((rc = pci_enable_device (pdev))) { 27 if ((rc = pci_enable_device (pdev))) {
28 printk (KERN_ERR "pci_eisa : Could not enable device %s\n", 28 printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
@@ -30,9 +30,30 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
30 return rc; 30 return rc;
31 } 31 }
32 32
33 /*
34 * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI
35 * device, so the resources available on EISA are the same as those
36 * available on the 82375 bus. This works the same as a PCI-PCI
37 * bridge in subtractive-decode mode (see pci_read_bridge_bases()).
38 * We assume other PCI-EISA bridges are similar.
39 *
40 * eisa_root_register() can only deal with a single io port resource,
41 * so we use the first valid io port resource.
42 */
43 pci_bus_for_each_resource(pdev->bus, res, i)
44 if (res && (res->flags & IORESOURCE_IO)) {
45 bus_res = res;
46 break;
47 }
48
49 if (!bus_res) {
50 dev_err(&pdev->dev, "No resources available\n");
51 return -1;
52 }
53
33 pci_eisa_root.dev = &pdev->dev; 54 pci_eisa_root.dev = &pdev->dev;
34 pci_eisa_root.res = pdev->bus->resource[0]; 55 pci_eisa_root.res = bus_res;
35 pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start; 56 pci_eisa_root.bus_base_addr = bus_res->start;
36 pci_eisa_root.slots = EISA_MAX_SLOTS; 57 pci_eisa_root.slots = EISA_MAX_SLOTS;
37 pci_eisa_root.dma_mask = pdev->dma_mask; 58 pci_eisa_root.dma_mask = pdev->dma_mask;
38 dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); 59 dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
@@ -45,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
45 return 0; 66 return 0;
46} 67}
47 68
48static struct pci_device_id pci_eisa_pci_tbl[] = { 69/*
49 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 70 * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init().
50 PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 }, 71 * Otherwise pnp resource will get enabled early and could prevent eisa
51 { 0, } 72 * to be initialized.
52}; 73 * Also need to make sure pci_eisa_init_early() is called after
74 * x86/pci_subsys_init().
75 * So need to use subsys_initcall_sync with it.
76 */
77static int __init pci_eisa_init_early(void)
78{
79 struct pci_dev *dev = NULL;
80 int ret;
53 81
54static struct pci_driver __refdata pci_eisa_driver = { 82 for_each_pci_dev(dev)
55 .name = "pci_eisa", 83 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) {
56 .id_table = pci_eisa_pci_tbl, 84 ret = pci_eisa_init(dev);
57 .probe = pci_eisa_init, 85 if (ret)
58}; 86 return ret;
87 }
59 88
60static int __init pci_eisa_init_module (void) 89 return 0;
61{
62 return pci_register_driver (&pci_eisa_driver);
63} 90}
64 91subsys_initcall_sync(pci_eisa_init_early);
65device_initcall(pci_eisa_init_module);
66MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl);
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
index f9dbd503fc40..de3c317bd3e2 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -214,7 +214,7 @@ static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr)
214 * If it can't be trusted, assume that the pin can be used as a GPIO. 214 * If it can't be trusted, assume that the pin can be used as a GPIO.
215 */ 215 */
216 if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) 216 if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f)))
217 return 1; 217 return 0;
218 218
219 return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; 219 return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV;
220} 220}
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index b820869ca93c..06ed257c5d31 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/irqdomain.h>
18#include <linux/bitops.h> 19#include <linux/bitops.h>
19#include <linux/workqueue.h> 20#include <linux/workqueue.h>
20#include <linux/gpio.h> 21#include <linux/gpio.h>
@@ -22,6 +23,7 @@
22#include <linux/amba/bus.h> 23#include <linux/amba/bus.h>
23#include <linux/amba/pl061.h> 24#include <linux/amba/pl061.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pinctrl/consumer.h>
25#include <linux/pm.h> 27#include <linux/pm.h>
26#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
27 29
@@ -51,8 +53,7 @@ struct pl061_gpio {
51 spinlock_t lock; 53 spinlock_t lock;
52 54
53 void __iomem *base; 55 void __iomem *base;
54 int irq_base; 56 struct irq_domain *domain;
55 struct irq_chip_generic *irq_gc;
56 struct gpio_chip gc; 57 struct gpio_chip gc;
57 58
58#ifdef CONFIG_PM 59#ifdef CONFIG_PM
@@ -60,6 +61,17 @@ struct pl061_gpio {
60#endif 61#endif
61}; 62};
62 63
64static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset)
65{
66 /*
67 * Map back to global GPIO space and request muxing, the direction
68 * parameter does not matter for this controller.
69 */
70 int gpio = chip->base + offset;
71
72 return pinctrl_request_gpio(gpio);
73}
74
63static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) 75static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
64{ 76{
65 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); 77 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
@@ -122,24 +134,20 @@ static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
122{ 134{
123 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); 135 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
124 136
125 if (chip->irq_base <= 0) 137 return irq_create_mapping(chip->domain, offset);
126 return -EINVAL;
127
128 return chip->irq_base + offset;
129} 138}
130 139
131static int pl061_irq_type(struct irq_data *d, unsigned trigger) 140static int pl061_irq_type(struct irq_data *d, unsigned trigger)
132{ 141{
133 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 142 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
134 struct pl061_gpio *chip = gc->private; 143 int offset = irqd_to_hwirq(d);
135 int offset = d->irq - chip->irq_base;
136 unsigned long flags; 144 unsigned long flags;
137 u8 gpiois, gpioibe, gpioiev; 145 u8 gpiois, gpioibe, gpioiev;
138 146
139 if (offset < 0 || offset >= PL061_GPIO_NR) 147 if (offset < 0 || offset >= PL061_GPIO_NR)
140 return -EINVAL; 148 return -EINVAL;
141 149
142 raw_spin_lock_irqsave(&gc->lock, flags); 150 spin_lock_irqsave(&chip->lock, flags);
143 151
144 gpioiev = readb(chip->base + GPIOIEV); 152 gpioiev = readb(chip->base + GPIOIEV);
145 153
@@ -168,7 +176,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
168 176
169 writeb(gpioiev, chip->base + GPIOIEV); 177 writeb(gpioiev, chip->base + GPIOIEV);
170 178
171 raw_spin_unlock_irqrestore(&gc->lock, flags); 179 spin_unlock_irqrestore(&chip->lock, flags);
172 180
173 return 0; 181 return 0;
174} 182}
@@ -192,31 +200,61 @@ static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
192 chained_irq_exit(irqchip, desc); 200 chained_irq_exit(irqchip, desc);
193} 201}
194 202
195static void __init pl061_init_gc(struct pl061_gpio *chip, int irq_base) 203static void pl061_irq_mask(struct irq_data *d)
196{ 204{
197 struct irq_chip_type *ct; 205 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
206 u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
207 u8 gpioie;
208
209 spin_lock(&chip->lock);
210 gpioie = readb(chip->base + GPIOIE) & ~mask;
211 writeb(gpioie, chip->base + GPIOIE);
212 spin_unlock(&chip->lock);
213}
214
215static void pl061_irq_unmask(struct irq_data *d)
216{
217 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
218 u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
219 u8 gpioie;
220
221 spin_lock(&chip->lock);
222 gpioie = readb(chip->base + GPIOIE) | mask;
223 writeb(gpioie, chip->base + GPIOIE);
224 spin_unlock(&chip->lock);
225}
198 226
199 chip->irq_gc = irq_alloc_generic_chip("gpio-pl061", 1, irq_base, 227static struct irq_chip pl061_irqchip = {
200 chip->base, handle_simple_irq); 228 .name = "pl061 gpio",
201 chip->irq_gc->private = chip; 229 .irq_mask = pl061_irq_mask,
230 .irq_unmask = pl061_irq_unmask,
231 .irq_set_type = pl061_irq_type,
232};
233
234static int pl061_irq_map(struct irq_domain *d, unsigned int virq,
235 irq_hw_number_t hw)
236{
237 struct pl061_gpio *chip = d->host_data;
202 238
203 ct = chip->irq_gc->chip_types; 239 irq_set_chip_and_handler_name(virq, &pl061_irqchip, handle_simple_irq,
204 ct->chip.irq_mask = irq_gc_mask_clr_bit; 240 "pl061");
205 ct->chip.irq_unmask = irq_gc_mask_set_bit; 241 irq_set_chip_data(virq, chip);
206 ct->chip.irq_set_type = pl061_irq_type; 242 irq_set_irq_type(virq, IRQ_TYPE_NONE);
207 ct->chip.irq_set_wake = irq_gc_set_wake;
208 ct->regs.mask = GPIOIE;
209 243
210 irq_setup_generic_chip(chip->irq_gc, IRQ_MSK(PL061_GPIO_NR), 244 return 0;
211 IRQ_GC_INIT_NESTED_LOCK, IRQ_NOREQUEST, 0);
212} 245}
213 246
247static const struct irq_domain_ops pl061_domain_ops = {
248 .map = pl061_irq_map,
249 .xlate = irq_domain_xlate_twocell,
250};
251
214static int pl061_probe(struct amba_device *adev, const struct amba_id *id) 252static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
215{ 253{
216 struct device *dev = &adev->dev; 254 struct device *dev = &adev->dev;
217 struct pl061_platform_data *pdata = dev->platform_data; 255 struct pl061_platform_data *pdata = dev->platform_data;
218 struct pl061_gpio *chip; 256 struct pl061_gpio *chip;
219 int ret, irq, i; 257 int ret, irq, i, irq_base;
220 258
221 chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); 259 chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
222 if (chip == NULL) 260 if (chip == NULL)
@@ -224,24 +262,31 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
224 262
225 if (pdata) { 263 if (pdata) {
226 chip->gc.base = pdata->gpio_base; 264 chip->gc.base = pdata->gpio_base;
227 chip->irq_base = pdata->irq_base; 265 irq_base = pdata->irq_base;
228 } else if (adev->dev.of_node) { 266 if (irq_base <= 0)
267 return -ENODEV;
268 } else {
229 chip->gc.base = -1; 269 chip->gc.base = -1;
230 chip->irq_base = 0; 270 irq_base = 0;
231 } else 271 }
232 return -ENODEV;
233 272
234 if (!devm_request_mem_region(dev, adev->res.start, 273 if (!devm_request_mem_region(dev, adev->res.start,
235 resource_size(&adev->res), "pl061")) 274 resource_size(&adev->res), "pl061"))
236 return -EBUSY; 275 return -EBUSY;
237 276
238 chip->base = devm_ioremap(dev, adev->res.start, 277 chip->base = devm_ioremap(dev, adev->res.start,
239 resource_size(&adev->res)); 278 resource_size(&adev->res));
240 if (chip->base == NULL) 279 if (!chip->base)
241 return -ENOMEM; 280 return -ENOMEM;
242 281
282 chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR,
283 irq_base, &pl061_domain_ops, chip);
284 if (!chip->domain)
285 return -ENODEV;
286
243 spin_lock_init(&chip->lock); 287 spin_lock_init(&chip->lock);
244 288
289 chip->gc.request = pl061_gpio_request;
245 chip->gc.direction_input = pl061_direction_input; 290 chip->gc.direction_input = pl061_direction_input;
246 chip->gc.direction_output = pl061_direction_output; 291 chip->gc.direction_output = pl061_direction_output;
247 chip->gc.get = pl061_get_value; 292 chip->gc.get = pl061_get_value;
@@ -259,12 +304,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
259 /* 304 /*
260 * irq_chip support 305 * irq_chip support
261 */ 306 */
262
263 if (chip->irq_base <= 0)
264 return 0;
265
266 pl061_init_gc(chip, chip->irq_base);
267
268 writeb(0, chip->base + GPIOIE); /* disable irqs */ 307 writeb(0, chip->base + GPIOIE); /* disable irqs */
269 irq = adev->irq[0]; 308 irq = adev->irq[0];
270 if (irq < 0) 309 if (irq < 0)
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 9cc108d2b770..b80717e1ce5b 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -86,20 +86,61 @@ struct pxa_gpio_chip {
86#endif 86#endif
87}; 87};
88 88
89enum { 89enum pxa_gpio_type {
90 PXA25X_GPIO = 0, 90 PXA25X_GPIO = 0,
91 PXA26X_GPIO, 91 PXA26X_GPIO,
92 PXA27X_GPIO, 92 PXA27X_GPIO,
93 PXA3XX_GPIO, 93 PXA3XX_GPIO,
94 PXA93X_GPIO, 94 PXA93X_GPIO,
95 MMP_GPIO = 0x10, 95 MMP_GPIO = 0x10,
96 MMP2_GPIO,
97};
98
99struct pxa_gpio_id {
100 enum pxa_gpio_type type;
101 int gpio_nums;
96}; 102};
97 103
98static DEFINE_SPINLOCK(gpio_lock); 104static DEFINE_SPINLOCK(gpio_lock);
99static struct pxa_gpio_chip *pxa_gpio_chips; 105static struct pxa_gpio_chip *pxa_gpio_chips;
100static int gpio_type; 106static enum pxa_gpio_type gpio_type;
101static void __iomem *gpio_reg_base; 107static void __iomem *gpio_reg_base;
102 108
109static struct pxa_gpio_id pxa25x_id = {
110 .type = PXA25X_GPIO,
111 .gpio_nums = 85,
112};
113
114static struct pxa_gpio_id pxa26x_id = {
115 .type = PXA26X_GPIO,
116 .gpio_nums = 90,
117};
118
119static struct pxa_gpio_id pxa27x_id = {
120 .type = PXA27X_GPIO,
121 .gpio_nums = 121,
122};
123
124static struct pxa_gpio_id pxa3xx_id = {
125 .type = PXA3XX_GPIO,
126 .gpio_nums = 128,
127};
128
129static struct pxa_gpio_id pxa93x_id = {
130 .type = PXA93X_GPIO,
131 .gpio_nums = 192,
132};
133
134static struct pxa_gpio_id mmp_id = {
135 .type = MMP_GPIO,
136 .gpio_nums = 128,
137};
138
139static struct pxa_gpio_id mmp2_id = {
140 .type = MMP2_GPIO,
141 .gpio_nums = 192,
142};
143
103#define for_each_gpio_chip(i, c) \ 144#define for_each_gpio_chip(i, c) \
104 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++) 145 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
105 146
@@ -432,47 +473,39 @@ static struct irq_chip pxa_muxed_gpio_chip = {
432 .irq_set_wake = pxa_gpio_set_wake, 473 .irq_set_wake = pxa_gpio_set_wake,
433}; 474};
434 475
435static int pxa_gpio_nums(void) 476static int pxa_gpio_nums(struct platform_device *pdev)
436{ 477{
478 const struct platform_device_id *id = platform_get_device_id(pdev);
479 struct pxa_gpio_id *pxa_id = (struct pxa_gpio_id *)id->driver_data;
437 int count = 0; 480 int count = 0;
438 481
439#ifdef CONFIG_ARCH_PXA 482 switch (pxa_id->type) {
440 if (cpu_is_pxa25x()) { 483 case PXA25X_GPIO:
441#ifdef CONFIG_CPU_PXA26x 484 case PXA26X_GPIO:
442 count = 89; 485 case PXA27X_GPIO:
443 gpio_type = PXA26X_GPIO; 486 case PXA3XX_GPIO:
444#elif defined(CONFIG_PXA25x) 487 case PXA93X_GPIO:
445 count = 84; 488 case MMP_GPIO:
446 gpio_type = PXA26X_GPIO; 489 case MMP2_GPIO:
447#endif /* CONFIG_CPU_PXA26x */ 490 gpio_type = pxa_id->type;
448 } else if (cpu_is_pxa27x()) { 491 count = pxa_id->gpio_nums - 1;
449 count = 120; 492 break;
450 gpio_type = PXA27X_GPIO; 493 default:
451 } else if (cpu_is_pxa93x()) { 494 count = -EINVAL;
452 count = 191; 495 break;
453 gpio_type = PXA93X_GPIO;
454 } else if (cpu_is_pxa3xx()) {
455 count = 127;
456 gpio_type = PXA3XX_GPIO;
457 }
458#endif /* CONFIG_ARCH_PXA */
459
460#ifdef CONFIG_ARCH_MMP
461 if (cpu_is_pxa168() || cpu_is_pxa910()) {
462 count = 127;
463 gpio_type = MMP_GPIO;
464 } else if (cpu_is_mmp2()) {
465 count = 191;
466 gpio_type = MMP_GPIO;
467 } 496 }
468#endif /* CONFIG_ARCH_MMP */
469 return count; 497 return count;
470} 498}
471 499
472#ifdef CONFIG_OF 500#ifdef CONFIG_OF
473static struct of_device_id pxa_gpio_dt_ids[] = { 501static struct of_device_id pxa_gpio_dt_ids[] = {
474 { .compatible = "mrvl,pxa-gpio" }, 502 { .compatible = "intel,pxa25x-gpio", .data = &pxa25x_id, },
475 { .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO }, 503 { .compatible = "intel,pxa26x-gpio", .data = &pxa26x_id, },
504 { .compatible = "intel,pxa27x-gpio", .data = &pxa27x_id, },
505 { .compatible = "intel,pxa3xx-gpio", .data = &pxa3xx_id, },
506 { .compatible = "marvell,pxa93x-gpio", .data = &pxa93x_id, },
507 { .compatible = "marvell,mmp-gpio", .data = &mmp_id, },
508 { .compatible = "marvell,mmp2-gpio", .data = &mmp2_id, },
476 {} 509 {}
477}; 510};
478 511
@@ -492,16 +525,18 @@ const struct irq_domain_ops pxa_irq_domain_ops = {
492 525
493static int pxa_gpio_probe_dt(struct platform_device *pdev) 526static int pxa_gpio_probe_dt(struct platform_device *pdev)
494{ 527{
495 int ret, nr_banks, nr_gpios; 528 int ret, nr_gpios;
496 struct device_node *prev, *next, *np = pdev->dev.of_node; 529 struct device_node *prev, *next, *np = pdev->dev.of_node;
497 const struct of_device_id *of_id = 530 const struct of_device_id *of_id =
498 of_match_device(pxa_gpio_dt_ids, &pdev->dev); 531 of_match_device(pxa_gpio_dt_ids, &pdev->dev);
532 const struct pxa_gpio_id *gpio_id;
499 533
500 if (!of_id) { 534 if (!of_id || !of_id->data) {
501 dev_err(&pdev->dev, "Failed to find gpio controller\n"); 535 dev_err(&pdev->dev, "Failed to find gpio controller\n");
502 return -EFAULT; 536 return -EFAULT;
503 } 537 }
504 gpio_type = (int)of_id->data; 538 gpio_id = of_id->data;
539 gpio_type = gpio_id->type;
505 540
506 next = of_get_next_child(np, NULL); 541 next = of_get_next_child(np, NULL);
507 prev = next; 542 prev = next;
@@ -510,14 +545,8 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev)
510 ret = -EINVAL; 545 ret = -EINVAL;
511 goto err; 546 goto err;
512 } 547 }
513 for (nr_banks = 1; ; nr_banks++) {
514 next = of_get_next_child(np, prev);
515 if (!next)
516 break;
517 prev = next;
518 }
519 of_node_put(prev); 548 of_node_put(prev);
520 nr_gpios = nr_banks << 5; 549 nr_gpios = gpio_id->gpio_nums;
521 pxa_last_gpio = nr_gpios - 1; 550 pxa_last_gpio = nr_gpios - 1;
522 551
523 irq_base = irq_alloc_descs(-1, 0, nr_gpios, 0); 552 irq_base = irq_alloc_descs(-1, 0, nr_gpios, 0);
@@ -546,19 +575,18 @@ static int pxa_gpio_probe(struct platform_device *pdev)
546 int gpio, irq, ret, use_of = 0; 575 int gpio, irq, ret, use_of = 0;
547 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; 576 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
548 577
549 ret = pxa_gpio_probe_dt(pdev); 578 info = dev_get_platdata(&pdev->dev);
550 if (ret < 0) { 579 if (info) {
551 pxa_last_gpio = pxa_gpio_nums(); 580 irq_base = info->irq_base;
552#ifdef CONFIG_ARCH_PXA 581 if (irq_base <= 0)
553 if (gpio_is_pxa_type(gpio_type)) 582 return -EINVAL;
554 irq_base = PXA_GPIO_TO_IRQ(0); 583 pxa_last_gpio = pxa_gpio_nums(pdev);
555#endif
556#ifdef CONFIG_ARCH_MMP
557 if (gpio_is_mmp_type(gpio_type))
558 irq_base = MMP_GPIO_TO_IRQ(0);
559#endif
560 } else { 584 } else {
585 irq_base = 0;
561 use_of = 1; 586 use_of = 1;
587 ret = pxa_gpio_probe_dt(pdev);
588 if (ret < 0)
589 return -EINVAL;
562 } 590 }
563 591
564 if (!pxa_last_gpio) 592 if (!pxa_last_gpio)
@@ -595,7 +623,6 @@ static int pxa_gpio_probe(struct platform_device *pdev)
595 } 623 }
596 624
597 /* Initialize GPIO chips */ 625 /* Initialize GPIO chips */
598 info = dev_get_platdata(&pdev->dev);
599 pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL); 626 pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL);
600 627
601 /* clear all GPIO edge detects */ 628 /* clear all GPIO edge detects */
@@ -635,12 +662,24 @@ static int pxa_gpio_probe(struct platform_device *pdev)
635 return 0; 662 return 0;
636} 663}
637 664
665static const struct platform_device_id gpio_id_table[] = {
666 { "pxa25x-gpio", (unsigned long)&pxa25x_id },
667 { "pxa26x-gpio", (unsigned long)&pxa26x_id },
668 { "pxa27x-gpio", (unsigned long)&pxa27x_id },
669 { "pxa3xx-gpio", (unsigned long)&pxa3xx_id },
670 { "pxa93x-gpio", (unsigned long)&pxa93x_id },
671 { "mmp-gpio", (unsigned long)&mmp_id },
672 { "mmp2-gpio", (unsigned long)&mmp2_id },
673 { },
674};
675
638static struct platform_driver pxa_gpio_driver = { 676static struct platform_driver pxa_gpio_driver = {
639 .probe = pxa_gpio_probe, 677 .probe = pxa_gpio_probe,
640 .driver = { 678 .driver = {
641 .name = "pxa-gpio", 679 .name = "pxa-gpio",
642 .of_match_table = of_match_ptr(pxa_gpio_dt_ids), 680 .of_match_table = of_match_ptr(pxa_gpio_dt_ids),
643 }, 681 },
682 .id_table = gpio_id_table,
644}; 683};
645module_platform_driver(pxa_gpio_driver); 684module_platform_driver(pxa_gpio_driver);
646 685
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 770476a9da87..3ce5bc38ac31 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -307,11 +307,15 @@ static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = {
307 .xlate = irq_domain_xlate_twocell, 307 .xlate = irq_domain_xlate_twocell,
308}; 308};
309 309
310static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio) 310static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio,
311 struct device_node *np)
311{ 312{
312 int base = stmpe_gpio->irq_base; 313 int base = 0;
313 314
314 stmpe_gpio->domain = irq_domain_add_simple(NULL, 315 if (!np)
316 base = stmpe_gpio->irq_base;
317
318 stmpe_gpio->domain = irq_domain_add_simple(np,
315 stmpe_gpio->chip.ngpio, base, 319 stmpe_gpio->chip.ngpio, base,
316 &stmpe_gpio_irq_simple_ops, stmpe_gpio); 320 &stmpe_gpio_irq_simple_ops, stmpe_gpio);
317 if (!stmpe_gpio->domain) { 321 if (!stmpe_gpio->domain) {
@@ -346,6 +350,9 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
346 stmpe_gpio->chip = template_chip; 350 stmpe_gpio->chip = template_chip;
347 stmpe_gpio->chip.ngpio = stmpe->num_gpios; 351 stmpe_gpio->chip.ngpio = stmpe->num_gpios;
348 stmpe_gpio->chip.dev = &pdev->dev; 352 stmpe_gpio->chip.dev = &pdev->dev;
353#ifdef CONFIG_OF
354 stmpe_gpio->chip.of_node = np;
355#endif
349 stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; 356 stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
350 357
351 if (pdata) 358 if (pdata)
@@ -366,7 +373,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
366 goto out_free; 373 goto out_free;
367 374
368 if (irq >= 0) { 375 if (irq >= 0) {
369 ret = stmpe_gpio_irq_init(stmpe_gpio); 376 ret = stmpe_gpio_irq_init(stmpe_gpio, np);
370 if (ret) 377 if (ret)
371 goto out_disable; 378 goto out_disable;
372 379
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 5150df6cba08..465f4ca57e80 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -203,22 +203,11 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
203 if (!pctldev) 203 if (!pctldev)
204 break; 204 break;
205 205
206 /*
207 * This assumes that the n GPIO pins are consecutive in the
208 * GPIO number space, and that the pins are also consecutive
209 * in their local number space. Currently it is not possible
210 * to add different ranges for one and the same GPIO chip,
211 * as the code assumes that we have one consecutive range
212 * on both, mapping 1-to-1.
213 *
214 * TODO: make the OF bindings handle multiple sparse ranges
215 * on the same GPIO chip.
216 */
217 ret = gpiochip_add_pin_range(chip, 206 ret = gpiochip_add_pin_range(chip,
218 pinctrl_dev_get_devname(pctldev), 207 pinctrl_dev_get_devname(pctldev),
219 0, /* offset in gpiochip */
220 pinspec.args[0], 208 pinspec.args[0],
221 pinspec.args[1]); 209 pinspec.args[1],
210 pinspec.args[2]);
222 211
223 if (ret) 212 if (ret)
224 break; 213 break;
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 792c3e3795ca..dd64a06dc5b4 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2326,7 +2326,6 @@ int drm_mode_addfb(struct drm_device *dev,
2326 fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r); 2326 fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r);
2327 if (IS_ERR(fb)) { 2327 if (IS_ERR(fb)) {
2328 DRM_DEBUG_KMS("could not create framebuffer\n"); 2328 DRM_DEBUG_KMS("could not create framebuffer\n");
2329 drm_modeset_unlock_all(dev);
2330 return PTR_ERR(fb); 2329 return PTR_ERR(fb);
2331 } 2330 }
2332 2331
@@ -2506,7 +2505,6 @@ int drm_mode_addfb2(struct drm_device *dev,
2506 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); 2505 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r);
2507 if (IS_ERR(fb)) { 2506 if (IS_ERR(fb)) {
2508 DRM_DEBUG_KMS("could not create framebuffer\n"); 2507 DRM_DEBUG_KMS("could not create framebuffer\n");
2509 drm_modeset_unlock_all(dev);
2510 return PTR_ERR(fb); 2508 return PTR_ERR(fb);
2511 } 2509 }
2512 2510
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 13fdcd10a605..429e07d0b0f1 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -123,6 +123,7 @@ int drm_open(struct inode *inode, struct file *filp)
123 int retcode = 0; 123 int retcode = 0;
124 int need_setup = 0; 124 int need_setup = 0;
125 struct address_space *old_mapping; 125 struct address_space *old_mapping;
126 struct address_space *old_imapping;
126 127
127 minor = idr_find(&drm_minors_idr, minor_id); 128 minor = idr_find(&drm_minors_idr, minor_id);
128 if (!minor) 129 if (!minor)
@@ -137,6 +138,7 @@ int drm_open(struct inode *inode, struct file *filp)
137 if (!dev->open_count++) 138 if (!dev->open_count++)
138 need_setup = 1; 139 need_setup = 1;
139 mutex_lock(&dev->struct_mutex); 140 mutex_lock(&dev->struct_mutex);
141 old_imapping = inode->i_mapping;
140 old_mapping = dev->dev_mapping; 142 old_mapping = dev->dev_mapping;
141 if (old_mapping == NULL) 143 if (old_mapping == NULL)
142 dev->dev_mapping = &inode->i_data; 144 dev->dev_mapping = &inode->i_data;
@@ -159,8 +161,8 @@ int drm_open(struct inode *inode, struct file *filp)
159 161
160err_undo: 162err_undo:
161 mutex_lock(&dev->struct_mutex); 163 mutex_lock(&dev->struct_mutex);
162 filp->f_mapping = old_mapping; 164 filp->f_mapping = old_imapping;
163 inode->i_mapping = old_mapping; 165 inode->i_mapping = old_imapping;
164 iput(container_of(dev->dev_mapping, struct inode, i_data)); 166 iput(container_of(dev->dev_mapping, struct inode, i_data));
165 dev->dev_mapping = old_mapping; 167 dev->dev_mapping = old_mapping;
166 mutex_unlock(&dev->struct_mutex); 168 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3b11ab0fbc96..9a48e1a2d417 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -57,7 +57,7 @@ eb_create(struct drm_i915_gem_execbuffer2 *args)
57 if (eb == NULL) { 57 if (eb == NULL) {
58 int size = args->buffer_count; 58 int size = args->buffer_count;
59 int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; 59 int count = PAGE_SIZE / sizeof(struct hlist_head) / 2;
60 BUILD_BUG_ON(!is_power_of_2(PAGE_SIZE / sizeof(struct hlist_head))); 60 BUILD_BUG_ON_NOT_POWER_OF_2(PAGE_SIZE / sizeof(struct hlist_head));
61 while (count > 2*size) 61 while (count > 2*size)
62 count >>= 1; 62 count >>= 1;
63 eb = kzalloc(count*sizeof(struct hlist_head) + 63 eb = kzalloc(count*sizeof(struct hlist_head) +
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 32a3693905ec..1ce45a0a2d3e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -45,6 +45,9 @@
45 45
46struct intel_crt { 46struct intel_crt {
47 struct intel_encoder base; 47 struct intel_encoder base;
48 /* DPMS state is stored in the connector, which we need in the
49 * encoder's enable/disable callbacks */
50 struct intel_connector *connector;
48 bool force_hotplug_required; 51 bool force_hotplug_required;
49 u32 adpa_reg; 52 u32 adpa_reg;
50}; 53};
@@ -81,29 +84,6 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
81 return true; 84 return true;
82} 85}
83 86
84static void intel_disable_crt(struct intel_encoder *encoder)
85{
86 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
87 struct intel_crt *crt = intel_encoder_to_crt(encoder);
88 u32 temp;
89
90 temp = I915_READ(crt->adpa_reg);
91 temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
92 temp &= ~ADPA_DAC_ENABLE;
93 I915_WRITE(crt->adpa_reg, temp);
94}
95
96static void intel_enable_crt(struct intel_encoder *encoder)
97{
98 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
99 struct intel_crt *crt = intel_encoder_to_crt(encoder);
100 u32 temp;
101
102 temp = I915_READ(crt->adpa_reg);
103 temp |= ADPA_DAC_ENABLE;
104 I915_WRITE(crt->adpa_reg, temp);
105}
106
107/* Note: The caller is required to filter out dpms modes not supported by the 87/* Note: The caller is required to filter out dpms modes not supported by the
108 * platform. */ 88 * platform. */
109static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) 89static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
@@ -135,6 +115,19 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
135 I915_WRITE(crt->adpa_reg, temp); 115 I915_WRITE(crt->adpa_reg, temp);
136} 116}
137 117
118static void intel_disable_crt(struct intel_encoder *encoder)
119{
120 intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF);
121}
122
123static void intel_enable_crt(struct intel_encoder *encoder)
124{
125 struct intel_crt *crt = intel_encoder_to_crt(encoder);
126
127 intel_crt_set_dpms(encoder, crt->connector->base.dpms);
128}
129
130
138static void intel_crt_dpms(struct drm_connector *connector, int mode) 131static void intel_crt_dpms(struct drm_connector *connector, int mode)
139{ 132{
140 struct drm_device *dev = connector->dev; 133 struct drm_device *dev = connector->dev;
@@ -746,6 +739,7 @@ void intel_crt_init(struct drm_device *dev)
746 } 739 }
747 740
748 connector = &intel_connector->base; 741 connector = &intel_connector->base;
742 crt->connector = intel_connector;
749 drm_connector_init(dev, &intel_connector->base, 743 drm_connector_init(dev, &intel_connector->base,
750 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); 744 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
751 745
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d7d4afe01341..8fc93f90a7cd 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2559,12 +2559,15 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
2559{ 2559{
2560 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); 2560 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
2561 struct intel_dp *intel_dp = &intel_dig_port->dp; 2561 struct intel_dp *intel_dp = &intel_dig_port->dp;
2562 struct drm_device *dev = intel_dp_to_dev(intel_dp);
2562 2563
2563 i2c_del_adapter(&intel_dp->adapter); 2564 i2c_del_adapter(&intel_dp->adapter);
2564 drm_encoder_cleanup(encoder); 2565 drm_encoder_cleanup(encoder);
2565 if (is_edp(intel_dp)) { 2566 if (is_edp(intel_dp)) {
2566 cancel_delayed_work_sync(&intel_dp->panel_vdd_work); 2567 cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
2568 mutex_lock(&dev->mode_config.mutex);
2567 ironlake_panel_vdd_off_sync(intel_dp); 2569 ironlake_panel_vdd_off_sync(intel_dp);
2570 mutex_unlock(&dev->mode_config.mutex);
2568 } 2571 }
2569 kfree(intel_dig_port); 2572 kfree(intel_dig_port);
2570} 2573}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index e816f06637a7..0e2c1a4f1659 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -248,6 +248,22 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
248 } 248 }
249} 249}
250 250
251static void
252nouveau_bios_shadow_platform(struct nouveau_bios *bios)
253{
254 struct pci_dev *pdev = nv_device(bios)->pdev;
255 size_t size;
256
257 void __iomem *rom = pci_platform_rom(pdev, &size);
258 if (rom && size) {
259 bios->data = kmalloc(size, GFP_KERNEL);
260 if (bios->data) {
261 memcpy_fromio(bios->data, rom, size);
262 bios->size = size;
263 }
264 }
265}
266
251static int 267static int
252nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) 268nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
253{ 269{
@@ -288,6 +304,7 @@ nouveau_bios_shadow(struct nouveau_bios *bios)
288 { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL }, 304 { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL },
289 { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL }, 305 { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL },
290 { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL }, 306 { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL },
307 { "PLATFORM", nouveau_bios_shadow_platform, true, 0, 0, NULL },
291 {} 308 {}
292 }; 309 };
293 struct methods *mthd, *best; 310 struct methods *mthd, *best;
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 3b6dc883e150..5eb3e0da7c6e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -391,7 +391,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
391 struct nouveau_drm *drm = nouveau_drm(dev); 391 struct nouveau_drm *drm = nouveau_drm(dev);
392 struct nouveau_device *device = nv_device(drm->device); 392 struct nouveau_device *device = nv_device(drm->device);
393 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); 393 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
394 struct nouveau_abi16_chan *chan, *temp; 394 struct nouveau_abi16_chan *chan = NULL, *temp;
395 struct nouveau_abi16_ntfy *ntfy; 395 struct nouveau_abi16_ntfy *ntfy;
396 struct nouveau_object *object; 396 struct nouveau_object *object;
397 struct nv_dma_class args = {}; 397 struct nv_dma_class args = {};
@@ -404,10 +404,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
404 if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) 404 if (unlikely(nv_device(abi16->device)->card_type >= NV_C0))
405 return nouveau_abi16_put(abi16, -EINVAL); 405 return nouveau_abi16_put(abi16, -EINVAL);
406 406
407 list_for_each_entry_safe(chan, temp, &abi16->channels, head) { 407 list_for_each_entry(temp, &abi16->channels, head) {
408 if (chan->chan->handle == (NVDRM_CHAN | info->channel)) 408 if (temp->chan->handle == (NVDRM_CHAN | info->channel)) {
409 chan = temp;
409 break; 410 break;
410 chan = NULL; 411 }
411 } 412 }
412 413
413 if (!chan) 414 if (!chan)
@@ -459,17 +460,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
459{ 460{
460 struct drm_nouveau_gpuobj_free *fini = data; 461 struct drm_nouveau_gpuobj_free *fini = data;
461 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); 462 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
462 struct nouveau_abi16_chan *chan, *temp; 463 struct nouveau_abi16_chan *chan = NULL, *temp;
463 struct nouveau_abi16_ntfy *ntfy; 464 struct nouveau_abi16_ntfy *ntfy;
464 int ret; 465 int ret;
465 466
466 if (unlikely(!abi16)) 467 if (unlikely(!abi16))
467 return -ENOMEM; 468 return -ENOMEM;
468 469
469 list_for_each_entry_safe(chan, temp, &abi16->channels, head) { 470 list_for_each_entry(temp, &abi16->channels, head) {
470 if (chan->chan->handle == (NVDRM_CHAN | fini->channel)) 471 if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) {
472 chan = temp;
471 break; 473 break;
472 chan = NULL; 474 }
473 } 475 }
474 476
475 if (!chan) 477 if (!chan)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index d1099365bfc1..c95decf543e9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -72,11 +72,25 @@ module_param_named(modeset, nouveau_modeset, int, 0400);
72static struct drm_driver driver; 72static struct drm_driver driver;
73 73
74static int 74static int
75nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head)
76{
77 struct nouveau_drm *drm =
78 container_of(event, struct nouveau_drm, vblank[head]);
79 drm_handle_vblank(drm->dev, head);
80 return NVKM_EVENT_KEEP;
81}
82
83static int
75nouveau_drm_vblank_enable(struct drm_device *dev, int head) 84nouveau_drm_vblank_enable(struct drm_device *dev, int head)
76{ 85{
77 struct nouveau_drm *drm = nouveau_drm(dev); 86 struct nouveau_drm *drm = nouveau_drm(dev);
78 struct nouveau_disp *pdisp = nouveau_disp(drm->device); 87 struct nouveau_disp *pdisp = nouveau_disp(drm->device);
79 nouveau_event_get(pdisp->vblank, head, &drm->vblank); 88
89 if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank)))
90 return -EIO;
91 WARN_ON_ONCE(drm->vblank[head].func);
92 drm->vblank[head].func = nouveau_drm_vblank_handler;
93 nouveau_event_get(pdisp->vblank, head, &drm->vblank[head]);
80 return 0; 94 return 0;
81} 95}
82 96
@@ -85,16 +99,11 @@ nouveau_drm_vblank_disable(struct drm_device *dev, int head)
85{ 99{
86 struct nouveau_drm *drm = nouveau_drm(dev); 100 struct nouveau_drm *drm = nouveau_drm(dev);
87 struct nouveau_disp *pdisp = nouveau_disp(drm->device); 101 struct nouveau_disp *pdisp = nouveau_disp(drm->device);
88 nouveau_event_put(pdisp->vblank, head, &drm->vblank); 102 if (drm->vblank[head].func)
89} 103 nouveau_event_put(pdisp->vblank, head, &drm->vblank[head]);
90 104 else
91static int 105 WARN_ON_ONCE(1);
92nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) 106 drm->vblank[head].func = NULL;
93{
94 struct nouveau_drm *drm =
95 container_of(event, struct nouveau_drm, vblank);
96 drm_handle_vblank(drm->dev, head);
97 return NVKM_EVENT_KEEP;
98} 107}
99 108
100static u64 109static u64
@@ -292,7 +301,6 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
292 301
293 dev->dev_private = drm; 302 dev->dev_private = drm;
294 drm->dev = dev; 303 drm->dev = dev;
295 drm->vblank.func = nouveau_drm_vblank_handler;
296 304
297 INIT_LIST_HEAD(&drm->clients); 305 INIT_LIST_HEAD(&drm->clients);
298 spin_lock_init(&drm->tile.lock); 306 spin_lock_init(&drm->tile.lock);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h
index b25df374c901..9c39bafbef2c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h
@@ -113,7 +113,7 @@ struct nouveau_drm {
113 struct nvbios vbios; 113 struct nvbios vbios;
114 struct nouveau_display *display; 114 struct nouveau_display *display;
115 struct backlight_device *backlight; 115 struct backlight_device *backlight;
116 struct nouveau_eventh vblank; 116 struct nouveau_eventh vblank[4];
117 117
118 /* power management */ 118 /* power management */
119 struct nouveau_pm *pm; 119 struct nouveau_pm *pm;
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index b8015913d382..fa3c56fba294 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -99,6 +99,29 @@ static bool radeon_read_bios(struct radeon_device *rdev)
99 return true; 99 return true;
100} 100}
101 101
102static bool radeon_read_platform_bios(struct radeon_device *rdev)
103{
104 uint8_t __iomem *bios;
105 size_t size;
106
107 rdev->bios = NULL;
108
109 bios = pci_platform_rom(rdev->pdev, &size);
110 if (!bios) {
111 return false;
112 }
113
114 if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
115 return false;
116 }
117 rdev->bios = kmemdup(bios, size, GFP_KERNEL);
118 if (rdev->bios == NULL) {
119 return false;
120 }
121
122 return true;
123}
124
102#ifdef CONFIG_ACPI 125#ifdef CONFIG_ACPI
103/* ATRM is used to get the BIOS on the discrete cards in 126/* ATRM is used to get the BIOS on the discrete cards in
104 * dual-gpu systems. 127 * dual-gpu systems.
@@ -620,6 +643,9 @@ bool radeon_get_bios(struct radeon_device *rdev)
620 if (r == false) { 643 if (r == false) {
621 r = radeon_read_disabled_bios(rdev); 644 r = radeon_read_disabled_bios(rdev);
622 } 645 }
646 if (r == false) {
647 r = radeon_read_platform_bios(rdev);
648 }
623 if (r == false || rdev->bios == NULL) { 649 if (r == false || rdev->bios == NULL) {
624 DRM_ERROR("Unable to locate a BIOS ROM\n"); 650 DRM_ERROR("Unable to locate a BIOS ROM\n");
625 rdev->bios = NULL; 651 rdev->bios = NULL;
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 512b01c04ea7..aa341d135867 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = {
2077 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, 2077 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
2078 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, 2078 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
2079 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, 2079 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) },
2080 { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
2081 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, 2080 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
2082 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, 2081 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
2083 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, 2082 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
@@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev)
2244 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) 2243 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST))
2245 return true; 2244 return true;
2246 break; 2245 break;
2246 case USB_VENDOR_ID_ATMEL_V_USB:
2247 /* Masterkit MA901 usb radio based on Atmel tiny85 chip and
2248 * it has the same USB ID as many Atmel V-USB devices. This
2249 * usb radio is handled by radio-ma901.c driver so we want
2250 * ignore the hid. Check the name, bus, product and ignore
2251 * if we have MA901 usb radio.
2252 */
2253 if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB &&
2254 hdev->bus == BUS_USB &&
2255 strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0)
2256 return true;
2257 break;
2247 } 2258 }
2248 2259
2249 if (hdev->type == HID_TYPE_USBMOUSE && 2260 if (hdev->type == HID_TYPE_USBMOUSE &&
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index c4388776f4e4..5309fd5eb0eb 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -158,6 +158,8 @@
158#define USB_VENDOR_ID_ATMEL 0x03eb 158#define USB_VENDOR_ID_ATMEL 0x03eb
159#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c 159#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
160#define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 160#define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118
161#define USB_VENDOR_ID_ATMEL_V_USB 0x16c0
162#define USB_DEVICE_ID_ATMEL_V_USB 0x05df
161 163
162#define USB_VENDOR_ID_AUREAL 0x0755 164#define USB_VENDOR_ID_AUREAL 0x0755
163#define USB_DEVICE_ID_AUREAL_W01RN 0x2626 165#define USB_DEVICE_ID_AUREAL_W01RN 0x2626
@@ -557,9 +559,6 @@
557#define USB_VENDOR_ID_MADCATZ 0x0738 559#define USB_VENDOR_ID_MADCATZ 0x0738
558#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 560#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
559 561
560#define USB_VENDOR_ID_MASTERKIT 0x16c0
561#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
562
563#define USB_VENDOR_ID_MCC 0x09db 562#define USB_VENDOR_ID_MCC 0x09db
564#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 563#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
565#define USB_DEVICE_ID_MCC_PMD1208LS 0x007a 564#define USB_DEVICE_ID_MCC_PMD1208LS 0x007a
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index f7f113ba083e..a8ce44296cfd 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev,
462 return 0; 462 return 0;
463} 463}
464 464
465static void magicmouse_input_configured(struct hid_device *hdev,
466 struct hid_input *hi)
467
468{
469 struct magicmouse_sc *msc = hid_get_drvdata(hdev);
470
471 int ret = magicmouse_setup_input(msc->input, hdev);
472 if (ret) {
473 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
474 /* clean msc->input to notify probe() of the failure */
475 msc->input = NULL;
476 }
477}
478
479
465static int magicmouse_probe(struct hid_device *hdev, 480static int magicmouse_probe(struct hid_device *hdev,
466 const struct hid_device_id *id) 481 const struct hid_device_id *id)
467{ 482{
@@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev,
493 goto err_free; 508 goto err_free;
494 } 509 }
495 510
496 /* We do this after hid-input is done parsing reports so that 511 if (!msc->input) {
497 * hid-input uses the most natural button and axis IDs. 512 hid_err(hdev, "magicmouse input not registered\n");
498 */ 513 ret = -ENOMEM;
499 if (msc->input) { 514 goto err_stop_hw;
500 ret = magicmouse_setup_input(msc->input, hdev);
501 if (ret) {
502 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
503 goto err_stop_hw;
504 }
505 } 515 }
506 516
507 if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) 517 if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
@@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = {
568 .remove = magicmouse_remove, 578 .remove = magicmouse_remove,
569 .raw_event = magicmouse_raw_event, 579 .raw_event = magicmouse_raw_event,
570 .input_mapping = magicmouse_input_mapping, 580 .input_mapping = magicmouse_input_mapping,
581 .input_configured = magicmouse_input_configured,
571}; 582};
572module_hid_driver(magicmouse_driver); 583module_hid_driver(magicmouse_driver);
573 584
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0ceb6e1b0f65..e3085c487ace 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -182,7 +182,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
182 adap->algo = &i2c_dw_algo; 182 adap->algo = &i2c_dw_algo;
183 adap->dev.parent = &pdev->dev; 183 adap->dev.parent = &pdev->dev;
184 adap->dev.of_node = pdev->dev.of_node; 184 adap->dev.of_node = pdev->dev.of_node;
185 ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev));
186 185
187 r = i2c_add_numbered_adapter(adap); 186 r = i2c_add_numbered_adapter(adap);
188 if (r) { 187 if (r) {
diff --git a/drivers/infiniband/hw/qib/qib_sd7220.c b/drivers/infiniband/hw/qib/qib_sd7220.c
index 08a6c6d39e56..911205d3d5a0 100644
--- a/drivers/infiniband/hw/qib/qib_sd7220.c
+++ b/drivers/infiniband/hw/qib/qib_sd7220.c
@@ -44,7 +44,7 @@
44#include "qib.h" 44#include "qib.h"
45#include "qib_7220.h" 45#include "qib_7220.h"
46 46
47#define SD7220_FW_NAME "intel/sd7220.fw" 47#define SD7220_FW_NAME "qlogic/sd7220.fw"
48MODULE_FIRMWARE(SD7220_FW_NAME); 48MODULE_FIRMWARE(SD7220_FW_NAME);
49 49
50/* 50/*
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 66120bd46d15..10744091e6ca 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -6,6 +6,7 @@
6 6
7#include "dm.h" 7#include "dm.h"
8#include "dm-bio-prison.h" 8#include "dm-bio-prison.h"
9#include "dm-bio-record.h"
9#include "dm-cache-metadata.h" 10#include "dm-cache-metadata.h"
10 11
11#include <linux/dm-io.h> 12#include <linux/dm-io.h>
@@ -201,10 +202,15 @@ struct per_bio_data {
201 unsigned req_nr:2; 202 unsigned req_nr:2;
202 struct dm_deferred_entry *all_io_entry; 203 struct dm_deferred_entry *all_io_entry;
203 204
204 /* writethrough fields */ 205 /*
206 * writethrough fields. These MUST remain at the end of this
207 * structure and the 'cache' member must be the first as it
208 * is used to determine the offsetof the writethrough fields.
209 */
205 struct cache *cache; 210 struct cache *cache;
206 dm_cblock_t cblock; 211 dm_cblock_t cblock;
207 bio_end_io_t *saved_bi_end_io; 212 bio_end_io_t *saved_bi_end_io;
213 struct dm_bio_details bio_details;
208}; 214};
209 215
210struct dm_cache_migration { 216struct dm_cache_migration {
@@ -513,16 +519,28 @@ static void save_stats(struct cache *cache)
513/*---------------------------------------------------------------- 519/*----------------------------------------------------------------
514 * Per bio data 520 * Per bio data
515 *--------------------------------------------------------------*/ 521 *--------------------------------------------------------------*/
516static struct per_bio_data *get_per_bio_data(struct bio *bio) 522
523/*
524 * If using writeback, leave out struct per_bio_data's writethrough fields.
525 */
526#define PB_DATA_SIZE_WB (offsetof(struct per_bio_data, cache))
527#define PB_DATA_SIZE_WT (sizeof(struct per_bio_data))
528
529static size_t get_per_bio_data_size(struct cache *cache)
530{
531 return cache->features.write_through ? PB_DATA_SIZE_WT : PB_DATA_SIZE_WB;
532}
533
534static struct per_bio_data *get_per_bio_data(struct bio *bio, size_t data_size)
517{ 535{
518 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 536 struct per_bio_data *pb = dm_per_bio_data(bio, data_size);
519 BUG_ON(!pb); 537 BUG_ON(!pb);
520 return pb; 538 return pb;
521} 539}
522 540
523static struct per_bio_data *init_per_bio_data(struct bio *bio) 541static struct per_bio_data *init_per_bio_data(struct bio *bio, size_t data_size)
524{ 542{
525 struct per_bio_data *pb = get_per_bio_data(bio); 543 struct per_bio_data *pb = get_per_bio_data(bio, data_size);
526 544
527 pb->tick = false; 545 pb->tick = false;
528 pb->req_nr = dm_bio_get_target_bio_nr(bio); 546 pb->req_nr = dm_bio_get_target_bio_nr(bio);
@@ -556,7 +574,8 @@ static void remap_to_cache(struct cache *cache, struct bio *bio,
556static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) 574static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio)
557{ 575{
558 unsigned long flags; 576 unsigned long flags;
559 struct per_bio_data *pb = get_per_bio_data(bio); 577 size_t pb_data_size = get_per_bio_data_size(cache);
578 struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size);
560 579
561 spin_lock_irqsave(&cache->lock, flags); 580 spin_lock_irqsave(&cache->lock, flags);
562 if (cache->need_tick_bio && 581 if (cache->need_tick_bio &&
@@ -635,7 +654,7 @@ static void defer_writethrough_bio(struct cache *cache, struct bio *bio)
635 654
636static void writethrough_endio(struct bio *bio, int err) 655static void writethrough_endio(struct bio *bio, int err)
637{ 656{
638 struct per_bio_data *pb = get_per_bio_data(bio); 657 struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT);
639 bio->bi_end_io = pb->saved_bi_end_io; 658 bio->bi_end_io = pb->saved_bi_end_io;
640 659
641 if (err) { 660 if (err) {
@@ -643,6 +662,7 @@ static void writethrough_endio(struct bio *bio, int err)
643 return; 662 return;
644 } 663 }
645 664
665 dm_bio_restore(&pb->bio_details, bio);
646 remap_to_cache(pb->cache, bio, pb->cblock); 666 remap_to_cache(pb->cache, bio, pb->cblock);
647 667
648 /* 668 /*
@@ -662,11 +682,12 @@ static void writethrough_endio(struct bio *bio, int err)
662static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, 682static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio,
663 dm_oblock_t oblock, dm_cblock_t cblock) 683 dm_oblock_t oblock, dm_cblock_t cblock)
664{ 684{
665 struct per_bio_data *pb = get_per_bio_data(bio); 685 struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT);
666 686
667 pb->cache = cache; 687 pb->cache = cache;
668 pb->cblock = cblock; 688 pb->cblock = cblock;
669 pb->saved_bi_end_io = bio->bi_end_io; 689 pb->saved_bi_end_io = bio->bi_end_io;
690 dm_bio_record(&pb->bio_details, bio);
670 bio->bi_end_io = writethrough_endio; 691 bio->bi_end_io = writethrough_endio;
671 692
672 remap_to_origin_clear_discard(pb->cache, bio, oblock); 693 remap_to_origin_clear_discard(pb->cache, bio, oblock);
@@ -1035,7 +1056,8 @@ static void defer_bio(struct cache *cache, struct bio *bio)
1035 1056
1036static void process_flush_bio(struct cache *cache, struct bio *bio) 1057static void process_flush_bio(struct cache *cache, struct bio *bio)
1037{ 1058{
1038 struct per_bio_data *pb = get_per_bio_data(bio); 1059 size_t pb_data_size = get_per_bio_data_size(cache);
1060 struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size);
1039 1061
1040 BUG_ON(bio->bi_size); 1062 BUG_ON(bio->bi_size);
1041 if (!pb->req_nr) 1063 if (!pb->req_nr)
@@ -1107,7 +1129,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs,
1107 dm_oblock_t block = get_bio_block(cache, bio); 1129 dm_oblock_t block = get_bio_block(cache, bio);
1108 struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; 1130 struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell;
1109 struct policy_result lookup_result; 1131 struct policy_result lookup_result;
1110 struct per_bio_data *pb = get_per_bio_data(bio); 1132 size_t pb_data_size = get_per_bio_data_size(cache);
1133 struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size);
1111 bool discarded_block = is_discarded_oblock(cache, block); 1134 bool discarded_block = is_discarded_oblock(cache, block);
1112 bool can_migrate = discarded_block || spare_migration_bandwidth(cache); 1135 bool can_migrate = discarded_block || spare_migration_bandwidth(cache);
1113 1136
@@ -1881,7 +1904,6 @@ static int cache_create(struct cache_args *ca, struct cache **result)
1881 1904
1882 cache->ti = ca->ti; 1905 cache->ti = ca->ti;
1883 ti->private = cache; 1906 ti->private = cache;
1884 ti->per_bio_data_size = sizeof(struct per_bio_data);
1885 ti->num_flush_bios = 2; 1907 ti->num_flush_bios = 2;
1886 ti->flush_supported = true; 1908 ti->flush_supported = true;
1887 1909
@@ -1890,6 +1912,7 @@ static int cache_create(struct cache_args *ca, struct cache **result)
1890 ti->discard_zeroes_data_unsupported = true; 1912 ti->discard_zeroes_data_unsupported = true;
1891 1913
1892 memcpy(&cache->features, &ca->features, sizeof(cache->features)); 1914 memcpy(&cache->features, &ca->features, sizeof(cache->features));
1915 ti->per_bio_data_size = get_per_bio_data_size(cache);
1893 1916
1894 cache->callbacks.congested_fn = cache_is_congested; 1917 cache->callbacks.congested_fn = cache_is_congested;
1895 dm_table_add_target_callbacks(ti->table, &cache->callbacks); 1918 dm_table_add_target_callbacks(ti->table, &cache->callbacks);
@@ -2092,6 +2115,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio)
2092 2115
2093 int r; 2116 int r;
2094 dm_oblock_t block = get_bio_block(cache, bio); 2117 dm_oblock_t block = get_bio_block(cache, bio);
2118 size_t pb_data_size = get_per_bio_data_size(cache);
2095 bool can_migrate = false; 2119 bool can_migrate = false;
2096 bool discarded_block; 2120 bool discarded_block;
2097 struct dm_bio_prison_cell *cell; 2121 struct dm_bio_prison_cell *cell;
@@ -2108,7 +2132,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio)
2108 return DM_MAPIO_REMAPPED; 2132 return DM_MAPIO_REMAPPED;
2109 } 2133 }
2110 2134
2111 pb = init_per_bio_data(bio); 2135 pb = init_per_bio_data(bio, pb_data_size);
2112 2136
2113 if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { 2137 if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) {
2114 defer_bio(cache, bio); 2138 defer_bio(cache, bio);
@@ -2193,7 +2217,8 @@ static int cache_end_io(struct dm_target *ti, struct bio *bio, int error)
2193{ 2217{
2194 struct cache *cache = ti->private; 2218 struct cache *cache = ti->private;
2195 unsigned long flags; 2219 unsigned long flags;
2196 struct per_bio_data *pb = get_per_bio_data(bio); 2220 size_t pb_data_size = get_per_bio_data_size(cache);
2221 struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size);
2197 2222
2198 if (pb->tick) { 2223 if (pb->tick) {
2199 policy_tick(cache->policy); 2224 policy_tick(cache->policy);
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 05d7b6333461..a0639e779973 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -204,7 +204,7 @@ config VIDEO_SAMSUNG_EXYNOS_GSC
204 204
205config VIDEO_SH_VEU 205config VIDEO_SH_VEU
206 tristate "SuperH VEU mem2mem video processing driver" 206 tristate "SuperH VEU mem2mem video processing driver"
207 depends on VIDEO_DEV && VIDEO_V4L2 207 depends on VIDEO_DEV && VIDEO_V4L2 && GENERIC_HARDIRQS
208 select VIDEOBUF2_DMA_CONTIG 208 select VIDEOBUF2_DMA_CONTIG
209 select V4L2_MEM2MEM_DEV 209 select V4L2_MEM2MEM_DEV
210 help 210 help
diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c
index c61f590029ad..348dafc0318a 100644
--- a/drivers/media/radio/radio-ma901.c
+++ b/drivers/media/radio/radio-ma901.c
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev)
347static int usb_ma901radio_probe(struct usb_interface *intf, 347static int usb_ma901radio_probe(struct usb_interface *intf,
348 const struct usb_device_id *id) 348 const struct usb_device_id *id)
349{ 349{
350 struct usb_device *dev = interface_to_usbdev(intf);
350 struct ma901radio_device *radio; 351 struct ma901radio_device *radio;
351 int retval = 0; 352 int retval = 0;
352 353
354 /* Masterkit MA901 usb radio has the same USB ID as many others
355 * Atmel V-USB devices. Let's make additional checks to be sure
356 * that this is our device.
357 */
358
359 if (dev->product && dev->manufacturer &&
360 (strncmp(dev->product, "MA901", 5) != 0
361 || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0))
362 return -ENODEV;
363
353 radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); 364 radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL);
354 if (!radio) { 365 if (!radio) {
355 dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); 366 dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6bbd90e1123c..171b10f167a5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1976,12 +1976,11 @@ static int __bond_release_one(struct net_device *bond_dev,
1976 return -EINVAL; 1976 return -EINVAL;
1977 } 1977 }
1978 1978
1979 write_unlock_bh(&bond->lock);
1979 /* unregister rx_handler early so bond_handle_frame wouldn't be called 1980 /* unregister rx_handler early so bond_handle_frame wouldn't be called
1980 * for this slave anymore. 1981 * for this slave anymore.
1981 */ 1982 */
1982 netdev_rx_handler_unregister(slave_dev); 1983 netdev_rx_handler_unregister(slave_dev);
1983 write_unlock_bh(&bond->lock);
1984 synchronize_net();
1985 write_lock_bh(&bond->lock); 1984 write_lock_bh(&bond->lock);
1986 1985
1987 if (!all && !bond->params.fail_over_mac) { 1986 if (!all && !bond->params.fail_over_mac) {
@@ -4903,8 +4902,8 @@ static void __exit bonding_exit(void)
4903 4902
4904 bond_destroy_debugfs(); 4903 bond_destroy_debugfs();
4905 4904
4906 rtnl_link_unregister(&bond_link_ops);
4907 unregister_pernet_subsys(&bond_net_ops); 4905 unregister_pernet_subsys(&bond_net_ops);
4906 rtnl_link_unregister(&bond_link_ops);
4908 4907
4909#ifdef CONFIG_NET_POLL_CONTROLLER 4908#ifdef CONFIG_NET_POLL_CONTROLLER
4910 /* 4909 /*
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index db103e03ba05..ea7a388f4843 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -527,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d,
527 goto out; 527 goto out;
528 } 528 }
529 if (new_value < 0) { 529 if (new_value < 0) {
530 pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", 530 pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n",
531 bond->dev->name, new_value, INT_MAX); 531 bond->dev->name, new_value, INT_MAX);
532 ret = -EINVAL; 532 ret = -EINVAL;
533 goto out; 533 goto out;
@@ -542,14 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d,
542 pr_info("%s: Setting ARP monitoring interval to %d.\n", 542 pr_info("%s: Setting ARP monitoring interval to %d.\n",
543 bond->dev->name, new_value); 543 bond->dev->name, new_value);
544 bond->params.arp_interval = new_value; 544 bond->params.arp_interval = new_value;
545 if (bond->params.miimon) { 545 if (new_value) {
546 pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", 546 if (bond->params.miimon) {
547 bond->dev->name, bond->dev->name); 547 pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
548 bond->params.miimon = 0; 548 bond->dev->name, bond->dev->name);
549 } 549 bond->params.miimon = 0;
550 if (!bond->params.arp_targets[0]) { 550 }
551 pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", 551 if (!bond->params.arp_targets[0])
552 bond->dev->name); 552 pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n",
553 bond->dev->name);
553 } 554 }
554 if (bond->dev->flags & IFF_UP) { 555 if (bond->dev->flags & IFF_UP) {
555 /* If the interface is up, we may need to fire off 556 /* If the interface is up, we may need to fire off
@@ -557,10 +558,13 @@ static ssize_t bonding_store_arp_interval(struct device *d,
557 * timer will get fired off when the open function 558 * timer will get fired off when the open function
558 * is called. 559 * is called.
559 */ 560 */
560 cancel_delayed_work_sync(&bond->mii_work); 561 if (!new_value) {
561 queue_delayed_work(bond->wq, &bond->arp_work, 0); 562 cancel_delayed_work_sync(&bond->arp_work);
563 } else {
564 cancel_delayed_work_sync(&bond->mii_work);
565 queue_delayed_work(bond->wq, &bond->arp_work, 0);
566 }
562 } 567 }
563
564out: 568out:
565 rtnl_unlock(); 569 rtnl_unlock();
566 return ret; 570 return ret;
@@ -702,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d,
702 } 706 }
703 if (new_value < 0) { 707 if (new_value < 0) {
704 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", 708 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n",
705 bond->dev->name, new_value, 1, INT_MAX); 709 bond->dev->name, new_value, 0, INT_MAX);
706 ret = -EINVAL; 710 ret = -EINVAL;
707 goto out; 711 goto out;
708 } else { 712 } else {
@@ -757,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d,
757 goto out; 761 goto out;
758 } 762 }
759 if (new_value < 0) { 763 if (new_value < 0) {
760 pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", 764 pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n",
761 bond->dev->name, new_value, 1, INT_MAX); 765 bond->dev->name, new_value, 0, INT_MAX);
762 ret = -EINVAL; 766 ret = -EINVAL;
763 goto out; 767 goto out;
764 } else { 768 } else {
@@ -968,37 +972,37 @@ static ssize_t bonding_store_miimon(struct device *d,
968 } 972 }
969 if (new_value < 0) { 973 if (new_value < 0) {
970 pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", 974 pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n",
971 bond->dev->name, new_value, 1, INT_MAX); 975 bond->dev->name, new_value, 0, INT_MAX);
972 ret = -EINVAL; 976 ret = -EINVAL;
973 goto out; 977 goto out;
974 } else { 978 }
975 pr_info("%s: Setting MII monitoring interval to %d.\n", 979 pr_info("%s: Setting MII monitoring interval to %d.\n",
976 bond->dev->name, new_value); 980 bond->dev->name, new_value);
977 bond->params.miimon = new_value; 981 bond->params.miimon = new_value;
978 if (bond->params.updelay) 982 if (bond->params.updelay)
979 pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", 983 pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n",
980 bond->dev->name, 984 bond->dev->name,
981 bond->params.updelay * bond->params.miimon); 985 bond->params.updelay * bond->params.miimon);
982 if (bond->params.downdelay) 986 if (bond->params.downdelay)
983 pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", 987 pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n",
984 bond->dev->name, 988 bond->dev->name,
985 bond->params.downdelay * bond->params.miimon); 989 bond->params.downdelay * bond->params.miimon);
986 if (bond->params.arp_interval) { 990 if (new_value && bond->params.arp_interval) {
987 pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", 991 pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
988 bond->dev->name); 992 bond->dev->name);
989 bond->params.arp_interval = 0; 993 bond->params.arp_interval = 0;
990 if (bond->params.arp_validate) { 994 if (bond->params.arp_validate)
991 bond->params.arp_validate = 995 bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
992 BOND_ARP_VALIDATE_NONE; 996 }
993 } 997 if (bond->dev->flags & IFF_UP) {
994 } 998 /* If the interface is up, we may need to fire off
995 999 * the MII timer. If the interface is down, the
996 if (bond->dev->flags & IFF_UP) { 1000 * timer will get fired off when the open function
997 /* If the interface is up, we may need to fire off 1001 * is called.
998 * the MII timer. If the interface is down, the 1002 */
999 * timer will get fired off when the open function 1003 if (!new_value) {
1000 * is called. 1004 cancel_delayed_work_sync(&bond->mii_work);
1001 */ 1005 } else {
1002 cancel_delayed_work_sync(&bond->arp_work); 1006 cancel_delayed_work_sync(&bond->arp_work);
1003 queue_delayed_work(bond->wq, &bond->mii_work, 0); 1007 queue_delayed_work(bond->wq, &bond->mii_work, 0);
1004 } 1008 }
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
index b39ca5b3ea7f..ff2ba86cd4a4 100644
--- a/drivers/net/can/sja1000/Kconfig
+++ b/drivers/net/can/sja1000/Kconfig
@@ -46,6 +46,7 @@ config CAN_EMS_PCI
46config CAN_PEAK_PCMCIA 46config CAN_PEAK_PCMCIA
47 tristate "PEAK PCAN-PC Card" 47 tristate "PEAK PCAN-PC Card"
48 depends on PCMCIA 48 depends on PCMCIA
49 depends on HAS_IOPORT
49 ---help--- 50 ---help---
50 This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) 51 This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels)
51 from PEAK-System (http://www.peak-system.com). To compile this 52 from PEAK-System (http://www.peak-system.com). To compile this
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index a042cdc260dc..3c18d7d000ed 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -348,7 +348,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
348 */ 348 */
349 if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == 349 if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) ==
350 REG_CR_BASICCAN_INITIAL && 350 REG_CR_BASICCAN_INITIAL &&
351 (priv->read_reg(priv, REG_SR) == REG_SR_BASICCAN_INITIAL) && 351 (priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_BASICCAN_INITIAL) &&
352 (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) 352 (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL))
353 flag = 1; 353 flag = 1;
354 354
@@ -360,7 +360,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv)
360 * See states on p. 23 of the Datasheet. 360 * See states on p. 23 of the Datasheet.
361 */ 361 */
362 if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && 362 if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL &&
363 priv->read_reg(priv, REG_SR) == REG_SR_PELICAN_INITIAL && 363 priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_PELICAN_INITIAL &&
364 priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) 364 priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL)
365 return flag; 365 return flag;
366 366
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index daf4013a8fc7..e4df307eaa90 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -92,7 +92,7 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
92 */ 92 */
93 spin_lock_irqsave(&priv->cmdreg_lock, flags); 93 spin_lock_irqsave(&priv->cmdreg_lock, flags);
94 priv->write_reg(priv, REG_CMR, val); 94 priv->write_reg(priv, REG_CMR, val);
95 priv->read_reg(priv, REG_SR); 95 priv->read_reg(priv, SJA1000_REG_SR);
96 spin_unlock_irqrestore(&priv->cmdreg_lock, flags); 96 spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
97} 97}
98 98
@@ -502,7 +502,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
502 502
503 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { 503 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
504 n++; 504 n++;
505 status = priv->read_reg(priv, REG_SR); 505 status = priv->read_reg(priv, SJA1000_REG_SR);
506 /* check for absent controller due to hw unplug */ 506 /* check for absent controller due to hw unplug */
507 if (status == 0xFF && sja1000_is_absent(priv)) 507 if (status == 0xFF && sja1000_is_absent(priv))
508 return IRQ_NONE; 508 return IRQ_NONE;
@@ -530,7 +530,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
530 /* receive interrupt */ 530 /* receive interrupt */
531 while (status & SR_RBS) { 531 while (status & SR_RBS) {
532 sja1000_rx(dev); 532 sja1000_rx(dev);
533 status = priv->read_reg(priv, REG_SR); 533 status = priv->read_reg(priv, SJA1000_REG_SR);
534 /* check for absent controller */ 534 /* check for absent controller */
535 if (status == 0xFF && sja1000_is_absent(priv)) 535 if (status == 0xFF && sja1000_is_absent(priv))
536 return IRQ_NONE; 536 return IRQ_NONE;
diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h
index afa99847a510..aa48e053da27 100644
--- a/drivers/net/can/sja1000/sja1000.h
+++ b/drivers/net/can/sja1000/sja1000.h
@@ -56,7 +56,7 @@
56/* SJA1000 registers - manual section 6.4 (Pelican Mode) */ 56/* SJA1000 registers - manual section 6.4 (Pelican Mode) */
57#define REG_MOD 0x00 57#define REG_MOD 0x00
58#define REG_CMR 0x01 58#define REG_CMR 0x01
59#define REG_SR 0x02 59#define SJA1000_REG_SR 0x02
60#define REG_IR 0x03 60#define REG_IR 0x03
61#define REG_IER 0x04 61#define REG_IER 0x04
62#define REG_ALC 0x0B 62#define REG_ALC 0x0B
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h
index 829b5ad71d0d..b5fd934585e9 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e.h
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h
@@ -186,7 +186,7 @@ struct atl1e_tpd_desc {
186/* how about 0x2000 */ 186/* how about 0x2000 */
187#define MAX_TX_BUF_LEN 0x2000 187#define MAX_TX_BUF_LEN 0x2000
188#define MAX_TX_BUF_SHIFT 13 188#define MAX_TX_BUF_SHIFT 13
189/*#define MAX_TX_BUF_LEN 0x3000 */ 189#define MAX_TSO_SEG_SIZE 0x3c00
190 190
191/* rrs word 1 bit 0:31 */ 191/* rrs word 1 bit 0:31 */
192#define RRS_RX_CSUM_MASK 0xFFFF 192#define RRS_RX_CSUM_MASK 0xFFFF
@@ -438,7 +438,6 @@ struct atl1e_adapter {
438 struct atl1e_hw hw; 438 struct atl1e_hw hw;
439 struct atl1e_hw_stats hw_stats; 439 struct atl1e_hw_stats hw_stats;
440 440
441 bool have_msi;
442 u32 wol; 441 u32 wol;
443 u16 link_speed; 442 u16 link_speed;
444 u16 link_duplex; 443 u16 link_duplex;
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 92f4734f860d..ac25f05ff68f 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1849,34 +1849,19 @@ static void atl1e_free_irq(struct atl1e_adapter *adapter)
1849 struct net_device *netdev = adapter->netdev; 1849 struct net_device *netdev = adapter->netdev;
1850 1850
1851 free_irq(adapter->pdev->irq, netdev); 1851 free_irq(adapter->pdev->irq, netdev);
1852
1853 if (adapter->have_msi)
1854 pci_disable_msi(adapter->pdev);
1855} 1852}
1856 1853
1857static int atl1e_request_irq(struct atl1e_adapter *adapter) 1854static int atl1e_request_irq(struct atl1e_adapter *adapter)
1858{ 1855{
1859 struct pci_dev *pdev = adapter->pdev; 1856 struct pci_dev *pdev = adapter->pdev;
1860 struct net_device *netdev = adapter->netdev; 1857 struct net_device *netdev = adapter->netdev;
1861 int flags = 0;
1862 int err = 0; 1858 int err = 0;
1863 1859
1864 adapter->have_msi = true; 1860 err = request_irq(pdev->irq, atl1e_intr, IRQF_SHARED, netdev->name,
1865 err = pci_enable_msi(pdev); 1861 netdev);
1866 if (err) {
1867 netdev_dbg(netdev,
1868 "Unable to allocate MSI interrupt Error: %d\n", err);
1869 adapter->have_msi = false;
1870 }
1871
1872 if (!adapter->have_msi)
1873 flags |= IRQF_SHARED;
1874 err = request_irq(pdev->irq, atl1e_intr, flags, netdev->name, netdev);
1875 if (err) { 1862 if (err) {
1876 netdev_dbg(adapter->netdev, 1863 netdev_dbg(adapter->netdev,
1877 "Unable to allocate interrupt Error: %d\n", err); 1864 "Unable to allocate interrupt Error: %d\n", err);
1878 if (adapter->have_msi)
1879 pci_disable_msi(pdev);
1880 return err; 1865 return err;
1881 } 1866 }
1882 netdev_dbg(netdev, "atl1e_request_irq OK\n"); 1867 netdev_dbg(netdev, "atl1e_request_irq OK\n");
@@ -2344,6 +2329,7 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2344 2329
2345 INIT_WORK(&adapter->reset_task, atl1e_reset_task); 2330 INIT_WORK(&adapter->reset_task, atl1e_reset_task);
2346 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); 2331 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task);
2332 netif_set_gso_max_size(netdev, MAX_TSO_SEG_SIZE);
2347 err = register_netdev(netdev); 2333 err = register_netdev(netdev);
2348 if (err) { 2334 if (err) {
2349 netdev_err(netdev, "register netdevice failed\n"); 2335 netdev_err(netdev, "register netdevice failed\n");
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 67d2663b3974..17a972734ba7 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -14604,8 +14604,11 @@ static void tg3_read_vpd(struct tg3 *tp)
14604 if (j + len > block_end) 14604 if (j + len > block_end)
14605 goto partno; 14605 goto partno;
14606 14606
14607 memcpy(tp->fw_ver, &vpd_data[j], len); 14607 if (len >= sizeof(tp->fw_ver))
14608 strncat(tp->fw_ver, " bc ", vpdlen - len - 1); 14608 len = sizeof(tp->fw_ver) - 1;
14609 memset(tp->fw_ver, 0, sizeof(tp->fw_ver));
14610 snprintf(tp->fw_ver, sizeof(tp->fw_ver), "%.*s bc ", len,
14611 &vpd_data[j]);
14609 } 14612 }
14610 14613
14611partno: 14614partno:
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index a170065b5973..b0ebc9f6d55e 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -163,6 +163,7 @@
163#define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ 163#define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */
164 164
165/* XGMAC_INT_STAT reg */ 165/* XGMAC_INT_STAT reg */
166#define XGMAC_INT_STAT_PMTIM 0x00800000 /* PMT Interrupt Mask */
166#define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ 167#define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */
167#define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ 168#define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */
168 169
@@ -960,6 +961,9 @@ static int xgmac_hw_init(struct net_device *dev)
960 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); 961 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS);
961 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); 962 writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA);
962 963
964 /* Mask power mgt interrupt */
965 writel(XGMAC_INT_STAT_PMTIM, ioaddr + XGMAC_INT_STAT);
966
963 /* XGMAC requires AXI bus init. This is a 'magic number' for now */ 967 /* XGMAC requires AXI bus init. This is a 'magic number' for now */
964 writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); 968 writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS);
965 969
@@ -1141,6 +1145,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit)
1141 struct sk_buff *skb; 1145 struct sk_buff *skb;
1142 int frame_len; 1146 int frame_len;
1143 1147
1148 if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ))
1149 break;
1150
1144 entry = priv->rx_tail; 1151 entry = priv->rx_tail;
1145 p = priv->dma_rx + entry; 1152 p = priv->dma_rx + entry;
1146 if (desc_get_owner(p)) 1153 if (desc_get_owner(p))
@@ -1825,7 +1832,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode)
1825 unsigned int pmt = 0; 1832 unsigned int pmt = 0;
1826 1833
1827 if (mode & WAKE_MAGIC) 1834 if (mode & WAKE_MAGIC)
1828 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT; 1835 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT_EN;
1829 if (mode & WAKE_UCAST) 1836 if (mode & WAKE_UCAST)
1830 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; 1837 pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST;
1831 1838
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 8cdf02503d13..9eada8e86078 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -257,6 +257,107 @@ static void dm9000_dumpblk_32bit(void __iomem *reg, int count)
257 tmp = readl(reg); 257 tmp = readl(reg);
258} 258}
259 259
260/*
261 * Sleep, either by using msleep() or if we are suspending, then
262 * use mdelay() to sleep.
263 */
264static void dm9000_msleep(board_info_t *db, unsigned int ms)
265{
266 if (db->in_suspend)
267 mdelay(ms);
268 else
269 msleep(ms);
270}
271
272/* Read a word from phyxcer */
273static int
274dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
275{
276 board_info_t *db = netdev_priv(dev);
277 unsigned long flags;
278 unsigned int reg_save;
279 int ret;
280
281 mutex_lock(&db->addr_lock);
282
283 spin_lock_irqsave(&db->lock, flags);
284
285 /* Save previous register address */
286 reg_save = readb(db->io_addr);
287
288 /* Fill the phyxcer register into REG_0C */
289 iow(db, DM9000_EPAR, DM9000_PHY | reg);
290
291 /* Issue phyxcer read command */
292 iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS);
293
294 writeb(reg_save, db->io_addr);
295 spin_unlock_irqrestore(&db->lock, flags);
296
297 dm9000_msleep(db, 1); /* Wait read complete */
298
299 spin_lock_irqsave(&db->lock, flags);
300 reg_save = readb(db->io_addr);
301
302 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
303
304 /* The read data keeps on REG_0D & REG_0E */
305 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
306
307 /* restore the previous address */
308 writeb(reg_save, db->io_addr);
309 spin_unlock_irqrestore(&db->lock, flags);
310
311 mutex_unlock(&db->addr_lock);
312
313 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
314 return ret;
315}
316
317/* Write a word to phyxcer */
318static void
319dm9000_phy_write(struct net_device *dev,
320 int phyaddr_unused, int reg, int value)
321{
322 board_info_t *db = netdev_priv(dev);
323 unsigned long flags;
324 unsigned long reg_save;
325
326 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
327 mutex_lock(&db->addr_lock);
328
329 spin_lock_irqsave(&db->lock, flags);
330
331 /* Save previous register address */
332 reg_save = readb(db->io_addr);
333
334 /* Fill the phyxcer register into REG_0C */
335 iow(db, DM9000_EPAR, DM9000_PHY | reg);
336
337 /* Fill the written data into REG_0D & REG_0E */
338 iow(db, DM9000_EPDRL, value);
339 iow(db, DM9000_EPDRH, value >> 8);
340
341 /* Issue phyxcer write command */
342 iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW);
343
344 writeb(reg_save, db->io_addr);
345 spin_unlock_irqrestore(&db->lock, flags);
346
347 dm9000_msleep(db, 1); /* Wait write complete */
348
349 spin_lock_irqsave(&db->lock, flags);
350 reg_save = readb(db->io_addr);
351
352 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
353
354 /* restore the previous address */
355 writeb(reg_save, db->io_addr);
356
357 spin_unlock_irqrestore(&db->lock, flags);
358 mutex_unlock(&db->addr_lock);
359}
360
260/* dm9000_set_io 361/* dm9000_set_io
261 * 362 *
262 * select the specified set of io routines to use with the 363 * select the specified set of io routines to use with the
@@ -795,6 +896,9 @@ dm9000_init_dm9000(struct net_device *dev)
795 896
796 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ 897 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */
797 898
899 dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */
900 dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */
901
798 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; 902 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0;
799 903
800 /* if wol is needed, then always set NCR_WAKEEN otherwise we end 904 /* if wol is needed, then always set NCR_WAKEEN otherwise we end
@@ -1201,109 +1305,6 @@ dm9000_open(struct net_device *dev)
1201 return 0; 1305 return 0;
1202} 1306}
1203 1307
1204/*
1205 * Sleep, either by using msleep() or if we are suspending, then
1206 * use mdelay() to sleep.
1207 */
1208static void dm9000_msleep(board_info_t *db, unsigned int ms)
1209{
1210 if (db->in_suspend)
1211 mdelay(ms);
1212 else
1213 msleep(ms);
1214}
1215
1216/*
1217 * Read a word from phyxcer
1218 */
1219static int
1220dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
1221{
1222 board_info_t *db = netdev_priv(dev);
1223 unsigned long flags;
1224 unsigned int reg_save;
1225 int ret;
1226
1227 mutex_lock(&db->addr_lock);
1228
1229 spin_lock_irqsave(&db->lock,flags);
1230
1231 /* Save previous register address */
1232 reg_save = readb(db->io_addr);
1233
1234 /* Fill the phyxcer register into REG_0C */
1235 iow(db, DM9000_EPAR, DM9000_PHY | reg);
1236
1237 iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); /* Issue phyxcer read command */
1238
1239 writeb(reg_save, db->io_addr);
1240 spin_unlock_irqrestore(&db->lock,flags);
1241
1242 dm9000_msleep(db, 1); /* Wait read complete */
1243
1244 spin_lock_irqsave(&db->lock,flags);
1245 reg_save = readb(db->io_addr);
1246
1247 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */
1248
1249 /* The read data keeps on REG_0D & REG_0E */
1250 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL);
1251
1252 /* restore the previous address */
1253 writeb(reg_save, db->io_addr);
1254 spin_unlock_irqrestore(&db->lock,flags);
1255
1256 mutex_unlock(&db->addr_lock);
1257
1258 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
1259 return ret;
1260}
1261
1262/*
1263 * Write a word to phyxcer
1264 */
1265static void
1266dm9000_phy_write(struct net_device *dev,
1267 int phyaddr_unused, int reg, int value)
1268{
1269 board_info_t *db = netdev_priv(dev);
1270 unsigned long flags;
1271 unsigned long reg_save;
1272
1273 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
1274 mutex_lock(&db->addr_lock);
1275
1276 spin_lock_irqsave(&db->lock,flags);
1277
1278 /* Save previous register address */
1279 reg_save = readb(db->io_addr);
1280
1281 /* Fill the phyxcer register into REG_0C */
1282 iow(db, DM9000_EPAR, DM9000_PHY | reg);
1283
1284 /* Fill the written data into REG_0D & REG_0E */
1285 iow(db, DM9000_EPDRL, value);
1286 iow(db, DM9000_EPDRH, value >> 8);
1287
1288 iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); /* Issue phyxcer write command */
1289
1290 writeb(reg_save, db->io_addr);
1291 spin_unlock_irqrestore(&db->lock, flags);
1292
1293 dm9000_msleep(db, 1); /* Wait write complete */
1294
1295 spin_lock_irqsave(&db->lock,flags);
1296 reg_save = readb(db->io_addr);
1297
1298 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */
1299
1300 /* restore the previous address */
1301 writeb(reg_save, db->io_addr);
1302
1303 spin_unlock_irqrestore(&db->lock, flags);
1304 mutex_unlock(&db->addr_lock);
1305}
1306
1307static void 1308static void
1308dm9000_shutdown(struct net_device *dev) 1309dm9000_shutdown(struct net_device *dev)
1309{ 1310{
@@ -1502,7 +1503,12 @@ dm9000_probe(struct platform_device *pdev)
1502 db->flags |= DM9000_PLATF_SIMPLE_PHY; 1503 db->flags |= DM9000_PLATF_SIMPLE_PHY;
1503#endif 1504#endif
1504 1505
1505 dm9000_reset(db); 1506 /* Fixing bug on dm9000_probe, takeover dm9000_reset(db),
1507 * Need 'NCR_MAC_LBK' bit to indeed stable our DM9000 fifo
1508 * while probe stage.
1509 */
1510
1511 iow(db, DM9000_NCR, NCR_MAC_LBK | NCR_RST);
1506 1512
1507 /* try multiple times, DM9000 sometimes gets the read wrong */ 1513 /* try multiple times, DM9000 sometimes gets the read wrong */
1508 for (i = 0; i < 8; i++) { 1514 for (i = 0; i < 8; i++) {
diff --git a/drivers/net/ethernet/davicom/dm9000.h b/drivers/net/ethernet/davicom/dm9000.h
index 55688bd1a3ef..9ce058adabab 100644
--- a/drivers/net/ethernet/davicom/dm9000.h
+++ b/drivers/net/ethernet/davicom/dm9000.h
@@ -69,7 +69,9 @@
69#define NCR_WAKEEN (1<<6) 69#define NCR_WAKEEN (1<<6)
70#define NCR_FCOL (1<<4) 70#define NCR_FCOL (1<<4)
71#define NCR_FDX (1<<3) 71#define NCR_FDX (1<<3)
72#define NCR_LBK (3<<1) 72
73#define NCR_RESERVED (3<<1)
74#define NCR_MAC_LBK (1<<1)
73#define NCR_RST (1<<0) 75#define NCR_RST (1<<0)
74 76
75#define NSR_SPEED (1<<7) 77#define NSR_SPEED (1<<7)
@@ -167,5 +169,12 @@
167#define ISR_LNKCHNG (1<<5) 169#define ISR_LNKCHNG (1<<5)
168#define ISR_UNDERRUN (1<<4) 170#define ISR_UNDERRUN (1<<4)
169 171
172/* Davicom MII registers.
173 */
174
175#define MII_DM_DSPCR 0x1b /* DSP Control Register */
176
177#define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */
178
170#endif /* _DM9000X_H_ */ 179#endif /* _DM9000X_H_ */
171 180
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 911d0253dbb2..f292c3aa423f 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -345,6 +345,53 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
345 return NETDEV_TX_OK; 345 return NETDEV_TX_OK;
346} 346}
347 347
348/* Init RX & TX buffer descriptors
349 */
350static void fec_enet_bd_init(struct net_device *dev)
351{
352 struct fec_enet_private *fep = netdev_priv(dev);
353 struct bufdesc *bdp;
354 unsigned int i;
355
356 /* Initialize the receive buffer descriptors. */
357 bdp = fep->rx_bd_base;
358 for (i = 0; i < RX_RING_SIZE; i++) {
359
360 /* Initialize the BD for every fragment in the page. */
361 if (bdp->cbd_bufaddr)
362 bdp->cbd_sc = BD_ENET_RX_EMPTY;
363 else
364 bdp->cbd_sc = 0;
365 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
366 }
367
368 /* Set the last buffer to wrap */
369 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
370 bdp->cbd_sc |= BD_SC_WRAP;
371
372 fep->cur_rx = fep->rx_bd_base;
373
374 /* ...and the same for transmit */
375 bdp = fep->tx_bd_base;
376 fep->cur_tx = bdp;
377 for (i = 0; i < TX_RING_SIZE; i++) {
378
379 /* Initialize the BD for every fragment in the page. */
380 bdp->cbd_sc = 0;
381 if (bdp->cbd_bufaddr && fep->tx_skbuff[i]) {
382 dev_kfree_skb_any(fep->tx_skbuff[i]);
383 fep->tx_skbuff[i] = NULL;
384 }
385 bdp->cbd_bufaddr = 0;
386 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
387 }
388
389 /* Set the last buffer to wrap */
390 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
391 bdp->cbd_sc |= BD_SC_WRAP;
392 fep->dirty_tx = bdp;
393}
394
348/* This function is called to start or restart the FEC during a link 395/* This function is called to start or restart the FEC during a link
349 * change. This only happens when switching between half and full 396 * change. This only happens when switching between half and full
350 * duplex. 397 * duplex.
@@ -388,6 +435,8 @@ fec_restart(struct net_device *ndev, int duplex)
388 /* Set maximum receive buffer size. */ 435 /* Set maximum receive buffer size. */
389 writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); 436 writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);
390 437
438 fec_enet_bd_init(ndev);
439
391 /* Set receive and transmit descriptor base. */ 440 /* Set receive and transmit descriptor base. */
392 writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); 441 writel(fep->bd_dma, fep->hwp + FEC_R_DES_START);
393 if (fep->bufdesc_ex) 442 if (fep->bufdesc_ex)
@@ -397,7 +446,6 @@ fec_restart(struct net_device *ndev, int duplex)
397 writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) 446 writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc)
398 * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); 447 * RX_RING_SIZE, fep->hwp + FEC_X_DES_START);
399 448
400 fep->cur_rx = fep->rx_bd_base;
401 449
402 for (i = 0; i <= TX_RING_MOD_MASK; i++) { 450 for (i = 0; i <= TX_RING_MOD_MASK; i++) {
403 if (fep->tx_skbuff[i]) { 451 if (fep->tx_skbuff[i]) {
@@ -1597,8 +1645,6 @@ static int fec_enet_init(struct net_device *ndev)
1597{ 1645{
1598 struct fec_enet_private *fep = netdev_priv(ndev); 1646 struct fec_enet_private *fep = netdev_priv(ndev);
1599 struct bufdesc *cbd_base; 1647 struct bufdesc *cbd_base;
1600 struct bufdesc *bdp;
1601 unsigned int i;
1602 1648
1603 /* Allocate memory for buffer descriptors. */ 1649 /* Allocate memory for buffer descriptors. */
1604 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, 1650 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma,
@@ -1608,6 +1654,7 @@ static int fec_enet_init(struct net_device *ndev)
1608 return -ENOMEM; 1654 return -ENOMEM;
1609 } 1655 }
1610 1656
1657 memset(cbd_base, 0, PAGE_SIZE);
1611 spin_lock_init(&fep->hw_lock); 1658 spin_lock_init(&fep->hw_lock);
1612 1659
1613 fep->netdev = ndev; 1660 fep->netdev = ndev;
@@ -1631,35 +1678,6 @@ static int fec_enet_init(struct net_device *ndev)
1631 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); 1678 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK);
1632 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); 1679 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT);
1633 1680
1634 /* Initialize the receive buffer descriptors. */
1635 bdp = fep->rx_bd_base;
1636 for (i = 0; i < RX_RING_SIZE; i++) {
1637
1638 /* Initialize the BD for every fragment in the page. */
1639 bdp->cbd_sc = 0;
1640 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
1641 }
1642
1643 /* Set the last buffer to wrap */
1644 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
1645 bdp->cbd_sc |= BD_SC_WRAP;
1646
1647 /* ...and the same for transmit */
1648 bdp = fep->tx_bd_base;
1649 fep->cur_tx = bdp;
1650 for (i = 0; i < TX_RING_SIZE; i++) {
1651
1652 /* Initialize the BD for every fragment in the page. */
1653 bdp->cbd_sc = 0;
1654 bdp->cbd_bufaddr = 0;
1655 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
1656 }
1657
1658 /* Set the last buffer to wrap */
1659 bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
1660 bdp->cbd_sc |= BD_SC_WRAP;
1661 fep->dirty_tx = bdp;
1662
1663 fec_restart(ndev, 0); 1681 fec_restart(ndev, 0);
1664 1682
1665 return 0; 1683 return 0;
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 43462d596a4e..ffd287196bf8 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1053,6 +1053,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1053 txdr->buffer_info[i].dma = 1053 txdr->buffer_info[i].dma =
1054 dma_map_single(&pdev->dev, skb->data, skb->len, 1054 dma_map_single(&pdev->dev, skb->data, skb->len,
1055 DMA_TO_DEVICE); 1055 DMA_TO_DEVICE);
1056 if (dma_mapping_error(&pdev->dev, txdr->buffer_info[i].dma)) {
1057 ret_val = 4;
1058 goto err_nomem;
1059 }
1056 tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); 1060 tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma);
1057 tx_desc->lower.data = cpu_to_le32(skb->len); 1061 tx_desc->lower.data = cpu_to_le32(skb->len);
1058 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | 1062 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP |
@@ -1069,7 +1073,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1069 rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), 1073 rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer),
1070 GFP_KERNEL); 1074 GFP_KERNEL);
1071 if (!rxdr->buffer_info) { 1075 if (!rxdr->buffer_info) {
1072 ret_val = 4; 1076 ret_val = 5;
1073 goto err_nomem; 1077 goto err_nomem;
1074 } 1078 }
1075 1079
@@ -1077,7 +1081,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1077 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, 1081 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
1078 GFP_KERNEL); 1082 GFP_KERNEL);
1079 if (!rxdr->desc) { 1083 if (!rxdr->desc) {
1080 ret_val = 5; 1084 ret_val = 6;
1081 goto err_nomem; 1085 goto err_nomem;
1082 } 1086 }
1083 memset(rxdr->desc, 0, rxdr->size); 1087 memset(rxdr->desc, 0, rxdr->size);
@@ -1101,7 +1105,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1101 1105
1102 skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); 1106 skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL);
1103 if (!skb) { 1107 if (!skb) {
1104 ret_val = 6; 1108 ret_val = 7;
1105 goto err_nomem; 1109 goto err_nomem;
1106 } 1110 }
1107 skb_reserve(skb, NET_IP_ALIGN); 1111 skb_reserve(skb, NET_IP_ALIGN);
@@ -1110,6 +1114,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1110 rxdr->buffer_info[i].dma = 1114 rxdr->buffer_info[i].dma =
1111 dma_map_single(&pdev->dev, skb->data, 1115 dma_map_single(&pdev->dev, skb->data,
1112 E1000_RXBUFFER_2048, DMA_FROM_DEVICE); 1116 E1000_RXBUFFER_2048, DMA_FROM_DEVICE);
1117 if (dma_mapping_error(&pdev->dev, rxdr->buffer_info[i].dma)) {
1118 ret_val = 8;
1119 goto err_nomem;
1120 }
1113 rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); 1121 rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma);
1114 memset(skb->data, 0x00, skb->len); 1122 memset(skb->data, 0x00, skb->len);
1115 } 1123 }
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 948b86ffa4f0..7e615e2bf7e6 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -848,11 +848,16 @@ check_page:
848 } 848 }
849 } 849 }
850 850
851 if (!buffer_info->dma) 851 if (!buffer_info->dma) {
852 buffer_info->dma = dma_map_page(&pdev->dev, 852 buffer_info->dma = dma_map_page(&pdev->dev,
853 buffer_info->page, 0, 853 buffer_info->page, 0,
854 PAGE_SIZE, 854 PAGE_SIZE,
855 DMA_FROM_DEVICE); 855 DMA_FROM_DEVICE);
856 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
857 adapter->alloc_rx_buff_failed++;
858 break;
859 }
860 }
856 861
857 rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); 862 rx_desc = E1000_RX_DESC_EXT(*rx_ring, i);
858 rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); 863 rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index ea4808373435..b5f94abe3cff 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -2159,6 +2159,10 @@ map_skb:
2159 skb->data, 2159 skb->data,
2160 adapter->rx_buffer_len, 2160 adapter->rx_buffer_len,
2161 DMA_FROM_DEVICE); 2161 DMA_FROM_DEVICE);
2162 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
2163 adapter->alloc_rx_buff_failed++;
2164 break;
2165 }
2162 2166
2163 rx_desc = IXGB_RX_DESC(*rx_ring, i); 2167 rx_desc = IXGB_RX_DESC(*rx_ring, i);
2164 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); 2168 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
@@ -2168,7 +2172,8 @@ map_skb:
2168 rx_desc->status = 0; 2172 rx_desc->status = 0;
2169 2173
2170 2174
2171 if (++i == rx_ring->count) i = 0; 2175 if (++i == rx_ring->count)
2176 i = 0;
2172 buffer_info = &rx_ring->buffer_info[i]; 2177 buffer_info = &rx_ring->buffer_info[i];
2173 } 2178 }
2174 2179
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index db5611ae407e..79f4a26ea6cc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7922,12 +7922,19 @@ static int __init ixgbe_init_module(void)
7922 ixgbe_dbg_init(); 7922 ixgbe_dbg_init();
7923#endif /* CONFIG_DEBUG_FS */ 7923#endif /* CONFIG_DEBUG_FS */
7924 7924
7925 ret = pci_register_driver(&ixgbe_driver);
7926 if (ret) {
7927#ifdef CONFIG_DEBUG_FS
7928 ixgbe_dbg_exit();
7929#endif /* CONFIG_DEBUG_FS */
7930 return ret;
7931 }
7932
7925#ifdef CONFIG_IXGBE_DCA 7933#ifdef CONFIG_IXGBE_DCA
7926 dca_register_notify(&dca_notifier); 7934 dca_register_notify(&dca_notifier);
7927#endif 7935#endif
7928 7936
7929 ret = pci_register_driver(&ixgbe_driver); 7937 return 0;
7930 return ret;
7931} 7938}
7932 7939
7933module_init(ixgbe_init_module); 7940module_init(ixgbe_init_module);
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index fc07ca35721b..6a0e671fcecd 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1067,7 +1067,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space)
1067 sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); 1067 sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp);
1068 sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); 1068 sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2);
1069 1069
1070 tp = space - 2048/8; 1070 tp = space - 8192/8;
1071 sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); 1071 sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp);
1072 sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); 1072 sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4);
1073 } else { 1073 } else {
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h
index 615ac63ea860..ec6dcd80152b 100644
--- a/drivers/net/ethernet/marvell/sky2.h
+++ b/drivers/net/ethernet/marvell/sky2.h
@@ -2074,7 +2074,7 @@ enum {
2074 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ 2074 GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */
2075 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ 2075 GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */
2076 2076
2077#define GMAC_DEF_MSK GM_IS_TX_FF_UR 2077#define GMAC_DEF_MSK (GM_IS_TX_FF_UR | GM_IS_RX_FF_OR)
2078}; 2078};
2079 2079
2080/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ 2080/* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index f278b10ef714..30d78f806dc3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -411,8 +411,8 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
411 411
412static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) 412static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac)
413{ 413{
414 unsigned int i; 414 int i;
415 for (i = ETH_ALEN - 1; i; --i) { 415 for (i = ETH_ALEN - 1; i >= 0; --i) {
416 dst_mac[i] = src_mac & 0xff; 416 dst_mac[i] = src_mac & 0xff;
417 src_mac >>= 8; 417 src_mac >>= 8;
418 } 418 }
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 33bcb63d56a2..8fb481252e2c 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -528,7 +528,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
528 for (; rxfc != 0; rxfc--) { 528 for (; rxfc != 0; rxfc--) {
529 rxh = ks8851_rdreg32(ks, KS_RXFHSR); 529 rxh = ks8851_rdreg32(ks, KS_RXFHSR);
530 rxstat = rxh & 0xffff; 530 rxstat = rxh & 0xffff;
531 rxlen = rxh >> 16; 531 rxlen = (rxh >> 16) & 0xfff;
532 532
533 netif_dbg(ks, rx_status, ks->netdev, 533 netif_dbg(ks, rx_status, ks->netdev,
534 "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); 534 "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 28fb50a1e9c3..4ecbe64a758d 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3818,6 +3818,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp)
3818 } 3818 }
3819} 3819}
3820 3820
3821static void rtl_speed_down(struct rtl8169_private *tp)
3822{
3823 u32 adv;
3824 int lpa;
3825
3826 rtl_writephy(tp, 0x1f, 0x0000);
3827 lpa = rtl_readphy(tp, MII_LPA);
3828
3829 if (lpa & (LPA_10HALF | LPA_10FULL))
3830 adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
3831 else if (lpa & (LPA_100HALF | LPA_100FULL))
3832 adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
3833 ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
3834 else
3835 adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
3836 ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
3837 (tp->mii.supports_gmii ?
3838 ADVERTISED_1000baseT_Half |
3839 ADVERTISED_1000baseT_Full : 0);
3840
3841 rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
3842 adv);
3843}
3844
3821static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) 3845static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
3822{ 3846{
3823 void __iomem *ioaddr = tp->mmio_addr; 3847 void __iomem *ioaddr = tp->mmio_addr;
@@ -3848,9 +3872,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
3848 if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) 3872 if (!(__rtl8169_get_wol(tp) & WAKE_ANY))
3849 return false; 3873 return false;
3850 3874
3851 rtl_writephy(tp, 0x1f, 0x0000); 3875 rtl_speed_down(tp);
3852 rtl_writephy(tp, MII_BMCR, 0x0000);
3853
3854 rtl_wol_suspend_quirk(tp); 3876 rtl_wol_suspend_quirk(tp);
3855 3877
3856 return true; 3878 return true;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index bf5e3cf97c4d..6ed333fe5c04 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
1216 if (felic_stat & ECSR_LCHNG) { 1216 if (felic_stat & ECSR_LCHNG) {
1217 /* Link Changed */ 1217 /* Link Changed */
1218 if (mdp->cd->no_psr || mdp->no_ether_link) { 1218 if (mdp->cd->no_psr || mdp->no_ether_link) {
1219 if (mdp->link == PHY_DOWN) 1219 goto ignore_link;
1220 link_stat = 0;
1221 else
1222 link_stat = PHY_ST_LINK;
1223 } else { 1220 } else {
1224 link_stat = (sh_eth_read(ndev, PSR)); 1221 link_stat = (sh_eth_read(ndev, PSR));
1225 if (mdp->ether_link_active_low) 1222 if (mdp->ether_link_active_low)
@@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
1242 } 1239 }
1243 } 1240 }
1244 1241
1242ignore_link:
1245 if (intr_status & EESR_TWB) { 1243 if (intr_status & EESR_TWB) {
1246 /* Write buck end. unused write back interrupt */ 1244 /* Write buck end. unused write back interrupt */
1247 if (intr_status & EESR_TABT) /* Transmit Abort int */ 1245 if (intr_status & EESR_TABT) /* Transmit Abort int */
@@ -1326,12 +1324,18 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
1326 struct sh_eth_private *mdp = netdev_priv(ndev); 1324 struct sh_eth_private *mdp = netdev_priv(ndev);
1327 struct sh_eth_cpu_data *cd = mdp->cd; 1325 struct sh_eth_cpu_data *cd = mdp->cd;
1328 irqreturn_t ret = IRQ_NONE; 1326 irqreturn_t ret = IRQ_NONE;
1329 u32 intr_status = 0; 1327 unsigned long intr_status;
1330 1328
1331 spin_lock(&mdp->lock); 1329 spin_lock(&mdp->lock);
1332 1330
1333 /* Get interrpt stat */ 1331 /* Get interrupt status */
1334 intr_status = sh_eth_read(ndev, EESR); 1332 intr_status = sh_eth_read(ndev, EESR);
1333 /* Mask it with the interrupt mask, forcing ECI interrupt to be always
1334 * enabled since it's the one that comes thru regardless of the mask,
1335 * and we need to fully handle it in sh_eth_error() in order to quench
1336 * it as it doesn't get cleared by just writing 1 to the ECI bit...
1337 */
1338 intr_status &= sh_eth_read(ndev, EESIPR) | DMAC_M_ECI;
1335 /* Clear interrupt */ 1339 /* Clear interrupt */
1336 if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | 1340 if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF |
1337 EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | 1341 EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF |
@@ -1373,7 +1377,7 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1373 struct phy_device *phydev = mdp->phydev; 1377 struct phy_device *phydev = mdp->phydev;
1374 int new_state = 0; 1378 int new_state = 0;
1375 1379
1376 if (phydev->link != PHY_DOWN) { 1380 if (phydev->link) {
1377 if (phydev->duplex != mdp->duplex) { 1381 if (phydev->duplex != mdp->duplex) {
1378 new_state = 1; 1382 new_state = 1;
1379 mdp->duplex = phydev->duplex; 1383 mdp->duplex = phydev->duplex;
@@ -1387,17 +1391,21 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1387 if (mdp->cd->set_rate) 1391 if (mdp->cd->set_rate)
1388 mdp->cd->set_rate(ndev); 1392 mdp->cd->set_rate(ndev);
1389 } 1393 }
1390 if (mdp->link == PHY_DOWN) { 1394 if (!mdp->link) {
1391 sh_eth_write(ndev, 1395 sh_eth_write(ndev,
1392 (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); 1396 (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
1393 new_state = 1; 1397 new_state = 1;
1394 mdp->link = phydev->link; 1398 mdp->link = phydev->link;
1399 if (mdp->cd->no_psr || mdp->no_ether_link)
1400 sh_eth_rcv_snd_enable(ndev);
1395 } 1401 }
1396 } else if (mdp->link) { 1402 } else if (mdp->link) {
1397 new_state = 1; 1403 new_state = 1;
1398 mdp->link = PHY_DOWN; 1404 mdp->link = 0;
1399 mdp->speed = 0; 1405 mdp->speed = 0;
1400 mdp->duplex = -1; 1406 mdp->duplex = -1;
1407 if (mdp->cd->no_psr || mdp->no_ether_link)
1408 sh_eth_rcv_snd_disable(ndev);
1401 } 1409 }
1402 1410
1403 if (new_state && netif_msg_link(mdp)) 1411 if (new_state && netif_msg_link(mdp))
@@ -1414,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
1414 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, 1422 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
1415 mdp->mii_bus->id , mdp->phy_id); 1423 mdp->mii_bus->id , mdp->phy_id);
1416 1424
1417 mdp->link = PHY_DOWN; 1425 mdp->link = 0;
1418 mdp->speed = 0; 1426 mdp->speed = 0;
1419 mdp->duplex = -1; 1427 mdp->duplex = -1;
1420 1428
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index e6655678458e..828be4515008 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -723,7 +723,7 @@ struct sh_eth_private {
723 u32 phy_id; /* PHY ID */ 723 u32 phy_id; /* PHY ID */
724 struct mii_bus *mii_bus; /* MDIO bus control */ 724 struct mii_bus *mii_bus; /* MDIO bus control */
725 struct phy_device *phydev; /* PHY device control */ 725 struct phy_device *phydev; /* PHY device control */
726 enum phy_state link; 726 int link;
727 phy_interface_t phy_interface; 727 phy_interface_t phy_interface;
728 int msg_enable; 728 int msg_enable;
729 int speed; 729 int speed;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index df32a090d08e..80cad06e5eb2 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -436,7 +436,7 @@ void cpsw_tx_handler(void *token, int len, int status)
436 * queue is stopped then start the queue as we have free desc for tx 436 * queue is stopped then start the queue as we have free desc for tx
437 */ 437 */
438 if (unlikely(netif_queue_stopped(ndev))) 438 if (unlikely(netif_queue_stopped(ndev)))
439 netif_start_queue(ndev); 439 netif_wake_queue(ndev);
440 cpts_tx_timestamp(priv->cpts, skb); 440 cpts_tx_timestamp(priv->cpts, skb);
441 priv->stats.tx_packets++; 441 priv->stats.tx_packets++;
442 priv->stats.tx_bytes += len; 442 priv->stats.tx_bytes += len;
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index ae1b77aa199f..72300bc9e378 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1053,7 +1053,7 @@ static void emac_tx_handler(void *token, int len, int status)
1053 * queue is stopped then start the queue as we have free desc for tx 1053 * queue is stopped then start the queue as we have free desc for tx
1054 */ 1054 */
1055 if (unlikely(netif_queue_stopped(ndev))) 1055 if (unlikely(netif_queue_stopped(ndev)))
1056 netif_start_queue(ndev); 1056 netif_wake_queue(ndev);
1057 ndev->stats.tx_packets++; 1057 ndev->stats.tx_packets++;
1058 ndev->stats.tx_bytes += len; 1058 ndev->stats.tx_bytes += len;
1059 dev_kfree_skb_any(skb); 1059 dev_kfree_skb_any(skb);
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 9abe51710f22..1a15ec14c386 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -914,8 +914,12 @@ static int smsc75xx_set_rx_max_frame_length(struct usbnet *dev, int size)
914static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) 914static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu)
915{ 915{
916 struct usbnet *dev = netdev_priv(netdev); 916 struct usbnet *dev = netdev_priv(netdev);
917 int ret;
918
919 if (new_mtu > MAX_SINGLE_PACKET_SIZE)
920 return -EINVAL;
917 921
918 int ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu); 922 ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN);
919 if (ret < 0) { 923 if (ret < 0) {
920 netdev_warn(dev->net, "Failed to set mac rx frame length\n"); 924 netdev_warn(dev->net, "Failed to set mac rx frame length\n");
921 return ret; 925 return ret;
@@ -1324,7 +1328,7 @@ static int smsc75xx_reset(struct usbnet *dev)
1324 1328
1325 netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); 1329 netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf);
1326 1330
1327 ret = smsc75xx_set_rx_max_frame_length(dev, 1514); 1331 ret = smsc75xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN);
1328 if (ret < 0) { 1332 if (ret < 0) {
1329 netdev_warn(dev->net, "Failed to set max rx frame length\n"); 1333 netdev_warn(dev->net, "Failed to set max rx frame length\n");
1330 return ret; 1334 return ret;
@@ -2134,8 +2138,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
2134 else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) 2138 else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT))
2135 dev->net->stats.rx_frame_errors++; 2139 dev->net->stats.rx_frame_errors++;
2136 } else { 2140 } else {
2137 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ 2141 /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */
2138 if (unlikely(size > (ETH_FRAME_LEN + 12))) { 2142 if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) {
2139 netif_dbg(dev, rx_err, dev->net, 2143 netif_dbg(dev, rx_err, dev->net,
2140 "size err rx_cmd_a=0x%08x\n", 2144 "size err rx_cmd_a=0x%08x\n",
2141 rx_cmd_a); 2145 rx_cmd_a);
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index 39c84ecf6a42..7fdac6c7b3ea 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -170,7 +170,8 @@ void ath_rx_poll(unsigned long data)
170{ 170{
171 struct ath_softc *sc = (struct ath_softc *)data; 171 struct ath_softc *sc = (struct ath_softc *)data;
172 172
173 ieee80211_queue_work(sc->hw, &sc->hw_check_work); 173 if (!test_bit(SC_OP_INVALID, &sc->sc_flags))
174 ieee80211_queue_work(sc->hw, &sc->hw_check_work);
174} 175}
175 176
176/* 177/*
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 38bc5a7997ff..122146943bf2 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1487,8 +1487,12 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1487 const struct b43_dma_ops *ops; 1487 const struct b43_dma_ops *ops;
1488 struct b43_dmaring *ring; 1488 struct b43_dmaring *ring;
1489 struct b43_dmadesc_meta *meta; 1489 struct b43_dmadesc_meta *meta;
1490 static const struct b43_txstatus fake; /* filled with 0 */
1491 const struct b43_txstatus *txstat;
1490 int slot, firstused; 1492 int slot, firstused;
1491 bool frame_succeed; 1493 bool frame_succeed;
1494 int skip;
1495 static u8 err_out1, err_out2;
1492 1496
1493 ring = parse_cookie(dev, status->cookie, &slot); 1497 ring = parse_cookie(dev, status->cookie, &slot);
1494 if (unlikely(!ring)) 1498 if (unlikely(!ring))
@@ -1501,13 +1505,36 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1501 firstused = ring->current_slot - ring->used_slots + 1; 1505 firstused = ring->current_slot - ring->used_slots + 1;
1502 if (firstused < 0) 1506 if (firstused < 0)
1503 firstused = ring->nr_slots + firstused; 1507 firstused = ring->nr_slots + firstused;
1508
1509 skip = 0;
1504 if (unlikely(slot != firstused)) { 1510 if (unlikely(slot != firstused)) {
1505 /* This possibly is a firmware bug and will result in 1511 /* This possibly is a firmware bug and will result in
1506 * malfunction, memory leaks and/or stall of DMA functionality. */ 1512 * malfunction, memory leaks and/or stall of DMA functionality.
1507 b43dbg(dev->wl, "Out of order TX status report on DMA ring %d. " 1513 */
1508 "Expected %d, but got %d\n", 1514 if (slot == next_slot(ring, next_slot(ring, firstused))) {
1509 ring->index, firstused, slot); 1515 /* If a single header/data pair was missed, skip over
1510 return; 1516 * the first two slots in an attempt to recover.
1517 */
1518 slot = firstused;
1519 skip = 2;
1520 if (!err_out1) {
1521 /* Report the error once. */
1522 b43dbg(dev->wl,
1523 "Skip on DMA ring %d slot %d.\n",
1524 ring->index, slot);
1525 err_out1 = 1;
1526 }
1527 } else {
1528 /* More than a single header/data pair were missed.
1529 * Report this error once.
1530 */
1531 if (!err_out2)
1532 b43dbg(dev->wl,
1533 "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n",
1534 ring->index, firstused, slot);
1535 err_out2 = 1;
1536 return;
1537 }
1511 } 1538 }
1512 1539
1513 ops = ring->ops; 1540 ops = ring->ops;
@@ -1522,11 +1549,13 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1522 slot, firstused, ring->index); 1549 slot, firstused, ring->index);
1523 break; 1550 break;
1524 } 1551 }
1552
1525 if (meta->skb) { 1553 if (meta->skb) {
1526 struct b43_private_tx_info *priv_info = 1554 struct b43_private_tx_info *priv_info =
1527 b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); 1555 b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb));
1528 1556
1529 unmap_descbuffer(ring, meta->dmaaddr, meta->skb->len, 1); 1557 unmap_descbuffer(ring, meta->dmaaddr,
1558 meta->skb->len, 1);
1530 kfree(priv_info->bouncebuffer); 1559 kfree(priv_info->bouncebuffer);
1531 priv_info->bouncebuffer = NULL; 1560 priv_info->bouncebuffer = NULL;
1532 } else { 1561 } else {
@@ -1538,8 +1567,9 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1538 struct ieee80211_tx_info *info; 1567 struct ieee80211_tx_info *info;
1539 1568
1540 if (unlikely(!meta->skb)) { 1569 if (unlikely(!meta->skb)) {
1541 /* This is a scatter-gather fragment of a frame, so 1570 /* This is a scatter-gather fragment of a frame,
1542 * the skb pointer must not be NULL. */ 1571 * so the skb pointer must not be NULL.
1572 */
1543 b43dbg(dev->wl, "TX status unexpected NULL skb " 1573 b43dbg(dev->wl, "TX status unexpected NULL skb "
1544 "at slot %d (first=%d) on ring %d\n", 1574 "at slot %d (first=%d) on ring %d\n",
1545 slot, firstused, ring->index); 1575 slot, firstused, ring->index);
@@ -1550,9 +1580,18 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1550 1580
1551 /* 1581 /*
1552 * Call back to inform the ieee80211 subsystem about 1582 * Call back to inform the ieee80211 subsystem about
1553 * the status of the transmission. 1583 * the status of the transmission. When skipping over
1584 * a missed TX status report, use a status structure
1585 * filled with zeros to indicate that the frame was not
1586 * sent (frame_count 0) and not acknowledged
1554 */ 1587 */
1555 frame_succeed = b43_fill_txstatus_report(dev, info, status); 1588 if (unlikely(skip))
1589 txstat = &fake;
1590 else
1591 txstat = status;
1592
1593 frame_succeed = b43_fill_txstatus_report(dev, info,
1594 txstat);
1556#ifdef CONFIG_B43_DEBUG 1595#ifdef CONFIG_B43_DEBUG
1557 if (frame_succeed) 1596 if (frame_succeed)
1558 ring->nr_succeed_tx_packets++; 1597 ring->nr_succeed_tx_packets++;
@@ -1580,12 +1619,14 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1580 /* Everything unmapped and free'd. So it's not used anymore. */ 1619 /* Everything unmapped and free'd. So it's not used anymore. */
1581 ring->used_slots--; 1620 ring->used_slots--;
1582 1621
1583 if (meta->is_last_fragment) { 1622 if (meta->is_last_fragment && !skip) {
1584 /* This is the last scatter-gather 1623 /* This is the last scatter-gather
1585 * fragment of the frame. We are done. */ 1624 * fragment of the frame. We are done. */
1586 break; 1625 break;
1587 } 1626 }
1588 slot = next_slot(ring, slot); 1627 slot = next_slot(ring, slot);
1628 if (skip > 0)
1629 --skip;
1589 } 1630 }
1590 if (ring->stopped) { 1631 if (ring->stopped) {
1591 B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); 1632 B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME);
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 3c35382ee6c2..e8486c1e091a 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1564,7 +1564,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1564 u16 clip_off[2] = { 0xFFFF, 0xFFFF }; 1564 u16 clip_off[2] = { 0xFFFF, 0xFFFF };
1565 1565
1566 u8 vcm_final = 0; 1566 u8 vcm_final = 0;
1567 s8 offset[4]; 1567 s32 offset[4];
1568 s32 results[8][4] = { }; 1568 s32 results[8][4] = { };
1569 s32 results_min[4] = { }; 1569 s32 results_min[4] = { };
1570 s32 poll_results[4] = { }; 1570 s32 poll_results[4] = { };
@@ -1615,7 +1615,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1615 } 1615 }
1616 for (i = 0; i < 4; i += 2) { 1616 for (i = 0; i < 4; i += 2) {
1617 s32 curr; 1617 s32 curr;
1618 s32 mind = 40; 1618 s32 mind = 0x100000;
1619 s32 minpoll = 249; 1619 s32 minpoll = 249;
1620 u8 minvcm = 0; 1620 u8 minvcm = 0;
1621 if (2 * core != i) 1621 if (2 * core != i)
@@ -1732,7 +1732,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1732 u8 regs_save_radio[2]; 1732 u8 regs_save_radio[2];
1733 u16 regs_save_phy[2]; 1733 u16 regs_save_phy[2];
1734 1734
1735 s8 offset[4]; 1735 s32 offset[4];
1736 u8 core; 1736 u8 core;
1737 u8 rail; 1737 u8 rail;
1738 1738
@@ -1799,7 +1799,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1799 } 1799 }
1800 1800
1801 for (i = 0; i < 4; i++) { 1801 for (i = 0; i < 4; i++) {
1802 s32 mind = 40; 1802 s32 mind = 0x100000;
1803 u8 minvcm = 0; 1803 u8 minvcm = 0;
1804 s32 minpoll = 249; 1804 s32 minpoll = 249;
1805 s32 curr; 1805 s32 curr;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 21a824232478..18d37645e2cd 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
1137 gain0_15 = ((biq1 & 0xf) << 12) | 1137 gain0_15 = ((biq1 & 0xf) << 12) |
1138 ((tia & 0xf) << 8) | 1138 ((tia & 0xf) << 8) |
1139 ((lna2 & 0x3) << 6) | 1139 ((lna2 & 0x3) << 6) |
1140 ((lna2 & 0x3) << 4) | 1140 ((lna2 &
1141 ((lna1 & 0x3) << 2) | 1141 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0);
1142 ((lna1 & 0x3) << 0);
1143 1142
1144 mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); 1143 mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0);
1145 mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); 1144 mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0);
@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
1157 } 1156 }
1158 1157
1159 mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); 1158 mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0);
1160 mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11);
1161 mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3);
1162 1159
1163} 1160}
1164 1161
@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples)
1331 return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; 1328 return (iq_est.i_pwr + iq_est.q_pwr) / nsamples;
1332} 1329}
1333 1330
1334static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain,
1335 u16 tia_gain, u16 lna2_gain)
1336{
1337 u32 i_thresh_l, q_thresh_l;
1338 u32 i_thresh_h, q_thresh_h;
1339 struct lcnphy_iq_est iq_est_h, iq_est_l;
1340
1341 wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain,
1342 lna2_gain, 0);
1343
1344 wlc_lcnphy_rx_gain_override_enable(pi, true);
1345 wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0);
1346 udelay(500);
1347 write_radio_reg(pi, RADIO_2064_REG112, 0);
1348 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l))
1349 return false;
1350
1351 wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0);
1352 udelay(500);
1353 write_radio_reg(pi, RADIO_2064_REG112, 0);
1354 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h))
1355 return false;
1356
1357 i_thresh_l = (iq_est_l.i_pwr << 1);
1358 i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr;
1359
1360 q_thresh_l = (iq_est_l.q_pwr << 1);
1361 q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr;
1362 if ((iq_est_h.i_pwr > i_thresh_l) &&
1363 (iq_est_h.i_pwr < i_thresh_h) &&
1364 (iq_est_h.q_pwr > q_thresh_l) &&
1365 (iq_est_h.q_pwr < q_thresh_h))
1366 return true;
1367
1368 return false;
1369}
1370
1371static bool 1331static bool
1372wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, 1332wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
1373 const struct lcnphy_rx_iqcomp *iqcomp, 1333 const struct lcnphy_rx_iqcomp *iqcomp,
@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
1382 RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, 1342 RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old,
1383 rfoverride3_old, rfoverride3val_old, rfoverride4_old, 1343 rfoverride3_old, rfoverride3val_old, rfoverride4_old,
1384 rfoverride4val_old, afectrlovr_old, afectrlovrval_old; 1344 rfoverride4val_old, afectrlovr_old, afectrlovrval_old;
1385 int tia_gain, lna2_gain, biq1_gain; 1345 int tia_gain;
1386 bool set_gain; 1346 u32 received_power, rx_pwr_threshold;
1387 u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; 1347 u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl;
1388 u16 values_to_save[11]; 1348 u16 values_to_save[11];
1389 s16 *ptr; 1349 s16 *ptr;
@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
1408 goto cal_done; 1368 goto cal_done;
1409 } 1369 }
1410 1370
1411 WARN_ON(module != 1); 1371 if (module == 1) {
1412 tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
1413 wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
1414
1415 for (i = 0; i < 11; i++)
1416 values_to_save[i] =
1417 read_radio_reg(pi, rxiq_cal_rf_reg[i]);
1418 Core1TxControl_old = read_phy_reg(pi, 0x631);
1419
1420 or_phy_reg(pi, 0x631, 0x0015);
1421
1422 RFOverride0_old = read_phy_reg(pi, 0x44c);
1423 RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
1424 rfoverride2_old = read_phy_reg(pi, 0x4b0);
1425 rfoverride2val_old = read_phy_reg(pi, 0x4b1);
1426 rfoverride3_old = read_phy_reg(pi, 0x4f9);
1427 rfoverride3val_old = read_phy_reg(pi, 0x4fa);
1428 rfoverride4_old = read_phy_reg(pi, 0x938);
1429 rfoverride4val_old = read_phy_reg(pi, 0x939);
1430 afectrlovr_old = read_phy_reg(pi, 0x43b);
1431 afectrlovrval_old = read_phy_reg(pi, 0x43c);
1432 old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
1433 old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
1434
1435 tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
1436 if (tx_gain_override_old) {
1437 wlc_lcnphy_get_tx_gain(pi, &old_gains);
1438 tx_gain_index_old = pi_lcn->lcnphy_current_index;
1439 }
1440
1441 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
1442 1372
1443 mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); 1373 tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
1444 mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); 1374 wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
1445 1375
1446 mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); 1376 for (i = 0; i < 11; i++)
1447 mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); 1377 values_to_save[i] =
1378 read_radio_reg(pi, rxiq_cal_rf_reg[i]);
1379 Core1TxControl_old = read_phy_reg(pi, 0x631);
1380
1381 or_phy_reg(pi, 0x631, 0x0015);
1382
1383 RFOverride0_old = read_phy_reg(pi, 0x44c);
1384 RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
1385 rfoverride2_old = read_phy_reg(pi, 0x4b0);
1386 rfoverride2val_old = read_phy_reg(pi, 0x4b1);
1387 rfoverride3_old = read_phy_reg(pi, 0x4f9);
1388 rfoverride3val_old = read_phy_reg(pi, 0x4fa);
1389 rfoverride4_old = read_phy_reg(pi, 0x938);
1390 rfoverride4val_old = read_phy_reg(pi, 0x939);
1391 afectrlovr_old = read_phy_reg(pi, 0x43b);
1392 afectrlovrval_old = read_phy_reg(pi, 0x43c);
1393 old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
1394 old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
1395
1396 tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
1397 if (tx_gain_override_old) {
1398 wlc_lcnphy_get_tx_gain(pi, &old_gains);
1399 tx_gain_index_old = pi_lcn->lcnphy_current_index;
1400 }
1448 1401
1449 write_radio_reg(pi, RADIO_2064_REG116, 0x06); 1402 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
1450 write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
1451 write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
1452 write_radio_reg(pi, RADIO_2064_REG098, 0x03);
1453 write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
1454 mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
1455 write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
1456 write_radio_reg(pi, RADIO_2064_REG114, 0x01);
1457 write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
1458 write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
1459
1460 mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
1461 mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
1462 mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
1463 mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
1464 mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
1465 mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
1466 mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
1467 mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
1468 mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
1469 mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
1470 1403
1471 mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); 1404 mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0);
1472 mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); 1405 mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0);
1473 1406
1474 write_phy_reg(pi, 0x6da, 0xffff); 1407 mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1);
1475 or_phy_reg(pi, 0x6db, 0x3); 1408 mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1);
1476 1409
1477 wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); 1410 write_radio_reg(pi, RADIO_2064_REG116, 0x06);
1478 set_gain = false; 1411 write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
1479 1412 write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
1480 lna2_gain = 3; 1413 write_radio_reg(pi, RADIO_2064_REG098, 0x03);
1481 while ((lna2_gain >= 0) && !set_gain) { 1414 write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
1482 tia_gain = 4; 1415 mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
1483 1416 write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
1484 while ((tia_gain >= 0) && !set_gain) { 1417 write_radio_reg(pi, RADIO_2064_REG114, 0x01);
1485 biq1_gain = 6; 1418 write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
1486 1419 write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
1487 while ((biq1_gain >= 0) && !set_gain) { 1420
1488 set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, 1421 mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
1489 (u16) 1422 mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
1490 biq1_gain, 1423 mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
1491 (u16) 1424 mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
1492 tia_gain, 1425 mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
1493 (u16) 1426 mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
1494 lna2_gain); 1427 mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
1495 biq1_gain -= 1; 1428 mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
1496 } 1429 mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
1430 mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
1431
1432 mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0);
1433 mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0);
1434
1435 wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0);
1436 write_phy_reg(pi, 0x6da, 0xffff);
1437 or_phy_reg(pi, 0x6db, 0x3);
1438 wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch);
1439 wlc_lcnphy_rx_gain_override_enable(pi, true);
1440
1441 tia_gain = 8;
1442 rx_pwr_threshold = 950;
1443 while (tia_gain > 0) {
1497 tia_gain -= 1; 1444 tia_gain -= 1;
1445 wlc_lcnphy_set_rx_gain_by_distribution(pi,
1446 0, 0, 2, 2,
1447 (u16)
1448 tia_gain, 1, 0);
1449 udelay(500);
1450
1451 received_power =
1452 wlc_lcnphy_measure_digital_power(pi, 2000);
1453 if (received_power < rx_pwr_threshold)
1454 break;
1498 } 1455 }
1499 lna2_gain -= 1; 1456 result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff);
1500 }
1501 1457
1502 if (set_gain) 1458 wlc_lcnphy_stop_tx_tone(pi);
1503 result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024);
1504 else
1505 result = false;
1506 1459
1507 wlc_lcnphy_stop_tx_tone(pi); 1460 write_phy_reg(pi, 0x631, Core1TxControl_old);
1508 1461
1509 write_phy_reg(pi, 0x631, Core1TxControl_old); 1462 write_phy_reg(pi, 0x44c, RFOverrideVal0_old);
1510 1463 write_phy_reg(pi, 0x44d, RFOverrideVal0_old);
1511 write_phy_reg(pi, 0x44c, RFOverrideVal0_old); 1464 write_phy_reg(pi, 0x4b0, rfoverride2_old);
1512 write_phy_reg(pi, 0x44d, RFOverrideVal0_old); 1465 write_phy_reg(pi, 0x4b1, rfoverride2val_old);
1513 write_phy_reg(pi, 0x4b0, rfoverride2_old); 1466 write_phy_reg(pi, 0x4f9, rfoverride3_old);
1514 write_phy_reg(pi, 0x4b1, rfoverride2val_old); 1467 write_phy_reg(pi, 0x4fa, rfoverride3val_old);
1515 write_phy_reg(pi, 0x4f9, rfoverride3_old); 1468 write_phy_reg(pi, 0x938, rfoverride4_old);
1516 write_phy_reg(pi, 0x4fa, rfoverride3val_old); 1469 write_phy_reg(pi, 0x939, rfoverride4val_old);
1517 write_phy_reg(pi, 0x938, rfoverride4_old); 1470 write_phy_reg(pi, 0x43b, afectrlovr_old);
1518 write_phy_reg(pi, 0x939, rfoverride4val_old); 1471 write_phy_reg(pi, 0x43c, afectrlovrval_old);
1519 write_phy_reg(pi, 0x43b, afectrlovr_old); 1472 write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
1520 write_phy_reg(pi, 0x43c, afectrlovrval_old); 1473 write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
1521 write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
1522 write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
1523 1474
1524 wlc_lcnphy_clear_trsw_override(pi); 1475 wlc_lcnphy_clear_trsw_override(pi);
1525 1476
1526 mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); 1477 mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
1527 1478
1528 for (i = 0; i < 11; i++) 1479 for (i = 0; i < 11; i++)
1529 write_radio_reg(pi, rxiq_cal_rf_reg[i], 1480 write_radio_reg(pi, rxiq_cal_rf_reg[i],
1530 values_to_save[i]); 1481 values_to_save[i]);
1531 1482
1532 if (tx_gain_override_old) 1483 if (tx_gain_override_old)
1533 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); 1484 wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
1534 else 1485 else
1535 wlc_lcnphy_disable_tx_gain_override(pi); 1486 wlc_lcnphy_disable_tx_gain_override(pi);
1536 1487
1537 wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); 1488 wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
1538 wlc_lcnphy_rx_gain_override_enable(pi, false); 1489 wlc_lcnphy_rx_gain_override_enable(pi, false);
1490 }
1539 1491
1540cal_done: 1492cal_done:
1541 kfree(ptr); 1493 kfree(ptr);
@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
1829 write_radio_reg(pi, RADIO_2064_REG038, 3); 1781 write_radio_reg(pi, RADIO_2064_REG038, 3);
1830 write_radio_reg(pi, RADIO_2064_REG091, 7); 1782 write_radio_reg(pi, RADIO_2064_REG091, 7);
1831 } 1783 }
1832
1833 if (!(pi->sh->boardflags & BFL_FEM)) {
1834 u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc,
1835 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0};
1836
1837 write_radio_reg(pi, RADIO_2064_REG02A, 0xf);
1838 write_radio_reg(pi, RADIO_2064_REG091, 0x3);
1839 write_radio_reg(pi, RADIO_2064_REG038, 0x3);
1840
1841 write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]);
1842 }
1843} 1784}
1844 1785
1845static int 1786static int
@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos)
2034 } else { 1975 } else {
2035 mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); 1976 mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1);
2036 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); 1977 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
2037 mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0);
2038 mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2);
2039 mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0);
2040 mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4);
2041 mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
2042 mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77);
2043 mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1);
2044 mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7);
2045 mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1);
2046 mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4);
2047 } 1978 }
2048 } else { 1979 } else {
2049 mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); 1980 mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2);
@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi)
2130 (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); 2061 (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12));
2131 2062
2132 mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); 2063 mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5));
2133 mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0));
2134} 2064}
2135 2065
2136static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) 2066static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2137{ 2067{
2138 struct phytbl_info tab; 2068 struct phytbl_info tab;
2139 u32 rfseq, ind; 2069 u32 rfseq, ind;
2140 u8 tssi_sel;
2141 2070
2142 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; 2071 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
2143 tab.tbl_width = 32; 2072 tab.tbl_width = 32;
@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2159 2088
2160 mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); 2089 mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4);
2161 2090
2162 if (pi->sh->boardflags & BFL_FEM) { 2091 wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
2163 tssi_sel = 0x1;
2164 wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
2165 } else {
2166 tssi_sel = 0xe;
2167 wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA);
2168 }
2169 mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); 2092 mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14);
2170 2093
2171 mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); 2094 mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15);
@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2201 mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); 2124 mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0);
2202 2125
2203 if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { 2126 if (LCNREV_IS(pi->pubpi.phy_rev, 2)) {
2204 mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); 2127 mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe);
2205 mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); 2128 mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4);
2206 } else { 2129 } else {
2207 mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1);
2208 mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); 2130 mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1);
2209 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); 2131 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3);
2210 } 2132 }
@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
2251 2173
2252 mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); 2174 mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8);
2253 2175
2254 mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0);
2255 mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
2256 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
2257
2258 wlc_lcnphy_pwrctrl_rssiparams(pi); 2176 wlc_lcnphy_pwrctrl_rssiparams(pi);
2259} 2177}
2260 2178
@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
2873 read_radio_reg(pi, RADIO_2064_REG007) & 1; 2791 read_radio_reg(pi, RADIO_2064_REG007) & 1;
2874 u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; 2792 u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10;
2875 u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; 2793 u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4;
2876 u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi);
2877
2878 idleTssi = read_phy_reg(pi, 0x4ab); 2794 idleTssi = read_phy_reg(pi, 0x4ab);
2879 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & 2795 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) &
2880 MCTL_EN_MAC)); 2796 MCTL_EN_MAC));
@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
2892 mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); 2808 mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4);
2893 mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); 2809 mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2);
2894 wlc_lcnphy_tssi_setup(pi); 2810 wlc_lcnphy_tssi_setup(pi);
2895
2896 mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0));
2897 mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6));
2898
2899 wlc_lcnphy_set_bbmult(pi, 0x0);
2900
2901 wlc_phy_do_dummy_tx(pi, true, OFF); 2811 wlc_phy_do_dummy_tx(pi, true, OFF);
2902 idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) 2812 idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0))
2903 >> 0); 2813 >> 0);
@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
2919 2829
2920 mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); 2830 mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12);
2921 2831
2922 wlc_lcnphy_set_bbmult(pi, SAVE_bbmult);
2923 wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); 2832 wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old);
2924 wlc_lcnphy_set_tx_gain(pi, &old_gains); 2833 wlc_lcnphy_set_tx_gain(pi, &old_gains);
2925 wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); 2834 wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl);
@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi)
3133 wlc_lcnphy_write_table(pi, &tab); 3042 wlc_lcnphy_write_table(pi, &tab);
3134 tab.tbl_offset++; 3043 tab.tbl_offset++;
3135 } 3044 }
3136 mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0);
3137 mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0);
3138 mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8);
3139 mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4);
3140 mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2);
3141 3045
3142 mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); 3046 mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7);
3143 3047
@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
3939 target_gains.pad_gain = 21; 3843 target_gains.pad_gain = 21;
3940 target_gains.dac_gain = 0; 3844 target_gains.dac_gain = 0;
3941 wlc_lcnphy_set_tx_gain(pi, &target_gains); 3845 wlc_lcnphy_set_tx_gain(pi, &target_gains);
3846 wlc_lcnphy_set_tx_pwr_by_index(pi, 16);
3942 3847
3943 if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { 3848 if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) {
3944 3849
@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
3949 lcnphy_recal ? LCNPHY_CAL_RECAL : 3854 lcnphy_recal ? LCNPHY_CAL_RECAL :
3950 LCNPHY_CAL_FULL), false); 3855 LCNPHY_CAL_FULL), false);
3951 } else { 3856 } else {
3952 wlc_lcnphy_set_tx_pwr_by_index(pi, 16);
3953 wlc_lcnphy_tx_iqlo_soft_cal_full(pi); 3857 wlc_lcnphy_tx_iqlo_soft_cal_full(pi);
3954 } 3858 }
3955 3859
@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi,
4374 if (CHSPEC_IS5G(pi->radio_chanspec)) 4278 if (CHSPEC_IS5G(pi->radio_chanspec))
4375 pa_gain = 0x70; 4279 pa_gain = 0x70;
4376 else 4280 else
4377 pa_gain = 0x60; 4281 pa_gain = 0x70;
4378 4282
4379 if (pi->sh->boardflags & BFL_FEM) 4283 if (pi->sh->boardflags & BFL_FEM)
4380 pa_gain = 0x10; 4284 pa_gain = 0x10;
4381
4382 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; 4285 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
4383 tab.tbl_width = 32; 4286 tab.tbl_width = 32;
4384 tab.tbl_len = 1; 4287 tab.tbl_len = 1;
4385 tab.tbl_ptr = &val; 4288 tab.tbl_ptr = &val;
4386 4289
4387 for (j = 0; j < 128; j++) { 4290 for (j = 0; j < 128; j++) {
4388 if (pi->sh->boardflags & BFL_FEM) 4291 gm_gain = gain_table[j].gm;
4389 gm_gain = gain_table[j].gm;
4390 else
4391 gm_gain = 15;
4392
4393 val = (((u32) pa_gain << 24) | 4292 val = (((u32) pa_gain << 24) |
4394 (gain_table[j].pad << 16) | 4293 (gain_table[j].pad << 16) |
4395 (gain_table[j].pga << 8) | gm_gain); 4294 (gain_table[j].pga << 8) | gm_gain);
@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
4600 4499
4601 write_phy_reg(pi, 0x4ea, 0x4688); 4500 write_phy_reg(pi, 0x4ea, 0x4688);
4602 4501
4603 if (pi->sh->boardflags & BFL_FEM) 4502 mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
4604 mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
4605 else
4606 mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0);
4607 4503
4608 mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); 4504 mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6);
4609 4505
@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
4614 wlc_lcnphy_rcal(pi); 4510 wlc_lcnphy_rcal(pi);
4615 4511
4616 wlc_lcnphy_rc_cal(pi); 4512 wlc_lcnphy_rc_cal(pi);
4617
4618 if (!(pi->sh->boardflags & BFL_FEM)) {
4619 write_radio_reg(pi, RADIO_2064_REG032, 0x6f);
4620 write_radio_reg(pi, RADIO_2064_REG033, 0x19);
4621 write_radio_reg(pi, RADIO_2064_REG039, 0xe);
4622 }
4623
4624} 4513}
4625 4514
4626static void wlc_lcnphy_radio_init(struct brcms_phy *pi) 4515static void wlc_lcnphy_radio_init(struct brcms_phy *pi)
@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi)
4650 wlc_lcnphy_write_table(pi, &tab); 4539 wlc_lcnphy_write_table(pi, &tab);
4651 } 4540 }
4652 4541
4653 if (!(pi->sh->boardflags & BFL_FEM)) { 4542 tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
4654 tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; 4543 tab.tbl_width = 16;
4655 tab.tbl_width = 16; 4544 tab.tbl_ptr = &val;
4656 tab.tbl_ptr = &val; 4545 tab.tbl_len = 1;
4657 tab.tbl_len = 1;
4658 4546
4659 val = 150; 4547 val = 114;
4660 tab.tbl_offset = 0; 4548 tab.tbl_offset = 0;
4661 wlc_lcnphy_write_table(pi, &tab); 4549 wlc_lcnphy_write_table(pi, &tab);
4662 4550
4663 val = 220; 4551 val = 130;
4664 tab.tbl_offset = 1; 4552 tab.tbl_offset = 1;
4665 wlc_lcnphy_write_table(pi, &tab); 4553 wlc_lcnphy_write_table(pi, &tab);
4666 } 4554
4555 val = 6;
4556 tab.tbl_offset = 8;
4557 wlc_lcnphy_write_table(pi, &tab);
4667 4558
4668 if (CHSPEC_IS2G(pi->radio_chanspec)) { 4559 if (CHSPEC_IS2G(pi->radio_chanspec)) {
4669 if (pi->sh->boardflags & BFL_FEM) 4560 if (pi->sh->boardflags & BFL_FEM)
@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec)
5055 wlc_lcnphy_load_tx_iir_filter(pi, true, 3); 4946 wlc_lcnphy_load_tx_iir_filter(pi, true, 3);
5056 4947
5057 mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); 4948 mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3);
5058 wlc_lcnphy_tssi_setup(pi);
5059} 4949}
5060 4950
5061void wlc_phy_detach_lcnphy(struct brcms_phy *pi) 4951void wlc_phy_detach_lcnphy(struct brcms_phy *pi)
@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
5094 if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) 4984 if (!wlc_phy_txpwr_srom_read_lcnphy(pi))
5095 return false; 4985 return false;
5096 4986
5097 if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { 4987 if ((pi->sh->boardflags & BFL_FEM) &&
4988 (LCNREV_IS(pi->pubpi.phy_rev, 1))) {
5098 if (pi_lcn->lcnphy_tempsense_option == 3) { 4989 if (pi_lcn->lcnphy_tempsense_option == 3) {
5099 pi->hwpwrctrl = true; 4990 pi->hwpwrctrl = true;
5100 pi->hwpwrctrl_capable = true; 4991 pi->hwpwrctrl_capable = true;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
index b7e95acc2084..622c01ca72c5 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
@@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = {
1992}; 1992};
1993 1993
1994static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { 1994static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = {
1995 0x0009,
1996 0x000a, 1995 0x000a,
1997 0x0005,
1998 0x0006,
1999 0x0009, 1996 0x0009,
2000 0x000a,
2001 0x0005,
2002 0x0006, 1997 0x0006,
2003 0x0009,
2004 0x000a,
2005 0x0005, 1998 0x0005,
2006 0x0006,
2007 0x0009,
2008 0x000a, 1999 0x000a,
2009 0x0005,
2010 0x0006,
2011 0x0009, 2000 0x0009,
2012 0x000a,
2013 0x0005,
2014 0x0006, 2001 0x0006,
2015 0x0009,
2016 0x000a,
2017 0x0005, 2002 0x0005,
2018 0x0006,
2019 0x0009,
2020 0x000a, 2003 0x000a,
2021 0x0005,
2022 0x0006,
2023 0x0009, 2004 0x0009,
2024 0x000a,
2025 0x0005,
2026 0x0006, 2005 0x0006,
2027 0x0009,
2028 0x000a,
2029 0x0005, 2006 0x0005,
2030 0x0006,
2031 0x0009,
2032 0x000a, 2007 0x000a,
2033 0x0005,
2034 0x0006,
2035 0x0009, 2008 0x0009,
2036 0x000a,
2037 0x0005,
2038 0x0006, 2009 0x0006,
2039 0x0009,
2040 0x000a,
2041 0x0005, 2010 0x0005,
2042 0x0006, 2011 0x000a,
2043 0x0009, 2012 0x0009,
2013 0x0006,
2014 0x0005,
2044 0x000a, 2015 0x000a,
2016 0x0009,
2017 0x0006,
2045 0x0005, 2018 0x0005,
2019 0x000a,
2020 0x0009,
2046 0x0006, 2021 0x0006,
2022 0x0005,
2023 0x000a,
2047 0x0009, 2024 0x0009,
2025 0x0006,
2026 0x0005,
2048 0x000a, 2027 0x000a,
2028 0x0009,
2029 0x0006,
2049 0x0005, 2030 0x0005,
2031 0x000a,
2032 0x0009,
2050 0x0006, 2033 0x0006,
2034 0x0005,
2035 0x000a,
2051 0x0009, 2036 0x0009,
2037 0x0006,
2038 0x0005,
2052 0x000a, 2039 0x000a,
2040 0x0009,
2041 0x0006,
2053 0x0005, 2042 0x0005,
2043 0x000a,
2044 0x0009,
2054 0x0006, 2045 0x0006,
2046 0x0005,
2047 0x000a,
2055 0x0009, 2048 0x0009,
2049 0x0006,
2050 0x0005,
2056 0x000a, 2051 0x000a,
2052 0x0009,
2053 0x0006,
2057 0x0005, 2054 0x0005,
2055 0x000a,
2056 0x0009,
2058 0x0006, 2057 0x0006,
2058 0x0005,
2059}; 2059};
2060 2060
2061static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { 2061static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = {
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index e8324b5e5bfe..6c7493c2d698 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2152,7 +2152,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2152 int rate_idx; 2152 int rate_idx;
2153 int i; 2153 int i;
2154 u32 rate; 2154 u32 rate;
2155 u8 use_green = il4965_rs_use_green(il, sta); 2155 u8 use_green;
2156 u8 active_tbl = 0; 2156 u8 active_tbl = 0;
2157 u8 valid_tx_ant; 2157 u8 valid_tx_ant;
2158 struct il_station_priv *sta_priv; 2158 struct il_station_priv *sta_priv;
@@ -2160,6 +2160,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2160 if (!sta || !lq_sta) 2160 if (!sta || !lq_sta)
2161 return; 2161 return;
2162 2162
2163 use_green = il4965_rs_use_green(il, sta);
2163 sta_priv = (void *)sta->drv_priv; 2164 sta_priv = (void *)sta->drv_priv;
2164 2165
2165 i = lq_sta->last_txrate_idx; 2166 i = lq_sta->last_txrate_idx;
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index 86ea5f4c3939..44ca0e57f9f7 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -1262,6 +1262,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1262 } 1262 }
1263 1263
1264 /* 1264 /*
1265 * This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag
1266 * in iwl_down but cancel the workers only later.
1267 */
1268 if (!priv->ucode_loaded) {
1269 IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id);
1270 return -EIO;
1271 }
1272
1273 /*
1265 * Synchronous commands from this op-mode must hold 1274 * Synchronous commands from this op-mode must hold
1266 * the mutex, this ensures we don't try to send two 1275 * the mutex, this ensures we don't try to send two
1267 * (or more) synchronous commands at a time. 1276 * (or more) synchronous commands at a time.
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index 23be948cf162..a82b6b39d4ff 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -1419,6 +1419,14 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1419 1419
1420 mutex_lock(&priv->mutex); 1420 mutex_lock(&priv->mutex);
1421 1421
1422 if (changes & BSS_CHANGED_IDLE && bss_conf->idle) {
1423 /*
1424 * If we go idle, then clearly no "passive-no-rx"
1425 * workaround is needed any more, this is a reset.
1426 */
1427 iwlagn_lift_passive_no_rx(priv);
1428 }
1429
1422 if (unlikely(!iwl_is_ready(priv))) { 1430 if (unlikely(!iwl_is_ready(priv))) {
1423 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 1431 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
1424 mutex_unlock(&priv->mutex); 1432 mutex_unlock(&priv->mutex);
@@ -1450,16 +1458,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1450 priv->timestamp = bss_conf->sync_tsf; 1458 priv->timestamp = bss_conf->sync_tsf;
1451 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 1459 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
1452 } else { 1460 } else {
1453 /*
1454 * If we disassociate while there are pending
1455 * frames, just wake up the queues and let the
1456 * frames "escape" ... This shouldn't really
1457 * be happening to start with, but we should
1458 * not get stuck in this case either since it
1459 * can happen if userspace gets confused.
1460 */
1461 iwlagn_lift_passive_no_rx(priv);
1462
1463 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1461 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1464 1462
1465 if (ctx->ctxid == IWL_RXON_CTX_BSS) 1463 if (ctx->ctxid == IWL_RXON_CTX_BSS)
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index 6aec2df3bb27..d1a670d7b10c 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -1192,7 +1192,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1192 memset(&info->status, 0, sizeof(info->status)); 1192 memset(&info->status, 0, sizeof(info->status));
1193 1193
1194 if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && 1194 if (status == TX_STATUS_FAIL_PASSIVE_NO_RX &&
1195 iwl_is_associated_ctx(ctx) && ctx->vif && 1195 ctx->vif &&
1196 ctx->vif->type == NL80211_IFTYPE_STATION) { 1196 ctx->vif->type == NL80211_IFTYPE_STATION) {
1197 /* block and stop all queues */ 1197 /* block and stop all queues */
1198 priv->passive_no_rx = true; 1198 priv->passive_no_rx = true;
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index 736fe9bb140e..1a4ac9236a44 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
367 return -EIO; 367 return -EIO;
368 } 368 }
369 369
370 priv->ucode_loaded = true;
371
370 if (ucode_type != IWL_UCODE_WOWLAN) { 372 if (ucode_type != IWL_UCODE_WOWLAN) {
371 /* delay a bit to give rfkill time to run */ 373 /* delay a bit to give rfkill time to run */
372 msleep(5); 374 msleep(5);
@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
380 return ret; 382 return ret;
381 } 383 }
382 384
383 priv->ucode_loaded = true;
384
385 return 0; 385 return 0;
386} 386}
387 387
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 17bedc50e753..12c4f31ca8fb 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -475,6 +475,10 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
475 475
476 /* If platform's RF_KILL switch is NOT set to KILL */ 476 /* If platform's RF_KILL switch is NOT set to KILL */
477 hw_rfkill = iwl_is_rfkill_set(trans); 477 hw_rfkill = iwl_is_rfkill_set(trans);
478 if (hw_rfkill)
479 set_bit(STATUS_RFKILL, &trans_pcie->status);
480 else
481 clear_bit(STATUS_RFKILL, &trans_pcie->status);
478 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); 482 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
479 if (hw_rfkill && !run_in_rfkill) 483 if (hw_rfkill && !run_in_rfkill)
480 return -ERFKILL; 484 return -ERFKILL;
@@ -641,6 +645,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
641 645
642static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) 646static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
643{ 647{
648 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
644 bool hw_rfkill; 649 bool hw_rfkill;
645 int err; 650 int err;
646 651
@@ -656,6 +661,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
656 iwl_enable_rfkill_int(trans); 661 iwl_enable_rfkill_int(trans);
657 662
658 hw_rfkill = iwl_is_rfkill_set(trans); 663 hw_rfkill = iwl_is_rfkill_set(trans);
664 if (hw_rfkill)
665 set_bit(STATUS_RFKILL, &trans_pcie->status);
666 else
667 clear_bit(STATUS_RFKILL, &trans_pcie->status);
659 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); 668 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
660 669
661 return 0; 670 return 0;
@@ -694,6 +703,10 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans,
694 * op_mode. 703 * op_mode.
695 */ 704 */
696 hw_rfkill = iwl_is_rfkill_set(trans); 705 hw_rfkill = iwl_is_rfkill_set(trans);
706 if (hw_rfkill)
707 set_bit(STATUS_RFKILL, &trans_pcie->status);
708 else
709 clear_bit(STATUS_RFKILL, &trans_pcie->status);
697 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); 710 iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill);
698 } 711 }
699} 712}
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 8595c16f74de..cb5c6792e3a8 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1264,7 +1264,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
1264 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { 1264 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
1265 int copy = 0; 1265 int copy = 0;
1266 1266
1267 if (!cmd->len) 1267 if (!cmd->len[i])
1268 continue; 1268 continue;
1269 1269
1270 /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ 1270 /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a44023a7bd57..8aaf56ade4d9 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1892,7 +1892,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1892 } 1892 }
1893 } 1893 }
1894 1894
1895 for (i = 0; i < request->n_channels; i++) { 1895 for (i = 0; i < min_t(u32, request->n_channels,
1896 MWIFIEX_USER_SCAN_CHAN_MAX); i++) {
1896 chan = request->channels[i]; 1897 chan = request->channels[i];
1897 priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; 1898 priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
1898 priv->user_scan_cfg->chan_list[i].radio_type = chan->band; 1899 priv->user_scan_cfg->chan_list[i].radio_type = chan->band;
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 5c395e2e6a2b..feb204613397 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -1508,6 +1508,7 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
1508 } 1508 }
1509 memcpy(adapter->upld_buf, skb->data, 1509 memcpy(adapter->upld_buf, skb->data,
1510 min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); 1510 min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len));
1511 skb_push(skb, INTF_HEADER_LEN);
1511 if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, 1512 if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
1512 PCI_DMA_FROMDEVICE)) 1513 PCI_DMA_FROMDEVICE))
1513 return -1; 1514 return -1;
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index eef38cfd812e..ca33ae193935 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -22,7 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/mei_bus.h> 25#include <linux/mei_cl_bus.h>
26 26
27#include <linux/nfc.h> 27#include <linux/nfc.h>
28#include <net/nfc/hci.h> 28#include <net/nfc/hci.h>
@@ -32,9 +32,6 @@
32 32
33#define MICROREAD_DRIVER_NAME "microread" 33#define MICROREAD_DRIVER_NAME "microread"
34 34
35#define MICROREAD_UUID UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50, 0x94, \
36 0xd4, 0x50, 0x26, 0x67, 0x23, 0x77, 0x5c)
37
38struct mei_nfc_hdr { 35struct mei_nfc_hdr {
39 u8 cmd; 36 u8 cmd;
40 u8 status; 37 u8 status;
@@ -48,7 +45,7 @@ struct mei_nfc_hdr {
48#define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) 45#define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD)
49 46
50struct microread_mei_phy { 47struct microread_mei_phy {
51 struct mei_device *mei_device; 48 struct mei_cl_device *device;
52 struct nfc_hci_dev *hdev; 49 struct nfc_hci_dev *hdev;
53 50
54 int powered; 51 int powered;
@@ -105,14 +102,14 @@ static int microread_mei_write(void *phy_id, struct sk_buff *skb)
105 102
106 MEI_DUMP_SKB_OUT("mei frame sent", skb); 103 MEI_DUMP_SKB_OUT("mei frame sent", skb);
107 104
108 r = mei_send(phy->device, skb->data, skb->len); 105 r = mei_cl_send(phy->device, skb->data, skb->len);
109 if (r > 0) 106 if (r > 0)
110 r = 0; 107 r = 0;
111 108
112 return r; 109 return r;
113} 110}
114 111
115static void microread_event_cb(struct mei_device *device, u32 events, 112static void microread_event_cb(struct mei_cl_device *device, u32 events,
116 void *context) 113 void *context)
117{ 114{
118 struct microread_mei_phy *phy = context; 115 struct microread_mei_phy *phy = context;
@@ -120,7 +117,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
120 if (phy->hard_fault != 0) 117 if (phy->hard_fault != 0)
121 return; 118 return;
122 119
123 if (events & BIT(MEI_EVENT_RX)) { 120 if (events & BIT(MEI_CL_EVENT_RX)) {
124 struct sk_buff *skb; 121 struct sk_buff *skb;
125 int reply_size; 122 int reply_size;
126 123
@@ -128,7 +125,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
128 if (!skb) 125 if (!skb)
129 return; 126 return;
130 127
131 reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ); 128 reply_size = mei_cl_recv(device, skb->data, MEI_NFC_MAX_READ);
132 if (reply_size < MEI_NFC_HEADER_SIZE) { 129 if (reply_size < MEI_NFC_HEADER_SIZE) {
133 kfree(skb); 130 kfree(skb);
134 return; 131 return;
@@ -149,8 +146,8 @@ static struct nfc_phy_ops mei_phy_ops = {
149 .disable = microread_mei_disable, 146 .disable = microread_mei_disable,
150}; 147};
151 148
152static int microread_mei_probe(struct mei_device *device, 149static int microread_mei_probe(struct mei_cl_device *device,
153 const struct mei_id *id) 150 const struct mei_cl_device_id *id)
154{ 151{
155 struct microread_mei_phy *phy; 152 struct microread_mei_phy *phy;
156 int r; 153 int r;
@@ -164,9 +161,9 @@ static int microread_mei_probe(struct mei_device *device,
164 } 161 }
165 162
166 phy->device = device; 163 phy->device = device;
167 mei_set_clientdata(device, phy); 164 mei_cl_set_drvdata(device, phy);
168 165
169 r = mei_register_event_cb(device, microread_event_cb, phy); 166 r = mei_cl_register_event_cb(device, microread_event_cb, phy);
170 if (r) { 167 if (r) {
171 pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); 168 pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n");
172 goto err_out; 169 goto err_out;
@@ -186,9 +183,9 @@ err_out:
186 return r; 183 return r;
187} 184}
188 185
189static int microread_mei_remove(struct mei_device *device) 186static int microread_mei_remove(struct mei_cl_device *device)
190{ 187{
191 struct microread_mei_phy *phy = mei_get_clientdata(device); 188 struct microread_mei_phy *phy = mei_cl_get_drvdata(device);
192 189
193 pr_info("Removing microread\n"); 190 pr_info("Removing microread\n");
194 191
@@ -202,16 +199,15 @@ static int microread_mei_remove(struct mei_device *device)
202 return 0; 199 return 0;
203} 200}
204 201
205static struct mei_id microread_mei_tbl[] = { 202static struct mei_cl_device_id microread_mei_tbl[] = {
206 { MICROREAD_DRIVER_NAME, MICROREAD_UUID }, 203 { MICROREAD_DRIVER_NAME },
207 204
208 /* required last entry */ 205 /* required last entry */
209 { } 206 { }
210}; 207};
211
212MODULE_DEVICE_TABLE(mei, microread_mei_tbl); 208MODULE_DEVICE_TABLE(mei, microread_mei_tbl);
213 209
214static struct mei_driver microread_driver = { 210static struct mei_cl_driver microread_driver = {
215 .id_table = microread_mei_tbl, 211 .id_table = microread_mei_tbl,
216 .name = MICROREAD_DRIVER_NAME, 212 .name = MICROREAD_DRIVER_NAME,
217 213
@@ -225,7 +221,7 @@ static int microread_mei_init(void)
225 221
226 pr_debug(DRIVER_DESC ": %s\n", __func__); 222 pr_debug(DRIVER_DESC ": %s\n", __func__);
227 223
228 r = mei_driver_register(&microread_driver); 224 r = mei_cl_driver_register(&microread_driver);
229 if (r) { 225 if (r) {
230 pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); 226 pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n");
231 return r; 227 return r;
@@ -236,7 +232,7 @@ static int microread_mei_init(void)
236 232
237static void microread_mei_exit(void) 233static void microread_mei_exit(void)
238{ 234{
239 mei_driver_unregister(&microread_driver); 235 mei_cl_driver_unregister(&microread_driver);
240} 236}
241 237
242module_init(microread_mei_init); 238module_init(microread_mei_init);
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index dee5dddaa292..5147c210df52 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -53,14 +53,15 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context)
53 return; 53 return;
54 } 54 }
55 55
56 if (!pci_dev->pm_cap || !pci_dev->pme_support 56 /* Clear PME Status if set. */
57 || pci_check_pme_status(pci_dev)) { 57 if (pci_dev->pme_support)
58 if (pci_dev->pme_poll) 58 pci_check_pme_status(pci_dev);
59 pci_dev->pme_poll = false;
60 59
61 pci_wakeup_event(pci_dev); 60 if (pci_dev->pme_poll)
62 pm_runtime_resume(&pci_dev->dev); 61 pci_dev->pme_poll = false;
63 } 62
63 pci_wakeup_event(pci_dev);
64 pm_runtime_resume(&pci_dev->dev);
64 65
65 if (pci_dev->subordinate) 66 if (pci_dev->subordinate)
66 pci_pme_wakeup_bus(pci_dev->subordinate); 67 pci_pme_wakeup_bus(pci_dev->subordinate);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 1fa1e482a999..79277fb36c6b 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -390,9 +390,10 @@ static void pci_device_shutdown(struct device *dev)
390 390
391 /* 391 /*
392 * Turn off Bus Master bit on the device to tell it to not 392 * Turn off Bus Master bit on the device to tell it to not
393 * continue to do DMA 393 * continue to do DMA. Don't touch devices in D3cold or unknown states.
394 */ 394 */
395 pci_clear_master(pci_dev); 395 if (pci_dev->current_state <= PCI_D3hot)
396 pci_clear_master(pci_dev);
396} 397}
397 398
398#ifdef CONFIG_PM 399#ifdef CONFIG_PM
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 08c243ab034e..ed4d09498337 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -185,14 +185,6 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {
185#endif /* !PM */ 185#endif /* !PM */
186 186
187/* 187/*
188 * PCIe port runtime suspend is broken for some chipsets, so use a
189 * black list to disable runtime PM for these chipsets.
190 */
191static const struct pci_device_id port_runtime_pm_black_list[] = {
192 { /* end: all zeroes */ }
193};
194
195/*
196 * pcie_portdrv_probe - Probe PCI-Express port devices 188 * pcie_portdrv_probe - Probe PCI-Express port devices
197 * @dev: PCI-Express port device being probed 189 * @dev: PCI-Express port device being probed
198 * 190 *
@@ -225,16 +217,11 @@ static int pcie_portdrv_probe(struct pci_dev *dev,
225 * it by default. 217 * it by default.
226 */ 218 */
227 dev->d3cold_allowed = false; 219 dev->d3cold_allowed = false;
228 if (!pci_match_id(port_runtime_pm_black_list, dev))
229 pm_runtime_put_noidle(&dev->dev);
230
231 return 0; 220 return 0;
232} 221}
233 222
234static void pcie_portdrv_remove(struct pci_dev *dev) 223static void pcie_portdrv_remove(struct pci_dev *dev)
235{ 224{
236 if (!pci_match_id(port_runtime_pm_black_list, dev))
237 pm_runtime_get_noresume(&dev->dev);
238 pcie_port_device_remove(dev); 225 pcie_port_device_remove(dev);
239 pci_disable_device(dev); 226 pci_disable_device(dev);
240} 227}
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index b41ac7756a4b..c5d0a08a8747 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -100,27 +100,6 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
100 return min((size_t)(image - rom), size); 100 return min((size_t)(image - rom), size);
101} 101}
102 102
103static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size)
104{
105 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
106 loff_t start;
107
108 /* assign the ROM an address if it doesn't have one */
109 if (res->parent == NULL && pci_assign_resource(pdev, PCI_ROM_RESOURCE))
110 return 0;
111 start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
112 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
113
114 if (*size == 0)
115 return 0;
116
117 /* Enable ROM space decodes */
118 if (pci_enable_rom(pdev))
119 return 0;
120
121 return start;
122}
123
124/** 103/**
125 * pci_map_rom - map a PCI ROM to kernel space 104 * pci_map_rom - map a PCI ROM to kernel space
126 * @pdev: pointer to pci device struct 105 * @pdev: pointer to pci device struct
@@ -135,7 +114,7 @@ static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size)
135void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) 114void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
136{ 115{
137 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; 116 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
138 loff_t start = 0; 117 loff_t start;
139 void __iomem *rom; 118 void __iomem *rom;
140 119
141 /* 120 /*
@@ -154,21 +133,21 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
154 return (void __iomem *)(unsigned long) 133 return (void __iomem *)(unsigned long)
155 pci_resource_start(pdev, PCI_ROM_RESOURCE); 134 pci_resource_start(pdev, PCI_ROM_RESOURCE);
156 } else { 135 } else {
157 start = pci_find_rom(pdev, size); 136 /* assign the ROM an address if it doesn't have one */
158 } 137 if (res->parent == NULL &&
159 } 138 pci_assign_resource(pdev,PCI_ROM_RESOURCE))
139 return NULL;
140 start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
141 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
142 if (*size == 0)
143 return NULL;
160 144
161 /* 145 /* Enable ROM space decodes */
162 * Some devices may provide ROMs via a source other than the BAR 146 if (pci_enable_rom(pdev))
163 */ 147 return NULL;
164 if (!start && pdev->rom && pdev->romlen) { 148 }
165 *size = pdev->romlen;
166 return phys_to_virt(pdev->rom);
167 } 149 }
168 150
169 if (!start)
170 return NULL;
171
172 rom = ioremap(start, *size); 151 rom = ioremap(start, *size);
173 if (!rom) { 152 if (!rom) {
174 /* restore enable if ioremap fails */ 153 /* restore enable if ioremap fails */
@@ -202,8 +181,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
202 if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) 181 if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY))
203 return; 182 return;
204 183
205 if (!pdev->rom || !pdev->romlen) 184 iounmap(rom);
206 iounmap(rom);
207 185
208 /* Disable again before continuing, leave enabled if pci=rom */ 186 /* Disable again before continuing, leave enabled if pci=rom */
209 if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) 187 if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW)))
@@ -227,7 +205,24 @@ void pci_cleanup_rom(struct pci_dev *pdev)
227 } 205 }
228} 206}
229 207
208/**
209 * pci_platform_rom - provides a pointer to any ROM image provided by the
210 * platform
211 * @pdev: pointer to pci device struct
212 * @size: pointer to receive size of pci window over ROM
213 */
214void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size)
215{
216 if (pdev->rom && pdev->romlen) {
217 *size = pdev->romlen;
218 return phys_to_virt((phys_addr_t)pdev->rom);
219 }
220
221 return NULL;
222}
223
230EXPORT_SYMBOL(pci_map_rom); 224EXPORT_SYMBOL(pci_map_rom);
231EXPORT_SYMBOL(pci_unmap_rom); 225EXPORT_SYMBOL(pci_unmap_rom);
232EXPORT_SYMBOL_GPL(pci_enable_rom); 226EXPORT_SYMBOL_GPL(pci_enable_rom);
233EXPORT_SYMBOL_GPL(pci_disable_rom); 227EXPORT_SYMBOL_GPL(pci_disable_rom);
228EXPORT_SYMBOL(pci_platform_rom);
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 34f51d2d90d2..5a690ce6d60d 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -166,6 +166,7 @@ config PINCTRL_SINGLE
166 depends on OF 166 depends on OF
167 select PINMUX 167 select PINMUX
168 select PINCONF 168 select PINCONF
169 select GENERIC_PINCONF
169 help 170 help
170 This selects the device tree based generic pinctrl driver. 171 This selects the device tree based generic pinctrl driver.
171 172
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index b0de6e7f1fdb..f8a632dc877b 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -27,6 +27,7 @@
27#include <linux/pinctrl/consumer.h> 27#include <linux/pinctrl/consumer.h>
28#include <linux/pinctrl/pinctrl.h> 28#include <linux/pinctrl/pinctrl.h>
29#include <linux/pinctrl/machine.h> 29#include <linux/pinctrl/machine.h>
30#include <asm-generic/gpio.h>
30#include "core.h" 31#include "core.h"
31#include "devicetree.h" 32#include "devicetree.h"
32#include "pinmux.h" 33#include "pinmux.h"
@@ -277,6 +278,39 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
277} 278}
278 279
279/** 280/**
281 * pinctrl_ready_for_gpio_range() - check if other GPIO pins of
282 * the same GPIO chip are in range
283 * @gpio: gpio pin to check taken from the global GPIO pin space
284 *
285 * This function is complement of pinctrl_match_gpio_range(). If the return
286 * value of pinctrl_match_gpio_range() is NULL, this function could be used
287 * to check whether pinctrl device is ready or not. Maybe some GPIO pins
288 * of the same GPIO chip don't have back-end pinctrl interface.
289 * If the return value is true, it means that pinctrl device is ready & the
290 * certain GPIO pin doesn't have back-end pinctrl device. If the return value
291 * is false, it means that pinctrl device may not be ready.
292 */
293static bool pinctrl_ready_for_gpio_range(unsigned gpio)
294{
295 struct pinctrl_dev *pctldev;
296 struct pinctrl_gpio_range *range = NULL;
297 struct gpio_chip *chip = gpio_to_chip(gpio);
298
299 /* Loop over the pin controllers */
300 list_for_each_entry(pctldev, &pinctrldev_list, node) {
301 /* Loop over the ranges */
302 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
303 /* Check if any gpio range overlapped with gpio chip */
304 if (range->base + range->npins - 1 < chip->base ||
305 range->base > chip->base + chip->ngpio - 1)
306 continue;
307 return true;
308 }
309 }
310 return false;
311}
312
313/**
280 * pinctrl_get_device_gpio_range() - find device for GPIO range 314 * pinctrl_get_device_gpio_range() - find device for GPIO range
281 * @gpio: the pin to locate the pin controller for 315 * @gpio: the pin to locate the pin controller for
282 * @outdev: the pin control device if found 316 * @outdev: the pin control device if found
@@ -443,6 +477,8 @@ int pinctrl_request_gpio(unsigned gpio)
443 477
444 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); 478 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
445 if (ret) { 479 if (ret) {
480 if (pinctrl_ready_for_gpio_range(gpio))
481 ret = 0;
446 mutex_unlock(&pinctrl_mutex); 482 mutex_unlock(&pinctrl_mutex);
447 return ret; 483 return ret;
448 } 484 }
@@ -979,9 +1015,8 @@ static int devm_pinctrl_match(struct device *dev, void *res, void *data)
979 */ 1015 */
980void devm_pinctrl_put(struct pinctrl *p) 1016void devm_pinctrl_put(struct pinctrl *p)
981{ 1017{
982 WARN_ON(devres_destroy(p->dev, devm_pinctrl_release, 1018 WARN_ON(devres_release(p->dev, devm_pinctrl_release,
983 devm_pinctrl_match, p)); 1019 devm_pinctrl_match, p));
984 pinctrl_put(p);
985} 1020}
986EXPORT_SYMBOL_GPL(devm_pinctrl_put); 1021EXPORT_SYMBOL_GPL(devm_pinctrl_put);
987 1022
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index fd40a11ad645..c7b7cb477129 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -41,7 +41,7 @@ static void dt_free_map(struct pinctrl_dev *pctldev,
41 struct pinctrl_map *map, unsigned num_maps) 41 struct pinctrl_map *map, unsigned num_maps)
42{ 42{
43 if (pctldev) { 43 if (pctldev) {
44 struct pinctrl_ops *ops = pctldev->desc->pctlops; 44 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
45 ops->dt_free_map(pctldev, map, num_maps); 45 ops->dt_free_map(pctldev, map, num_maps);
46 } else { 46 } else {
47 /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */ 47 /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */
@@ -122,7 +122,7 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
122{ 122{
123 struct device_node *np_pctldev; 123 struct device_node *np_pctldev;
124 struct pinctrl_dev *pctldev; 124 struct pinctrl_dev *pctldev;
125 struct pinctrl_ops *ops; 125 const struct pinctrl_ops *ops;
126 int ret; 126 int ret;
127 struct pinctrl_map *map; 127 struct pinctrl_map *map;
128 unsigned num_maps; 128 unsigned num_maps;
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 2d2f0a43d36b..7f34a2b212d2 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -263,7 +263,7 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
263 return; 263 return;
264} 264}
265 265
266static struct pinconf_ops mvebu_pinconf_ops = { 266static const struct pinconf_ops mvebu_pinconf_ops = {
267 .pin_config_group_get = mvebu_pinconf_group_get, 267 .pin_config_group_get = mvebu_pinconf_group_get,
268 .pin_config_group_set = mvebu_pinconf_group_set, 268 .pin_config_group_set = mvebu_pinconf_group_set,
269 .pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show, 269 .pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show,
@@ -369,7 +369,7 @@ static int mvebu_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
369 return -ENOTSUPP; 369 return -ENOTSUPP;
370} 370}
371 371
372static struct pinmux_ops mvebu_pinmux_ops = { 372static const struct pinmux_ops mvebu_pinmux_ops = {
373 .get_functions_count = mvebu_pinmux_get_funcs_count, 373 .get_functions_count = mvebu_pinmux_get_funcs_count,
374 .get_function_name = mvebu_pinmux_get_func_name, 374 .get_function_name = mvebu_pinmux_get_func_name,
375 .get_function_groups = mvebu_pinmux_get_groups, 375 .get_function_groups = mvebu_pinmux_get_groups,
@@ -470,7 +470,7 @@ static void mvebu_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
470 kfree(map); 470 kfree(map);
471} 471}
472 472
473static struct pinctrl_ops mvebu_pinctrl_ops = { 473static const struct pinctrl_ops mvebu_pinctrl_ops = {
474 .get_groups_count = mvebu_pinctrl_get_groups_count, 474 .get_groups_count = mvebu_pinctrl_get_groups_count,
475 .get_group_name = mvebu_pinctrl_get_group_name, 475 .get_group_name = mvebu_pinctrl_get_group_name,
476 .get_group_pins = mvebu_pinctrl_get_group_pins, 476 .get_group_pins = mvebu_pinctrl_get_group_pins,
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 06c304ac6f7d..9c436858812c 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -12,6 +12,7 @@
12#define pr_fmt(fmt) "generic pinconfig core: " fmt 12#define pr_fmt(fmt) "generic pinconfig core: " fmt
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/device.h> 17#include <linux/device.h>
17#include <linux/slab.h> 18#include <linux/slab.h>
@@ -120,4 +121,17 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
120 } 121 }
121} 122}
122 123
124void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
125 struct seq_file *s, unsigned long config)
126{
127 int i;
128
129 for(i = 0; i < ARRAY_SIZE(conf_items); i++) {
130 if (pinconf_to_config_param(config) != conf_items[i].param)
131 continue;
132 seq_printf(s, "%s: 0x%x", conf_items[i].display,
133 pinconf_to_config_argument(config));
134 }
135}
136EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
123#endif 137#endif
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index d611ecfcbf70..dae927f91088 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -670,7 +670,7 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d)
670 struct pinctrl_maps *maps_node; 670 struct pinctrl_maps *maps_node;
671 struct pinctrl_map const *map; 671 struct pinctrl_map const *map;
672 struct pinctrl_dev *pctldev = NULL; 672 struct pinctrl_dev *pctldev = NULL;
673 struct pinconf_ops *confops = NULL; 673 const struct pinconf_ops *confops = NULL;
674 int i, j; 674 int i, j;
675 bool found = false; 675 bool found = false;
676 676
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h
index bfda73d64eed..92c7267244d2 100644
--- a/drivers/pinctrl/pinconf.h
+++ b/drivers/pinctrl/pinconf.h
@@ -98,6 +98,8 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
98void pinconf_generic_dump_group(struct pinctrl_dev *pctldev, 98void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
99 struct seq_file *s, const char *gname); 99 struct seq_file *s, const char *gname);
100 100
101void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
102 struct seq_file *s, unsigned long config);
101#else 103#else
102 104
103static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, 105static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
@@ -114,4 +116,10 @@ static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
114 return; 116 return;
115} 117}
116 118
119static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
120 struct seq_file *s,
121 unsigned long config)
122{
123 return;
124}
117#endif 125#endif
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index c542a97c82f3..0cf3fa4a21ae 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -656,7 +656,7 @@ static void abx500_gpio_disable_free(struct pinctrl_dev *pctldev,
656{ 656{
657} 657}
658 658
659static struct pinmux_ops abx500_pinmux_ops = { 659static const struct pinmux_ops abx500_pinmux_ops = {
660 .get_functions_count = abx500_pmx_get_funcs_cnt, 660 .get_functions_count = abx500_pmx_get_funcs_cnt,
661 .get_function_name = abx500_pmx_get_func_name, 661 .get_function_name = abx500_pmx_get_func_name,
662 .get_function_groups = abx500_pmx_get_func_groups, 662 .get_function_groups = abx500_pmx_get_func_groups,
@@ -704,7 +704,7 @@ static void abx500_pin_dbg_show(struct pinctrl_dev *pctldev,
704 chip->base + offset - 1); 704 chip->base + offset - 1);
705} 705}
706 706
707static struct pinctrl_ops abx500_pinctrl_ops = { 707static const struct pinctrl_ops abx500_pinctrl_ops = {
708 .get_groups_count = abx500_get_groups_cnt, 708 .get_groups_count = abx500_get_groups_cnt,
709 .get_group_name = abx500_get_group_name, 709 .get_group_name = abx500_get_group_name,
710 .get_group_pins = abx500_get_group_pins, 710 .get_group_pins = abx500_get_group_pins,
@@ -778,7 +778,7 @@ int abx500_pin_config_set(struct pinctrl_dev *pctldev,
778 return ret; 778 return ret;
779} 779}
780 780
781static struct pinconf_ops abx500_pinconf_ops = { 781static const struct pinconf_ops abx500_pinconf_ops = {
782 .pin_config_get = abx500_pin_config_get, 782 .pin_config_get = abx500_pin_config_get,
783 .pin_config_set = abx500_pin_config_set, 783 .pin_config_set = abx500_pin_config_set,
784}; 784};
@@ -834,6 +834,7 @@ static const struct of_device_id abx500_gpio_match[] = {
834 { .compatible = "stericsson,ab8505-gpio", .data = (void *)PINCTRL_AB8505, }, 834 { .compatible = "stericsson,ab8505-gpio", .data = (void *)PINCTRL_AB8505, },
835 { .compatible = "stericsson,ab8540-gpio", .data = (void *)PINCTRL_AB8540, }, 835 { .compatible = "stericsson,ab8540-gpio", .data = (void *)PINCTRL_AB8540, },
836 { .compatible = "stericsson,ab9540-gpio", .data = (void *)PINCTRL_AB9540, }, 836 { .compatible = "stericsson,ab9540-gpio", .data = (void *)PINCTRL_AB9540, },
837 { }
837}; 838};
838 839
839static int abx500_gpio_probe(struct platform_device *pdev) 840static int abx500_gpio_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index efb7f10e902a..bddd1dd9efdf 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -294,7 +294,7 @@ static void at91_dt_free_map(struct pinctrl_dev *pctldev,
294{ 294{
295} 295}
296 296
297static struct pinctrl_ops at91_pctrl_ops = { 297static const struct pinctrl_ops at91_pctrl_ops = {
298 .get_groups_count = at91_get_groups_count, 298 .get_groups_count = at91_get_groups_count,
299 .get_group_name = at91_get_group_name, 299 .get_group_name = at91_get_group_name,
300 .get_group_pins = at91_get_group_pins, 300 .get_group_pins = at91_get_group_pins,
@@ -696,7 +696,7 @@ static void at91_gpio_disable_free(struct pinctrl_dev *pctldev,
696 /* Set the pin to some default state, GPIO is usually default */ 696 /* Set the pin to some default state, GPIO is usually default */
697} 697}
698 698
699static struct pinmux_ops at91_pmx_ops = { 699static const struct pinmux_ops at91_pmx_ops = {
700 .get_functions_count = at91_pmx_get_funcs_count, 700 .get_functions_count = at91_pmx_get_funcs_count,
701 .get_function_name = at91_pmx_get_func_name, 701 .get_function_name = at91_pmx_get_func_name,
702 .get_function_groups = at91_pmx_get_groups, 702 .get_function_groups = at91_pmx_get_groups,
@@ -776,7 +776,7 @@ static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
776{ 776{
777} 777}
778 778
779static struct pinconf_ops at91_pinconf_ops = { 779static const struct pinconf_ops at91_pinconf_ops = {
780 .pin_config_get = at91_pinconf_get, 780 .pin_config_get = at91_pinconf_get,
781 .pin_config_set = at91_pinconf_set, 781 .pin_config_set = at91_pinconf_set,
782 .pin_config_dbg_show = at91_pinconf_dbg_show, 782 .pin_config_dbg_show = at91_pinconf_dbg_show,
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index 4eb6d2c4e4df..f28d4b08771a 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -795,7 +795,7 @@ out:
795 return err; 795 return err;
796} 796}
797 797
798static struct pinctrl_ops bcm2835_pctl_ops = { 798static const struct pinctrl_ops bcm2835_pctl_ops = {
799 .get_groups_count = bcm2835_pctl_get_groups_count, 799 .get_groups_count = bcm2835_pctl_get_groups_count,
800 .get_group_name = bcm2835_pctl_get_group_name, 800 .get_group_name = bcm2835_pctl_get_group_name,
801 .get_group_pins = bcm2835_pctl_get_group_pins, 801 .get_group_pins = bcm2835_pctl_get_group_pins,
@@ -872,7 +872,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
872 return 0; 872 return 0;
873} 873}
874 874
875static struct pinmux_ops bcm2835_pmx_ops = { 875static const struct pinmux_ops bcm2835_pmx_ops = {
876 .get_functions_count = bcm2835_pmx_get_functions_count, 876 .get_functions_count = bcm2835_pmx_get_functions_count,
877 .get_function_name = bcm2835_pmx_get_function_name, 877 .get_function_name = bcm2835_pmx_get_function_name,
878 .get_function_groups = bcm2835_pmx_get_function_groups, 878 .get_function_groups = bcm2835_pmx_get_function_groups,
@@ -916,7 +916,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev,
916 return 0; 916 return 0;
917} 917}
918 918
919static struct pinconf_ops bcm2835_pinconf_ops = { 919static const struct pinconf_ops bcm2835_pinconf_ops = {
920 .pin_config_get = bcm2835_pinconf_get, 920 .pin_config_get = bcm2835_pinconf_get,
921 .pin_config_set = bcm2835_pinconf_set, 921 .pin_config_set = bcm2835_pinconf_set,
922}; 922};
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c
index 1376eb7305db..169ea3e5f777 100644
--- a/drivers/pinctrl/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/pinctrl-exynos5440.c
@@ -286,7 +286,7 @@ static void exynos5440_dt_free_map(struct pinctrl_dev *pctldev,
286} 286}
287 287
288/* list of pinctrl callbacks for the pinctrl core */ 288/* list of pinctrl callbacks for the pinctrl core */
289static struct pinctrl_ops exynos5440_pctrl_ops = { 289static const struct pinctrl_ops exynos5440_pctrl_ops = {
290 .get_groups_count = exynos5440_get_group_count, 290 .get_groups_count = exynos5440_get_group_count,
291 .get_group_name = exynos5440_get_group_name, 291 .get_group_name = exynos5440_get_group_name,
292 .get_group_pins = exynos5440_get_group_pins, 292 .get_group_pins = exynos5440_get_group_pins,
@@ -374,7 +374,7 @@ static int exynos5440_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
374} 374}
375 375
376/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ 376/* list of pinmux callbacks for the pinmux vertical in pinctrl core */
377static struct pinmux_ops exynos5440_pinmux_ops = { 377static const struct pinmux_ops exynos5440_pinmux_ops = {
378 .get_functions_count = exynos5440_get_functions_count, 378 .get_functions_count = exynos5440_get_functions_count,
379 .get_function_name = exynos5440_pinmux_get_fname, 379 .get_function_name = exynos5440_pinmux_get_fname,
380 .get_function_groups = exynos5440_pinmux_get_groups, 380 .get_function_groups = exynos5440_pinmux_get_groups,
@@ -523,7 +523,7 @@ static int exynos5440_pinconf_group_get(struct pinctrl_dev *pctldev,
523} 523}
524 524
525/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ 525/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */
526static struct pinconf_ops exynos5440_pinconf_ops = { 526static const struct pinconf_ops exynos5440_pinconf_ops = {
527 .pin_config_get = exynos5440_pinconf_get, 527 .pin_config_get = exynos5440_pinconf_get,
528 .pin_config_set = exynos5440_pinconf_set, 528 .pin_config_set = exynos5440_pinconf_set,
529 .pin_config_group_get = exynos5440_pinconf_group_get, 529 .pin_config_group_get = exynos5440_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
index af97a1f90007..f9b2a1d4854f 100644
--- a/drivers/pinctrl/pinctrl-falcon.c
+++ b/drivers/pinctrl/pinctrl-falcon.c
@@ -353,7 +353,7 @@ static void falcon_pinconf_group_dbg_show(struct pinctrl_dev *pctrldev,
353{ 353{
354} 354}
355 355
356static struct pinconf_ops falcon_pinconf_ops = { 356static const struct pinconf_ops falcon_pinconf_ops = {
357 .pin_config_get = falcon_pinconf_get, 357 .pin_config_get = falcon_pinconf_get,
358 .pin_config_set = falcon_pinconf_set, 358 .pin_config_set = falcon_pinconf_set,
359 .pin_config_group_get = falcon_pinconf_group_get, 359 .pin_config_group_get = falcon_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 4cebb9c6c5c5..0ef190449eab 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -207,7 +207,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev,
207 kfree(map); 207 kfree(map);
208} 208}
209 209
210static struct pinctrl_ops imx_pctrl_ops = { 210static const struct pinctrl_ops imx_pctrl_ops = {
211 .get_groups_count = imx_get_groups_count, 211 .get_groups_count = imx_get_groups_count,
212 .get_group_name = imx_get_group_name, 212 .get_group_name = imx_get_group_name,
213 .get_group_pins = imx_get_group_pins, 213 .get_group_pins = imx_get_group_pins,
@@ -299,7 +299,7 @@ static int imx_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
299 return 0; 299 return 0;
300} 300}
301 301
302static struct pinmux_ops imx_pmx_ops = { 302static const struct pinmux_ops imx_pmx_ops = {
303 .get_functions_count = imx_pmx_get_funcs_count, 303 .get_functions_count = imx_pmx_get_funcs_count,
304 .get_function_name = imx_pmx_get_func_name, 304 .get_function_name = imx_pmx_get_func_name,
305 .get_function_groups = imx_pmx_get_groups, 305 .get_function_groups = imx_pmx_get_groups,
@@ -397,7 +397,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
397 } 397 }
398} 398}
399 399
400static struct pinconf_ops imx_pinconf_ops = { 400static const struct pinconf_ops imx_pinconf_ops = {
401 .pin_config_get = imx_pinconf_get, 401 .pin_config_get = imx_pinconf_get,
402 .pin_config_set = imx_pinconf_set, 402 .pin_config_set = imx_pinconf_set,
403 .pin_config_dbg_show = imx_pinconf_dbg_show, 403 .pin_config_dbg_show = imx_pinconf_dbg_show,
diff --git a/drivers/pinctrl/pinctrl-lantiq.c b/drivers/pinctrl/pinctrl-lantiq.c
index a70384611351..615c5002b757 100644
--- a/drivers/pinctrl/pinctrl-lantiq.c
+++ b/drivers/pinctrl/pinctrl-lantiq.c
@@ -169,7 +169,7 @@ static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
169 return 0; 169 return 0;
170} 170}
171 171
172static struct pinctrl_ops ltq_pctrl_ops = { 172static const struct pinctrl_ops ltq_pctrl_ops = {
173 .get_groups_count = ltq_get_group_count, 173 .get_groups_count = ltq_get_group_count,
174 .get_group_name = ltq_get_group_name, 174 .get_group_name = ltq_get_group_name,
175 .get_group_pins = ltq_get_group_pins, 175 .get_group_pins = ltq_get_group_pins,
@@ -311,7 +311,7 @@ static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev,
311 return info->apply_mux(pctrldev, mfp, pin_func); 311 return info->apply_mux(pctrldev, mfp, pin_func);
312} 312}
313 313
314static struct pinmux_ops ltq_pmx_ops = { 314static const struct pinmux_ops ltq_pmx_ops = {
315 .get_functions_count = ltq_pmx_func_count, 315 .get_functions_count = ltq_pmx_func_count,
316 .get_function_name = ltq_pmx_func_name, 316 .get_function_name = ltq_pmx_func_name,
317 .get_function_groups = ltq_pmx_get_groups, 317 .get_function_groups = ltq_pmx_get_groups,
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index 23af9f1f9c35..b45c4eb35798 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -158,7 +158,7 @@ static void mxs_dt_free_map(struct pinctrl_dev *pctldev,
158 kfree(map); 158 kfree(map);
159} 159}
160 160
161static struct pinctrl_ops mxs_pinctrl_ops = { 161static const struct pinctrl_ops mxs_pinctrl_ops = {
162 .get_groups_count = mxs_get_groups_count, 162 .get_groups_count = mxs_get_groups_count,
163 .get_group_name = mxs_get_group_name, 163 .get_group_name = mxs_get_group_name,
164 .get_group_pins = mxs_get_group_pins, 164 .get_group_pins = mxs_get_group_pins,
@@ -219,7 +219,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector,
219 return 0; 219 return 0;
220} 220}
221 221
222static struct pinmux_ops mxs_pinmux_ops = { 222static const struct pinmux_ops mxs_pinmux_ops = {
223 .get_functions_count = mxs_pinctrl_get_funcs_count, 223 .get_functions_count = mxs_pinctrl_get_funcs_count,
224 .get_function_name = mxs_pinctrl_get_func_name, 224 .get_function_name = mxs_pinctrl_get_func_name,
225 .get_function_groups = mxs_pinctrl_get_func_groups, 225 .get_function_groups = mxs_pinctrl_get_func_groups,
@@ -319,7 +319,7 @@ static void mxs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
319 seq_printf(s, "0x%lx", config); 319 seq_printf(s, "0x%lx", config);
320} 320}
321 321
322static struct pinconf_ops mxs_pinconf_ops = { 322static const struct pinconf_ops mxs_pinconf_ops = {
323 .pin_config_get = mxs_pinconf_get, 323 .pin_config_get = mxs_pinconf_get,
324 .pin_config_set = mxs_pinconf_set, 324 .pin_config_set = mxs_pinconf_set,
325 .pin_config_group_get = mxs_pinconf_group_get, 325 .pin_config_group_get = mxs_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 36d20293de5c..2328baaa86bf 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -1764,7 +1764,7 @@ int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
1764 return 0; 1764 return 0;
1765} 1765}
1766 1766
1767static struct pinctrl_ops nmk_pinctrl_ops = { 1767static const struct pinctrl_ops nmk_pinctrl_ops = {
1768 .get_groups_count = nmk_get_groups_cnt, 1768 .get_groups_count = nmk_get_groups_cnt,
1769 .get_group_name = nmk_get_group_name, 1769 .get_group_name = nmk_get_group_name,
1770 .get_group_pins = nmk_get_group_pins, 1770 .get_group_pins = nmk_get_group_pins,
@@ -1975,7 +1975,7 @@ static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev,
1975 /* Set the pin to some default state, GPIO is usually default */ 1975 /* Set the pin to some default state, GPIO is usually default */
1976} 1976}
1977 1977
1978static struct pinmux_ops nmk_pinmux_ops = { 1978static const struct pinmux_ops nmk_pinmux_ops = {
1979 .get_functions_count = nmk_pmx_get_funcs_cnt, 1979 .get_functions_count = nmk_pmx_get_funcs_cnt,
1980 .get_function_name = nmk_pmx_get_func_name, 1980 .get_function_name = nmk_pmx_get_func_name,
1981 .get_function_groups = nmk_pmx_get_func_groups, 1981 .get_function_groups = nmk_pmx_get_func_groups,
@@ -2089,7 +2089,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
2089 return 0; 2089 return 0;
2090} 2090}
2091 2091
2092static struct pinconf_ops nmk_pinconf_ops = { 2092static const struct pinconf_ops nmk_pinconf_ops = {
2093 .pin_config_get = nmk_pin_config_get, 2093 .pin_config_get = nmk_pin_config_get,
2094 .pin_config_set = nmk_pin_config_set, 2094 .pin_config_set = nmk_pin_config_set,
2095}; 2095};
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
index 1f49bb02a6af..05e11de1d144 100644
--- a/drivers/pinctrl/pinctrl-pxa3xx.c
+++ b/drivers/pinctrl/pinctrl-pxa3xx.c
@@ -53,7 +53,7 @@ static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev,
53 return 0; 53 return 0;
54} 54}
55 55
56static struct pinctrl_ops pxa3xx_pctrl_ops = { 56static const struct pinctrl_ops pxa3xx_pctrl_ops = {
57 .get_groups_count = pxa3xx_get_groups_count, 57 .get_groups_count = pxa3xx_get_groups_count,
58 .get_group_name = pxa3xx_get_group_name, 58 .get_group_name = pxa3xx_get_group_name,
59 .get_group_pins = pxa3xx_get_group_pins, 59 .get_group_pins = pxa3xx_get_group_pins,
@@ -161,7 +161,7 @@ static int pxa3xx_pmx_request_gpio(struct pinctrl_dev *pctrldev,
161 return 0; 161 return 0;
162} 162}
163 163
164static struct pinmux_ops pxa3xx_pmx_ops = { 164static const struct pinmux_ops pxa3xx_pmx_ops = {
165 .get_functions_count = pxa3xx_pmx_get_funcs_count, 165 .get_functions_count = pxa3xx_pmx_get_funcs_count,
166 .get_function_name = pxa3xx_pmx_get_func_name, 166 .get_function_name = pxa3xx_pmx_get_func_name,
167 .get_function_groups = pxa3xx_pmx_get_groups, 167 .get_function_groups = pxa3xx_pmx_get_groups,
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index f206df175656..3475b92b24a4 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -214,7 +214,7 @@ static void samsung_dt_free_map(struct pinctrl_dev *pctldev,
214} 214}
215 215
216/* list of pinctrl callbacks for the pinctrl core */ 216/* list of pinctrl callbacks for the pinctrl core */
217static struct pinctrl_ops samsung_pctrl_ops = { 217static const struct pinctrl_ops samsung_pctrl_ops = {
218 .get_groups_count = samsung_get_group_count, 218 .get_groups_count = samsung_get_group_count,
219 .get_group_name = samsung_get_group_name, 219 .get_group_name = samsung_get_group_name,
220 .get_group_pins = samsung_get_group_pins, 220 .get_group_pins = samsung_get_group_pins,
@@ -357,7 +357,7 @@ static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
357} 357}
358 358
359/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ 359/* list of pinmux callbacks for the pinmux vertical in pinctrl core */
360static struct pinmux_ops samsung_pinmux_ops = { 360static const struct pinmux_ops samsung_pinmux_ops = {
361 .get_functions_count = samsung_get_functions_count, 361 .get_functions_count = samsung_get_functions_count,
362 .get_function_name = samsung_pinmux_get_fname, 362 .get_function_name = samsung_pinmux_get_fname,
363 .get_function_groups = samsung_pinmux_get_groups, 363 .get_function_groups = samsung_pinmux_get_groups,
@@ -468,7 +468,7 @@ static int samsung_pinconf_group_get(struct pinctrl_dev *pctldev,
468} 468}
469 469
470/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ 470/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */
471static struct pinconf_ops samsung_pinconf_ops = { 471static const struct pinconf_ops samsung_pinconf_ops = {
472 .pin_config_get = samsung_pinconf_get, 472 .pin_config_get = samsung_pinconf_get,
473 .pin_config_set = samsung_pinconf_set, 473 .pin_config_set = samsung_pinconf_set,
474 .pin_config_group_get = samsung_pinconf_group_get, 474 .pin_config_group_get = samsung_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 5c32e880bcb2..e35dabd3135d 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -22,8 +22,10 @@
22 22
23#include <linux/pinctrl/pinctrl.h> 23#include <linux/pinctrl/pinctrl.h>
24#include <linux/pinctrl/pinmux.h> 24#include <linux/pinctrl/pinmux.h>
25#include <linux/pinctrl/pinconf-generic.h>
25 26
26#include "core.h" 27#include "core.h"
28#include "pinconf.h"
27 29
28#define DRIVER_NAME "pinctrl-single" 30#define DRIVER_NAME "pinctrl-single"
29#define PCS_MUX_PINS_NAME "pinctrl-single,pins" 31#define PCS_MUX_PINS_NAME "pinctrl-single,pins"
@@ -59,6 +61,33 @@ struct pcs_func_vals {
59}; 61};
60 62
61/** 63/**
64 * struct pcs_conf_vals - pinconf parameter, pinconf register offset
65 * and value, enable, disable, mask
66 * @param: config parameter
67 * @val: user input bits in the pinconf register
68 * @enable: enable bits in the pinconf register
69 * @disable: disable bits in the pinconf register
70 * @mask: mask bits in the register value
71 */
72struct pcs_conf_vals {
73 enum pin_config_param param;
74 unsigned val;
75 unsigned enable;
76 unsigned disable;
77 unsigned mask;
78};
79
80/**
81 * struct pcs_conf_type - pinconf property name, pinconf param pair
82 * @name: property name in DTS file
83 * @param: config parameter
84 */
85struct pcs_conf_type {
86 const char *name;
87 enum pin_config_param param;
88};
89
90/**
62 * struct pcs_function - pinctrl function 91 * struct pcs_function - pinctrl function
63 * @name: pinctrl function name 92 * @name: pinctrl function name
64 * @vals: register and vals array 93 * @vals: register and vals array
@@ -73,6 +102,22 @@ struct pcs_function {
73 unsigned nvals; 102 unsigned nvals;
74 const char **pgnames; 103 const char **pgnames;
75 int npgnames; 104 int npgnames;
105 struct pcs_conf_vals *conf;
106 int nconfs;
107 struct list_head node;
108};
109
110/**
111 * struct pcs_gpiofunc_range - pin ranges with same mux value of gpio function
112 * @offset: offset base of pins
113 * @npins: number pins with the same mux value of gpio function
114 * @gpiofunc: mux value of gpio function
115 * @node: list node
116 */
117struct pcs_gpiofunc_range {
118 unsigned offset;
119 unsigned npins;
120 unsigned gpiofunc;
76 struct list_head node; 121 struct list_head node;
77}; 122};
78 123
@@ -117,12 +162,14 @@ struct pcs_name {
117 * @fshift: function register shift 162 * @fshift: function register shift
118 * @foff: value to turn mux off 163 * @foff: value to turn mux off
119 * @fmax: max number of functions in fmask 164 * @fmax: max number of functions in fmask
165 * @is_pinconf: whether supports pinconf
120 * @names: array of register names for pins 166 * @names: array of register names for pins
121 * @pins: physical pins on the SoC 167 * @pins: physical pins on the SoC
122 * @pgtree: pingroup index radix tree 168 * @pgtree: pingroup index radix tree
123 * @ftree: function index radix tree 169 * @ftree: function index radix tree
124 * @pingroups: list of pingroups 170 * @pingroups: list of pingroups
125 * @functions: list of functions 171 * @functions: list of functions
172 * @gpiofuncs: list of gpio functions
126 * @ngroups: number of pingroups 173 * @ngroups: number of pingroups
127 * @nfuncs: number of functions 174 * @nfuncs: number of functions
128 * @desc: pin controller descriptor 175 * @desc: pin controller descriptor
@@ -142,12 +189,14 @@ struct pcs_device {
142 unsigned foff; 189 unsigned foff;
143 unsigned fmax; 190 unsigned fmax;
144 bool bits_per_mux; 191 bool bits_per_mux;
192 bool is_pinconf;
145 struct pcs_name *names; 193 struct pcs_name *names;
146 struct pcs_data pins; 194 struct pcs_data pins;
147 struct radix_tree_root pgtree; 195 struct radix_tree_root pgtree;
148 struct radix_tree_root ftree; 196 struct radix_tree_root ftree;
149 struct list_head pingroups; 197 struct list_head pingroups;
150 struct list_head functions; 198 struct list_head functions;
199 struct list_head gpiofuncs;
151 unsigned ngroups; 200 unsigned ngroups;
152 unsigned nfuncs; 201 unsigned nfuncs;
153 struct pinctrl_desc desc; 202 struct pinctrl_desc desc;
@@ -155,6 +204,16 @@ struct pcs_device {
155 void (*write)(unsigned val, void __iomem *reg); 204 void (*write)(unsigned val, void __iomem *reg);
156}; 205};
157 206
207static int pcs_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin,
208 unsigned long *config);
209static int pcs_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
210 unsigned long config);
211
212static enum pin_config_param pcs_bias[] = {
213 PIN_CONFIG_BIAS_PULL_DOWN,
214 PIN_CONFIG_BIAS_PULL_UP,
215};
216
158/* 217/*
159 * REVISIT: Reads and writes could eventually use regmap or something 218 * REVISIT: Reads and writes could eventually use regmap or something
160 * generic. But at least on omaps, some mux registers are performance 219 * generic. But at least on omaps, some mux registers are performance
@@ -270,7 +329,7 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
270 struct device_node *np_config, 329 struct device_node *np_config,
271 struct pinctrl_map **map, unsigned *num_maps); 330 struct pinctrl_map **map, unsigned *num_maps);
272 331
273static struct pinctrl_ops pcs_pinctrl_ops = { 332static const struct pinctrl_ops pcs_pinctrl_ops = {
274 .get_groups_count = pcs_get_groups_count, 333 .get_groups_count = pcs_get_groups_count,
275 .get_group_name = pcs_get_group_name, 334 .get_group_name = pcs_get_group_name,
276 .get_group_pins = pcs_get_group_pins, 335 .get_group_pins = pcs_get_group_pins,
@@ -326,6 +385,28 @@ static int pcs_get_function_groups(struct pinctrl_dev *pctldev,
326 return 0; 385 return 0;
327} 386}
328 387
388static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,
389 struct pcs_function **func)
390{
391 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
392 struct pin_desc *pdesc = pin_desc_get(pctldev, pin);
393 const struct pinctrl_setting_mux *setting;
394 unsigned fselector;
395
396 /* If pin is not described in DTS & enabled, mux_setting is NULL. */
397 setting = pdesc->mux_setting;
398 if (!setting)
399 return -ENOTSUPP;
400 fselector = setting->func;
401 *func = radix_tree_lookup(&pcs->ftree, fselector);
402 if (!(*func)) {
403 dev_err(pcs->dev, "%s could not find function%i\n",
404 __func__, fselector);
405 return -ENOTSUPP;
406 }
407 return 0;
408}
409
329static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector, 410static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
330 unsigned group) 411 unsigned group)
331{ 412{
@@ -334,6 +415,9 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
334 int i; 415 int i;
335 416
336 pcs = pinctrl_dev_get_drvdata(pctldev); 417 pcs = pinctrl_dev_get_drvdata(pctldev);
418 /* If function mask is null, needn't enable it. */
419 if (!pcs->fmask)
420 return 0;
337 func = radix_tree_lookup(&pcs->ftree, fselector); 421 func = radix_tree_lookup(&pcs->ftree, fselector);
338 if (!func) 422 if (!func)
339 return -EINVAL; 423 return -EINVAL;
@@ -368,6 +452,10 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
368 int i; 452 int i;
369 453
370 pcs = pinctrl_dev_get_drvdata(pctldev); 454 pcs = pinctrl_dev_get_drvdata(pctldev);
455 /* If function mask is null, needn't disable it. */
456 if (!pcs->fmask)
457 return;
458
371 func = radix_tree_lookup(&pcs->ftree, fselector); 459 func = radix_tree_lookup(&pcs->ftree, fselector);
372 if (!func) { 460 if (!func) {
373 dev_err(pcs->dev, "%s could not find function%i\n", 461 dev_err(pcs->dev, "%s could not find function%i\n",
@@ -403,12 +491,33 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
403} 491}
404 492
405static int pcs_request_gpio(struct pinctrl_dev *pctldev, 493static int pcs_request_gpio(struct pinctrl_dev *pctldev,
406 struct pinctrl_gpio_range *range, unsigned offset) 494 struct pinctrl_gpio_range *range, unsigned pin)
407{ 495{
408 return -ENOTSUPP; 496 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
497 struct pcs_gpiofunc_range *frange = NULL;
498 struct list_head *pos, *tmp;
499 int mux_bytes = 0;
500 unsigned data;
501
502 /* If function mask is null, return directly. */
503 if (!pcs->fmask)
504 return -ENOTSUPP;
505
506 list_for_each_safe(pos, tmp, &pcs->gpiofuncs) {
507 frange = list_entry(pos, struct pcs_gpiofunc_range, node);
508 if (pin >= frange->offset + frange->npins
509 || pin < frange->offset)
510 continue;
511 mux_bytes = pcs->width / BITS_PER_BYTE;
512 data = pcs->read(pcs->base + pin * mux_bytes) & ~pcs->fmask;
513 data |= frange->gpiofunc;
514 pcs->write(data, pcs->base + pin * mux_bytes);
515 break;
516 }
517 return 0;
409} 518}
410 519
411static struct pinmux_ops pcs_pinmux_ops = { 520static const struct pinmux_ops pcs_pinmux_ops = {
412 .get_functions_count = pcs_get_functions_count, 521 .get_functions_count = pcs_get_functions_count,
413 .get_function_name = pcs_get_function_name, 522 .get_function_name = pcs_get_function_name,
414 .get_function_groups = pcs_get_function_groups, 523 .get_function_groups = pcs_get_function_groups,
@@ -417,32 +526,191 @@ static struct pinmux_ops pcs_pinmux_ops = {
417 .gpio_request_enable = pcs_request_gpio, 526 .gpio_request_enable = pcs_request_gpio,
418}; 527};
419 528
529/* Clear BIAS value */
530static void pcs_pinconf_clear_bias(struct pinctrl_dev *pctldev, unsigned pin)
531{
532 unsigned long config;
533 int i;
534 for (i = 0; i < ARRAY_SIZE(pcs_bias); i++) {
535 config = pinconf_to_config_packed(pcs_bias[i], 0);
536 pcs_pinconf_set(pctldev, pin, config);
537 }
538}
539
540/*
541 * Check whether PIN_CONFIG_BIAS_DISABLE is valid.
542 * It's depend on that PULL_DOWN & PULL_UP configs are all invalid.
543 */
544static bool pcs_pinconf_bias_disable(struct pinctrl_dev *pctldev, unsigned pin)
545{
546 unsigned long config;
547 int i;
548
549 for (i = 0; i < ARRAY_SIZE(pcs_bias); i++) {
550 config = pinconf_to_config_packed(pcs_bias[i], 0);
551 if (!pcs_pinconf_get(pctldev, pin, &config))
552 goto out;
553 }
554 return true;
555out:
556 return false;
557}
558
420static int pcs_pinconf_get(struct pinctrl_dev *pctldev, 559static int pcs_pinconf_get(struct pinctrl_dev *pctldev,
421 unsigned pin, unsigned long *config) 560 unsigned pin, unsigned long *config)
422{ 561{
562 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
563 struct pcs_function *func;
564 enum pin_config_param param;
565 unsigned offset = 0, data = 0, i, j, ret;
566
567 ret = pcs_get_function(pctldev, pin, &func);
568 if (ret)
569 return ret;
570
571 for (i = 0; i < func->nconfs; i++) {
572 param = pinconf_to_config_param(*config);
573 if (param == PIN_CONFIG_BIAS_DISABLE) {
574 if (pcs_pinconf_bias_disable(pctldev, pin)) {
575 *config = 0;
576 return 0;
577 } else {
578 return -ENOTSUPP;
579 }
580 } else if (param != func->conf[i].param) {
581 continue;
582 }
583
584 offset = pin * (pcs->width / BITS_PER_BYTE);
585 data = pcs->read(pcs->base + offset) & func->conf[i].mask;
586 switch (func->conf[i].param) {
587 /* 4 parameters */
588 case PIN_CONFIG_BIAS_PULL_DOWN:
589 case PIN_CONFIG_BIAS_PULL_UP:
590 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
591 if ((data != func->conf[i].enable) ||
592 (data == func->conf[i].disable))
593 return -ENOTSUPP;
594 *config = 0;
595 break;
596 /* 2 parameters */
597 case PIN_CONFIG_INPUT_SCHMITT:
598 for (j = 0; j < func->nconfs; j++) {
599 switch (func->conf[j].param) {
600 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
601 if (data != func->conf[j].enable)
602 return -ENOTSUPP;
603 break;
604 default:
605 break;
606 }
607 }
608 *config = data;
609 break;
610 case PIN_CONFIG_DRIVE_STRENGTH:
611 case PIN_CONFIG_SLEW_RATE:
612 default:
613 *config = data;
614 break;
615 }
616 return 0;
617 }
423 return -ENOTSUPP; 618 return -ENOTSUPP;
424} 619}
425 620
426static int pcs_pinconf_set(struct pinctrl_dev *pctldev, 621static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
427 unsigned pin, unsigned long config) 622 unsigned pin, unsigned long config)
428{ 623{
624 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
625 struct pcs_function *func;
626 unsigned offset = 0, shift = 0, arg = 0, i, data, ret;
627 u16 argument;
628
629 ret = pcs_get_function(pctldev, pin, &func);
630 if (ret)
631 return ret;
632
633 for (i = 0; i < func->nconfs; i++) {
634 if (pinconf_to_config_param(config) == func->conf[i].param) {
635 offset = pin * (pcs->width / BITS_PER_BYTE);
636 data = pcs->read(pcs->base + offset);
637 argument = pinconf_to_config_argument(config);
638 switch (func->conf[i].param) {
639 /* 2 parameters */
640 case PIN_CONFIG_INPUT_SCHMITT:
641 case PIN_CONFIG_DRIVE_STRENGTH:
642 case PIN_CONFIG_SLEW_RATE:
643 shift = ffs(func->conf[i].mask) - 1;
644 arg = pinconf_to_config_argument(config);
645 data &= ~func->conf[i].mask;
646 data |= (arg << shift) & func->conf[i].mask;
647 break;
648 /* 4 parameters */
649 case PIN_CONFIG_BIAS_DISABLE:
650 pcs_pinconf_clear_bias(pctldev, pin);
651 break;
652 case PIN_CONFIG_BIAS_PULL_DOWN:
653 case PIN_CONFIG_BIAS_PULL_UP:
654 if (argument)
655 pcs_pinconf_clear_bias(pctldev, pin);
656 /* fall through */
657 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
658 data &= ~func->conf[i].mask;
659 if (argument)
660 data |= func->conf[i].enable;
661 else
662 data |= func->conf[i].disable;
663 break;
664 default:
665 return -ENOTSUPP;
666 }
667 pcs->write(data, pcs->base + offset);
668 return 0;
669 }
670 }
429 return -ENOTSUPP; 671 return -ENOTSUPP;
430} 672}
431 673
432static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev, 674static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev,
433 unsigned group, unsigned long *config) 675 unsigned group, unsigned long *config)
434{ 676{
435 return -ENOTSUPP; 677 const unsigned *pins;
678 unsigned npins, old = 0;
679 int i, ret;
680
681 ret = pcs_get_group_pins(pctldev, group, &pins, &npins);
682 if (ret)
683 return ret;
684 for (i = 0; i < npins; i++) {
685 if (pcs_pinconf_get(pctldev, pins[i], config))
686 return -ENOTSUPP;
687 /* configs do not match between two pins */
688 if (i && (old != *config))
689 return -ENOTSUPP;
690 old = *config;
691 }
692 return 0;
436} 693}
437 694
438static int pcs_pinconf_group_set(struct pinctrl_dev *pctldev, 695static int pcs_pinconf_group_set(struct pinctrl_dev *pctldev,
439 unsigned group, unsigned long config) 696 unsigned group, unsigned long config)
440{ 697{
441 return -ENOTSUPP; 698 const unsigned *pins;
699 unsigned npins;
700 int i, ret;
701
702 ret = pcs_get_group_pins(pctldev, group, &pins, &npins);
703 if (ret)
704 return ret;
705 for (i = 0; i < npins; i++) {
706 if (pcs_pinconf_set(pctldev, pins[i], config))
707 return -ENOTSUPP;
708 }
709 return 0;
442} 710}
443 711
444static void pcs_pinconf_dbg_show(struct pinctrl_dev *pctldev, 712static void pcs_pinconf_dbg_show(struct pinctrl_dev *pctldev,
445 struct seq_file *s, unsigned offset) 713 struct seq_file *s, unsigned pin)
446{ 714{
447} 715}
448 716
@@ -451,13 +719,22 @@ static void pcs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
451{ 719{
452} 720}
453 721
454static struct pinconf_ops pcs_pinconf_ops = { 722static void pcs_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
723 struct seq_file *s,
724 unsigned long config)
725{
726 pinconf_generic_dump_config(pctldev, s, config);
727}
728
729static const struct pinconf_ops pcs_pinconf_ops = {
455 .pin_config_get = pcs_pinconf_get, 730 .pin_config_get = pcs_pinconf_get,
456 .pin_config_set = pcs_pinconf_set, 731 .pin_config_set = pcs_pinconf_set,
457 .pin_config_group_get = pcs_pinconf_group_get, 732 .pin_config_group_get = pcs_pinconf_group_get,
458 .pin_config_group_set = pcs_pinconf_group_set, 733 .pin_config_group_set = pcs_pinconf_group_set,
459 .pin_config_dbg_show = pcs_pinconf_dbg_show, 734 .pin_config_dbg_show = pcs_pinconf_dbg_show,
460 .pin_config_group_dbg_show = pcs_pinconf_group_dbg_show, 735 .pin_config_group_dbg_show = pcs_pinconf_group_dbg_show,
736 .pin_config_config_dbg_show = pcs_pinconf_config_dbg_show,
737 .is_generic = true,
461}; 738};
462 739
463/** 740/**
@@ -648,11 +925,157 @@ static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset)
648 return index; 925 return index;
649} 926}
650 927
928/*
929 * check whether data matches enable bits or disable bits
930 * Return value: 1 for matching enable bits, 0 for matching disable bits,
931 * and negative value for matching failure.
932 */
933static int pcs_config_match(unsigned data, unsigned enable, unsigned disable)
934{
935 int ret = -EINVAL;
936
937 if (data == enable)
938 ret = 1;
939 else if (data == disable)
940 ret = 0;
941 return ret;
942}
943
944static void add_config(struct pcs_conf_vals **conf, enum pin_config_param param,
945 unsigned value, unsigned enable, unsigned disable,
946 unsigned mask)
947{
948 (*conf)->param = param;
949 (*conf)->val = value;
950 (*conf)->enable = enable;
951 (*conf)->disable = disable;
952 (*conf)->mask = mask;
953 (*conf)++;
954}
955
956static void add_setting(unsigned long **setting, enum pin_config_param param,
957 unsigned arg)
958{
959 **setting = pinconf_to_config_packed(param, arg);
960 (*setting)++;
961}
962
963/* add pinconf setting with 2 parameters */
964static void pcs_add_conf2(struct pcs_device *pcs, struct device_node *np,
965 const char *name, enum pin_config_param param,
966 struct pcs_conf_vals **conf, unsigned long **settings)
967{
968 unsigned value[2];
969 int ret;
970
971 ret = of_property_read_u32_array(np, name, value, 2);
972 if (ret)
973 return;
974 /* set value & mask */
975 value[0] &= value[1];
976 /* skip enable & disable */
977 add_config(conf, param, value[0], 0, 0, value[1]);
978 add_setting(settings, param, value[0]);
979}
980
981/* add pinconf setting with 4 parameters */
982static void pcs_add_conf4(struct pcs_device *pcs, struct device_node *np,
983 const char *name, enum pin_config_param param,
984 struct pcs_conf_vals **conf, unsigned long **settings)
985{
986 unsigned value[4];
987 int ret;
988
989 /* value to set, enable, disable, mask */
990 ret = of_property_read_u32_array(np, name, value, 4);
991 if (ret)
992 return;
993 if (!value[3]) {
994 dev_err(pcs->dev, "mask field of the property can't be 0\n");
995 return;
996 }
997 value[0] &= value[3];
998 value[1] &= value[3];
999 value[2] &= value[3];
1000 ret = pcs_config_match(value[0], value[1], value[2]);
1001 if (ret < 0)
1002 dev_dbg(pcs->dev, "failed to match enable or disable bits\n");
1003 add_config(conf, param, value[0], value[1], value[2], value[3]);
1004 add_setting(settings, param, ret);
1005}
1006
1007static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
1008 struct pcs_function *func,
1009 struct pinctrl_map **map)
1010
1011{
1012 struct pinctrl_map *m = *map;
1013 int i = 0, nconfs = 0;
1014 unsigned long *settings = NULL, *s = NULL;
1015 struct pcs_conf_vals *conf = NULL;
1016 struct pcs_conf_type prop2[] = {
1017 { "pinctrl-single,drive-strength", PIN_CONFIG_DRIVE_STRENGTH, },
1018 { "pinctrl-single,slew-rate", PIN_CONFIG_SLEW_RATE, },
1019 { "pinctrl-single,input-schmitt", PIN_CONFIG_INPUT_SCHMITT, },
1020 };
1021 struct pcs_conf_type prop4[] = {
1022 { "pinctrl-single,bias-pullup", PIN_CONFIG_BIAS_PULL_UP, },
1023 { "pinctrl-single,bias-pulldown", PIN_CONFIG_BIAS_PULL_DOWN, },
1024 { "pinctrl-single,input-schmitt-enable",
1025 PIN_CONFIG_INPUT_SCHMITT_ENABLE, },
1026 };
1027
1028 /* If pinconf isn't supported, don't parse properties in below. */
1029 if (!pcs->is_pinconf)
1030 return 0;
1031
1032 /* cacluate how much properties are supported in current node */
1033 for (i = 0; i < ARRAY_SIZE(prop2); i++) {
1034 if (of_find_property(np, prop2[i].name, NULL))
1035 nconfs++;
1036 }
1037 for (i = 0; i < ARRAY_SIZE(prop4); i++) {
1038 if (of_find_property(np, prop4[i].name, NULL))
1039 nconfs++;
1040 }
1041 if (!nconfs)
1042 return 0;
1043
1044 func->conf = devm_kzalloc(pcs->dev,
1045 sizeof(struct pcs_conf_vals) * nconfs,
1046 GFP_KERNEL);
1047 if (!func->conf)
1048 return -ENOMEM;
1049 func->nconfs = nconfs;
1050 conf = &(func->conf[0]);
1051 m++;
1052 settings = devm_kzalloc(pcs->dev, sizeof(unsigned long) * nconfs,
1053 GFP_KERNEL);
1054 if (!settings)
1055 return -ENOMEM;
1056 s = &settings[0];
1057
1058 for (i = 0; i < ARRAY_SIZE(prop2); i++)
1059 pcs_add_conf2(pcs, np, prop2[i].name, prop2[i].param,
1060 &conf, &s);
1061 for (i = 0; i < ARRAY_SIZE(prop4); i++)
1062 pcs_add_conf4(pcs, np, prop4[i].name, prop4[i].param,
1063 &conf, &s);
1064 m->type = PIN_MAP_TYPE_CONFIGS_GROUP;
1065 m->data.configs.group_or_pin = np->name;
1066 m->data.configs.configs = settings;
1067 m->data.configs.num_configs = nconfs;
1068 return 0;
1069}
1070
1071static void pcs_free_pingroups(struct pcs_device *pcs);
1072
651/** 1073/**
652 * smux_parse_one_pinctrl_entry() - parses a device tree mux entry 1074 * smux_parse_one_pinctrl_entry() - parses a device tree mux entry
653 * @pcs: pinctrl driver instance 1075 * @pcs: pinctrl driver instance
654 * @np: device node of the mux entry 1076 * @np: device node of the mux entry
655 * @map: map entry 1077 * @map: map entry
1078 * @num_maps: number of map
656 * @pgnames: pingroup names 1079 * @pgnames: pingroup names
657 * 1080 *
658 * Note that this binding currently supports only sets of one register + value. 1081 * Note that this binding currently supports only sets of one register + value.
@@ -669,6 +1092,7 @@ static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset)
669static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, 1092static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
670 struct device_node *np, 1093 struct device_node *np,
671 struct pinctrl_map **map, 1094 struct pinctrl_map **map,
1095 unsigned *num_maps,
672 const char **pgnames) 1096 const char **pgnames)
673{ 1097{
674 struct pcs_func_vals *vals; 1098 struct pcs_func_vals *vals;
@@ -741,8 +1165,18 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
741 (*map)->data.mux.group = np->name; 1165 (*map)->data.mux.group = np->name;
742 (*map)->data.mux.function = np->name; 1166 (*map)->data.mux.function = np->name;
743 1167
1168 if (pcs->is_pinconf) {
1169 if (pcs_parse_pinconf(pcs, np, function, map))
1170 goto free_pingroups;
1171 *num_maps = 2;
1172 } else {
1173 *num_maps = 1;
1174 }
744 return 0; 1175 return 0;
745 1176
1177free_pingroups:
1178 pcs_free_pingroups(pcs);
1179 *num_maps = 1;
746free_function: 1180free_function:
747 pcs_remove_function(pcs, function); 1181 pcs_remove_function(pcs, function);
748 1182
@@ -771,7 +1205,8 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
771 1205
772 pcs = pinctrl_dev_get_drvdata(pctldev); 1206 pcs = pinctrl_dev_get_drvdata(pctldev);
773 1207
774 *map = devm_kzalloc(pcs->dev, sizeof(**map), GFP_KERNEL); 1208 /* create 2 maps. One is for pinmux, and the other is for pinconf. */
1209 *map = devm_kzalloc(pcs->dev, sizeof(**map) * 2, GFP_KERNEL);
775 if (!*map) 1210 if (!*map)
776 return -ENOMEM; 1211 return -ENOMEM;
777 1212
@@ -783,13 +1218,13 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
783 goto free_map; 1218 goto free_map;
784 } 1219 }
785 1220
786 ret = pcs_parse_one_pinctrl_entry(pcs, np_config, map, pgnames); 1221 ret = pcs_parse_one_pinctrl_entry(pcs, np_config, map, num_maps,
1222 pgnames);
787 if (ret < 0) { 1223 if (ret < 0) {
788 dev_err(pcs->dev, "no pins entries for %s\n", 1224 dev_err(pcs->dev, "no pins entries for %s\n",
789 np_config->name); 1225 np_config->name);
790 goto free_pgnames; 1226 goto free_pgnames;
791 } 1227 }
792 *num_maps = 1;
793 1228
794 return 0; 1229 return 0;
795 1230
@@ -879,6 +1314,37 @@ static void pcs_free_resources(struct pcs_device *pcs)
879 1314
880static struct of_device_id pcs_of_match[]; 1315static struct of_device_id pcs_of_match[];
881 1316
1317static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs)
1318{
1319 const char *propname = "pinctrl-single,gpio-range";
1320 const char *cellname = "#pinctrl-single,gpio-range-cells";
1321 struct of_phandle_args gpiospec;
1322 struct pcs_gpiofunc_range *range;
1323 int ret, i;
1324
1325 for (i = 0; ; i++) {
1326 ret = of_parse_phandle_with_args(node, propname, cellname,
1327 i, &gpiospec);
1328 /* Do not treat it as error. Only treat it as end condition. */
1329 if (ret) {
1330 ret = 0;
1331 break;
1332 }
1333 range = devm_kzalloc(pcs->dev, sizeof(*range), GFP_KERNEL);
1334 if (!range) {
1335 ret = -ENOMEM;
1336 break;
1337 }
1338 range->offset = gpiospec.args[0];
1339 range->npins = gpiospec.args[1];
1340 range->gpiofunc = gpiospec.args[2];
1341 mutex_lock(&pcs->mutex);
1342 list_add_tail(&range->node, &pcs->gpiofuncs);
1343 mutex_unlock(&pcs->mutex);
1344 }
1345 return ret;
1346}
1347
882static int pcs_probe(struct platform_device *pdev) 1348static int pcs_probe(struct platform_device *pdev)
883{ 1349{
884 struct device_node *np = pdev->dev.of_node; 1350 struct device_node *np = pdev->dev.of_node;
@@ -900,14 +1366,23 @@ static int pcs_probe(struct platform_device *pdev)
900 mutex_init(&pcs->mutex); 1366 mutex_init(&pcs->mutex);
901 INIT_LIST_HEAD(&pcs->pingroups); 1367 INIT_LIST_HEAD(&pcs->pingroups);
902 INIT_LIST_HEAD(&pcs->functions); 1368 INIT_LIST_HEAD(&pcs->functions);
1369 INIT_LIST_HEAD(&pcs->gpiofuncs);
1370 pcs->is_pinconf = match->data;
903 1371
904 PCS_GET_PROP_U32("pinctrl-single,register-width", &pcs->width, 1372 PCS_GET_PROP_U32("pinctrl-single,register-width", &pcs->width,
905 "register width not specified\n"); 1373 "register width not specified\n");
906 1374
907 PCS_GET_PROP_U32("pinctrl-single,function-mask", &pcs->fmask, 1375 ret = of_property_read_u32(np, "pinctrl-single,function-mask",
908 "function register mask not specified\n"); 1376 &pcs->fmask);
909 pcs->fshift = ffs(pcs->fmask) - 1; 1377 if (!ret) {
910 pcs->fmax = pcs->fmask >> pcs->fshift; 1378 pcs->fshift = ffs(pcs->fmask) - 1;
1379 pcs->fmax = pcs->fmask >> pcs->fshift;
1380 } else {
1381 /* If mask property doesn't exist, function mux is invalid. */
1382 pcs->fmask = 0;
1383 pcs->fshift = 0;
1384 pcs->fmax = 0;
1385 }
911 1386
912 ret = of_property_read_u32(np, "pinctrl-single,function-off", 1387 ret = of_property_read_u32(np, "pinctrl-single,function-off",
913 &pcs->foff); 1388 &pcs->foff);
@@ -961,7 +1436,8 @@ static int pcs_probe(struct platform_device *pdev)
961 pcs->desc.name = DRIVER_NAME; 1436 pcs->desc.name = DRIVER_NAME;
962 pcs->desc.pctlops = &pcs_pinctrl_ops; 1437 pcs->desc.pctlops = &pcs_pinctrl_ops;
963 pcs->desc.pmxops = &pcs_pinmux_ops; 1438 pcs->desc.pmxops = &pcs_pinmux_ops;
964 pcs->desc.confops = &pcs_pinconf_ops; 1439 if (pcs->is_pinconf)
1440 pcs->desc.confops = &pcs_pinconf_ops;
965 pcs->desc.owner = THIS_MODULE; 1441 pcs->desc.owner = THIS_MODULE;
966 1442
967 ret = pcs_allocate_pin_table(pcs); 1443 ret = pcs_allocate_pin_table(pcs);
@@ -975,6 +1451,10 @@ static int pcs_probe(struct platform_device *pdev)
975 goto free; 1451 goto free;
976 } 1452 }
977 1453
1454 ret = pcs_add_gpio_func(np, pcs);
1455 if (ret < 0)
1456 goto free;
1457
978 dev_info(pcs->dev, "%i pins at pa %p size %u\n", 1458 dev_info(pcs->dev, "%i pins at pa %p size %u\n",
979 pcs->desc.npins, pcs->base, pcs->size); 1459 pcs->desc.npins, pcs->base, pcs->size);
980 1460
@@ -999,7 +1479,8 @@ static int pcs_remove(struct platform_device *pdev)
999} 1479}
1000 1480
1001static struct of_device_id pcs_of_match[] = { 1481static struct of_device_id pcs_of_match[] = {
1002 { .compatible = DRIVER_NAME, }, 1482 { .compatible = "pinctrl-single", .data = (void *)false },
1483 { .compatible = "pinconf-single", .data = (void *)true },
1003 { }, 1484 { },
1004}; 1485};
1005MODULE_DEVICE_TABLE(of, pcs_of_match); 1486MODULE_DEVICE_TABLE(of, pcs_of_match);
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index d02498b30c6e..0990a721758e 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -979,7 +979,7 @@ static void sirfsoc_dt_free_map(struct pinctrl_dev *pctldev,
979 kfree(map); 979 kfree(map);
980} 980}
981 981
982static struct pinctrl_ops sirfsoc_pctrl_ops = { 982static const struct pinctrl_ops sirfsoc_pctrl_ops = {
983 .get_groups_count = sirfsoc_get_groups_count, 983 .get_groups_count = sirfsoc_get_groups_count,
984 .get_group_name = sirfsoc_get_group_name, 984 .get_group_name = sirfsoc_get_group_name,
985 .get_group_pins = sirfsoc_get_group_pins, 985 .get_group_pins = sirfsoc_get_group_pins,
@@ -1181,7 +1181,7 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
1181 return 0; 1181 return 0;
1182} 1182}
1183 1183
1184static struct pinmux_ops sirfsoc_pinmux_ops = { 1184static const struct pinmux_ops sirfsoc_pinmux_ops = {
1185 .enable = sirfsoc_pinmux_enable, 1185 .enable = sirfsoc_pinmux_enable,
1186 .disable = sirfsoc_pinmux_disable, 1186 .disable = sirfsoc_pinmux_disable,
1187 .get_functions_count = sirfsoc_pinmux_get_funcs_count, 1187 .get_functions_count = sirfsoc_pinmux_get_funcs_count,
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index 80b11e3415bc..cb491d6ba601 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -30,482 +30,856 @@
30static const struct sunxi_desc_pin sun4i_a10_pins[] = { 30static const struct sunxi_desc_pin sun4i_a10_pins[] = {
31 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA0, 31 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA0,
32 SUNXI_FUNCTION(0x0, "gpio_in"), 32 SUNXI_FUNCTION(0x0, "gpio_in"),
33 SUNXI_FUNCTION(0x1, "gpio_out")), 33 SUNXI_FUNCTION(0x1, "gpio_out"),
34 SUNXI_FUNCTION(0x2, "wemac"), /* ERXD3 */
35 SUNXI_FUNCTION(0x3, "spi1"), /* CS0 */
36 SUNXI_FUNCTION(0x4, "uart2")), /* RTS */
34 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA1, 37 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA1,
35 SUNXI_FUNCTION(0x0, "gpio_in"), 38 SUNXI_FUNCTION(0x0, "gpio_in"),
36 SUNXI_FUNCTION(0x1, "gpio_out")), 39 SUNXI_FUNCTION(0x1, "gpio_out"),
40 SUNXI_FUNCTION(0x2, "wemac"), /* ERXD2 */
41 SUNXI_FUNCTION(0x3, "spi1"), /* CLK */
42 SUNXI_FUNCTION(0x4, "uart2")), /* CTS */
37 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA2, 43 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA2,
38 SUNXI_FUNCTION(0x0, "gpio_in"), 44 SUNXI_FUNCTION(0x0, "gpio_in"),
39 SUNXI_FUNCTION(0x1, "gpio_out")), 45 SUNXI_FUNCTION(0x1, "gpio_out"),
46 SUNXI_FUNCTION(0x2, "wemac"), /* ERXD1 */
47 SUNXI_FUNCTION(0x3, "spi1"), /* MOSI */
48 SUNXI_FUNCTION(0x4, "uart2")), /* TX */
40 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA3, 49 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA3,
41 SUNXI_FUNCTION(0x0, "gpio_in"), 50 SUNXI_FUNCTION(0x0, "gpio_in"),
42 SUNXI_FUNCTION(0x1, "gpio_out")), 51 SUNXI_FUNCTION(0x1, "gpio_out"),
52 SUNXI_FUNCTION(0x2, "wemac"), /* ERXD0 */
53 SUNXI_FUNCTION(0x3, "spi1"), /* MISO */
54 SUNXI_FUNCTION(0x4, "uart2")), /* RX */
43 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA4, 55 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA4,
44 SUNXI_FUNCTION(0x0, "gpio_in"), 56 SUNXI_FUNCTION(0x0, "gpio_in"),
45 SUNXI_FUNCTION(0x1, "gpio_out")), 57 SUNXI_FUNCTION(0x1, "gpio_out"),
58 SUNXI_FUNCTION(0x2, "wemac"), /* ETXD3 */
59 SUNXI_FUNCTION(0x3, "spi1")), /* CS1 */
46 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA5, 60 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA5,
47 SUNXI_FUNCTION(0x0, "gpio_in"), 61 SUNXI_FUNCTION(0x0, "gpio_in"),
48 SUNXI_FUNCTION(0x1, "gpio_out")), 62 SUNXI_FUNCTION(0x1, "gpio_out"),
63 SUNXI_FUNCTION(0x2, "wemac"), /* ETXD2 */
64 SUNXI_FUNCTION(0x3, "spi3")), /* CS0 */
49 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA6, 65 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA6,
50 SUNXI_FUNCTION(0x0, "gpio_in"), 66 SUNXI_FUNCTION(0x0, "gpio_in"),
51 SUNXI_FUNCTION(0x1, "gpio_out")), 67 SUNXI_FUNCTION(0x1, "gpio_out"),
68 SUNXI_FUNCTION(0x2, "wemac"), /* ETXD1 */
69 SUNXI_FUNCTION(0x3, "spi3")), /* CLK */
52 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA7, 70 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA7,
53 SUNXI_FUNCTION(0x0, "gpio_in"), 71 SUNXI_FUNCTION(0x0, "gpio_in"),
54 SUNXI_FUNCTION(0x1, "gpio_out")), 72 SUNXI_FUNCTION(0x1, "gpio_out"),
73 SUNXI_FUNCTION(0x2, "wemac"), /* ETXD0 */
74 SUNXI_FUNCTION(0x3, "spi3")), /* MOSI */
55 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA8, 75 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA8,
56 SUNXI_FUNCTION(0x0, "gpio_in"), 76 SUNXI_FUNCTION(0x0, "gpio_in"),
57 SUNXI_FUNCTION(0x1, "gpio_out")), 77 SUNXI_FUNCTION(0x1, "gpio_out"),
78 SUNXI_FUNCTION(0x2, "wemac"), /* ERXCK */
79 SUNXI_FUNCTION(0x3, "spi3")), /* MISO */
58 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA9, 80 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA9,
59 SUNXI_FUNCTION(0x0, "gpio_in"), 81 SUNXI_FUNCTION(0x0, "gpio_in"),
60 SUNXI_FUNCTION(0x1, "gpio_out")), 82 SUNXI_FUNCTION(0x1, "gpio_out"),
83 SUNXI_FUNCTION(0x2, "wemac"), /* ERXERR */
84 SUNXI_FUNCTION(0x3, "spi3")), /* CS1 */
61 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA10, 85 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA10,
62 SUNXI_FUNCTION(0x0, "gpio_in"), 86 SUNXI_FUNCTION(0x0, "gpio_in"),
63 SUNXI_FUNCTION(0x1, "gpio_out"), 87 SUNXI_FUNCTION(0x1, "gpio_out"),
88 SUNXI_FUNCTION(0x2, "wemac"), /* ERXDV */
64 SUNXI_FUNCTION(0x4, "uart1")), /* TX */ 89 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
65 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA11, 90 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA11,
66 SUNXI_FUNCTION(0x0, "gpio_in"), 91 SUNXI_FUNCTION(0x0, "gpio_in"),
67 SUNXI_FUNCTION(0x1, "gpio_out"), 92 SUNXI_FUNCTION(0x1, "gpio_out"),
93 SUNXI_FUNCTION(0x2, "wemac"), /* EMDC */
68 SUNXI_FUNCTION(0x4, "uart1")), /* RX */ 94 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
69 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA12, 95 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA12,
70 SUNXI_FUNCTION(0x0, "gpio_in"), 96 SUNXI_FUNCTION(0x0, "gpio_in"),
71 SUNXI_FUNCTION(0x1, "gpio_out"), 97 SUNXI_FUNCTION(0x1, "gpio_out"),
98 SUNXI_FUNCTION(0x2, "wemac"), /* EMDIO */
99 SUNXI_FUNCTION(0x3, "uart6"), /* TX */
72 SUNXI_FUNCTION(0x4, "uart1")), /* RTS */ 100 SUNXI_FUNCTION(0x4, "uart1")), /* RTS */
73 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA13, 101 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA13,
74 SUNXI_FUNCTION(0x0, "gpio_in"), 102 SUNXI_FUNCTION(0x0, "gpio_in"),
75 SUNXI_FUNCTION(0x1, "gpio_out"), 103 SUNXI_FUNCTION(0x1, "gpio_out"),
104 SUNXI_FUNCTION(0x2, "wemac"), /* ETXEN */
105 SUNXI_FUNCTION(0x3, "uart6"), /* RX */
76 SUNXI_FUNCTION(0x4, "uart1")), /* CTS */ 106 SUNXI_FUNCTION(0x4, "uart1")), /* CTS */
77 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA14, 107 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA14,
78 SUNXI_FUNCTION(0x0, "gpio_in"), 108 SUNXI_FUNCTION(0x0, "gpio_in"),
79 SUNXI_FUNCTION(0x1, "gpio_out"), 109 SUNXI_FUNCTION(0x1, "gpio_out"),
110 SUNXI_FUNCTION(0x2, "wemac"), /* ETXCK */
111 SUNXI_FUNCTION(0x3, "uart7"), /* TX */
80 SUNXI_FUNCTION(0x4, "uart1")), /* DTR */ 112 SUNXI_FUNCTION(0x4, "uart1")), /* DTR */
81 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA15, 113 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA15,
82 SUNXI_FUNCTION(0x0, "gpio_in"), 114 SUNXI_FUNCTION(0x0, "gpio_in"),
83 SUNXI_FUNCTION(0x1, "gpio_out"), 115 SUNXI_FUNCTION(0x1, "gpio_out"),
116 SUNXI_FUNCTION(0x2, "wemac"), /* ECRS */
117 SUNXI_FUNCTION(0x3, "uart7"), /* RX */
84 SUNXI_FUNCTION(0x4, "uart1")), /* DSR */ 118 SUNXI_FUNCTION(0x4, "uart1")), /* DSR */
85 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA16, 119 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA16,
86 SUNXI_FUNCTION(0x0, "gpio_in"), 120 SUNXI_FUNCTION(0x0, "gpio_in"),
87 SUNXI_FUNCTION(0x1, "gpio_out"), 121 SUNXI_FUNCTION(0x1, "gpio_out"),
122 SUNXI_FUNCTION(0x2, "wemac"), /* ECOL */
123 SUNXI_FUNCTION(0x3, "can"), /* TX */
88 SUNXI_FUNCTION(0x4, "uart1")), /* DCD */ 124 SUNXI_FUNCTION(0x4, "uart1")), /* DCD */
89 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA17, 125 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA17,
90 SUNXI_FUNCTION(0x0, "gpio_in"), 126 SUNXI_FUNCTION(0x0, "gpio_in"),
91 SUNXI_FUNCTION(0x1, "gpio_out"), 127 SUNXI_FUNCTION(0x1, "gpio_out"),
128 SUNXI_FUNCTION(0x2, "wemac"), /* ETXERR */
129 SUNXI_FUNCTION(0x3, "can"), /* RX */
92 SUNXI_FUNCTION(0x4, "uart1")), /* RING */ 130 SUNXI_FUNCTION(0x4, "uart1")), /* RING */
93 /* Hole */ 131 /* Hole */
94 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0, 132 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0,
95 SUNXI_FUNCTION(0x0, "gpio_in"), 133 SUNXI_FUNCTION(0x0, "gpio_in"),
96 SUNXI_FUNCTION(0x1, "gpio_out")), 134 SUNXI_FUNCTION(0x1, "gpio_out"),
135 SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
97 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1, 136 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1,
98 SUNXI_FUNCTION(0x0, "gpio_in"), 137 SUNXI_FUNCTION(0x0, "gpio_in"),
99 SUNXI_FUNCTION(0x1, "gpio_out")), 138 SUNXI_FUNCTION(0x1, "gpio_out"),
139 SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
100 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2, 140 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2,
101 SUNXI_FUNCTION(0x0, "gpio_in"), 141 SUNXI_FUNCTION(0x0, "gpio_in"),
102 SUNXI_FUNCTION(0x1, "gpio_out")), 142 SUNXI_FUNCTION(0x1, "gpio_out"),
143 SUNXI_FUNCTION(0x2, "pwm")), /* PWM0 */
103 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3, 144 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3,
104 SUNXI_FUNCTION(0x0, "gpio_in"), 145 SUNXI_FUNCTION(0x0, "gpio_in"),
105 SUNXI_FUNCTION(0x1, "gpio_out")), 146 SUNXI_FUNCTION(0x1, "gpio_out"),
147 SUNXI_FUNCTION(0x2, "ir0")), /* TX */
106 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4, 148 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4,
107 SUNXI_FUNCTION(0x0, "gpio_in"), 149 SUNXI_FUNCTION(0x0, "gpio_in"),
108 SUNXI_FUNCTION(0x1, "gpio_out")), 150 SUNXI_FUNCTION(0x1, "gpio_out"),
151 SUNXI_FUNCTION(0x2, "ir0")), /* RX */
109 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB5, 152 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB5,
110 SUNXI_FUNCTION(0x0, "gpio_in"), 153 SUNXI_FUNCTION(0x0, "gpio_in"),
111 SUNXI_FUNCTION(0x1, "gpio_out")), 154 SUNXI_FUNCTION(0x1, "gpio_out"),
155 SUNXI_FUNCTION(0x2, "i2s"), /* MCLK */
156 SUNXI_FUNCTION(0x3, "ac97")), /* MCLK */
112 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB6, 157 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB6,
113 SUNXI_FUNCTION(0x0, "gpio_in"), 158 SUNXI_FUNCTION(0x0, "gpio_in"),
114 SUNXI_FUNCTION(0x1, "gpio_out")), 159 SUNXI_FUNCTION(0x1, "gpio_out"),
160 SUNXI_FUNCTION(0x2, "i2s"), /* BCLK */
161 SUNXI_FUNCTION(0x3, "ac97")), /* BCLK */
115 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB7, 162 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB7,
116 SUNXI_FUNCTION(0x0, "gpio_in"), 163 SUNXI_FUNCTION(0x0, "gpio_in"),
117 SUNXI_FUNCTION(0x1, "gpio_out")), 164 SUNXI_FUNCTION(0x1, "gpio_out"),
165 SUNXI_FUNCTION(0x2, "i2s"), /* LRCK */
166 SUNXI_FUNCTION(0x3, "ac97")), /* SYNC */
118 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB8, 167 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB8,
119 SUNXI_FUNCTION(0x0, "gpio_in"), 168 SUNXI_FUNCTION(0x0, "gpio_in"),
120 SUNXI_FUNCTION(0x1, "gpio_out")), 169 SUNXI_FUNCTION(0x1, "gpio_out"),
170 SUNXI_FUNCTION(0x2, "i2s"), /* DO0 */
171 SUNXI_FUNCTION(0x3, "ac97")), /* DO */
121 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB9, 172 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB9,
122 SUNXI_FUNCTION(0x0, "gpio_in"), 173 SUNXI_FUNCTION(0x0, "gpio_in"),
123 SUNXI_FUNCTION(0x1, "gpio_out")), 174 SUNXI_FUNCTION(0x1, "gpio_out"),
175 SUNXI_FUNCTION(0x2, "i2s")), /* DO1 */
124 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10, 176 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10,
125 SUNXI_FUNCTION(0x0, "gpio_in"), 177 SUNXI_FUNCTION(0x0, "gpio_in"),
126 SUNXI_FUNCTION(0x1, "gpio_out")), 178 SUNXI_FUNCTION(0x1, "gpio_out"),
179 SUNXI_FUNCTION(0x2, "i2s")), /* DO2 */
127 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB11, 180 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB11,
128 SUNXI_FUNCTION(0x0, "gpio_in"), 181 SUNXI_FUNCTION(0x0, "gpio_in"),
129 SUNXI_FUNCTION(0x1, "gpio_out")), 182 SUNXI_FUNCTION(0x1, "gpio_out"),
183 SUNXI_FUNCTION(0x2, "i2s")), /* DO3 */
130 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB12, 184 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB12,
131 SUNXI_FUNCTION(0x0, "gpio_in"), 185 SUNXI_FUNCTION(0x0, "gpio_in"),
132 SUNXI_FUNCTION(0x1, "gpio_out")), 186 SUNXI_FUNCTION(0x1, "gpio_out"),
187 SUNXI_FUNCTION(0x2, "i2s"), /* DI */
188 SUNXI_FUNCTION(0x3, "ac97")), /* DI */
133 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB13, 189 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB13,
134 SUNXI_FUNCTION(0x0, "gpio_in"), 190 SUNXI_FUNCTION(0x0, "gpio_in"),
135 SUNXI_FUNCTION(0x1, "gpio_out")), 191 SUNXI_FUNCTION(0x1, "gpio_out"),
192 SUNXI_FUNCTION(0x2, "spi2")), /* CS1 */
136 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB14, 193 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB14,
137 SUNXI_FUNCTION(0x0, "gpio_in"), 194 SUNXI_FUNCTION(0x0, "gpio_in"),
138 SUNXI_FUNCTION(0x1, "gpio_out")), 195 SUNXI_FUNCTION(0x1, "gpio_out"),
196 SUNXI_FUNCTION(0x2, "spi2"), /* CS0 */
197 SUNXI_FUNCTION(0x3, "jtag")), /* MS0 */
139 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15, 198 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15,
140 SUNXI_FUNCTION(0x0, "gpio_in"), 199 SUNXI_FUNCTION(0x0, "gpio_in"),
141 SUNXI_FUNCTION(0x1, "gpio_out")), 200 SUNXI_FUNCTION(0x1, "gpio_out"),
201 SUNXI_FUNCTION(0x2, "spi2"), /* CLK */
202 SUNXI_FUNCTION(0x3, "jtag")), /* CK0 */
142 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16, 203 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16,
143 SUNXI_FUNCTION(0x0, "gpio_in"), 204 SUNXI_FUNCTION(0x0, "gpio_in"),
144 SUNXI_FUNCTION(0x1, "gpio_out")), 205 SUNXI_FUNCTION(0x1, "gpio_out"),
206 SUNXI_FUNCTION(0x2, "spi2"), /* MOSI */
207 SUNXI_FUNCTION(0x3, "jtag")), /* DO0 */
145 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17, 208 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17,
146 SUNXI_FUNCTION(0x0, "gpio_in"), 209 SUNXI_FUNCTION(0x0, "gpio_in"),
147 SUNXI_FUNCTION(0x1, "gpio_out")), 210 SUNXI_FUNCTION(0x1, "gpio_out"),
211 SUNXI_FUNCTION(0x2, "spi2"), /* MISO */
212 SUNXI_FUNCTION(0x3, "jtag")), /* DI0 */
148 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18, 213 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18,
149 SUNXI_FUNCTION(0x0, "gpio_in"), 214 SUNXI_FUNCTION(0x0, "gpio_in"),
150 SUNXI_FUNCTION(0x1, "gpio_out")), 215 SUNXI_FUNCTION(0x1, "gpio_out"),
216 SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
151 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB19, 217 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB19,
152 SUNXI_FUNCTION(0x0, "gpio_in"), 218 SUNXI_FUNCTION(0x0, "gpio_in"),
153 SUNXI_FUNCTION(0x1, "gpio_out")), 219 SUNXI_FUNCTION(0x1, "gpio_out"),
220 SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
154 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB20, 221 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB20,
155 SUNXI_FUNCTION(0x0, "gpio_in"), 222 SUNXI_FUNCTION(0x0, "gpio_in"),
156 SUNXI_FUNCTION(0x1, "gpio_out")), 223 SUNXI_FUNCTION(0x1, "gpio_out"),
224 SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
157 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB21, 225 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB21,
158 SUNXI_FUNCTION(0x0, "gpio_in"), 226 SUNXI_FUNCTION(0x0, "gpio_in"),
159 SUNXI_FUNCTION(0x1, "gpio_out")), 227 SUNXI_FUNCTION(0x1, "gpio_out"),
228 SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
160 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB22, 229 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB22,
161 SUNXI_FUNCTION(0x0, "gpio_in"), 230 SUNXI_FUNCTION(0x0, "gpio_in"),
162 SUNXI_FUNCTION(0x1, "gpio_out"), 231 SUNXI_FUNCTION(0x1, "gpio_out"),
163 SUNXI_FUNCTION(0x2, "uart0")), /* TX */ 232 SUNXI_FUNCTION(0x2, "uart0"), /* TX */
233 SUNXI_FUNCTION(0x3, "ir1")), /* TX */
164 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB23, 234 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB23,
165 SUNXI_FUNCTION(0x0, "gpio_in"), 235 SUNXI_FUNCTION(0x0, "gpio_in"),
166 SUNXI_FUNCTION(0x1, "gpio_out"), 236 SUNXI_FUNCTION(0x1, "gpio_out"),
167 SUNXI_FUNCTION(0x2, "uart0")), /* RX */ 237 SUNXI_FUNCTION(0x2, "uart0"), /* RX */
238 SUNXI_FUNCTION(0x3, "ir1")), /* RX */
168 /* Hole */ 239 /* Hole */
169 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0, 240 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0,
170 SUNXI_FUNCTION(0x0, "gpio_in"), 241 SUNXI_FUNCTION(0x0, "gpio_in"),
171 SUNXI_FUNCTION(0x1, "gpio_out")), 242 SUNXI_FUNCTION(0x1, "gpio_out"),
243 SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
244 SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
172 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1, 245 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1,
173 SUNXI_FUNCTION(0x0, "gpio_in"), 246 SUNXI_FUNCTION(0x0, "gpio_in"),
174 SUNXI_FUNCTION(0x1, "gpio_out")), 247 SUNXI_FUNCTION(0x1, "gpio_out"),
248 SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
249 SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
175 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2, 250 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2,
176 SUNXI_FUNCTION(0x0, "gpio_in"), 251 SUNXI_FUNCTION(0x0, "gpio_in"),
177 SUNXI_FUNCTION(0x1, "gpio_out")), 252 SUNXI_FUNCTION(0x1, "gpio_out"),
253 SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
254 SUNXI_FUNCTION(0x3, "spi0")), /* SCK */
178 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3, 255 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3,
179 SUNXI_FUNCTION(0x0, "gpio_in"), 256 SUNXI_FUNCTION(0x0, "gpio_in"),
180 SUNXI_FUNCTION(0x1, "gpio_out")), 257 SUNXI_FUNCTION(0x1, "gpio_out"),
258 SUNXI_FUNCTION(0x2, "nand0")), /* NCE1 */
181 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4, 259 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4,
182 SUNXI_FUNCTION(0x0, "gpio_in"), 260 SUNXI_FUNCTION(0x0, "gpio_in"),
183 SUNXI_FUNCTION(0x1, "gpio_out")), 261 SUNXI_FUNCTION(0x1, "gpio_out"),
262 SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
184 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5, 263 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5,
185 SUNXI_FUNCTION(0x0, "gpio_in"), 264 SUNXI_FUNCTION(0x0, "gpio_in"),
186 SUNXI_FUNCTION(0x1, "gpio_out")), 265 SUNXI_FUNCTION(0x1, "gpio_out"),
266 SUNXI_FUNCTION(0x2, "nand0")), /* NRE# */
187 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6, 267 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6,
188 SUNXI_FUNCTION(0x0, "gpio_in"), 268 SUNXI_FUNCTION(0x0, "gpio_in"),
189 SUNXI_FUNCTION(0x1, "gpio_out")), 269 SUNXI_FUNCTION(0x1, "gpio_out"),
270 SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
271 SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
190 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7, 272 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7,
191 SUNXI_FUNCTION(0x0, "gpio_in"), 273 SUNXI_FUNCTION(0x0, "gpio_in"),
192 SUNXI_FUNCTION(0x1, "gpio_out")), 274 SUNXI_FUNCTION(0x1, "gpio_out"),
275 SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
276 SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
193 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8, 277 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8,
194 SUNXI_FUNCTION(0x0, "gpio_in"), 278 SUNXI_FUNCTION(0x0, "gpio_in"),
195 SUNXI_FUNCTION(0x1, "gpio_out")), 279 SUNXI_FUNCTION(0x1, "gpio_out"),
280 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
281 SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
196 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9, 282 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9,
197 SUNXI_FUNCTION(0x0, "gpio_in"), 283 SUNXI_FUNCTION(0x0, "gpio_in"),
198 SUNXI_FUNCTION(0x1, "gpio_out")), 284 SUNXI_FUNCTION(0x1, "gpio_out"),
285 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
286 SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
199 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10, 287 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10,
200 SUNXI_FUNCTION(0x0, "gpio_in"), 288 SUNXI_FUNCTION(0x0, "gpio_in"),
201 SUNXI_FUNCTION(0x1, "gpio_out")), 289 SUNXI_FUNCTION(0x1, "gpio_out"),
290 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
291 SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
202 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11, 292 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11,
203 SUNXI_FUNCTION(0x0, "gpio_in"), 293 SUNXI_FUNCTION(0x0, "gpio_in"),
204 SUNXI_FUNCTION(0x1, "gpio_out")), 294 SUNXI_FUNCTION(0x1, "gpio_out"),
295 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
296 SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
205 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12, 297 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12,
206 SUNXI_FUNCTION(0x0, "gpio_in"), 298 SUNXI_FUNCTION(0x0, "gpio_in"),
207 SUNXI_FUNCTION(0x1, "gpio_out")), 299 SUNXI_FUNCTION(0x1, "gpio_out"),
300 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ4 */
208 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13, 301 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13,
209 SUNXI_FUNCTION(0x0, "gpio_in"), 302 SUNXI_FUNCTION(0x0, "gpio_in"),
210 SUNXI_FUNCTION(0x1, "gpio_out")), 303 SUNXI_FUNCTION(0x1, "gpio_out"),
304 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ5 */
211 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14, 305 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14,
212 SUNXI_FUNCTION(0x0, "gpio_in"), 306 SUNXI_FUNCTION(0x0, "gpio_in"),
213 SUNXI_FUNCTION(0x1, "gpio_out")), 307 SUNXI_FUNCTION(0x1, "gpio_out"),
308 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ6 */
214 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15, 309 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15,
215 SUNXI_FUNCTION(0x0, "gpio_in"), 310 SUNXI_FUNCTION(0x0, "gpio_in"),
216 SUNXI_FUNCTION(0x1, "gpio_out")), 311 SUNXI_FUNCTION(0x1, "gpio_out"),
312 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ7 */
217 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC16, 313 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC16,
218 SUNXI_FUNCTION(0x0, "gpio_in"), 314 SUNXI_FUNCTION(0x0, "gpio_in"),
219 SUNXI_FUNCTION(0x1, "gpio_out")), 315 SUNXI_FUNCTION(0x1, "gpio_out"),
316 SUNXI_FUNCTION(0x2, "nand0")), /* NWP */
220 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC17, 317 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC17,
221 SUNXI_FUNCTION(0x0, "gpio_in"), 318 SUNXI_FUNCTION(0x0, "gpio_in"),
222 SUNXI_FUNCTION(0x1, "gpio_out")), 319 SUNXI_FUNCTION(0x1, "gpio_out"),
320 SUNXI_FUNCTION(0x2, "nand0")), /* NCE2 */
223 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC18, 321 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC18,
224 SUNXI_FUNCTION(0x0, "gpio_in"), 322 SUNXI_FUNCTION(0x0, "gpio_in"),
225 SUNXI_FUNCTION(0x1, "gpio_out")), 323 SUNXI_FUNCTION(0x1, "gpio_out"),
324 SUNXI_FUNCTION(0x2, "nand0")), /* NCE3 */
226 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19, 325 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19,
227 SUNXI_FUNCTION(0x0, "gpio_in"), 326 SUNXI_FUNCTION(0x0, "gpio_in"),
228 SUNXI_FUNCTION(0x1, "gpio_out")), 327 SUNXI_FUNCTION(0x1, "gpio_out"),
328 SUNXI_FUNCTION(0x2, "nand0"), /* NCE4 */
329 SUNXI_FUNCTION(0x3, "spi2")), /* CS0 */
229 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC20, 330 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC20,
230 SUNXI_FUNCTION(0x0, "gpio_in"), 331 SUNXI_FUNCTION(0x0, "gpio_in"),
231 SUNXI_FUNCTION(0x1, "gpio_out")), 332 SUNXI_FUNCTION(0x1, "gpio_out"),
333 SUNXI_FUNCTION(0x2, "nand0"), /* NCE5 */
334 SUNXI_FUNCTION(0x3, "spi2")), /* CLK */
232 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC21, 335 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC21,
233 SUNXI_FUNCTION(0x0, "gpio_in"), 336 SUNXI_FUNCTION(0x0, "gpio_in"),
234 SUNXI_FUNCTION(0x1, "gpio_out")), 337 SUNXI_FUNCTION(0x1, "gpio_out"),
338 SUNXI_FUNCTION(0x2, "nand0"), /* NCE6 */
339 SUNXI_FUNCTION(0x3, "spi2")), /* MOSI */
235 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC22, 340 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC22,
236 SUNXI_FUNCTION(0x0, "gpio_in"), 341 SUNXI_FUNCTION(0x0, "gpio_in"),
237 SUNXI_FUNCTION(0x1, "gpio_out")), 342 SUNXI_FUNCTION(0x1, "gpio_out"),
343 SUNXI_FUNCTION(0x2, "nand0"), /* NCE7 */
344 SUNXI_FUNCTION(0x3, "spi2")), /* MISO */
238 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC23, 345 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC23,
239 SUNXI_FUNCTION(0x0, "gpio_in"), 346 SUNXI_FUNCTION(0x0, "gpio_in"),
240 SUNXI_FUNCTION(0x1, "gpio_out")), 347 SUNXI_FUNCTION(0x1, "gpio_out"),
348 SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
241 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC24, 349 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC24,
242 SUNXI_FUNCTION(0x0, "gpio_in"), 350 SUNXI_FUNCTION(0x0, "gpio_in"),
243 SUNXI_FUNCTION(0x1, "gpio_out")), 351 SUNXI_FUNCTION(0x1, "gpio_out"),
352 SUNXI_FUNCTION(0x2, "nand0")), /* NDQS */
244 /* Hole */ 353 /* Hole */
245 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD0, 354 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD0,
246 SUNXI_FUNCTION(0x0, "gpio_in"), 355 SUNXI_FUNCTION(0x0, "gpio_in"),
247 SUNXI_FUNCTION(0x1, "gpio_out")), 356 SUNXI_FUNCTION(0x1, "gpio_out"),
357 SUNXI_FUNCTION(0x2, "lcd0"), /* D0 */
358 SUNXI_FUNCTION(0x3, "lvds0")), /* VP0 */
248 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD1, 359 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD1,
249 SUNXI_FUNCTION(0x0, "gpio_in"), 360 SUNXI_FUNCTION(0x0, "gpio_in"),
250 SUNXI_FUNCTION(0x1, "gpio_out")), 361 SUNXI_FUNCTION(0x1, "gpio_out"),
362 SUNXI_FUNCTION(0x2, "lcd0"), /* D1 */
363 SUNXI_FUNCTION(0x3, "lvds0")), /* VN0 */
251 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2, 364 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2,
252 SUNXI_FUNCTION(0x0, "gpio_in"), 365 SUNXI_FUNCTION(0x0, "gpio_in"),
253 SUNXI_FUNCTION(0x1, "gpio_out")), 366 SUNXI_FUNCTION(0x1, "gpio_out"),
367 SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
368 SUNXI_FUNCTION(0x3, "lvds0")), /* VP1 */
254 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3, 369 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3,
255 SUNXI_FUNCTION(0x0, "gpio_in"), 370 SUNXI_FUNCTION(0x0, "gpio_in"),
256 SUNXI_FUNCTION(0x1, "gpio_out")), 371 SUNXI_FUNCTION(0x1, "gpio_out"),
372 SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
373 SUNXI_FUNCTION(0x3, "lvds0")), /* VN1 */
257 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4, 374 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4,
258 SUNXI_FUNCTION(0x0, "gpio_in"), 375 SUNXI_FUNCTION(0x0, "gpio_in"),
259 SUNXI_FUNCTION(0x1, "gpio_out")), 376 SUNXI_FUNCTION(0x1, "gpio_out"),
377 SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
378 SUNXI_FUNCTION(0x3, "lvds0")), /* VP2 */
260 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5, 379 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5,
261 SUNXI_FUNCTION(0x0, "gpio_in"), 380 SUNXI_FUNCTION(0x0, "gpio_in"),
262 SUNXI_FUNCTION(0x1, "gpio_out")), 381 SUNXI_FUNCTION(0x1, "gpio_out"),
382 SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
383 SUNXI_FUNCTION(0x3, "lvds0")), /* VN2 */
263 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6, 384 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6,
264 SUNXI_FUNCTION(0x0, "gpio_in"), 385 SUNXI_FUNCTION(0x0, "gpio_in"),
265 SUNXI_FUNCTION(0x1, "gpio_out")), 386 SUNXI_FUNCTION(0x1, "gpio_out"),
387 SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
388 SUNXI_FUNCTION(0x3, "lvds0")), /* VPC */
266 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7, 389 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7,
267 SUNXI_FUNCTION(0x0, "gpio_in"), 390 SUNXI_FUNCTION(0x0, "gpio_in"),
268 SUNXI_FUNCTION(0x1, "gpio_out")), 391 SUNXI_FUNCTION(0x1, "gpio_out"),
392 SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
393 SUNXI_FUNCTION(0x3, "lvds0")), /* VNC */
269 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD8, 394 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD8,
270 SUNXI_FUNCTION(0x0, "gpio_in"), 395 SUNXI_FUNCTION(0x0, "gpio_in"),
271 SUNXI_FUNCTION(0x1, "gpio_out")), 396 SUNXI_FUNCTION(0x1, "gpio_out"),
397 SUNXI_FUNCTION(0x2, "lcd0"), /* D8 */
398 SUNXI_FUNCTION(0x3, "lvds0")), /* VP3 */
272 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD9, 399 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD9,
273 SUNXI_FUNCTION(0x0, "gpio_in"), 400 SUNXI_FUNCTION(0x0, "gpio_in"),
274 SUNXI_FUNCTION(0x1, "gpio_out")), 401 SUNXI_FUNCTION(0x1, "gpio_out"),
402 SUNXI_FUNCTION(0x2, "lcd0"), /* D9 */
403 SUNXI_FUNCTION(0x3, "lvds0")), /* VM3 */
275 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10, 404 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10,
276 SUNXI_FUNCTION(0x0, "gpio_in"), 405 SUNXI_FUNCTION(0x0, "gpio_in"),
277 SUNXI_FUNCTION(0x1, "gpio_out")), 406 SUNXI_FUNCTION(0x1, "gpio_out"),
407 SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
408 SUNXI_FUNCTION(0x3, "lvds1")), /* VP0 */
278 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11, 409 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11,
279 SUNXI_FUNCTION(0x0, "gpio_in"), 410 SUNXI_FUNCTION(0x0, "gpio_in"),
280 SUNXI_FUNCTION(0x1, "gpio_out")), 411 SUNXI_FUNCTION(0x1, "gpio_out"),
412 SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
413 SUNXI_FUNCTION(0x3, "lvds1")), /* VN0 */
281 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12, 414 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12,
282 SUNXI_FUNCTION(0x0, "gpio_in"), 415 SUNXI_FUNCTION(0x0, "gpio_in"),
283 SUNXI_FUNCTION(0x1, "gpio_out")), 416 SUNXI_FUNCTION(0x1, "gpio_out"),
417 SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
418 SUNXI_FUNCTION(0x3, "lvds1")), /* VP1 */
284 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13, 419 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13,
285 SUNXI_FUNCTION(0x0, "gpio_in"), 420 SUNXI_FUNCTION(0x0, "gpio_in"),
286 SUNXI_FUNCTION(0x1, "gpio_out")), 421 SUNXI_FUNCTION(0x1, "gpio_out"),
422 SUNXI_FUNCTION(0x2, "lcd0"), /* D13 */
423 SUNXI_FUNCTION(0x3, "lvds1")), /* VN1 */
287 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14, 424 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14,
288 SUNXI_FUNCTION(0x0, "gpio_in"), 425 SUNXI_FUNCTION(0x0, "gpio_in"),
289 SUNXI_FUNCTION(0x1, "gpio_out")), 426 SUNXI_FUNCTION(0x1, "gpio_out"),
427 SUNXI_FUNCTION(0x2, "lcd0"), /* D14 */
428 SUNXI_FUNCTION(0x3, "lvds1")), /* VP2 */
290 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15, 429 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15,
291 SUNXI_FUNCTION(0x0, "gpio_in"), 430 SUNXI_FUNCTION(0x0, "gpio_in"),
292 SUNXI_FUNCTION(0x1, "gpio_out")), 431 SUNXI_FUNCTION(0x1, "gpio_out"),
432 SUNXI_FUNCTION(0x2, "lcd0"), /* D15 */
433 SUNXI_FUNCTION(0x3, "lvds1")), /* VN2 */
293 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD16, 434 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD16,
294 SUNXI_FUNCTION(0x0, "gpio_in"), 435 SUNXI_FUNCTION(0x0, "gpio_in"),
295 SUNXI_FUNCTION(0x1, "gpio_out")), 436 SUNXI_FUNCTION(0x1, "gpio_out"),
437 SUNXI_FUNCTION(0x2, "lcd0"), /* D16 */
438 SUNXI_FUNCTION(0x3, "lvds1")), /* VPC */
296 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD17, 439 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD17,
297 SUNXI_FUNCTION(0x0, "gpio_in"), 440 SUNXI_FUNCTION(0x0, "gpio_in"),
298 SUNXI_FUNCTION(0x1, "gpio_out")), 441 SUNXI_FUNCTION(0x1, "gpio_out"),
442 SUNXI_FUNCTION(0x2, "lcd0"), /* D17 */
443 SUNXI_FUNCTION(0x3, "lvds1")), /* VNC */
299 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18, 444 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18,
300 SUNXI_FUNCTION(0x0, "gpio_in"), 445 SUNXI_FUNCTION(0x0, "gpio_in"),
301 SUNXI_FUNCTION(0x1, "gpio_out")), 446 SUNXI_FUNCTION(0x1, "gpio_out"),
447 SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
448 SUNXI_FUNCTION(0x3, "lvds1")), /* VP3 */
302 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19, 449 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19,
303 SUNXI_FUNCTION(0x0, "gpio_in"), 450 SUNXI_FUNCTION(0x0, "gpio_in"),
304 SUNXI_FUNCTION(0x1, "gpio_out")), 451 SUNXI_FUNCTION(0x1, "gpio_out"),
452 SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
453 SUNXI_FUNCTION(0x3, "lvds1")), /* VN3 */
305 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20, 454 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20,
306 SUNXI_FUNCTION(0x0, "gpio_in"), 455 SUNXI_FUNCTION(0x0, "gpio_in"),
307 SUNXI_FUNCTION(0x1, "gpio_out")), 456 SUNXI_FUNCTION(0x1, "gpio_out"),
457 SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
458 SUNXI_FUNCTION(0x3, "csi1")), /* MCLK */
308 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21, 459 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21,
309 SUNXI_FUNCTION(0x0, "gpio_in"), 460 SUNXI_FUNCTION(0x0, "gpio_in"),
310 SUNXI_FUNCTION(0x1, "gpio_out")), 461 SUNXI_FUNCTION(0x1, "gpio_out"),
462 SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
463 SUNXI_FUNCTION(0x3, "sim")), /* VPPEN */
311 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22, 464 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22,
312 SUNXI_FUNCTION(0x0, "gpio_in"), 465 SUNXI_FUNCTION(0x0, "gpio_in"),
313 SUNXI_FUNCTION(0x1, "gpio_out")), 466 SUNXI_FUNCTION(0x1, "gpio_out"),
467 SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
468 SUNXI_FUNCTION(0x3, "sim")), /* VPPPP */
314 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23, 469 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23,
315 SUNXI_FUNCTION(0x0, "gpio_in"), 470 SUNXI_FUNCTION(0x0, "gpio_in"),
316 SUNXI_FUNCTION(0x1, "gpio_out")), 471 SUNXI_FUNCTION(0x1, "gpio_out"),
472 SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
473 SUNXI_FUNCTION(0x3, "sim")), /* DET */
317 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24, 474 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24,
318 SUNXI_FUNCTION(0x0, "gpio_in"), 475 SUNXI_FUNCTION(0x0, "gpio_in"),
319 SUNXI_FUNCTION(0x1, "gpio_out")), 476 SUNXI_FUNCTION(0x1, "gpio_out"),
477 SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
478 SUNXI_FUNCTION(0x3, "sim")), /* VCCEN */
320 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25, 479 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25,
321 SUNXI_FUNCTION(0x0, "gpio_in"), 480 SUNXI_FUNCTION(0x0, "gpio_in"),
322 SUNXI_FUNCTION(0x1, "gpio_out")), 481 SUNXI_FUNCTION(0x1, "gpio_out"),
482 SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
483 SUNXI_FUNCTION(0x3, "sim")), /* RST */
323 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26, 484 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26,
324 SUNXI_FUNCTION(0x0, "gpio_in"), 485 SUNXI_FUNCTION(0x0, "gpio_in"),
325 SUNXI_FUNCTION(0x1, "gpio_out")), 486 SUNXI_FUNCTION(0x1, "gpio_out"),
487 SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
488 SUNXI_FUNCTION(0x3, "sim")), /* SCK */
326 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27, 489 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27,
327 SUNXI_FUNCTION(0x0, "gpio_in"), 490 SUNXI_FUNCTION(0x0, "gpio_in"),
328 SUNXI_FUNCTION(0x1, "gpio_out")), 491 SUNXI_FUNCTION(0x1, "gpio_out"),
492 SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
493 SUNXI_FUNCTION(0x3, "sim")), /* SDA */
329 /* Hole */ 494 /* Hole */
330 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0, 495 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0,
331 SUNXI_FUNCTION(0x0, "gpio_in"), 496 SUNXI_FUNCTION(0x0, "gpio_in"),
332 SUNXI_FUNCTION(0x1, "gpio_out")), 497 SUNXI_FUNCTION(0x1, "gpio_out"),
498 SUNXI_FUNCTION(0x2, "ts0"), /* CLK */
499 SUNXI_FUNCTION(0x3, "csi0")), /* PCK */
333 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1, 500 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1,
334 SUNXI_FUNCTION(0x0, "gpio_in"), 501 SUNXI_FUNCTION(0x0, "gpio_in"),
335 SUNXI_FUNCTION(0x1, "gpio_out")), 502 SUNXI_FUNCTION(0x1, "gpio_out"),
503 SUNXI_FUNCTION(0x2, "ts0"), /* ERR */
504 SUNXI_FUNCTION(0x3, "csi0")), /* CK */
336 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2, 505 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2,
337 SUNXI_FUNCTION(0x0, "gpio_in"), 506 SUNXI_FUNCTION(0x0, "gpio_in"),
338 SUNXI_FUNCTION(0x1, "gpio_out")), 507 SUNXI_FUNCTION(0x1, "gpio_out"),
508 SUNXI_FUNCTION(0x2, "ts0"), /* SYNC */
509 SUNXI_FUNCTION(0x3, "csi0")), /* HSYNC */
339 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3, 510 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3,
340 SUNXI_FUNCTION(0x0, "gpio_in"), 511 SUNXI_FUNCTION(0x0, "gpio_in"),
341 SUNXI_FUNCTION(0x1, "gpio_out")), 512 SUNXI_FUNCTION(0x1, "gpio_out"),
513 SUNXI_FUNCTION(0x2, "ts0"), /* DVLD */
514 SUNXI_FUNCTION(0x3, "csi0")), /* VSYNC */
342 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4, 515 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4,
343 SUNXI_FUNCTION(0x0, "gpio_in"), 516 SUNXI_FUNCTION(0x0, "gpio_in"),
344 SUNXI_FUNCTION(0x1, "gpio_out")), 517 SUNXI_FUNCTION(0x1, "gpio_out"),
518 SUNXI_FUNCTION(0x2, "ts0"), /* D0 */
519 SUNXI_FUNCTION(0x3, "csi0")), /* D0 */
345 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5, 520 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5,
346 SUNXI_FUNCTION(0x0, "gpio_in"), 521 SUNXI_FUNCTION(0x0, "gpio_in"),
347 SUNXI_FUNCTION(0x1, "gpio_out")), 522 SUNXI_FUNCTION(0x1, "gpio_out"),
523 SUNXI_FUNCTION(0x2, "ts0"), /* D1 */
524 SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
525 SUNXI_FUNCTION(0x4, "sim")), /* VPPEN */
348 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6, 526 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6,
349 SUNXI_FUNCTION(0x0, "gpio_in"), 527 SUNXI_FUNCTION(0x0, "gpio_in"),
350 SUNXI_FUNCTION(0x1, "gpio_out")), 528 SUNXI_FUNCTION(0x1, "gpio_out"),
529 SUNXI_FUNCTION(0x2, "ts0"), /* D2 */
530 SUNXI_FUNCTION(0x3, "csi0")), /* D2 */
351 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7, 531 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7,
352 SUNXI_FUNCTION(0x0, "gpio_in"), 532 SUNXI_FUNCTION(0x0, "gpio_in"),
353 SUNXI_FUNCTION(0x1, "gpio_out")), 533 SUNXI_FUNCTION(0x1, "gpio_out"),
534 SUNXI_FUNCTION(0x2, "ts0"), /* D3 */
535 SUNXI_FUNCTION(0x3, "csi0")), /* D3 */
354 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8, 536 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8,
355 SUNXI_FUNCTION(0x0, "gpio_in"), 537 SUNXI_FUNCTION(0x0, "gpio_in"),
356 SUNXI_FUNCTION(0x1, "gpio_out")), 538 SUNXI_FUNCTION(0x1, "gpio_out"),
539 SUNXI_FUNCTION(0x2, "ts0"), /* D4 */
540 SUNXI_FUNCTION(0x3, "csi0")), /* D4 */
357 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9, 541 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9,
358 SUNXI_FUNCTION(0x0, "gpio_in"), 542 SUNXI_FUNCTION(0x0, "gpio_in"),
359 SUNXI_FUNCTION(0x1, "gpio_out")), 543 SUNXI_FUNCTION(0x1, "gpio_out"),
544 SUNXI_FUNCTION(0x2, "ts0"), /* D5 */
545 SUNXI_FUNCTION(0x3, "csi0")), /* D5 */
360 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10, 546 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10,
361 SUNXI_FUNCTION(0x0, "gpio_in"), 547 SUNXI_FUNCTION(0x0, "gpio_in"),
362 SUNXI_FUNCTION(0x1, "gpio_out")), 548 SUNXI_FUNCTION(0x1, "gpio_out"),
549 SUNXI_FUNCTION(0x2, "ts0"), /* D6 */
550 SUNXI_FUNCTION(0x3, "csi0")), /* D6 */
363 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11, 551 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11,
364 SUNXI_FUNCTION(0x0, "gpio_in"), 552 SUNXI_FUNCTION(0x0, "gpio_in"),
365 SUNXI_FUNCTION(0x1, "gpio_out")), 553 SUNXI_FUNCTION(0x1, "gpio_out"),
554 SUNXI_FUNCTION(0x2, "ts0"), /* D7 */
555 SUNXI_FUNCTION(0x3, "csi0")), /* D7 */
366 /* Hole */ 556 /* Hole */
367 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0, 557 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0,
368 SUNXI_FUNCTION(0x0, "gpio_in"), 558 SUNXI_FUNCTION(0x0, "gpio_in"),
369 SUNXI_FUNCTION(0x1, "gpio_out")), 559 SUNXI_FUNCTION(0x1, "gpio_out"),
560 SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
561 SUNXI_FUNCTION(0x4, "jtag")), /* MSI */
370 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1, 562 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1,
371 SUNXI_FUNCTION(0x0, "gpio_in"), 563 SUNXI_FUNCTION(0x0, "gpio_in"),
372 SUNXI_FUNCTION(0x1, "gpio_out")), 564 SUNXI_FUNCTION(0x1, "gpio_out"),
565 SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
566 SUNXI_FUNCTION(0x4, "jtag")), /* DI1 */
373 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2, 567 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2,
374 SUNXI_FUNCTION(0x0, "gpio_in"), 568 SUNXI_FUNCTION(0x0, "gpio_in"),
375 SUNXI_FUNCTION(0x1, "gpio_out"), 569 SUNXI_FUNCTION(0x1, "gpio_out"),
570 SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
376 SUNXI_FUNCTION(0x4, "uart0")), /* TX */ 571 SUNXI_FUNCTION(0x4, "uart0")), /* TX */
377 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3, 572 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3,
378 SUNXI_FUNCTION(0x0, "gpio_in"), 573 SUNXI_FUNCTION(0x0, "gpio_in"),
379 SUNXI_FUNCTION(0x1, "gpio_out")), 574 SUNXI_FUNCTION(0x1, "gpio_out"),
575 SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
576 SUNXI_FUNCTION(0x4, "jtag")), /* DO1 */
380 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4, 577 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4,
381 SUNXI_FUNCTION(0x0, "gpio_in"), 578 SUNXI_FUNCTION(0x0, "gpio_in"),
382 SUNXI_FUNCTION(0x1, "gpio_out"), 579 SUNXI_FUNCTION(0x1, "gpio_out"),
580 SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
383 SUNXI_FUNCTION(0x4, "uart0")), /* RX */ 581 SUNXI_FUNCTION(0x4, "uart0")), /* RX */
384 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5, 582 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5,
385 SUNXI_FUNCTION(0x0, "gpio_in"), 583 SUNXI_FUNCTION(0x0, "gpio_in"),
386 SUNXI_FUNCTION(0x1, "gpio_out")), 584 SUNXI_FUNCTION(0x1, "gpio_out"),
585 SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
586 SUNXI_FUNCTION(0x4, "jtag")), /* CK1 */
387 /* Hole */ 587 /* Hole */
388 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0, 588 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0,
389 SUNXI_FUNCTION(0x0, "gpio_in"), 589 SUNXI_FUNCTION(0x0, "gpio_in"),
390 SUNXI_FUNCTION(0x1, "gpio_out")), 590 SUNXI_FUNCTION(0x1, "gpio_out"),
591 SUNXI_FUNCTION(0x2, "ts1"), /* CLK */
592 SUNXI_FUNCTION(0x3, "csi1"), /* PCK */
593 SUNXI_FUNCTION(0x4, "mmc1")), /* CMD */
391 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG1, 594 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG1,
392 SUNXI_FUNCTION(0x0, "gpio_in"), 595 SUNXI_FUNCTION(0x0, "gpio_in"),
393 SUNXI_FUNCTION(0x1, "gpio_out")), 596 SUNXI_FUNCTION(0x1, "gpio_out"),
597 SUNXI_FUNCTION(0x2, "ts1"), /* ERR */
598 SUNXI_FUNCTION(0x3, "csi1"), /* CK */
599 SUNXI_FUNCTION(0x4, "mmc1")), /* CLK */
394 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG2, 600 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG2,
395 SUNXI_FUNCTION(0x0, "gpio_in"), 601 SUNXI_FUNCTION(0x0, "gpio_in"),
396 SUNXI_FUNCTION(0x1, "gpio_out")), 602 SUNXI_FUNCTION(0x1, "gpio_out"),
603 SUNXI_FUNCTION(0x2, "ts1"), /* SYNC */
604 SUNXI_FUNCTION(0x3, "csi1"), /* HSYNC */
605 SUNXI_FUNCTION(0x4, "mmc1")), /* D0 */
397 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3, 606 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3,
398 SUNXI_FUNCTION(0x0, "gpio_in"), 607 SUNXI_FUNCTION(0x0, "gpio_in"),
399 SUNXI_FUNCTION(0x1, "gpio_out")), 608 SUNXI_FUNCTION(0x1, "gpio_out"),
609 SUNXI_FUNCTION(0x2, "ts1"), /* DVLD */
610 SUNXI_FUNCTION(0x3, "csi1"), /* VSYNC */
611 SUNXI_FUNCTION(0x4, "mmc1")), /* D1 */
400 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4, 612 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4,
401 SUNXI_FUNCTION(0x0, "gpio_in"), 613 SUNXI_FUNCTION(0x0, "gpio_in"),
402 SUNXI_FUNCTION(0x1, "gpio_out")), 614 SUNXI_FUNCTION(0x1, "gpio_out"),
615 SUNXI_FUNCTION(0x2, "ts1"), /* D0 */
616 SUNXI_FUNCTION(0x3, "csi1"), /* D0 */
617 SUNXI_FUNCTION(0x4, "mmc1"), /* D2 */
618 SUNXI_FUNCTION(0x5, "csi0")), /* D8 */
403 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG5, 619 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG5,
404 SUNXI_FUNCTION(0x0, "gpio_in"), 620 SUNXI_FUNCTION(0x0, "gpio_in"),
405 SUNXI_FUNCTION(0x1, "gpio_out")), 621 SUNXI_FUNCTION(0x1, "gpio_out"),
622 SUNXI_FUNCTION(0x2, "ts1"), /* D1 */
623 SUNXI_FUNCTION(0x3, "csi1"), /* D1 */
624 SUNXI_FUNCTION(0x4, "mmc1"), /* D3 */
625 SUNXI_FUNCTION(0x5, "csi0")), /* D9 */
406 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG6, 626 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG6,
407 SUNXI_FUNCTION(0x0, "gpio_in"), 627 SUNXI_FUNCTION(0x0, "gpio_in"),
408 SUNXI_FUNCTION(0x1, "gpio_out")), 628 SUNXI_FUNCTION(0x1, "gpio_out"),
629 SUNXI_FUNCTION(0x2, "ts1"), /* D2 */
630 SUNXI_FUNCTION(0x3, "csi1"), /* D2 */
631 SUNXI_FUNCTION(0x4, "uart3"), /* TX */
632 SUNXI_FUNCTION(0x5, "csi0")), /* D10 */
409 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG7, 633 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG7,
410 SUNXI_FUNCTION(0x0, "gpio_in"), 634 SUNXI_FUNCTION(0x0, "gpio_in"),
411 SUNXI_FUNCTION(0x1, "gpio_out")), 635 SUNXI_FUNCTION(0x1, "gpio_out"),
636 SUNXI_FUNCTION(0x2, "ts1"), /* D3 */
637 SUNXI_FUNCTION(0x3, "csi1"), /* D3 */
638 SUNXI_FUNCTION(0x4, "uart3"), /* RX */
639 SUNXI_FUNCTION(0x5, "csi0")), /* D11 */
412 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG8, 640 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG8,
413 SUNXI_FUNCTION(0x0, "gpio_in"), 641 SUNXI_FUNCTION(0x0, "gpio_in"),
414 SUNXI_FUNCTION(0x1, "gpio_out")), 642 SUNXI_FUNCTION(0x1, "gpio_out"),
643 SUNXI_FUNCTION(0x2, "ts1"), /* D4 */
644 SUNXI_FUNCTION(0x3, "csi1"), /* D4 */
645 SUNXI_FUNCTION(0x4, "uart3"), /* RTS */
646 SUNXI_FUNCTION(0x5, "csi0")), /* D12 */
415 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9, 647 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9,
416 SUNXI_FUNCTION(0x0, "gpio_in"), 648 SUNXI_FUNCTION(0x0, "gpio_in"),
417 SUNXI_FUNCTION(0x1, "gpio_out")), 649 SUNXI_FUNCTION(0x1, "gpio_out"),
650 SUNXI_FUNCTION(0x2, "ts1"), /* D5 */
651 SUNXI_FUNCTION(0x3, "csi1"), /* D5 */
652 SUNXI_FUNCTION(0x4, "uart3"), /* CTS */
653 SUNXI_FUNCTION(0x5, "csi0")), /* D13 */
418 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10, 654 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10,
419 SUNXI_FUNCTION(0x0, "gpio_in"), 655 SUNXI_FUNCTION(0x0, "gpio_in"),
420 SUNXI_FUNCTION(0x1, "gpio_out")), 656 SUNXI_FUNCTION(0x1, "gpio_out"),
657 SUNXI_FUNCTION(0x2, "ts1"), /* D6 */
658 SUNXI_FUNCTION(0x3, "csi1"), /* D6 */
659 SUNXI_FUNCTION(0x4, "uart4"), /* TX */
660 SUNXI_FUNCTION(0x5, "csi0")), /* D14 */
421 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11, 661 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11,
422 SUNXI_FUNCTION(0x0, "gpio_in"), 662 SUNXI_FUNCTION(0x0, "gpio_in"),
423 SUNXI_FUNCTION(0x1, "gpio_out")), 663 SUNXI_FUNCTION(0x1, "gpio_out"),
664 SUNXI_FUNCTION(0x2, "ts1"), /* D7 */
665 SUNXI_FUNCTION(0x3, "csi1"), /* D7 */
666 SUNXI_FUNCTION(0x4, "uart4"), /* RX */
667 SUNXI_FUNCTION(0x5, "csi0")), /* D15 */
424 /* Hole */ 668 /* Hole */
425 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH0, 669 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH0,
426 SUNXI_FUNCTION(0x0, "gpio_in"), 670 SUNXI_FUNCTION(0x0, "gpio_in"),
427 SUNXI_FUNCTION(0x1, "gpio_out")), 671 SUNXI_FUNCTION(0x1, "gpio_out"),
672 SUNXI_FUNCTION(0x2, "lcd1"), /* D0 */
673 SUNXI_FUNCTION(0x3, "pata"), /* ATAA0 */
674 SUNXI_FUNCTION(0x4, "uart3"), /* TX */
675 SUNXI_FUNCTION(0x7, "csi1")), /* D0 */
428 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH1, 676 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH1,
429 SUNXI_FUNCTION(0x0, "gpio_in"), 677 SUNXI_FUNCTION(0x0, "gpio_in"),
430 SUNXI_FUNCTION(0x1, "gpio_out")), 678 SUNXI_FUNCTION(0x1, "gpio_out"),
679 SUNXI_FUNCTION(0x2, "lcd1"), /* D1 */
680 SUNXI_FUNCTION(0x3, "pata"), /* ATAA1 */
681 SUNXI_FUNCTION(0x4, "uart3"), /* RX */
682 SUNXI_FUNCTION(0x7, "csi1")), /* D1 */
431 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH2, 683 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH2,
432 SUNXI_FUNCTION(0x0, "gpio_in"), 684 SUNXI_FUNCTION(0x0, "gpio_in"),
433 SUNXI_FUNCTION(0x1, "gpio_out")), 685 SUNXI_FUNCTION(0x1, "gpio_out"),
686 SUNXI_FUNCTION(0x2, "lcd1"), /* D2 */
687 SUNXI_FUNCTION(0x3, "pata"), /* ATAA2 */
688 SUNXI_FUNCTION(0x4, "uart3"), /* RTS */
689 SUNXI_FUNCTION(0x7, "csi1")), /* D2 */
434 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH3, 690 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH3,
435 SUNXI_FUNCTION(0x0, "gpio_in"), 691 SUNXI_FUNCTION(0x0, "gpio_in"),
436 SUNXI_FUNCTION(0x1, "gpio_out")), 692 SUNXI_FUNCTION(0x1, "gpio_out"),
693 SUNXI_FUNCTION(0x2, "lcd1"), /* D3 */
694 SUNXI_FUNCTION(0x3, "pata"), /* ATAIRQ */
695 SUNXI_FUNCTION(0x4, "uart3"), /* CTS */
696 SUNXI_FUNCTION(0x7, "csi1")), /* D3 */
437 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH4, 697 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH4,
438 SUNXI_FUNCTION(0x0, "gpio_in"), 698 SUNXI_FUNCTION(0x0, "gpio_in"),
439 SUNXI_FUNCTION(0x1, "gpio_out")), 699 SUNXI_FUNCTION(0x1, "gpio_out"),
700 SUNXI_FUNCTION(0x2, "lcd1"), /* D4 */
701 SUNXI_FUNCTION(0x3, "pata"), /* ATAD0 */
702 SUNXI_FUNCTION(0x4, "uart4"), /* TX */
703 SUNXI_FUNCTION(0x7, "csi1")), /* D4 */
440 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH5, 704 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH5,
441 SUNXI_FUNCTION(0x0, "gpio_in"), 705 SUNXI_FUNCTION(0x0, "gpio_in"),
442 SUNXI_FUNCTION(0x1, "gpio_out")), 706 SUNXI_FUNCTION(0x1, "gpio_out"),
707 SUNXI_FUNCTION(0x2, "lcd1"), /* D5 */
708 SUNXI_FUNCTION(0x3, "pata"), /* ATAD1 */
709 SUNXI_FUNCTION(0x4, "uart4"), /* RX */
710 SUNXI_FUNCTION(0x7, "csi1")), /* D5 */
443 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH6, 711 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH6,
444 SUNXI_FUNCTION(0x0, "gpio_in"), 712 SUNXI_FUNCTION(0x0, "gpio_in"),
445 SUNXI_FUNCTION(0x1, "gpio_out")), 713 SUNXI_FUNCTION(0x1, "gpio_out"),
714 SUNXI_FUNCTION(0x2, "lcd1"), /* D6 */
715 SUNXI_FUNCTION(0x3, "pata"), /* ATAD2 */
716 SUNXI_FUNCTION(0x4, "uart5"), /* TX */
717 SUNXI_FUNCTION(0x5, "ms"), /* BS */
718 SUNXI_FUNCTION(0x7, "csi1")), /* D6 */
446 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH7, 719 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH7,
447 SUNXI_FUNCTION(0x0, "gpio_in"), 720 SUNXI_FUNCTION(0x0, "gpio_in"),
448 SUNXI_FUNCTION(0x1, "gpio_out")), 721 SUNXI_FUNCTION(0x1, "gpio_out"),
722 SUNXI_FUNCTION(0x2, "lcd1"), /* D7 */
723 SUNXI_FUNCTION(0x3, "pata"), /* ATAD3 */
724 SUNXI_FUNCTION(0x4, "uart5"), /* RX */
725 SUNXI_FUNCTION(0x5, "ms"), /* CLK */
726 SUNXI_FUNCTION(0x7, "csi1")), /* D7 */
449 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH8, 727 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH8,
450 SUNXI_FUNCTION(0x0, "gpio_in"), 728 SUNXI_FUNCTION(0x0, "gpio_in"),
451 SUNXI_FUNCTION(0x1, "gpio_out")), 729 SUNXI_FUNCTION(0x1, "gpio_out"),
730 SUNXI_FUNCTION(0x2, "lcd1"), /* D8 */
731 SUNXI_FUNCTION(0x3, "pata"), /* ATAD4 */
732 SUNXI_FUNCTION(0x4, "keypad"), /* IN0 */
733 SUNXI_FUNCTION(0x5, "ms"), /* D0 */
734 SUNXI_FUNCTION(0x7, "csi1")), /* D8 */
452 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH9, 735 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH9,
453 SUNXI_FUNCTION(0x0, "gpio_in"), 736 SUNXI_FUNCTION(0x0, "gpio_in"),
454 SUNXI_FUNCTION(0x1, "gpio_out")), 737 SUNXI_FUNCTION(0x1, "gpio_out"),
738 SUNXI_FUNCTION(0x2, "lcd1"), /* D9 */
739 SUNXI_FUNCTION(0x3, "pata"), /* ATAD5 */
740 SUNXI_FUNCTION(0x4, "keypad"), /* IN1 */
741 SUNXI_FUNCTION(0x5, "ms"), /* D1 */
742 SUNXI_FUNCTION(0x7, "csi1")), /* D9 */
455 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH10, 743 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH10,
456 SUNXI_FUNCTION(0x0, "gpio_in"), 744 SUNXI_FUNCTION(0x0, "gpio_in"),
457 SUNXI_FUNCTION(0x1, "gpio_out")), 745 SUNXI_FUNCTION(0x1, "gpio_out"),
746 SUNXI_FUNCTION(0x2, "lcd1"), /* D10 */
747 SUNXI_FUNCTION(0x3, "pata"), /* ATAD6 */
748 SUNXI_FUNCTION(0x4, "keypad"), /* IN2 */
749 SUNXI_FUNCTION(0x5, "ms"), /* D2 */
750 SUNXI_FUNCTION(0x7, "csi1")), /* D10 */
458 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH11, 751 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH11,
459 SUNXI_FUNCTION(0x0, "gpio_in"), 752 SUNXI_FUNCTION(0x0, "gpio_in"),
460 SUNXI_FUNCTION(0x1, "gpio_out")), 753 SUNXI_FUNCTION(0x1, "gpio_out"),
754 SUNXI_FUNCTION(0x2, "lcd1"), /* D11 */
755 SUNXI_FUNCTION(0x3, "pata"), /* ATAD7 */
756 SUNXI_FUNCTION(0x4, "keypad"), /* IN3 */
757 SUNXI_FUNCTION(0x5, "ms"), /* D3 */
758 SUNXI_FUNCTION(0x7, "csi1")), /* D11 */
461 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH12, 759 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH12,
462 SUNXI_FUNCTION(0x0, "gpio_in"), 760 SUNXI_FUNCTION(0x0, "gpio_in"),
463 SUNXI_FUNCTION(0x1, "gpio_out")), 761 SUNXI_FUNCTION(0x1, "gpio_out"),
762 SUNXI_FUNCTION(0x2, "lcd1"), /* D12 */
763 SUNXI_FUNCTION(0x3, "pata"), /* ATAD8 */
764 SUNXI_FUNCTION(0x4, "ps2"), /* SCK1 */
765 SUNXI_FUNCTION(0x7, "csi1")), /* D12 */
464 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH13, 766 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH13,
465 SUNXI_FUNCTION(0x0, "gpio_in"), 767 SUNXI_FUNCTION(0x0, "gpio_in"),
466 SUNXI_FUNCTION(0x1, "gpio_out")), 768 SUNXI_FUNCTION(0x1, "gpio_out"),
769 SUNXI_FUNCTION(0x2, "lcd1"), /* D13 */
770 SUNXI_FUNCTION(0x3, "pata"), /* ATAD9 */
771 SUNXI_FUNCTION(0x4, "ps2"), /* SDA1 */
772 SUNXI_FUNCTION(0x5, "sim"), /* RST */
773 SUNXI_FUNCTION(0x7, "csi1")), /* D13 */
467 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH14, 774 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH14,
468 SUNXI_FUNCTION(0x0, "gpio_in"), 775 SUNXI_FUNCTION(0x0, "gpio_in"),
469 SUNXI_FUNCTION(0x1, "gpio_out")), 776 SUNXI_FUNCTION(0x1, "gpio_out"),
777 SUNXI_FUNCTION(0x2, "lcd1"), /* D14 */
778 SUNXI_FUNCTION(0x3, "pata"), /* ATAD10 */
779 SUNXI_FUNCTION(0x4, "keypad"), /* IN4 */
780 SUNXI_FUNCTION(0x5, "sim"), /* VPPEN */
781 SUNXI_FUNCTION(0x7, "csi1")), /* D14 */
470 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH15, 782 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH15,
471 SUNXI_FUNCTION(0x0, "gpio_in"), 783 SUNXI_FUNCTION(0x0, "gpio_in"),
472 SUNXI_FUNCTION(0x1, "gpio_out")), 784 SUNXI_FUNCTION(0x1, "gpio_out"),
785 SUNXI_FUNCTION(0x2, "lcd1"), /* D15 */
786 SUNXI_FUNCTION(0x3, "pata"), /* ATAD11 */
787 SUNXI_FUNCTION(0x4, "keypad"), /* IN5 */
788 SUNXI_FUNCTION(0x5, "sim"), /* VPPPP */
789 SUNXI_FUNCTION(0x7, "csi1")), /* D15 */
473 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH16, 790 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH16,
474 SUNXI_FUNCTION(0x0, "gpio_in"), 791 SUNXI_FUNCTION(0x0, "gpio_in"),
475 SUNXI_FUNCTION(0x1, "gpio_out")), 792 SUNXI_FUNCTION(0x1, "gpio_out"),
793 SUNXI_FUNCTION(0x2, "lcd1"), /* D16 */
794 SUNXI_FUNCTION(0x3, "pata"), /* ATAD12 */
795 SUNXI_FUNCTION(0x4, "keypad"), /* IN6 */
796 SUNXI_FUNCTION(0x7, "csi1")), /* D16 */
476 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH17, 797 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH17,
477 SUNXI_FUNCTION(0x0, "gpio_in"), 798 SUNXI_FUNCTION(0x0, "gpio_in"),
478 SUNXI_FUNCTION(0x1, "gpio_out")), 799 SUNXI_FUNCTION(0x1, "gpio_out"),
800 SUNXI_FUNCTION(0x2, "lcd1"), /* D17 */
801 SUNXI_FUNCTION(0x3, "pata"), /* ATAD13 */
802 SUNXI_FUNCTION(0x4, "keypad"), /* IN7 */
803 SUNXI_FUNCTION(0x5, "sim"), /* VCCEN */
804 SUNXI_FUNCTION(0x7, "csi1")), /* D17 */
479 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH18, 805 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH18,
480 SUNXI_FUNCTION(0x0, "gpio_in"), 806 SUNXI_FUNCTION(0x0, "gpio_in"),
481 SUNXI_FUNCTION(0x1, "gpio_out")), 807 SUNXI_FUNCTION(0x1, "gpio_out"),
808 SUNXI_FUNCTION(0x2, "lcd1"), /* D18 */
809 SUNXI_FUNCTION(0x3, "pata"), /* ATAD14 */
810 SUNXI_FUNCTION(0x4, "keypad"), /* OUT0 */
811 SUNXI_FUNCTION(0x5, "sim"), /* SCK */
812 SUNXI_FUNCTION(0x7, "csi1")), /* D18 */
482 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH19, 813 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH19,
483 SUNXI_FUNCTION(0x0, "gpio_in"), 814 SUNXI_FUNCTION(0x0, "gpio_in"),
484 SUNXI_FUNCTION(0x1, "gpio_out")), 815 SUNXI_FUNCTION(0x1, "gpio_out"),
816 SUNXI_FUNCTION(0x2, "lcd1"), /* D19 */
817 SUNXI_FUNCTION(0x3, "pata"), /* ATAD15 */
818 SUNXI_FUNCTION(0x4, "keypad"), /* OUT1 */
819 SUNXI_FUNCTION(0x5, "sim"), /* SDA */
820 SUNXI_FUNCTION(0x7, "csi1")), /* D19 */
485 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH20, 821 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH20,
486 SUNXI_FUNCTION(0x0, "gpio_in"), 822 SUNXI_FUNCTION(0x0, "gpio_in"),
487 SUNXI_FUNCTION(0x1, "gpio_out")), 823 SUNXI_FUNCTION(0x1, "gpio_out"),
824 SUNXI_FUNCTION(0x2, "lcd1"), /* D20 */
825 SUNXI_FUNCTION(0x3, "pata"), /* ATAOE */
826 SUNXI_FUNCTION(0x4, "can"), /* TX */
827 SUNXI_FUNCTION(0x7, "csi1")), /* D20 */
488 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH21, 828 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH21,
489 SUNXI_FUNCTION(0x0, "gpio_in"), 829 SUNXI_FUNCTION(0x0, "gpio_in"),
490 SUNXI_FUNCTION(0x1, "gpio_out")), 830 SUNXI_FUNCTION(0x1, "gpio_out"),
831 SUNXI_FUNCTION(0x2, "lcd1"), /* D21 */
832 SUNXI_FUNCTION(0x3, "pata"), /* ATADREQ */
833 SUNXI_FUNCTION(0x4, "can"), /* RX */
834 SUNXI_FUNCTION(0x7, "csi1")), /* D21 */
491 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH22, 835 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH22,
492 SUNXI_FUNCTION(0x0, "gpio_in"), 836 SUNXI_FUNCTION(0x0, "gpio_in"),
493 SUNXI_FUNCTION(0x1, "gpio_out")), 837 SUNXI_FUNCTION(0x1, "gpio_out"),
838 SUNXI_FUNCTION(0x2, "lcd1"), /* D22 */
839 SUNXI_FUNCTION(0x3, "pata"), /* ATADACK */
840 SUNXI_FUNCTION(0x4, "keypad"), /* OUT2 */
841 SUNXI_FUNCTION(0x5, "mmc1"), /* CMD */
842 SUNXI_FUNCTION(0x7, "csi1")), /* D22 */
494 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH23, 843 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH23,
495 SUNXI_FUNCTION(0x0, "gpio_in"), 844 SUNXI_FUNCTION(0x0, "gpio_in"),
496 SUNXI_FUNCTION(0x1, "gpio_out")), 845 SUNXI_FUNCTION(0x1, "gpio_out"),
846 SUNXI_FUNCTION(0x2, "lcd1"), /* D23 */
847 SUNXI_FUNCTION(0x3, "pata"), /* ATACS0 */
848 SUNXI_FUNCTION(0x4, "keypad"), /* OUT3 */
849 SUNXI_FUNCTION(0x5, "mmc1"), /* CLK */
850 SUNXI_FUNCTION(0x7, "csi1")), /* D23 */
497 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH24, 851 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH24,
498 SUNXI_FUNCTION(0x0, "gpio_in"), 852 SUNXI_FUNCTION(0x0, "gpio_in"),
499 SUNXI_FUNCTION(0x1, "gpio_out")), 853 SUNXI_FUNCTION(0x1, "gpio_out"),
854 SUNXI_FUNCTION(0x2, "lcd1"), /* CLK */
855 SUNXI_FUNCTION(0x3, "pata"), /* ATACS1 */
856 SUNXI_FUNCTION(0x4, "keypad"), /* OUT4 */
857 SUNXI_FUNCTION(0x5, "mmc1"), /* D0 */
858 SUNXI_FUNCTION(0x7, "csi1")), /* PCLK */
500 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH25, 859 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH25,
501 SUNXI_FUNCTION(0x0, "gpio_in"), 860 SUNXI_FUNCTION(0x0, "gpio_in"),
502 SUNXI_FUNCTION(0x1, "gpio_out")), 861 SUNXI_FUNCTION(0x1, "gpio_out"),
862 SUNXI_FUNCTION(0x2, "lcd1"), /* DE */
863 SUNXI_FUNCTION(0x3, "pata"), /* ATAIORDY */
864 SUNXI_FUNCTION(0x4, "keypad"), /* OUT5 */
865 SUNXI_FUNCTION(0x5, "mmc1"), /* D1 */
866 SUNXI_FUNCTION(0x7, "csi1")), /* FIELD */
503 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH26, 867 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH26,
504 SUNXI_FUNCTION(0x0, "gpio_in"), 868 SUNXI_FUNCTION(0x0, "gpio_in"),
505 SUNXI_FUNCTION(0x1, "gpio_out")), 869 SUNXI_FUNCTION(0x1, "gpio_out"),
870 SUNXI_FUNCTION(0x2, "lcd1"), /* HSYNC */
871 SUNXI_FUNCTION(0x3, "pata"), /* ATAIOR */
872 SUNXI_FUNCTION(0x4, "keypad"), /* OUT6 */
873 SUNXI_FUNCTION(0x5, "mmc1"), /* D2 */
874 SUNXI_FUNCTION(0x7, "csi1")), /* HSYNC */
506 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH27, 875 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH27,
507 SUNXI_FUNCTION(0x0, "gpio_in"), 876 SUNXI_FUNCTION(0x0, "gpio_in"),
508 SUNXI_FUNCTION(0x1, "gpio_out")), 877 SUNXI_FUNCTION(0x1, "gpio_out"),
878 SUNXI_FUNCTION(0x2, "lcd1"), /* VSYNC */
879 SUNXI_FUNCTION(0x3, "pata"), /* ATAIOW */
880 SUNXI_FUNCTION(0x4, "keypad"), /* OUT7 */
881 SUNXI_FUNCTION(0x5, "mmc1"), /* D3 */
882 SUNXI_FUNCTION(0x7, "csi1")), /* VSYNC */
509 /* Hole */ 883 /* Hole */
510 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI0, 884 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI0,
511 SUNXI_FUNCTION(0x0, "gpio_in"), 885 SUNXI_FUNCTION(0x0, "gpio_in"),
@@ -518,277 +892,401 @@ static const struct sunxi_desc_pin sun4i_a10_pins[] = {
518 SUNXI_FUNCTION(0x1, "gpio_out")), 892 SUNXI_FUNCTION(0x1, "gpio_out")),
519 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI3, 893 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI3,
520 SUNXI_FUNCTION(0x0, "gpio_in"), 894 SUNXI_FUNCTION(0x0, "gpio_in"),
521 SUNXI_FUNCTION(0x1, "gpio_out")), 895 SUNXI_FUNCTION(0x1, "gpio_out"),
896 SUNXI_FUNCTION(0x2, "pwm")), /* PWM1 */
522 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI4, 897 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI4,
523 SUNXI_FUNCTION(0x0, "gpio_in"), 898 SUNXI_FUNCTION(0x0, "gpio_in"),
524 SUNXI_FUNCTION(0x1, "gpio_out")), 899 SUNXI_FUNCTION(0x1, "gpio_out"),
900 SUNXI_FUNCTION(0x2, "mmc3")), /* CMD */
525 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI5, 901 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI5,
526 SUNXI_FUNCTION(0x0, "gpio_in"), 902 SUNXI_FUNCTION(0x0, "gpio_in"),
527 SUNXI_FUNCTION(0x1, "gpio_out")), 903 SUNXI_FUNCTION(0x1, "gpio_out"),
904 SUNXI_FUNCTION(0x2, "mmc3")), /* CLK */
528 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI6, 905 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI6,
529 SUNXI_FUNCTION(0x0, "gpio_in"), 906 SUNXI_FUNCTION(0x0, "gpio_in"),
530 SUNXI_FUNCTION(0x1, "gpio_out")), 907 SUNXI_FUNCTION(0x1, "gpio_out"),
908 SUNXI_FUNCTION(0x2, "mmc3")), /* D0 */
531 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI7, 909 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI7,
532 SUNXI_FUNCTION(0x0, "gpio_in"), 910 SUNXI_FUNCTION(0x0, "gpio_in"),
533 SUNXI_FUNCTION(0x1, "gpio_out")), 911 SUNXI_FUNCTION(0x1, "gpio_out"),
912 SUNXI_FUNCTION(0x2, "mmc3")), /* D1 */
534 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI8, 913 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI8,
535 SUNXI_FUNCTION(0x0, "gpio_in"), 914 SUNXI_FUNCTION(0x0, "gpio_in"),
536 SUNXI_FUNCTION(0x1, "gpio_out")), 915 SUNXI_FUNCTION(0x1, "gpio_out"),
916 SUNXI_FUNCTION(0x2, "mmc3")), /* D2 */
537 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI9, 917 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI9,
538 SUNXI_FUNCTION(0x0, "gpio_in"), 918 SUNXI_FUNCTION(0x0, "gpio_in"),
539 SUNXI_FUNCTION(0x1, "gpio_out")), 919 SUNXI_FUNCTION(0x1, "gpio_out"),
920 SUNXI_FUNCTION(0x2, "mmc3")), /* D3 */
540 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI10, 921 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI10,
541 SUNXI_FUNCTION(0x0, "gpio_in"), 922 SUNXI_FUNCTION(0x0, "gpio_in"),
542 SUNXI_FUNCTION(0x1, "gpio_out")), 923 SUNXI_FUNCTION(0x1, "gpio_out"),
924 SUNXI_FUNCTION(0x2, "spi0"), /* CS0 */
925 SUNXI_FUNCTION(0x3, "uart5")), /* TX */
543 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI11, 926 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI11,
544 SUNXI_FUNCTION(0x0, "gpio_in"), 927 SUNXI_FUNCTION(0x0, "gpio_in"),
545 SUNXI_FUNCTION(0x1, "gpio_out")), 928 SUNXI_FUNCTION(0x1, "gpio_out"),
929 SUNXI_FUNCTION(0x2, "spi0"), /* CLK */
930 SUNXI_FUNCTION(0x3, "uart5")), /* RX */
546 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI12, 931 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI12,
547 SUNXI_FUNCTION(0x0, "gpio_in"), 932 SUNXI_FUNCTION(0x0, "gpio_in"),
548 SUNXI_FUNCTION(0x1, "gpio_out")), 933 SUNXI_FUNCTION(0x1, "gpio_out"),
934 SUNXI_FUNCTION(0x2, "spi0"), /* MOSI */
935 SUNXI_FUNCTION(0x3, "uart6")), /* TX */
549 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI13, 936 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI13,
550 SUNXI_FUNCTION(0x0, "gpio_in"), 937 SUNXI_FUNCTION(0x0, "gpio_in"),
551 SUNXI_FUNCTION(0x1, "gpio_out")), 938 SUNXI_FUNCTION(0x1, "gpio_out"),
939 SUNXI_FUNCTION(0x2, "spi0"), /* MISO */
940 SUNXI_FUNCTION(0x3, "uart6")), /* RX */
552 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI14, 941 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI14,
553 SUNXI_FUNCTION(0x0, "gpio_in"), 942 SUNXI_FUNCTION(0x0, "gpio_in"),
554 SUNXI_FUNCTION(0x1, "gpio_out")), 943 SUNXI_FUNCTION(0x1, "gpio_out"),
944 SUNXI_FUNCTION(0x2, "spi0"), /* CS1 */
945 SUNXI_FUNCTION(0x3, "ps2"), /* SCK1 */
946 SUNXI_FUNCTION(0x4, "timer4")), /* TCLKIN0 */
555 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI15, 947 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI15,
556 SUNXI_FUNCTION(0x0, "gpio_in"), 948 SUNXI_FUNCTION(0x0, "gpio_in"),
557 SUNXI_FUNCTION(0x1, "gpio_out")), 949 SUNXI_FUNCTION(0x1, "gpio_out"),
950 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */
951 SUNXI_FUNCTION(0x3, "ps2"), /* SDA1 */
952 SUNXI_FUNCTION(0x4, "timer5")), /* TCLKIN1 */
558 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI16, 953 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI16,
559 SUNXI_FUNCTION(0x0, "gpio_in"), 954 SUNXI_FUNCTION(0x0, "gpio_in"),
560 SUNXI_FUNCTION(0x1, "gpio_out")), 955 SUNXI_FUNCTION(0x1, "gpio_out"),
956 SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
957 SUNXI_FUNCTION(0x3, "uart2")), /* RTS */
561 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI17, 958 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI17,
562 SUNXI_FUNCTION(0x0, "gpio_in"), 959 SUNXI_FUNCTION(0x0, "gpio_in"),
563 SUNXI_FUNCTION(0x1, "gpio_out")), 960 SUNXI_FUNCTION(0x1, "gpio_out"),
961 SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
962 SUNXI_FUNCTION(0x3, "uart2")), /* CTS */
564 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI18, 963 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI18,
565 SUNXI_FUNCTION(0x0, "gpio_in"), 964 SUNXI_FUNCTION(0x0, "gpio_in"),
566 SUNXI_FUNCTION(0x1, "gpio_out")), 965 SUNXI_FUNCTION(0x1, "gpio_out"),
966 SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
967 SUNXI_FUNCTION(0x3, "uart2")), /* TX */
567 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI19, 968 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI19,
568 SUNXI_FUNCTION(0x0, "gpio_in"), 969 SUNXI_FUNCTION(0x0, "gpio_in"),
569 SUNXI_FUNCTION(0x1, "gpio_out")), 970 SUNXI_FUNCTION(0x1, "gpio_out"),
971 SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
972 SUNXI_FUNCTION(0x3, "uart2")), /* RX */
570 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI20, 973 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI20,
571 SUNXI_FUNCTION(0x0, "gpio_in"), 974 SUNXI_FUNCTION(0x0, "gpio_in"),
572 SUNXI_FUNCTION(0x1, "gpio_out")), 975 SUNXI_FUNCTION(0x1, "gpio_out"),
976 SUNXI_FUNCTION(0x2, "ps2"), /* SCK0 */
977 SUNXI_FUNCTION(0x3, "uart7"), /* TX */
978 SUNXI_FUNCTION(0x4, "hdmi")), /* HSCL */
573 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI21, 979 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI21,
574 SUNXI_FUNCTION(0x0, "gpio_in"), 980 SUNXI_FUNCTION(0x0, "gpio_in"),
575 SUNXI_FUNCTION(0x1, "gpio_out")), 981 SUNXI_FUNCTION(0x1, "gpio_out"),
982 SUNXI_FUNCTION(0x2, "ps2"), /* SDA0 */
983 SUNXI_FUNCTION(0x3, "uart7"), /* RX */
984 SUNXI_FUNCTION(0x4, "hdmi")), /* HSDA */
576}; 985};
577 986
578static const struct sunxi_desc_pin sun5i_a13_pins[] = { 987static const struct sunxi_desc_pin sun5i_a13_pins[] = {
579 /* Hole */ 988 /* Hole */
580 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0, 989 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0,
581 SUNXI_FUNCTION(0x0, "gpio_in"), 990 SUNXI_FUNCTION(0x0, "gpio_in"),
582 SUNXI_FUNCTION(0x1, "gpio_out")), 991 SUNXI_FUNCTION(0x1, "gpio_out"),
992 SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
583 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1, 993 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1,
584 SUNXI_FUNCTION(0x0, "gpio_in"), 994 SUNXI_FUNCTION(0x0, "gpio_in"),
585 SUNXI_FUNCTION(0x1, "gpio_out")), 995 SUNXI_FUNCTION(0x1, "gpio_out"),
996 SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
586 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2, 997 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2,
587 SUNXI_FUNCTION(0x0, "gpio_in"), 998 SUNXI_FUNCTION(0x0, "gpio_in"),
588 SUNXI_FUNCTION(0x1, "gpio_out")), 999 SUNXI_FUNCTION(0x1, "gpio_out"),
1000 SUNXI_FUNCTION(0x2, "pwm")),
589 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3, 1001 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3,
590 SUNXI_FUNCTION(0x0, "gpio_in"), 1002 SUNXI_FUNCTION(0x0, "gpio_in"),
591 SUNXI_FUNCTION(0x1, "gpio_out")), 1003 SUNXI_FUNCTION(0x1, "gpio_out"),
1004 SUNXI_FUNCTION(0x2, "ir0")), /* TX */
592 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4, 1005 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4,
593 SUNXI_FUNCTION(0x0, "gpio_in"), 1006 SUNXI_FUNCTION(0x0, "gpio_in"),
594 SUNXI_FUNCTION(0x1, "gpio_out")), 1007 SUNXI_FUNCTION(0x1, "gpio_out"),
1008 SUNXI_FUNCTION(0x2, "ir0")), /* RX */
595 /* Hole */ 1009 /* Hole */
596 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10, 1010 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10,
597 SUNXI_FUNCTION(0x0, "gpio_in"), 1011 SUNXI_FUNCTION(0x0, "gpio_in"),
598 SUNXI_FUNCTION(0x1, "gpio_out")), 1012 SUNXI_FUNCTION(0x1, "gpio_out"),
1013 SUNXI_FUNCTION(0x2, "spi2")), /* CS1 */
599 /* Hole */ 1014 /* Hole */
600 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15, 1015 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15,
601 SUNXI_FUNCTION(0x0, "gpio_in"), 1016 SUNXI_FUNCTION(0x0, "gpio_in"),
602 SUNXI_FUNCTION(0x1, "gpio_out")), 1017 SUNXI_FUNCTION(0x1, "gpio_out"),
1018 SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
603 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16, 1019 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16,
604 SUNXI_FUNCTION(0x0, "gpio_in"), 1020 SUNXI_FUNCTION(0x0, "gpio_in"),
605 SUNXI_FUNCTION(0x1, "gpio_out")), 1021 SUNXI_FUNCTION(0x1, "gpio_out"),
1022 SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
606 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17, 1023 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17,
607 SUNXI_FUNCTION(0x0, "gpio_in"), 1024 SUNXI_FUNCTION(0x0, "gpio_in"),
608 SUNXI_FUNCTION(0x1, "gpio_out")), 1025 SUNXI_FUNCTION(0x1, "gpio_out"),
1026 SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
609 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18, 1027 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18,
610 SUNXI_FUNCTION(0x0, "gpio_in"), 1028 SUNXI_FUNCTION(0x0, "gpio_in"),
611 SUNXI_FUNCTION(0x1, "gpio_out")), 1029 SUNXI_FUNCTION(0x1, "gpio_out"),
1030 SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
612 /* Hole */ 1031 /* Hole */
613 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0, 1032 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0,
614 SUNXI_FUNCTION(0x0, "gpio_in"), 1033 SUNXI_FUNCTION(0x0, "gpio_in"),
615 SUNXI_FUNCTION(0x1, "gpio_out")), 1034 SUNXI_FUNCTION(0x1, "gpio_out"),
1035 SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
1036 SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
616 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1, 1037 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1,
617 SUNXI_FUNCTION(0x0, "gpio_in"), 1038 SUNXI_FUNCTION(0x0, "gpio_in"),
618 SUNXI_FUNCTION(0x1, "gpio_out")), 1039 SUNXI_FUNCTION(0x1, "gpio_out"),
1040 SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
1041 SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
619 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2, 1042 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2,
620 SUNXI_FUNCTION(0x0, "gpio_in"), 1043 SUNXI_FUNCTION(0x0, "gpio_in"),
621 SUNXI_FUNCTION(0x1, "gpio_out")), 1044 SUNXI_FUNCTION(0x1, "gpio_out"),
1045 SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
1046 SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
622 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3, 1047 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3,
623 SUNXI_FUNCTION(0x0, "gpio_in"), 1048 SUNXI_FUNCTION(0x0, "gpio_in"),
624 SUNXI_FUNCTION(0x1, "gpio_out")), 1049 SUNXI_FUNCTION(0x1, "gpio_out"),
1050 SUNXI_FUNCTION(0x2, "nand0"), /* NCE1 */
1051 SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
625 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4, 1052 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4,
626 SUNXI_FUNCTION(0x0, "gpio_in"), 1053 SUNXI_FUNCTION(0x0, "gpio_in"),
627 SUNXI_FUNCTION(0x1, "gpio_out")), 1054 SUNXI_FUNCTION(0x1, "gpio_out"),
1055 SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
628 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5, 1056 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5,
629 SUNXI_FUNCTION(0x0, "gpio_in"), 1057 SUNXI_FUNCTION(0x0, "gpio_in"),
630 SUNXI_FUNCTION(0x1, "gpio_out")), 1058 SUNXI_FUNCTION(0x1, "gpio_out"),
1059 SUNXI_FUNCTION(0x2, "nand0")), /* NRE */
631 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6, 1060 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6,
632 SUNXI_FUNCTION(0x0, "gpio_in"), 1061 SUNXI_FUNCTION(0x0, "gpio_in"),
633 SUNXI_FUNCTION(0x1, "gpio_out")), 1062 SUNXI_FUNCTION(0x1, "gpio_out"),
1063 SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
1064 SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
634 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7, 1065 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7,
635 SUNXI_FUNCTION(0x0, "gpio_in"), 1066 SUNXI_FUNCTION(0x0, "gpio_in"),
636 SUNXI_FUNCTION(0x1, "gpio_out")), 1067 SUNXI_FUNCTION(0x1, "gpio_out"),
1068 SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
1069 SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
637 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8, 1070 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8,
638 SUNXI_FUNCTION(0x0, "gpio_in"), 1071 SUNXI_FUNCTION(0x0, "gpio_in"),
639 SUNXI_FUNCTION(0x1, "gpio_out")), 1072 SUNXI_FUNCTION(0x1, "gpio_out"),
1073 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
1074 SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
640 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9, 1075 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9,
641 SUNXI_FUNCTION(0x0, "gpio_in"), 1076 SUNXI_FUNCTION(0x0, "gpio_in"),
642 SUNXI_FUNCTION(0x1, "gpio_out")), 1077 SUNXI_FUNCTION(0x1, "gpio_out"),
1078 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
1079 SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
643 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10, 1080 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10,
644 SUNXI_FUNCTION(0x0, "gpio_in"), 1081 SUNXI_FUNCTION(0x0, "gpio_in"),
645 SUNXI_FUNCTION(0x1, "gpio_out")), 1082 SUNXI_FUNCTION(0x1, "gpio_out"),
1083 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
1084 SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
646 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11, 1085 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11,
647 SUNXI_FUNCTION(0x0, "gpio_in"), 1086 SUNXI_FUNCTION(0x0, "gpio_in"),
648 SUNXI_FUNCTION(0x1, "gpio_out")), 1087 SUNXI_FUNCTION(0x1, "gpio_out"),
1088 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
1089 SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
649 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12, 1090 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12,
650 SUNXI_FUNCTION(0x0, "gpio_in"), 1091 SUNXI_FUNCTION(0x0, "gpio_in"),
651 SUNXI_FUNCTION(0x1, "gpio_out")), 1092 SUNXI_FUNCTION(0x1, "gpio_out"),
1093 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ4 */
1094 SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
652 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13, 1095 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13,
653 SUNXI_FUNCTION(0x0, "gpio_in"), 1096 SUNXI_FUNCTION(0x0, "gpio_in"),
654 SUNXI_FUNCTION(0x1, "gpio_out")), 1097 SUNXI_FUNCTION(0x1, "gpio_out"),
1098 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ5 */
1099 SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
655 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14, 1100 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14,
656 SUNXI_FUNCTION(0x0, "gpio_in"), 1101 SUNXI_FUNCTION(0x0, "gpio_in"),
657 SUNXI_FUNCTION(0x1, "gpio_out")), 1102 SUNXI_FUNCTION(0x1, "gpio_out"),
1103 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ6 */
1104 SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
658 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15, 1105 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15,
659 SUNXI_FUNCTION(0x0, "gpio_in"), 1106 SUNXI_FUNCTION(0x0, "gpio_in"),
660 SUNXI_FUNCTION(0x1, "gpio_out")), 1107 SUNXI_FUNCTION(0x1, "gpio_out"),
1108 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ7 */
1109 SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
661 /* Hole */ 1110 /* Hole */
662 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19, 1111 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19,
663 SUNXI_FUNCTION(0x0, "gpio_in"), 1112 SUNXI_FUNCTION(0x0, "gpio_in"),
664 SUNXI_FUNCTION(0x1, "gpio_out")), 1113 SUNXI_FUNCTION(0x1, "gpio_out"),
1114 SUNXI_FUNCTION(0x2, "nand0"), /* NDQS */
1115 SUNXI_FUNCTION(0x4, "uart3")), /* RTS */
665 /* Hole */ 1116 /* Hole */
666 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2, 1117 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2,
667 SUNXI_FUNCTION(0x0, "gpio_in"), 1118 SUNXI_FUNCTION(0x0, "gpio_in"),
668 SUNXI_FUNCTION(0x1, "gpio_out")), 1119 SUNXI_FUNCTION(0x1, "gpio_out"),
1120 SUNXI_FUNCTION(0x2, "lcd0")), /* D2 */
669 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3, 1121 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3,
670 SUNXI_FUNCTION(0x0, "gpio_in"), 1122 SUNXI_FUNCTION(0x0, "gpio_in"),
671 SUNXI_FUNCTION(0x1, "gpio_out")), 1123 SUNXI_FUNCTION(0x1, "gpio_out"),
1124 SUNXI_FUNCTION(0x2, "lcd0")), /* D3 */
672 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4, 1125 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4,
673 SUNXI_FUNCTION(0x0, "gpio_in"), 1126 SUNXI_FUNCTION(0x0, "gpio_in"),
674 SUNXI_FUNCTION(0x1, "gpio_out")), 1127 SUNXI_FUNCTION(0x1, "gpio_out"),
1128 SUNXI_FUNCTION(0x2, "lcd0")), /* D4 */
675 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5, 1129 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5,
676 SUNXI_FUNCTION(0x0, "gpio_in"), 1130 SUNXI_FUNCTION(0x0, "gpio_in"),
677 SUNXI_FUNCTION(0x1, "gpio_out")), 1131 SUNXI_FUNCTION(0x1, "gpio_out"),
1132 SUNXI_FUNCTION(0x2, "lcd0")), /* D5 */
678 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6, 1133 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6,
679 SUNXI_FUNCTION(0x0, "gpio_in"), 1134 SUNXI_FUNCTION(0x0, "gpio_in"),
680 SUNXI_FUNCTION(0x1, "gpio_out")), 1135 SUNXI_FUNCTION(0x1, "gpio_out"),
1136 SUNXI_FUNCTION(0x2, "lcd0")), /* D6 */
681 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7, 1137 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7,
682 SUNXI_FUNCTION(0x0, "gpio_in"), 1138 SUNXI_FUNCTION(0x0, "gpio_in"),
683 SUNXI_FUNCTION(0x1, "gpio_out")), 1139 SUNXI_FUNCTION(0x1, "gpio_out"),
1140 SUNXI_FUNCTION(0x2, "lcd0")), /* D7 */
684 /* Hole */ 1141 /* Hole */
685 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10, 1142 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10,
686 SUNXI_FUNCTION(0x0, "gpio_in"), 1143 SUNXI_FUNCTION(0x0, "gpio_in"),
687 SUNXI_FUNCTION(0x1, "gpio_out")), 1144 SUNXI_FUNCTION(0x1, "gpio_out"),
1145 SUNXI_FUNCTION(0x2, "lcd0")), /* D10 */
688 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11, 1146 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11,
689 SUNXI_FUNCTION(0x0, "gpio_in"), 1147 SUNXI_FUNCTION(0x0, "gpio_in"),
690 SUNXI_FUNCTION(0x1, "gpio_out")), 1148 SUNXI_FUNCTION(0x1, "gpio_out"),
1149 SUNXI_FUNCTION(0x2, "lcd0")), /* D11 */
691 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12, 1150 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12,
692 SUNXI_FUNCTION(0x0, "gpio_in"), 1151 SUNXI_FUNCTION(0x0, "gpio_in"),
693 SUNXI_FUNCTION(0x1, "gpio_out")), 1152 SUNXI_FUNCTION(0x1, "gpio_out"),
1153 SUNXI_FUNCTION(0x2, "lcd0")), /* D12 */
694 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13, 1154 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13,
695 SUNXI_FUNCTION(0x0, "gpio_in"), 1155 SUNXI_FUNCTION(0x0, "gpio_in"),
696 SUNXI_FUNCTION(0x1, "gpio_out")), 1156 SUNXI_FUNCTION(0x1, "gpio_out"),
1157 SUNXI_FUNCTION(0x2, "lcd0")), /* D13 */
697 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14, 1158 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14,
698 SUNXI_FUNCTION(0x0, "gpio_in"), 1159 SUNXI_FUNCTION(0x0, "gpio_in"),
699 SUNXI_FUNCTION(0x1, "gpio_out")), 1160 SUNXI_FUNCTION(0x1, "gpio_out"),
1161 SUNXI_FUNCTION(0x2, "lcd0")), /* D14 */
700 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15, 1162 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15,
701 SUNXI_FUNCTION(0x0, "gpio_in"), 1163 SUNXI_FUNCTION(0x0, "gpio_in"),
702 SUNXI_FUNCTION(0x1, "gpio_out")), 1164 SUNXI_FUNCTION(0x1, "gpio_out"),
1165 SUNXI_FUNCTION(0x2, "lcd0")), /* D15 */
703 /* Hole */ 1166 /* Hole */
704 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18, 1167 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18,
705 SUNXI_FUNCTION(0x0, "gpio_in"), 1168 SUNXI_FUNCTION(0x0, "gpio_in"),
706 SUNXI_FUNCTION(0x1, "gpio_out")), 1169 SUNXI_FUNCTION(0x1, "gpio_out"),
1170 SUNXI_FUNCTION(0x2, "lcd0")), /* D18 */
707 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19, 1171 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19,
708 SUNXI_FUNCTION(0x0, "gpio_in"), 1172 SUNXI_FUNCTION(0x0, "gpio_in"),
709 SUNXI_FUNCTION(0x1, "gpio_out")), 1173 SUNXI_FUNCTION(0x1, "gpio_out"),
1174 SUNXI_FUNCTION(0x2, "lcd0")), /* D19 */
710 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20, 1175 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20,
711 SUNXI_FUNCTION(0x0, "gpio_in"), 1176 SUNXI_FUNCTION(0x0, "gpio_in"),
712 SUNXI_FUNCTION(0x1, "gpio_out")), 1177 SUNXI_FUNCTION(0x1, "gpio_out"),
1178 SUNXI_FUNCTION(0x2, "lcd0")), /* D20 */
713 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21, 1179 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21,
714 SUNXI_FUNCTION(0x0, "gpio_in"), 1180 SUNXI_FUNCTION(0x0, "gpio_in"),
715 SUNXI_FUNCTION(0x1, "gpio_out")), 1181 SUNXI_FUNCTION(0x1, "gpio_out"),
1182 SUNXI_FUNCTION(0x2, "lcd0")), /* D21 */
716 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22, 1183 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22,
717 SUNXI_FUNCTION(0x0, "gpio_in"), 1184 SUNXI_FUNCTION(0x0, "gpio_in"),
718 SUNXI_FUNCTION(0x1, "gpio_out")), 1185 SUNXI_FUNCTION(0x1, "gpio_out"),
1186 SUNXI_FUNCTION(0x2, "lcd0")), /* D22 */
719 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23, 1187 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23,
720 SUNXI_FUNCTION(0x0, "gpio_in"), 1188 SUNXI_FUNCTION(0x0, "gpio_in"),
721 SUNXI_FUNCTION(0x1, "gpio_out")), 1189 SUNXI_FUNCTION(0x1, "gpio_out"),
1190 SUNXI_FUNCTION(0x2, "lcd0")), /* D23 */
722 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24, 1191 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24,
723 SUNXI_FUNCTION(0x0, "gpio_in"), 1192 SUNXI_FUNCTION(0x0, "gpio_in"),
724 SUNXI_FUNCTION(0x1, "gpio_out")), 1193 SUNXI_FUNCTION(0x1, "gpio_out"),
1194 SUNXI_FUNCTION(0x2, "lcd0")), /* CLK */
725 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25, 1195 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25,
726 SUNXI_FUNCTION(0x0, "gpio_in"), 1196 SUNXI_FUNCTION(0x0, "gpio_in"),
727 SUNXI_FUNCTION(0x1, "gpio_out")), 1197 SUNXI_FUNCTION(0x1, "gpio_out"),
1198 SUNXI_FUNCTION(0x2, "lcd0")), /* DE */
728 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26, 1199 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26,
729 SUNXI_FUNCTION(0x0, "gpio_in"), 1200 SUNXI_FUNCTION(0x0, "gpio_in"),
730 SUNXI_FUNCTION(0x1, "gpio_out")), 1201 SUNXI_FUNCTION(0x1, "gpio_out"),
1202 SUNXI_FUNCTION(0x2, "lcd0")), /* HSYNC */
731 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27, 1203 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27,
732 SUNXI_FUNCTION(0x0, "gpio_in"), 1204 SUNXI_FUNCTION(0x0, "gpio_in"),
733 SUNXI_FUNCTION(0x1, "gpio_out")), 1205 SUNXI_FUNCTION(0x1, "gpio_out"),
1206 SUNXI_FUNCTION(0x2, "lcd0")), /* VSYNC */
734 /* Hole */ 1207 /* Hole */
735 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0, 1208 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0,
736 SUNXI_FUNCTION(0x0, "gpio_in"), 1209 SUNXI_FUNCTION(0x0, "gpio_in"),
737 SUNXI_FUNCTION(0x1, "gpio_out")), 1210 SUNXI_FUNCTION(0x3, "csi0"), /* PCLK */
1211 SUNXI_FUNCTION(0x4, "spi2")), /* CS0 */
738 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1, 1212 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1,
739 SUNXI_FUNCTION(0x0, "gpio_in"), 1213 SUNXI_FUNCTION(0x0, "gpio_in"),
740 SUNXI_FUNCTION(0x1, "gpio_out")), 1214 SUNXI_FUNCTION(0x3, "csi0"), /* MCLK */
1215 SUNXI_FUNCTION(0x4, "spi2")), /* CLK */
741 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2, 1216 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2,
742 SUNXI_FUNCTION(0x0, "gpio_in"), 1217 SUNXI_FUNCTION(0x0, "gpio_in"),
743 SUNXI_FUNCTION(0x1, "gpio_out")), 1218 SUNXI_FUNCTION(0x3, "csi0"), /* HSYNC */
1219 SUNXI_FUNCTION(0x4, "spi2")), /* MOSI */
744 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3, 1220 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3,
745 SUNXI_FUNCTION(0x0, "gpio_in"), 1221 SUNXI_FUNCTION(0x0, "gpio_in"),
746 SUNXI_FUNCTION(0x1, "gpio_out")), 1222 SUNXI_FUNCTION(0x1, "gpio_out"),
1223 SUNXI_FUNCTION(0x3, "csi0"), /* VSYNC */
1224 SUNXI_FUNCTION(0x4, "spi2")), /* MISO */
747 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4, 1225 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4,
748 SUNXI_FUNCTION(0x0, "gpio_in"), 1226 SUNXI_FUNCTION(0x0, "gpio_in"),
749 SUNXI_FUNCTION(0x1, "gpio_out")), 1227 SUNXI_FUNCTION(0x1, "gpio_out"),
1228 SUNXI_FUNCTION(0x3, "csi0"), /* D0 */
1229 SUNXI_FUNCTION(0x4, "mmc2")), /* D0 */
750 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5, 1230 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5,
751 SUNXI_FUNCTION(0x0, "gpio_in"), 1231 SUNXI_FUNCTION(0x0, "gpio_in"),
752 SUNXI_FUNCTION(0x1, "gpio_out")), 1232 SUNXI_FUNCTION(0x1, "gpio_out"),
1233 SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
1234 SUNXI_FUNCTION(0x4, "mmc2")), /* D1 */
753 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6, 1235 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6,
754 SUNXI_FUNCTION(0x0, "gpio_in"), 1236 SUNXI_FUNCTION(0x0, "gpio_in"),
755 SUNXI_FUNCTION(0x1, "gpio_out")), 1237 SUNXI_FUNCTION(0x1, "gpio_out"),
1238 SUNXI_FUNCTION(0x3, "csi0"), /* D2 */
1239 SUNXI_FUNCTION(0x4, "mmc2")), /* D2 */
756 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7, 1240 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7,
757 SUNXI_FUNCTION(0x0, "gpio_in"), 1241 SUNXI_FUNCTION(0x0, "gpio_in"),
758 SUNXI_FUNCTION(0x1, "gpio_out")), 1242 SUNXI_FUNCTION(0x1, "gpio_out"),
1243 SUNXI_FUNCTION(0x3, "csi0"), /* D3 */
1244 SUNXI_FUNCTION(0x4, "mmc2")), /* D3 */
759 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8, 1245 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8,
760 SUNXI_FUNCTION(0x0, "gpio_in"), 1246 SUNXI_FUNCTION(0x0, "gpio_in"),
761 SUNXI_FUNCTION(0x1, "gpio_out")), 1247 SUNXI_FUNCTION(0x1, "gpio_out"),
1248 SUNXI_FUNCTION(0x3, "csi0"), /* D4 */
1249 SUNXI_FUNCTION(0x4, "mmc2")), /* CMD */
762 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9, 1250 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9,
763 SUNXI_FUNCTION(0x0, "gpio_in"), 1251 SUNXI_FUNCTION(0x0, "gpio_in"),
764 SUNXI_FUNCTION(0x1, "gpio_out")), 1252 SUNXI_FUNCTION(0x1, "gpio_out"),
1253 SUNXI_FUNCTION(0x3, "csi0"), /* D5 */
1254 SUNXI_FUNCTION(0x4, "mmc2")), /* CLK */
765 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10, 1255 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10,
766 SUNXI_FUNCTION(0x0, "gpio_in"), 1256 SUNXI_FUNCTION(0x0, "gpio_in"),
767 SUNXI_FUNCTION(0x1, "gpio_out"), 1257 SUNXI_FUNCTION(0x1, "gpio_out"),
1258 SUNXI_FUNCTION(0x3, "csi0"), /* D6 */
768 SUNXI_FUNCTION(0x4, "uart1")), /* TX */ 1259 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
769 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11, 1260 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11,
770 SUNXI_FUNCTION(0x0, "gpio_in"), 1261 SUNXI_FUNCTION(0x0, "gpio_in"),
771 SUNXI_FUNCTION(0x1, "gpio_out"), 1262 SUNXI_FUNCTION(0x1, "gpio_out"),
1263 SUNXI_FUNCTION(0x3, "csi0"), /* D7 */
772 SUNXI_FUNCTION(0x4, "uart1")), /* RX */ 1264 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
773 /* Hole */ 1265 /* Hole */
774 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0, 1266 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0,
775 SUNXI_FUNCTION(0x0, "gpio_in"), 1267 SUNXI_FUNCTION(0x0, "gpio_in"),
776 SUNXI_FUNCTION(0x1, "gpio_out")), 1268 SUNXI_FUNCTION(0x1, "gpio_out"),
1269 SUNXI_FUNCTION(0x4, "mmc0")), /* D1 */
777 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1, 1270 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1,
778 SUNXI_FUNCTION(0x0, "gpio_in"), 1271 SUNXI_FUNCTION(0x0, "gpio_in"),
779 SUNXI_FUNCTION(0x1, "gpio_out")), 1272 SUNXI_FUNCTION(0x1, "gpio_out"),
1273 SUNXI_FUNCTION(0x4, "mmc0")), /* D0 */
780 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2, 1274 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2,
781 SUNXI_FUNCTION(0x0, "gpio_in"), 1275 SUNXI_FUNCTION(0x0, "gpio_in"),
782 SUNXI_FUNCTION(0x1, "gpio_out")), 1276 SUNXI_FUNCTION(0x1, "gpio_out"),
1277 SUNXI_FUNCTION(0x4, "mmc0")), /* CLK */
783 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3, 1278 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3,
784 SUNXI_FUNCTION(0x0, "gpio_in"), 1279 SUNXI_FUNCTION(0x0, "gpio_in"),
785 SUNXI_FUNCTION(0x1, "gpio_out")), 1280 SUNXI_FUNCTION(0x1, "gpio_out"),
1281 SUNXI_FUNCTION(0x4, "mmc0")), /* CMD */
786 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4, 1282 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4,
787 SUNXI_FUNCTION(0x0, "gpio_in"), 1283 SUNXI_FUNCTION(0x0, "gpio_in"),
788 SUNXI_FUNCTION(0x1, "gpio_out")), 1284 SUNXI_FUNCTION(0x1, "gpio_out"),
1285 SUNXI_FUNCTION(0x4, "mmc0")), /* D3 */
789 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5, 1286 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5,
790 SUNXI_FUNCTION(0x0, "gpio_in"), 1287 SUNXI_FUNCTION(0x0, "gpio_in"),
791 SUNXI_FUNCTION(0x1, "gpio_out")), 1288 SUNXI_FUNCTION(0x1, "gpio_out"),
1289 SUNXI_FUNCTION(0x4, "mmc0")), /* D2 */
792 /* Hole */ 1290 /* Hole */
793 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0, 1291 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0,
794 SUNXI_FUNCTION(0x0, "gpio_in"), 1292 SUNXI_FUNCTION(0x0, "gpio_in"),
@@ -802,24 +1300,34 @@ static const struct sunxi_desc_pin sun5i_a13_pins[] = {
802 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3, 1300 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3,
803 SUNXI_FUNCTION(0x0, "gpio_in"), 1301 SUNXI_FUNCTION(0x0, "gpio_in"),
804 SUNXI_FUNCTION(0x1, "gpio_out"), 1302 SUNXI_FUNCTION(0x1, "gpio_out"),
1303 SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
805 SUNXI_FUNCTION(0x4, "uart1")), /* TX */ 1304 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
806 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4, 1305 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4,
807 SUNXI_FUNCTION(0x0, "gpio_in"), 1306 SUNXI_FUNCTION(0x0, "gpio_in"),
808 SUNXI_FUNCTION(0x1, "gpio_out"), 1307 SUNXI_FUNCTION(0x1, "gpio_out"),
1308 SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
809 SUNXI_FUNCTION(0x4, "uart1")), /* RX */ 1309 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
810 /* Hole */ 1310/* Hole */
811 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9, 1311 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9,
812 SUNXI_FUNCTION(0x0, "gpio_in"), 1312 SUNXI_FUNCTION(0x0, "gpio_in"),
813 SUNXI_FUNCTION(0x1, "gpio_out")), 1313 SUNXI_FUNCTION(0x1, "gpio_out"),
1314 SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
1315 SUNXI_FUNCTION(0x3, "uart3")), /* TX */
814 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10, 1316 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10,
815 SUNXI_FUNCTION(0x0, "gpio_in"), 1317 SUNXI_FUNCTION(0x0, "gpio_in"),
816 SUNXI_FUNCTION(0x1, "gpio_out")), 1318 SUNXI_FUNCTION(0x1, "gpio_out"),
1319 SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
1320 SUNXI_FUNCTION(0x3, "uart3")), /* RX */
817 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11, 1321 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11,
818 SUNXI_FUNCTION(0x0, "gpio_in"), 1322 SUNXI_FUNCTION(0x0, "gpio_in"),
819 SUNXI_FUNCTION(0x1, "gpio_out")), 1323 SUNXI_FUNCTION(0x1, "gpio_out"),
1324 SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
1325 SUNXI_FUNCTION(0x3, "uart3")), /* CTS */
820 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG12, 1326 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG12,
821 SUNXI_FUNCTION(0x0, "gpio_in"), 1327 SUNXI_FUNCTION(0x0, "gpio_in"),
822 SUNXI_FUNCTION(0x1, "gpio_out")), 1328 SUNXI_FUNCTION(0x1, "gpio_out"),
1329 SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
1330 SUNXI_FUNCTION(0x3, "uart3")), /* RTS */
823}; 1331};
824 1332
825static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = { 1333static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
@@ -1029,7 +1537,7 @@ static void sunxi_pctrl_dt_free_map(struct pinctrl_dev *pctldev,
1029 kfree(map); 1537 kfree(map);
1030} 1538}
1031 1539
1032static struct pinctrl_ops sunxi_pctrl_ops = { 1540static const struct pinctrl_ops sunxi_pctrl_ops = {
1033 .dt_node_to_map = sunxi_pctrl_dt_node_to_map, 1541 .dt_node_to_map = sunxi_pctrl_dt_node_to_map,
1034 .dt_free_map = sunxi_pctrl_dt_free_map, 1542 .dt_free_map = sunxi_pctrl_dt_free_map,
1035 .get_groups_count = sunxi_pctrl_get_groups_count, 1543 .get_groups_count = sunxi_pctrl_get_groups_count,
@@ -1098,7 +1606,7 @@ static int sunxi_pconf_group_set(struct pinctrl_dev *pctldev,
1098 return 0; 1606 return 0;
1099} 1607}
1100 1608
1101static struct pinconf_ops sunxi_pconf_ops = { 1609static const struct pinconf_ops sunxi_pconf_ops = {
1102 .pin_config_group_get = sunxi_pconf_group_get, 1610 .pin_config_group_get = sunxi_pconf_group_get,
1103 .pin_config_group_set = sunxi_pconf_group_set, 1611 .pin_config_group_set = sunxi_pconf_group_set,
1104}; 1612};
@@ -1204,7 +1712,7 @@ error:
1204 return ret; 1712 return ret;
1205} 1713}
1206 1714
1207static struct pinmux_ops sunxi_pmx_ops = { 1715static const struct pinmux_ops sunxi_pmx_ops = {
1208 .get_functions_count = sunxi_pmx_get_funcs_cnt, 1716 .get_functions_count = sunxi_pmx_get_funcs_cnt,
1209 .get_function_name = sunxi_pmx_get_func_name, 1717 .get_function_name = sunxi_pmx_get_func_name,
1210 .get_function_groups = sunxi_pmx_get_func_groups, 1718 .get_function_groups = sunxi_pmx_get_func_groups,
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
index f195d77a3572..2fa9bc6cd7ab 100644
--- a/drivers/pinctrl/pinctrl-tegra.c
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -316,7 +316,7 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
316 return 0; 316 return 0;
317} 317}
318 318
319static struct pinctrl_ops tegra_pinctrl_ops = { 319static const struct pinctrl_ops tegra_pinctrl_ops = {
320 .get_groups_count = tegra_pinctrl_get_groups_count, 320 .get_groups_count = tegra_pinctrl_get_groups_count,
321 .get_group_name = tegra_pinctrl_get_group_name, 321 .get_group_name = tegra_pinctrl_get_group_name,
322 .get_group_pins = tegra_pinctrl_get_group_pins, 322 .get_group_pins = tegra_pinctrl_get_group_pins,
@@ -401,7 +401,7 @@ static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev,
401 pmx_writel(pmx, val, g->mux_bank, g->mux_reg); 401 pmx_writel(pmx, val, g->mux_bank, g->mux_reg);
402} 402}
403 403
404static struct pinmux_ops tegra_pinmux_ops = { 404static const struct pinmux_ops tegra_pinmux_ops = {
405 .get_functions_count = tegra_pinctrl_get_funcs_count, 405 .get_functions_count = tegra_pinctrl_get_funcs_count,
406 .get_function_name = tegra_pinctrl_get_func_name, 406 .get_function_name = tegra_pinctrl_get_func_name,
407 .get_function_groups = tegra_pinctrl_get_func_groups, 407 .get_function_groups = tegra_pinctrl_get_func_groups,
@@ -676,7 +676,7 @@ static void tegra_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
676} 676}
677#endif 677#endif
678 678
679static struct pinconf_ops tegra_pinconf_ops = { 679static const struct pinconf_ops tegra_pinconf_ops = {
680 .pin_config_get = tegra_pinconf_get, 680 .pin_config_get = tegra_pinconf_get,
681 .pin_config_set = tegra_pinconf_set, 681 .pin_config_set = tegra_pinconf_set,
682 .pin_config_group_get = tegra_pinconf_group_get, 682 .pin_config_group_get = tegra_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index 2b5772550836..6a3a7503e6a0 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -860,7 +860,7 @@ static void u300_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
860 seq_printf(s, " " DRIVER_NAME); 860 seq_printf(s, " " DRIVER_NAME);
861} 861}
862 862
863static struct pinctrl_ops u300_pctrl_ops = { 863static const struct pinctrl_ops u300_pctrl_ops = {
864 .get_groups_count = u300_get_groups_count, 864 .get_groups_count = u300_get_groups_count,
865 .get_group_name = u300_get_group_name, 865 .get_group_name = u300_get_group_name,
866 .get_group_pins = u300_get_group_pins, 866 .get_group_pins = u300_get_group_pins,
@@ -1003,7 +1003,7 @@ static int u300_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
1003 return 0; 1003 return 0;
1004} 1004}
1005 1005
1006static struct pinmux_ops u300_pmx_ops = { 1006static const struct pinmux_ops u300_pmx_ops = {
1007 .get_functions_count = u300_pmx_get_funcs_count, 1007 .get_functions_count = u300_pmx_get_funcs_count,
1008 .get_function_name = u300_pmx_get_func_name, 1008 .get_function_name = u300_pmx_get_func_name,
1009 .get_function_groups = u300_pmx_get_groups, 1009 .get_function_groups = u300_pmx_get_groups,
@@ -1046,7 +1046,7 @@ static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
1046 return 0; 1046 return 0;
1047} 1047}
1048 1048
1049static struct pinconf_ops u300_pconf_ops = { 1049static const struct pinconf_ops u300_pconf_ops = {
1050 .is_generic = true, 1050 .is_generic = true,
1051 .pin_config_get = u300_pin_config_get, 1051 .pin_config_get = u300_pin_config_get,
1052 .pin_config_set = u300_pin_config_set, 1052 .pin_config_set = u300_pin_config_set,
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index 068224efa6fa..f2977cff8366 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -553,7 +553,7 @@ int xway_pinconf_group_set(struct pinctrl_dev *pctldev,
553 return ret; 553 return ret;
554} 554}
555 555
556static struct pinconf_ops xway_pinconf_ops = { 556static const struct pinconf_ops xway_pinconf_ops = {
557 .pin_config_get = xway_pinconf_get, 557 .pin_config_get = xway_pinconf_get,
558 .pin_config_set = xway_pinconf_set, 558 .pin_config_set = xway_pinconf_set,
559 .pin_config_group_set = xway_pinconf_group_set, 559 .pin_config_group_set = xway_pinconf_group_set,
diff --git a/drivers/pinctrl/sh-pfc/Kconfig b/drivers/pinctrl/sh-pfc/Kconfig
index c3340f54d2ad..af16f8f6ab6c 100644
--- a/drivers/pinctrl/sh-pfc/Kconfig
+++ b/drivers/pinctrl/sh-pfc/Kconfig
@@ -10,6 +10,7 @@ config PINCTRL_SH_PFC
10 select GPIO_SH_PFC if ARCH_REQUIRE_GPIOLIB 10 select GPIO_SH_PFC if ARCH_REQUIRE_GPIOLIB
11 select PINMUX 11 select PINMUX
12 select PINCONF 12 select PINCONF
13 select GENERIC_PINCONF
13 def_bool y 14 def_bool y
14 help 15 help
15 This enables pin control drivers for SH and SH Mobile platforms 16 This enables pin control drivers for SH and SH Mobile platforms
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 970ddff2b0b6..feef89792568 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#define DRV_NAME "sh-pfc" 12#define DRV_NAME "sh-pfc"
13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 13
15#include <linux/bitops.h> 14#include <linux/bitops.h>
16#include <linux/err.h> 15#include <linux/err.h>
@@ -30,10 +29,8 @@ static int sh_pfc_ioremap(struct sh_pfc *pfc, struct platform_device *pdev)
30 struct resource *res; 29 struct resource *res;
31 int k; 30 int k;
32 31
33 if (pdev->num_resources == 0) { 32 if (pdev->num_resources == 0)
34 pfc->num_windows = 0; 33 return -EINVAL;
35 return 0;
36 }
37 34
38 pfc->window = devm_kzalloc(pfc->dev, pdev->num_resources * 35 pfc->window = devm_kzalloc(pfc->dev, pdev->num_resources *
39 sizeof(*pfc->window), GFP_NOWAIT); 36 sizeof(*pfc->window), GFP_NOWAIT);
@@ -59,11 +56,11 @@ static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc,
59 unsigned long address) 56 unsigned long address)
60{ 57{
61 struct sh_pfc_window *window; 58 struct sh_pfc_window *window;
62 int k; 59 unsigned int i;
63 60
64 /* scan through physical windows and convert address */ 61 /* scan through physical windows and convert address */
65 for (k = 0; k < pfc->num_windows; k++) { 62 for (i = 0; i < pfc->num_windows; i++) {
66 window = pfc->window + k; 63 window = pfc->window + i;
67 64
68 if (address < window->phys) 65 if (address < window->phys)
69 continue; 66 continue;
@@ -74,11 +71,32 @@ static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc,
74 return window->virt + (address - window->phys); 71 return window->virt + (address - window->phys);
75 } 72 }
76 73
77 /* no windows defined, register must be 1:1 mapped virt:phys */ 74 BUG();
78 return (void __iomem *)address;
79} 75}
80 76
81static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r) 77int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin)
78{
79 unsigned int offset;
80 unsigned int i;
81
82 if (pfc->info->ranges == NULL)
83 return pin;
84
85 for (i = 0, offset = 0; i < pfc->info->nr_ranges; ++i) {
86 const struct pinmux_range *range = &pfc->info->ranges[i];
87
88 if (pin <= range->end)
89 return pin >= range->begin
90 ? offset + pin - range->begin : -1;
91
92 offset += range->end - range->begin + 1;
93 }
94
95 return -EINVAL;
96}
97
98static int sh_pfc_enum_in_range(pinmux_enum_t enum_id,
99 const struct pinmux_range *r)
82{ 100{
83 if (enum_id < r->begin) 101 if (enum_id < r->begin)
84 return 0; 102 return 0;
@@ -89,8 +107,8 @@ static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r)
89 return 1; 107 return 1;
90} 108}
91 109
92static unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, 110unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
93 unsigned long reg_width) 111 unsigned long reg_width)
94{ 112{
95 switch (reg_width) { 113 switch (reg_width) {
96 case 8: 114 case 8:
@@ -105,8 +123,8 @@ static unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
105 return 0; 123 return 0;
106} 124}
107 125
108static void sh_pfc_write_raw_reg(void __iomem *mapped_reg, 126void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
109 unsigned long reg_width, unsigned long data) 127 unsigned long data)
110{ 128{
111 switch (reg_width) { 129 switch (reg_width) {
112 case 8: 130 case 8:
@@ -123,39 +141,8 @@ static void sh_pfc_write_raw_reg(void __iomem *mapped_reg,
123 BUG(); 141 BUG();
124} 142}
125 143
126int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos)
127{
128 unsigned long pos;
129
130 pos = dr->reg_width - (in_pos + 1);
131
132 pr_debug("read_bit: addr = %lx, pos = %ld, "
133 "r_width = %ld\n", dr->reg, pos, dr->reg_width);
134
135 return (sh_pfc_read_raw_reg(dr->mapped_reg, dr->reg_width) >> pos) & 1;
136}
137
138void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
139 unsigned long value)
140{
141 unsigned long pos;
142
143 pos = dr->reg_width - (in_pos + 1);
144
145 pr_debug("write_bit addr = %lx, value = %d, pos = %ld, "
146 "r_width = %ld\n",
147 dr->reg, !!value, pos, dr->reg_width);
148
149 if (value)
150 set_bit(pos, &dr->reg_shadow);
151 else
152 clear_bit(pos, &dr->reg_shadow);
153
154 sh_pfc_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow);
155}
156
157static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, 144static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
158 struct pinmux_cfg_reg *crp, 145 const struct pinmux_cfg_reg *crp,
159 unsigned long in_pos, 146 unsigned long in_pos,
160 void __iomem **mapped_regp, 147 void __iomem **mapped_regp,
161 unsigned long *maskp, 148 unsigned long *maskp,
@@ -176,24 +163,8 @@ static void sh_pfc_config_reg_helper(struct sh_pfc *pfc,
176 } 163 }
177} 164}
178 165
179static int sh_pfc_read_config_reg(struct sh_pfc *pfc,
180 struct pinmux_cfg_reg *crp,
181 unsigned long field)
182{
183 void __iomem *mapped_reg;
184 unsigned long mask, pos;
185
186 sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos);
187
188 pr_debug("read_reg: addr = %lx, field = %ld, "
189 "r_width = %ld, f_width = %ld\n",
190 crp->reg, field, crp->reg_width, crp->field_width);
191
192 return (sh_pfc_read_raw_reg(mapped_reg, crp->reg_width) >> pos) & mask;
193}
194
195static void sh_pfc_write_config_reg(struct sh_pfc *pfc, 166static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
196 struct pinmux_cfg_reg *crp, 167 const struct pinmux_cfg_reg *crp,
197 unsigned long field, unsigned long value) 168 unsigned long field, unsigned long value)
198{ 169{
199 void __iomem *mapped_reg; 170 void __iomem *mapped_reg;
@@ -201,9 +172,9 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
201 172
202 sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); 173 sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos);
203 174
204 pr_debug("write_reg addr = %lx, value = %ld, field = %ld, " 175 dev_dbg(pfc->dev, "write_reg addr = %lx, value = %ld, field = %ld, "
205 "r_width = %ld, f_width = %ld\n", 176 "r_width = %ld, f_width = %ld\n",
206 crp->reg, value, field, crp->reg_width, crp->field_width); 177 crp->reg, value, field, crp->reg_width, crp->field_width);
207 178
208 mask = ~(mask << pos); 179 mask = ~(mask << pos);
209 value = value << pos; 180 value = value << pos;
@@ -220,83 +191,11 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc,
220 sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data); 191 sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data);
221} 192}
222 193
223static int sh_pfc_setup_data_reg(struct sh_pfc *pfc, unsigned gpio)
224{
225 struct pinmux_gpio *gpiop = &pfc->info->gpios[gpio];
226 struct pinmux_data_reg *data_reg;
227 int k, n;
228
229 if (!sh_pfc_enum_in_range(gpiop->enum_id, &pfc->info->data))
230 return -1;
231
232 k = 0;
233 while (1) {
234 data_reg = pfc->info->data_regs + k;
235
236 if (!data_reg->reg_width)
237 break;
238
239 data_reg->mapped_reg = sh_pfc_phys_to_virt(pfc, data_reg->reg);
240
241 for (n = 0; n < data_reg->reg_width; n++) {
242 if (data_reg->enum_ids[n] == gpiop->enum_id) {
243 gpiop->flags &= ~PINMUX_FLAG_DREG;
244 gpiop->flags |= (k << PINMUX_FLAG_DREG_SHIFT);
245 gpiop->flags &= ~PINMUX_FLAG_DBIT;
246 gpiop->flags |= (n << PINMUX_FLAG_DBIT_SHIFT);
247 return 0;
248 }
249 }
250 k++;
251 }
252
253 BUG();
254
255 return -1;
256}
257
258static void sh_pfc_setup_data_regs(struct sh_pfc *pfc)
259{
260 struct pinmux_data_reg *drp;
261 int k;
262
263 for (k = pfc->info->first_gpio; k <= pfc->info->last_gpio; k++)
264 sh_pfc_setup_data_reg(pfc, k);
265
266 k = 0;
267 while (1) {
268 drp = pfc->info->data_regs + k;
269
270 if (!drp->reg_width)
271 break;
272
273 drp->reg_shadow = sh_pfc_read_raw_reg(drp->mapped_reg,
274 drp->reg_width);
275 k++;
276 }
277}
278
279int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
280 struct pinmux_data_reg **drp, int *bitp)
281{
282 struct pinmux_gpio *gpiop = &pfc->info->gpios[gpio];
283 int k, n;
284
285 if (!sh_pfc_enum_in_range(gpiop->enum_id, &pfc->info->data))
286 return -1;
287
288 k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT;
289 n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT;
290 *drp = pfc->info->data_regs + k;
291 *bitp = n;
292 return 0;
293}
294
295static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, 194static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
296 struct pinmux_cfg_reg **crp, int *fieldp, 195 const struct pinmux_cfg_reg **crp, int *fieldp,
297 int *valuep, unsigned long **cntp) 196 int *valuep)
298{ 197{
299 struct pinmux_cfg_reg *config_reg; 198 const struct pinmux_cfg_reg *config_reg;
300 unsigned long r_width, f_width, curr_width, ncomb; 199 unsigned long r_width, f_width, curr_width, ncomb;
301 int k, m, n, pos, bit_pos; 200 int k, m, n, pos, bit_pos;
302 201
@@ -324,7 +223,6 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
324 *crp = config_reg; 223 *crp = config_reg;
325 *fieldp = m; 224 *fieldp = m;
326 *valuep = n; 225 *valuep = n;
327 *cntp = &config_reg->cnt[m];
328 return 0; 226 return 0;
329 } 227 }
330 } 228 }
@@ -334,47 +232,39 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
334 k++; 232 k++;
335 } 233 }
336 234
337 return -1; 235 return -EINVAL;
338} 236}
339 237
340int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, 238static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos,
341 pinmux_enum_t *enum_idp) 239 pinmux_enum_t *enum_idp)
342{ 240{
343 pinmux_enum_t enum_id = pfc->info->gpios[gpio].enum_id; 241 const pinmux_enum_t *data = pfc->info->gpio_data;
344 pinmux_enum_t *data = pfc->info->gpio_data;
345 int k; 242 int k;
346 243
347 if (!sh_pfc_enum_in_range(enum_id, &pfc->info->data)) {
348 if (!sh_pfc_enum_in_range(enum_id, &pfc->info->mark)) {
349 pr_err("non data/mark enum_id for gpio %d\n", gpio);
350 return -1;
351 }
352 }
353
354 if (pos) { 244 if (pos) {
355 *enum_idp = data[pos + 1]; 245 *enum_idp = data[pos + 1];
356 return pos + 1; 246 return pos + 1;
357 } 247 }
358 248
359 for (k = 0; k < pfc->info->gpio_data_size; k++) { 249 for (k = 0; k < pfc->info->gpio_data_size; k++) {
360 if (data[k] == enum_id) { 250 if (data[k] == mark) {
361 *enum_idp = data[k + 1]; 251 *enum_idp = data[k + 1];
362 return k + 1; 252 return k + 1;
363 } 253 }
364 } 254 }
365 255
366 pr_err("cannot locate data/mark enum_id for gpio %d\n", gpio); 256 dev_err(pfc->dev, "cannot locate data/mark enum_id for mark %d\n",
367 return -1; 257 mark);
258 return -EINVAL;
368} 259}
369 260
370int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, 261int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
371 int cfg_mode)
372{ 262{
373 struct pinmux_cfg_reg *cr = NULL; 263 const struct pinmux_cfg_reg *cr = NULL;
374 pinmux_enum_t enum_id; 264 pinmux_enum_t enum_id;
375 struct pinmux_range *range; 265 const struct pinmux_range *range;
376 int in_range, pos, field, value; 266 int in_range, pos, field, value;
377 unsigned long *cntp; 267 int ret;
378 268
379 switch (pinmux_type) { 269 switch (pinmux_type) {
380 270
@@ -399,7 +289,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
399 break; 289 break;
400 290
401 default: 291 default:
402 goto out_err; 292 return -EINVAL;
403 } 293 }
404 294
405 pos = 0; 295 pos = 0;
@@ -407,9 +297,9 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
407 field = 0; 297 field = 0;
408 value = 0; 298 value = 0;
409 while (1) { 299 while (1) {
410 pos = sh_pfc_gpio_to_enum(pfc, gpio, pos, &enum_id); 300 pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id);
411 if (pos <= 0) 301 if (pos < 0)
412 goto out_err; 302 return pos;
413 303
414 if (!enum_id) 304 if (!enum_id)
415 break; 305 break;
@@ -452,44 +342,22 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
452 if (!in_range) 342 if (!in_range)
453 continue; 343 continue;
454 344
455 if (sh_pfc_get_config_reg(pfc, enum_id, &cr, 345 ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value);
456 &field, &value, &cntp) != 0) 346 if (ret < 0)
457 goto out_err; 347 return ret;
458
459 switch (cfg_mode) {
460 case GPIO_CFG_DRYRUN:
461 if (!*cntp ||
462 (sh_pfc_read_config_reg(pfc, cr, field) != value))
463 continue;
464 break;
465
466 case GPIO_CFG_REQ:
467 sh_pfc_write_config_reg(pfc, cr, field, value);
468 *cntp = *cntp + 1;
469 break;
470 348
471 case GPIO_CFG_FREE: 349 sh_pfc_write_config_reg(pfc, cr, field, value);
472 *cntp = *cntp - 1;
473 break;
474 }
475 } 350 }
476 351
477 return 0; 352 return 0;
478 out_err:
479 return -1;
480} 353}
481 354
482static int sh_pfc_probe(struct platform_device *pdev) 355static int sh_pfc_probe(struct platform_device *pdev)
483{ 356{
484 struct sh_pfc_soc_info *info; 357 const struct sh_pfc_soc_info *info;
485 struct sh_pfc *pfc; 358 struct sh_pfc *pfc;
486 int ret; 359 int ret;
487 360
488 /*
489 * Ensure that the type encoding fits
490 */
491 BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1));
492
493 info = pdev->id_entry->driver_data 361 info = pdev->id_entry->driver_data
494 ? (void *)pdev->id_entry->driver_data : pdev->dev.platform_data; 362 ? (void *)pdev->id_entry->driver_data : pdev->dev.platform_data;
495 if (info == NULL) 363 if (info == NULL)
@@ -509,7 +377,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
509 spin_lock_init(&pfc->lock); 377 spin_lock_init(&pfc->lock);
510 378
511 pinctrl_provide_dummies(); 379 pinctrl_provide_dummies();
512 sh_pfc_setup_data_regs(pfc);
513 380
514 /* 381 /*
515 * Initialize pinctrl bindings first 382 * Initialize pinctrl bindings first
@@ -529,13 +396,13 @@ static int sh_pfc_probe(struct platform_device *pdev)
529 * PFC state as it is, given that there are already 396 * PFC state as it is, given that there are already
530 * extant users of it that have succeeded by this point. 397 * extant users of it that have succeeded by this point.
531 */ 398 */
532 pr_notice("failed to init GPIO chip, ignoring...\n"); 399 dev_notice(pfc->dev, "failed to init GPIO chip, ignoring...\n");
533 } 400 }
534#endif 401#endif
535 402
536 platform_set_drvdata(pdev, pfc); 403 platform_set_drvdata(pdev, pfc);
537 404
538 pr_info("%s support registered\n", info->name); 405 dev_info(pfc->dev, "%s support registered\n", info->name);
539 406
540 return 0; 407 return 0;
541} 408}
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index ba7c33c33599..763d717ca979 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -26,13 +26,17 @@ struct sh_pfc_pinctrl;
26 26
27struct sh_pfc { 27struct sh_pfc {
28 struct device *dev; 28 struct device *dev;
29 struct sh_pfc_soc_info *info; 29 const struct sh_pfc_soc_info *info;
30 spinlock_t lock; 30 spinlock_t lock;
31 31
32 unsigned int num_windows; 32 unsigned int num_windows;
33 struct sh_pfc_window *window; 33 struct sh_pfc_window *window;
34 34
35 unsigned int nr_pins;
36
35 struct sh_pfc_chip *gpio; 37 struct sh_pfc_chip *gpio;
38 struct sh_pfc_chip *func;
39
36 struct sh_pfc_pinctrl *pinctrl; 40 struct sh_pfc_pinctrl *pinctrl;
37}; 41};
38 42
@@ -42,31 +46,29 @@ int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
42int sh_pfc_register_pinctrl(struct sh_pfc *pfc); 46int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
43int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc); 47int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
44 48
45int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos); 49unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
46void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos, 50 unsigned long reg_width);
47 unsigned long value); 51void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
48int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, 52 unsigned long data);
49 struct pinmux_data_reg **drp, int *bitp); 53
50int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, 54int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
51 pinmux_enum_t *enum_idp); 55int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
52int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
53 int cfg_mode);
54 56
55extern struct sh_pfc_soc_info r8a7740_pinmux_info; 57extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
56extern struct sh_pfc_soc_info r8a7779_pinmux_info; 58extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
57extern struct sh_pfc_soc_info sh7203_pinmux_info; 59extern const struct sh_pfc_soc_info sh7203_pinmux_info;
58extern struct sh_pfc_soc_info sh7264_pinmux_info; 60extern const struct sh_pfc_soc_info sh7264_pinmux_info;
59extern struct sh_pfc_soc_info sh7269_pinmux_info; 61extern const struct sh_pfc_soc_info sh7269_pinmux_info;
60extern struct sh_pfc_soc_info sh7372_pinmux_info; 62extern const struct sh_pfc_soc_info sh7372_pinmux_info;
61extern struct sh_pfc_soc_info sh73a0_pinmux_info; 63extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
62extern struct sh_pfc_soc_info sh7720_pinmux_info; 64extern const struct sh_pfc_soc_info sh7720_pinmux_info;
63extern struct sh_pfc_soc_info sh7722_pinmux_info; 65extern const struct sh_pfc_soc_info sh7722_pinmux_info;
64extern struct sh_pfc_soc_info sh7723_pinmux_info; 66extern const struct sh_pfc_soc_info sh7723_pinmux_info;
65extern struct sh_pfc_soc_info sh7724_pinmux_info; 67extern const struct sh_pfc_soc_info sh7724_pinmux_info;
66extern struct sh_pfc_soc_info sh7734_pinmux_info; 68extern const struct sh_pfc_soc_info sh7734_pinmux_info;
67extern struct sh_pfc_soc_info sh7757_pinmux_info; 69extern const struct sh_pfc_soc_info sh7757_pinmux_info;
68extern struct sh_pfc_soc_info sh7785_pinmux_info; 70extern const struct sh_pfc_soc_info sh7785_pinmux_info;
69extern struct sh_pfc_soc_info sh7786_pinmux_info; 71extern const struct sh_pfc_soc_info sh7786_pinmux_info;
70extern struct sh_pfc_soc_info shx3_pinmux_info; 72extern const struct sh_pfc_soc_info shx3_pinmux_info;
71 73
72#endif /* __SH_PFC_CORE_H__ */ 74#endif /* __SH_PFC_CORE_H__ */
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index a535075c8b69..d7acb06d888c 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -9,8 +9,6 @@
9 * for more details. 9 * for more details.
10 */ 10 */
11 11
12#define pr_fmt(fmt) KBUILD_MODNAME " gpio: " fmt
13
14#include <linux/device.h> 12#include <linux/device.h>
15#include <linux/gpio.h> 13#include <linux/gpio.h>
16#include <linux/init.h> 14#include <linux/init.h>
@@ -21,9 +19,23 @@
21 19
22#include "core.h" 20#include "core.h"
23 21
22struct sh_pfc_gpio_data_reg {
23 const struct pinmux_data_reg *info;
24 unsigned long shadow;
25};
26
27struct sh_pfc_gpio_pin {
28 u8 dbit;
29 u8 dreg;
30};
31
24struct sh_pfc_chip { 32struct sh_pfc_chip {
25 struct sh_pfc *pfc; 33 struct sh_pfc *pfc;
26 struct gpio_chip gpio_chip; 34 struct gpio_chip gpio_chip;
35
36 struct sh_pfc_window *mem;
37 struct sh_pfc_gpio_data_reg *regs;
38 struct sh_pfc_gpio_pin *pins;
27}; 39};
28 40
29static struct sh_pfc_chip *gpio_to_pfc_chip(struct gpio_chip *gc) 41static struct sh_pfc_chip *gpio_to_pfc_chip(struct gpio_chip *gc)
@@ -36,143 +48,358 @@ static struct sh_pfc *gpio_to_pfc(struct gpio_chip *gc)
36 return gpio_to_pfc_chip(gc)->pfc; 48 return gpio_to_pfc_chip(gc)->pfc;
37} 49}
38 50
39static int sh_gpio_request(struct gpio_chip *gc, unsigned offset) 51static void gpio_get_data_reg(struct sh_pfc_chip *chip, unsigned int gpio,
52 struct sh_pfc_gpio_data_reg **reg,
53 unsigned int *bit)
40{ 54{
41 return pinctrl_request_gpio(offset); 55 int idx = sh_pfc_get_pin_index(chip->pfc, gpio);
56 struct sh_pfc_gpio_pin *gpio_pin = &chip->pins[idx];
57
58 *reg = &chip->regs[gpio_pin->dreg];
59 *bit = gpio_pin->dbit;
42} 60}
43 61
44static void sh_gpio_free(struct gpio_chip *gc, unsigned offset) 62static unsigned long gpio_read_data_reg(struct sh_pfc_chip *chip,
63 const struct pinmux_data_reg *dreg)
45{ 64{
46 pinctrl_free_gpio(offset); 65 void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt;
66
67 return sh_pfc_read_raw_reg(mem, dreg->reg_width);
47} 68}
48 69
49static void sh_gpio_set_value(struct sh_pfc *pfc, unsigned gpio, int value) 70static void gpio_write_data_reg(struct sh_pfc_chip *chip,
71 const struct pinmux_data_reg *dreg,
72 unsigned long value)
50{ 73{
51 struct pinmux_data_reg *dr = NULL; 74 void __iomem *mem = dreg->reg - chip->mem->phys + chip->mem->virt;
52 int bit = 0;
53 75
54 if (sh_pfc_get_data_reg(pfc, gpio, &dr, &bit) != 0) 76 sh_pfc_write_raw_reg(mem, dreg->reg_width, value);
55 BUG(); 77}
56 else 78
57 sh_pfc_write_bit(dr, bit, value); 79static void gpio_setup_data_reg(struct sh_pfc_chip *chip, unsigned gpio)
80{
81 struct sh_pfc *pfc = chip->pfc;
82 struct sh_pfc_gpio_pin *gpio_pin = &chip->pins[gpio];
83 const struct sh_pfc_pin *pin = &pfc->info->pins[gpio];
84 const struct pinmux_data_reg *dreg;
85 unsigned int bit;
86 unsigned int i;
87
88 for (i = 0, dreg = pfc->info->data_regs; dreg->reg; ++i, ++dreg) {
89 for (bit = 0; bit < dreg->reg_width; bit++) {
90 if (dreg->enum_ids[bit] == pin->enum_id) {
91 gpio_pin->dreg = i;
92 gpio_pin->dbit = bit;
93 return;
94 }
95 }
96 }
97
98 BUG();
99}
100
101static int gpio_setup_data_regs(struct sh_pfc_chip *chip)
102{
103 struct sh_pfc *pfc = chip->pfc;
104 unsigned long addr = pfc->info->data_regs[0].reg;
105 const struct pinmux_data_reg *dreg;
106 unsigned int i;
107
108 /* Find the window that contain the GPIO registers. */
109 for (i = 0; i < pfc->num_windows; ++i) {
110 struct sh_pfc_window *window = &pfc->window[i];
111
112 if (addr >= window->phys && addr < window->phys + window->size)
113 break;
114 }
115
116 if (i == pfc->num_windows)
117 return -EINVAL;
118
119 /* GPIO data registers must be in the first memory resource. */
120 chip->mem = &pfc->window[i];
121
122 /* Count the number of data registers, allocate memory and initialize
123 * them.
124 */
125 for (i = 0; pfc->info->data_regs[i].reg_width; ++i)
126 ;
127
128 chip->regs = devm_kzalloc(pfc->dev, i * sizeof(*chip->regs),
129 GFP_KERNEL);
130 if (chip->regs == NULL)
131 return -ENOMEM;
132
133 for (i = 0, dreg = pfc->info->data_regs; dreg->reg_width; ++i, ++dreg) {
134 chip->regs[i].info = dreg;
135 chip->regs[i].shadow = gpio_read_data_reg(chip, dreg);
136 }
137
138 for (i = 0; i < pfc->info->nr_pins; i++) {
139 if (pfc->info->pins[i].enum_id == 0)
140 continue;
141
142 gpio_setup_data_reg(chip, i);
143 }
144
145 return 0;
58} 146}
59 147
60static int sh_gpio_get_value(struct sh_pfc *pfc, unsigned gpio) 148/* -----------------------------------------------------------------------------
149 * Pin GPIOs
150 */
151
152static int gpio_pin_request(struct gpio_chip *gc, unsigned offset)
61{ 153{
62 struct pinmux_data_reg *dr = NULL; 154 struct sh_pfc *pfc = gpio_to_pfc(gc);
63 int bit = 0; 155 int idx = sh_pfc_get_pin_index(pfc, offset);
64 156
65 if (sh_pfc_get_data_reg(pfc, gpio, &dr, &bit) != 0) 157 if (idx < 0 || pfc->info->pins[idx].enum_id == 0)
66 return -EINVAL; 158 return -EINVAL;
67 159
68 return sh_pfc_read_bit(dr, bit); 160 return pinctrl_request_gpio(offset);
69} 161}
70 162
71static int sh_gpio_direction_input(struct gpio_chip *gc, unsigned offset) 163static void gpio_pin_free(struct gpio_chip *gc, unsigned offset)
164{
165 return pinctrl_free_gpio(offset);
166}
167
168static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset,
169 int value)
170{
171 struct sh_pfc_gpio_data_reg *reg;
172 unsigned long pos;
173 unsigned int bit;
174
175 gpio_get_data_reg(chip, offset, &reg, &bit);
176
177 pos = reg->info->reg_width - (bit + 1);
178
179 if (value)
180 set_bit(pos, &reg->shadow);
181 else
182 clear_bit(pos, &reg->shadow);
183
184 gpio_write_data_reg(chip, reg->info, reg->shadow);
185}
186
187static int gpio_pin_direction_input(struct gpio_chip *gc, unsigned offset)
72{ 188{
73 return pinctrl_gpio_direction_input(offset); 189 return pinctrl_gpio_direction_input(offset);
74} 190}
75 191
76static int sh_gpio_direction_output(struct gpio_chip *gc, unsigned offset, 192static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset,
77 int value) 193 int value)
78{ 194{
79 sh_gpio_set_value(gpio_to_pfc(gc), offset, value); 195 gpio_pin_set_value(gpio_to_pfc_chip(gc), offset, value);
80 196
81 return pinctrl_gpio_direction_output(offset); 197 return pinctrl_gpio_direction_output(offset);
82} 198}
83 199
84static int sh_gpio_get(struct gpio_chip *gc, unsigned offset) 200static int gpio_pin_get(struct gpio_chip *gc, unsigned offset)
85{ 201{
86 return sh_gpio_get_value(gpio_to_pfc(gc), offset); 202 struct sh_pfc_chip *chip = gpio_to_pfc_chip(gc);
203 struct sh_pfc_gpio_data_reg *reg;
204 unsigned long pos;
205 unsigned int bit;
206
207 gpio_get_data_reg(chip, offset, &reg, &bit);
208
209 pos = reg->info->reg_width - (bit + 1);
210
211 return (gpio_read_data_reg(chip, reg->info) >> pos) & 1;
87} 212}
88 213
89static void sh_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 214static void gpio_pin_set(struct gpio_chip *gc, unsigned offset, int value)
90{ 215{
91 sh_gpio_set_value(gpio_to_pfc(gc), offset, value); 216 gpio_pin_set_value(gpio_to_pfc_chip(gc), offset, value);
92} 217}
93 218
94static int sh_gpio_to_irq(struct gpio_chip *gc, unsigned offset) 219static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset)
95{ 220{
96 struct sh_pfc *pfc = gpio_to_pfc(gc); 221 struct sh_pfc *pfc = gpio_to_pfc(gc);
97 pinmux_enum_t enum_id; 222 int i, k;
98 pinmux_enum_t *enum_ids;
99 int i, k, pos;
100
101 pos = 0;
102 enum_id = 0;
103 while (1) {
104 pos = sh_pfc_gpio_to_enum(pfc, offset, pos, &enum_id);
105 if (pos <= 0 || !enum_id)
106 break;
107 223
108 for (i = 0; i < pfc->info->gpio_irq_size; i++) { 224 for (i = 0; i < pfc->info->gpio_irq_size; i++) {
109 enum_ids = pfc->info->gpio_irq[i].enum_ids; 225 unsigned short *gpios = pfc->info->gpio_irq[i].gpios;
110 for (k = 0; enum_ids[k]; k++) { 226
111 if (enum_ids[k] == enum_id) 227 for (k = 0; gpios[k]; k++) {
112 return pfc->info->gpio_irq[i].irq; 228 if (gpios[k] == offset)
113 } 229 return pfc->info->gpio_irq[i].irq;
114 } 230 }
115 } 231 }
116 232
117 return -ENOSYS; 233 return -ENOSYS;
118} 234}
119 235
120static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip) 236static int gpio_pin_setup(struct sh_pfc_chip *chip)
121{ 237{
122 struct sh_pfc *pfc = chip->pfc; 238 struct sh_pfc *pfc = chip->pfc;
123 struct gpio_chip *gc = &chip->gpio_chip; 239 struct gpio_chip *gc = &chip->gpio_chip;
240 int ret;
241
242 chip->pins = devm_kzalloc(pfc->dev, pfc->nr_pins * sizeof(*chip->pins),
243 GFP_KERNEL);
244 if (chip->pins == NULL)
245 return -ENOMEM;
124 246
125 gc->request = sh_gpio_request; 247 ret = gpio_setup_data_regs(chip);
126 gc->free = sh_gpio_free; 248 if (ret < 0)
127 gc->direction_input = sh_gpio_direction_input; 249 return ret;
128 gc->get = sh_gpio_get;
129 gc->direction_output = sh_gpio_direction_output;
130 gc->set = sh_gpio_set;
131 gc->to_irq = sh_gpio_to_irq;
132 250
133 WARN_ON(pfc->info->first_gpio != 0); /* needs testing */ 251 gc->request = gpio_pin_request;
252 gc->free = gpio_pin_free;
253 gc->direction_input = gpio_pin_direction_input;
254 gc->get = gpio_pin_get;
255 gc->direction_output = gpio_pin_direction_output;
256 gc->set = gpio_pin_set;
257 gc->to_irq = gpio_pin_to_irq;
134 258
135 gc->label = pfc->info->name; 259 gc->label = pfc->info->name;
260 gc->dev = pfc->dev;
136 gc->owner = THIS_MODULE; 261 gc->owner = THIS_MODULE;
137 gc->base = pfc->info->first_gpio; 262 gc->base = 0;
138 gc->ngpio = (pfc->info->last_gpio - pfc->info->first_gpio) + 1; 263 gc->ngpio = pfc->nr_pins;
264
265 return 0;
139} 266}
140 267
141int sh_pfc_register_gpiochip(struct sh_pfc *pfc) 268/* -----------------------------------------------------------------------------
269 * Function GPIOs
270 */
271
272static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
273{
274 static bool __print_once;
275 struct sh_pfc *pfc = gpio_to_pfc(gc);
276 unsigned int mark = pfc->info->func_gpios[offset].enum_id;
277 unsigned long flags;
278 int ret;
279
280 if (!__print_once) {
281 dev_notice(pfc->dev,
282 "Use of GPIO API for function requests is deprecated."
283 " Convert to pinctrl\n");
284 __print_once = true;
285 }
286
287 if (mark == 0)
288 return -EINVAL;
289
290 spin_lock_irqsave(&pfc->lock, flags);
291 ret = sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION);
292 spin_unlock_irqrestore(&pfc->lock, flags);
293
294 return ret;
295}
296
297static void gpio_function_free(struct gpio_chip *gc, unsigned offset)
298{
299}
300
301static int gpio_function_setup(struct sh_pfc_chip *chip)
302{
303 struct sh_pfc *pfc = chip->pfc;
304 struct gpio_chip *gc = &chip->gpio_chip;
305
306 gc->request = gpio_function_request;
307 gc->free = gpio_function_free;
308
309 gc->label = pfc->info->name;
310 gc->owner = THIS_MODULE;
311 gc->base = pfc->nr_pins;
312 gc->ngpio = pfc->info->nr_func_gpios;
313
314 return 0;
315}
316
317/* -----------------------------------------------------------------------------
318 * Register/unregister
319 */
320
321static struct sh_pfc_chip *
322sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *))
142{ 323{
143 struct sh_pfc_chip *chip; 324 struct sh_pfc_chip *chip;
144 int ret; 325 int ret;
145 326
146 chip = devm_kzalloc(pfc->dev, sizeof(*chip), GFP_KERNEL); 327 chip = devm_kzalloc(pfc->dev, sizeof(*chip), GFP_KERNEL);
147 if (unlikely(!chip)) 328 if (unlikely(!chip))
148 return -ENOMEM; 329 return ERR_PTR(-ENOMEM);
149 330
150 chip->pfc = pfc; 331 chip->pfc = pfc;
151 332
152 sh_pfc_gpio_setup(chip); 333 ret = setup(chip);
334 if (ret < 0)
335 return ERR_PTR(ret);
153 336
154 ret = gpiochip_add(&chip->gpio_chip); 337 ret = gpiochip_add(&chip->gpio_chip);
155 if (unlikely(ret < 0)) 338 if (unlikely(ret < 0))
156 return ret; 339 return ERR_PTR(ret);
340
341 dev_info(pfc->dev, "%s handling gpio %u -> %u\n",
342 chip->gpio_chip.label, chip->gpio_chip.base,
343 chip->gpio_chip.base + chip->gpio_chip.ngpio - 1);
344
345 return chip;
346}
347
348int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
349{
350 const struct pinmux_range *ranges;
351 struct pinmux_range def_range;
352 struct sh_pfc_chip *chip;
353 unsigned int nr_ranges;
354 unsigned int i;
355 int ret;
356
357 /* Register the real GPIOs chip. */
358 chip = sh_pfc_add_gpiochip(pfc, gpio_pin_setup);
359 if (IS_ERR(chip))
360 return PTR_ERR(chip);
157 361
158 pfc->gpio = chip; 362 pfc->gpio = chip;
159 363
160 pr_info("%s handling gpio %d -> %d\n", 364 /* Register the GPIO to pin mappings. */
161 pfc->info->name, pfc->info->first_gpio, 365 if (pfc->info->ranges == NULL) {
162 pfc->info->last_gpio); 366 def_range.begin = 0;
367 def_range.end = pfc->info->nr_pins - 1;
368 ranges = &def_range;
369 nr_ranges = 1;
370 } else {
371 ranges = pfc->info->ranges;
372 nr_ranges = pfc->info->nr_ranges;
373 }
374
375 for (i = 0; i < nr_ranges; ++i) {
376 const struct pinmux_range *range = &ranges[i];
377
378 ret = gpiochip_add_pin_range(&chip->gpio_chip,
379 dev_name(pfc->dev),
380 range->begin, range->begin,
381 range->end - range->begin + 1);
382 if (ret < 0)
383 return ret;
384 }
385
386 /* Register the function GPIOs chip. */
387 chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup);
388 if (IS_ERR(chip))
389 return PTR_ERR(chip);
390
391 pfc->func = chip;
163 392
164 return 0; 393 return 0;
165} 394}
166 395
167int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc) 396int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
168{ 397{
169 struct sh_pfc_chip *chip = pfc->gpio; 398 int err;
170 int ret; 399 int ret;
171 400
172 ret = gpiochip_remove(&chip->gpio_chip); 401 ret = gpiochip_remove(&pfc->gpio->gpio_chip);
173 if (unlikely(ret < 0)) 402 err = gpiochip_remove(&pfc->func->gpio_chip);
174 return ret;
175 403
176 pfc->gpio = NULL; 404 return ret < 0 ? ret : err;
177 return 0;
178} 405}
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
index 214788c4a606..3621d3e81fc3 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
@@ -577,7 +577,7 @@ enum {
577 PINMUX_MARK_END, 577 PINMUX_MARK_END,
578}; 578};
579 579
580static pinmux_enum_t pinmux_data[] = { 580static const pinmux_enum_t pinmux_data[] = {
581 /* specify valid pin states for each pin in GPIO mode */ 581 /* specify valid pin states for each pin in GPIO mode */
582 582
583 /* I/O and Pull U/D */ 583 /* I/O and Pull U/D */
@@ -1654,11 +1654,532 @@ static pinmux_enum_t pinmux_data[] = {
1654 PINMUX_DATA(TRACEAUD_FROM_MEMC_MARK, MSEL5CR_30_1, MSEL5CR_29_0), 1654 PINMUX_DATA(TRACEAUD_FROM_MEMC_MARK, MSEL5CR_30_1, MSEL5CR_29_0),
1655}; 1655};
1656 1656
1657static struct pinmux_gpio pinmux_gpios[] = { 1657static struct sh_pfc_pin pinmux_pins[] = {
1658
1659 /* PORT */
1660 GPIO_PORT_ALL(), 1658 GPIO_PORT_ALL(),
1659};
1660
1661/* - LCD0 ------------------------------------------------------------------- */
1662static const unsigned int lcd0_data8_pins[] = {
1663 /* D[0:7] */
1664 58, 57, 56, 55, 54, 53, 52, 51,
1665};
1666static const unsigned int lcd0_data8_mux[] = {
1667 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1668 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1669};
1670static const unsigned int lcd0_data9_pins[] = {
1671 /* D[0:8] */
1672 58, 57, 56, 55, 54, 53, 52, 51,
1673 50,
1674};
1675static const unsigned int lcd0_data9_mux[] = {
1676 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1677 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1678 LCD0_D8_MARK,
1679};
1680static const unsigned int lcd0_data12_pins[] = {
1681 /* D[0:11] */
1682 58, 57, 56, 55, 54, 53, 52, 51,
1683 50, 49, 48, 47,
1684};
1685static const unsigned int lcd0_data12_mux[] = {
1686 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1687 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1688 LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
1689};
1690static const unsigned int lcd0_data16_pins[] = {
1691 /* D[0:15] */
1692 58, 57, 56, 55, 54, 53, 52, 51,
1693 50, 49, 48, 47, 46, 45, 44, 43,
1694};
1695static const unsigned int lcd0_data16_mux[] = {
1696 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1697 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1698 LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
1699 LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
1700};
1701static const unsigned int lcd0_data18_pins[] = {
1702 /* D[0:17] */
1703 58, 57, 56, 55, 54, 53, 52, 51,
1704 50, 49, 48, 47, 46, 45, 44, 43,
1705 42, 41,
1706};
1707static const unsigned int lcd0_data18_mux[] = {
1708 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1709 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1710 LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
1711 LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
1712 LCD0_D16_MARK, LCD0_D17_MARK,
1713};
1714static const unsigned int lcd0_data24_0_pins[] = {
1715 /* D[0:23] */
1716 58, 57, 56, 55, 54, 53, 52, 51,
1717 50, 49, 48, 47, 46, 45, 44, 43,
1718 42, 41, 40, 4, 3, 2, 0, 1,
1719};
1720static const unsigned int lcd0_data24_0_mux[] = {
1721 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1722 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1723 LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
1724 LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
1725 LCD0_D16_MARK, LCD0_D17_MARK, LCD0_D18_PORT40_MARK, LCD0_D19_PORT4_MARK,
1726 LCD0_D20_PORT3_MARK, LCD0_D21_PORT2_MARK, LCD0_D22_PORT0_MARK,
1727 LCD0_D23_PORT1_MARK,
1728};
1729static const unsigned int lcd0_data24_1_pins[] = {
1730 /* D[0:23] */
1731 58, 57, 56, 55, 54, 53, 52, 51,
1732 50, 49, 48, 47, 46, 45, 44, 43,
1733 42, 41, 163, 162, 161, 158, 160, 159,
1734};
1735static const unsigned int lcd0_data24_1_mux[] = {
1736 LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
1737 LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
1738 LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
1739 LCD0_D16_MARK, LCD0_D17_MARK, LCD0_D18_PORT163_MARK,
1740 LCD0_D19_PORT162_MARK, LCD0_D20_PORT161_MARK, LCD0_D21_PORT158_MARK,
1741 LCD0_D22_PORT160_MARK, LCD0_D23_PORT159_MARK,
1742};
1743static const unsigned int lcd0_display_pins[] = {
1744 /* DON, VCPWC, VEPWC */
1745 61, 59, 60,
1746};
1747static const unsigned int lcd0_display_mux[] = {
1748 LCD0_DON_MARK, LCD0_VCPWC_MARK, LCD0_VEPWC_MARK,
1749};
1750static const unsigned int lcd0_lclk_0_pins[] = {
1751 /* LCLK */
1752 102,
1753};
1754static const unsigned int lcd0_lclk_0_mux[] = {
1755 LCD0_LCLK_PORT102_MARK,
1756};
1757static const unsigned int lcd0_lclk_1_pins[] = {
1758 /* LCLK */
1759 165,
1760};
1761static const unsigned int lcd0_lclk_1_mux[] = {
1762 LCD0_LCLK_PORT165_MARK,
1763};
1764static const unsigned int lcd0_sync_pins[] = {
1765 /* VSYN, HSYN, DCK, DISP */
1766 63, 64, 62, 65,
1767};
1768static const unsigned int lcd0_sync_mux[] = {
1769 LCD0_VSYN_MARK, LCD0_HSYN_MARK, LCD0_DCK_MARK, LCD0_DISP_MARK,
1770};
1771static const unsigned int lcd0_sys_pins[] = {
1772 /* CS, WR, RD, RS */
1773 64, 62, 164, 65,
1774};
1775static const unsigned int lcd0_sys_mux[] = {
1776 LCD0_CS_MARK, LCD0_WR_MARK, LCD0_RD_MARK, LCD0_RS_MARK,
1777};
1778/* - LCD1 ------------------------------------------------------------------- */
1779static const unsigned int lcd1_data8_pins[] = {
1780 /* D[0:7] */
1781 4, 3, 2, 1, 0, 91, 92, 23,
1782};
1783static const unsigned int lcd1_data8_mux[] = {
1784 LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
1785 LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
1786};
1787static const unsigned int lcd1_data9_pins[] = {
1788 /* D[0:8] */
1789 4, 3, 2, 1, 0, 91, 92, 23,
1790 93,
1791};
1792static const unsigned int lcd1_data9_mux[] = {
1793 LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
1794 LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
1795 LCD1_D8_MARK,
1796};
1797static const unsigned int lcd1_data12_pins[] = {
1798 /* D[0:12] */
1799 4, 3, 2, 1, 0, 91, 92, 23,
1800 93, 94, 21, 201,
1801};
1802static const unsigned int lcd1_data12_mux[] = {
1803 LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
1804 LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
1805 LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
1806};
1807static const unsigned int lcd1_data16_pins[] = {
1808 /* D[0:15] */
1809 4, 3, 2, 1, 0, 91, 92, 23,
1810 93, 94, 21, 201, 200, 199, 196, 195,
1811};
1812static const unsigned int lcd1_data16_mux[] = {
1813 LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
1814 LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
1815 LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
1816 LCD1_D12_MARK, LCD1_D13_MARK, LCD1_D14_MARK, LCD1_D15_MARK,
1817};
1818static const unsigned int lcd1_data18_pins[] = {
1819 /* D[0:17] */
1820 4, 3, 2, 1, 0, 91, 92, 23,
1821 93, 94, 21, 201, 200, 199, 196, 195,
1822 194, 193,
1823};
1824static const unsigned int lcd1_data18_mux[] = {
1825 LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
1826 LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
1827 LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
1828 LCD1_D12_MARK, LCD1_D13_MARK, LCD1_D14_MARK, LCD1_D15_MARK,
1829 LCD1_D16_MARK, LCD1_D17_MARK,
1830};
1831static const unsigned int lcd1_data24_pins[] = {
1832 /* D[0:23] */
1833 4, 3, 2, 1, 0, 91, 92, 23,
1834 93, 94, 21, 201, 200, 199, 196, 195,
1835 194, 193, 198, 197, 75, 74, 15, 14,
1836};
1837static const unsigned int lcd1_data24_mux[] = {
1838 LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
1839 LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
1840 LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
1841 LCD1_D12_MARK, LCD1_D13_MARK, LCD1_D14_MARK, LCD1_D15_MARK,
1842 LCD1_D16_MARK, LCD1_D17_MARK, LCD1_D18_MARK, LCD1_D19_MARK,
1843 LCD1_D20_MARK, LCD1_D21_MARK, LCD1_D22_MARK, LCD1_D23_MARK,
1844};
1845static const unsigned int lcd1_display_pins[] = {
1846 /* DON, VCPWC, VEPWC */
1847 100, 5, 6,
1848};
1849static const unsigned int lcd1_display_mux[] = {
1850 LCD1_DON_MARK, LCD1_VCPWC_MARK, LCD1_VEPWC_MARK,
1851};
1852static const unsigned int lcd1_lclk_pins[] = {
1853 /* LCLK */
1854 40,
1855};
1856static const unsigned int lcd1_lclk_mux[] = {
1857 LCD1_LCLK_MARK,
1858};
1859static const unsigned int lcd1_sync_pins[] = {
1860 /* VSYN, HSYN, DCK, DISP */
1861 98, 97, 99, 12,
1862};
1863static const unsigned int lcd1_sync_mux[] = {
1864 LCD1_VSYN_MARK, LCD1_HSYN_MARK, LCD1_DCK_MARK, LCD1_DISP_MARK,
1865};
1866static const unsigned int lcd1_sys_pins[] = {
1867 /* CS, WR, RD, RS */
1868 97, 99, 13, 12,
1869};
1870static const unsigned int lcd1_sys_mux[] = {
1871 LCD1_CS_MARK, LCD1_WR_MARK, LCD1_RD_MARK, LCD1_RS_MARK,
1872};
1873/* - MMCIF ------------------------------------------------------------------ */
1874static const unsigned int mmc0_data1_0_pins[] = {
1875 /* D[0] */
1876 68,
1877};
1878static const unsigned int mmc0_data1_0_mux[] = {
1879 MMC0_D0_PORT68_MARK,
1880};
1881static const unsigned int mmc0_data4_0_pins[] = {
1882 /* D[0:3] */
1883 68, 69, 70, 71,
1884};
1885static const unsigned int mmc0_data4_0_mux[] = {
1886 MMC0_D0_PORT68_MARK, MMC0_D1_PORT69_MARK, MMC0_D2_PORT70_MARK, MMC0_D3_PORT71_MARK,
1887};
1888static const unsigned int mmc0_data8_0_pins[] = {
1889 /* D[0:7] */
1890 68, 69, 70, 71, 72, 73, 74, 75,
1891};
1892static const unsigned int mmc0_data8_0_mux[] = {
1893 MMC0_D0_PORT68_MARK, MMC0_D1_PORT69_MARK, MMC0_D2_PORT70_MARK, MMC0_D3_PORT71_MARK,
1894 MMC0_D4_PORT72_MARK, MMC0_D5_PORT73_MARK, MMC0_D6_PORT74_MARK, MMC0_D7_PORT75_MARK,
1895};
1896static const unsigned int mmc0_ctrl_0_pins[] = {
1897 /* CMD, CLK */
1898 67, 66,
1899};
1900static const unsigned int mmc0_ctrl_0_mux[] = {
1901 MMC0_CMD_PORT67_MARK, MMC0_CLK_PORT66_MARK,
1902};
1903
1904static const unsigned int mmc0_data1_1_pins[] = {
1905 /* D[0] */
1906 149,
1907};
1908static const unsigned int mmc0_data1_1_mux[] = {
1909 MMC1_D0_PORT149_MARK,
1910};
1911static const unsigned int mmc0_data4_1_pins[] = {
1912 /* D[0:3] */
1913 149, 148, 147, 146,
1914};
1915static const unsigned int mmc0_data4_1_mux[] = {
1916 MMC1_D0_PORT149_MARK, MMC1_D1_PORT148_MARK, MMC1_D2_PORT147_MARK, MMC1_D3_PORT146_MARK,
1917};
1918static const unsigned int mmc0_data8_1_pins[] = {
1919 /* D[0:7] */
1920 149, 148, 147, 146, 145, 144, 143, 142,
1921};
1922static const unsigned int mmc0_data8_1_mux[] = {
1923 MMC1_D0_PORT149_MARK, MMC1_D1_PORT148_MARK, MMC1_D2_PORT147_MARK, MMC1_D3_PORT146_MARK,
1924 MMC1_D4_PORT145_MARK, MMC1_D5_PORT144_MARK, MMC1_D6_PORT143_MARK, MMC1_D7_PORT142_MARK,
1925};
1926static const unsigned int mmc0_ctrl_1_pins[] = {
1927 /* CMD, CLK */
1928 104, 103,
1929};
1930static const unsigned int mmc0_ctrl_1_mux[] = {
1931 MMC1_CMD_PORT104_MARK, MMC1_CLK_PORT103_MARK,
1932};
1933/* - SDHI0 ------------------------------------------------------------------ */
1934static const unsigned int sdhi0_data1_pins[] = {
1935 /* D0 */
1936 77,
1937};
1938static const unsigned int sdhi0_data1_mux[] = {
1939 SDHI0_D0_MARK,
1940};
1941static const unsigned int sdhi0_data4_pins[] = {
1942 /* D[0:3] */
1943 77, 78, 79, 80,
1944};
1945static const unsigned int sdhi0_data4_mux[] = {
1946 SDHI0_D0_MARK, SDHI0_D1_MARK, SDHI0_D2_MARK, SDHI0_D3_MARK,
1947};
1948static const unsigned int sdhi0_ctrl_pins[] = {
1949 /* CMD, CLK */
1950 76, 82,
1951};
1952static const unsigned int sdhi0_ctrl_mux[] = {
1953 SDHI0_CMD_MARK, SDHI0_CLK_MARK,
1954};
1955static const unsigned int sdhi0_cd_pins[] = {
1956 /* CD */
1957 81,
1958};
1959static const unsigned int sdhi0_cd_mux[] = {
1960 SDHI0_CD_MARK,
1961};
1962static const unsigned int sdhi0_wp_pins[] = {
1963 /* WP */
1964 83,
1965};
1966static const unsigned int sdhi0_wp_mux[] = {
1967 SDHI0_WP_MARK,
1968};
1969/* - SDHI1 ------------------------------------------------------------------ */
1970static const unsigned int sdhi1_data1_pins[] = {
1971 /* D0 */
1972 68,
1973};
1974static const unsigned int sdhi1_data1_mux[] = {
1975 SDHI1_D0_MARK,
1976};
1977static const unsigned int sdhi1_data4_pins[] = {
1978 /* D[0:3] */
1979 68, 69, 70, 71,
1980};
1981static const unsigned int sdhi1_data4_mux[] = {
1982 SDHI1_D0_MARK, SDHI1_D1_MARK, SDHI1_D2_MARK, SDHI1_D3_MARK,
1983};
1984static const unsigned int sdhi1_ctrl_pins[] = {
1985 /* CMD, CLK */
1986 67, 66,
1987};
1988static const unsigned int sdhi1_ctrl_mux[] = {
1989 SDHI1_CMD_MARK, SDHI1_CLK_MARK,
1990};
1991static const unsigned int sdhi1_cd_pins[] = {
1992 /* CD */
1993 72,
1994};
1995static const unsigned int sdhi1_cd_mux[] = {
1996 SDHI1_CD_MARK,
1997};
1998static const unsigned int sdhi1_wp_pins[] = {
1999 /* WP */
2000 73,
2001};
2002static const unsigned int sdhi1_wp_mux[] = {
2003 SDHI1_WP_MARK,
2004};
2005/* - SDHI2 ------------------------------------------------------------------ */
2006static const unsigned int sdhi2_data1_pins[] = {
2007 /* D0 */
2008 205,
2009};
2010static const unsigned int sdhi2_data1_mux[] = {
2011 SDHI2_D0_MARK,
2012};
2013static const unsigned int sdhi2_data4_pins[] = {
2014 /* D[0:3] */
2015 205, 206, 207, 208,
2016};
2017static const unsigned int sdhi2_data4_mux[] = {
2018 SDHI2_D0_MARK, SDHI2_D1_MARK, SDHI2_D2_MARK, SDHI2_D3_MARK,
2019};
2020static const unsigned int sdhi2_ctrl_pins[] = {
2021 /* CMD, CLK */
2022 204, 203,
2023};
2024static const unsigned int sdhi2_ctrl_mux[] = {
2025 SDHI2_CMD_MARK, SDHI2_CLK_MARK,
2026};
2027static const unsigned int sdhi2_cd_0_pins[] = {
2028 /* CD */
2029 202,
2030};
2031static const unsigned int sdhi2_cd_0_mux[] = {
2032 SDHI2_CD_PORT202_MARK,
2033};
2034static const unsigned int sdhi2_wp_0_pins[] = {
2035 /* WP */
2036 177,
2037};
2038static const unsigned int sdhi2_wp_0_mux[] = {
2039 SDHI2_WP_PORT177_MARK,
2040};
2041static const unsigned int sdhi2_cd_1_pins[] = {
2042 /* CD */
2043 24,
2044};
2045static const unsigned int sdhi2_cd_1_mux[] = {
2046 SDHI2_CD_PORT24_MARK,
2047};
2048static const unsigned int sdhi2_wp_1_pins[] = {
2049 /* WP */
2050 25,
2051};
2052static const unsigned int sdhi2_wp_1_mux[] = {
2053 SDHI2_WP_PORT25_MARK,
2054};
1661 2055
2056static const struct sh_pfc_pin_group pinmux_groups[] = {
2057 SH_PFC_PIN_GROUP(lcd0_data8),
2058 SH_PFC_PIN_GROUP(lcd0_data9),
2059 SH_PFC_PIN_GROUP(lcd0_data12),
2060 SH_PFC_PIN_GROUP(lcd0_data16),
2061 SH_PFC_PIN_GROUP(lcd0_data18),
2062 SH_PFC_PIN_GROUP(lcd0_data24_0),
2063 SH_PFC_PIN_GROUP(lcd0_data24_1),
2064 SH_PFC_PIN_GROUP(lcd0_display),
2065 SH_PFC_PIN_GROUP(lcd0_lclk_0),
2066 SH_PFC_PIN_GROUP(lcd0_lclk_1),
2067 SH_PFC_PIN_GROUP(lcd0_sync),
2068 SH_PFC_PIN_GROUP(lcd0_sys),
2069 SH_PFC_PIN_GROUP(lcd1_data8),
2070 SH_PFC_PIN_GROUP(lcd1_data9),
2071 SH_PFC_PIN_GROUP(lcd1_data12),
2072 SH_PFC_PIN_GROUP(lcd1_data16),
2073 SH_PFC_PIN_GROUP(lcd1_data18),
2074 SH_PFC_PIN_GROUP(lcd1_data24),
2075 SH_PFC_PIN_GROUP(lcd1_display),
2076 SH_PFC_PIN_GROUP(lcd1_lclk),
2077 SH_PFC_PIN_GROUP(lcd1_sync),
2078 SH_PFC_PIN_GROUP(lcd1_sys),
2079 SH_PFC_PIN_GROUP(mmc0_data1_0),
2080 SH_PFC_PIN_GROUP(mmc0_data4_0),
2081 SH_PFC_PIN_GROUP(mmc0_data8_0),
2082 SH_PFC_PIN_GROUP(mmc0_ctrl_0),
2083 SH_PFC_PIN_GROUP(mmc0_data1_1),
2084 SH_PFC_PIN_GROUP(mmc0_data4_1),
2085 SH_PFC_PIN_GROUP(mmc0_data8_1),
2086 SH_PFC_PIN_GROUP(mmc0_ctrl_1),
2087 SH_PFC_PIN_GROUP(sdhi0_data1),
2088 SH_PFC_PIN_GROUP(sdhi0_data4),
2089 SH_PFC_PIN_GROUP(sdhi0_ctrl),
2090 SH_PFC_PIN_GROUP(sdhi0_cd),
2091 SH_PFC_PIN_GROUP(sdhi0_wp),
2092 SH_PFC_PIN_GROUP(sdhi1_data1),
2093 SH_PFC_PIN_GROUP(sdhi1_data4),
2094 SH_PFC_PIN_GROUP(sdhi1_ctrl),
2095 SH_PFC_PIN_GROUP(sdhi1_cd),
2096 SH_PFC_PIN_GROUP(sdhi1_wp),
2097 SH_PFC_PIN_GROUP(sdhi2_data1),
2098 SH_PFC_PIN_GROUP(sdhi2_data4),
2099 SH_PFC_PIN_GROUP(sdhi2_ctrl),
2100 SH_PFC_PIN_GROUP(sdhi2_cd_0),
2101 SH_PFC_PIN_GROUP(sdhi2_wp_0),
2102 SH_PFC_PIN_GROUP(sdhi2_cd_1),
2103 SH_PFC_PIN_GROUP(sdhi2_wp_1),
2104};
2105
2106static const char * const lcd0_groups[] = {
2107 "lcd0_data8",
2108 "lcd0_data9",
2109 "lcd0_data12",
2110 "lcd0_data16",
2111 "lcd0_data18",
2112 "lcd0_data24_0",
2113 "lcd0_data24_1",
2114 "lcd0_display",
2115 "lcd0_lclk_0",
2116 "lcd0_lclk_1",
2117 "lcd0_sync",
2118 "lcd0_sys",
2119};
2120
2121static const char * const lcd1_groups[] = {
2122 "lcd1_data8",
2123 "lcd1_data9",
2124 "lcd1_data12",
2125 "lcd1_data16",
2126 "lcd1_data18",
2127 "lcd1_data24",
2128 "lcd1_display",
2129 "lcd1_lclk",
2130 "lcd1_sync",
2131 "lcd1_sys",
2132};
2133
2134static const char * const mmc0_groups[] = {
2135 "mmc0_data1_0",
2136 "mmc0_data4_0",
2137 "mmc0_data8_0",
2138 "mmc0_ctrl_0",
2139 "mmc0_data1_1",
2140 "mmc0_data4_1",
2141 "mmc0_data8_1",
2142 "mmc0_ctrl_1",
2143};
2144
2145static const char * const sdhi0_groups[] = {
2146 "sdhi0_data1",
2147 "sdhi0_data4",
2148 "sdhi0_ctrl",
2149 "sdhi0_cd",
2150 "sdhi0_wp",
2151};
2152
2153static const char * const sdhi1_groups[] = {
2154 "sdhi1_data1",
2155 "sdhi1_data4",
2156 "sdhi1_ctrl",
2157 "sdhi1_cd",
2158 "sdhi1_wp",
2159};
2160
2161static const char * const sdhi2_groups[] = {
2162 "sdhi2_data1",
2163 "sdhi2_data4",
2164 "sdhi2_ctrl",
2165 "sdhi2_cd_0",
2166 "sdhi2_wp_0",
2167 "sdhi2_cd_1",
2168 "sdhi2_wp_1",
2169};
2170
2171static const struct sh_pfc_function pinmux_functions[] = {
2172 SH_PFC_FUNCTION(lcd0),
2173 SH_PFC_FUNCTION(lcd1),
2174 SH_PFC_FUNCTION(mmc0),
2175 SH_PFC_FUNCTION(sdhi0),
2176 SH_PFC_FUNCTION(sdhi1),
2177 SH_PFC_FUNCTION(sdhi2),
2178};
2179
2180#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
2181
2182static const struct pinmux_func pinmux_func_gpios[] = {
1662 /* IRQ */ 2183 /* IRQ */
1663 GPIO_FN(IRQ0_PORT2), GPIO_FN(IRQ0_PORT13), 2184 GPIO_FN(IRQ0_PORT2), GPIO_FN(IRQ0_PORT13),
1664 GPIO_FN(IRQ1), 2185 GPIO_FN(IRQ1),
@@ -1792,43 +2313,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1792 GPIO_FN(SCIFB_RTS_PORT172), 2313 GPIO_FN(SCIFB_RTS_PORT172),
1793 GPIO_FN(SCIFB_CTS_PORT173), 2314 GPIO_FN(SCIFB_CTS_PORT173),
1794 2315
1795 /* LCD0 */
1796 GPIO_FN(LCD0_D0), GPIO_FN(LCD0_D1), GPIO_FN(LCD0_D2),
1797 GPIO_FN(LCD0_D3), GPIO_FN(LCD0_D4), GPIO_FN(LCD0_D5),
1798 GPIO_FN(LCD0_D6), GPIO_FN(LCD0_D7), GPIO_FN(LCD0_D8),
1799 GPIO_FN(LCD0_D9), GPIO_FN(LCD0_D10), GPIO_FN(LCD0_D11),
1800 GPIO_FN(LCD0_D12), GPIO_FN(LCD0_D13), GPIO_FN(LCD0_D14),
1801 GPIO_FN(LCD0_D15), GPIO_FN(LCD0_D16), GPIO_FN(LCD0_D17),
1802 GPIO_FN(LCD0_DON), GPIO_FN(LCD0_VCPWC), GPIO_FN(LCD0_VEPWC),
1803 GPIO_FN(LCD0_DCK), GPIO_FN(LCD0_VSYN),
1804 GPIO_FN(LCD0_HSYN), GPIO_FN(LCD0_DISP),
1805 GPIO_FN(LCD0_WR), GPIO_FN(LCD0_RD),
1806 GPIO_FN(LCD0_CS), GPIO_FN(LCD0_RS),
1807
1808 GPIO_FN(LCD0_D18_PORT163), GPIO_FN(LCD0_D19_PORT162),
1809 GPIO_FN(LCD0_D20_PORT161), GPIO_FN(LCD0_D21_PORT158),
1810 GPIO_FN(LCD0_D22_PORT160), GPIO_FN(LCD0_D23_PORT159),
1811 GPIO_FN(LCD0_LCLK_PORT165), /* MSEL5CR_6_1 */
1812
1813 GPIO_FN(LCD0_D18_PORT40), GPIO_FN(LCD0_D19_PORT4),
1814 GPIO_FN(LCD0_D20_PORT3), GPIO_FN(LCD0_D21_PORT2),
1815 GPIO_FN(LCD0_D22_PORT0), GPIO_FN(LCD0_D23_PORT1),
1816 GPIO_FN(LCD0_LCLK_PORT102), /* MSEL5CR_6_0 */
1817
1818 /* LCD1 */
1819 GPIO_FN(LCD1_D0), GPIO_FN(LCD1_D1), GPIO_FN(LCD1_D2),
1820 GPIO_FN(LCD1_D3), GPIO_FN(LCD1_D4), GPIO_FN(LCD1_D5),
1821 GPIO_FN(LCD1_D6), GPIO_FN(LCD1_D7), GPIO_FN(LCD1_D8),
1822 GPIO_FN(LCD1_D9), GPIO_FN(LCD1_D10), GPIO_FN(LCD1_D11),
1823 GPIO_FN(LCD1_D12), GPIO_FN(LCD1_D13), GPIO_FN(LCD1_D14),
1824 GPIO_FN(LCD1_D15), GPIO_FN(LCD1_D16), GPIO_FN(LCD1_D17),
1825 GPIO_FN(LCD1_D18), GPIO_FN(LCD1_D19), GPIO_FN(LCD1_D20),
1826 GPIO_FN(LCD1_D21), GPIO_FN(LCD1_D22), GPIO_FN(LCD1_D23),
1827 GPIO_FN(LCD1_RS), GPIO_FN(LCD1_RD), GPIO_FN(LCD1_CS),
1828 GPIO_FN(LCD1_WR), GPIO_FN(LCD1_DCK), GPIO_FN(LCD1_DON),
1829 GPIO_FN(LCD1_VCPWC), GPIO_FN(LCD1_LCLK), GPIO_FN(LCD1_HSYN),
1830 GPIO_FN(LCD1_VSYN), GPIO_FN(LCD1_VEPWC), GPIO_FN(LCD1_DISP),
1831
1832 /* RSPI */ 2316 /* RSPI */
1833 GPIO_FN(RSPI_SSL0_A), GPIO_FN(RSPI_SSL1_A), GPIO_FN(RSPI_SSL2_A), 2317 GPIO_FN(RSPI_SSL0_A), GPIO_FN(RSPI_SSL1_A), GPIO_FN(RSPI_SSL2_A),
1834 GPIO_FN(RSPI_SSL3_A), GPIO_FN(RSPI_CK_A), GPIO_FN(RSPI_MOSI_A), 2318 GPIO_FN(RSPI_SSL3_A), GPIO_FN(RSPI_CK_A), GPIO_FN(RSPI_MOSI_A),
@@ -1889,26 +2373,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1889 GPIO_FN(SIM_D_PORT22), /* SIM_D Port 22/199 */ 2373 GPIO_FN(SIM_D_PORT22), /* SIM_D Port 22/199 */
1890 GPIO_FN(SIM_D_PORT199), 2374 GPIO_FN(SIM_D_PORT199),
1891 2375
1892 /* SDHI0 */
1893 GPIO_FN(SDHI0_D0), GPIO_FN(SDHI0_D1), GPIO_FN(SDHI0_D2),
1894 GPIO_FN(SDHI0_D3), GPIO_FN(SDHI0_CD), GPIO_FN(SDHI0_WP),
1895 GPIO_FN(SDHI0_CMD), GPIO_FN(SDHI0_CLK),
1896
1897 /* SDHI1 */
1898 GPIO_FN(SDHI1_D0), GPIO_FN(SDHI1_D1), GPIO_FN(SDHI1_D2),
1899 GPIO_FN(SDHI1_D3), GPIO_FN(SDHI1_CD), GPIO_FN(SDHI1_WP),
1900 GPIO_FN(SDHI1_CMD), GPIO_FN(SDHI1_CLK),
1901
1902 /* SDHI2 */
1903 GPIO_FN(SDHI2_D0), GPIO_FN(SDHI2_D1), GPIO_FN(SDHI2_D2),
1904 GPIO_FN(SDHI2_D3), GPIO_FN(SDHI2_CLK), GPIO_FN(SDHI2_CMD),
1905
1906 GPIO_FN(SDHI2_CD_PORT24), /* MSEL5CR_19_0 */
1907 GPIO_FN(SDHI2_WP_PORT25),
1908
1909 GPIO_FN(SDHI2_WP_PORT177), /* MSEL5CR_19_1 */
1910 GPIO_FN(SDHI2_CD_PORT202),
1911
1912 /* MSIOF2 */ 2376 /* MSIOF2 */
1913 GPIO_FN(MSIOF2_TXD), GPIO_FN(MSIOF2_RXD), GPIO_FN(MSIOF2_TSCK), 2377 GPIO_FN(MSIOF2_TXD), GPIO_FN(MSIOF2_RXD), GPIO_FN(MSIOF2_TSCK),
1914 GPIO_FN(MSIOF2_SS2), GPIO_FN(MSIOF2_TSYNC), GPIO_FN(MSIOF2_SS1), 2378 GPIO_FN(MSIOF2_SS2), GPIO_FN(MSIOF2_TSYNC), GPIO_FN(MSIOF2_SS1),
@@ -1953,21 +2417,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1953 GPIO_FN(MEMC_WAIT), GPIO_FN(MEMC_DREQ1), GPIO_FN(MEMC_BUSCLK), 2417 GPIO_FN(MEMC_WAIT), GPIO_FN(MEMC_DREQ1), GPIO_FN(MEMC_BUSCLK),
1954 GPIO_FN(MEMC_A0), 2418 GPIO_FN(MEMC_A0),
1955 2419
1956 /* MMC */
1957 GPIO_FN(MMC0_D0_PORT68), GPIO_FN(MMC0_D1_PORT69),
1958 GPIO_FN(MMC0_D2_PORT70), GPIO_FN(MMC0_D3_PORT71),
1959 GPIO_FN(MMC0_D4_PORT72), GPIO_FN(MMC0_D5_PORT73),
1960 GPIO_FN(MMC0_D6_PORT74), GPIO_FN(MMC0_D7_PORT75),
1961 GPIO_FN(MMC0_CLK_PORT66),
1962 GPIO_FN(MMC0_CMD_PORT67), /* MSEL4CR_15_0 */
1963
1964 GPIO_FN(MMC1_D0_PORT149), GPIO_FN(MMC1_D1_PORT148),
1965 GPIO_FN(MMC1_D2_PORT147), GPIO_FN(MMC1_D3_PORT146),
1966 GPIO_FN(MMC1_D4_PORT145), GPIO_FN(MMC1_D5_PORT144),
1967 GPIO_FN(MMC1_D6_PORT143), GPIO_FN(MMC1_D7_PORT142),
1968 GPIO_FN(MMC1_CLK_PORT103),
1969 GPIO_FN(MMC1_CMD_PORT104), /* MSEL4CR_15_1 */
1970
1971 /* MSIOF0 */ 2420 /* MSIOF0 */
1972 GPIO_FN(MSIOF0_SS1), GPIO_FN(MSIOF0_SS2), GPIO_FN(MSIOF0_RXD), 2421 GPIO_FN(MSIOF0_SS1), GPIO_FN(MSIOF0_SS2), GPIO_FN(MSIOF0_RXD),
1973 GPIO_FN(MSIOF0_TXD), GPIO_FN(MSIOF0_MCK0), GPIO_FN(MSIOF0_MCK1), 2422 GPIO_FN(MSIOF0_TXD), GPIO_FN(MSIOF0_MCK0), GPIO_FN(MSIOF0_MCK1),
@@ -2126,7 +2575,7 @@ static struct pinmux_gpio pinmux_gpios[] = {
2126 GPIO_FN(TRACEAUD_FROM_MEMC), 2575 GPIO_FN(TRACEAUD_FROM_MEMC),
2127}; 2576};
2128 2577
2129static struct pinmux_cfg_reg pinmux_config_regs[] = { 2578static const struct pinmux_cfg_reg pinmux_config_regs[] = {
2130 PORTCR(0, 0xe6050000), /* PORT0CR */ 2579 PORTCR(0, 0xe6050000), /* PORT0CR */
2131 PORTCR(1, 0xe6050001), /* PORT1CR */ 2580 PORTCR(1, 0xe6050001), /* PORT1CR */
2132 PORTCR(2, 0xe6050002), /* PORT2CR */ 2581 PORTCR(2, 0xe6050002), /* PORT2CR */
@@ -2440,7 +2889,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2440 { }, 2889 { },
2441}; 2890};
2442 2891
2443static struct pinmux_data_reg pinmux_data_regs[] = { 2892static const struct pinmux_data_reg pinmux_data_regs[] = {
2444 { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054800, 32) { 2893 { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054800, 32) {
2445 PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA, 2894 PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA,
2446 PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA, 2895 PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA,
@@ -2544,46 +2993,43 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2544 { }, 2993 { },
2545}; 2994};
2546 2995
2547static struct pinmux_irq pinmux_irqs[] = { 2996static const struct pinmux_irq pinmux_irqs[] = {
2548 PINMUX_IRQ(evt2irq(0x0200), PORT2_FN0, PORT13_FN0), /* IRQ0A */ 2997 PINMUX_IRQ(evt2irq(0x0200), GPIO_PORT2, GPIO_PORT13), /* IRQ0A */
2549 PINMUX_IRQ(evt2irq(0x0220), PORT20_FN0), /* IRQ1A */ 2998 PINMUX_IRQ(evt2irq(0x0220), GPIO_PORT20), /* IRQ1A */
2550 PINMUX_IRQ(evt2irq(0x0240), PORT11_FN0, PORT12_FN0), /* IRQ2A */ 2999 PINMUX_IRQ(evt2irq(0x0240), GPIO_PORT11, GPIO_PORT12), /* IRQ2A */
2551 PINMUX_IRQ(evt2irq(0x0260), PORT10_FN0, PORT14_FN0), /* IRQ3A */ 3000 PINMUX_IRQ(evt2irq(0x0260), GPIO_PORT10, GPIO_PORT14), /* IRQ3A */
2552 PINMUX_IRQ(evt2irq(0x0280), PORT15_FN0, PORT172_FN0), /* IRQ4A */ 3001 PINMUX_IRQ(evt2irq(0x0280), GPIO_PORT15, GPIO_PORT172),/* IRQ4A */
2553 PINMUX_IRQ(evt2irq(0x02A0), PORT0_FN0, PORT1_FN0), /* IRQ5A */ 3002 PINMUX_IRQ(evt2irq(0x02A0), GPIO_PORT0, GPIO_PORT1), /* IRQ5A */
2554 PINMUX_IRQ(evt2irq(0x02C0), PORT121_FN0, PORT173_FN0), /* IRQ6A */ 3003 PINMUX_IRQ(evt2irq(0x02C0), GPIO_PORT121, GPIO_PORT173),/* IRQ6A */
2555 PINMUX_IRQ(evt2irq(0x02E0), PORT120_FN0, PORT209_FN0), /* IRQ7A */ 3004 PINMUX_IRQ(evt2irq(0x02E0), GPIO_PORT120, GPIO_PORT209),/* IRQ7A */
2556 PINMUX_IRQ(evt2irq(0x0300), PORT119_FN0), /* IRQ8A */ 3005 PINMUX_IRQ(evt2irq(0x0300), GPIO_PORT119), /* IRQ8A */
2557 PINMUX_IRQ(evt2irq(0x0320), PORT118_FN0, PORT210_FN0), /* IRQ9A */ 3006 PINMUX_IRQ(evt2irq(0x0320), GPIO_PORT118, GPIO_PORT210),/* IRQ9A */
2558 PINMUX_IRQ(evt2irq(0x0340), PORT19_FN0), /* IRQ10A */ 3007 PINMUX_IRQ(evt2irq(0x0340), GPIO_PORT19), /* IRQ10A */
2559 PINMUX_IRQ(evt2irq(0x0360), PORT104_FN0), /* IRQ11A */ 3008 PINMUX_IRQ(evt2irq(0x0360), GPIO_PORT104), /* IRQ11A */
2560 PINMUX_IRQ(evt2irq(0x0380), PORT42_FN0, PORT97_FN0), /* IRQ12A */ 3009 PINMUX_IRQ(evt2irq(0x0380), GPIO_PORT42, GPIO_PORT97), /* IRQ12A */
2561 PINMUX_IRQ(evt2irq(0x03A0), PORT64_FN0, PORT98_FN0), /* IRQ13A */ 3010 PINMUX_IRQ(evt2irq(0x03A0), GPIO_PORT64, GPIO_PORT98), /* IRQ13A */
2562 PINMUX_IRQ(evt2irq(0x03C0), PORT63_FN0, PORT99_FN0), /* IRQ14A */ 3011 PINMUX_IRQ(evt2irq(0x03C0), GPIO_PORT63, GPIO_PORT99), /* IRQ14A */
2563 PINMUX_IRQ(evt2irq(0x03E0), PORT62_FN0, PORT100_FN0), /* IRQ15A */ 3012 PINMUX_IRQ(evt2irq(0x03E0), GPIO_PORT62, GPIO_PORT100),/* IRQ15A */
2564 PINMUX_IRQ(evt2irq(0x3200), PORT68_FN0, PORT211_FN0), /* IRQ16A */ 3013 PINMUX_IRQ(evt2irq(0x3200), GPIO_PORT68, GPIO_PORT211),/* IRQ16A */
2565 PINMUX_IRQ(evt2irq(0x3220), PORT69_FN0), /* IRQ17A */ 3014 PINMUX_IRQ(evt2irq(0x3220), GPIO_PORT69), /* IRQ17A */
2566 PINMUX_IRQ(evt2irq(0x3240), PORT70_FN0), /* IRQ18A */ 3015 PINMUX_IRQ(evt2irq(0x3240), GPIO_PORT70), /* IRQ18A */
2567 PINMUX_IRQ(evt2irq(0x3260), PORT71_FN0), /* IRQ19A */ 3016 PINMUX_IRQ(evt2irq(0x3260), GPIO_PORT71), /* IRQ19A */
2568 PINMUX_IRQ(evt2irq(0x3280), PORT67_FN0), /* IRQ20A */ 3017 PINMUX_IRQ(evt2irq(0x3280), GPIO_PORT67), /* IRQ20A */
2569 PINMUX_IRQ(evt2irq(0x32A0), PORT202_FN0), /* IRQ21A */ 3018 PINMUX_IRQ(evt2irq(0x32A0), GPIO_PORT202), /* IRQ21A */
2570 PINMUX_IRQ(evt2irq(0x32C0), PORT95_FN0), /* IRQ22A */ 3019 PINMUX_IRQ(evt2irq(0x32C0), GPIO_PORT95), /* IRQ22A */
2571 PINMUX_IRQ(evt2irq(0x32E0), PORT96_FN0), /* IRQ23A */ 3020 PINMUX_IRQ(evt2irq(0x32E0), GPIO_PORT96), /* IRQ23A */
2572 PINMUX_IRQ(evt2irq(0x3300), PORT180_FN0), /* IRQ24A */ 3021 PINMUX_IRQ(evt2irq(0x3300), GPIO_PORT180), /* IRQ24A */
2573 PINMUX_IRQ(evt2irq(0x3320), PORT38_FN0), /* IRQ25A */ 3022 PINMUX_IRQ(evt2irq(0x3320), GPIO_PORT38), /* IRQ25A */
2574 PINMUX_IRQ(evt2irq(0x3340), PORT58_FN0, PORT81_FN0), /* IRQ26A */ 3023 PINMUX_IRQ(evt2irq(0x3340), GPIO_PORT58, GPIO_PORT81), /* IRQ26A */
2575 PINMUX_IRQ(evt2irq(0x3360), PORT57_FN0, PORT168_FN0), /* IRQ27A */ 3024 PINMUX_IRQ(evt2irq(0x3360), GPIO_PORT57, GPIO_PORT168),/* IRQ27A */
2576 PINMUX_IRQ(evt2irq(0x3380), PORT56_FN0, PORT169_FN0), /* IRQ28A */ 3025 PINMUX_IRQ(evt2irq(0x3380), GPIO_PORT56, GPIO_PORT169),/* IRQ28A */
2577 PINMUX_IRQ(evt2irq(0x33A0), PORT50_FN0, PORT170_FN0), /* IRQ29A */ 3026 PINMUX_IRQ(evt2irq(0x33A0), GPIO_PORT50, GPIO_PORT170),/* IRQ29A */
2578 PINMUX_IRQ(evt2irq(0x33C0), PORT49_FN0, PORT171_FN0), /* IRQ30A */ 3027 PINMUX_IRQ(evt2irq(0x33C0), GPIO_PORT49, GPIO_PORT171),/* IRQ30A */
2579 PINMUX_IRQ(evt2irq(0x33E0), PORT41_FN0, PORT167_FN0), /* IRQ31A */ 3028 PINMUX_IRQ(evt2irq(0x33E0), GPIO_PORT41, GPIO_PORT167),/* IRQ31A */
2580}; 3029};
2581 3030
2582struct sh_pfc_soc_info r8a7740_pinmux_info = { 3031const struct sh_pfc_soc_info r8a7740_pinmux_info = {
2583 .name = "r8a7740_pfc", 3032 .name = "r8a7740_pfc",
2584 .reserved_id = PINMUX_RESERVED,
2585 .data = { PINMUX_DATA_BEGIN,
2586 PINMUX_DATA_END },
2587 .input = { PINMUX_INPUT_BEGIN, 3033 .input = { PINMUX_INPUT_BEGIN,
2588 PINMUX_INPUT_END }, 3034 PINMUX_INPUT_END },
2589 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, 3035 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN,
@@ -2592,15 +3038,19 @@ struct sh_pfc_soc_info r8a7740_pinmux_info = {
2592 PINMUX_INPUT_PULLDOWN_END }, 3038 PINMUX_INPUT_PULLDOWN_END },
2593 .output = { PINMUX_OUTPUT_BEGIN, 3039 .output = { PINMUX_OUTPUT_BEGIN,
2594 PINMUX_OUTPUT_END }, 3040 PINMUX_OUTPUT_END },
2595 .mark = { PINMUX_MARK_BEGIN,
2596 PINMUX_MARK_END },
2597 .function = { PINMUX_FUNCTION_BEGIN, 3041 .function = { PINMUX_FUNCTION_BEGIN,
2598 PINMUX_FUNCTION_END }, 3042 PINMUX_FUNCTION_END },
2599 3043
2600 .first_gpio = GPIO_PORT0, 3044 .pins = pinmux_pins,
2601 .last_gpio = GPIO_FN_TRACEAUD_FROM_MEMC, 3045 .nr_pins = ARRAY_SIZE(pinmux_pins),
3046 .groups = pinmux_groups,
3047 .nr_groups = ARRAY_SIZE(pinmux_groups),
3048 .functions = pinmux_functions,
3049 .nr_functions = ARRAY_SIZE(pinmux_functions),
3050
3051 .func_gpios = pinmux_func_gpios,
3052 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2602 3053
2603 .gpios = pinmux_gpios,
2604 .cfg_regs = pinmux_config_regs, 3054 .cfg_regs = pinmux_config_regs,
2605 .data_regs = pinmux_data_regs, 3055 .data_regs = pinmux_data_regs,
2606 3056
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
index 13feaa0c0eb7..1d7b0dfbbb21 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
@@ -23,11 +23,6 @@
23 23
24#include "sh_pfc.h" 24#include "sh_pfc.h"
25 25
26#define CPU_32_PORT(fn, pfx, sfx) \
27 PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \
28 PORT_10(fn, pfx##2, sfx), PORT_1(fn, pfx##30, sfx), \
29 PORT_1(fn, pfx##31, sfx)
30
31#define CPU_32_PORT6(fn, pfx, sfx) \ 26#define CPU_32_PORT6(fn, pfx, sfx) \
32 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ 27 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
33 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ 28 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
@@ -36,12 +31,12 @@
36 PORT_1(fn, pfx##8, sfx) 31 PORT_1(fn, pfx##8, sfx)
37 32
38#define CPU_ALL_PORT(fn, pfx, sfx) \ 33#define CPU_ALL_PORT(fn, pfx, sfx) \
39 CPU_32_PORT(fn, pfx##_0_, sfx), \ 34 PORT_32(fn, pfx##_0_, sfx), \
40 CPU_32_PORT(fn, pfx##_1_, sfx), \ 35 PORT_32(fn, pfx##_1_, sfx), \
41 CPU_32_PORT(fn, pfx##_2_, sfx), \ 36 PORT_32(fn, pfx##_2_, sfx), \
42 CPU_32_PORT(fn, pfx##_3_, sfx), \ 37 PORT_32(fn, pfx##_3_, sfx), \
43 CPU_32_PORT(fn, pfx##_4_, sfx), \ 38 PORT_32(fn, pfx##_4_, sfx), \
44 CPU_32_PORT(fn, pfx##_5_, sfx), \ 39 PORT_32(fn, pfx##_5_, sfx), \
45 CPU_32_PORT6(fn, pfx##_6_, sfx) 40 CPU_32_PORT6(fn, pfx##_6_, sfx)
46 41
47#define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) 42#define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA)
@@ -55,21 +50,8 @@
55#define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) 50#define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused)
56#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) 51#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused)
57 52
58 53#define GP_INOUTSEL(bank) PORT_32_REV(_GP_INOUTSEL, _##bank##_, unused)
59#define PORT_10_REV(fn, pfx, sfx) \ 54#define GP_INDT(bank) PORT_32_REV(_GP_INDT, _##bank##_, unused)
60 PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \
61 PORT_1(fn, pfx##7, sfx), PORT_1(fn, pfx##6, sfx), \
62 PORT_1(fn, pfx##5, sfx), PORT_1(fn, pfx##4, sfx), \
63 PORT_1(fn, pfx##3, sfx), PORT_1(fn, pfx##2, sfx), \
64 PORT_1(fn, pfx##1, sfx), PORT_1(fn, pfx##0, sfx)
65
66#define CPU_32_PORT_REV(fn, pfx, sfx) \
67 PORT_1(fn, pfx##31, sfx), PORT_1(fn, pfx##30, sfx), \
68 PORT_10_REV(fn, pfx##2, sfx), PORT_10_REV(fn, pfx##1, sfx), \
69 PORT_10_REV(fn, pfx, sfx)
70
71#define GP_INOUTSEL(bank) CPU_32_PORT_REV(_GP_INOUTSEL, _##bank##_, unused)
72#define GP_INDT(bank) CPU_32_PORT_REV(_GP_INDT, _##bank##_, unused)
73 55
74#define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) 56#define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn)
75#define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ 57#define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \
@@ -371,7 +353,7 @@ enum {
371 FN_VI1_DATA6_VI1_B6, FN_SD2_CD, FN_MT0_VCXO, FN_SPA_TMS, 353 FN_VI1_DATA6_VI1_B6, FN_SD2_CD, FN_MT0_VCXO, FN_SPA_TMS,
372 FN_HSPI_TX1_D, FN_VI1_DATA7_VI1_B7, FN_SD2_WP, FN_MT0_PWM, 354 FN_HSPI_TX1_D, FN_VI1_DATA7_VI1_B7, FN_SD2_WP, FN_MT0_PWM,
373 FN_SPA_TDI, FN_HSPI_RX1_D, FN_VI1_G0, FN_VI3_DATA0, 355 FN_SPA_TDI, FN_HSPI_RX1_D, FN_VI1_G0, FN_VI3_DATA0,
374 FN_DU1_DOTCLKOUT1, FN_TS_SCK1, FN_DREQ2_B, FN_TX2, 356 FN_TS_SCK1, FN_DREQ2_B, FN_TX2,
375 FN_SPA_TDO, FN_HCTS0_B, FN_VI1_G1, FN_VI3_DATA1, 357 FN_SPA_TDO, FN_HCTS0_B, FN_VI1_G1, FN_VI3_DATA1,
376 FN_SSI_SCK1, FN_TS_SDEN1, FN_DACK2_B, FN_RX2, FN_HRTS0_B, 358 FN_SSI_SCK1, FN_TS_SDEN1, FN_DACK2_B, FN_RX2, FN_HRTS0_B,
377 359
@@ -447,7 +429,8 @@ enum {
447 A0_MARK, SD1_DAT3_MARK, MMC0_D3_MARK, FD3_MARK, 429 A0_MARK, SD1_DAT3_MARK, MMC0_D3_MARK, FD3_MARK,
448 BS_MARK, SD1_DAT2_MARK, MMC0_D2_MARK, FD2_MARK, 430 BS_MARK, SD1_DAT2_MARK, MMC0_D2_MARK, FD2_MARK,
449 ATADIR0_MARK, SDSELF_MARK, HCTS1_MARK, TX4_C_MARK, 431 ATADIR0_MARK, SDSELF_MARK, HCTS1_MARK, TX4_C_MARK,
450 USB_PENC2_MARK, SCK0_MARK, PWM1_MARK, PWMFSW0_MARK, 432 USB_PENC0_MARK, USB_PENC1_MARK, USB_PENC2_MARK,
433 SCK0_MARK, PWM1_MARK, PWMFSW0_MARK,
451 SCIF_CLK_MARK, TCLK0_C_MARK, 434 SCIF_CLK_MARK, TCLK0_C_MARK,
452 435
453 EX_CS0_MARK, RX3_C_IRDA_RX_C_MARK, MMC0_D6_MARK, 436 EX_CS0_MARK, RX3_C_IRDA_RX_C_MARK, MMC0_D6_MARK,
@@ -632,7 +615,7 @@ enum {
632 HSPI_CS1_D_MARK, ADICHS2_B_MARK, VI1_DATA6_VI1_B6_MARK, SD2_CD_MARK, 615 HSPI_CS1_D_MARK, ADICHS2_B_MARK, VI1_DATA6_VI1_B6_MARK, SD2_CD_MARK,
633 MT0_VCXO_MARK, SPA_TMS_MARK, HSPI_TX1_D_MARK, VI1_DATA7_VI1_B7_MARK, 616 MT0_VCXO_MARK, SPA_TMS_MARK, HSPI_TX1_D_MARK, VI1_DATA7_VI1_B7_MARK,
634 SD2_WP_MARK, MT0_PWM_MARK, SPA_TDI_MARK, HSPI_RX1_D_MARK, 617 SD2_WP_MARK, MT0_PWM_MARK, SPA_TDI_MARK, HSPI_RX1_D_MARK,
635 VI1_G0_MARK, VI3_DATA0_MARK, DU1_DOTCLKOUT1_MARK, TS_SCK1_MARK, 618 VI1_G0_MARK, VI3_DATA0_MARK, TS_SCK1_MARK,
636 DREQ2_B_MARK, TX2_MARK, SPA_TDO_MARK, HCTS0_B_MARK, 619 DREQ2_B_MARK, TX2_MARK, SPA_TDO_MARK, HCTS0_B_MARK,
637 VI1_G1_MARK, VI3_DATA1_MARK, SSI_SCK1_MARK, TS_SDEN1_MARK, 620 VI1_G1_MARK, VI3_DATA1_MARK, SSI_SCK1_MARK, TS_SDEN1_MARK,
638 DACK2_B_MARK, RX2_MARK, HRTS0_B_MARK, 621 DACK2_B_MARK, RX2_MARK, HRTS0_B_MARK,
@@ -649,7 +632,7 @@ enum {
649 PINMUX_MARK_END, 632 PINMUX_MARK_END,
650}; 633};
651 634
652static pinmux_enum_t pinmux_data[] = { 635static const pinmux_enum_t pinmux_data[] = {
653 PINMUX_DATA_GP_ALL(), /* PINMUX_DATA(GP_M_N_DATA, GP_M_N_FN...), */ 636 PINMUX_DATA_GP_ALL(), /* PINMUX_DATA(GP_M_N_DATA, GP_M_N_FN...), */
654 637
655 PINMUX_DATA(AVS1_MARK, FN_AVS1), 638 PINMUX_DATA(AVS1_MARK, FN_AVS1),
@@ -658,6 +641,9 @@ static pinmux_enum_t pinmux_data[] = {
658 PINMUX_DATA(A18_MARK, FN_A18), 641 PINMUX_DATA(A18_MARK, FN_A18),
659 PINMUX_DATA(A19_MARK, FN_A19), 642 PINMUX_DATA(A19_MARK, FN_A19),
660 643
644 PINMUX_DATA(USB_PENC0_MARK, FN_USB_PENC0),
645 PINMUX_DATA(USB_PENC1_MARK, FN_USB_PENC1),
646
661 PINMUX_IPSR_DATA(IP0_2_0, USB_PENC2), 647 PINMUX_IPSR_DATA(IP0_2_0, USB_PENC2),
662 PINMUX_IPSR_MODSEL_DATA(IP0_2_0, SCK0, SEL_SCIF0_0), 648 PINMUX_IPSR_MODSEL_DATA(IP0_2_0, SCK0, SEL_SCIF0_0),
663 PINMUX_IPSR_DATA(IP0_2_0, PWM1), 649 PINMUX_IPSR_DATA(IP0_2_0, PWM1),
@@ -1399,7 +1385,6 @@ static pinmux_enum_t pinmux_data[] = {
1399 PINMUX_IPSR_MODSEL_DATA(IP11_23_21, HSPI_RX1_D, SEL_HSPI1_3), 1385 PINMUX_IPSR_MODSEL_DATA(IP11_23_21, HSPI_RX1_D, SEL_HSPI1_3),
1400 PINMUX_IPSR_DATA(IP11_26_24, VI1_G0), 1386 PINMUX_IPSR_DATA(IP11_26_24, VI1_G0),
1401 PINMUX_IPSR_DATA(IP11_26_24, VI3_DATA0), 1387 PINMUX_IPSR_DATA(IP11_26_24, VI3_DATA0),
1402 PINMUX_IPSR_DATA(IP11_26_24, DU1_DOTCLKOUT1),
1403 PINMUX_IPSR_DATA(IP11_26_24, TS_SCK1), 1388 PINMUX_IPSR_DATA(IP11_26_24, TS_SCK1),
1404 PINMUX_IPSR_MODSEL_DATA(IP11_26_24, DREQ2_B, SEL_EXBUS2_1), 1389 PINMUX_IPSR_MODSEL_DATA(IP11_26_24, DREQ2_B, SEL_EXBUS2_1),
1405 PINMUX_IPSR_DATA(IP11_26_24, TX2), 1390 PINMUX_IPSR_DATA(IP11_26_24, TX2),
@@ -1450,140 +1435,1372 @@ static pinmux_enum_t pinmux_data[] = {
1450 PINMUX_IPSR_MODSEL_DATA(IP12_17_15, SCK4_B, SEL_SCIF4_1), 1435 PINMUX_IPSR_MODSEL_DATA(IP12_17_15, SCK4_B, SEL_SCIF4_1),
1451}; 1436};
1452 1437
1453static struct pinmux_gpio pinmux_gpios[] = { 1438static struct sh_pfc_pin pinmux_pins[] = {
1454 PINMUX_GPIO_GP_ALL(), 1439 PINMUX_GPIO_GP_ALL(),
1440};
1441
1442/* - DU0 -------------------------------------------------------------------- */
1443static const unsigned int du0_rgb666_pins[] = {
1444 /* R[7:2], G[7:2], B[7:2] */
1445 188, 187, 186, 185, 184, 183,
1446 194, 193, 192, 191, 190, 189,
1447 200, 199, 198, 197, 196, 195,
1448};
1449static const unsigned int du0_rgb666_mux[] = {
1450 DU0_DR7_MARK, DU0_DR6_MARK, DU0_DR5_MARK, DU0_DR4_MARK,
1451 DU0_DR3_MARK, DU0_DR2_MARK,
1452 DU0_DG7_MARK, DU0_DG6_MARK, DU0_DG5_MARK, DU0_DG4_MARK,
1453 DU0_DG3_MARK, DU0_DG2_MARK,
1454 DU0_DB7_MARK, DU0_DB6_MARK, DU0_DB5_MARK, DU0_DB4_MARK,
1455 DU0_DB3_MARK, DU0_DB2_MARK,
1456};
1457static const unsigned int du0_rgb888_pins[] = {
1458 /* R[7:0], G[7:0], B[7:0] */
1459 188, 187, 186, 185, 184, 183, 24, 23,
1460 194, 193, 192, 191, 190, 189, 26, 25,
1461 200, 199, 198, 197, 196, 195, 28, 27,
1462};
1463static const unsigned int du0_rgb888_mux[] = {
1464 DU0_DR7_MARK, DU0_DR6_MARK, DU0_DR5_MARK, DU0_DR4_MARK,
1465 DU0_DR3_MARK, DU0_DR2_MARK, DU0_DR1_MARK, DU0_DR0_MARK,
1466 DU0_DG7_MARK, DU0_DG6_MARK, DU0_DG5_MARK, DU0_DG4_MARK,
1467 DU0_DG3_MARK, DU0_DG2_MARK, DU0_DG1_MARK, DU0_DG0_MARK,
1468 DU0_DB7_MARK, DU0_DB6_MARK, DU0_DB5_MARK, DU0_DB4_MARK,
1469 DU0_DB3_MARK, DU0_DB2_MARK, DU0_DB1_MARK, DU0_DB0_MARK,
1470};
1471static const unsigned int du0_clk_0_pins[] = {
1472 /* CLKIN, CLKOUT */
1473 29, 180,
1474};
1475static const unsigned int du0_clk_0_mux[] = {
1476 DU0_DOTCLKIN_MARK, DU0_DOTCLKOUT0_MARK,
1477};
1478static const unsigned int du0_clk_1_pins[] = {
1479 /* CLKIN, CLKOUT */
1480 29, 30,
1481};
1482static const unsigned int du0_clk_1_mux[] = {
1483 DU0_DOTCLKIN_MARK, DU0_DOTCLKOUT1_MARK,
1484};
1485static const unsigned int du0_sync_0_pins[] = {
1486 /* VSYNC, HSYNC, DISP */
1487 182, 181, 31,
1488};
1489static const unsigned int du0_sync_0_mux[] = {
1490 DU0_EXHSYNC_DU0_HSYNC_MARK, DU0_EXVSYNC_DU0_VSYNC_MARK,
1491 DU0_EXODDF_DU0_ODDF_DISP_CDE_MARK
1492};
1493static const unsigned int du0_sync_1_pins[] = {
1494 /* VSYNC, HSYNC, DISP */
1495 182, 181, 32,
1496};
1497static const unsigned int du0_sync_1_mux[] = {
1498 DU0_EXHSYNC_DU0_HSYNC_MARK, DU0_EXVSYNC_DU0_VSYNC_MARK,
1499 DU0_DISP_MARK
1500};
1501static const unsigned int du0_oddf_pins[] = {
1502 /* ODDF */
1503 31,
1504};
1505static const unsigned int du0_oddf_mux[] = {
1506 DU0_EXODDF_DU0_ODDF_DISP_CDE_MARK
1507};
1508static const unsigned int du0_cde_pins[] = {
1509 /* CDE */
1510 33,
1511};
1512static const unsigned int du0_cde_mux[] = {
1513 DU0_CDE_MARK
1514};
1515/* - DU1 -------------------------------------------------------------------- */
1516static const unsigned int du1_rgb666_pins[] = {
1517 /* R[7:2], G[7:2], B[7:2] */
1518 41, 40, 39, 38, 37, 36,
1519 49, 48, 47, 46, 45, 44,
1520 57, 56, 55, 54, 53, 52,
1521};
1522static const unsigned int du1_rgb666_mux[] = {
1523 DU1_DR7_MARK, DU1_DR6_MARK, DU1_DR5_MARK, DU1_DR4_MARK,
1524 DU1_DR3_MARK, DU1_DR2_MARK,
1525 DU1_DG7_MARK, DU1_DG6_MARK, DU1_DG5_MARK, DU1_DG4_MARK,
1526 DU1_DG3_MARK, DU1_DG2_MARK,
1527 DU1_DB7_MARK, DU1_DB6_MARK, DU1_DB5_MARK, DU1_DB4_MARK,
1528 DU1_DB3_MARK, DU1_DB2_MARK,
1529};
1530static const unsigned int du1_rgb888_pins[] = {
1531 /* R[7:0], G[7:0], B[7:0] */
1532 41, 40, 39, 38, 37, 36, 35, 34,
1533 49, 48, 47, 46, 45, 44, 43, 32,
1534 57, 56, 55, 54, 53, 52, 51, 50,
1535};
1536static const unsigned int du1_rgb888_mux[] = {
1537 DU1_DR7_MARK, DU1_DR6_MARK, DU1_DR5_MARK, DU1_DR4_MARK,
1538 DU1_DR3_MARK, DU1_DR2_MARK, DU1_DR1_MARK, DU1_DR0_MARK,
1539 DU1_DG7_MARK, DU1_DG6_MARK, DU1_DG5_MARK, DU1_DG4_MARK,
1540 DU1_DG3_MARK, DU1_DG2_MARK, DU1_DG1_MARK, DU1_DG0_MARK,
1541 DU1_DB7_MARK, DU1_DB6_MARK, DU1_DB5_MARK, DU1_DB4_MARK,
1542 DU1_DB3_MARK, DU1_DB2_MARK, DU1_DB1_MARK, DU1_DB0_MARK,
1543};
1544static const unsigned int du1_clk_pins[] = {
1545 /* CLKIN, CLKOUT */
1546 58, 59,
1547};
1548static const unsigned int du1_clk_mux[] = {
1549 DU1_DOTCLKIN_MARK, DU1_DOTCLKOUT_MARK,
1550};
1551static const unsigned int du1_sync_0_pins[] = {
1552 /* VSYNC, HSYNC, DISP */
1553 61, 60, 62,
1554};
1555static const unsigned int du1_sync_0_mux[] = {
1556 DU1_EXVSYNC_DU1_VSYNC_MARK, DU1_EXHSYNC_DU1_HSYNC_MARK,
1557 DU1_EXODDF_DU1_ODDF_DISP_CDE_MARK
1558};
1559static const unsigned int du1_sync_1_pins[] = {
1560 /* VSYNC, HSYNC, DISP */
1561 61, 60, 63,
1562};
1563static const unsigned int du1_sync_1_mux[] = {
1564 DU1_EXVSYNC_DU1_VSYNC_MARK, DU1_EXHSYNC_DU1_HSYNC_MARK,
1565 DU1_DISP_MARK
1566};
1567static const unsigned int du1_oddf_pins[] = {
1568 /* ODDF */
1569 62,
1570};
1571static const unsigned int du1_oddf_mux[] = {
1572 DU1_EXODDF_DU1_ODDF_DISP_CDE_MARK
1573};
1574static const unsigned int du1_cde_pins[] = {
1575 /* CDE */
1576 64,
1577};
1578static const unsigned int du1_cde_mux[] = {
1579 DU1_CDE_MARK
1580};
1581/* - HSPI0 ------------------------------------------------------------------ */
1582static const unsigned int hspi0_pins[] = {
1583 /* CLK, CS, RX, TX */
1584 150, 151, 153, 152,
1585};
1586static const unsigned int hspi0_mux[] = {
1587 HSPI_CLK0_MARK, HSPI_CS0_MARK, HSPI_RX0_MARK, HSPI_TX0_MARK,
1588};
1589/* - HSPI1 ------------------------------------------------------------------ */
1590static const unsigned int hspi1_pins[] = {
1591 /* CLK, CS, RX, TX */
1592 63, 58, 64, 62,
1593};
1594static const unsigned int hspi1_mux[] = {
1595 HSPI_CLK1_MARK, HSPI_CS1_MARK, HSPI_RX1_MARK, HSPI_TX1_MARK,
1596};
1597static const unsigned int hspi1_b_pins[] = {
1598 /* CLK, CS, RX, TX */
1599 90, 91, 93, 92,
1600};
1601static const unsigned int hspi1_b_mux[] = {
1602 HSPI_CLK1_B_MARK, HSPI_CS1_B_MARK, HSPI_RX1_B_MARK, HSPI_TX1_B_MARK,
1603};
1604static const unsigned int hspi1_c_pins[] = {
1605 /* CLK, CS, RX, TX */
1606 141, 142, 144, 143,
1607};
1608static const unsigned int hspi1_c_mux[] = {
1609 HSPI_CLK1_C_MARK, HSPI_CS1_C_MARK, HSPI_RX1_C_MARK, HSPI_TX1_C_MARK,
1610};
1611static const unsigned int hspi1_d_pins[] = {
1612 /* CLK, CS, RX, TX */
1613 101, 102, 104, 103,
1614};
1615static const unsigned int hspi1_d_mux[] = {
1616 HSPI_CLK1_D_MARK, HSPI_CS1_D_MARK, HSPI_RX1_D_MARK, HSPI_TX1_D_MARK,
1617};
1618/* - HSPI2 ------------------------------------------------------------------ */
1619static const unsigned int hspi2_pins[] = {
1620 /* CLK, CS, RX, TX */
1621 9, 10, 11, 14,
1622};
1623static const unsigned int hspi2_mux[] = {
1624 HSPI_CLK2_MARK, HSPI_CS2_MARK, HSPI_RX2_MARK, HSPI_TX2_MARK,
1625};
1626static const unsigned int hspi2_b_pins[] = {
1627 /* CLK, CS, RX, TX */
1628 7, 13, 8, 6,
1629};
1630static const unsigned int hspi2_b_mux[] = {
1631 HSPI_CLK2_B_MARK, HSPI_CS2_B_MARK, HSPI_RX2_B_MARK, HSPI_TX2_B_MARK,
1632};
1633/* - INTC ------------------------------------------------------------------- */
1634static const unsigned int intc_irq0_pins[] = {
1635 /* IRQ */
1636 78,
1637};
1638static const unsigned int intc_irq0_mux[] = {
1639 IRQ0_MARK,
1640};
1641static const unsigned int intc_irq0_b_pins[] = {
1642 /* IRQ */
1643 141,
1644};
1645static const unsigned int intc_irq0_b_mux[] = {
1646 IRQ0_B_MARK,
1647};
1648static const unsigned int intc_irq1_pins[] = {
1649 /* IRQ */
1650 79,
1651};
1652static const unsigned int intc_irq1_mux[] = {
1653 IRQ1_MARK,
1654};
1655static const unsigned int intc_irq1_b_pins[] = {
1656 /* IRQ */
1657 142,
1658};
1659static const unsigned int intc_irq1_b_mux[] = {
1660 IRQ1_B_MARK,
1661};
1662static const unsigned int intc_irq2_pins[] = {
1663 /* IRQ */
1664 88,
1665};
1666static const unsigned int intc_irq2_mux[] = {
1667 IRQ2_MARK,
1668};
1669static const unsigned int intc_irq2_b_pins[] = {
1670 /* IRQ */
1671 143,
1672};
1673static const unsigned int intc_irq2_b_mux[] = {
1674 IRQ2_B_MARK,
1675};
1676static const unsigned int intc_irq3_pins[] = {
1677 /* IRQ */
1678 89,
1679};
1680static const unsigned int intc_irq3_mux[] = {
1681 IRQ3_MARK,
1682};
1683static const unsigned int intc_irq3_b_pins[] = {
1684 /* IRQ */
1685 144,
1686};
1687static const unsigned int intc_irq3_b_mux[] = {
1688 IRQ3_B_MARK,
1689};
1690/* - LSBC ------------------------------------------------------------------- */
1691static const unsigned int lbsc_cs0_pins[] = {
1692 /* CS */
1693 13,
1694};
1695static const unsigned int lbsc_cs0_mux[] = {
1696 CS0_MARK,
1697};
1698static const unsigned int lbsc_cs1_pins[] = {
1699 /* CS */
1700 14,
1701};
1702static const unsigned int lbsc_cs1_mux[] = {
1703 CS1_A26_MARK,
1704};
1705static const unsigned int lbsc_ex_cs0_pins[] = {
1706 /* CS */
1707 15,
1708};
1709static const unsigned int lbsc_ex_cs0_mux[] = {
1710 EX_CS0_MARK,
1711};
1712static const unsigned int lbsc_ex_cs1_pins[] = {
1713 /* CS */
1714 16,
1715};
1716static const unsigned int lbsc_ex_cs1_mux[] = {
1717 EX_CS1_MARK,
1718};
1719static const unsigned int lbsc_ex_cs2_pins[] = {
1720 /* CS */
1721 17,
1722};
1723static const unsigned int lbsc_ex_cs2_mux[] = {
1724 EX_CS2_MARK,
1725};
1726static const unsigned int lbsc_ex_cs3_pins[] = {
1727 /* CS */
1728 18,
1729};
1730static const unsigned int lbsc_ex_cs3_mux[] = {
1731 EX_CS3_MARK,
1732};
1733static const unsigned int lbsc_ex_cs4_pins[] = {
1734 /* CS */
1735 19,
1736};
1737static const unsigned int lbsc_ex_cs4_mux[] = {
1738 EX_CS4_MARK,
1739};
1740static const unsigned int lbsc_ex_cs5_pins[] = {
1741 /* CS */
1742 20,
1743};
1744static const unsigned int lbsc_ex_cs5_mux[] = {
1745 EX_CS5_MARK,
1746};
1747/* - MMCIF ------------------------------------------------------------------ */
1748static const unsigned int mmc0_data1_pins[] = {
1749 /* D[0] */
1750 19,
1751};
1752static const unsigned int mmc0_data1_mux[] = {
1753 MMC0_D0_MARK,
1754};
1755static const unsigned int mmc0_data4_pins[] = {
1756 /* D[0:3] */
1757 19, 20, 21, 2,
1758};
1759static const unsigned int mmc0_data4_mux[] = {
1760 MMC0_D0_MARK, MMC0_D1_MARK, MMC0_D2_MARK, MMC0_D3_MARK,
1761};
1762static const unsigned int mmc0_data8_pins[] = {
1763 /* D[0:7] */
1764 19, 20, 21, 2, 10, 11, 15, 16,
1765};
1766static const unsigned int mmc0_data8_mux[] = {
1767 MMC0_D0_MARK, MMC0_D1_MARK, MMC0_D2_MARK, MMC0_D3_MARK,
1768 MMC0_D4_MARK, MMC0_D5_MARK, MMC0_D6_MARK, MMC0_D7_MARK,
1769};
1770static const unsigned int mmc0_ctrl_pins[] = {
1771 /* CMD, CLK */
1772 18, 17,
1773};
1774static const unsigned int mmc0_ctrl_mux[] = {
1775 MMC0_CMD_MARK, MMC0_CLK_MARK,
1776};
1777static const unsigned int mmc1_data1_pins[] = {
1778 /* D[0] */
1779 72,
1780};
1781static const unsigned int mmc1_data1_mux[] = {
1782 MMC1_D0_MARK,
1783};
1784static const unsigned int mmc1_data4_pins[] = {
1785 /* D[0:3] */
1786 72, 73, 74, 75,
1787};
1788static const unsigned int mmc1_data4_mux[] = {
1789 MMC1_D0_MARK, MMC1_D1_MARK, MMC1_D2_MARK, MMC1_D3_MARK,
1790};
1791static const unsigned int mmc1_data8_pins[] = {
1792 /* D[0:7] */
1793 72, 73, 74, 75, 76, 77, 80, 81,
1794};
1795static const unsigned int mmc1_data8_mux[] = {
1796 MMC1_D0_MARK, MMC1_D1_MARK, MMC1_D2_MARK, MMC1_D3_MARK,
1797 MMC1_D4_MARK, MMC1_D5_MARK, MMC1_D6_MARK, MMC1_D7_MARK,
1798};
1799static const unsigned int mmc1_ctrl_pins[] = {
1800 /* CMD, CLK */
1801 68, 65,
1802};
1803static const unsigned int mmc1_ctrl_mux[] = {
1804 MMC1_CMD_MARK, MMC1_CLK_MARK,
1805};
1806/* - SCIF0 ------------------------------------------------------------------ */
1807static const unsigned int scif0_data_pins[] = {
1808 /* RXD, TXD */
1809 153, 152,
1810};
1811static const unsigned int scif0_data_mux[] = {
1812 RX0_MARK, TX0_MARK,
1813};
1814static const unsigned int scif0_clk_pins[] = {
1815 /* SCK */
1816 156,
1817};
1818static const unsigned int scif0_clk_mux[] = {
1819 SCK0_MARK,
1820};
1821static const unsigned int scif0_ctrl_pins[] = {
1822 /* RTS, CTS */
1823 151, 150,
1824};
1825static const unsigned int scif0_ctrl_mux[] = {
1826 RTS0_TANS_MARK, CTS0_MARK,
1827};
1828static const unsigned int scif0_data_b_pins[] = {
1829 /* RXD, TXD */
1830 20, 19,
1831};
1832static const unsigned int scif0_data_b_mux[] = {
1833 RX0_B_MARK, TX0_B_MARK,
1834};
1835static const unsigned int scif0_clk_b_pins[] = {
1836 /* SCK */
1837 33,
1838};
1839static const unsigned int scif0_clk_b_mux[] = {
1840 SCK0_B_MARK,
1841};
1842static const unsigned int scif0_ctrl_b_pins[] = {
1843 /* RTS, CTS */
1844 18, 11,
1845};
1846static const unsigned int scif0_ctrl_b_mux[] = {
1847 RTS0_B_TANS_B_MARK, CTS0_B_MARK,
1848};
1849static const unsigned int scif0_data_c_pins[] = {
1850 /* RXD, TXD */
1851 146, 147,
1852};
1853static const unsigned int scif0_data_c_mux[] = {
1854 RX0_C_MARK, TX0_C_MARK,
1855};
1856static const unsigned int scif0_clk_c_pins[] = {
1857 /* SCK */
1858 145,
1859};
1860static const unsigned int scif0_clk_c_mux[] = {
1861 SCK0_C_MARK,
1862};
1863static const unsigned int scif0_ctrl_c_pins[] = {
1864 /* RTS, CTS */
1865 149, 148,
1866};
1867static const unsigned int scif0_ctrl_c_mux[] = {
1868 RTS0_C_TANS_C_MARK, CTS0_C_MARK,
1869};
1870static const unsigned int scif0_data_d_pins[] = {
1871 /* RXD, TXD */
1872 43, 42,
1873};
1874static const unsigned int scif0_data_d_mux[] = {
1875 RX0_D_MARK, TX0_D_MARK,
1876};
1877static const unsigned int scif0_clk_d_pins[] = {
1878 /* SCK */
1879 50,
1880};
1881static const unsigned int scif0_clk_d_mux[] = {
1882 SCK0_D_MARK,
1883};
1884static const unsigned int scif0_ctrl_d_pins[] = {
1885 /* RTS, CTS */
1886 51, 35,
1887};
1888static const unsigned int scif0_ctrl_d_mux[] = {
1889 RTS0_D_TANS_D_MARK, CTS0_D_MARK,
1890};
1891/* - SCIF1 ------------------------------------------------------------------ */
1892static const unsigned int scif1_data_pins[] = {
1893 /* RXD, TXD */
1894 149, 148,
1895};
1896static const unsigned int scif1_data_mux[] = {
1897 RX1_MARK, TX1_MARK,
1898};
1899static const unsigned int scif1_clk_pins[] = {
1900 /* SCK */
1901 145,
1902};
1903static const unsigned int scif1_clk_mux[] = {
1904 SCK1_MARK,
1905};
1906static const unsigned int scif1_ctrl_pins[] = {
1907 /* RTS, CTS */
1908 147, 146,
1909};
1910static const unsigned int scif1_ctrl_mux[] = {
1911 RTS1_TANS_MARK, CTS1_MARK,
1912};
1913static const unsigned int scif1_data_b_pins[] = {
1914 /* RXD, TXD */
1915 117, 114,
1916};
1917static const unsigned int scif1_data_b_mux[] = {
1918 RX1_B_MARK, TX1_B_MARK,
1919};
1920static const unsigned int scif1_clk_b_pins[] = {
1921 /* SCK */
1922 113,
1923};
1924static const unsigned int scif1_clk_b_mux[] = {
1925 SCK1_B_MARK,
1926};
1927static const unsigned int scif1_ctrl_b_pins[] = {
1928 /* RTS, CTS */
1929 115, 116,
1930};
1931static const unsigned int scif1_ctrl_b_mux[] = {
1932 RTS1_B_TANS_B_MARK, CTS1_B_MARK,
1933};
1934static const unsigned int scif1_data_c_pins[] = {
1935 /* RXD, TXD */
1936 67, 66,
1937};
1938static const unsigned int scif1_data_c_mux[] = {
1939 RX1_C_MARK, TX1_C_MARK,
1940};
1941static const unsigned int scif1_clk_c_pins[] = {
1942 /* SCK */
1943 86,
1944};
1945static const unsigned int scif1_clk_c_mux[] = {
1946 SCK1_C_MARK,
1947};
1948static const unsigned int scif1_ctrl_c_pins[] = {
1949 /* RTS, CTS */
1950 69, 68,
1951};
1952static const unsigned int scif1_ctrl_c_mux[] = {
1953 RTS1_C_TANS_C_MARK, CTS1_C_MARK,
1954};
1955/* - SCIF2 ------------------------------------------------------------------ */
1956static const unsigned int scif2_data_pins[] = {
1957 /* RXD, TXD */
1958 106, 105,
1959};
1960static const unsigned int scif2_data_mux[] = {
1961 RX2_MARK, TX2_MARK,
1962};
1963static const unsigned int scif2_clk_pins[] = {
1964 /* SCK */
1965 107,
1966};
1967static const unsigned int scif2_clk_mux[] = {
1968 SCK2_MARK,
1969};
1970static const unsigned int scif2_data_b_pins[] = {
1971 /* RXD, TXD */
1972 120, 119,
1973};
1974static const unsigned int scif2_data_b_mux[] = {
1975 RX2_B_MARK, TX2_B_MARK,
1976};
1977static const unsigned int scif2_clk_b_pins[] = {
1978 /* SCK */
1979 118,
1980};
1981static const unsigned int scif2_clk_b_mux[] = {
1982 SCK2_B_MARK,
1983};
1984static const unsigned int scif2_data_c_pins[] = {
1985 /* RXD, TXD */
1986 33, 31,
1987};
1988static const unsigned int scif2_data_c_mux[] = {
1989 RX2_C_MARK, TX2_C_MARK,
1990};
1991static const unsigned int scif2_clk_c_pins[] = {
1992 /* SCK */
1993 32,
1994};
1995static const unsigned int scif2_clk_c_mux[] = {
1996 SCK2_C_MARK,
1997};
1998static const unsigned int scif2_data_d_pins[] = {
1999 /* RXD, TXD */
2000 64, 62,
2001};
2002static const unsigned int scif2_data_d_mux[] = {
2003 RX2_D_MARK, TX2_D_MARK,
2004};
2005static const unsigned int scif2_clk_d_pins[] = {
2006 /* SCK */
2007 63,
2008};
2009static const unsigned int scif2_clk_d_mux[] = {
2010 SCK2_D_MARK,
2011};
2012static const unsigned int scif2_data_e_pins[] = {
2013 /* RXD, TXD */
2014 20, 19,
2015};
2016static const unsigned int scif2_data_e_mux[] = {
2017 RX2_E_MARK, TX2_E_MARK,
2018};
2019/* - SCIF3 ------------------------------------------------------------------ */
2020static const unsigned int scif3_data_pins[] = {
2021 /* RXD, TXD */
2022 137, 136,
2023};
2024static const unsigned int scif3_data_mux[] = {
2025 RX3_IRDA_RX_MARK, TX3_IRDA_TX_MARK,
2026};
2027static const unsigned int scif3_clk_pins[] = {
2028 /* SCK */
2029 135,
2030};
2031static const unsigned int scif3_clk_mux[] = {
2032 SCK3_MARK,
2033};
2034
2035static const unsigned int scif3_data_b_pins[] = {
2036 /* RXD, TXD */
2037 64, 62,
2038};
2039static const unsigned int scif3_data_b_mux[] = {
2040 RX3_B_IRDA_RX_B_MARK, TX3_B_IRDA_TX_B_MARK,
2041};
2042static const unsigned int scif3_data_c_pins[] = {
2043 /* RXD, TXD */
2044 15, 12,
2045};
2046static const unsigned int scif3_data_c_mux[] = {
2047 RX3_C_IRDA_RX_C_MARK, TX3C_IRDA_TX_C_MARK,
2048};
2049static const unsigned int scif3_data_d_pins[] = {
2050 /* RXD, TXD */
2051 30, 29,
2052};
2053static const unsigned int scif3_data_d_mux[] = {
2054 RX3_D_IRDA_RX_D_MARK, TX3_D_IRDA_TX_D_MARK,
2055};
2056static const unsigned int scif3_data_e_pins[] = {
2057 /* RXD, TXD */
2058 35, 34,
2059};
2060static const unsigned int scif3_data_e_mux[] = {
2061 RX3_E_IRDA_RX_E_MARK, TX3_E_IRDA_TX_E_MARK,
2062};
2063static const unsigned int scif3_clk_e_pins[] = {
2064 /* SCK */
2065 42,
2066};
2067static const unsigned int scif3_clk_e_mux[] = {
2068 SCK3_E_MARK,
2069};
2070/* - SCIF4 ------------------------------------------------------------------ */
2071static const unsigned int scif4_data_pins[] = {
2072 /* RXD, TXD */
2073 123, 122,
2074};
2075static const unsigned int scif4_data_mux[] = {
2076 RX4_MARK, TX4_MARK,
2077};
2078static const unsigned int scif4_clk_pins[] = {
2079 /* SCK */
2080 121,
2081};
2082static const unsigned int scif4_clk_mux[] = {
2083 SCK4_MARK,
2084};
2085static const unsigned int scif4_data_b_pins[] = {
2086 /* RXD, TXD */
2087 111, 110,
2088};
2089static const unsigned int scif4_data_b_mux[] = {
2090 RX4_B_MARK, TX4_B_MARK,
2091};
2092static const unsigned int scif4_clk_b_pins[] = {
2093 /* SCK */
2094 112,
2095};
2096static const unsigned int scif4_clk_b_mux[] = {
2097 SCK4_B_MARK,
2098};
2099static const unsigned int scif4_data_c_pins[] = {
2100 /* RXD, TXD */
2101 22, 21,
2102};
2103static const unsigned int scif4_data_c_mux[] = {
2104 RX4_C_MARK, TX4_C_MARK,
2105};
2106static const unsigned int scif4_data_d_pins[] = {
2107 /* RXD, TXD */
2108 69, 68,
2109};
2110static const unsigned int scif4_data_d_mux[] = {
2111 RX4_D_MARK, TX4_D_MARK,
2112};
2113/* - SCIF5 ------------------------------------------------------------------ */
2114static const unsigned int scif5_data_pins[] = {
2115 /* RXD, TXD */
2116 51, 50,
2117};
2118static const unsigned int scif5_data_mux[] = {
2119 RX5_MARK, TX5_MARK,
2120};
2121static const unsigned int scif5_clk_pins[] = {
2122 /* SCK */
2123 43,
2124};
2125static const unsigned int scif5_clk_mux[] = {
2126 SCK5_MARK,
2127};
2128static const unsigned int scif5_data_b_pins[] = {
2129 /* RXD, TXD */
2130 18, 11,
2131};
2132static const unsigned int scif5_data_b_mux[] = {
2133 RX5_B_MARK, TX5_B_MARK,
2134};
2135static const unsigned int scif5_clk_b_pins[] = {
2136 /* SCK */
2137 19,
2138};
2139static const unsigned int scif5_clk_b_mux[] = {
2140 SCK5_B_MARK,
2141};
2142static const unsigned int scif5_data_c_pins[] = {
2143 /* RXD, TXD */
2144 24, 23,
2145};
2146static const unsigned int scif5_data_c_mux[] = {
2147 RX5_C_MARK, TX5_C_MARK,
2148};
2149static const unsigned int scif5_clk_c_pins[] = {
2150 /* SCK */
2151 28,
2152};
2153static const unsigned int scif5_clk_c_mux[] = {
2154 SCK5_C_MARK,
2155};
2156static const unsigned int scif5_data_d_pins[] = {
2157 /* RXD, TXD */
2158 8, 6,
2159};
2160static const unsigned int scif5_data_d_mux[] = {
2161 RX5_D_MARK, TX5_D_MARK,
2162};
2163static const unsigned int scif5_clk_d_pins[] = {
2164 /* SCK */
2165 7,
2166};
2167static const unsigned int scif5_clk_d_mux[] = {
2168 SCK5_D_MARK,
2169};
2170/* - SDHI0 ------------------------------------------------------------------ */
2171static const unsigned int sdhi0_data1_pins[] = {
2172 /* D0 */
2173 117,
2174};
2175static const unsigned int sdhi0_data1_mux[] = {
2176 SD0_DAT0_MARK,
2177};
2178static const unsigned int sdhi0_data4_pins[] = {
2179 /* D[0:3] */
2180 117, 118, 119, 120,
2181};
2182static const unsigned int sdhi0_data4_mux[] = {
2183 SD0_DAT0_MARK, SD0_DAT1_MARK, SD0_DAT2_MARK, SD0_DAT3_MARK,
2184};
2185static const unsigned int sdhi0_ctrl_pins[] = {
2186 /* CMD, CLK */
2187 114, 113,
2188};
2189static const unsigned int sdhi0_ctrl_mux[] = {
2190 SD0_CMD_MARK, SD0_CLK_MARK,
2191};
2192static const unsigned int sdhi0_cd_pins[] = {
2193 /* CD */
2194 115,
2195};
2196static const unsigned int sdhi0_cd_mux[] = {
2197 SD0_CD_MARK,
2198};
2199static const unsigned int sdhi0_wp_pins[] = {
2200 /* WP */
2201 116,
2202};
2203static const unsigned int sdhi0_wp_mux[] = {
2204 SD0_WP_MARK,
2205};
2206/* - SDHI1 ------------------------------------------------------------------ */
2207static const unsigned int sdhi1_data1_pins[] = {
2208 /* D0 */
2209 19,
2210};
2211static const unsigned int sdhi1_data1_mux[] = {
2212 SD1_DAT0_MARK,
2213};
2214static const unsigned int sdhi1_data4_pins[] = {
2215 /* D[0:3] */
2216 19, 20, 21, 2,
2217};
2218static const unsigned int sdhi1_data4_mux[] = {
2219 SD1_DAT0_MARK, SD1_DAT1_MARK, SD1_DAT2_MARK, SD1_DAT3_MARK,
2220};
2221static const unsigned int sdhi1_ctrl_pins[] = {
2222 /* CMD, CLK */
2223 18, 17,
2224};
2225static const unsigned int sdhi1_ctrl_mux[] = {
2226 SD1_CMD_MARK, SD1_CLK_MARK,
2227};
2228static const unsigned int sdhi1_cd_pins[] = {
2229 /* CD */
2230 10,
2231};
2232static const unsigned int sdhi1_cd_mux[] = {
2233 SD1_CD_MARK,
2234};
2235static const unsigned int sdhi1_wp_pins[] = {
2236 /* WP */
2237 11,
2238};
2239static const unsigned int sdhi1_wp_mux[] = {
2240 SD1_WP_MARK,
2241};
2242/* - SDHI2 ------------------------------------------------------------------ */
2243static const unsigned int sdhi2_data1_pins[] = {
2244 /* D0 */
2245 97,
2246};
2247static const unsigned int sdhi2_data1_mux[] = {
2248 SD2_DAT0_MARK,
2249};
2250static const unsigned int sdhi2_data4_pins[] = {
2251 /* D[0:3] */
2252 97, 98, 99, 100,
2253};
2254static const unsigned int sdhi2_data4_mux[] = {
2255 SD2_DAT0_MARK, SD2_DAT1_MARK, SD2_DAT2_MARK, SD2_DAT3_MARK,
2256};
2257static const unsigned int sdhi2_ctrl_pins[] = {
2258 /* CMD, CLK */
2259 102, 101,
2260};
2261static const unsigned int sdhi2_ctrl_mux[] = {
2262 SD2_CMD_MARK, SD2_CLK_MARK,
2263};
2264static const unsigned int sdhi2_cd_pins[] = {
2265 /* CD */
2266 103,
2267};
2268static const unsigned int sdhi2_cd_mux[] = {
2269 SD2_CD_MARK,
2270};
2271static const unsigned int sdhi2_wp_pins[] = {
2272 /* WP */
2273 104,
2274};
2275static const unsigned int sdhi2_wp_mux[] = {
2276 SD2_WP_MARK,
2277};
2278/* - SDHI3 ------------------------------------------------------------------ */
2279static const unsigned int sdhi3_data1_pins[] = {
2280 /* D0 */
2281 50,
2282};
2283static const unsigned int sdhi3_data1_mux[] = {
2284 SD3_DAT0_MARK,
2285};
2286static const unsigned int sdhi3_data4_pins[] = {
2287 /* D[0:3] */
2288 50, 51, 52, 53,
2289};
2290static const unsigned int sdhi3_data4_mux[] = {
2291 SD3_DAT0_MARK, SD3_DAT1_MARK, SD3_DAT2_MARK, SD3_DAT3_MARK,
2292};
2293static const unsigned int sdhi3_ctrl_pins[] = {
2294 /* CMD, CLK */
2295 35, 34,
2296};
2297static const unsigned int sdhi3_ctrl_mux[] = {
2298 SD3_CMD_MARK, SD3_CLK_MARK,
2299};
2300static const unsigned int sdhi3_cd_pins[] = {
2301 /* CD */
2302 62,
2303};
2304static const unsigned int sdhi3_cd_mux[] = {
2305 SD3_CD_MARK,
2306};
2307static const unsigned int sdhi3_wp_pins[] = {
2308 /* WP */
2309 64,
2310};
2311static const unsigned int sdhi3_wp_mux[] = {
2312 SD3_WP_MARK,
2313};
2314/* - USB0 ------------------------------------------------------------------- */
2315static const unsigned int usb0_pins[] = {
2316 /* OVC */
2317 150, 154,
2318};
2319static const unsigned int usb0_mux[] = {
2320 USB_OVC0_MARK, USB_PENC0_MARK,
2321};
2322/* - USB1 ------------------------------------------------------------------- */
2323static const unsigned int usb1_pins[] = {
2324 /* OVC */
2325 152, 155,
2326};
2327static const unsigned int usb1_mux[] = {
2328 USB_OVC1_MARK, USB_PENC1_MARK,
2329};
2330/* - USB2 ------------------------------------------------------------------- */
2331static const unsigned int usb2_pins[] = {
2332 /* OVC, PENC */
2333 125, 156,
2334};
2335static const unsigned int usb2_mux[] = {
2336 USB_OVC2_MARK, USB_PENC2_MARK,
2337};
2338
2339static const struct sh_pfc_pin_group pinmux_groups[] = {
2340 SH_PFC_PIN_GROUP(du0_rgb666),
2341 SH_PFC_PIN_GROUP(du0_rgb888),
2342 SH_PFC_PIN_GROUP(du0_clk_0),
2343 SH_PFC_PIN_GROUP(du0_clk_1),
2344 SH_PFC_PIN_GROUP(du0_sync_0),
2345 SH_PFC_PIN_GROUP(du0_sync_1),
2346 SH_PFC_PIN_GROUP(du0_oddf),
2347 SH_PFC_PIN_GROUP(du0_cde),
2348 SH_PFC_PIN_GROUP(du1_rgb666),
2349 SH_PFC_PIN_GROUP(du1_rgb888),
2350 SH_PFC_PIN_GROUP(du1_clk),
2351 SH_PFC_PIN_GROUP(du1_sync_0),
2352 SH_PFC_PIN_GROUP(du1_sync_1),
2353 SH_PFC_PIN_GROUP(du1_oddf),
2354 SH_PFC_PIN_GROUP(du1_cde),
2355 SH_PFC_PIN_GROUP(hspi0),
2356 SH_PFC_PIN_GROUP(hspi1),
2357 SH_PFC_PIN_GROUP(hspi1_b),
2358 SH_PFC_PIN_GROUP(hspi1_c),
2359 SH_PFC_PIN_GROUP(hspi1_d),
2360 SH_PFC_PIN_GROUP(hspi2),
2361 SH_PFC_PIN_GROUP(hspi2_b),
2362 SH_PFC_PIN_GROUP(intc_irq0),
2363 SH_PFC_PIN_GROUP(intc_irq0_b),
2364 SH_PFC_PIN_GROUP(intc_irq1),
2365 SH_PFC_PIN_GROUP(intc_irq1_b),
2366 SH_PFC_PIN_GROUP(intc_irq2),
2367 SH_PFC_PIN_GROUP(intc_irq2_b),
2368 SH_PFC_PIN_GROUP(intc_irq3),
2369 SH_PFC_PIN_GROUP(intc_irq3_b),
2370 SH_PFC_PIN_GROUP(lbsc_cs0),
2371 SH_PFC_PIN_GROUP(lbsc_cs1),
2372 SH_PFC_PIN_GROUP(lbsc_ex_cs0),
2373 SH_PFC_PIN_GROUP(lbsc_ex_cs1),
2374 SH_PFC_PIN_GROUP(lbsc_ex_cs2),
2375 SH_PFC_PIN_GROUP(lbsc_ex_cs3),
2376 SH_PFC_PIN_GROUP(lbsc_ex_cs4),
2377 SH_PFC_PIN_GROUP(lbsc_ex_cs5),
2378 SH_PFC_PIN_GROUP(mmc0_data1),
2379 SH_PFC_PIN_GROUP(mmc0_data4),
2380 SH_PFC_PIN_GROUP(mmc0_data8),
2381 SH_PFC_PIN_GROUP(mmc0_ctrl),
2382 SH_PFC_PIN_GROUP(mmc1_data1),
2383 SH_PFC_PIN_GROUP(mmc1_data4),
2384 SH_PFC_PIN_GROUP(mmc1_data8),
2385 SH_PFC_PIN_GROUP(mmc1_ctrl),
2386 SH_PFC_PIN_GROUP(scif0_data),
2387 SH_PFC_PIN_GROUP(scif0_clk),
2388 SH_PFC_PIN_GROUP(scif0_ctrl),
2389 SH_PFC_PIN_GROUP(scif0_data_b),
2390 SH_PFC_PIN_GROUP(scif0_clk_b),
2391 SH_PFC_PIN_GROUP(scif0_ctrl_b),
2392 SH_PFC_PIN_GROUP(scif0_data_c),
2393 SH_PFC_PIN_GROUP(scif0_clk_c),
2394 SH_PFC_PIN_GROUP(scif0_ctrl_c),
2395 SH_PFC_PIN_GROUP(scif0_data_d),
2396 SH_PFC_PIN_GROUP(scif0_clk_d),
2397 SH_PFC_PIN_GROUP(scif0_ctrl_d),
2398 SH_PFC_PIN_GROUP(scif1_data),
2399 SH_PFC_PIN_GROUP(scif1_clk),
2400 SH_PFC_PIN_GROUP(scif1_ctrl),
2401 SH_PFC_PIN_GROUP(scif1_data_b),
2402 SH_PFC_PIN_GROUP(scif1_clk_b),
2403 SH_PFC_PIN_GROUP(scif1_ctrl_b),
2404 SH_PFC_PIN_GROUP(scif1_data_c),
2405 SH_PFC_PIN_GROUP(scif1_clk_c),
2406 SH_PFC_PIN_GROUP(scif1_ctrl_c),
2407 SH_PFC_PIN_GROUP(scif2_data),
2408 SH_PFC_PIN_GROUP(scif2_clk),
2409 SH_PFC_PIN_GROUP(scif2_data_b),
2410 SH_PFC_PIN_GROUP(scif2_clk_b),
2411 SH_PFC_PIN_GROUP(scif2_data_c),
2412 SH_PFC_PIN_GROUP(scif2_clk_c),
2413 SH_PFC_PIN_GROUP(scif2_data_d),
2414 SH_PFC_PIN_GROUP(scif2_clk_d),
2415 SH_PFC_PIN_GROUP(scif2_data_e),
2416 SH_PFC_PIN_GROUP(scif3_data),
2417 SH_PFC_PIN_GROUP(scif3_clk),
2418 SH_PFC_PIN_GROUP(scif3_data_b),
2419 SH_PFC_PIN_GROUP(scif3_data_c),
2420 SH_PFC_PIN_GROUP(scif3_data_d),
2421 SH_PFC_PIN_GROUP(scif3_data_e),
2422 SH_PFC_PIN_GROUP(scif3_clk_e),
2423 SH_PFC_PIN_GROUP(scif4_data),
2424 SH_PFC_PIN_GROUP(scif4_clk),
2425 SH_PFC_PIN_GROUP(scif4_data_b),
2426 SH_PFC_PIN_GROUP(scif4_clk_b),
2427 SH_PFC_PIN_GROUP(scif4_data_c),
2428 SH_PFC_PIN_GROUP(scif4_data_d),
2429 SH_PFC_PIN_GROUP(scif5_data),
2430 SH_PFC_PIN_GROUP(scif5_clk),
2431 SH_PFC_PIN_GROUP(scif5_data_b),
2432 SH_PFC_PIN_GROUP(scif5_clk_b),
2433 SH_PFC_PIN_GROUP(scif5_data_c),
2434 SH_PFC_PIN_GROUP(scif5_clk_c),
2435 SH_PFC_PIN_GROUP(scif5_data_d),
2436 SH_PFC_PIN_GROUP(scif5_clk_d),
2437 SH_PFC_PIN_GROUP(sdhi0_data1),
2438 SH_PFC_PIN_GROUP(sdhi0_data4),
2439 SH_PFC_PIN_GROUP(sdhi0_ctrl),
2440 SH_PFC_PIN_GROUP(sdhi0_cd),
2441 SH_PFC_PIN_GROUP(sdhi0_wp),
2442 SH_PFC_PIN_GROUP(sdhi1_data1),
2443 SH_PFC_PIN_GROUP(sdhi1_data4),
2444 SH_PFC_PIN_GROUP(sdhi1_ctrl),
2445 SH_PFC_PIN_GROUP(sdhi1_cd),
2446 SH_PFC_PIN_GROUP(sdhi1_wp),
2447 SH_PFC_PIN_GROUP(sdhi2_data1),
2448 SH_PFC_PIN_GROUP(sdhi2_data4),
2449 SH_PFC_PIN_GROUP(sdhi2_ctrl),
2450 SH_PFC_PIN_GROUP(sdhi2_cd),
2451 SH_PFC_PIN_GROUP(sdhi2_wp),
2452 SH_PFC_PIN_GROUP(sdhi3_data1),
2453 SH_PFC_PIN_GROUP(sdhi3_data4),
2454 SH_PFC_PIN_GROUP(sdhi3_ctrl),
2455 SH_PFC_PIN_GROUP(sdhi3_cd),
2456 SH_PFC_PIN_GROUP(sdhi3_wp),
2457 SH_PFC_PIN_GROUP(usb0),
2458 SH_PFC_PIN_GROUP(usb1),
2459 SH_PFC_PIN_GROUP(usb2),
2460};
2461
2462static const char * const du0_groups[] = {
2463 "du0_rgb666",
2464 "du0_rgb888",
2465 "du0_clk_0",
2466 "du0_clk_1",
2467 "du0_sync_0",
2468 "du0_sync_1",
2469 "du0_oddf",
2470 "du0_cde",
2471};
2472
2473static const char * const du1_groups[] = {
2474 "du1_rgb666",
2475 "du1_rgb888",
2476 "du1_clk",
2477 "du1_sync_0",
2478 "du1_sync_1",
2479 "du1_oddf",
2480 "du1_cde",
2481};
2482
2483static const char * const hspi0_groups[] = {
2484 "hspi0",
2485};
2486
2487static const char * const hspi1_groups[] = {
2488 "hspi1",
2489 "hspi1_b",
2490 "hspi1_c",
2491 "hspi1_d",
2492};
2493
2494static const char * const hspi2_groups[] = {
2495 "hspi2",
2496 "hspi2_b",
2497};
2498
2499static const char * const intc_groups[] = {
2500 "intc_irq0",
2501 "intc_irq0_b",
2502 "intc_irq1",
2503 "intc_irq1_b",
2504 "intc_irq2",
2505 "intc_irq2_b",
2506 "intc_irq3",
2507 "intc_irq4_b",
2508};
2509
2510static const char * const lbsc_groups[] = {
2511 "lbsc_cs0",
2512 "lbsc_cs1",
2513 "lbsc_ex_cs0",
2514 "lbsc_ex_cs1",
2515 "lbsc_ex_cs2",
2516 "lbsc_ex_cs3",
2517 "lbsc_ex_cs4",
2518 "lbsc_ex_cs5",
2519};
2520
2521static const char * const mmc0_groups[] = {
2522 "mmc0_data1",
2523 "mmc0_data4",
2524 "mmc0_data8",
2525 "mmc0_ctrl",
2526};
2527
2528static const char * const mmc1_groups[] = {
2529 "mmc1_data1",
2530 "mmc1_data4",
2531 "mmc1_data8",
2532 "mmc1_ctrl",
2533};
2534
2535static const char * const scif0_groups[] = {
2536 "scif0_data",
2537 "scif0_clk",
2538 "scif0_ctrl",
2539 "scif0_data_b",
2540 "scif0_clk_b",
2541 "scif0_ctrl_b",
2542 "scif0_data_c",
2543 "scif0_clk_c",
2544 "scif0_ctrl_c",
2545 "scif0_data_d",
2546 "scif0_clk_d",
2547 "scif0_ctrl_d",
2548};
2549
2550static const char * const scif1_groups[] = {
2551 "scif1_data",
2552 "scif1_clk",
2553 "scif1_ctrl",
2554 "scif1_data_b",
2555 "scif1_clk_b",
2556 "scif1_ctrl_b",
2557 "scif1_data_c",
2558 "scif1_clk_c",
2559 "scif1_ctrl_c",
2560};
2561
2562static const char * const scif2_groups[] = {
2563 "scif2_data",
2564 "scif2_clk",
2565 "scif2_data_b",
2566 "scif2_clk_b",
2567 "scif2_data_c",
2568 "scif2_clk_c",
2569 "scif2_data_d",
2570 "scif2_clk_d",
2571 "scif2_data_e",
2572};
2573
2574static const char * const scif3_groups[] = {
2575 "scif3_data",
2576 "scif3_clk",
2577 "scif3_data_b",
2578 "scif3_data_c",
2579 "scif3_data_d",
2580 "scif3_data_e",
2581 "scif3_clk_e",
2582};
2583
2584static const char * const scif4_groups[] = {
2585 "scif4_data",
2586 "scif4_clk",
2587 "scif4_data_b",
2588 "scif4_clk_b",
2589 "scif4_data_c",
2590 "scif4_data_d",
2591};
2592
2593static const char * const scif5_groups[] = {
2594 "scif5_data",
2595 "scif5_clk",
2596 "scif5_data_b",
2597 "scif5_clk_b",
2598 "scif5_data_c",
2599 "scif5_clk_c",
2600 "scif5_data_d",
2601 "scif5_clk_d",
2602};
2603
2604static const char * const sdhi0_groups[] = {
2605 "sdhi0_data1",
2606 "sdhi0_data4",
2607 "sdhi0_ctrl",
2608 "sdhi0_cd",
2609 "sdhi0_wp",
2610};
2611
2612static const char * const sdhi1_groups[] = {
2613 "sdhi1_data1",
2614 "sdhi1_data4",
2615 "sdhi1_ctrl",
2616 "sdhi1_cd",
2617 "sdhi1_wp",
2618};
2619
2620static const char * const sdhi2_groups[] = {
2621 "sdhi2_data1",
2622 "sdhi2_data4",
2623 "sdhi2_ctrl",
2624 "sdhi2_cd",
2625 "sdhi2_wp",
2626};
2627
2628static const char * const sdhi3_groups[] = {
2629 "sdhi3_data1",
2630 "sdhi3_data4",
2631 "sdhi3_ctrl",
2632 "sdhi3_cd",
2633 "sdhi3_wp",
2634};
2635
2636static const char * const usb0_groups[] = {
2637 "usb0",
2638};
2639
2640static const char * const usb1_groups[] = {
2641 "usb1",
2642};
2643
2644static const char * const usb2_groups[] = {
2645 "usb2",
2646};
2647
2648static const struct sh_pfc_function pinmux_functions[] = {
2649 SH_PFC_FUNCTION(du0),
2650 SH_PFC_FUNCTION(du1),
2651 SH_PFC_FUNCTION(hspi0),
2652 SH_PFC_FUNCTION(hspi1),
2653 SH_PFC_FUNCTION(hspi2),
2654 SH_PFC_FUNCTION(intc),
2655 SH_PFC_FUNCTION(lbsc),
2656 SH_PFC_FUNCTION(mmc0),
2657 SH_PFC_FUNCTION(mmc1),
2658 SH_PFC_FUNCTION(sdhi0),
2659 SH_PFC_FUNCTION(sdhi1),
2660 SH_PFC_FUNCTION(sdhi2),
2661 SH_PFC_FUNCTION(sdhi3),
2662 SH_PFC_FUNCTION(scif0),
2663 SH_PFC_FUNCTION(scif1),
2664 SH_PFC_FUNCTION(scif2),
2665 SH_PFC_FUNCTION(scif3),
2666 SH_PFC_FUNCTION(scif4),
2667 SH_PFC_FUNCTION(scif5),
2668 SH_PFC_FUNCTION(usb0),
2669 SH_PFC_FUNCTION(usb1),
2670 SH_PFC_FUNCTION(usb2),
2671};
2672
2673#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
2674
2675static const struct pinmux_func pinmux_func_gpios[] = {
1455 GPIO_FN(AVS1), GPIO_FN(AVS2), GPIO_FN(A17), GPIO_FN(A18), 2676 GPIO_FN(AVS1), GPIO_FN(AVS2), GPIO_FN(A17), GPIO_FN(A18),
1456 GPIO_FN(A19), 2677 GPIO_FN(A19),
1457 2678
1458 /* IPSR0 */ 2679 /* IPSR0 */
1459 GPIO_FN(USB_PENC2), GPIO_FN(SCK0), GPIO_FN(PWM1), GPIO_FN(PWMFSW0), 2680 GPIO_FN(PWM1), GPIO_FN(PWMFSW0),
1460 GPIO_FN(SCIF_CLK), GPIO_FN(TCLK0_C), GPIO_FN(BS), GPIO_FN(SD1_DAT2), 2681 GPIO_FN(SCIF_CLK), GPIO_FN(TCLK0_C), GPIO_FN(BS),
1461 GPIO_FN(MMC0_D2), GPIO_FN(FD2), GPIO_FN(ATADIR0), GPIO_FN(SDSELF), 2682 GPIO_FN(FD2), GPIO_FN(ATADIR0), GPIO_FN(SDSELF),
1462 GPIO_FN(HCTS1), GPIO_FN(TX4_C), GPIO_FN(A0), GPIO_FN(SD1_DAT3), 2683 GPIO_FN(HCTS1), GPIO_FN(A0),
1463 GPIO_FN(MMC0_D3), GPIO_FN(FD3), GPIO_FN(A20), GPIO_FN(TX5_D), 2684 GPIO_FN(FD3), GPIO_FN(A20),
1464 GPIO_FN(HSPI_TX2_B), GPIO_FN(A21), GPIO_FN(SCK5_D), 2685 GPIO_FN(A21),
1465 GPIO_FN(HSPI_CLK2_B), GPIO_FN(A22), GPIO_FN(RX5_D), 2686 GPIO_FN(A22),
1466 GPIO_FN(HSPI_RX2_B), GPIO_FN(VI1_R0), GPIO_FN(A23), GPIO_FN(FCLE), 2687 GPIO_FN(VI1_R0), GPIO_FN(A23), GPIO_FN(FCLE),
1467 GPIO_FN(HSPI_CLK2), GPIO_FN(VI1_R1), GPIO_FN(A24), GPIO_FN(SD1_CD), 2688 GPIO_FN(VI1_R1), GPIO_FN(A24),
1468 GPIO_FN(MMC0_D4), GPIO_FN(FD4), GPIO_FN(HSPI_CS2), GPIO_FN(VI1_R2), 2689 GPIO_FN(FD4), GPIO_FN(VI1_R2),
1469 GPIO_FN(SSI_WS78_B), GPIO_FN(A25), GPIO_FN(SD1_WP), GPIO_FN(MMC0_D5), 2690 GPIO_FN(SSI_WS78_B), GPIO_FN(A25),
1470 GPIO_FN(FD5), GPIO_FN(HSPI_RX2), GPIO_FN(VI1_R3), GPIO_FN(TX5_B), 2691 GPIO_FN(FD5), GPIO_FN(VI1_R3),
1471 GPIO_FN(SSI_SDATA7_B), GPIO_FN(CTS0_B), GPIO_FN(CLKOUT), 2692 GPIO_FN(SSI_SDATA7_B), GPIO_FN(CLKOUT),
1472 GPIO_FN(TX3C_IRDA_TX_C), GPIO_FN(PWM0_B), GPIO_FN(CS0), 2693 GPIO_FN(PWM0_B),
1473 GPIO_FN(HSPI_CS2_B), GPIO_FN(CS1_A26), GPIO_FN(HSPI_TX2),
1474 GPIO_FN(SDSELF_B), GPIO_FN(RD_WR), GPIO_FN(FWE), GPIO_FN(ATAG0), 2694 GPIO_FN(SDSELF_B), GPIO_FN(RD_WR), GPIO_FN(FWE), GPIO_FN(ATAG0),
1475 GPIO_FN(VI1_R7), GPIO_FN(HRTS1), GPIO_FN(RX4_C), 2695 GPIO_FN(VI1_R7), GPIO_FN(HRTS1),
1476 2696
1477 /* IPSR1 */ 2697 /* IPSR1 */
1478 GPIO_FN(EX_CS0), GPIO_FN(RX3_C_IRDA_RX_C), GPIO_FN(MMC0_D6), 2698 GPIO_FN(FD6), GPIO_FN(FD7),
1479 GPIO_FN(FD6), GPIO_FN(EX_CS1), GPIO_FN(MMC0_D7), GPIO_FN(FD7), 2699 GPIO_FN(FALE),
1480 GPIO_FN(EX_CS2), GPIO_FN(SD1_CLK), GPIO_FN(MMC0_CLK), GPIO_FN(FALE), 2700 GPIO_FN(ATACS00),
1481 GPIO_FN(ATACS00), GPIO_FN(EX_CS3), GPIO_FN(SD1_CMD), GPIO_FN(MMC0_CMD), 2701 GPIO_FN(FRE), GPIO_FN(ATACS10), GPIO_FN(VI1_R4),
1482 GPIO_FN(FRE), GPIO_FN(ATACS10), GPIO_FN(VI1_R4), GPIO_FN(RX5_B), 2702 GPIO_FN(HSCK1), GPIO_FN(SSI_SDATA8_B),
1483 GPIO_FN(HSCK1), GPIO_FN(SSI_SDATA8_B), GPIO_FN(RTS0_B_TANS_B), 2703 GPIO_FN(SSI_SDATA9),
1484 GPIO_FN(SSI_SDATA9), GPIO_FN(EX_CS4), GPIO_FN(SD1_DAT0), 2704 GPIO_FN(FD0), GPIO_FN(ATARD0), GPIO_FN(VI1_R5),
1485 GPIO_FN(MMC0_D0), GPIO_FN(FD0), GPIO_FN(ATARD0), GPIO_FN(VI1_R5), 2705 GPIO_FN(HTX1),
1486 GPIO_FN(SCK5_B), GPIO_FN(HTX1), GPIO_FN(TX2_E), GPIO_FN(TX0_B), 2706 GPIO_FN(SSI_SCK9),
1487 GPIO_FN(SSI_SCK9), GPIO_FN(EX_CS5), GPIO_FN(SD1_DAT1), 2707 GPIO_FN(FD1), GPIO_FN(ATAWR0), GPIO_FN(VI1_R6),
1488 GPIO_FN(MMC0_D1), GPIO_FN(FD1), GPIO_FN(ATAWR0), GPIO_FN(VI1_R6), 2708 GPIO_FN(HRX1), GPIO_FN(SSI_WS9),
1489 GPIO_FN(HRX1), GPIO_FN(RX2_E), GPIO_FN(RX0_B), GPIO_FN(SSI_WS9), 2709 GPIO_FN(MLB_CLK), GPIO_FN(PWM2), GPIO_FN(MLB_SIG),
1490 GPIO_FN(MLB_CLK), GPIO_FN(PWM2), GPIO_FN(SCK4), GPIO_FN(MLB_SIG), 2710 GPIO_FN(PWM3), GPIO_FN(MLB_DAT), GPIO_FN(PWM4),
1491 GPIO_FN(PWM3), GPIO_FN(TX4), GPIO_FN(MLB_DAT), GPIO_FN(PWM4), 2711 GPIO_FN(HTX0), GPIO_FN(SDATA),
1492 GPIO_FN(RX4), GPIO_FN(HTX0), GPIO_FN(TX1), GPIO_FN(SDATA), 2712 GPIO_FN(SUB_TCK), GPIO_FN(CC5_STATE2),
1493 GPIO_FN(CTS0_C), GPIO_FN(SUB_TCK), GPIO_FN(CC5_STATE2),
1494 GPIO_FN(CC5_STATE10), GPIO_FN(CC5_STATE18), GPIO_FN(CC5_STATE26), 2713 GPIO_FN(CC5_STATE10), GPIO_FN(CC5_STATE18), GPIO_FN(CC5_STATE26),
1495 GPIO_FN(CC5_STATE34), 2714 GPIO_FN(CC5_STATE34),
1496 2715
1497 /* IPSR2 */ 2716 /* IPSR2 */
1498 GPIO_FN(HRX0), GPIO_FN(RX1), GPIO_FN(SCKZ), GPIO_FN(RTS0_C_TANS_C), 2717 GPIO_FN(HRX0), GPIO_FN(SCKZ),
1499 GPIO_FN(SUB_TDI), GPIO_FN(CC5_STATE3), GPIO_FN(CC5_STATE11), 2718 GPIO_FN(SUB_TDI), GPIO_FN(CC5_STATE3), GPIO_FN(CC5_STATE11),
1500 GPIO_FN(CC5_STATE19), GPIO_FN(CC5_STATE27), GPIO_FN(CC5_STATE35), 2719 GPIO_FN(CC5_STATE19), GPIO_FN(CC5_STATE27), GPIO_FN(CC5_STATE35),
1501 GPIO_FN(HSCK0), GPIO_FN(SCK1), GPIO_FN(MTS), GPIO_FN(PWM5), 2720 GPIO_FN(HSCK0), GPIO_FN(MTS), GPIO_FN(PWM5),
1502 GPIO_FN(SCK0_C), GPIO_FN(SSI_SDATA9_B), GPIO_FN(SUB_TDO), 2721 GPIO_FN(SSI_SDATA9_B), GPIO_FN(SUB_TDO),
1503 GPIO_FN(CC5_STATE0), GPIO_FN(CC5_STATE8), GPIO_FN(CC5_STATE16), 2722 GPIO_FN(CC5_STATE0), GPIO_FN(CC5_STATE8), GPIO_FN(CC5_STATE16),
1504 GPIO_FN(CC5_STATE24), GPIO_FN(CC5_STATE32), GPIO_FN(HCTS0), 2723 GPIO_FN(CC5_STATE24), GPIO_FN(CC5_STATE32), GPIO_FN(HCTS0),
1505 GPIO_FN(CTS1), GPIO_FN(STM), GPIO_FN(PWM0_D), GPIO_FN(RX0_C), 2724 GPIO_FN(STM), GPIO_FN(PWM0_D),
1506 GPIO_FN(SCIF_CLK_C), GPIO_FN(SUB_TRST), GPIO_FN(TCLK1_B), 2725 GPIO_FN(SCIF_CLK_C), GPIO_FN(SUB_TRST), GPIO_FN(TCLK1_B),
1507 GPIO_FN(CC5_OSCOUT), GPIO_FN(HRTS0), GPIO_FN(RTS1_TANS), 2726 GPIO_FN(CC5_OSCOUT), GPIO_FN(HRTS0),
1508 GPIO_FN(MDATA), GPIO_FN(TX0_C), GPIO_FN(SUB_TMS), GPIO_FN(CC5_STATE1), 2727 GPIO_FN(MDATA), GPIO_FN(SUB_TMS), GPIO_FN(CC5_STATE1),
1509 GPIO_FN(CC5_STATE9), GPIO_FN(CC5_STATE17), GPIO_FN(CC5_STATE25), 2728 GPIO_FN(CC5_STATE9), GPIO_FN(CC5_STATE17), GPIO_FN(CC5_STATE25),
1510 GPIO_FN(CC5_STATE33), GPIO_FN(DU0_DR0), GPIO_FN(LCDOUT0), 2729 GPIO_FN(CC5_STATE33), GPIO_FN(LCDOUT0),
1511 GPIO_FN(DREQ0), GPIO_FN(GPS_CLK_B), GPIO_FN(AUDATA0), 2730 GPIO_FN(DREQ0), GPIO_FN(GPS_CLK_B), GPIO_FN(AUDATA0),
1512 GPIO_FN(TX5_C), GPIO_FN(DU0_DR1), GPIO_FN(LCDOUT1), GPIO_FN(DACK0), 2731 GPIO_FN(LCDOUT1), GPIO_FN(DACK0),
1513 GPIO_FN(DRACK0), GPIO_FN(GPS_SIGN_B), GPIO_FN(AUDATA1), GPIO_FN(RX5_C), 2732 GPIO_FN(DRACK0), GPIO_FN(GPS_SIGN_B), GPIO_FN(AUDATA1),
1514 GPIO_FN(DU0_DR2), GPIO_FN(LCDOUT2), GPIO_FN(DU0_DR3), GPIO_FN(LCDOUT3), 2733 GPIO_FN(LCDOUT2), GPIO_FN(LCDOUT3),
1515 GPIO_FN(DU0_DR4), GPIO_FN(LCDOUT4), GPIO_FN(DU0_DR5), GPIO_FN(LCDOUT5), 2734 GPIO_FN(LCDOUT4), GPIO_FN(LCDOUT5),
1516 GPIO_FN(DU0_DR6), GPIO_FN(LCDOUT6), GPIO_FN(DU0_DR7), GPIO_FN(LCDOUT7), 2735 GPIO_FN(LCDOUT6), GPIO_FN(LCDOUT7),
1517 GPIO_FN(DU0_DG0), GPIO_FN(LCDOUT8), GPIO_FN(DREQ1), GPIO_FN(SCL2), 2736 GPIO_FN(LCDOUT8), GPIO_FN(DREQ1), GPIO_FN(SCL2),
1518 GPIO_FN(AUDATA2), 2737 GPIO_FN(AUDATA2),
1519 2738
1520 /* IPSR3 */ 2739 /* IPSR3 */
1521 GPIO_FN(DU0_DG1), GPIO_FN(LCDOUT9), GPIO_FN(DACK1), GPIO_FN(SDA2), 2740 GPIO_FN(LCDOUT9), GPIO_FN(DACK1), GPIO_FN(SDA2),
1522 GPIO_FN(AUDATA3), GPIO_FN(DU0_DG2), GPIO_FN(LCDOUT10), 2741 GPIO_FN(AUDATA3), GPIO_FN(LCDOUT10),
1523 GPIO_FN(DU0_DG3), GPIO_FN(LCDOUT11), GPIO_FN(DU0_DG4), 2742 GPIO_FN(LCDOUT11),
1524 GPIO_FN(LCDOUT12), GPIO_FN(DU0_DG5), GPIO_FN(LCDOUT13), 2743 GPIO_FN(LCDOUT12), GPIO_FN(LCDOUT13),
1525 GPIO_FN(DU0_DG6), GPIO_FN(LCDOUT14), GPIO_FN(DU0_DG7), 2744 GPIO_FN(LCDOUT14),
1526 GPIO_FN(LCDOUT15), GPIO_FN(DU0_DB0), GPIO_FN(LCDOUT16), 2745 GPIO_FN(LCDOUT15), GPIO_FN(LCDOUT16),
1527 GPIO_FN(EX_WAIT1), GPIO_FN(SCL1), GPIO_FN(TCLK1), GPIO_FN(AUDATA4), 2746 GPIO_FN(EX_WAIT1), GPIO_FN(SCL1), GPIO_FN(TCLK1), GPIO_FN(AUDATA4),
1528 GPIO_FN(DU0_DB1), GPIO_FN(LCDOUT17), GPIO_FN(EX_WAIT2), GPIO_FN(SDA1), 2747 GPIO_FN(LCDOUT17), GPIO_FN(EX_WAIT2), GPIO_FN(SDA1),
1529 GPIO_FN(GPS_MAG_B), GPIO_FN(AUDATA5), GPIO_FN(SCK5_C), 2748 GPIO_FN(GPS_MAG_B), GPIO_FN(AUDATA5),
1530 GPIO_FN(DU0_DB2), GPIO_FN(LCDOUT18), GPIO_FN(DU0_DB3), 2749 GPIO_FN(LCDOUT18),
1531 GPIO_FN(LCDOUT19), GPIO_FN(DU0_DB4), GPIO_FN(LCDOUT20), 2750 GPIO_FN(LCDOUT19), GPIO_FN(LCDOUT20),
1532 GPIO_FN(DU0_DB5), GPIO_FN(LCDOUT21), GPIO_FN(DU0_DB6), 2751 GPIO_FN(LCDOUT21),
1533 GPIO_FN(LCDOUT22), GPIO_FN(DU0_DB7), GPIO_FN(LCDOUT23), 2752 GPIO_FN(LCDOUT22), GPIO_FN(LCDOUT23),
1534 GPIO_FN(DU0_DOTCLKIN), GPIO_FN(QSTVA_QVS), GPIO_FN(TX3_D_IRDA_TX_D), 2753 GPIO_FN(QSTVA_QVS),
1535 GPIO_FN(SCL3_B), GPIO_FN(DU0_DOTCLKOUT0), GPIO_FN(QCLK), 2754 GPIO_FN(SCL3_B), GPIO_FN(QCLK),
1536 GPIO_FN(DU0_DOTCLKOUT1), GPIO_FN(QSTVB_QVE), GPIO_FN(RX3_D_IRDA_RX_D), 2755 GPIO_FN(QSTVB_QVE),
1537 GPIO_FN(SDA3_B), GPIO_FN(SDA2_C), GPIO_FN(DACK0_B), GPIO_FN(DRACK0_B), 2756 GPIO_FN(SDA3_B), GPIO_FN(SDA2_C), GPIO_FN(DACK0_B), GPIO_FN(DRACK0_B),
1538 GPIO_FN(DU0_EXHSYNC_DU0_HSYNC), GPIO_FN(QSTH_QHS), 2757 GPIO_FN(QSTH_QHS),
1539 GPIO_FN(DU0_EXVSYNC_DU0_VSYNC), GPIO_FN(QSTB_QHE), 2758 GPIO_FN(QSTB_QHE),
1540 GPIO_FN(DU0_EXODDF_DU0_ODDF_DISP_CDE), GPIO_FN(QCPV_QDE), 2759 GPIO_FN(QCPV_QDE),
1541 GPIO_FN(CAN1_TX), GPIO_FN(TX2_C), GPIO_FN(SCL2_C), GPIO_FN(REMOCON), 2760 GPIO_FN(CAN1_TX), GPIO_FN(SCL2_C), GPIO_FN(REMOCON),
1542 2761
1543 /* IPSR4 */ 2762 /* IPSR4 */
1544 GPIO_FN(DU0_DISP), GPIO_FN(QPOLA), GPIO_FN(CAN_CLK_C), GPIO_FN(SCK2_C), 2763 GPIO_FN(QPOLA), GPIO_FN(CAN_CLK_C),
1545 GPIO_FN(DU0_CDE), GPIO_FN(QPOLB), GPIO_FN(CAN1_RX), GPIO_FN(RX2_C), 2764 GPIO_FN(QPOLB), GPIO_FN(CAN1_RX),
1546 GPIO_FN(DREQ0_B), GPIO_FN(SSI_SCK78_B), GPIO_FN(SCK0_B), 2765 GPIO_FN(DREQ0_B), GPIO_FN(SSI_SCK78_B),
1547 GPIO_FN(DU1_DR0), GPIO_FN(VI2_DATA0_VI2_B0), GPIO_FN(PWM6), 2766 GPIO_FN(VI2_DATA0_VI2_B0), GPIO_FN(PWM6),
1548 GPIO_FN(SD3_CLK), GPIO_FN(TX3_E_IRDA_TX_E), GPIO_FN(AUDCK), 2767 GPIO_FN(AUDCK),
1549 GPIO_FN(PWMFSW0_B), GPIO_FN(DU1_DR1), GPIO_FN(VI2_DATA1_VI2_B1), 2768 GPIO_FN(PWMFSW0_B), GPIO_FN(VI2_DATA1_VI2_B1),
1550 GPIO_FN(PWM0), GPIO_FN(SD3_CMD), GPIO_FN(RX3_E_IRDA_RX_E), 2769 GPIO_FN(PWM0),
1551 GPIO_FN(AUDSYNC), GPIO_FN(CTS0_D), GPIO_FN(DU1_DR2), GPIO_FN(VI2_G0), 2770 GPIO_FN(AUDSYNC), GPIO_FN(VI2_G0),
1552 GPIO_FN(DU1_DR3), GPIO_FN(VI2_G1), GPIO_FN(DU1_DR4), GPIO_FN(VI2_G2), 2771 GPIO_FN(VI2_G1), GPIO_FN(VI2_G2),
1553 GPIO_FN(DU1_DR5), GPIO_FN(VI2_G3), GPIO_FN(DU1_DR6), GPIO_FN(VI2_G4), 2772 GPIO_FN(VI2_G3), GPIO_FN(VI2_G4),
1554 GPIO_FN(DU1_DR7), GPIO_FN(VI2_G5), GPIO_FN(DU1_DG0), 2773 GPIO_FN(VI2_G5),
1555 GPIO_FN(VI2_DATA2_VI2_B2), GPIO_FN(SCL1_B), GPIO_FN(SD3_DAT2), 2774 GPIO_FN(VI2_DATA2_VI2_B2), GPIO_FN(SCL1_B),
1556 GPIO_FN(SCK3_E), GPIO_FN(AUDATA6), GPIO_FN(TX0_D), GPIO_FN(DU1_DG1), 2775 GPIO_FN(AUDATA6),
1557 GPIO_FN(VI2_DATA3_VI2_B3), GPIO_FN(SDA1_B), GPIO_FN(SD3_DAT3), 2776 GPIO_FN(VI2_DATA3_VI2_B3), GPIO_FN(SDA1_B),
1558 GPIO_FN(SCK5), GPIO_FN(AUDATA7), GPIO_FN(RX0_D), GPIO_FN(DU1_DG2), 2777 GPIO_FN(AUDATA7),
1559 GPIO_FN(VI2_G6), GPIO_FN(DU1_DG3), GPIO_FN(VI2_G7), GPIO_FN(DU1_DG4), 2778 GPIO_FN(VI2_G6), GPIO_FN(VI2_G7),
1560 GPIO_FN(VI2_R0), GPIO_FN(DU1_DG5), GPIO_FN(VI2_R1), GPIO_FN(DU1_DG6), 2779 GPIO_FN(VI2_R0), GPIO_FN(VI2_R1),
1561 GPIO_FN(VI2_R2), GPIO_FN(DU1_DG7), GPIO_FN(VI2_R3), GPIO_FN(DU1_DB0), 2780 GPIO_FN(VI2_R2), GPIO_FN(VI2_R3),
1562 GPIO_FN(VI2_DATA4_VI2_B4), GPIO_FN(SCL2_B), GPIO_FN(SD3_DAT0), 2781 GPIO_FN(VI2_DATA4_VI2_B4), GPIO_FN(SCL2_B),
1563 GPIO_FN(TX5), GPIO_FN(SCK0_D),
1564 2782
1565 /* IPSR5 */ 2783 /* IPSR5 */
1566 GPIO_FN(DU1_DB1), GPIO_FN(VI2_DATA5_VI2_B5), GPIO_FN(SDA2_B), 2784 GPIO_FN(VI2_DATA5_VI2_B5), GPIO_FN(SDA2_B),
1567 GPIO_FN(SD3_DAT1), GPIO_FN(RX5), GPIO_FN(RTS0_D_TANS_D), 2785 GPIO_FN(VI2_R4), GPIO_FN(VI2_R5),
1568 GPIO_FN(DU1_DB2), GPIO_FN(VI2_R4), GPIO_FN(DU1_DB3), GPIO_FN(VI2_R5), 2786 GPIO_FN(VI2_R6), GPIO_FN(VI2_R7),
1569 GPIO_FN(DU1_DB4), GPIO_FN(VI2_R6), GPIO_FN(DU1_DB5), GPIO_FN(VI2_R7), 2787 GPIO_FN(SCL2_D), GPIO_FN(SDA2_D),
1570 GPIO_FN(DU1_DB6), GPIO_FN(SCL2_D), GPIO_FN(DU1_DB7), GPIO_FN(SDA2_D), 2788 GPIO_FN(VI2_CLKENB),
1571 GPIO_FN(DU1_DOTCLKIN), GPIO_FN(VI2_CLKENB), GPIO_FN(HSPI_CS1), 2789 GPIO_FN(SCL1_D), GPIO_FN(VI2_FIELD),
1572 GPIO_FN(SCL1_D), GPIO_FN(DU1_DOTCLKOUT), GPIO_FN(VI2_FIELD), 2790 GPIO_FN(SDA1_D), GPIO_FN(VI2_HSYNC),
1573 GPIO_FN(SDA1_D), GPIO_FN(DU1_EXHSYNC_DU1_HSYNC), GPIO_FN(VI2_HSYNC), 2791 GPIO_FN(VI3_HSYNC), GPIO_FN(VI2_VSYNC),
1574 GPIO_FN(VI3_HSYNC), GPIO_FN(DU1_EXVSYNC_DU1_VSYNC), GPIO_FN(VI2_VSYNC), 2792 GPIO_FN(VI3_VSYNC),
1575 GPIO_FN(VI3_VSYNC), GPIO_FN(DU1_EXODDF_DU1_ODDF_DISP_CDE), 2793 GPIO_FN(VI2_CLK),
1576 GPIO_FN(VI2_CLK), GPIO_FN(TX3_B_IRDA_TX_B), GPIO_FN(SD3_CD), 2794 GPIO_FN(VI1_CLKENB), GPIO_FN(VI3_CLKENB),
1577 GPIO_FN(HSPI_TX1), GPIO_FN(VI1_CLKENB), GPIO_FN(VI3_CLKENB), 2795 GPIO_FN(AUDIO_CLKC), GPIO_FN(SPEEDIN),
1578 GPIO_FN(AUDIO_CLKC), GPIO_FN(TX2_D), GPIO_FN(SPEEDIN), 2796 GPIO_FN(GPS_SIGN_D), GPIO_FN(VI2_DATA6_VI2_B6),
1579 GPIO_FN(GPS_SIGN_D), GPIO_FN(DU1_DISP), GPIO_FN(VI2_DATA6_VI2_B6), 2797 GPIO_FN(TCLK0), GPIO_FN(QSTVA_B_QVS_B),
1580 GPIO_FN(TCLK0), GPIO_FN(QSTVA_B_QVS_B), GPIO_FN(HSPI_CLK1), 2798 GPIO_FN(AUDIO_CLKOUT_B), GPIO_FN(GPS_MAG_D),
1581 GPIO_FN(SCK2_D), GPIO_FN(AUDIO_CLKOUT_B), GPIO_FN(GPS_MAG_D), 2799 GPIO_FN(VI2_DATA7_VI2_B7),
1582 GPIO_FN(DU1_CDE), GPIO_FN(VI2_DATA7_VI2_B7), GPIO_FN(RX3_B_IRDA_RX_B), 2800 GPIO_FN(VI1_FIELD),
1583 GPIO_FN(SD3_WP), GPIO_FN(HSPI_RX1), GPIO_FN(VI1_FIELD), 2801 GPIO_FN(VI3_FIELD), GPIO_FN(AUDIO_CLKOUT),
1584 GPIO_FN(VI3_FIELD), GPIO_FN(AUDIO_CLKOUT), GPIO_FN(RX2_D),
1585 GPIO_FN(GPS_CLK_C), GPIO_FN(GPS_CLK_D), GPIO_FN(AUDIO_CLKA), 2802 GPIO_FN(GPS_CLK_C), GPIO_FN(GPS_CLK_D), GPIO_FN(AUDIO_CLKA),
1586 GPIO_FN(CAN_TXCLK), GPIO_FN(AUDIO_CLKB), GPIO_FN(USB_OVC2), 2803 GPIO_FN(CAN_TXCLK), GPIO_FN(AUDIO_CLKB),
1587 GPIO_FN(CAN_DEBUGOUT0), GPIO_FN(MOUT0), 2804 GPIO_FN(CAN_DEBUGOUT0), GPIO_FN(MOUT0),
1588 2805
1589 /* IPSR6 */ 2806 /* IPSR6 */
@@ -1599,89 +2816,87 @@ static struct pinmux_gpio pinmux_gpios[] = {
1599 GPIO_FN(CAN_CLK_B), GPIO_FN(IECLK), GPIO_FN(SCIF_CLK_B), 2816 GPIO_FN(CAN_CLK_B), GPIO_FN(IECLK), GPIO_FN(SCIF_CLK_B),
1600 GPIO_FN(TCLK0_B), GPIO_FN(SSI_SDATA4), GPIO_FN(CAN_DEBUGOUT9), 2817 GPIO_FN(TCLK0_B), GPIO_FN(SSI_SDATA4), GPIO_FN(CAN_DEBUGOUT9),
1601 GPIO_FN(SSI_SDATA9_C), GPIO_FN(SSI_SCK5), GPIO_FN(ADICLK), 2818 GPIO_FN(SSI_SDATA9_C), GPIO_FN(SSI_SCK5), GPIO_FN(ADICLK),
1602 GPIO_FN(CAN_DEBUGOUT10), GPIO_FN(SCK3), GPIO_FN(TCLK0_D), 2819 GPIO_FN(CAN_DEBUGOUT10), GPIO_FN(TCLK0_D),
1603 GPIO_FN(SSI_WS5), GPIO_FN(ADICS_SAMP), GPIO_FN(CAN_DEBUGOUT11), 2820 GPIO_FN(SSI_WS5), GPIO_FN(ADICS_SAMP), GPIO_FN(CAN_DEBUGOUT11),
1604 GPIO_FN(TX3_IRDA_TX), GPIO_FN(SSI_SDATA5), GPIO_FN(ADIDATA), 2821 GPIO_FN(SSI_SDATA5), GPIO_FN(ADIDATA),
1605 GPIO_FN(CAN_DEBUGOUT12), GPIO_FN(RX3_IRDA_RX), GPIO_FN(SSI_SCK6), 2822 GPIO_FN(CAN_DEBUGOUT12), GPIO_FN(SSI_SCK6),
1606 GPIO_FN(ADICHS0), GPIO_FN(CAN0_TX), GPIO_FN(IERX_B), 2823 GPIO_FN(ADICHS0), GPIO_FN(CAN0_TX), GPIO_FN(IERX_B),
1607 2824
1608 /* IPSR7 */ 2825 /* IPSR7 */
1609 GPIO_FN(SSI_WS6), GPIO_FN(ADICHS1), GPIO_FN(CAN0_RX), GPIO_FN(IETX_B), 2826 GPIO_FN(SSI_WS6), GPIO_FN(ADICHS1), GPIO_FN(CAN0_RX), GPIO_FN(IETX_B),
1610 GPIO_FN(SSI_SDATA6), GPIO_FN(ADICHS2), GPIO_FN(CAN_CLK), 2827 GPIO_FN(SSI_SDATA6), GPIO_FN(ADICHS2), GPIO_FN(CAN_CLK),
1611 GPIO_FN(IECLK_B), GPIO_FN(SSI_SCK78), GPIO_FN(CAN_DEBUGOUT13), 2828 GPIO_FN(IECLK_B), GPIO_FN(SSI_SCK78), GPIO_FN(CAN_DEBUGOUT13),
1612 GPIO_FN(IRQ0_B), GPIO_FN(SSI_SCK9_B), GPIO_FN(HSPI_CLK1_C), 2829 GPIO_FN(SSI_SCK9_B),
1613 GPIO_FN(SSI_WS78), GPIO_FN(CAN_DEBUGOUT14), GPIO_FN(IRQ1_B), 2830 GPIO_FN(SSI_WS78), GPIO_FN(CAN_DEBUGOUT14),
1614 GPIO_FN(SSI_WS9_B), GPIO_FN(HSPI_CS1_C), GPIO_FN(SSI_SDATA7), 2831 GPIO_FN(SSI_WS9_B), GPIO_FN(SSI_SDATA7),
1615 GPIO_FN(CAN_DEBUGOUT15), GPIO_FN(IRQ2_B), GPIO_FN(TCLK1_C), 2832 GPIO_FN(CAN_DEBUGOUT15), GPIO_FN(TCLK1_C),
1616 GPIO_FN(HSPI_TX1_C), GPIO_FN(SSI_SDATA8), GPIO_FN(VSP), 2833 GPIO_FN(SSI_SDATA8), GPIO_FN(VSP),
1617 GPIO_FN(IRQ3_B), GPIO_FN(HSPI_RX1_C), GPIO_FN(SD0_CLK), 2834 GPIO_FN(ATACS01), GPIO_FN(ATACS11),
1618 GPIO_FN(ATACS01), GPIO_FN(SCK1_B), GPIO_FN(SD0_CMD), GPIO_FN(ATACS11), 2835 GPIO_FN(CC5_TDO), GPIO_FN(ATADIR1),
1619 GPIO_FN(TX1_B), GPIO_FN(CC5_TDO), GPIO_FN(SD0_DAT0), GPIO_FN(ATADIR1), 2836 GPIO_FN(CC5_TRST), GPIO_FN(ATAG1),
1620 GPIO_FN(RX1_B), GPIO_FN(CC5_TRST), GPIO_FN(SD0_DAT1), GPIO_FN(ATAG1), 2837 GPIO_FN(CC5_TMS), GPIO_FN(ATARD1),
1621 GPIO_FN(SCK2_B), GPIO_FN(CC5_TMS), GPIO_FN(SD0_DAT2), GPIO_FN(ATARD1), 2838 GPIO_FN(CC5_TCK), GPIO_FN(ATAWR1),
1622 GPIO_FN(TX2_B), GPIO_FN(CC5_TCK), GPIO_FN(SD0_DAT3), GPIO_FN(ATAWR1), 2839 GPIO_FN(CC5_TDI), GPIO_FN(DREQ2),
1623 GPIO_FN(RX2_B), GPIO_FN(CC5_TDI), GPIO_FN(SD0_CD), GPIO_FN(DREQ2), 2840 GPIO_FN(DACK2),
1624 GPIO_FN(RTS1_B_TANS_B), GPIO_FN(SD0_WP), GPIO_FN(DACK2),
1625 GPIO_FN(CTS1_B),
1626 2841
1627 /* IPSR8 */ 2842 /* IPSR8 */
1628 GPIO_FN(HSPI_CLK0), GPIO_FN(CTS0), GPIO_FN(USB_OVC0), GPIO_FN(AD_CLK), 2843 GPIO_FN(AD_CLK),
1629 GPIO_FN(CC5_STATE4), GPIO_FN(CC5_STATE12), GPIO_FN(CC5_STATE20), 2844 GPIO_FN(CC5_STATE4), GPIO_FN(CC5_STATE12), GPIO_FN(CC5_STATE20),
1630 GPIO_FN(CC5_STATE28), GPIO_FN(CC5_STATE36), GPIO_FN(HSPI_CS0), 2845 GPIO_FN(CC5_STATE28), GPIO_FN(CC5_STATE36),
1631 GPIO_FN(RTS0_TANS), GPIO_FN(USB_OVC1), GPIO_FN(AD_DI), 2846 GPIO_FN(AD_DI),
1632 GPIO_FN(CC5_STATE5), GPIO_FN(CC5_STATE13), GPIO_FN(CC5_STATE21), 2847 GPIO_FN(CC5_STATE5), GPIO_FN(CC5_STATE13), GPIO_FN(CC5_STATE21),
1633 GPIO_FN(CC5_STATE29), GPIO_FN(CC5_STATE37), GPIO_FN(HSPI_TX0), 2848 GPIO_FN(CC5_STATE29), GPIO_FN(CC5_STATE37),
1634 GPIO_FN(TX0), GPIO_FN(CAN_DEBUG_HW_TRIGGER), GPIO_FN(AD_DO), 2849 GPIO_FN(CAN_DEBUG_HW_TRIGGER), GPIO_FN(AD_DO),
1635 GPIO_FN(CC5_STATE6), GPIO_FN(CC5_STATE14), GPIO_FN(CC5_STATE22), 2850 GPIO_FN(CC5_STATE6), GPIO_FN(CC5_STATE14), GPIO_FN(CC5_STATE22),
1636 GPIO_FN(CC5_STATE30), GPIO_FN(CC5_STATE38), GPIO_FN(HSPI_RX0), 2851 GPIO_FN(CC5_STATE30), GPIO_FN(CC5_STATE38),
1637 GPIO_FN(RX0), GPIO_FN(CAN_STEP0), GPIO_FN(AD_NCS), GPIO_FN(CC5_STATE7), 2852 GPIO_FN(CAN_STEP0), GPIO_FN(AD_NCS), GPIO_FN(CC5_STATE7),
1638 GPIO_FN(CC5_STATE15), GPIO_FN(CC5_STATE23), GPIO_FN(CC5_STATE31), 2853 GPIO_FN(CC5_STATE15), GPIO_FN(CC5_STATE23), GPIO_FN(CC5_STATE31),
1639 GPIO_FN(CC5_STATE39), GPIO_FN(FMCLK), GPIO_FN(RDS_CLK), GPIO_FN(PCMOE), 2854 GPIO_FN(CC5_STATE39), GPIO_FN(FMCLK), GPIO_FN(RDS_CLK), GPIO_FN(PCMOE),
1640 GPIO_FN(BPFCLK), GPIO_FN(PCMWE), GPIO_FN(FMIN), GPIO_FN(RDS_DATA), 2855 GPIO_FN(BPFCLK), GPIO_FN(PCMWE), GPIO_FN(FMIN), GPIO_FN(RDS_DATA),
1641 GPIO_FN(VI0_CLK), GPIO_FN(MMC1_CLK), GPIO_FN(VI0_CLKENB), 2856 GPIO_FN(VI0_CLK), GPIO_FN(VI0_CLKENB),
1642 GPIO_FN(TX1_C), GPIO_FN(HTX1_B), GPIO_FN(MT1_SYNC), 2857 GPIO_FN(HTX1_B), GPIO_FN(MT1_SYNC),
1643 GPIO_FN(VI0_FIELD), GPIO_FN(RX1_C), GPIO_FN(HRX1_B), 2858 GPIO_FN(VI0_FIELD), GPIO_FN(HRX1_B),
1644 GPIO_FN(VI0_HSYNC), GPIO_FN(VI0_DATA0_B_VI0_B0_B), GPIO_FN(CTS1_C), 2859 GPIO_FN(VI0_HSYNC), GPIO_FN(VI0_DATA0_B_VI0_B0_B),
1645 GPIO_FN(TX4_D), GPIO_FN(MMC1_CMD), GPIO_FN(HSCK1_B), 2860 GPIO_FN(HSCK1_B),
1646 GPIO_FN(VI0_VSYNC), GPIO_FN(VI0_DATA1_B_VI0_B1_B), 2861 GPIO_FN(VI0_VSYNC), GPIO_FN(VI0_DATA1_B_VI0_B1_B),
1647 GPIO_FN(RTS1_C_TANS_C), GPIO_FN(RX4_D), GPIO_FN(PWMFSW0_C), 2862 GPIO_FN(PWMFSW0_C),
1648 2863
1649 /* IPSR9 */ 2864 /* IPSR9 */
1650 GPIO_FN(VI0_DATA0_VI0_B0), GPIO_FN(HRTS1_B), GPIO_FN(MT1_VCXO), 2865 GPIO_FN(VI0_DATA0_VI0_B0), GPIO_FN(HRTS1_B), GPIO_FN(MT1_VCXO),
1651 GPIO_FN(VI0_DATA1_VI0_B1), GPIO_FN(HCTS1_B), GPIO_FN(MT1_PWM), 2866 GPIO_FN(VI0_DATA1_VI0_B1), GPIO_FN(HCTS1_B), GPIO_FN(MT1_PWM),
1652 GPIO_FN(VI0_DATA2_VI0_B2), GPIO_FN(MMC1_D0), GPIO_FN(VI0_DATA3_VI0_B3), 2867 GPIO_FN(VI0_DATA2_VI0_B2), GPIO_FN(VI0_DATA3_VI0_B3),
1653 GPIO_FN(MMC1_D1), GPIO_FN(VI0_DATA4_VI0_B4), GPIO_FN(MMC1_D2), 2868 GPIO_FN(VI0_DATA4_VI0_B4),
1654 GPIO_FN(VI0_DATA5_VI0_B5), GPIO_FN(MMC1_D3), GPIO_FN(VI0_DATA6_VI0_B6), 2869 GPIO_FN(VI0_DATA5_VI0_B5), GPIO_FN(VI0_DATA6_VI0_B6),
1655 GPIO_FN(MMC1_D4), GPIO_FN(ARM_TRACEDATA_0), GPIO_FN(VI0_DATA7_VI0_B7), 2870 GPIO_FN(ARM_TRACEDATA_0), GPIO_FN(VI0_DATA7_VI0_B7),
1656 GPIO_FN(MMC1_D5), GPIO_FN(ARM_TRACEDATA_1), GPIO_FN(VI0_G0), 2871 GPIO_FN(ARM_TRACEDATA_1), GPIO_FN(VI0_G0),
1657 GPIO_FN(SSI_SCK78_C), GPIO_FN(IRQ0), GPIO_FN(ARM_TRACEDATA_2), 2872 GPIO_FN(SSI_SCK78_C), GPIO_FN(ARM_TRACEDATA_2),
1658 GPIO_FN(VI0_G1), GPIO_FN(SSI_WS78_C), GPIO_FN(IRQ1), 2873 GPIO_FN(VI0_G1), GPIO_FN(SSI_WS78_C),
1659 GPIO_FN(ARM_TRACEDATA_3), GPIO_FN(VI0_G2), GPIO_FN(ETH_TXD1), 2874 GPIO_FN(ARM_TRACEDATA_3), GPIO_FN(VI0_G2), GPIO_FN(ETH_TXD1),
1660 GPIO_FN(MMC1_D6), GPIO_FN(ARM_TRACEDATA_4), GPIO_FN(TS_SPSYNC0), 2875 GPIO_FN(ARM_TRACEDATA_4), GPIO_FN(TS_SPSYNC0),
1661 GPIO_FN(VI0_G3), GPIO_FN(ETH_CRS_DV), GPIO_FN(MMC1_D7), 2876 GPIO_FN(VI0_G3), GPIO_FN(ETH_CRS_DV),
1662 GPIO_FN(ARM_TRACEDATA_5), GPIO_FN(TS_SDAT0), GPIO_FN(VI0_G4), 2877 GPIO_FN(ARM_TRACEDATA_5), GPIO_FN(TS_SDAT0), GPIO_FN(VI0_G4),
1663 GPIO_FN(ETH_TX_EN), GPIO_FN(SD2_DAT0_B), GPIO_FN(ARM_TRACEDATA_6), 2878 GPIO_FN(ETH_TX_EN), GPIO_FN(ARM_TRACEDATA_6),
1664 GPIO_FN(VI0_G5), GPIO_FN(ETH_RX_ER), GPIO_FN(SD2_DAT1_B), 2879 GPIO_FN(VI0_G5), GPIO_FN(ETH_RX_ER),
1665 GPIO_FN(ARM_TRACEDATA_7), GPIO_FN(VI0_G6), GPIO_FN(ETH_RXD0), 2880 GPIO_FN(ARM_TRACEDATA_7), GPIO_FN(VI0_G6), GPIO_FN(ETH_RXD0),
1666 GPIO_FN(SD2_DAT2_B), GPIO_FN(ARM_TRACEDATA_8), GPIO_FN(VI0_G7), 2881 GPIO_FN(ARM_TRACEDATA_8), GPIO_FN(VI0_G7),
1667 GPIO_FN(ETH_RXD1), GPIO_FN(SD2_DAT3_B), GPIO_FN(ARM_TRACEDATA_9), 2882 GPIO_FN(ETH_RXD1), GPIO_FN(ARM_TRACEDATA_9),
1668 2883
1669 /* IPSR10 */ 2884 /* IPSR10 */
1670 GPIO_FN(VI0_R0), GPIO_FN(SSI_SDATA7_C), GPIO_FN(SCK1_C), 2885 GPIO_FN(VI0_R0), GPIO_FN(SSI_SDATA7_C),
1671 GPIO_FN(DREQ1_B), GPIO_FN(ARM_TRACEDATA_10), GPIO_FN(DREQ0_C), 2886 GPIO_FN(DREQ1_B), GPIO_FN(ARM_TRACEDATA_10), GPIO_FN(DREQ0_C),
1672 GPIO_FN(VI0_R1), GPIO_FN(SSI_SDATA8_C), GPIO_FN(DACK1_B), 2887 GPIO_FN(VI0_R1), GPIO_FN(SSI_SDATA8_C), GPIO_FN(DACK1_B),
1673 GPIO_FN(ARM_TRACEDATA_11), GPIO_FN(DACK0_C), GPIO_FN(DRACK0_C), 2888 GPIO_FN(ARM_TRACEDATA_11), GPIO_FN(DACK0_C), GPIO_FN(DRACK0_C),
1674 GPIO_FN(VI0_R2), GPIO_FN(ETH_LINK), GPIO_FN(SD2_CLK_B), GPIO_FN(IRQ2), 2889 GPIO_FN(VI0_R2), GPIO_FN(ETH_LINK),
1675 GPIO_FN(ARM_TRACEDATA_12), GPIO_FN(VI0_R3), GPIO_FN(ETH_MAGIC), 2890 GPIO_FN(ARM_TRACEDATA_12), GPIO_FN(VI0_R3), GPIO_FN(ETH_MAGIC),
1676 GPIO_FN(SD2_CMD_B), GPIO_FN(IRQ3), GPIO_FN(ARM_TRACEDATA_13), 2891 GPIO_FN(ARM_TRACEDATA_13),
1677 GPIO_FN(VI0_R4), GPIO_FN(ETH_REFCLK), GPIO_FN(SD2_CD_B), 2892 GPIO_FN(VI0_R4), GPIO_FN(ETH_REFCLK),
1678 GPIO_FN(HSPI_CLK1_B), GPIO_FN(ARM_TRACEDATA_14), GPIO_FN(MT1_CLK), 2893 GPIO_FN(ARM_TRACEDATA_14), GPIO_FN(MT1_CLK),
1679 GPIO_FN(TS_SCK0), GPIO_FN(VI0_R5), GPIO_FN(ETH_TXD0), 2894 GPIO_FN(TS_SCK0), GPIO_FN(VI0_R5), GPIO_FN(ETH_TXD0),
1680 GPIO_FN(SD2_WP_B), GPIO_FN(HSPI_CS1_B), GPIO_FN(ARM_TRACEDATA_15), 2895 GPIO_FN(ARM_TRACEDATA_15),
1681 GPIO_FN(MT1_D), GPIO_FN(TS_SDEN0), GPIO_FN(VI0_R6), GPIO_FN(ETH_MDC), 2896 GPIO_FN(MT1_D), GPIO_FN(TS_SDEN0), GPIO_FN(VI0_R6), GPIO_FN(ETH_MDC),
1682 GPIO_FN(DREQ2_C), GPIO_FN(HSPI_TX1_B), GPIO_FN(TRACECLK), 2897 GPIO_FN(DREQ2_C), GPIO_FN(TRACECLK),
1683 GPIO_FN(MT1_BEN), GPIO_FN(PWMFSW0_D), GPIO_FN(VI0_R7), 2898 GPIO_FN(MT1_BEN), GPIO_FN(PWMFSW0_D), GPIO_FN(VI0_R7),
1684 GPIO_FN(ETH_MDIO), GPIO_FN(DACK2_C), GPIO_FN(HSPI_RX1_B), 2899 GPIO_FN(ETH_MDIO), GPIO_FN(DACK2_C),
1685 GPIO_FN(SCIF_CLK_D), GPIO_FN(TRACECTL), GPIO_FN(MT1_PEN), 2900 GPIO_FN(SCIF_CLK_D), GPIO_FN(TRACECTL), GPIO_FN(MT1_PEN),
1686 GPIO_FN(VI1_CLK), GPIO_FN(SIM_D), GPIO_FN(SDA3), GPIO_FN(VI1_HSYNC), 2901 GPIO_FN(VI1_CLK), GPIO_FN(SIM_D), GPIO_FN(SDA3), GPIO_FN(VI1_HSYNC),
1687 GPIO_FN(VI3_CLK), GPIO_FN(SSI_SCK4), GPIO_FN(GPS_SIGN_C), 2902 GPIO_FN(VI3_CLK), GPIO_FN(SSI_SCK4), GPIO_FN(GPS_SIGN_C),
@@ -1690,40 +2905,40 @@ static struct pinmux_gpio pinmux_gpios[] = {
1690 GPIO_FN(SPV_TRST), GPIO_FN(SCL3), 2905 GPIO_FN(SPV_TRST), GPIO_FN(SCL3),
1691 2906
1692 /* IPSR11 */ 2907 /* IPSR11 */
1693 GPIO_FN(VI1_DATA0_VI1_B0), GPIO_FN(SD2_DAT0), GPIO_FN(SIM_RST), 2908 GPIO_FN(VI1_DATA0_VI1_B0), GPIO_FN(SIM_RST),
1694 GPIO_FN(SPV_TCK), GPIO_FN(ADICLK_B), GPIO_FN(VI1_DATA1_VI1_B1), 2909 GPIO_FN(SPV_TCK), GPIO_FN(ADICLK_B), GPIO_FN(VI1_DATA1_VI1_B1),
1695 GPIO_FN(SD2_DAT1), GPIO_FN(MT0_CLK), GPIO_FN(SPV_TMS), 2910 GPIO_FN(MT0_CLK), GPIO_FN(SPV_TMS),
1696 GPIO_FN(ADICS_B_SAMP_B), GPIO_FN(VI1_DATA2_VI1_B2), GPIO_FN(SD2_DAT2), 2911 GPIO_FN(ADICS_B_SAMP_B), GPIO_FN(VI1_DATA2_VI1_B2),
1697 GPIO_FN(MT0_D), GPIO_FN(SPVTDI), GPIO_FN(ADIDATA_B), 2912 GPIO_FN(MT0_D), GPIO_FN(SPVTDI), GPIO_FN(ADIDATA_B),
1698 GPIO_FN(VI1_DATA3_VI1_B3), GPIO_FN(SD2_DAT3), GPIO_FN(MT0_BEN), 2913 GPIO_FN(VI1_DATA3_VI1_B3), GPIO_FN(MT0_BEN),
1699 GPIO_FN(SPV_TDO), GPIO_FN(ADICHS0_B), GPIO_FN(VI1_DATA4_VI1_B4), 2914 GPIO_FN(SPV_TDO), GPIO_FN(ADICHS0_B), GPIO_FN(VI1_DATA4_VI1_B4),
1700 GPIO_FN(SD2_CLK), GPIO_FN(MT0_PEN), GPIO_FN(SPA_TRST), 2915 GPIO_FN(MT0_PEN), GPIO_FN(SPA_TRST),
1701 GPIO_FN(HSPI_CLK1_D), GPIO_FN(ADICHS1_B), GPIO_FN(VI1_DATA5_VI1_B5), 2916 GPIO_FN(ADICHS1_B), GPIO_FN(VI1_DATA5_VI1_B5),
1702 GPIO_FN(SD2_CMD), GPIO_FN(MT0_SYNC), GPIO_FN(SPA_TCK), 2917 GPIO_FN(MT0_SYNC), GPIO_FN(SPA_TCK),
1703 GPIO_FN(HSPI_CS1_D), GPIO_FN(ADICHS2_B), GPIO_FN(VI1_DATA6_VI1_B6), 2918 GPIO_FN(ADICHS2_B), GPIO_FN(VI1_DATA6_VI1_B6),
1704 GPIO_FN(SD2_CD), GPIO_FN(MT0_VCXO), GPIO_FN(SPA_TMS), 2919 GPIO_FN(MT0_VCXO), GPIO_FN(SPA_TMS),
1705 GPIO_FN(HSPI_TX1_D), GPIO_FN(VI1_DATA7_VI1_B7), GPIO_FN(SD2_WP), 2920 GPIO_FN(VI1_DATA7_VI1_B7),
1706 GPIO_FN(MT0_PWM), GPIO_FN(SPA_TDI), GPIO_FN(HSPI_RX1_D), 2921 GPIO_FN(MT0_PWM), GPIO_FN(SPA_TDI),
1707 GPIO_FN(VI1_G0), GPIO_FN(VI3_DATA0), GPIO_FN(DU1_DOTCLKOUT1), 2922 GPIO_FN(VI1_G0), GPIO_FN(VI3_DATA0),
1708 GPIO_FN(TS_SCK1), GPIO_FN(DREQ2_B), GPIO_FN(TX2), GPIO_FN(SPA_TDO), 2923 GPIO_FN(TS_SCK1), GPIO_FN(DREQ2_B), GPIO_FN(SPA_TDO),
1709 GPIO_FN(HCTS0_B), GPIO_FN(VI1_G1), GPIO_FN(VI3_DATA1), 2924 GPIO_FN(HCTS0_B), GPIO_FN(VI1_G1), GPIO_FN(VI3_DATA1),
1710 GPIO_FN(SSI_SCK1), GPIO_FN(TS_SDEN1), GPIO_FN(DACK2_B), GPIO_FN(RX2), 2925 GPIO_FN(SSI_SCK1), GPIO_FN(TS_SDEN1), GPIO_FN(DACK2_B),
1711 GPIO_FN(HRTS0_B), 2926 GPIO_FN(HRTS0_B),
1712 2927
1713 /* IPSR12 */ 2928 /* IPSR12 */
1714 GPIO_FN(VI1_G2), GPIO_FN(VI3_DATA2), GPIO_FN(SSI_WS1), 2929 GPIO_FN(VI1_G2), GPIO_FN(VI3_DATA2), GPIO_FN(SSI_WS1),
1715 GPIO_FN(TS_SPSYNC1), GPIO_FN(SCK2), GPIO_FN(HSCK0_B), GPIO_FN(VI1_G3), 2930 GPIO_FN(TS_SPSYNC1), GPIO_FN(HSCK0_B), GPIO_FN(VI1_G3),
1716 GPIO_FN(VI3_DATA3), GPIO_FN(SSI_SCK2), GPIO_FN(TS_SDAT1), 2931 GPIO_FN(VI3_DATA3), GPIO_FN(SSI_SCK2), GPIO_FN(TS_SDAT1),
1717 GPIO_FN(SCL1_C), GPIO_FN(HTX0_B), GPIO_FN(VI1_G4), GPIO_FN(VI3_DATA4), 2932 GPIO_FN(SCL1_C), GPIO_FN(HTX0_B), GPIO_FN(VI1_G4), GPIO_FN(VI3_DATA4),
1718 GPIO_FN(SSI_WS2), GPIO_FN(SDA1_C), GPIO_FN(SIM_RST_B), 2933 GPIO_FN(SSI_WS2), GPIO_FN(SDA1_C), GPIO_FN(SIM_RST_B),
1719 GPIO_FN(HRX0_B), GPIO_FN(VI1_G5), GPIO_FN(VI3_DATA5), 2934 GPIO_FN(HRX0_B), GPIO_FN(VI1_G5), GPIO_FN(VI3_DATA5),
1720 GPIO_FN(GPS_CLK), GPIO_FN(FSE), GPIO_FN(TX4_B), GPIO_FN(SIM_D_B), 2935 GPIO_FN(GPS_CLK), GPIO_FN(FSE), GPIO_FN(SIM_D_B),
1721 GPIO_FN(VI1_G6), GPIO_FN(VI3_DATA6), GPIO_FN(GPS_SIGN), GPIO_FN(FRB), 2936 GPIO_FN(VI1_G6), GPIO_FN(VI3_DATA6), GPIO_FN(GPS_SIGN), GPIO_FN(FRB),
1722 GPIO_FN(RX4_B), GPIO_FN(SIM_CLK_B), GPIO_FN(VI1_G7), 2937 GPIO_FN(SIM_CLK_B), GPIO_FN(VI1_G7),
1723 GPIO_FN(VI3_DATA7), GPIO_FN(GPS_MAG), GPIO_FN(FCE), GPIO_FN(SCK4_B), 2938 GPIO_FN(VI3_DATA7), GPIO_FN(GPS_MAG), GPIO_FN(FCE),
1724}; 2939};
1725 2940
1726static struct pinmux_cfg_reg pinmux_config_regs[] = { 2941static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1727 { PINMUX_CFG_REG("GPSR0", 0xfffc0004, 32, 1) { 2942 { PINMUX_CFG_REG("GPSR0", 0xfffc0004, 32, 1) {
1728 GP_0_31_FN, FN_IP3_31_29, 2943 GP_0_31_FN, FN_IP3_31_29,
1729 GP_0_30_FN, FN_IP3_26_24, 2944 GP_0_30_FN, FN_IP3_26_24,
@@ -2412,7 +3627,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2412 FN_VI1_G1, FN_VI3_DATA1, FN_SSI_SCK1, FN_TS_SDEN1, 3627 FN_VI1_G1, FN_VI3_DATA1, FN_SSI_SCK1, FN_TS_SDEN1,
2413 FN_DACK2_B, FN_RX2, FN_HRTS0_B, 0, 3628 FN_DACK2_B, FN_RX2, FN_HRTS0_B, 0,
2414 /* IP11_26_24 [3] */ 3629 /* IP11_26_24 [3] */
2415 FN_VI1_G0, FN_VI3_DATA0, FN_DU1_DOTCLKOUT1, FN_TS_SCK1, 3630 FN_VI1_G0, FN_VI3_DATA0, 0, FN_TS_SCK1,
2416 FN_DREQ2_B, FN_TX2, FN_SPA_TDO, FN_HCTS0_B, 3631 FN_DREQ2_B, FN_TX2, FN_SPA_TDO, FN_HCTS0_B,
2417 /* IP11_23_21 [3] */ 3632 /* IP11_23_21 [3] */
2418 FN_VI1_DATA7_VI1_B7, FN_SD2_WP, FN_MT0_PWM, FN_SPA_TDI, 3633 FN_VI1_DATA7_VI1_B7, FN_SD2_WP, FN_MT0_PWM, FN_SPA_TDI,
@@ -2584,7 +3799,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2584 { }, 3799 { },
2585}; 3800};
2586 3801
2587static struct pinmux_data_reg pinmux_data_regs[] = { 3802static const struct pinmux_data_reg pinmux_data_regs[] = {
2588 { PINMUX_DATA_REG("INDT0", 0xffc40008, 32) { GP_INDT(0) } }, 3803 { PINMUX_DATA_REG("INDT0", 0xffc40008, 32) { GP_INDT(0) } },
2589 { PINMUX_DATA_REG("INDT1", 0xffc41008, 32) { GP_INDT(1) } }, 3804 { PINMUX_DATA_REG("INDT1", 0xffc41008, 32) { GP_INDT(1) } },
2590 { PINMUX_DATA_REG("INDT2", 0xffc42008, 32) { GP_INDT(2) } }, 3805 { PINMUX_DATA_REG("INDT2", 0xffc42008, 32) { GP_INDT(2) } },
@@ -2600,22 +3815,25 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2600 { }, 3815 { },
2601}; 3816};
2602 3817
2603struct sh_pfc_soc_info r8a7779_pinmux_info = { 3818const struct sh_pfc_soc_info r8a7779_pinmux_info = {
2604 .name = "r8a7779_pfc", 3819 .name = "r8a7779_pfc",
2605 3820
2606 .unlock_reg = 0xfffc0000, /* PMMR */ 3821 .unlock_reg = 0xfffc0000, /* PMMR */
2607 3822
2608 .reserved_id = PINMUX_RESERVED,
2609 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
2610 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 3823 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2611 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 3824 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
2612 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2613 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 3825 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2614 3826
2615 .first_gpio = GPIO_GP_0_0, 3827 .pins = pinmux_pins,
2616 .last_gpio = GPIO_FN_SCK4_B, 3828 .nr_pins = ARRAY_SIZE(pinmux_pins),
3829 .groups = pinmux_groups,
3830 .nr_groups = ARRAY_SIZE(pinmux_groups),
3831 .functions = pinmux_functions,
3832 .nr_functions = ARRAY_SIZE(pinmux_functions),
3833
3834 .func_gpios = pinmux_func_gpios,
3835 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2617 3836
2618 .gpios = pinmux_gpios,
2619 .cfg_regs = pinmux_config_regs, 3837 .cfg_regs = pinmux_config_regs,
2620 .data_regs = pinmux_data_regs, 3838 .data_regs = pinmux_data_regs,
2621 3839
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7203.c b/drivers/pinctrl/sh-pfc/pfc-sh7203.c
index 01b425dfd162..f63d51dc3f4c 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7203.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7203.c
@@ -272,7 +272,7 @@ enum {
272 PINMUX_MARK_END, 272 PINMUX_MARK_END,
273}; 273};
274 274
275static pinmux_enum_t pinmux_data[] = { 275static const pinmux_enum_t pinmux_data[] = {
276 276
277 /* PA */ 277 /* PA */
278 PINMUX_DATA(PA7_DATA, PA7_IN), 278 PINMUX_DATA(PA7_DATA, PA7_IN),
@@ -703,7 +703,7 @@ static pinmux_enum_t pinmux_data[] = {
703 PINMUX_DATA(SSCK0_PF_MARK, PF0MD_11), 703 PINMUX_DATA(SSCK0_PF_MARK, PF0MD_11),
704}; 704};
705 705
706static struct pinmux_gpio pinmux_gpios[] = { 706static struct sh_pfc_pin pinmux_pins[] = {
707 707
708 /* PA */ 708 /* PA */
709 PINMUX_GPIO(GPIO_PA7, PA7_DATA), 709 PINMUX_GPIO(GPIO_PA7, PA7_DATA),
@@ -815,265 +815,269 @@ static struct pinmux_gpio pinmux_gpios[] = {
815 PINMUX_GPIO(GPIO_PF2, PF2_DATA), 815 PINMUX_GPIO(GPIO_PF2, PF2_DATA),
816 PINMUX_GPIO(GPIO_PF1, PF1_DATA), 816 PINMUX_GPIO(GPIO_PF1, PF1_DATA),
817 PINMUX_GPIO(GPIO_PF0, PF0_DATA), 817 PINMUX_GPIO(GPIO_PF0, PF0_DATA),
818};
819
820#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
818 821
822static const struct pinmux_func pinmux_func_gpios[] = {
819 /* INTC */ 823 /* INTC */
820 PINMUX_GPIO(GPIO_FN_PINT7_PB, PINT7_PB_MARK), 824 GPIO_FN(PINT7_PB),
821 PINMUX_GPIO(GPIO_FN_PINT6_PB, PINT6_PB_MARK), 825 GPIO_FN(PINT6_PB),
822 PINMUX_GPIO(GPIO_FN_PINT5_PB, PINT5_PB_MARK), 826 GPIO_FN(PINT5_PB),
823 PINMUX_GPIO(GPIO_FN_PINT4_PB, PINT4_PB_MARK), 827 GPIO_FN(PINT4_PB),
824 PINMUX_GPIO(GPIO_FN_PINT3_PB, PINT3_PB_MARK), 828 GPIO_FN(PINT3_PB),
825 PINMUX_GPIO(GPIO_FN_PINT2_PB, PINT2_PB_MARK), 829 GPIO_FN(PINT2_PB),
826 PINMUX_GPIO(GPIO_FN_PINT1_PB, PINT1_PB_MARK), 830 GPIO_FN(PINT1_PB),
827 PINMUX_GPIO(GPIO_FN_PINT0_PB, PINT0_PB_MARK), 831 GPIO_FN(PINT0_PB),
828 PINMUX_GPIO(GPIO_FN_PINT7_PD, PINT7_PD_MARK), 832 GPIO_FN(PINT7_PD),
829 PINMUX_GPIO(GPIO_FN_PINT6_PD, PINT6_PD_MARK), 833 GPIO_FN(PINT6_PD),
830 PINMUX_GPIO(GPIO_FN_PINT5_PD, PINT5_PD_MARK), 834 GPIO_FN(PINT5_PD),
831 PINMUX_GPIO(GPIO_FN_PINT4_PD, PINT4_PD_MARK), 835 GPIO_FN(PINT4_PD),
832 PINMUX_GPIO(GPIO_FN_PINT3_PD, PINT3_PD_MARK), 836 GPIO_FN(PINT3_PD),
833 PINMUX_GPIO(GPIO_FN_PINT2_PD, PINT2_PD_MARK), 837 GPIO_FN(PINT2_PD),
834 PINMUX_GPIO(GPIO_FN_PINT1_PD, PINT1_PD_MARK), 838 GPIO_FN(PINT1_PD),
835 PINMUX_GPIO(GPIO_FN_PINT0_PD, PINT0_PD_MARK), 839 GPIO_FN(PINT0_PD),
836 PINMUX_GPIO(GPIO_FN_IRQ7_PB, IRQ7_PB_MARK), 840 GPIO_FN(IRQ7_PB),
837 PINMUX_GPIO(GPIO_FN_IRQ6_PB, IRQ6_PB_MARK), 841 GPIO_FN(IRQ6_PB),
838 PINMUX_GPIO(GPIO_FN_IRQ5_PB, IRQ5_PB_MARK), 842 GPIO_FN(IRQ5_PB),
839 PINMUX_GPIO(GPIO_FN_IRQ4_PB, IRQ4_PB_MARK), 843 GPIO_FN(IRQ4_PB),
840 PINMUX_GPIO(GPIO_FN_IRQ3_PB, IRQ3_PB_MARK), 844 GPIO_FN(IRQ3_PB),
841 PINMUX_GPIO(GPIO_FN_IRQ2_PB, IRQ2_PB_MARK), 845 GPIO_FN(IRQ2_PB),
842 PINMUX_GPIO(GPIO_FN_IRQ1_PB, IRQ1_PB_MARK), 846 GPIO_FN(IRQ1_PB),
843 PINMUX_GPIO(GPIO_FN_IRQ0_PB, IRQ0_PB_MARK), 847 GPIO_FN(IRQ0_PB),
844 PINMUX_GPIO(GPIO_FN_IRQ7_PD, IRQ7_PD_MARK), 848 GPIO_FN(IRQ7_PD),
845 PINMUX_GPIO(GPIO_FN_IRQ6_PD, IRQ6_PD_MARK), 849 GPIO_FN(IRQ6_PD),
846 PINMUX_GPIO(GPIO_FN_IRQ5_PD, IRQ5_PD_MARK), 850 GPIO_FN(IRQ5_PD),
847 PINMUX_GPIO(GPIO_FN_IRQ4_PD, IRQ4_PD_MARK), 851 GPIO_FN(IRQ4_PD),
848 PINMUX_GPIO(GPIO_FN_IRQ3_PD, IRQ3_PD_MARK), 852 GPIO_FN(IRQ3_PD),
849 PINMUX_GPIO(GPIO_FN_IRQ2_PD, IRQ2_PD_MARK), 853 GPIO_FN(IRQ2_PD),
850 PINMUX_GPIO(GPIO_FN_IRQ1_PD, IRQ1_PD_MARK), 854 GPIO_FN(IRQ1_PD),
851 PINMUX_GPIO(GPIO_FN_IRQ0_PD, IRQ0_PD_MARK), 855 GPIO_FN(IRQ0_PD),
852 PINMUX_GPIO(GPIO_FN_IRQ7_PE, IRQ7_PE_MARK), 856 GPIO_FN(IRQ7_PE),
853 PINMUX_GPIO(GPIO_FN_IRQ6_PE, IRQ6_PE_MARK), 857 GPIO_FN(IRQ6_PE),
854 PINMUX_GPIO(GPIO_FN_IRQ5_PE, IRQ5_PE_MARK), 858 GPIO_FN(IRQ5_PE),
855 PINMUX_GPIO(GPIO_FN_IRQ4_PE, IRQ4_PE_MARK), 859 GPIO_FN(IRQ4_PE),
856 PINMUX_GPIO(GPIO_FN_IRQ3_PE, IRQ3_PE_MARK), 860 GPIO_FN(IRQ3_PE),
857 PINMUX_GPIO(GPIO_FN_IRQ2_PE, IRQ2_PE_MARK), 861 GPIO_FN(IRQ2_PE),
858 PINMUX_GPIO(GPIO_FN_IRQ1_PE, IRQ1_PE_MARK), 862 GPIO_FN(IRQ1_PE),
859 PINMUX_GPIO(GPIO_FN_IRQ0_PE, IRQ0_PE_MARK), 863 GPIO_FN(IRQ0_PE),
860 864
861 PINMUX_GPIO(GPIO_FN_WDTOVF, WDTOVF_MARK), 865 GPIO_FN(WDTOVF),
862 PINMUX_GPIO(GPIO_FN_IRQOUT, IRQOUT_MARK), 866 GPIO_FN(IRQOUT),
863 PINMUX_GPIO(GPIO_FN_REFOUT, REFOUT_MARK), 867 GPIO_FN(REFOUT),
864 PINMUX_GPIO(GPIO_FN_IRQOUT_REFOUT, IRQOUT_REFOUT_MARK), 868 GPIO_FN(IRQOUT_REFOUT),
865 PINMUX_GPIO(GPIO_FN_UBCTRG, UBCTRG_MARK), 869 GPIO_FN(UBCTRG),
866 870
867 /* CAN */ 871 /* CAN */
868 PINMUX_GPIO(GPIO_FN_CTX1, CTX1_MARK), 872 GPIO_FN(CTX1),
869 PINMUX_GPIO(GPIO_FN_CRX1, CRX1_MARK), 873 GPIO_FN(CRX1),
870 PINMUX_GPIO(GPIO_FN_CTX0, CTX0_MARK), 874 GPIO_FN(CTX0),
871 PINMUX_GPIO(GPIO_FN_CTX0_CTX1, CTX0_CTX1_MARK), 875 GPIO_FN(CTX0_CTX1),
872 PINMUX_GPIO(GPIO_FN_CRX0, CRX0_MARK), 876 GPIO_FN(CRX0),
873 PINMUX_GPIO(GPIO_FN_CRX0_CRX1, CRX0_CRX1_MARK), 877 GPIO_FN(CRX0_CRX1),
874 878
875 /* IIC3 */ 879 /* IIC3 */
876 PINMUX_GPIO(GPIO_FN_SDA3, SDA3_MARK), 880 GPIO_FN(SDA3),
877 PINMUX_GPIO(GPIO_FN_SCL3, SCL3_MARK), 881 GPIO_FN(SCL3),
878 PINMUX_GPIO(GPIO_FN_SDA2, SDA2_MARK), 882 GPIO_FN(SDA2),
879 PINMUX_GPIO(GPIO_FN_SCL2, SCL2_MARK), 883 GPIO_FN(SCL2),
880 PINMUX_GPIO(GPIO_FN_SDA1, SDA1_MARK), 884 GPIO_FN(SDA1),
881 PINMUX_GPIO(GPIO_FN_SCL1, SCL1_MARK), 885 GPIO_FN(SCL1),
882 PINMUX_GPIO(GPIO_FN_SDA0, SDA0_MARK), 886 GPIO_FN(SDA0),
883 PINMUX_GPIO(GPIO_FN_SCL0, SCL0_MARK), 887 GPIO_FN(SCL0),
884 888
885 /* DMAC */ 889 /* DMAC */
886 PINMUX_GPIO(GPIO_FN_TEND0_PD, TEND0_PD_MARK), 890 GPIO_FN(TEND0_PD),
887 PINMUX_GPIO(GPIO_FN_TEND0_PE, TEND0_PE_MARK), 891 GPIO_FN(TEND0_PE),
888 PINMUX_GPIO(GPIO_FN_DACK0_PD, DACK0_PD_MARK), 892 GPIO_FN(DACK0_PD),
889 PINMUX_GPIO(GPIO_FN_DACK0_PE, DACK0_PE_MARK), 893 GPIO_FN(DACK0_PE),
890 PINMUX_GPIO(GPIO_FN_DREQ0_PD, DREQ0_PD_MARK), 894 GPIO_FN(DREQ0_PD),
891 PINMUX_GPIO(GPIO_FN_DREQ0_PE, DREQ0_PE_MARK), 895 GPIO_FN(DREQ0_PE),
892 PINMUX_GPIO(GPIO_FN_TEND1_PD, TEND1_PD_MARK), 896 GPIO_FN(TEND1_PD),
893 PINMUX_GPIO(GPIO_FN_TEND1_PE, TEND1_PE_MARK), 897 GPIO_FN(TEND1_PE),
894 PINMUX_GPIO(GPIO_FN_DACK1_PD, DACK1_PD_MARK), 898 GPIO_FN(DACK1_PD),
895 PINMUX_GPIO(GPIO_FN_DACK1_PE, DACK1_PE_MARK), 899 GPIO_FN(DACK1_PE),
896 PINMUX_GPIO(GPIO_FN_DREQ1_PD, DREQ1_PD_MARK), 900 GPIO_FN(DREQ1_PD),
897 PINMUX_GPIO(GPIO_FN_DREQ1_PE, DREQ1_PE_MARK), 901 GPIO_FN(DREQ1_PE),
898 PINMUX_GPIO(GPIO_FN_DACK2, DACK2_MARK), 902 GPIO_FN(DACK2),
899 PINMUX_GPIO(GPIO_FN_DREQ2, DREQ2_MARK), 903 GPIO_FN(DREQ2),
900 PINMUX_GPIO(GPIO_FN_DACK3, DACK3_MARK), 904 GPIO_FN(DACK3),
901 PINMUX_GPIO(GPIO_FN_DREQ3, DREQ3_MARK), 905 GPIO_FN(DREQ3),
902 906
903 /* ADC */ 907 /* ADC */
904 PINMUX_GPIO(GPIO_FN_ADTRG_PD, ADTRG_PD_MARK), 908 GPIO_FN(ADTRG_PD),
905 PINMUX_GPIO(GPIO_FN_ADTRG_PE, ADTRG_PE_MARK), 909 GPIO_FN(ADTRG_PE),
906 910
907 /* BSC */ 911 /* BSC */
908 PINMUX_GPIO(GPIO_FN_D31, D31_MARK), 912 GPIO_FN(D31),
909 PINMUX_GPIO(GPIO_FN_D30, D30_MARK), 913 GPIO_FN(D30),
910 PINMUX_GPIO(GPIO_FN_D29, D29_MARK), 914 GPIO_FN(D29),
911 PINMUX_GPIO(GPIO_FN_D28, D28_MARK), 915 GPIO_FN(D28),
912 PINMUX_GPIO(GPIO_FN_D27, D27_MARK), 916 GPIO_FN(D27),
913 PINMUX_GPIO(GPIO_FN_D26, D26_MARK), 917 GPIO_FN(D26),
914 PINMUX_GPIO(GPIO_FN_D25, D25_MARK), 918 GPIO_FN(D25),
915 PINMUX_GPIO(GPIO_FN_D24, D24_MARK), 919 GPIO_FN(D24),
916 PINMUX_GPIO(GPIO_FN_D23, D23_MARK), 920 GPIO_FN(D23),
917 PINMUX_GPIO(GPIO_FN_D22, D22_MARK), 921 GPIO_FN(D22),
918 PINMUX_GPIO(GPIO_FN_D21, D21_MARK), 922 GPIO_FN(D21),
919 PINMUX_GPIO(GPIO_FN_D20, D20_MARK), 923 GPIO_FN(D20),
920 PINMUX_GPIO(GPIO_FN_D19, D19_MARK), 924 GPIO_FN(D19),
921 PINMUX_GPIO(GPIO_FN_D18, D18_MARK), 925 GPIO_FN(D18),
922 PINMUX_GPIO(GPIO_FN_D17, D17_MARK), 926 GPIO_FN(D17),
923 PINMUX_GPIO(GPIO_FN_D16, D16_MARK), 927 GPIO_FN(D16),
924 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 928 GPIO_FN(A25),
925 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 929 GPIO_FN(A24),
926 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 930 GPIO_FN(A23),
927 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 931 GPIO_FN(A22),
928 PINMUX_GPIO(GPIO_FN_A21, A21_MARK), 932 GPIO_FN(A21),
929 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK), 933 GPIO_FN(CS4),
930 PINMUX_GPIO(GPIO_FN_MRES, MRES_MARK), 934 GPIO_FN(MRES),
931 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 935 GPIO_FN(BS),
932 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 936 GPIO_FN(IOIS16),
933 PINMUX_GPIO(GPIO_FN_CS1, CS1_MARK), 937 GPIO_FN(CS1),
934 PINMUX_GPIO(GPIO_FN_CS6_CE1B, CS6_CE1B_MARK), 938 GPIO_FN(CS6_CE1B),
935 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK), 939 GPIO_FN(CE2B),
936 PINMUX_GPIO(GPIO_FN_CS5_CE1A, CS5_CE1A_MARK), 940 GPIO_FN(CS5_CE1A),
937 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK), 941 GPIO_FN(CE2A),
938 PINMUX_GPIO(GPIO_FN_FRAME, FRAME_MARK), 942 GPIO_FN(FRAME),
939 PINMUX_GPIO(GPIO_FN_WAIT, WAIT_MARK), 943 GPIO_FN(WAIT),
940 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK), 944 GPIO_FN(RDWR),
941 PINMUX_GPIO(GPIO_FN_CKE, CKE_MARK), 945 GPIO_FN(CKE),
942 PINMUX_GPIO(GPIO_FN_CASU, CASU_MARK), 946 GPIO_FN(CASU),
943 PINMUX_GPIO(GPIO_FN_BREQ, BREQ_MARK), 947 GPIO_FN(BREQ),
944 PINMUX_GPIO(GPIO_FN_RASU, RASU_MARK), 948 GPIO_FN(RASU),
945 PINMUX_GPIO(GPIO_FN_BACK, BACK_MARK), 949 GPIO_FN(BACK),
946 PINMUX_GPIO(GPIO_FN_CASL, CASL_MARK), 950 GPIO_FN(CASL),
947 PINMUX_GPIO(GPIO_FN_RASL, RASL_MARK), 951 GPIO_FN(RASL),
948 PINMUX_GPIO(GPIO_FN_WE3_DQMUU_AH_ICIO_WR, WE3_DQMUU_AH_ICIO_WR_MARK), 952 GPIO_FN(WE3_DQMUU_AH_ICIO_WR),
949 PINMUX_GPIO(GPIO_FN_WE2_DQMUL_ICIORD, WE2_DQMUL_ICIORD_MARK), 953 GPIO_FN(WE2_DQMUL_ICIORD),
950 PINMUX_GPIO(GPIO_FN_WE1_DQMLU_WE, WE1_DQMLU_WE_MARK), 954 GPIO_FN(WE1_DQMLU_WE),
951 PINMUX_GPIO(GPIO_FN_WE0_DQMLL, WE0_DQMLL_MARK), 955 GPIO_FN(WE0_DQMLL),
952 PINMUX_GPIO(GPIO_FN_CS3, CS3_MARK), 956 GPIO_FN(CS3),
953 PINMUX_GPIO(GPIO_FN_CS2, CS2_MARK), 957 GPIO_FN(CS2),
954 PINMUX_GPIO(GPIO_FN_A1, A1_MARK), 958 GPIO_FN(A1),
955 PINMUX_GPIO(GPIO_FN_A0, A0_MARK), 959 GPIO_FN(A0),
956 PINMUX_GPIO(GPIO_FN_CS7, CS7_MARK), 960 GPIO_FN(CS7),
957 961
958 /* TMU */ 962 /* TMU */
959 PINMUX_GPIO(GPIO_FN_TIOC4D, TIOC4D_MARK), 963 GPIO_FN(TIOC4D),
960 PINMUX_GPIO(GPIO_FN_TIOC4C, TIOC4C_MARK), 964 GPIO_FN(TIOC4C),
961 PINMUX_GPIO(GPIO_FN_TIOC4B, TIOC4B_MARK), 965 GPIO_FN(TIOC4B),
962 PINMUX_GPIO(GPIO_FN_TIOC4A, TIOC4A_MARK), 966 GPIO_FN(TIOC4A),
963 PINMUX_GPIO(GPIO_FN_TIOC3D, TIOC3D_MARK), 967 GPIO_FN(TIOC3D),
964 PINMUX_GPIO(GPIO_FN_TIOC3C, TIOC3C_MARK), 968 GPIO_FN(TIOC3C),
965 PINMUX_GPIO(GPIO_FN_TIOC3B, TIOC3B_MARK), 969 GPIO_FN(TIOC3B),
966 PINMUX_GPIO(GPIO_FN_TIOC3A, TIOC3A_MARK), 970 GPIO_FN(TIOC3A),
967 PINMUX_GPIO(GPIO_FN_TIOC2B, TIOC2B_MARK), 971 GPIO_FN(TIOC2B),
968 PINMUX_GPIO(GPIO_FN_TIOC1B, TIOC1B_MARK), 972 GPIO_FN(TIOC1B),
969 PINMUX_GPIO(GPIO_FN_TIOC2A, TIOC2A_MARK), 973 GPIO_FN(TIOC2A),
970 PINMUX_GPIO(GPIO_FN_TIOC1A, TIOC1A_MARK), 974 GPIO_FN(TIOC1A),
971 PINMUX_GPIO(GPIO_FN_TIOC0D, TIOC0D_MARK), 975 GPIO_FN(TIOC0D),
972 PINMUX_GPIO(GPIO_FN_TIOC0C, TIOC0C_MARK), 976 GPIO_FN(TIOC0C),
973 PINMUX_GPIO(GPIO_FN_TIOC0B, TIOC0B_MARK), 977 GPIO_FN(TIOC0B),
974 PINMUX_GPIO(GPIO_FN_TIOC0A, TIOC0A_MARK), 978 GPIO_FN(TIOC0A),
975 PINMUX_GPIO(GPIO_FN_TCLKD_PD, TCLKD_PD_MARK), 979 GPIO_FN(TCLKD_PD),
976 PINMUX_GPIO(GPIO_FN_TCLKC_PD, TCLKC_PD_MARK), 980 GPIO_FN(TCLKC_PD),
977 PINMUX_GPIO(GPIO_FN_TCLKB_PD, TCLKB_PD_MARK), 981 GPIO_FN(TCLKB_PD),
978 PINMUX_GPIO(GPIO_FN_TCLKA_PD, TCLKA_PD_MARK), 982 GPIO_FN(TCLKA_PD),
979 PINMUX_GPIO(GPIO_FN_TCLKD_PF, TCLKD_PF_MARK), 983 GPIO_FN(TCLKD_PF),
980 PINMUX_GPIO(GPIO_FN_TCLKC_PF, TCLKC_PF_MARK), 984 GPIO_FN(TCLKC_PF),
981 PINMUX_GPIO(GPIO_FN_TCLKB_PF, TCLKB_PF_MARK), 985 GPIO_FN(TCLKB_PF),
982 PINMUX_GPIO(GPIO_FN_TCLKA_PF, TCLKA_PF_MARK), 986 GPIO_FN(TCLKA_PF),
983 987
984 /* SSU */ 988 /* SSU */
985 PINMUX_GPIO(GPIO_FN_SCS0_PD, SCS0_PD_MARK), 989 GPIO_FN(SCS0_PD),
986 PINMUX_GPIO(GPIO_FN_SSO0_PD, SSO0_PD_MARK), 990 GPIO_FN(SSO0_PD),
987 PINMUX_GPIO(GPIO_FN_SSI0_PD, SSI0_PD_MARK), 991 GPIO_FN(SSI0_PD),
988 PINMUX_GPIO(GPIO_FN_SSCK0_PD, SSCK0_PD_MARK), 992 GPIO_FN(SSCK0_PD),
989 PINMUX_GPIO(GPIO_FN_SCS0_PF, SCS0_PF_MARK), 993 GPIO_FN(SCS0_PF),
990 PINMUX_GPIO(GPIO_FN_SSO0_PF, SSO0_PF_MARK), 994 GPIO_FN(SSO0_PF),
991 PINMUX_GPIO(GPIO_FN_SSI0_PF, SSI0_PF_MARK), 995 GPIO_FN(SSI0_PF),
992 PINMUX_GPIO(GPIO_FN_SSCK0_PF, SSCK0_PF_MARK), 996 GPIO_FN(SSCK0_PF),
993 PINMUX_GPIO(GPIO_FN_SCS1_PD, SCS1_PD_MARK), 997 GPIO_FN(SCS1_PD),
994 PINMUX_GPIO(GPIO_FN_SSO1_PD, SSO1_PD_MARK), 998 GPIO_FN(SSO1_PD),
995 PINMUX_GPIO(GPIO_FN_SSI1_PD, SSI1_PD_MARK), 999 GPIO_FN(SSI1_PD),
996 PINMUX_GPIO(GPIO_FN_SSCK1_PD, SSCK1_PD_MARK), 1000 GPIO_FN(SSCK1_PD),
997 PINMUX_GPIO(GPIO_FN_SCS1_PF, SCS1_PF_MARK), 1001 GPIO_FN(SCS1_PF),
998 PINMUX_GPIO(GPIO_FN_SSO1_PF, SSO1_PF_MARK), 1002 GPIO_FN(SSO1_PF),
999 PINMUX_GPIO(GPIO_FN_SSI1_PF, SSI1_PF_MARK), 1003 GPIO_FN(SSI1_PF),
1000 PINMUX_GPIO(GPIO_FN_SSCK1_PF, SSCK1_PF_MARK), 1004 GPIO_FN(SSCK1_PF),
1001 1005
1002 /* SCIF */ 1006 /* SCIF */
1003 PINMUX_GPIO(GPIO_FN_TXD0, TXD0_MARK), 1007 GPIO_FN(TXD0),
1004 PINMUX_GPIO(GPIO_FN_RXD0, RXD0_MARK), 1008 GPIO_FN(RXD0),
1005 PINMUX_GPIO(GPIO_FN_SCK0, SCK0_MARK), 1009 GPIO_FN(SCK0),
1006 PINMUX_GPIO(GPIO_FN_TXD1, TXD1_MARK), 1010 GPIO_FN(TXD1),
1007 PINMUX_GPIO(GPIO_FN_RXD1, RXD1_MARK), 1011 GPIO_FN(RXD1),
1008 PINMUX_GPIO(GPIO_FN_SCK1, SCK1_MARK), 1012 GPIO_FN(SCK1),
1009 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK), 1013 GPIO_FN(TXD2),
1010 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK), 1014 GPIO_FN(RXD2),
1011 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK), 1015 GPIO_FN(SCK2),
1012 PINMUX_GPIO(GPIO_FN_RTS3, RTS3_MARK), 1016 GPIO_FN(RTS3),
1013 PINMUX_GPIO(GPIO_FN_CTS3, CTS3_MARK), 1017 GPIO_FN(CTS3),
1014 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK), 1018 GPIO_FN(TXD3),
1015 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK), 1019 GPIO_FN(RXD3),
1016 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK), 1020 GPIO_FN(SCK3),
1017 1021
1018 /* SSI */ 1022 /* SSI */
1019 PINMUX_GPIO(GPIO_FN_AUDIO_CLK, AUDIO_CLK_MARK), 1023 GPIO_FN(AUDIO_CLK),
1020 PINMUX_GPIO(GPIO_FN_SSIDATA3, SSIDATA3_MARK), 1024 GPIO_FN(SSIDATA3),
1021 PINMUX_GPIO(GPIO_FN_SSIWS3, SSIWS3_MARK), 1025 GPIO_FN(SSIWS3),
1022 PINMUX_GPIO(GPIO_FN_SSISCK3, SSISCK3_MARK), 1026 GPIO_FN(SSISCK3),
1023 PINMUX_GPIO(GPIO_FN_SSIDATA2, SSIDATA2_MARK), 1027 GPIO_FN(SSIDATA2),
1024 PINMUX_GPIO(GPIO_FN_SSIWS2, SSIWS2_MARK), 1028 GPIO_FN(SSIWS2),
1025 PINMUX_GPIO(GPIO_FN_SSISCK2, SSISCK2_MARK), 1029 GPIO_FN(SSISCK2),
1026 PINMUX_GPIO(GPIO_FN_SSIDATA1, SSIDATA1_MARK), 1030 GPIO_FN(SSIDATA1),
1027 PINMUX_GPIO(GPIO_FN_SSIWS1, SSIWS1_MARK), 1031 GPIO_FN(SSIWS1),
1028 PINMUX_GPIO(GPIO_FN_SSISCK1, SSISCK1_MARK), 1032 GPIO_FN(SSISCK1),
1029 PINMUX_GPIO(GPIO_FN_SSIDATA0, SSIDATA0_MARK), 1033 GPIO_FN(SSIDATA0),
1030 PINMUX_GPIO(GPIO_FN_SSIWS0, SSIWS0_MARK), 1034 GPIO_FN(SSIWS0),
1031 PINMUX_GPIO(GPIO_FN_SSISCK0, SSISCK0_MARK), 1035 GPIO_FN(SSISCK0),
1032 1036
1033 /* FLCTL */ 1037 /* FLCTL */
1034 PINMUX_GPIO(GPIO_FN_FCE, FCE_MARK), 1038 GPIO_FN(FCE),
1035 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 1039 GPIO_FN(FRB),
1036 PINMUX_GPIO(GPIO_FN_NAF7, NAF7_MARK), 1040 GPIO_FN(NAF7),
1037 PINMUX_GPIO(GPIO_FN_NAF6, NAF6_MARK), 1041 GPIO_FN(NAF6),
1038 PINMUX_GPIO(GPIO_FN_NAF5, NAF5_MARK), 1042 GPIO_FN(NAF5),
1039 PINMUX_GPIO(GPIO_FN_NAF4, NAF4_MARK), 1043 GPIO_FN(NAF4),
1040 PINMUX_GPIO(GPIO_FN_NAF3, NAF3_MARK), 1044 GPIO_FN(NAF3),
1041 PINMUX_GPIO(GPIO_FN_NAF2, NAF2_MARK), 1045 GPIO_FN(NAF2),
1042 PINMUX_GPIO(GPIO_FN_NAF1, NAF1_MARK), 1046 GPIO_FN(NAF1),
1043 PINMUX_GPIO(GPIO_FN_NAF0, NAF0_MARK), 1047 GPIO_FN(NAF0),
1044 PINMUX_GPIO(GPIO_FN_FSC, FSC_MARK), 1048 GPIO_FN(FSC),
1045 PINMUX_GPIO(GPIO_FN_FOE, FOE_MARK), 1049 GPIO_FN(FOE),
1046 PINMUX_GPIO(GPIO_FN_FCDE, FCDE_MARK), 1050 GPIO_FN(FCDE),
1047 PINMUX_GPIO(GPIO_FN_FWE, FWE_MARK), 1051 GPIO_FN(FWE),
1048 1052
1049 /* LCDC */ 1053 /* LCDC */
1050 PINMUX_GPIO(GPIO_FN_LCD_VEPWC, LCD_VEPWC_MARK), 1054 GPIO_FN(LCD_VEPWC),
1051 PINMUX_GPIO(GPIO_FN_LCD_VCPWC, LCD_VCPWC_MARK), 1055 GPIO_FN(LCD_VCPWC),
1052 PINMUX_GPIO(GPIO_FN_LCD_CLK, LCD_CLK_MARK), 1056 GPIO_FN(LCD_CLK),
1053 PINMUX_GPIO(GPIO_FN_LCD_FLM, LCD_FLM_MARK), 1057 GPIO_FN(LCD_FLM),
1054 PINMUX_GPIO(GPIO_FN_LCD_M_DISP, LCD_M_DISP_MARK), 1058 GPIO_FN(LCD_M_DISP),
1055 PINMUX_GPIO(GPIO_FN_LCD_CL2, LCD_CL2_MARK), 1059 GPIO_FN(LCD_CL2),
1056 PINMUX_GPIO(GPIO_FN_LCD_CL1, LCD_CL1_MARK), 1060 GPIO_FN(LCD_CL1),
1057 PINMUX_GPIO(GPIO_FN_LCD_DON, LCD_DON_MARK), 1061 GPIO_FN(LCD_DON),
1058 PINMUX_GPIO(GPIO_FN_LCD_DATA15, LCD_DATA15_MARK), 1062 GPIO_FN(LCD_DATA15),
1059 PINMUX_GPIO(GPIO_FN_LCD_DATA14, LCD_DATA14_MARK), 1063 GPIO_FN(LCD_DATA14),
1060 PINMUX_GPIO(GPIO_FN_LCD_DATA13, LCD_DATA13_MARK), 1064 GPIO_FN(LCD_DATA13),
1061 PINMUX_GPIO(GPIO_FN_LCD_DATA12, LCD_DATA12_MARK), 1065 GPIO_FN(LCD_DATA12),
1062 PINMUX_GPIO(GPIO_FN_LCD_DATA11, LCD_DATA11_MARK), 1066 GPIO_FN(LCD_DATA11),
1063 PINMUX_GPIO(GPIO_FN_LCD_DATA10, LCD_DATA10_MARK), 1067 GPIO_FN(LCD_DATA10),
1064 PINMUX_GPIO(GPIO_FN_LCD_DATA9, LCD_DATA9_MARK), 1068 GPIO_FN(LCD_DATA9),
1065 PINMUX_GPIO(GPIO_FN_LCD_DATA8, LCD_DATA8_MARK), 1069 GPIO_FN(LCD_DATA8),
1066 PINMUX_GPIO(GPIO_FN_LCD_DATA7, LCD_DATA7_MARK), 1070 GPIO_FN(LCD_DATA7),
1067 PINMUX_GPIO(GPIO_FN_LCD_DATA6, LCD_DATA6_MARK), 1071 GPIO_FN(LCD_DATA6),
1068 PINMUX_GPIO(GPIO_FN_LCD_DATA5, LCD_DATA5_MARK), 1072 GPIO_FN(LCD_DATA5),
1069 PINMUX_GPIO(GPIO_FN_LCD_DATA4, LCD_DATA4_MARK), 1073 GPIO_FN(LCD_DATA4),
1070 PINMUX_GPIO(GPIO_FN_LCD_DATA3, LCD_DATA3_MARK), 1074 GPIO_FN(LCD_DATA3),
1071 PINMUX_GPIO(GPIO_FN_LCD_DATA2, LCD_DATA2_MARK), 1075 GPIO_FN(LCD_DATA2),
1072 PINMUX_GPIO(GPIO_FN_LCD_DATA1, LCD_DATA1_MARK), 1076 GPIO_FN(LCD_DATA1),
1073 PINMUX_GPIO(GPIO_FN_LCD_DATA0, LCD_DATA0_MARK), 1077 GPIO_FN(LCD_DATA0),
1074}; 1078};
1075 1079
1076static struct pinmux_cfg_reg pinmux_config_regs[] = { 1080static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1077 { PINMUX_CFG_REG("PBIORL", 0xfffe3886, 16, 1) { 1081 { PINMUX_CFG_REG("PBIORL", 0xfffe3886, 16, 1) {
1078 0, 0, 1082 0, 0,
1079 0, 0, 1083 0, 0,
@@ -1525,7 +1529,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1525 {} 1529 {}
1526}; 1530};
1527 1531
1528static struct pinmux_data_reg pinmux_data_regs[] = { 1532static const struct pinmux_data_reg pinmux_data_regs[] = {
1529 { PINMUX_DATA_REG("PADRL", 0xfffe3802, 16) { 1533 { PINMUX_DATA_REG("PADRL", 0xfffe3802, 16) {
1530 0, 0, 0, 0, 1534 0, 0, 0, 0,
1531 0, 0, 0, 0, 1535 0, 0, 0, 0,
@@ -1571,19 +1575,17 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1571 { }, 1575 { },
1572}; 1576};
1573 1577
1574struct sh_pfc_soc_info sh7203_pinmux_info = { 1578const struct sh_pfc_soc_info sh7203_pinmux_info = {
1575 .name = "sh7203_pfc", 1579 .name = "sh7203_pfc",
1576 .reserved_id = PINMUX_RESERVED,
1577 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1578 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN }, 1580 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN },
1579 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, 1581 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT },
1580 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1581 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 1582 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1582 1583
1583 .first_gpio = GPIO_PA7, 1584 .pins = pinmux_pins,
1584 .last_gpio = GPIO_FN_LCD_DATA0, 1585 .nr_pins = ARRAY_SIZE(pinmux_pins),
1586 .func_gpios = pinmux_func_gpios,
1587 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
1585 1588
1586 .gpios = pinmux_gpios,
1587 .cfg_regs = pinmux_config_regs, 1589 .cfg_regs = pinmux_config_regs,
1588 .data_regs = pinmux_data_regs, 1590 .data_regs = pinmux_data_regs,
1589 1591
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7264.c b/drivers/pinctrl/sh-pfc/pfc-sh7264.c
index 2ba5639dcf34..284675249ed9 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7264.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7264.c
@@ -604,7 +604,7 @@ enum {
604 PINMUX_MARK_END, 604 PINMUX_MARK_END,
605}; 605};
606 606
607static pinmux_enum_t pinmux_data[] = { 607static const pinmux_enum_t pinmux_data[] = {
608 608
609 /* Port A */ 609 /* Port A */
610 PINMUX_DATA(PA3_DATA, PA3_IN), 610 PINMUX_DATA(PA3_DATA, PA3_IN),
@@ -1072,7 +1072,7 @@ static pinmux_enum_t pinmux_data[] = {
1072 PINMUX_DATA(SD_D2_MARK, PK0MD_10), 1072 PINMUX_DATA(SD_D2_MARK, PK0MD_10),
1073}; 1073};
1074 1074
1075static struct pinmux_gpio pinmux_gpios[] = { 1075static struct sh_pfc_pin pinmux_pins[] = {
1076 1076
1077 /* Port A */ 1077 /* Port A */
1078 PINMUX_GPIO(GPIO_PA3, PA3_DATA), 1078 PINMUX_GPIO(GPIO_PA3, PA3_DATA),
@@ -1216,257 +1216,261 @@ static struct pinmux_gpio pinmux_gpios[] = {
1216 PINMUX_GPIO(GPIO_PK2, PK2_DATA), 1216 PINMUX_GPIO(GPIO_PK2, PK2_DATA),
1217 PINMUX_GPIO(GPIO_PK1, PK1_DATA), 1217 PINMUX_GPIO(GPIO_PK1, PK1_DATA),
1218 PINMUX_GPIO(GPIO_PK0, PK0_DATA), 1218 PINMUX_GPIO(GPIO_PK0, PK0_DATA),
1219};
1220
1221#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1219 1222
1223static const struct pinmux_func pinmux_func_gpios[] = {
1220 /* INTC */ 1224 /* INTC */
1221 PINMUX_GPIO(GPIO_FN_PINT7_PG, PINT7_PG_MARK), 1225 GPIO_FN(PINT7_PG),
1222 PINMUX_GPIO(GPIO_FN_PINT6_PG, PINT6_PG_MARK), 1226 GPIO_FN(PINT6_PG),
1223 PINMUX_GPIO(GPIO_FN_PINT5_PG, PINT5_PG_MARK), 1227 GPIO_FN(PINT5_PG),
1224 PINMUX_GPIO(GPIO_FN_PINT4_PG, PINT4_PG_MARK), 1228 GPIO_FN(PINT4_PG),
1225 PINMUX_GPIO(GPIO_FN_PINT3_PG, PINT3_PG_MARK), 1229 GPIO_FN(PINT3_PG),
1226 PINMUX_GPIO(GPIO_FN_PINT2_PG, PINT2_PG_MARK), 1230 GPIO_FN(PINT2_PG),
1227 PINMUX_GPIO(GPIO_FN_PINT1_PG, PINT1_PG_MARK), 1231 GPIO_FN(PINT1_PG),
1228 1232
1229 PINMUX_GPIO(GPIO_FN_IRQ7_PC, IRQ7_PC_MARK), 1233 GPIO_FN(IRQ7_PC),
1230 PINMUX_GPIO(GPIO_FN_IRQ6_PC, IRQ6_PC_MARK), 1234 GPIO_FN(IRQ6_PC),
1231 PINMUX_GPIO(GPIO_FN_IRQ5_PC, IRQ5_PC_MARK), 1235 GPIO_FN(IRQ5_PC),
1232 PINMUX_GPIO(GPIO_FN_IRQ4_PC, IRQ4_PC_MARK), 1236 GPIO_FN(IRQ4_PC),
1233 PINMUX_GPIO(GPIO_FN_IRQ3_PG, IRQ3_PG_MARK), 1237 GPIO_FN(IRQ3_PG),
1234 PINMUX_GPIO(GPIO_FN_IRQ2_PG, IRQ2_PG_MARK), 1238 GPIO_FN(IRQ2_PG),
1235 PINMUX_GPIO(GPIO_FN_IRQ1_PJ, IRQ1_PJ_MARK), 1239 GPIO_FN(IRQ1_PJ),
1236 PINMUX_GPIO(GPIO_FN_IRQ0_PJ, IRQ0_PJ_MARK), 1240 GPIO_FN(IRQ0_PJ),
1237 PINMUX_GPIO(GPIO_FN_IRQ3_PE, IRQ3_PE_MARK), 1241 GPIO_FN(IRQ3_PE),
1238 PINMUX_GPIO(GPIO_FN_IRQ2_PE, IRQ2_PE_MARK), 1242 GPIO_FN(IRQ2_PE),
1239 PINMUX_GPIO(GPIO_FN_IRQ1_PE, IRQ1_PE_MARK), 1243 GPIO_FN(IRQ1_PE),
1240 PINMUX_GPIO(GPIO_FN_IRQ0_PE, IRQ0_PE_MARK), 1244 GPIO_FN(IRQ0_PE),
1241 1245
1242 /* WDT */ 1246 /* WDT */
1243 PINMUX_GPIO(GPIO_FN_WDTOVF, WDTOVF_MARK), 1247 GPIO_FN(WDTOVF),
1244 1248
1245 /* CAN */ 1249 /* CAN */
1246 PINMUX_GPIO(GPIO_FN_CTX1, CTX1_MARK), 1250 GPIO_FN(CTX1),
1247 PINMUX_GPIO(GPIO_FN_CRX1, CRX1_MARK), 1251 GPIO_FN(CRX1),
1248 PINMUX_GPIO(GPIO_FN_CTX0, CTX0_MARK), 1252 GPIO_FN(CTX0),
1249 PINMUX_GPIO(GPIO_FN_CRX0, CRX0_MARK), 1253 GPIO_FN(CRX0),
1250 PINMUX_GPIO(GPIO_FN_CRX0_CRX1, CRX0_CRX1_MARK), 1254 GPIO_FN(CRX0_CRX1),
1251 1255
1252 /* DMAC */ 1256 /* DMAC */
1253 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK), 1257 GPIO_FN(TEND0),
1254 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 1258 GPIO_FN(DACK0),
1255 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 1259 GPIO_FN(DREQ0),
1256 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK), 1260 GPIO_FN(TEND1),
1257 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 1261 GPIO_FN(DACK1),
1258 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 1262 GPIO_FN(DREQ1),
1259 1263
1260 /* ADC */ 1264 /* ADC */
1261 PINMUX_GPIO(GPIO_FN_ADTRG, ADTRG_MARK), 1265 GPIO_FN(ADTRG),
1262 1266
1263 /* BSCh */ 1267 /* BSCh */
1264 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 1268 GPIO_FN(A25),
1265 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 1269 GPIO_FN(A24),
1266 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1270 GPIO_FN(A23),
1267 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1271 GPIO_FN(A22),
1268 PINMUX_GPIO(GPIO_FN_A21, A21_MARK), 1272 GPIO_FN(A21),
1269 PINMUX_GPIO(GPIO_FN_A20, A20_MARK), 1273 GPIO_FN(A20),
1270 PINMUX_GPIO(GPIO_FN_A19, A19_MARK), 1274 GPIO_FN(A19),
1271 PINMUX_GPIO(GPIO_FN_A18, A18_MARK), 1275 GPIO_FN(A18),
1272 PINMUX_GPIO(GPIO_FN_A17, A17_MARK), 1276 GPIO_FN(A17),
1273 PINMUX_GPIO(GPIO_FN_A16, A16_MARK), 1277 GPIO_FN(A16),
1274 PINMUX_GPIO(GPIO_FN_A15, A15_MARK), 1278 GPIO_FN(A15),
1275 PINMUX_GPIO(GPIO_FN_A14, A14_MARK), 1279 GPIO_FN(A14),
1276 PINMUX_GPIO(GPIO_FN_A13, A13_MARK), 1280 GPIO_FN(A13),
1277 PINMUX_GPIO(GPIO_FN_A12, A12_MARK), 1281 GPIO_FN(A12),
1278 PINMUX_GPIO(GPIO_FN_A11, A11_MARK), 1282 GPIO_FN(A11),
1279 PINMUX_GPIO(GPIO_FN_A10, A10_MARK), 1283 GPIO_FN(A10),
1280 PINMUX_GPIO(GPIO_FN_A9, A9_MARK), 1284 GPIO_FN(A9),
1281 PINMUX_GPIO(GPIO_FN_A8, A8_MARK), 1285 GPIO_FN(A8),
1282 PINMUX_GPIO(GPIO_FN_A7, A7_MARK), 1286 GPIO_FN(A7),
1283 PINMUX_GPIO(GPIO_FN_A6, A6_MARK), 1287 GPIO_FN(A6),
1284 PINMUX_GPIO(GPIO_FN_A5, A5_MARK), 1288 GPIO_FN(A5),
1285 PINMUX_GPIO(GPIO_FN_A4, A4_MARK), 1289 GPIO_FN(A4),
1286 PINMUX_GPIO(GPIO_FN_A3, A3_MARK), 1290 GPIO_FN(A3),
1287 PINMUX_GPIO(GPIO_FN_A2, A2_MARK), 1291 GPIO_FN(A2),
1288 PINMUX_GPIO(GPIO_FN_A1, A1_MARK), 1292 GPIO_FN(A1),
1289 PINMUX_GPIO(GPIO_FN_A0, A0_MARK), 1293 GPIO_FN(A0),
1290 1294
1291 PINMUX_GPIO(GPIO_FN_D15, D15_MARK), 1295 GPIO_FN(D15),
1292 PINMUX_GPIO(GPIO_FN_D14, D14_MARK), 1296 GPIO_FN(D14),
1293 PINMUX_GPIO(GPIO_FN_D13, D13_MARK), 1297 GPIO_FN(D13),
1294 PINMUX_GPIO(GPIO_FN_D12, D12_MARK), 1298 GPIO_FN(D12),
1295 PINMUX_GPIO(GPIO_FN_D11, D11_MARK), 1299 GPIO_FN(D11),
1296 PINMUX_GPIO(GPIO_FN_D10, D10_MARK), 1300 GPIO_FN(D10),
1297 PINMUX_GPIO(GPIO_FN_D9, D9_MARK), 1301 GPIO_FN(D9),
1298 PINMUX_GPIO(GPIO_FN_D8, D8_MARK), 1302 GPIO_FN(D8),
1299 PINMUX_GPIO(GPIO_FN_D7, D7_MARK), 1303 GPIO_FN(D7),
1300 PINMUX_GPIO(GPIO_FN_D6, D6_MARK), 1304 GPIO_FN(D6),
1301 PINMUX_GPIO(GPIO_FN_D5, D5_MARK), 1305 GPIO_FN(D5),
1302 PINMUX_GPIO(GPIO_FN_D4, D4_MARK), 1306 GPIO_FN(D4),
1303 PINMUX_GPIO(GPIO_FN_D3, D3_MARK), 1307 GPIO_FN(D3),
1304 PINMUX_GPIO(GPIO_FN_D2, D2_MARK), 1308 GPIO_FN(D2),
1305 PINMUX_GPIO(GPIO_FN_D1, D1_MARK), 1309 GPIO_FN(D1),
1306 PINMUX_GPIO(GPIO_FN_D0, D0_MARK), 1310 GPIO_FN(D0),
1307 1311
1308 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1312 GPIO_FN(BS),
1309 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK), 1313 GPIO_FN(CS4),
1310 PINMUX_GPIO(GPIO_FN_CS3, CS3_MARK), 1314 GPIO_FN(CS3),
1311 PINMUX_GPIO(GPIO_FN_CS2, CS2_MARK), 1315 GPIO_FN(CS2),
1312 PINMUX_GPIO(GPIO_FN_CS1, CS1_MARK), 1316 GPIO_FN(CS1),
1313 PINMUX_GPIO(GPIO_FN_CS0, CS0_MARK), 1317 GPIO_FN(CS0),
1314 PINMUX_GPIO(GPIO_FN_CS6CE1B, CS6CE1B_MARK), 1318 GPIO_FN(CS6CE1B),
1315 PINMUX_GPIO(GPIO_FN_CS5CE1A, CS5CE1A_MARK), 1319 GPIO_FN(CS5CE1A),
1316 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK), 1320 GPIO_FN(CE2A),
1317 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK), 1321 GPIO_FN(CE2B),
1318 PINMUX_GPIO(GPIO_FN_RD, RD_MARK), 1322 GPIO_FN(RD),
1319 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK), 1323 GPIO_FN(RDWR),
1320 PINMUX_GPIO(GPIO_FN_ICIOWRAH, ICIOWRAH_MARK), 1324 GPIO_FN(ICIOWRAH),
1321 PINMUX_GPIO(GPIO_FN_ICIORD, ICIORD_MARK), 1325 GPIO_FN(ICIORD),
1322 PINMUX_GPIO(GPIO_FN_WE1DQMUWE, WE1DQMUWE_MARK), 1326 GPIO_FN(WE1DQMUWE),
1323 PINMUX_GPIO(GPIO_FN_WE0DQML, WE0DQML_MARK), 1327 GPIO_FN(WE0DQML),
1324 PINMUX_GPIO(GPIO_FN_RAS, RAS_MARK), 1328 GPIO_FN(RAS),
1325 PINMUX_GPIO(GPIO_FN_CAS, CAS_MARK), 1329 GPIO_FN(CAS),
1326 PINMUX_GPIO(GPIO_FN_CKE, CKE_MARK), 1330 GPIO_FN(CKE),
1327 PINMUX_GPIO(GPIO_FN_WAIT, WAIT_MARK), 1331 GPIO_FN(WAIT),
1328 PINMUX_GPIO(GPIO_FN_BREQ, BREQ_MARK), 1332 GPIO_FN(BREQ),
1329 PINMUX_GPIO(GPIO_FN_BACK, BACK_MARK), 1333 GPIO_FN(BACK),
1330 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 1334 GPIO_FN(IOIS16),
1331 1335
1332 /* TMU */ 1336 /* TMU */
1333 PINMUX_GPIO(GPIO_FN_TIOC4D, TIOC4D_MARK), 1337 GPIO_FN(TIOC4D),
1334 PINMUX_GPIO(GPIO_FN_TIOC4C, TIOC4C_MARK), 1338 GPIO_FN(TIOC4C),
1335 PINMUX_GPIO(GPIO_FN_TIOC4B, TIOC4B_MARK), 1339 GPIO_FN(TIOC4B),
1336 PINMUX_GPIO(GPIO_FN_TIOC4A, TIOC4A_MARK), 1340 GPIO_FN(TIOC4A),
1337 PINMUX_GPIO(GPIO_FN_TIOC3D, TIOC3D_MARK), 1341 GPIO_FN(TIOC3D),
1338 PINMUX_GPIO(GPIO_FN_TIOC3C, TIOC3C_MARK), 1342 GPIO_FN(TIOC3C),
1339 PINMUX_GPIO(GPIO_FN_TIOC3B, TIOC3B_MARK), 1343 GPIO_FN(TIOC3B),
1340 PINMUX_GPIO(GPIO_FN_TIOC3A, TIOC3A_MARK), 1344 GPIO_FN(TIOC3A),
1341 PINMUX_GPIO(GPIO_FN_TIOC2B, TIOC2B_MARK), 1345 GPIO_FN(TIOC2B),
1342 PINMUX_GPIO(GPIO_FN_TIOC1B, TIOC1B_MARK), 1346 GPIO_FN(TIOC1B),
1343 PINMUX_GPIO(GPIO_FN_TIOC2A, TIOC2A_MARK), 1347 GPIO_FN(TIOC2A),
1344 PINMUX_GPIO(GPIO_FN_TIOC1A, TIOC1A_MARK), 1348 GPIO_FN(TIOC1A),
1345 PINMUX_GPIO(GPIO_FN_TIOC0D, TIOC0D_MARK), 1349 GPIO_FN(TIOC0D),
1346 PINMUX_GPIO(GPIO_FN_TIOC0C, TIOC0C_MARK), 1350 GPIO_FN(TIOC0C),
1347 PINMUX_GPIO(GPIO_FN_TIOC0B, TIOC0B_MARK), 1351 GPIO_FN(TIOC0B),
1348 PINMUX_GPIO(GPIO_FN_TIOC0A, TIOC0A_MARK), 1352 GPIO_FN(TIOC0A),
1349 PINMUX_GPIO(GPIO_FN_TCLKD, TCLKD_MARK), 1353 GPIO_FN(TCLKD),
1350 PINMUX_GPIO(GPIO_FN_TCLKC, TCLKC_MARK), 1354 GPIO_FN(TCLKC),
1351 PINMUX_GPIO(GPIO_FN_TCLKB, TCLKB_MARK), 1355 GPIO_FN(TCLKB),
1352 PINMUX_GPIO(GPIO_FN_TCLKA, TCLKA_MARK), 1356 GPIO_FN(TCLKA),
1353 1357
1354 /* SCIF */ 1358 /* SCIF */
1355 PINMUX_GPIO(GPIO_FN_TXD0, TXD0_MARK), 1359 GPIO_FN(TXD0),
1356 PINMUX_GPIO(GPIO_FN_RXD0, RXD0_MARK), 1360 GPIO_FN(RXD0),
1357 PINMUX_GPIO(GPIO_FN_SCK0, SCK0_MARK), 1361 GPIO_FN(SCK0),
1358 PINMUX_GPIO(GPIO_FN_TXD1, TXD1_MARK), 1362 GPIO_FN(TXD1),
1359 PINMUX_GPIO(GPIO_FN_RXD1, RXD1_MARK), 1363 GPIO_FN(RXD1),
1360 PINMUX_GPIO(GPIO_FN_SCK1, SCK1_MARK), 1364 GPIO_FN(SCK1),
1361 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK), 1365 GPIO_FN(TXD2),
1362 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK), 1366 GPIO_FN(RXD2),
1363 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK), 1367 GPIO_FN(SCK2),
1364 PINMUX_GPIO(GPIO_FN_RTS3, RTS3_MARK), 1368 GPIO_FN(RTS3),
1365 PINMUX_GPIO(GPIO_FN_CTS3, CTS3_MARK), 1369 GPIO_FN(CTS3),
1366 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK), 1370 GPIO_FN(TXD3),
1367 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK), 1371 GPIO_FN(RXD3),
1368 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK), 1372 GPIO_FN(SCK3),
1369 PINMUX_GPIO(GPIO_FN_TXD4, TXD4_MARK), 1373 GPIO_FN(TXD4),
1370 PINMUX_GPIO(GPIO_FN_RXD4, RXD4_MARK), 1374 GPIO_FN(RXD4),
1371 PINMUX_GPIO(GPIO_FN_TXD5, TXD5_MARK), 1375 GPIO_FN(TXD5),
1372 PINMUX_GPIO(GPIO_FN_RXD5, RXD5_MARK), 1376 GPIO_FN(RXD5),
1373 PINMUX_GPIO(GPIO_FN_TXD6, TXD6_MARK), 1377 GPIO_FN(TXD6),
1374 PINMUX_GPIO(GPIO_FN_RXD6, RXD6_MARK), 1378 GPIO_FN(RXD6),
1375 PINMUX_GPIO(GPIO_FN_TXD7, TXD7_MARK), 1379 GPIO_FN(TXD7),
1376 PINMUX_GPIO(GPIO_FN_RXD7, RXD7_MARK), 1380 GPIO_FN(RXD7),
1377 PINMUX_GPIO(GPIO_FN_RTS1, RTS1_MARK), 1381 GPIO_FN(RTS1),
1378 PINMUX_GPIO(GPIO_FN_CTS1, CTS1_MARK), 1382 GPIO_FN(CTS1),
1379 1383
1380 /* RSPI */ 1384 /* RSPI */
1381 PINMUX_GPIO(GPIO_FN_RSPCK0, RSPCK0_MARK), 1385 GPIO_FN(RSPCK0),
1382 PINMUX_GPIO(GPIO_FN_MOSI0, MOSI0_MARK), 1386 GPIO_FN(MOSI0),
1383 PINMUX_GPIO(GPIO_FN_MISO0_PF12, MISO0_PF12_MARK), 1387 GPIO_FN(MISO0_PF12),
1384 PINMUX_GPIO(GPIO_FN_MISO1, MISO1_MARK), 1388 GPIO_FN(MISO1),
1385 PINMUX_GPIO(GPIO_FN_SSL00, SSL00_MARK), 1389 GPIO_FN(SSL00),
1386 PINMUX_GPIO(GPIO_FN_RSPCK1, RSPCK1_MARK), 1390 GPIO_FN(RSPCK1),
1387 PINMUX_GPIO(GPIO_FN_MOSI1, MOSI1_MARK), 1391 GPIO_FN(MOSI1),
1388 PINMUX_GPIO(GPIO_FN_MISO1_PG19, MISO1_PG19_MARK), 1392 GPIO_FN(MISO1_PG19),
1389 PINMUX_GPIO(GPIO_FN_SSL10, SSL10_MARK), 1393 GPIO_FN(SSL10),
1390 1394
1391 /* IIC3 */ 1395 /* IIC3 */
1392 PINMUX_GPIO(GPIO_FN_SCL0, SCL0_MARK), 1396 GPIO_FN(SCL0),
1393 PINMUX_GPIO(GPIO_FN_SCL1, SCL1_MARK), 1397 GPIO_FN(SCL1),
1394 PINMUX_GPIO(GPIO_FN_SCL2, SCL2_MARK), 1398 GPIO_FN(SCL2),
1395 PINMUX_GPIO(GPIO_FN_SDA0, SDA0_MARK), 1399 GPIO_FN(SDA0),
1396 PINMUX_GPIO(GPIO_FN_SDA1, SDA1_MARK), 1400 GPIO_FN(SDA1),
1397 PINMUX_GPIO(GPIO_FN_SDA2, SDA2_MARK), 1401 GPIO_FN(SDA2),
1398 1402
1399 /* SSI */ 1403 /* SSI */
1400 PINMUX_GPIO(GPIO_FN_SSISCK0, SSISCK0_MARK), 1404 GPIO_FN(SSISCK0),
1401 PINMUX_GPIO(GPIO_FN_SSIWS0, SSIWS0_MARK), 1405 GPIO_FN(SSIWS0),
1402 PINMUX_GPIO(GPIO_FN_SSITXD0, SSITXD0_MARK), 1406 GPIO_FN(SSITXD0),
1403 PINMUX_GPIO(GPIO_FN_SSIRXD0, SSIRXD0_MARK), 1407 GPIO_FN(SSIRXD0),
1404 PINMUX_GPIO(GPIO_FN_SSIWS1, SSIWS1_MARK), 1408 GPIO_FN(SSIWS1),
1405 PINMUX_GPIO(GPIO_FN_SSIWS2, SSIWS2_MARK), 1409 GPIO_FN(SSIWS2),
1406 PINMUX_GPIO(GPIO_FN_SSIWS3, SSIWS3_MARK), 1410 GPIO_FN(SSIWS3),
1407 PINMUX_GPIO(GPIO_FN_SSISCK1, SSISCK1_MARK), 1411 GPIO_FN(SSISCK1),
1408 PINMUX_GPIO(GPIO_FN_SSISCK2, SSISCK2_MARK), 1412 GPIO_FN(SSISCK2),
1409 PINMUX_GPIO(GPIO_FN_SSISCK3, SSISCK3_MARK), 1413 GPIO_FN(SSISCK3),
1410 PINMUX_GPIO(GPIO_FN_SSIDATA1, SSIDATA1_MARK), 1414 GPIO_FN(SSIDATA1),
1411 PINMUX_GPIO(GPIO_FN_SSIDATA2, SSIDATA2_MARK), 1415 GPIO_FN(SSIDATA2),
1412 PINMUX_GPIO(GPIO_FN_SSIDATA3, SSIDATA3_MARK), 1416 GPIO_FN(SSIDATA3),
1413 PINMUX_GPIO(GPIO_FN_AUDIO_CLK, AUDIO_CLK_MARK), 1417 GPIO_FN(AUDIO_CLK),
1414 1418
1415 /* SIOF */ /* NOTE Shares AUDIO_CLK with SSI */ 1419 /* SIOF */ /* NOTE Shares AUDIO_CLK with SSI */
1416 PINMUX_GPIO(GPIO_FN_SIOFTXD, SIOFTXD_MARK), 1420 GPIO_FN(SIOFTXD),
1417 PINMUX_GPIO(GPIO_FN_SIOFRXD, SIOFRXD_MARK), 1421 GPIO_FN(SIOFRXD),
1418 PINMUX_GPIO(GPIO_FN_SIOFSYNC, SIOFSYNC_MARK), 1422 GPIO_FN(SIOFSYNC),
1419 PINMUX_GPIO(GPIO_FN_SIOFSCK, SIOFSCK_MARK), 1423 GPIO_FN(SIOFSCK),
1420 1424
1421 /* SPDIF */ /* NOTE Shares AUDIO_CLK with SSI */ 1425 /* SPDIF */ /* NOTE Shares AUDIO_CLK with SSI */
1422 PINMUX_GPIO(GPIO_FN_SPDIF_IN, SPDIF_IN_MARK), 1426 GPIO_FN(SPDIF_IN),
1423 PINMUX_GPIO(GPIO_FN_SPDIF_OUT, SPDIF_OUT_MARK), 1427 GPIO_FN(SPDIF_OUT),
1424 1428
1425 /* NANDFMC */ /* NOTE Controller is not available in boot mode 0 */ 1429 /* NANDFMC */ /* NOTE Controller is not available in boot mode 0 */
1426 PINMUX_GPIO(GPIO_FN_FCE, FCE_MARK), 1430 GPIO_FN(FCE),
1427 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 1431 GPIO_FN(FRB),
1428 1432
1429 /* VDC3 */ 1433 /* VDC3 */
1430 PINMUX_GPIO(GPIO_FN_DV_CLK, DV_CLK_MARK), 1434 GPIO_FN(DV_CLK),
1431 PINMUX_GPIO(GPIO_FN_DV_VSYNC, DV_VSYNC_MARK), 1435 GPIO_FN(DV_VSYNC),
1432 PINMUX_GPIO(GPIO_FN_DV_HSYNC, DV_HSYNC_MARK), 1436 GPIO_FN(DV_HSYNC),
1433 1437
1434 PINMUX_GPIO(GPIO_FN_DV_DATA7, DV_DATA7_MARK), 1438 GPIO_FN(DV_DATA7),
1435 PINMUX_GPIO(GPIO_FN_DV_DATA6, DV_DATA6_MARK), 1439 GPIO_FN(DV_DATA6),
1436 PINMUX_GPIO(GPIO_FN_DV_DATA5, DV_DATA5_MARK), 1440 GPIO_FN(DV_DATA5),
1437 PINMUX_GPIO(GPIO_FN_DV_DATA4, DV_DATA4_MARK), 1441 GPIO_FN(DV_DATA4),
1438 PINMUX_GPIO(GPIO_FN_DV_DATA3, DV_DATA3_MARK), 1442 GPIO_FN(DV_DATA3),
1439 PINMUX_GPIO(GPIO_FN_DV_DATA2, DV_DATA2_MARK), 1443 GPIO_FN(DV_DATA2),
1440 PINMUX_GPIO(GPIO_FN_DV_DATA1, DV_DATA1_MARK), 1444 GPIO_FN(DV_DATA1),
1441 PINMUX_GPIO(GPIO_FN_DV_DATA0, DV_DATA0_MARK), 1445 GPIO_FN(DV_DATA0),
1442 1446
1443 PINMUX_GPIO(GPIO_FN_LCD_CLK, LCD_CLK_MARK), 1447 GPIO_FN(LCD_CLK),
1444 PINMUX_GPIO(GPIO_FN_LCD_EXTCLK, LCD_EXTCLK_MARK), 1448 GPIO_FN(LCD_EXTCLK),
1445 PINMUX_GPIO(GPIO_FN_LCD_VSYNC, LCD_VSYNC_MARK), 1449 GPIO_FN(LCD_VSYNC),
1446 PINMUX_GPIO(GPIO_FN_LCD_HSYNC, LCD_HSYNC_MARK), 1450 GPIO_FN(LCD_HSYNC),
1447 PINMUX_GPIO(GPIO_FN_LCD_DE, LCD_DE_MARK), 1451 GPIO_FN(LCD_DE),
1448 1452
1449 PINMUX_GPIO(GPIO_FN_LCD_DATA15, LCD_DATA15_MARK), 1453 GPIO_FN(LCD_DATA15),
1450 PINMUX_GPIO(GPIO_FN_LCD_DATA14, LCD_DATA14_MARK), 1454 GPIO_FN(LCD_DATA14),
1451 PINMUX_GPIO(GPIO_FN_LCD_DATA13, LCD_DATA13_MARK), 1455 GPIO_FN(LCD_DATA13),
1452 PINMUX_GPIO(GPIO_FN_LCD_DATA12, LCD_DATA12_MARK), 1456 GPIO_FN(LCD_DATA12),
1453 PINMUX_GPIO(GPIO_FN_LCD_DATA11, LCD_DATA11_MARK), 1457 GPIO_FN(LCD_DATA11),
1454 PINMUX_GPIO(GPIO_FN_LCD_DATA10, LCD_DATA10_MARK), 1458 GPIO_FN(LCD_DATA10),
1455 PINMUX_GPIO(GPIO_FN_LCD_DATA9, LCD_DATA9_MARK), 1459 GPIO_FN(LCD_DATA9),
1456 PINMUX_GPIO(GPIO_FN_LCD_DATA8, LCD_DATA8_MARK), 1460 GPIO_FN(LCD_DATA8),
1457 PINMUX_GPIO(GPIO_FN_LCD_DATA7, LCD_DATA7_MARK), 1461 GPIO_FN(LCD_DATA7),
1458 PINMUX_GPIO(GPIO_FN_LCD_DATA6, LCD_DATA6_MARK), 1462 GPIO_FN(LCD_DATA6),
1459 PINMUX_GPIO(GPIO_FN_LCD_DATA5, LCD_DATA5_MARK), 1463 GPIO_FN(LCD_DATA5),
1460 PINMUX_GPIO(GPIO_FN_LCD_DATA4, LCD_DATA4_MARK), 1464 GPIO_FN(LCD_DATA4),
1461 PINMUX_GPIO(GPIO_FN_LCD_DATA3, LCD_DATA3_MARK), 1465 GPIO_FN(LCD_DATA3),
1462 PINMUX_GPIO(GPIO_FN_LCD_DATA2, LCD_DATA2_MARK), 1466 GPIO_FN(LCD_DATA2),
1463 PINMUX_GPIO(GPIO_FN_LCD_DATA1, LCD_DATA1_MARK), 1467 GPIO_FN(LCD_DATA1),
1464 PINMUX_GPIO(GPIO_FN_LCD_DATA0, LCD_DATA0_MARK), 1468 GPIO_FN(LCD_DATA0),
1465 1469
1466 PINMUX_GPIO(GPIO_FN_LCD_M_DISP, LCD_M_DISP_MARK), 1470 GPIO_FN(LCD_M_DISP),
1467}; 1471};
1468 1472
1469static struct pinmux_cfg_reg pinmux_config_regs[] = { 1473static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1470 { PINMUX_CFG_REG("PAIOR0", 0xfffe3812, 16, 1) { 1474 { PINMUX_CFG_REG("PAIOR0", 0xfffe3812, 16, 1) {
1471 0, 0, 0, 0, 0, 0, 0, 0, 1475 0, 0, 0, 0, 0, 0, 0, 0,
1472 0, 0, 0, 0, 0, 0, 0, 0, 1476 0, 0, 0, 0, 0, 0, 0, 0,
@@ -2032,7 +2036,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2032 {} 2036 {}
2033}; 2037};
2034 2038
2035static struct pinmux_data_reg pinmux_data_regs[] = { 2039static const struct pinmux_data_reg pinmux_data_regs[] = {
2036 { PINMUX_DATA_REG("PADR1", 0xfffe3814, 16) { 2040 { PINMUX_DATA_REG("PADR1", 0xfffe3814, 16) {
2037 0, 0, 0, 0, 0, 0, 0, PA3_DATA, 2041 0, 0, 0, 0, 0, 0, 0, PA3_DATA,
2038 0, 0, 0, 0, 0, 0, 0, PA2_DATA } 2042 0, 0, 0, 0, 0, 0, 0, PA2_DATA }
@@ -2110,19 +2114,17 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2110 { } 2114 { }
2111}; 2115};
2112 2116
2113struct sh_pfc_soc_info sh7264_pinmux_info = { 2117const struct sh_pfc_soc_info sh7264_pinmux_info = {
2114 .name = "sh7264_pfc", 2118 .name = "sh7264_pfc",
2115 .reserved_id = PINMUX_RESERVED,
2116 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
2117 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN }, 2119 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN },
2118 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, 2120 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT },
2119 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2120 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 2121 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2121 2122
2122 .first_gpio = GPIO_PA3, 2123 .pins = pinmux_pins,
2123 .last_gpio = GPIO_FN_LCD_M_DISP, 2124 .nr_pins = ARRAY_SIZE(pinmux_pins),
2125 .func_gpios = pinmux_func_gpios,
2126 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2124 2127
2125 .gpios = pinmux_gpios,
2126 .cfg_regs = pinmux_config_regs, 2128 .cfg_regs = pinmux_config_regs,
2127 .data_regs = pinmux_data_regs, 2129 .data_regs = pinmux_data_regs,
2128 2130
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7269.c b/drivers/pinctrl/sh-pfc/pfc-sh7269.c
index b1b5d6d4ad76..4c401a74acd5 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7269.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7269.c
@@ -781,7 +781,7 @@ enum {
781 PINMUX_MARK_END, 781 PINMUX_MARK_END,
782}; 782};
783 783
784static pinmux_enum_t pinmux_data[] = { 784static const pinmux_enum_t pinmux_data[] = {
785 785
786 /* Port A */ 786 /* Port A */
787 PINMUX_DATA(PA1_DATA, PA1_IN), 787 PINMUX_DATA(PA1_DATA, PA1_IN),
@@ -1452,7 +1452,7 @@ static pinmux_enum_t pinmux_data[] = {
1452 PINMUX_DATA(PWM1A_MARK, PJ0MD_100), 1452 PINMUX_DATA(PWM1A_MARK, PJ0MD_100),
1453}; 1453};
1454 1454
1455static struct pinmux_gpio pinmux_gpios[] = { 1455static struct sh_pfc_pin pinmux_pins[] = {
1456 /* Port A */ 1456 /* Port A */
1457 PINMUX_GPIO(GPIO_PA1, PA1_DATA), 1457 PINMUX_GPIO(GPIO_PA1, PA1_DATA),
1458 PINMUX_GPIO(GPIO_PA0, PA0_DATA), 1458 PINMUX_GPIO(GPIO_PA0, PA0_DATA),
@@ -1613,339 +1613,343 @@ static struct pinmux_gpio pinmux_gpios[] = {
1613 PINMUX_GPIO(GPIO_PJ2, PJ2_DATA), 1613 PINMUX_GPIO(GPIO_PJ2, PJ2_DATA),
1614 PINMUX_GPIO(GPIO_PJ1, PJ1_DATA), 1614 PINMUX_GPIO(GPIO_PJ1, PJ1_DATA),
1615 PINMUX_GPIO(GPIO_PJ0, PJ0_DATA), 1615 PINMUX_GPIO(GPIO_PJ0, PJ0_DATA),
1616};
1617
1618#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1616 1619
1620static const struct pinmux_func pinmux_func_gpios[] = {
1617 /* INTC */ 1621 /* INTC */
1618 PINMUX_GPIO(GPIO_FN_IRQ7_PG, IRQ7_PG_MARK), 1622 GPIO_FN(IRQ7_PG),
1619 PINMUX_GPIO(GPIO_FN_IRQ6_PG, IRQ6_PG_MARK), 1623 GPIO_FN(IRQ6_PG),
1620 PINMUX_GPIO(GPIO_FN_IRQ5_PG, IRQ5_PG_MARK), 1624 GPIO_FN(IRQ5_PG),
1621 PINMUX_GPIO(GPIO_FN_IRQ4_PG, IRQ4_PG_MARK), 1625 GPIO_FN(IRQ4_PG),
1622 PINMUX_GPIO(GPIO_FN_IRQ3_PG, IRQ3_PG_MARK), 1626 GPIO_FN(IRQ3_PG),
1623 PINMUX_GPIO(GPIO_FN_IRQ2_PG, IRQ2_PG_MARK), 1627 GPIO_FN(IRQ2_PG),
1624 PINMUX_GPIO(GPIO_FN_IRQ1_PG, IRQ1_PG_MARK), 1628 GPIO_FN(IRQ1_PG),
1625 PINMUX_GPIO(GPIO_FN_IRQ0_PG, IRQ0_PG_MARK), 1629 GPIO_FN(IRQ0_PG),
1626 PINMUX_GPIO(GPIO_FN_IRQ7_PF, IRQ7_PF_MARK), 1630 GPIO_FN(IRQ7_PF),
1627 PINMUX_GPIO(GPIO_FN_IRQ6_PF, IRQ6_PF_MARK), 1631 GPIO_FN(IRQ6_PF),
1628 PINMUX_GPIO(GPIO_FN_IRQ5_PF, IRQ5_PF_MARK), 1632 GPIO_FN(IRQ5_PF),
1629 PINMUX_GPIO(GPIO_FN_IRQ4_PF, IRQ4_PF_MARK), 1633 GPIO_FN(IRQ4_PF),
1630 PINMUX_GPIO(GPIO_FN_IRQ3_PJ, IRQ3_PJ_MARK), 1634 GPIO_FN(IRQ3_PJ),
1631 PINMUX_GPIO(GPIO_FN_IRQ2_PJ, IRQ2_PJ_MARK), 1635 GPIO_FN(IRQ2_PJ),
1632 PINMUX_GPIO(GPIO_FN_IRQ1_PJ, IRQ1_PJ_MARK), 1636 GPIO_FN(IRQ1_PJ),
1633 PINMUX_GPIO(GPIO_FN_IRQ0_PJ, IRQ0_PJ_MARK), 1637 GPIO_FN(IRQ0_PJ),
1634 PINMUX_GPIO(GPIO_FN_IRQ1_PC, IRQ1_PC_MARK), 1638 GPIO_FN(IRQ1_PC),
1635 PINMUX_GPIO(GPIO_FN_IRQ0_PC, IRQ0_PC_MARK), 1639 GPIO_FN(IRQ0_PC),
1636 1640
1637 PINMUX_GPIO(GPIO_FN_PINT7_PG, PINT7_PG_MARK), 1641 GPIO_FN(PINT7_PG),
1638 PINMUX_GPIO(GPIO_FN_PINT6_PG, PINT6_PG_MARK), 1642 GPIO_FN(PINT6_PG),
1639 PINMUX_GPIO(GPIO_FN_PINT5_PG, PINT5_PG_MARK), 1643 GPIO_FN(PINT5_PG),
1640 PINMUX_GPIO(GPIO_FN_PINT4_PG, PINT4_PG_MARK), 1644 GPIO_FN(PINT4_PG),
1641 PINMUX_GPIO(GPIO_FN_PINT3_PG, PINT3_PG_MARK), 1645 GPIO_FN(PINT3_PG),
1642 PINMUX_GPIO(GPIO_FN_PINT2_PG, PINT2_PG_MARK), 1646 GPIO_FN(PINT2_PG),
1643 PINMUX_GPIO(GPIO_FN_PINT1_PG, PINT1_PG_MARK), 1647 GPIO_FN(PINT1_PG),
1644 PINMUX_GPIO(GPIO_FN_PINT0_PG, PINT0_PG_MARK), 1648 GPIO_FN(PINT0_PG),
1645 PINMUX_GPIO(GPIO_FN_PINT7_PH, PINT7_PH_MARK), 1649 GPIO_FN(PINT7_PH),
1646 PINMUX_GPIO(GPIO_FN_PINT6_PH, PINT6_PH_MARK), 1650 GPIO_FN(PINT6_PH),
1647 PINMUX_GPIO(GPIO_FN_PINT5_PH, PINT5_PH_MARK), 1651 GPIO_FN(PINT5_PH),
1648 PINMUX_GPIO(GPIO_FN_PINT4_PH, PINT4_PH_MARK), 1652 GPIO_FN(PINT4_PH),
1649 PINMUX_GPIO(GPIO_FN_PINT3_PH, PINT3_PH_MARK), 1653 GPIO_FN(PINT3_PH),
1650 PINMUX_GPIO(GPIO_FN_PINT2_PH, PINT2_PH_MARK), 1654 GPIO_FN(PINT2_PH),
1651 PINMUX_GPIO(GPIO_FN_PINT1_PH, PINT1_PH_MARK), 1655 GPIO_FN(PINT1_PH),
1652 PINMUX_GPIO(GPIO_FN_PINT0_PH, PINT0_PH_MARK), 1656 GPIO_FN(PINT0_PH),
1653 PINMUX_GPIO(GPIO_FN_PINT7_PJ, PINT7_PJ_MARK), 1657 GPIO_FN(PINT7_PJ),
1654 PINMUX_GPIO(GPIO_FN_PINT6_PJ, PINT6_PJ_MARK), 1658 GPIO_FN(PINT6_PJ),
1655 PINMUX_GPIO(GPIO_FN_PINT5_PJ, PINT5_PJ_MARK), 1659 GPIO_FN(PINT5_PJ),
1656 PINMUX_GPIO(GPIO_FN_PINT4_PJ, PINT4_PJ_MARK), 1660 GPIO_FN(PINT4_PJ),
1657 PINMUX_GPIO(GPIO_FN_PINT3_PJ, PINT3_PJ_MARK), 1661 GPIO_FN(PINT3_PJ),
1658 PINMUX_GPIO(GPIO_FN_PINT2_PJ, PINT2_PJ_MARK), 1662 GPIO_FN(PINT2_PJ),
1659 PINMUX_GPIO(GPIO_FN_PINT1_PJ, PINT1_PJ_MARK), 1663 GPIO_FN(PINT1_PJ),
1660 PINMUX_GPIO(GPIO_FN_PINT0_PJ, PINT0_PJ_MARK), 1664 GPIO_FN(PINT0_PJ),
1661 1665
1662 /* WDT */ 1666 /* WDT */
1663 PINMUX_GPIO(GPIO_FN_WDTOVF, WDTOVF_MARK), 1667 GPIO_FN(WDTOVF),
1664 1668
1665 /* CAN */ 1669 /* CAN */
1666 PINMUX_GPIO(GPIO_FN_CTX1, CTX1_MARK), 1670 GPIO_FN(CTX1),
1667 PINMUX_GPIO(GPIO_FN_CRX1, CRX1_MARK), 1671 GPIO_FN(CRX1),
1668 PINMUX_GPIO(GPIO_FN_CTX0, CTX0_MARK), 1672 GPIO_FN(CTX0),
1669 PINMUX_GPIO(GPIO_FN_CRX0, CRX0_MARK), 1673 GPIO_FN(CRX0),
1670 PINMUX_GPIO(GPIO_FN_CRX0_CRX1, CRX0_CRX1_MARK), 1674 GPIO_FN(CRX0_CRX1),
1671 PINMUX_GPIO(GPIO_FN_CRX0_CRX1_CRX2, CRX0_CRX1_CRX2_MARK), 1675 GPIO_FN(CRX0_CRX1_CRX2),
1672 1676
1673 /* DMAC */ 1677 /* DMAC */
1674 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK), 1678 GPIO_FN(TEND0),
1675 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 1679 GPIO_FN(DACK0),
1676 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 1680 GPIO_FN(DREQ0),
1677 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK), 1681 GPIO_FN(TEND1),
1678 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 1682 GPIO_FN(DACK1),
1679 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 1683 GPIO_FN(DREQ1),
1680 1684
1681 /* ADC */ 1685 /* ADC */
1682 PINMUX_GPIO(GPIO_FN_ADTRG, ADTRG_MARK), 1686 GPIO_FN(ADTRG),
1683 1687
1684 /* BSCh */ 1688 /* BSCh */
1685 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 1689 GPIO_FN(A25),
1686 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 1690 GPIO_FN(A24),
1687 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1691 GPIO_FN(A23),
1688 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1692 GPIO_FN(A22),
1689 PINMUX_GPIO(GPIO_FN_A21, A21_MARK), 1693 GPIO_FN(A21),
1690 PINMUX_GPIO(GPIO_FN_A20, A20_MARK), 1694 GPIO_FN(A20),
1691 PINMUX_GPIO(GPIO_FN_A19, A19_MARK), 1695 GPIO_FN(A19),
1692 PINMUX_GPIO(GPIO_FN_A18, A18_MARK), 1696 GPIO_FN(A18),
1693 PINMUX_GPIO(GPIO_FN_A17, A17_MARK), 1697 GPIO_FN(A17),
1694 PINMUX_GPIO(GPIO_FN_A16, A16_MARK), 1698 GPIO_FN(A16),
1695 PINMUX_GPIO(GPIO_FN_A15, A15_MARK), 1699 GPIO_FN(A15),
1696 PINMUX_GPIO(GPIO_FN_A14, A14_MARK), 1700 GPIO_FN(A14),
1697 PINMUX_GPIO(GPIO_FN_A13, A13_MARK), 1701 GPIO_FN(A13),
1698 PINMUX_GPIO(GPIO_FN_A12, A12_MARK), 1702 GPIO_FN(A12),
1699 PINMUX_GPIO(GPIO_FN_A11, A11_MARK), 1703 GPIO_FN(A11),
1700 PINMUX_GPIO(GPIO_FN_A10, A10_MARK), 1704 GPIO_FN(A10),
1701 PINMUX_GPIO(GPIO_FN_A9, A9_MARK), 1705 GPIO_FN(A9),
1702 PINMUX_GPIO(GPIO_FN_A8, A8_MARK), 1706 GPIO_FN(A8),
1703 PINMUX_GPIO(GPIO_FN_A7, A7_MARK), 1707 GPIO_FN(A7),
1704 PINMUX_GPIO(GPIO_FN_A6, A6_MARK), 1708 GPIO_FN(A6),
1705 PINMUX_GPIO(GPIO_FN_A5, A5_MARK), 1709 GPIO_FN(A5),
1706 PINMUX_GPIO(GPIO_FN_A4, A4_MARK), 1710 GPIO_FN(A4),
1707 PINMUX_GPIO(GPIO_FN_A3, A3_MARK), 1711 GPIO_FN(A3),
1708 PINMUX_GPIO(GPIO_FN_A2, A2_MARK), 1712 GPIO_FN(A2),
1709 PINMUX_GPIO(GPIO_FN_A1, A1_MARK), 1713 GPIO_FN(A1),
1710 PINMUX_GPIO(GPIO_FN_A0, A0_MARK), 1714 GPIO_FN(A0),
1711 1715
1712 PINMUX_GPIO(GPIO_FN_D15, D15_MARK), 1716 GPIO_FN(D15),
1713 PINMUX_GPIO(GPIO_FN_D14, D14_MARK), 1717 GPIO_FN(D14),
1714 PINMUX_GPIO(GPIO_FN_D13, D13_MARK), 1718 GPIO_FN(D13),
1715 PINMUX_GPIO(GPIO_FN_D12, D12_MARK), 1719 GPIO_FN(D12),
1716 PINMUX_GPIO(GPIO_FN_D11, D11_MARK), 1720 GPIO_FN(D11),
1717 PINMUX_GPIO(GPIO_FN_D10, D10_MARK), 1721 GPIO_FN(D10),
1718 PINMUX_GPIO(GPIO_FN_D9, D9_MARK), 1722 GPIO_FN(D9),
1719 PINMUX_GPIO(GPIO_FN_D8, D8_MARK), 1723 GPIO_FN(D8),
1720 PINMUX_GPIO(GPIO_FN_D7, D7_MARK), 1724 GPIO_FN(D7),
1721 PINMUX_GPIO(GPIO_FN_D6, D6_MARK), 1725 GPIO_FN(D6),
1722 PINMUX_GPIO(GPIO_FN_D5, D5_MARK), 1726 GPIO_FN(D5),
1723 PINMUX_GPIO(GPIO_FN_D4, D4_MARK), 1727 GPIO_FN(D4),
1724 PINMUX_GPIO(GPIO_FN_D3, D3_MARK), 1728 GPIO_FN(D3),
1725 PINMUX_GPIO(GPIO_FN_D2, D2_MARK), 1729 GPIO_FN(D2),
1726 PINMUX_GPIO(GPIO_FN_D1, D1_MARK), 1730 GPIO_FN(D1),
1727 PINMUX_GPIO(GPIO_FN_D0, D0_MARK), 1731 GPIO_FN(D0),
1728 1732
1729 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1733 GPIO_FN(BS),
1730 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK), 1734 GPIO_FN(CS4),
1731 PINMUX_GPIO(GPIO_FN_CS3, CS3_MARK), 1735 GPIO_FN(CS3),
1732 PINMUX_GPIO(GPIO_FN_CS2, CS2_MARK), 1736 GPIO_FN(CS2),
1733 PINMUX_GPIO(GPIO_FN_CS1, CS1_MARK), 1737 GPIO_FN(CS1),
1734 PINMUX_GPIO(GPIO_FN_CS0, CS0_MARK), 1738 GPIO_FN(CS0),
1735 PINMUX_GPIO(GPIO_FN_CS5CE1A, CS5CE1A_MARK), 1739 GPIO_FN(CS5CE1A),
1736 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK), 1740 GPIO_FN(CE2A),
1737 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK), 1741 GPIO_FN(CE2B),
1738 PINMUX_GPIO(GPIO_FN_RD, RD_MARK), 1742 GPIO_FN(RD),
1739 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK), 1743 GPIO_FN(RDWR),
1740 PINMUX_GPIO(GPIO_FN_WE3ICIOWRAHDQMUU, WE3ICIOWRAHDQMUU_MARK), 1744 GPIO_FN(WE3ICIOWRAHDQMUU),
1741 PINMUX_GPIO(GPIO_FN_WE2ICIORDDQMUL, WE2ICIORDDQMUL_MARK), 1745 GPIO_FN(WE2ICIORDDQMUL),
1742 PINMUX_GPIO(GPIO_FN_WE1DQMUWE, WE1DQMUWE_MARK), 1746 GPIO_FN(WE1DQMUWE),
1743 PINMUX_GPIO(GPIO_FN_WE0DQML, WE0DQML_MARK), 1747 GPIO_FN(WE0DQML),
1744 PINMUX_GPIO(GPIO_FN_RAS, RAS_MARK), 1748 GPIO_FN(RAS),
1745 PINMUX_GPIO(GPIO_FN_CAS, CAS_MARK), 1749 GPIO_FN(CAS),
1746 PINMUX_GPIO(GPIO_FN_CKE, CKE_MARK), 1750 GPIO_FN(CKE),
1747 PINMUX_GPIO(GPIO_FN_WAIT, WAIT_MARK), 1751 GPIO_FN(WAIT),
1748 PINMUX_GPIO(GPIO_FN_BREQ, BREQ_MARK), 1752 GPIO_FN(BREQ),
1749 PINMUX_GPIO(GPIO_FN_BACK, BACK_MARK), 1753 GPIO_FN(BACK),
1750 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 1754 GPIO_FN(IOIS16),
1751 1755
1752 /* TMU */ 1756 /* TMU */
1753 PINMUX_GPIO(GPIO_FN_TIOC4D, TIOC4D_MARK), 1757 GPIO_FN(TIOC4D),
1754 PINMUX_GPIO(GPIO_FN_TIOC4C, TIOC4C_MARK), 1758 GPIO_FN(TIOC4C),
1755 PINMUX_GPIO(GPIO_FN_TIOC4B, TIOC4B_MARK), 1759 GPIO_FN(TIOC4B),
1756 PINMUX_GPIO(GPIO_FN_TIOC4A, TIOC4A_MARK), 1760 GPIO_FN(TIOC4A),
1757 PINMUX_GPIO(GPIO_FN_TIOC3D, TIOC3D_MARK), 1761 GPIO_FN(TIOC3D),
1758 PINMUX_GPIO(GPIO_FN_TIOC3C, TIOC3C_MARK), 1762 GPIO_FN(TIOC3C),
1759 PINMUX_GPIO(GPIO_FN_TIOC3B, TIOC3B_MARK), 1763 GPIO_FN(TIOC3B),
1760 PINMUX_GPIO(GPIO_FN_TIOC3A, TIOC3A_MARK), 1764 GPIO_FN(TIOC3A),
1761 PINMUX_GPIO(GPIO_FN_TIOC2B, TIOC2B_MARK), 1765 GPIO_FN(TIOC2B),
1762 PINMUX_GPIO(GPIO_FN_TIOC1B, TIOC1B_MARK), 1766 GPIO_FN(TIOC1B),
1763 PINMUX_GPIO(GPIO_FN_TIOC2A, TIOC2A_MARK), 1767 GPIO_FN(TIOC2A),
1764 PINMUX_GPIO(GPIO_FN_TIOC1A, TIOC1A_MARK), 1768 GPIO_FN(TIOC1A),
1765 PINMUX_GPIO(GPIO_FN_TIOC0D, TIOC0D_MARK), 1769 GPIO_FN(TIOC0D),
1766 PINMUX_GPIO(GPIO_FN_TIOC0C, TIOC0C_MARK), 1770 GPIO_FN(TIOC0C),
1767 PINMUX_GPIO(GPIO_FN_TIOC0B, TIOC0B_MARK), 1771 GPIO_FN(TIOC0B),
1768 PINMUX_GPIO(GPIO_FN_TIOC0A, TIOC0A_MARK), 1772 GPIO_FN(TIOC0A),
1769 PINMUX_GPIO(GPIO_FN_TCLKD, TCLKD_MARK), 1773 GPIO_FN(TCLKD),
1770 PINMUX_GPIO(GPIO_FN_TCLKC, TCLKC_MARK), 1774 GPIO_FN(TCLKC),
1771 PINMUX_GPIO(GPIO_FN_TCLKB, TCLKB_MARK), 1775 GPIO_FN(TCLKB),
1772 PINMUX_GPIO(GPIO_FN_TCLKA, TCLKA_MARK), 1776 GPIO_FN(TCLKA),
1773 1777
1774 /* SCIF */ 1778 /* SCIF */
1775 PINMUX_GPIO(GPIO_FN_SCK0, SCK0_MARK), 1779 GPIO_FN(SCK0),
1776 PINMUX_GPIO(GPIO_FN_TXD0, TXD0_MARK), 1780 GPIO_FN(TXD0),
1777 PINMUX_GPIO(GPIO_FN_RXD0, RXD0_MARK), 1781 GPIO_FN(RXD0),
1778 PINMUX_GPIO(GPIO_FN_SCK1, SCK1_MARK), 1782 GPIO_FN(SCK1),
1779 PINMUX_GPIO(GPIO_FN_TXD1, TXD1_MARK), 1783 GPIO_FN(TXD1),
1780 PINMUX_GPIO(GPIO_FN_RXD1, RXD1_MARK), 1784 GPIO_FN(RXD1),
1781 PINMUX_GPIO(GPIO_FN_RTS1, RTS1_MARK), 1785 GPIO_FN(RTS1),
1782 PINMUX_GPIO(GPIO_FN_CTS1, CTS1_MARK), 1786 GPIO_FN(CTS1),
1783 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK), 1787 GPIO_FN(SCK2),
1784 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK), 1788 GPIO_FN(TXD2),
1785 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK), 1789 GPIO_FN(RXD2),
1786 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK), 1790 GPIO_FN(SCK3),
1787 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK), 1791 GPIO_FN(TXD3),
1788 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK), 1792 GPIO_FN(RXD3),
1789 PINMUX_GPIO(GPIO_FN_SCK4, SCK4_MARK), 1793 GPIO_FN(SCK4),
1790 PINMUX_GPIO(GPIO_FN_TXD4, TXD4_MARK), 1794 GPIO_FN(TXD4),
1791 PINMUX_GPIO(GPIO_FN_RXD4, RXD4_MARK), 1795 GPIO_FN(RXD4),
1792 PINMUX_GPIO(GPIO_FN_SCK5, SCK5_MARK), 1796 GPIO_FN(SCK5),
1793 PINMUX_GPIO(GPIO_FN_TXD5, TXD5_MARK), 1797 GPIO_FN(TXD5),
1794 PINMUX_GPIO(GPIO_FN_RXD5, RXD5_MARK), 1798 GPIO_FN(RXD5),
1795 PINMUX_GPIO(GPIO_FN_RTS5, RTS5_MARK), 1799 GPIO_FN(RTS5),
1796 PINMUX_GPIO(GPIO_FN_CTS5, CTS5_MARK), 1800 GPIO_FN(CTS5),
1797 PINMUX_GPIO(GPIO_FN_SCK6, SCK6_MARK), 1801 GPIO_FN(SCK6),
1798 PINMUX_GPIO(GPIO_FN_TXD6, TXD6_MARK), 1802 GPIO_FN(TXD6),
1799 PINMUX_GPIO(GPIO_FN_RXD6, RXD6_MARK), 1803 GPIO_FN(RXD6),
1800 PINMUX_GPIO(GPIO_FN_SCK7, SCK7_MARK), 1804 GPIO_FN(SCK7),
1801 PINMUX_GPIO(GPIO_FN_TXD7, TXD7_MARK), 1805 GPIO_FN(TXD7),
1802 PINMUX_GPIO(GPIO_FN_RXD7, RXD7_MARK), 1806 GPIO_FN(RXD7),
1803 PINMUX_GPIO(GPIO_FN_RTS7, RTS7_MARK), 1807 GPIO_FN(RTS7),
1804 PINMUX_GPIO(GPIO_FN_CTS7, CTS7_MARK), 1808 GPIO_FN(CTS7),
1805 1809
1806 /* RSPI */ 1810 /* RSPI */
1807 PINMUX_GPIO(GPIO_FN_RSPCK0_PJ16, RSPCK0_PJ16_MARK), 1811 GPIO_FN(RSPCK0_PJ16),
1808 PINMUX_GPIO(GPIO_FN_SSL00_PJ17, SSL00_PJ17_MARK), 1812 GPIO_FN(SSL00_PJ17),
1809 PINMUX_GPIO(GPIO_FN_MOSI0_PJ18, MOSI0_PJ18_MARK), 1813 GPIO_FN(MOSI0_PJ18),
1810 PINMUX_GPIO(GPIO_FN_MISO0_PJ19, MISO0_PJ19_MARK), 1814 GPIO_FN(MISO0_PJ19),
1811 PINMUX_GPIO(GPIO_FN_RSPCK0_PB17, RSPCK0_PB17_MARK), 1815 GPIO_FN(RSPCK0_PB17),
1812 PINMUX_GPIO(GPIO_FN_SSL00_PB18, SSL00_PB18_MARK), 1816 GPIO_FN(SSL00_PB18),
1813 PINMUX_GPIO(GPIO_FN_MOSI0_PB19, MOSI0_PB19_MARK), 1817 GPIO_FN(MOSI0_PB19),
1814 PINMUX_GPIO(GPIO_FN_MISO0_PB20, MISO0_PB20_MARK), 1818 GPIO_FN(MISO0_PB20),
1815 PINMUX_GPIO(GPIO_FN_RSPCK1, RSPCK1_MARK), 1819 GPIO_FN(RSPCK1),
1816 PINMUX_GPIO(GPIO_FN_MOSI1, MOSI1_MARK), 1820 GPIO_FN(MOSI1),
1817 PINMUX_GPIO(GPIO_FN_MISO1, MISO1_MARK), 1821 GPIO_FN(MISO1),
1818 PINMUX_GPIO(GPIO_FN_SSL10, SSL10_MARK), 1822 GPIO_FN(SSL10),
1819 1823
1820 /* IIC3 */ 1824 /* IIC3 */
1821 PINMUX_GPIO(GPIO_FN_SCL0, SCL0_MARK), 1825 GPIO_FN(SCL0),
1822 PINMUX_GPIO(GPIO_FN_SCL1, SCL1_MARK), 1826 GPIO_FN(SCL1),
1823 PINMUX_GPIO(GPIO_FN_SCL2, SCL2_MARK), 1827 GPIO_FN(SCL2),
1824 PINMUX_GPIO(GPIO_FN_SDA0, SDA0_MARK), 1828 GPIO_FN(SDA0),
1825 PINMUX_GPIO(GPIO_FN_SDA1, SDA1_MARK), 1829 GPIO_FN(SDA1),
1826 PINMUX_GPIO(GPIO_FN_SDA2, SDA2_MARK), 1830 GPIO_FN(SDA2),
1827 1831
1828 /* SSI */ 1832 /* SSI */
1829 PINMUX_GPIO(GPIO_FN_SSISCK0, SSISCK0_MARK), 1833 GPIO_FN(SSISCK0),
1830 PINMUX_GPIO(GPIO_FN_SSIWS0, SSIWS0_MARK), 1834 GPIO_FN(SSIWS0),
1831 PINMUX_GPIO(GPIO_FN_SSITXD0, SSITXD0_MARK), 1835 GPIO_FN(SSITXD0),
1832 PINMUX_GPIO(GPIO_FN_SSIRXD0, SSIRXD0_MARK), 1836 GPIO_FN(SSIRXD0),
1833 PINMUX_GPIO(GPIO_FN_SSIWS1, SSIWS1_MARK), 1837 GPIO_FN(SSIWS1),
1834 PINMUX_GPIO(GPIO_FN_SSIWS2, SSIWS2_MARK), 1838 GPIO_FN(SSIWS2),
1835 PINMUX_GPIO(GPIO_FN_SSIWS3, SSIWS3_MARK), 1839 GPIO_FN(SSIWS3),
1836 PINMUX_GPIO(GPIO_FN_SSISCK1, SSISCK1_MARK), 1840 GPIO_FN(SSISCK1),
1837 PINMUX_GPIO(GPIO_FN_SSISCK2, SSISCK2_MARK), 1841 GPIO_FN(SSISCK2),
1838 PINMUX_GPIO(GPIO_FN_SSISCK3, SSISCK3_MARK), 1842 GPIO_FN(SSISCK3),
1839 PINMUX_GPIO(GPIO_FN_SSIDATA1, SSIDATA1_MARK), 1843 GPIO_FN(SSIDATA1),
1840 PINMUX_GPIO(GPIO_FN_SSIDATA2, SSIDATA2_MARK), 1844 GPIO_FN(SSIDATA2),
1841 PINMUX_GPIO(GPIO_FN_SSIDATA3, SSIDATA3_MARK), 1845 GPIO_FN(SSIDATA3),
1842 PINMUX_GPIO(GPIO_FN_AUDIO_CLK, AUDIO_CLK_MARK), 1846 GPIO_FN(AUDIO_CLK),
1843 PINMUX_GPIO(GPIO_FN_AUDIO_XOUT, AUDIO_XOUT_MARK), 1847 GPIO_FN(AUDIO_XOUT),
1844 1848
1845 /* SIOF */ /* NOTE Shares AUDIO_CLK with SSI */ 1849 /* SIOF */ /* NOTE Shares AUDIO_CLK with SSI */
1846 PINMUX_GPIO(GPIO_FN_SIOFTXD, SIOFTXD_MARK), 1850 GPIO_FN(SIOFTXD),
1847 PINMUX_GPIO(GPIO_FN_SIOFRXD, SIOFRXD_MARK), 1851 GPIO_FN(SIOFRXD),
1848 PINMUX_GPIO(GPIO_FN_SIOFSYNC, SIOFSYNC_MARK), 1852 GPIO_FN(SIOFSYNC),
1849 PINMUX_GPIO(GPIO_FN_SIOFSCK, SIOFSCK_MARK), 1853 GPIO_FN(SIOFSCK),
1850 1854
1851 /* SPDIF */ /* NOTE Shares AUDIO_CLK with SSI */ 1855 /* SPDIF */ /* NOTE Shares AUDIO_CLK with SSI */
1852 PINMUX_GPIO(GPIO_FN_SPDIF_IN, SPDIF_IN_MARK), 1856 GPIO_FN(SPDIF_IN),
1853 PINMUX_GPIO(GPIO_FN_SPDIF_OUT, SPDIF_OUT_MARK), 1857 GPIO_FN(SPDIF_OUT),
1854 1858
1855 /* NANDFMC */ /* NOTE Controller is not available in boot mode 0 */ 1859 /* NANDFMC */ /* NOTE Controller is not available in boot mode 0 */
1856 PINMUX_GPIO(GPIO_FN_FCE, FCE_MARK), 1860 GPIO_FN(FCE),
1857 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 1861 GPIO_FN(FRB),
1858 1862
1859 /* VDC3 */ 1863 /* VDC3 */
1860 PINMUX_GPIO(GPIO_FN_DV_CLK, DV_CLK_MARK), 1864 GPIO_FN(DV_CLK),
1861 PINMUX_GPIO(GPIO_FN_DV_VSYNC, DV_VSYNC_MARK), 1865 GPIO_FN(DV_VSYNC),
1862 PINMUX_GPIO(GPIO_FN_DV_HSYNC, DV_HSYNC_MARK), 1866 GPIO_FN(DV_HSYNC),
1863 1867
1864 PINMUX_GPIO(GPIO_FN_DV_DATA23, DV_DATA23_MARK), 1868 GPIO_FN(DV_DATA23),
1865 PINMUX_GPIO(GPIO_FN_DV_DATA22, DV_DATA22_MARK), 1869 GPIO_FN(DV_DATA22),
1866 PINMUX_GPIO(GPIO_FN_DV_DATA21, DV_DATA21_MARK), 1870 GPIO_FN(DV_DATA21),
1867 PINMUX_GPIO(GPIO_FN_DV_DATA20, DV_DATA20_MARK), 1871 GPIO_FN(DV_DATA20),
1868 PINMUX_GPIO(GPIO_FN_DV_DATA19, DV_DATA19_MARK), 1872 GPIO_FN(DV_DATA19),
1869 PINMUX_GPIO(GPIO_FN_DV_DATA18, DV_DATA18_MARK), 1873 GPIO_FN(DV_DATA18),
1870 PINMUX_GPIO(GPIO_FN_DV_DATA17, DV_DATA17_MARK), 1874 GPIO_FN(DV_DATA17),
1871 PINMUX_GPIO(GPIO_FN_DV_DATA16, DV_DATA16_MARK), 1875 GPIO_FN(DV_DATA16),
1872 PINMUX_GPIO(GPIO_FN_DV_DATA15, DV_DATA15_MARK), 1876 GPIO_FN(DV_DATA15),
1873 PINMUX_GPIO(GPIO_FN_DV_DATA14, DV_DATA14_MARK), 1877 GPIO_FN(DV_DATA14),
1874 PINMUX_GPIO(GPIO_FN_DV_DATA13, DV_DATA13_MARK), 1878 GPIO_FN(DV_DATA13),
1875 PINMUX_GPIO(GPIO_FN_DV_DATA12, DV_DATA12_MARK), 1879 GPIO_FN(DV_DATA12),
1876 PINMUX_GPIO(GPIO_FN_DV_DATA11, DV_DATA11_MARK), 1880 GPIO_FN(DV_DATA11),
1877 PINMUX_GPIO(GPIO_FN_DV_DATA10, DV_DATA10_MARK), 1881 GPIO_FN(DV_DATA10),
1878 PINMUX_GPIO(GPIO_FN_DV_DATA9, DV_DATA9_MARK), 1882 GPIO_FN(DV_DATA9),
1879 PINMUX_GPIO(GPIO_FN_DV_DATA8, DV_DATA8_MARK), 1883 GPIO_FN(DV_DATA8),
1880 PINMUX_GPIO(GPIO_FN_DV_DATA7, DV_DATA7_MARK), 1884 GPIO_FN(DV_DATA7),
1881 PINMUX_GPIO(GPIO_FN_DV_DATA6, DV_DATA6_MARK), 1885 GPIO_FN(DV_DATA6),
1882 PINMUX_GPIO(GPIO_FN_DV_DATA5, DV_DATA5_MARK), 1886 GPIO_FN(DV_DATA5),
1883 PINMUX_GPIO(GPIO_FN_DV_DATA4, DV_DATA4_MARK), 1887 GPIO_FN(DV_DATA4),
1884 PINMUX_GPIO(GPIO_FN_DV_DATA3, DV_DATA3_MARK), 1888 GPIO_FN(DV_DATA3),
1885 PINMUX_GPIO(GPIO_FN_DV_DATA2, DV_DATA2_MARK), 1889 GPIO_FN(DV_DATA2),
1886 PINMUX_GPIO(GPIO_FN_DV_DATA1, DV_DATA1_MARK), 1890 GPIO_FN(DV_DATA1),
1887 PINMUX_GPIO(GPIO_FN_DV_DATA0, DV_DATA0_MARK), 1891 GPIO_FN(DV_DATA0),
1888 1892
1889 PINMUX_GPIO(GPIO_FN_LCD_CLK, LCD_CLK_MARK), 1893 GPIO_FN(LCD_CLK),
1890 PINMUX_GPIO(GPIO_FN_LCD_EXTCLK, LCD_EXTCLK_MARK), 1894 GPIO_FN(LCD_EXTCLK),
1891 PINMUX_GPIO(GPIO_FN_LCD_VSYNC, LCD_VSYNC_MARK), 1895 GPIO_FN(LCD_VSYNC),
1892 PINMUX_GPIO(GPIO_FN_LCD_HSYNC, LCD_HSYNC_MARK), 1896 GPIO_FN(LCD_HSYNC),
1893 PINMUX_GPIO(GPIO_FN_LCD_DE, LCD_DE_MARK), 1897 GPIO_FN(LCD_DE),
1894 1898
1895 PINMUX_GPIO(GPIO_FN_LCD_DATA23_PG23, LCD_DATA23_PG23_MARK), 1899 GPIO_FN(LCD_DATA23_PG23),
1896 PINMUX_GPIO(GPIO_FN_LCD_DATA22_PG22, LCD_DATA22_PG22_MARK), 1900 GPIO_FN(LCD_DATA22_PG22),
1897 PINMUX_GPIO(GPIO_FN_LCD_DATA21_PG21, LCD_DATA21_PG21_MARK), 1901 GPIO_FN(LCD_DATA21_PG21),
1898 PINMUX_GPIO(GPIO_FN_LCD_DATA20_PG20, LCD_DATA20_PG20_MARK), 1902 GPIO_FN(LCD_DATA20_PG20),
1899 PINMUX_GPIO(GPIO_FN_LCD_DATA19_PG19, LCD_DATA19_PG19_MARK), 1903 GPIO_FN(LCD_DATA19_PG19),
1900 PINMUX_GPIO(GPIO_FN_LCD_DATA18_PG18, LCD_DATA18_PG18_MARK), 1904 GPIO_FN(LCD_DATA18_PG18),
1901 PINMUX_GPIO(GPIO_FN_LCD_DATA17_PG17, LCD_DATA17_PG17_MARK), 1905 GPIO_FN(LCD_DATA17_PG17),
1902 PINMUX_GPIO(GPIO_FN_LCD_DATA16_PG16, LCD_DATA16_PG16_MARK), 1906 GPIO_FN(LCD_DATA16_PG16),
1903 PINMUX_GPIO(GPIO_FN_LCD_DATA15_PG15, LCD_DATA15_PG15_MARK), 1907 GPIO_FN(LCD_DATA15_PG15),
1904 PINMUX_GPIO(GPIO_FN_LCD_DATA14_PG14, LCD_DATA14_PG14_MARK), 1908 GPIO_FN(LCD_DATA14_PG14),
1905 PINMUX_GPIO(GPIO_FN_LCD_DATA13_PG13, LCD_DATA13_PG13_MARK), 1909 GPIO_FN(LCD_DATA13_PG13),
1906 PINMUX_GPIO(GPIO_FN_LCD_DATA12_PG12, LCD_DATA12_PG12_MARK), 1910 GPIO_FN(LCD_DATA12_PG12),
1907 PINMUX_GPIO(GPIO_FN_LCD_DATA11_PG11, LCD_DATA11_PG11_MARK), 1911 GPIO_FN(LCD_DATA11_PG11),
1908 PINMUX_GPIO(GPIO_FN_LCD_DATA10_PG10, LCD_DATA10_PG10_MARK), 1912 GPIO_FN(LCD_DATA10_PG10),
1909 PINMUX_GPIO(GPIO_FN_LCD_DATA9_PG9, LCD_DATA9_PG9_MARK), 1913 GPIO_FN(LCD_DATA9_PG9),
1910 PINMUX_GPIO(GPIO_FN_LCD_DATA8_PG8, LCD_DATA8_PG8_MARK), 1914 GPIO_FN(LCD_DATA8_PG8),
1911 PINMUX_GPIO(GPIO_FN_LCD_DATA7_PG7, LCD_DATA7_PG7_MARK), 1915 GPIO_FN(LCD_DATA7_PG7),
1912 PINMUX_GPIO(GPIO_FN_LCD_DATA6_PG6, LCD_DATA6_PG6_MARK), 1916 GPIO_FN(LCD_DATA6_PG6),
1913 PINMUX_GPIO(GPIO_FN_LCD_DATA5_PG5, LCD_DATA5_PG5_MARK), 1917 GPIO_FN(LCD_DATA5_PG5),
1914 PINMUX_GPIO(GPIO_FN_LCD_DATA4_PG4, LCD_DATA4_PG4_MARK), 1918 GPIO_FN(LCD_DATA4_PG4),
1915 PINMUX_GPIO(GPIO_FN_LCD_DATA3_PG3, LCD_DATA3_PG3_MARK), 1919 GPIO_FN(LCD_DATA3_PG3),
1916 PINMUX_GPIO(GPIO_FN_LCD_DATA2_PG2, LCD_DATA2_PG2_MARK), 1920 GPIO_FN(LCD_DATA2_PG2),
1917 PINMUX_GPIO(GPIO_FN_LCD_DATA1_PG1, LCD_DATA1_PG1_MARK), 1921 GPIO_FN(LCD_DATA1_PG1),
1918 PINMUX_GPIO(GPIO_FN_LCD_DATA0_PG0, LCD_DATA0_PG0_MARK), 1922 GPIO_FN(LCD_DATA0_PG0),
1919 1923
1920 PINMUX_GPIO(GPIO_FN_LCD_DATA23_PJ23, LCD_DATA23_PJ23_MARK), 1924 GPIO_FN(LCD_DATA23_PJ23),
1921 PINMUX_GPIO(GPIO_FN_LCD_DATA22_PJ22, LCD_DATA22_PJ22_MARK), 1925 GPIO_FN(LCD_DATA22_PJ22),
1922 PINMUX_GPIO(GPIO_FN_LCD_DATA21_PJ21, LCD_DATA21_PJ21_MARK), 1926 GPIO_FN(LCD_DATA21_PJ21),
1923 PINMUX_GPIO(GPIO_FN_LCD_DATA20_PJ20, LCD_DATA20_PJ20_MARK), 1927 GPIO_FN(LCD_DATA20_PJ20),
1924 PINMUX_GPIO(GPIO_FN_LCD_DATA19_PJ19, LCD_DATA19_PJ19_MARK), 1928 GPIO_FN(LCD_DATA19_PJ19),
1925 PINMUX_GPIO(GPIO_FN_LCD_DATA18_PJ18, LCD_DATA18_PJ18_MARK), 1929 GPIO_FN(LCD_DATA18_PJ18),
1926 PINMUX_GPIO(GPIO_FN_LCD_DATA17_PJ17, LCD_DATA17_PJ17_MARK), 1930 GPIO_FN(LCD_DATA17_PJ17),
1927 PINMUX_GPIO(GPIO_FN_LCD_DATA16_PJ16, LCD_DATA16_PJ16_MARK), 1931 GPIO_FN(LCD_DATA16_PJ16),
1928 PINMUX_GPIO(GPIO_FN_LCD_DATA15_PJ15, LCD_DATA15_PJ15_MARK), 1932 GPIO_FN(LCD_DATA15_PJ15),
1929 PINMUX_GPIO(GPIO_FN_LCD_DATA14_PJ14, LCD_DATA14_PJ14_MARK), 1933 GPIO_FN(LCD_DATA14_PJ14),
1930 PINMUX_GPIO(GPIO_FN_LCD_DATA13_PJ13, LCD_DATA13_PJ13_MARK), 1934 GPIO_FN(LCD_DATA13_PJ13),
1931 PINMUX_GPIO(GPIO_FN_LCD_DATA12_PJ12, LCD_DATA12_PJ12_MARK), 1935 GPIO_FN(LCD_DATA12_PJ12),
1932 PINMUX_GPIO(GPIO_FN_LCD_DATA11_PJ11, LCD_DATA11_PJ11_MARK), 1936 GPIO_FN(LCD_DATA11_PJ11),
1933 PINMUX_GPIO(GPIO_FN_LCD_DATA10_PJ10, LCD_DATA10_PJ10_MARK), 1937 GPIO_FN(LCD_DATA10_PJ10),
1934 PINMUX_GPIO(GPIO_FN_LCD_DATA9_PJ9, LCD_DATA9_PJ9_MARK), 1938 GPIO_FN(LCD_DATA9_PJ9),
1935 PINMUX_GPIO(GPIO_FN_LCD_DATA8_PJ8, LCD_DATA8_PJ8_MARK), 1939 GPIO_FN(LCD_DATA8_PJ8),
1936 PINMUX_GPIO(GPIO_FN_LCD_DATA7_PJ7, LCD_DATA7_PJ7_MARK), 1940 GPIO_FN(LCD_DATA7_PJ7),
1937 PINMUX_GPIO(GPIO_FN_LCD_DATA6_PJ6, LCD_DATA6_PJ6_MARK), 1941 GPIO_FN(LCD_DATA6_PJ6),
1938 PINMUX_GPIO(GPIO_FN_LCD_DATA5_PJ5, LCD_DATA5_PJ5_MARK), 1942 GPIO_FN(LCD_DATA5_PJ5),
1939 PINMUX_GPIO(GPIO_FN_LCD_DATA4_PJ4, LCD_DATA4_PJ4_MARK), 1943 GPIO_FN(LCD_DATA4_PJ4),
1940 PINMUX_GPIO(GPIO_FN_LCD_DATA3_PJ3, LCD_DATA3_PJ3_MARK), 1944 GPIO_FN(LCD_DATA3_PJ3),
1941 PINMUX_GPIO(GPIO_FN_LCD_DATA2_PJ2, LCD_DATA2_PJ2_MARK), 1945 GPIO_FN(LCD_DATA2_PJ2),
1942 PINMUX_GPIO(GPIO_FN_LCD_DATA1_PJ1, LCD_DATA1_PJ1_MARK), 1946 GPIO_FN(LCD_DATA1_PJ1),
1943 PINMUX_GPIO(GPIO_FN_LCD_DATA0_PJ0, LCD_DATA0_PJ0_MARK), 1947 GPIO_FN(LCD_DATA0_PJ0),
1944 1948
1945 PINMUX_GPIO(GPIO_FN_LCD_M_DISP, LCD_M_DISP_MARK), 1949 GPIO_FN(LCD_M_DISP),
1946}; 1950};
1947 1951
1948static struct pinmux_cfg_reg pinmux_config_regs[] = { 1952static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1949 /* "name" addr register_size Field_Width */ 1953 /* "name" addr register_size Field_Width */
1950 1954
1951 /* where Field_Width is 1 for single mode registers or 4 for upto 16 1955 /* where Field_Width is 1 for single mode registers or 4 for upto 16
@@ -2734,7 +2738,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2734 {} 2738 {}
2735}; 2739};
2736 2740
2737static struct pinmux_data_reg pinmux_data_regs[] = { 2741static const struct pinmux_data_reg pinmux_data_regs[] = {
2738 { PINMUX_DATA_REG("PADR0", 0xfffe3816, 16) { 2742 { PINMUX_DATA_REG("PADR0", 0xfffe3816, 16) {
2739 0, 0, 0, 0, 0, 0, 0, PA1_DATA, 2743 0, 0, 0, 0, 0, 0, 0, PA1_DATA,
2740 0, 0, 0, 0, 0, 0, 0, PA0_DATA } 2744 0, 0, 0, 0, 0, 0, 0, PA0_DATA }
@@ -2813,19 +2817,17 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2813 { } 2817 { }
2814}; 2818};
2815 2819
2816struct sh_pfc_soc_info sh7269_pinmux_info = { 2820const struct sh_pfc_soc_info sh7269_pinmux_info = {
2817 .name = "sh7269_pfc", 2821 .name = "sh7269_pfc",
2818 .reserved_id = PINMUX_RESERVED,
2819 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
2820 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN }, 2822 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END, FORCE_IN },
2821 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, 2823 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT },
2822 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2823 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 2824 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2824 2825
2825 .first_gpio = GPIO_PA1, 2826 .pins = pinmux_pins,
2826 .last_gpio = GPIO_FN_LCD_M_DISP, 2827 .nr_pins = ARRAY_SIZE(pinmux_pins),
2828 .func_gpios = pinmux_func_gpios,
2829 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2827 2830
2828 .gpios = pinmux_gpios,
2829 .cfg_regs = pinmux_config_regs, 2831 .cfg_regs = pinmux_config_regs,
2830 .data_regs = pinmux_data_regs, 2832 .data_regs = pinmux_data_regs,
2831 2833
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7372.c b/drivers/pinctrl/sh-pfc/pfc-sh7372.c
index d44e7f02069b..df0ae21a5ac8 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7372.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7372.c
@@ -368,7 +368,7 @@ enum {
368 PINMUX_MARK_END, 368 PINMUX_MARK_END,
369}; 369};
370 370
371static pinmux_enum_t pinmux_data[] = { 371static const pinmux_enum_t pinmux_data[] = {
372 372
373 /* specify valid pin states for each pin in GPIO mode */ 373 /* specify valid pin states for each pin in GPIO mode */
374 PORT_DATA_IO_PD(0), PORT_DATA_IO_PD(1), 374 PORT_DATA_IO_PD(0), PORT_DATA_IO_PD(1),
@@ -929,11 +929,214 @@ static pinmux_enum_t pinmux_data[] = {
929 PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1), 929 PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1),
930}; 930};
931 931
932static struct pinmux_gpio pinmux_gpios[] = { 932static struct sh_pfc_pin pinmux_pins[] = {
933
934 /* PORT */
935 GPIO_PORT_ALL(), 933 GPIO_PORT_ALL(),
934};
936 935
936/* - MMCIF ------------------------------------------------------------------ */
937static const unsigned int mmc0_data1_0_pins[] = {
938 /* D[0] */
939 84,
940};
941static const unsigned int mmc0_data1_0_mux[] = {
942 MMCD0_0_MARK,
943};
944static const unsigned int mmc0_data4_0_pins[] = {
945 /* D[0:3] */
946 84, 85, 86, 87,
947};
948static const unsigned int mmc0_data4_0_mux[] = {
949 MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
950};
951static const unsigned int mmc0_data8_0_pins[] = {
952 /* D[0:7] */
953 84, 85, 86, 87, 88, 89, 90, 91,
954};
955static const unsigned int mmc0_data8_0_mux[] = {
956 MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
957 MMCD0_4_MARK, MMCD0_5_MARK, MMCD0_6_MARK, MMCD0_7_MARK,
958};
959static const unsigned int mmc0_ctrl_0_pins[] = {
960 /* CMD, CLK */
961 92, 99,
962};
963static const unsigned int mmc0_ctrl_0_mux[] = {
964 MMCCMD0_MARK, MMCCLK0_MARK,
965};
966
967static const unsigned int mmc0_data1_1_pins[] = {
968 /* D[0] */
969 54,
970};
971static const unsigned int mmc0_data1_1_mux[] = {
972 MMCD1_0_MARK,
973};
974static const unsigned int mmc0_data4_1_pins[] = {
975 /* D[0:3] */
976 54, 55, 56, 57,
977};
978static const unsigned int mmc0_data4_1_mux[] = {
979 MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
980};
981static const unsigned int mmc0_data8_1_pins[] = {
982 /* D[0:7] */
983 54, 55, 56, 57, 58, 59, 60, 61,
984};
985static const unsigned int mmc0_data8_1_mux[] = {
986 MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
987 MMCD1_4_MARK, MMCD1_5_MARK, MMCD1_6_MARK, MMCD1_7_MARK,
988};
989static const unsigned int mmc0_ctrl_1_pins[] = {
990 /* CMD, CLK */
991 67, 66,
992};
993static const unsigned int mmc0_ctrl_1_mux[] = {
994 MMCCMD1_MARK, MMCCLK1_MARK,
995};
996/* - SDHI0 ------------------------------------------------------------------ */
997static const unsigned int sdhi0_data1_pins[] = {
998 /* D0 */
999 173,
1000};
1001static const unsigned int sdhi0_data1_mux[] = {
1002 SDHID0_0_MARK,
1003};
1004static const unsigned int sdhi0_data4_pins[] = {
1005 /* D[0:3] */
1006 173, 174, 175, 176,
1007};
1008static const unsigned int sdhi0_data4_mux[] = {
1009 SDHID0_0_MARK, SDHID0_1_MARK, SDHID0_2_MARK, SDHID0_3_MARK,
1010};
1011static const unsigned int sdhi0_ctrl_pins[] = {
1012 /* CMD, CLK */
1013 177, 171,
1014};
1015static const unsigned int sdhi0_ctrl_mux[] = {
1016 SDHICMD0_MARK, SDHICLK0_MARK,
1017};
1018static const unsigned int sdhi0_cd_pins[] = {
1019 /* CD */
1020 172,
1021};
1022static const unsigned int sdhi0_cd_mux[] = {
1023 SDHICD0_MARK,
1024};
1025static const unsigned int sdhi0_wp_pins[] = {
1026 /* WP */
1027 178,
1028};
1029static const unsigned int sdhi0_wp_mux[] = {
1030 SDHIWP0_MARK,
1031};
1032/* - SDHI1 ------------------------------------------------------------------ */
1033static const unsigned int sdhi1_data1_pins[] = {
1034 /* D0 */
1035 180,
1036};
1037static const unsigned int sdhi1_data1_mux[] = {
1038 SDHID1_0_MARK,
1039};
1040static const unsigned int sdhi1_data4_pins[] = {
1041 /* D[0:3] */
1042 180, 181, 182, 183,
1043};
1044static const unsigned int sdhi1_data4_mux[] = {
1045 SDHID1_0_MARK, SDHID1_1_MARK, SDHID1_2_MARK, SDHID1_3_MARK,
1046};
1047static const unsigned int sdhi1_ctrl_pins[] = {
1048 /* CMD, CLK */
1049 184, 179,
1050};
1051static const unsigned int sdhi1_ctrl_mux[] = {
1052 SDHICMD1_MARK, SDHICLK1_MARK,
1053};
1054
1055static const unsigned int sdhi2_data1_pins[] = {
1056 /* D0 */
1057 186,
1058};
1059static const unsigned int sdhi2_data1_mux[] = {
1060 SDHID2_0_MARK,
1061};
1062static const unsigned int sdhi2_data4_pins[] = {
1063 /* D[0:3] */
1064 186, 187, 188, 189,
1065};
1066static const unsigned int sdhi2_data4_mux[] = {
1067 SDHID2_0_MARK, SDHID2_1_MARK, SDHID2_2_MARK, SDHID2_3_MARK,
1068};
1069static const unsigned int sdhi2_ctrl_pins[] = {
1070 /* CMD, CLK */
1071 190, 185,
1072};
1073static const unsigned int sdhi2_ctrl_mux[] = {
1074 SDHICMD2_MARK, SDHICLK2_MARK,
1075};
1076
1077static const struct sh_pfc_pin_group pinmux_groups[] = {
1078 SH_PFC_PIN_GROUP(mmc0_data1_0),
1079 SH_PFC_PIN_GROUP(mmc0_data4_0),
1080 SH_PFC_PIN_GROUP(mmc0_data8_0),
1081 SH_PFC_PIN_GROUP(mmc0_ctrl_0),
1082 SH_PFC_PIN_GROUP(mmc0_data1_1),
1083 SH_PFC_PIN_GROUP(mmc0_data4_1),
1084 SH_PFC_PIN_GROUP(mmc0_data8_1),
1085 SH_PFC_PIN_GROUP(mmc0_ctrl_1),
1086 SH_PFC_PIN_GROUP(sdhi0_data1),
1087 SH_PFC_PIN_GROUP(sdhi0_data4),
1088 SH_PFC_PIN_GROUP(sdhi0_ctrl),
1089 SH_PFC_PIN_GROUP(sdhi0_cd),
1090 SH_PFC_PIN_GROUP(sdhi0_wp),
1091 SH_PFC_PIN_GROUP(sdhi1_data1),
1092 SH_PFC_PIN_GROUP(sdhi1_data4),
1093 SH_PFC_PIN_GROUP(sdhi1_ctrl),
1094 SH_PFC_PIN_GROUP(sdhi2_data1),
1095 SH_PFC_PIN_GROUP(sdhi2_data4),
1096 SH_PFC_PIN_GROUP(sdhi2_ctrl),
1097};
1098
1099static const char * const mmc0_groups[] = {
1100 "mmc0_data1_0",
1101 "mmc0_data4_0",
1102 "mmc0_data8_0",
1103 "mmc0_ctrl_0",
1104 "mmc0_data1_1",
1105 "mmc0_data4_1",
1106 "mmc0_data8_1",
1107 "mmc0_ctrl_1",
1108};
1109
1110static const char * const sdhi0_groups[] = {
1111 "sdhi0_data1",
1112 "sdhi0_data4",
1113 "sdhi0_ctrl",
1114 "sdhi0_cd",
1115 "sdhi0_wp",
1116};
1117
1118static const char * const sdhi1_groups[] = {
1119 "sdhi1_data1",
1120 "sdhi1_data4",
1121 "sdhi1_ctrl",
1122};
1123
1124static const char * const sdhi2_groups[] = {
1125 "sdhi2_data1",
1126 "sdhi2_data4",
1127 "sdhi2_ctrl",
1128};
1129
1130static const struct sh_pfc_function pinmux_functions[] = {
1131 SH_PFC_FUNCTION(mmc0),
1132 SH_PFC_FUNCTION(sdhi0),
1133 SH_PFC_FUNCTION(sdhi1),
1134 SH_PFC_FUNCTION(sdhi2),
1135};
1136
1137#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1138
1139static const struct pinmux_func pinmux_func_gpios[] = {
937 /* IRQ */ 1140 /* IRQ */
938 GPIO_FN(IRQ0_6), GPIO_FN(IRQ0_162), GPIO_FN(IRQ1), 1141 GPIO_FN(IRQ0_6), GPIO_FN(IRQ0_162), GPIO_FN(IRQ1),
939 GPIO_FN(IRQ2_4), GPIO_FN(IRQ2_5), GPIO_FN(IRQ3_8), 1142 GPIO_FN(IRQ2_4), GPIO_FN(IRQ2_5), GPIO_FN(IRQ3_8),
@@ -1074,18 +1277,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1074 GPIO_FN(D11_NAF11), GPIO_FN(D12_NAF12), GPIO_FN(D13_NAF13), 1277 GPIO_FN(D11_NAF11), GPIO_FN(D12_NAF12), GPIO_FN(D13_NAF13),
1075 GPIO_FN(D14_NAF14), GPIO_FN(D15_NAF15), 1278 GPIO_FN(D14_NAF14), GPIO_FN(D15_NAF15),
1076 1279
1077 /* MMCIF(1) */
1078 GPIO_FN(MMCD0_0), GPIO_FN(MMCD0_1), GPIO_FN(MMCD0_2),
1079 GPIO_FN(MMCD0_3), GPIO_FN(MMCD0_4), GPIO_FN(MMCD0_5),
1080 GPIO_FN(MMCD0_6), GPIO_FN(MMCD0_7), GPIO_FN(MMCCMD0),
1081 GPIO_FN(MMCCLK0),
1082
1083 /* MMCIF(2) */
1084 GPIO_FN(MMCD1_0), GPIO_FN(MMCD1_1), GPIO_FN(MMCD1_2),
1085 GPIO_FN(MMCD1_3), GPIO_FN(MMCD1_4), GPIO_FN(MMCD1_5),
1086 GPIO_FN(MMCD1_6), GPIO_FN(MMCD1_7), GPIO_FN(MMCCLK1),
1087 GPIO_FN(MMCCMD1),
1088
1089 /* SPU2 */ 1280 /* SPU2 */
1090 GPIO_FN(VINT_I), 1281 GPIO_FN(VINT_I),
1091 1282
@@ -1182,25 +1373,12 @@ static struct pinmux_gpio pinmux_gpios[] = {
1182 /* HDMI */ 1373 /* HDMI */
1183 GPIO_FN(HDMI_HPD), GPIO_FN(HDMI_CEC), 1374 GPIO_FN(HDMI_HPD), GPIO_FN(HDMI_CEC),
1184 1375
1185 /* SDHI0 */
1186 GPIO_FN(SDHICLK0), GPIO_FN(SDHICD0), GPIO_FN(SDHICMD0),
1187 GPIO_FN(SDHIWP0), GPIO_FN(SDHID0_0), GPIO_FN(SDHID0_1),
1188 GPIO_FN(SDHID0_2), GPIO_FN(SDHID0_3),
1189
1190 /* SDHI1 */
1191 GPIO_FN(SDHICLK1), GPIO_FN(SDHICMD1), GPIO_FN(SDHID1_0),
1192 GPIO_FN(SDHID1_1), GPIO_FN(SDHID1_2), GPIO_FN(SDHID1_3),
1193
1194 /* SDHI2 */
1195 GPIO_FN(SDHICLK2), GPIO_FN(SDHICMD2), GPIO_FN(SDHID2_0),
1196 GPIO_FN(SDHID2_1), GPIO_FN(SDHID2_2), GPIO_FN(SDHID2_3),
1197
1198 /* SDENC */ 1376 /* SDENC */
1199 GPIO_FN(SDENC_CPG), 1377 GPIO_FN(SDENC_CPG),
1200 GPIO_FN(SDENC_DV_CLKI), 1378 GPIO_FN(SDENC_DV_CLKI),
1201}; 1379};
1202 1380
1203static struct pinmux_cfg_reg pinmux_config_regs[] = { 1381static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1204 PORTCR(0, 0xE6051000), /* PORT0CR */ 1382 PORTCR(0, 0xE6051000), /* PORT0CR */
1205 PORTCR(1, 0xE6051001), /* PORT1CR */ 1383 PORTCR(1, 0xE6051001), /* PORT1CR */
1206 PORTCR(2, 0xE6051002), /* PORT2CR */ 1384 PORTCR(2, 0xE6051002), /* PORT2CR */
@@ -1472,7 +1650,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1472 { }, 1650 { },
1473}; 1651};
1474 1652
1475static struct pinmux_data_reg pinmux_data_regs[] = { 1653static const struct pinmux_data_reg pinmux_data_regs[] = {
1476 { PINMUX_DATA_REG("PORTL095_064DR", 0xE6054008, 32) { 1654 { PINMUX_DATA_REG("PORTL095_064DR", 0xE6054008, 32) {
1477 PORT95_DATA, PORT94_DATA, PORT93_DATA, PORT92_DATA, 1655 PORT95_DATA, PORT94_DATA, PORT93_DATA, PORT92_DATA,
1478 PORT91_DATA, PORT90_DATA, PORT89_DATA, PORT88_DATA, 1656 PORT91_DATA, PORT90_DATA, PORT89_DATA, PORT88_DATA,
@@ -1597,56 +1775,59 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1597 1775
1598#define EXT_IRQ16L(n) evt2irq(0x200 + ((n) << 5)) 1776#define EXT_IRQ16L(n) evt2irq(0x200 + ((n) << 5))
1599#define EXT_IRQ16H(n) evt2irq(0x3200 + (((n) - 16) << 5)) 1777#define EXT_IRQ16H(n) evt2irq(0x3200 + (((n) - 16) << 5))
1600static struct pinmux_irq pinmux_irqs[] = { 1778static const struct pinmux_irq pinmux_irqs[] = {
1601 PINMUX_IRQ(EXT_IRQ16L(0), PORT6_FN0, PORT162_FN0), 1779 PINMUX_IRQ(EXT_IRQ16L(0), GPIO_PORT6, GPIO_PORT162),
1602 PINMUX_IRQ(EXT_IRQ16L(1), PORT12_FN0), 1780 PINMUX_IRQ(EXT_IRQ16L(1), GPIO_PORT12),
1603 PINMUX_IRQ(EXT_IRQ16L(2), PORT4_FN0, PORT5_FN0), 1781 PINMUX_IRQ(EXT_IRQ16L(2), GPIO_PORT4, GPIO_PORT5),
1604 PINMUX_IRQ(EXT_IRQ16L(3), PORT8_FN0, PORT16_FN0), 1782 PINMUX_IRQ(EXT_IRQ16L(3), GPIO_PORT8, GPIO_PORT16),
1605 PINMUX_IRQ(EXT_IRQ16L(4), PORT17_FN0, PORT163_FN0), 1783 PINMUX_IRQ(EXT_IRQ16L(4), GPIO_PORT17, GPIO_PORT163),
1606 PINMUX_IRQ(EXT_IRQ16L(5), PORT18_FN0), 1784 PINMUX_IRQ(EXT_IRQ16L(5), GPIO_PORT18),
1607 PINMUX_IRQ(EXT_IRQ16L(6), PORT39_FN0, PORT164_FN0), 1785 PINMUX_IRQ(EXT_IRQ16L(6), GPIO_PORT39, GPIO_PORT164),
1608 PINMUX_IRQ(EXT_IRQ16L(7), PORT40_FN0, PORT167_FN0), 1786 PINMUX_IRQ(EXT_IRQ16L(7), GPIO_PORT40, GPIO_PORT167),
1609 PINMUX_IRQ(EXT_IRQ16L(8), PORT41_FN0, PORT168_FN0), 1787 PINMUX_IRQ(EXT_IRQ16L(8), GPIO_PORT41, GPIO_PORT168),
1610 PINMUX_IRQ(EXT_IRQ16L(9), PORT42_FN0, PORT169_FN0), 1788 PINMUX_IRQ(EXT_IRQ16L(9), GPIO_PORT42, GPIO_PORT169),
1611 PINMUX_IRQ(EXT_IRQ16L(10), PORT65_FN0), 1789 PINMUX_IRQ(EXT_IRQ16L(10), GPIO_PORT65),
1612 PINMUX_IRQ(EXT_IRQ16L(11), PORT67_FN0), 1790 PINMUX_IRQ(EXT_IRQ16L(11), GPIO_PORT67),
1613 PINMUX_IRQ(EXT_IRQ16L(12), PORT80_FN0, PORT137_FN0), 1791 PINMUX_IRQ(EXT_IRQ16L(12), GPIO_PORT80, GPIO_PORT137),
1614 PINMUX_IRQ(EXT_IRQ16L(13), PORT81_FN0, PORT145_FN0), 1792 PINMUX_IRQ(EXT_IRQ16L(13), GPIO_PORT81, GPIO_PORT145),
1615 PINMUX_IRQ(EXT_IRQ16L(14), PORT82_FN0, PORT146_FN0), 1793 PINMUX_IRQ(EXT_IRQ16L(14), GPIO_PORT82, GPIO_PORT146),
1616 PINMUX_IRQ(EXT_IRQ16L(15), PORT83_FN0, PORT147_FN0), 1794 PINMUX_IRQ(EXT_IRQ16L(15), GPIO_PORT83, GPIO_PORT147),
1617 PINMUX_IRQ(EXT_IRQ16H(16), PORT84_FN0, PORT170_FN0), 1795 PINMUX_IRQ(EXT_IRQ16H(16), GPIO_PORT84, GPIO_PORT170),
1618 PINMUX_IRQ(EXT_IRQ16H(17), PORT85_FN0), 1796 PINMUX_IRQ(EXT_IRQ16H(17), GPIO_PORT85),
1619 PINMUX_IRQ(EXT_IRQ16H(18), PORT86_FN0), 1797 PINMUX_IRQ(EXT_IRQ16H(18), GPIO_PORT86),
1620 PINMUX_IRQ(EXT_IRQ16H(19), PORT87_FN0), 1798 PINMUX_IRQ(EXT_IRQ16H(19), GPIO_PORT87),
1621 PINMUX_IRQ(EXT_IRQ16H(20), PORT92_FN0), 1799 PINMUX_IRQ(EXT_IRQ16H(20), GPIO_PORT92),
1622 PINMUX_IRQ(EXT_IRQ16H(21), PORT93_FN0), 1800 PINMUX_IRQ(EXT_IRQ16H(21), GPIO_PORT93),
1623 PINMUX_IRQ(EXT_IRQ16H(22), PORT94_FN0), 1801 PINMUX_IRQ(EXT_IRQ16H(22), GPIO_PORT94),
1624 PINMUX_IRQ(EXT_IRQ16H(23), PORT95_FN0), 1802 PINMUX_IRQ(EXT_IRQ16H(23), GPIO_PORT95),
1625 PINMUX_IRQ(EXT_IRQ16H(24), PORT112_FN0), 1803 PINMUX_IRQ(EXT_IRQ16H(24), GPIO_PORT112),
1626 PINMUX_IRQ(EXT_IRQ16H(25), PORT119_FN0), 1804 PINMUX_IRQ(EXT_IRQ16H(25), GPIO_PORT119),
1627 PINMUX_IRQ(EXT_IRQ16H(26), PORT121_FN0, PORT172_FN0), 1805 PINMUX_IRQ(EXT_IRQ16H(26), GPIO_PORT121, GPIO_PORT172),
1628 PINMUX_IRQ(EXT_IRQ16H(27), PORT122_FN0, PORT180_FN0), 1806 PINMUX_IRQ(EXT_IRQ16H(27), GPIO_PORT122, GPIO_PORT180),
1629 PINMUX_IRQ(EXT_IRQ16H(28), PORT123_FN0, PORT181_FN0), 1807 PINMUX_IRQ(EXT_IRQ16H(28), GPIO_PORT123, GPIO_PORT181),
1630 PINMUX_IRQ(EXT_IRQ16H(29), PORT129_FN0, PORT182_FN0), 1808 PINMUX_IRQ(EXT_IRQ16H(29), GPIO_PORT129, GPIO_PORT182),
1631 PINMUX_IRQ(EXT_IRQ16H(30), PORT130_FN0, PORT183_FN0), 1809 PINMUX_IRQ(EXT_IRQ16H(30), GPIO_PORT130, GPIO_PORT183),
1632 PINMUX_IRQ(EXT_IRQ16H(31), PORT138_FN0, PORT184_FN0), 1810 PINMUX_IRQ(EXT_IRQ16H(31), GPIO_PORT138, GPIO_PORT184),
1633}; 1811};
1634 1812
1635struct sh_pfc_soc_info sh7372_pinmux_info = { 1813const struct sh_pfc_soc_info sh7372_pinmux_info = {
1636 .name = "sh7372_pfc", 1814 .name = "sh7372_pfc",
1637 .reserved_id = PINMUX_RESERVED,
1638 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1639 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 1815 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1640 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 1816 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1641 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END }, 1817 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END },
1642 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 1818 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1643 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1644 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 1819 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1645 1820
1646 .first_gpio = GPIO_PORT0, 1821 .pins = pinmux_pins,
1647 .last_gpio = GPIO_FN_SDENC_DV_CLKI, 1822 .nr_pins = ARRAY_SIZE(pinmux_pins),
1823 .groups = pinmux_groups,
1824 .nr_groups = ARRAY_SIZE(pinmux_groups),
1825 .functions = pinmux_functions,
1826 .nr_functions = ARRAY_SIZE(pinmux_functions),
1827
1828 .func_gpios = pinmux_func_gpios,
1829 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
1648 1830
1649 .gpios = pinmux_gpios,
1650 .cfg_regs = pinmux_config_regs, 1831 .cfg_regs = pinmux_config_regs,
1651 .data_regs = pinmux_data_regs, 1832 .data_regs = pinmux_data_regs,
1652 1833
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
index 709008e94124..cde4387edce1 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
@@ -18,18 +18,18 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21#include <linux/io.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/pinctrl/pinconf-generic.h>
24
22#include <mach/sh73a0.h> 25#include <mach/sh73a0.h>
23#include <mach/irqs.h> 26#include <mach/irqs.h>
24 27
28#include "core.h"
25#include "sh_pfc.h" 29#include "sh_pfc.h"
26 30
27#define CPU_ALL_PORT(fn, pfx, sfx) \ 31#define CPU_ALL_PORT(fn, pfx, sfx) \
28 PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \ 32 PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
29 PORT_10(fn, pfx##2, sfx), PORT_10(fn, pfx##3, sfx), \
30 PORT_10(fn, pfx##4, sfx), PORT_10(fn, pfx##5, sfx), \
31 PORT_10(fn, pfx##6, sfx), PORT_10(fn, pfx##7, sfx), \
32 PORT_10(fn, pfx##8, sfx), PORT_10(fn, pfx##9, sfx), \
33 PORT_10(fn, pfx##10, sfx), \ 33 PORT_10(fn, pfx##10, sfx), \
34 PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \ 34 PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \
35 PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \ 35 PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \
@@ -66,14 +66,6 @@ enum {
66 PORT_ALL(IN), /* PORT0_IN -> PORT309_IN */ 66 PORT_ALL(IN), /* PORT0_IN -> PORT309_IN */
67 PINMUX_INPUT_END, 67 PINMUX_INPUT_END,
68 68
69 PINMUX_INPUT_PULLUP_BEGIN,
70 PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */
71 PINMUX_INPUT_PULLUP_END,
72
73 PINMUX_INPUT_PULLDOWN_BEGIN,
74 PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */
75 PINMUX_INPUT_PULLDOWN_END,
76
77 PINMUX_OUTPUT_BEGIN, 69 PINMUX_OUTPUT_BEGIN,
78 PORT_ALL(OUT), /* PORT0_OUT -> PORT309_OUT */ 70 PORT_ALL(OUT), /* PORT0_OUT -> PORT309_OUT */
79 PINMUX_OUTPUT_END, 71 PINMUX_OUTPUT_END,
@@ -468,328 +460,15 @@ enum {
468 EDBGREQ_PD_MARK, 460 EDBGREQ_PD_MARK,
469 EDBGREQ_PU_MARK, 461 EDBGREQ_PU_MARK,
470 462
471 /* Functions with pull-ups */
472 KEYIN0_PU_MARK,
473 KEYIN1_PU_MARK,
474 KEYIN2_PU_MARK,
475 KEYIN3_PU_MARK,
476 KEYIN4_PU_MARK,
477 KEYIN5_PU_MARK,
478 KEYIN6_PU_MARK,
479 KEYIN7_PU_MARK,
480 SDHICD0_PU_MARK,
481 SDHID0_0_PU_MARK,
482 SDHID0_1_PU_MARK,
483 SDHID0_2_PU_MARK,
484 SDHID0_3_PU_MARK,
485 SDHICMD0_PU_MARK,
486 SDHIWP0_PU_MARK,
487 SDHID1_0_PU_MARK,
488 SDHID1_1_PU_MARK,
489 SDHID1_2_PU_MARK,
490 SDHID1_3_PU_MARK,
491 SDHICMD1_PU_MARK,
492 SDHID2_0_PU_MARK,
493 SDHID2_1_PU_MARK,
494 SDHID2_2_PU_MARK,
495 SDHID2_3_PU_MARK,
496 SDHICMD2_PU_MARK,
497 MMCCMD0_PU_MARK,
498 MMCCMD1_PU_MARK,
499 MMCD0_0_PU_MARK,
500 MMCD0_1_PU_MARK,
501 MMCD0_2_PU_MARK,
502 MMCD0_3_PU_MARK,
503 MMCD0_4_PU_MARK,
504 MMCD0_5_PU_MARK,
505 MMCD0_6_PU_MARK,
506 MMCD0_7_PU_MARK,
507 FSIBISLD_PU_MARK,
508 FSIACK_PU_MARK,
509 FSIAILR_PU_MARK,
510 FSIAIBT_PU_MARK,
511 FSIAISLD_PU_MARK,
512
513 PINMUX_MARK_END, 463 PINMUX_MARK_END,
514}; 464};
515 465
516static pinmux_enum_t pinmux_data[] = { 466#define _PORT_DATA(pfx, sfx) PORT_DATA_IO(pfx)
517 /* specify valid pin states for each pin in GPIO mode */ 467#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_PORT_DATA, , unused)
518 468
519 /* Table 25-1 (I/O and Pull U/D) */ 469static const pinmux_enum_t pinmux_data[] = {
520 PORT_DATA_I_PD(0), 470 /* specify valid pin states for each pin in GPIO mode */
521 PORT_DATA_I_PU(1), 471 PINMUX_DATA_GP_ALL(),
522 PORT_DATA_I_PU(2),
523 PORT_DATA_I_PU(3),
524 PORT_DATA_I_PU(4),
525 PORT_DATA_I_PU(5),
526 PORT_DATA_I_PU(6),
527 PORT_DATA_I_PU(7),
528 PORT_DATA_I_PU(8),
529 PORT_DATA_I_PD(9),
530 PORT_DATA_I_PD(10),
531 PORT_DATA_I_PU_PD(11),
532 PORT_DATA_IO_PU_PD(12),
533 PORT_DATA_IO_PU_PD(13),
534 PORT_DATA_IO_PU_PD(14),
535 PORT_DATA_IO_PU_PD(15),
536 PORT_DATA_IO_PD(16),
537 PORT_DATA_IO_PD(17),
538 PORT_DATA_IO_PU(18),
539 PORT_DATA_IO_PU(19),
540 PORT_DATA_O(20),
541 PORT_DATA_O(21),
542 PORT_DATA_O(22),
543 PORT_DATA_O(23),
544 PORT_DATA_O(24),
545 PORT_DATA_I_PD(25),
546 PORT_DATA_I_PD(26),
547 PORT_DATA_IO_PU(27),
548 PORT_DATA_IO_PU(28),
549 PORT_DATA_IO_PD(29),
550 PORT_DATA_IO_PD(30),
551 PORT_DATA_IO_PU(31),
552 PORT_DATA_IO_PD(32),
553 PORT_DATA_I_PU_PD(33),
554 PORT_DATA_IO_PD(34),
555 PORT_DATA_I_PU_PD(35),
556 PORT_DATA_IO_PD(36),
557 PORT_DATA_IO(37),
558 PORT_DATA_O(38),
559 PORT_DATA_I_PU(39),
560 PORT_DATA_I_PU_PD(40),
561 PORT_DATA_O(41),
562 PORT_DATA_IO_PD(42),
563 PORT_DATA_IO_PU_PD(43),
564 PORT_DATA_IO_PU_PD(44),
565 PORT_DATA_IO_PD(45),
566 PORT_DATA_IO_PD(46),
567 PORT_DATA_IO_PD(47),
568 PORT_DATA_I_PD(48),
569 PORT_DATA_IO_PU_PD(49),
570 PORT_DATA_IO_PD(50),
571
572 PORT_DATA_IO_PD(51),
573 PORT_DATA_O(52),
574 PORT_DATA_IO_PU_PD(53),
575 PORT_DATA_IO_PU_PD(54),
576 PORT_DATA_IO_PD(55),
577 PORT_DATA_I_PU_PD(56),
578 PORT_DATA_IO(57),
579 PORT_DATA_IO(58),
580 PORT_DATA_IO(59),
581 PORT_DATA_IO(60),
582 PORT_DATA_IO(61),
583 PORT_DATA_IO_PD(62),
584 PORT_DATA_IO_PD(63),
585 PORT_DATA_IO_PU_PD(64),
586 PORT_DATA_IO_PD(65),
587 PORT_DATA_IO_PU_PD(66),
588 PORT_DATA_IO_PU_PD(67),
589 PORT_DATA_IO_PU_PD(68),
590 PORT_DATA_IO_PU_PD(69),
591 PORT_DATA_IO_PU_PD(70),
592 PORT_DATA_IO_PU_PD(71),
593 PORT_DATA_IO_PU_PD(72),
594 PORT_DATA_I_PU_PD(73),
595 PORT_DATA_IO_PU(74),
596 PORT_DATA_IO_PU(75),
597 PORT_DATA_IO_PU(76),
598 PORT_DATA_IO_PU(77),
599 PORT_DATA_IO_PU(78),
600 PORT_DATA_IO_PU(79),
601 PORT_DATA_IO_PU(80),
602 PORT_DATA_IO_PU(81),
603 PORT_DATA_IO_PU(82),
604 PORT_DATA_IO_PU(83),
605 PORT_DATA_IO_PU(84),
606 PORT_DATA_IO_PU(85),
607 PORT_DATA_IO_PU(86),
608 PORT_DATA_IO_PU(87),
609 PORT_DATA_IO_PU(88),
610 PORT_DATA_IO_PU(89),
611 PORT_DATA_O(90),
612 PORT_DATA_IO_PU(91),
613 PORT_DATA_O(92),
614 PORT_DATA_IO_PU(93),
615 PORT_DATA_O(94),
616 PORT_DATA_I_PU_PD(95),
617 PORT_DATA_IO(96),
618 PORT_DATA_IO(97),
619 PORT_DATA_IO(98),
620 PORT_DATA_I_PU(99),
621 PORT_DATA_O(100),
622 PORT_DATA_O(101),
623 PORT_DATA_I_PU(102),
624 PORT_DATA_IO_PD(103),
625 PORT_DATA_I_PU_PD(104),
626 PORT_DATA_I_PD(105),
627 PORT_DATA_I_PD(106),
628 PORT_DATA_I_PU_PD(107),
629 PORT_DATA_I_PU_PD(108),
630 PORT_DATA_IO_PD(109),
631 PORT_DATA_IO_PD(110),
632 PORT_DATA_IO_PU_PD(111),
633 PORT_DATA_IO_PU_PD(112),
634 PORT_DATA_IO_PU_PD(113),
635 PORT_DATA_IO_PD(114),
636 PORT_DATA_IO_PU(115),
637 PORT_DATA_IO_PU(116),
638 PORT_DATA_IO_PU_PD(117),
639 PORT_DATA_IO_PU_PD(118),
640 PORT_DATA_IO_PD(128),
641
642 PORT_DATA_IO_PD(129),
643 PORT_DATA_IO_PU_PD(130),
644 PORT_DATA_IO_PD(131),
645 PORT_DATA_IO_PD(132),
646 PORT_DATA_IO_PD(133),
647 PORT_DATA_IO_PU_PD(134),
648 PORT_DATA_IO_PU_PD(135),
649 PORT_DATA_IO_PU_PD(136),
650 PORT_DATA_IO_PU_PD(137),
651 PORT_DATA_IO_PD(138),
652 PORT_DATA_IO_PD(139),
653 PORT_DATA_IO_PD(140),
654 PORT_DATA_IO_PD(141),
655 PORT_DATA_IO_PD(142),
656 PORT_DATA_IO_PD(143),
657 PORT_DATA_IO_PU_PD(144),
658 PORT_DATA_IO_PD(145),
659 PORT_DATA_IO_PU_PD(146),
660 PORT_DATA_IO_PU_PD(147),
661 PORT_DATA_IO_PU_PD(148),
662 PORT_DATA_IO_PU_PD(149),
663 PORT_DATA_I_PU_PD(150),
664 PORT_DATA_IO_PU_PD(151),
665 PORT_DATA_IO_PU_PD(152),
666 PORT_DATA_IO_PD(153),
667 PORT_DATA_IO_PD(154),
668 PORT_DATA_I_PU_PD(155),
669 PORT_DATA_IO_PU_PD(156),
670 PORT_DATA_I_PD(157),
671 PORT_DATA_IO_PD(158),
672 PORT_DATA_IO_PU_PD(159),
673 PORT_DATA_IO_PU_PD(160),
674 PORT_DATA_I_PU_PD(161),
675 PORT_DATA_I_PU_PD(162),
676 PORT_DATA_IO_PU_PD(163),
677 PORT_DATA_I_PU_PD(164),
678 PORT_DATA_IO_PD(192),
679 PORT_DATA_IO_PU_PD(193),
680 PORT_DATA_IO_PD(194),
681 PORT_DATA_IO_PU_PD(195),
682 PORT_DATA_IO_PD(196),
683 PORT_DATA_IO_PD(197),
684 PORT_DATA_IO_PD(198),
685 PORT_DATA_IO_PD(199),
686 PORT_DATA_IO_PU_PD(200),
687 PORT_DATA_IO_PU_PD(201),
688 PORT_DATA_IO_PU_PD(202),
689 PORT_DATA_IO_PU_PD(203),
690 PORT_DATA_IO_PU_PD(204),
691 PORT_DATA_IO_PU_PD(205),
692 PORT_DATA_IO_PU_PD(206),
693 PORT_DATA_IO_PD(207),
694 PORT_DATA_IO_PD(208),
695 PORT_DATA_IO_PD(209),
696 PORT_DATA_IO_PD(210),
697 PORT_DATA_IO_PD(211),
698 PORT_DATA_IO_PD(212),
699 PORT_DATA_IO_PD(213),
700 PORT_DATA_IO_PU_PD(214),
701 PORT_DATA_IO_PU_PD(215),
702 PORT_DATA_IO_PD(216),
703 PORT_DATA_IO_PD(217),
704 PORT_DATA_O(218),
705 PORT_DATA_IO_PD(219),
706 PORT_DATA_IO_PD(220),
707 PORT_DATA_IO_PU_PD(221),
708 PORT_DATA_IO_PU_PD(222),
709 PORT_DATA_I_PU_PD(223),
710 PORT_DATA_I_PU_PD(224),
711
712 PORT_DATA_IO_PU_PD(225),
713 PORT_DATA_O(226),
714 PORT_DATA_IO_PU_PD(227),
715 PORT_DATA_I_PU_PD(228),
716 PORT_DATA_I_PD(229),
717 PORT_DATA_IO(230),
718 PORT_DATA_IO_PU_PD(231),
719 PORT_DATA_IO_PU_PD(232),
720 PORT_DATA_I_PU_PD(233),
721 PORT_DATA_IO_PU_PD(234),
722 PORT_DATA_IO_PU_PD(235),
723 PORT_DATA_IO_PU_PD(236),
724 PORT_DATA_IO_PD(237),
725 PORT_DATA_IO_PU_PD(238),
726 PORT_DATA_IO_PU_PD(239),
727 PORT_DATA_IO_PU_PD(240),
728 PORT_DATA_O(241),
729 PORT_DATA_I_PD(242),
730 PORT_DATA_IO_PU_PD(243),
731 PORT_DATA_IO_PU_PD(244),
732 PORT_DATA_IO_PU_PD(245),
733 PORT_DATA_IO_PU_PD(246),
734 PORT_DATA_IO_PU_PD(247),
735 PORT_DATA_IO_PU_PD(248),
736 PORT_DATA_IO_PU_PD(249),
737 PORT_DATA_IO_PU_PD(250),
738 PORT_DATA_IO_PU_PD(251),
739 PORT_DATA_IO_PU_PD(252),
740 PORT_DATA_IO_PU_PD(253),
741 PORT_DATA_IO_PU_PD(254),
742 PORT_DATA_IO_PU_PD(255),
743 PORT_DATA_IO_PU_PD(256),
744 PORT_DATA_IO_PU_PD(257),
745 PORT_DATA_IO_PU_PD(258),
746 PORT_DATA_IO_PU_PD(259),
747 PORT_DATA_IO_PU_PD(260),
748 PORT_DATA_IO_PU_PD(261),
749 PORT_DATA_IO_PU_PD(262),
750 PORT_DATA_IO_PU_PD(263),
751 PORT_DATA_IO_PU_PD(264),
752 PORT_DATA_IO_PU_PD(265),
753 PORT_DATA_IO_PU_PD(266),
754 PORT_DATA_IO_PU_PD(267),
755 PORT_DATA_IO_PU_PD(268),
756 PORT_DATA_IO_PU_PD(269),
757 PORT_DATA_IO_PU_PD(270),
758 PORT_DATA_IO_PU_PD(271),
759 PORT_DATA_IO_PU_PD(272),
760 PORT_DATA_IO_PU_PD(273),
761 PORT_DATA_IO_PU_PD(274),
762 PORT_DATA_IO_PU_PD(275),
763 PORT_DATA_IO_PU_PD(276),
764 PORT_DATA_IO_PU_PD(277),
765 PORT_DATA_IO_PU_PD(278),
766 PORT_DATA_IO_PU_PD(279),
767 PORT_DATA_IO_PU_PD(280),
768 PORT_DATA_O(281),
769 PORT_DATA_O(282),
770 PORT_DATA_I_PU(288),
771 PORT_DATA_IO_PU_PD(289),
772 PORT_DATA_IO_PU_PD(290),
773 PORT_DATA_IO_PU_PD(291),
774 PORT_DATA_IO_PU_PD(292),
775 PORT_DATA_IO_PU_PD(293),
776 PORT_DATA_IO_PU_PD(294),
777 PORT_DATA_IO_PU_PD(295),
778 PORT_DATA_IO_PU_PD(296),
779 PORT_DATA_IO_PU_PD(297),
780 PORT_DATA_IO_PU_PD(298),
781
782 PORT_DATA_IO_PU_PD(299),
783 PORT_DATA_IO_PU_PD(300),
784 PORT_DATA_IO_PU_PD(301),
785 PORT_DATA_IO_PU_PD(302),
786 PORT_DATA_IO_PU_PD(303),
787 PORT_DATA_IO_PU_PD(304),
788 PORT_DATA_IO_PU_PD(305),
789 PORT_DATA_O(306),
790 PORT_DATA_O(307),
791 PORT_DATA_I_PU(308),
792 PORT_DATA_O(309),
793 472
794 /* Table 25-1 (Function 0-7) */ 473 /* Table 25-1 (Function 0-7) */
795 PINMUX_DATA(VBUS_0_MARK, PORT0_FN1), 474 PINMUX_DATA(VBUS_0_MARK, PORT0_FN1),
@@ -1358,28 +1037,19 @@ static pinmux_enum_t pinmux_data[] = {
1358 PINMUX_DATA(TS_SCK4_MARK, PORT268_FN3), 1037 PINMUX_DATA(TS_SCK4_MARK, PORT268_FN3),
1359 PINMUX_DATA(SDHICMD2_MARK, PORT269_FN1), 1038 PINMUX_DATA(SDHICMD2_MARK, PORT269_FN1),
1360 PINMUX_DATA(MMCCLK0_MARK, PORT270_FN1, MSEL4CR_MSEL15_0), 1039 PINMUX_DATA(MMCCLK0_MARK, PORT270_FN1, MSEL4CR_MSEL15_0),
1361 PINMUX_DATA(MMCD0_0_MARK, PORT271_FN1, PORT271_IN_PU, 1040 PINMUX_DATA(MMCD0_0_MARK, PORT271_FN1, MSEL4CR_MSEL15_0),
1362 MSEL4CR_MSEL15_0), 1041 PINMUX_DATA(MMCD0_1_MARK, PORT272_FN1, MSEL4CR_MSEL15_0),
1363 PINMUX_DATA(MMCD0_1_MARK, PORT272_FN1, PORT272_IN_PU, 1042 PINMUX_DATA(MMCD0_2_MARK, PORT273_FN1, MSEL4CR_MSEL15_0),
1364 MSEL4CR_MSEL15_0), 1043 PINMUX_DATA(MMCD0_3_MARK, PORT274_FN1, MSEL4CR_MSEL15_0),
1365 PINMUX_DATA(MMCD0_2_MARK, PORT273_FN1, PORT273_IN_PU, 1044 PINMUX_DATA(MMCD0_4_MARK, PORT275_FN1, MSEL4CR_MSEL15_0),
1366 MSEL4CR_MSEL15_0),
1367 PINMUX_DATA(MMCD0_3_MARK, PORT274_FN1, PORT274_IN_PU,
1368 MSEL4CR_MSEL15_0),
1369 PINMUX_DATA(MMCD0_4_MARK, PORT275_FN1, PORT275_IN_PU,
1370 MSEL4CR_MSEL15_0), \
1371 PINMUX_DATA(TS_SPSYNC5_MARK, PORT275_FN3), 1045 PINMUX_DATA(TS_SPSYNC5_MARK, PORT275_FN3),
1372 PINMUX_DATA(MMCD0_5_MARK, PORT276_FN1, PORT276_IN_PU, 1046 PINMUX_DATA(MMCD0_5_MARK, PORT276_FN1, MSEL4CR_MSEL15_0),
1373 MSEL4CR_MSEL15_0), \
1374 PINMUX_DATA(TS_SDAT5_MARK, PORT276_FN3), 1047 PINMUX_DATA(TS_SDAT5_MARK, PORT276_FN3),
1375 PINMUX_DATA(MMCD0_6_MARK, PORT277_FN1, PORT277_IN_PU, 1048 PINMUX_DATA(MMCD0_6_MARK, PORT277_FN1, MSEL4CR_MSEL15_0),
1376 MSEL4CR_MSEL15_0), \
1377 PINMUX_DATA(TS_SDEN5_MARK, PORT277_FN3), 1049 PINMUX_DATA(TS_SDEN5_MARK, PORT277_FN3),
1378 PINMUX_DATA(MMCD0_7_MARK, PORT278_FN1, PORT278_IN_PU, 1050 PINMUX_DATA(MMCD0_7_MARK, PORT278_FN1, MSEL4CR_MSEL15_0),
1379 MSEL4CR_MSEL15_0), \
1380 PINMUX_DATA(TS_SCK5_MARK, PORT278_FN3), 1051 PINMUX_DATA(TS_SCK5_MARK, PORT278_FN3),
1381 PINMUX_DATA(MMCCMD0_MARK, PORT279_FN1, PORT279_IN_PU, 1052 PINMUX_DATA(MMCCMD0_MARK, PORT279_FN1, MSEL4CR_MSEL15_0),
1382 MSEL4CR_MSEL15_0),
1383 PINMUX_DATA(RESETOUTS__MARK, PORT281_FN1), \ 1053 PINMUX_DATA(RESETOUTS__MARK, PORT281_FN1), \
1384 PINMUX_DATA(EXTAL2OUT_MARK, PORT281_FN2), 1054 PINMUX_DATA(EXTAL2OUT_MARK, PORT281_FN2),
1385 PINMUX_DATA(MCP_WAIT__MCP_FRB_MARK, PORT288_FN1), 1055 PINMUX_DATA(MCP_WAIT__MCP_FRB_MARK, PORT288_FN1),
@@ -1485,69 +1155,1791 @@ static pinmux_enum_t pinmux_data[] = {
1485 PINMUX_DATA(RESETA_N_PU_OFF_MARK, MSEL4CR_MSEL4_1), 1155 PINMUX_DATA(RESETA_N_PU_OFF_MARK, MSEL4CR_MSEL4_1),
1486 PINMUX_DATA(EDBGREQ_PD_MARK, MSEL4CR_MSEL1_0), 1156 PINMUX_DATA(EDBGREQ_PD_MARK, MSEL4CR_MSEL1_0),
1487 PINMUX_DATA(EDBGREQ_PU_MARK, MSEL4CR_MSEL1_1), 1157 PINMUX_DATA(EDBGREQ_PU_MARK, MSEL4CR_MSEL1_1),
1158};
1159
1160#define SH73A0_PIN(pin, cfgs) \
1161 { \
1162 .name = __stringify(PORT##pin), \
1163 .enum_id = PORT##pin##_DATA, \
1164 .configs = cfgs, \
1165 }
1166
1167#define __I (SH_PFC_PIN_CFG_INPUT)
1168#define __O (SH_PFC_PIN_CFG_OUTPUT)
1169#define __IO (SH_PFC_PIN_CFG_INPUT | SH_PFC_PIN_CFG_OUTPUT)
1170#define __PD (SH_PFC_PIN_CFG_PULL_DOWN)
1171#define __PU (SH_PFC_PIN_CFG_PULL_UP)
1172#define __PUD (SH_PFC_PIN_CFG_PULL_DOWN | SH_PFC_PIN_CFG_PULL_UP)
1173
1174#define SH73A0_PIN_I_PD(pin) SH73A0_PIN(pin, __I | __PD)
1175#define SH73A0_PIN_I_PU(pin) SH73A0_PIN(pin, __I | __PU)
1176#define SH73A0_PIN_I_PU_PD(pin) SH73A0_PIN(pin, __I | __PUD)
1177#define SH73A0_PIN_IO(pin) SH73A0_PIN(pin, __IO)
1178#define SH73A0_PIN_IO_PD(pin) SH73A0_PIN(pin, __IO | __PD)
1179#define SH73A0_PIN_IO_PU(pin) SH73A0_PIN(pin, __IO | __PU)
1180#define SH73A0_PIN_IO_PU_PD(pin) SH73A0_PIN(pin, __IO | __PUD)
1181#define SH73A0_PIN_O(pin) SH73A0_PIN(pin, __O)
1182
1183static struct sh_pfc_pin pinmux_pins[] = {
1184 /* Table 25-1 (I/O and Pull U/D) */
1185 SH73A0_PIN_I_PD(0),
1186 SH73A0_PIN_I_PU(1),
1187 SH73A0_PIN_I_PU(2),
1188 SH73A0_PIN_I_PU(3),
1189 SH73A0_PIN_I_PU(4),
1190 SH73A0_PIN_I_PU(5),
1191 SH73A0_PIN_I_PU(6),
1192 SH73A0_PIN_I_PU(7),
1193 SH73A0_PIN_I_PU(8),
1194 SH73A0_PIN_I_PD(9),
1195 SH73A0_PIN_I_PD(10),
1196 SH73A0_PIN_I_PU_PD(11),
1197 SH73A0_PIN_IO_PU_PD(12),
1198 SH73A0_PIN_IO_PU_PD(13),
1199 SH73A0_PIN_IO_PU_PD(14),
1200 SH73A0_PIN_IO_PU_PD(15),
1201 SH73A0_PIN_IO_PD(16),
1202 SH73A0_PIN_IO_PD(17),
1203 SH73A0_PIN_IO_PU(18),
1204 SH73A0_PIN_IO_PU(19),
1205 SH73A0_PIN_O(20),
1206 SH73A0_PIN_O(21),
1207 SH73A0_PIN_O(22),
1208 SH73A0_PIN_O(23),
1209 SH73A0_PIN_O(24),
1210 SH73A0_PIN_I_PD(25),
1211 SH73A0_PIN_I_PD(26),
1212 SH73A0_PIN_IO_PU(27),
1213 SH73A0_PIN_IO_PU(28),
1214 SH73A0_PIN_IO_PD(29),
1215 SH73A0_PIN_IO_PD(30),
1216 SH73A0_PIN_IO_PU(31),
1217 SH73A0_PIN_IO_PD(32),
1218 SH73A0_PIN_I_PU_PD(33),
1219 SH73A0_PIN_IO_PD(34),
1220 SH73A0_PIN_I_PU_PD(35),
1221 SH73A0_PIN_IO_PD(36),
1222 SH73A0_PIN_IO(37),
1223 SH73A0_PIN_O(38),
1224 SH73A0_PIN_I_PU(39),
1225 SH73A0_PIN_I_PU_PD(40),
1226 SH73A0_PIN_O(41),
1227 SH73A0_PIN_IO_PD(42),
1228 SH73A0_PIN_IO_PU_PD(43),
1229 SH73A0_PIN_IO_PU_PD(44),
1230 SH73A0_PIN_IO_PD(45),
1231 SH73A0_PIN_IO_PD(46),
1232 SH73A0_PIN_IO_PD(47),
1233 SH73A0_PIN_I_PD(48),
1234 SH73A0_PIN_IO_PU_PD(49),
1235 SH73A0_PIN_IO_PD(50),
1236 SH73A0_PIN_IO_PD(51),
1237 SH73A0_PIN_O(52),
1238 SH73A0_PIN_IO_PU_PD(53),
1239 SH73A0_PIN_IO_PU_PD(54),
1240 SH73A0_PIN_IO_PD(55),
1241 SH73A0_PIN_I_PU_PD(56),
1242 SH73A0_PIN_IO(57),
1243 SH73A0_PIN_IO(58),
1244 SH73A0_PIN_IO(59),
1245 SH73A0_PIN_IO(60),
1246 SH73A0_PIN_IO(61),
1247 SH73A0_PIN_IO_PD(62),
1248 SH73A0_PIN_IO_PD(63),
1249 SH73A0_PIN_IO_PU_PD(64),
1250 SH73A0_PIN_IO_PD(65),
1251 SH73A0_PIN_IO_PU_PD(66),
1252 SH73A0_PIN_IO_PU_PD(67),
1253 SH73A0_PIN_IO_PU_PD(68),
1254 SH73A0_PIN_IO_PU_PD(69),
1255 SH73A0_PIN_IO_PU_PD(70),
1256 SH73A0_PIN_IO_PU_PD(71),
1257 SH73A0_PIN_IO_PU_PD(72),
1258 SH73A0_PIN_I_PU_PD(73),
1259 SH73A0_PIN_IO_PU(74),
1260 SH73A0_PIN_IO_PU(75),
1261 SH73A0_PIN_IO_PU(76),
1262 SH73A0_PIN_IO_PU(77),
1263 SH73A0_PIN_IO_PU(78),
1264 SH73A0_PIN_IO_PU(79),
1265 SH73A0_PIN_IO_PU(80),
1266 SH73A0_PIN_IO_PU(81),
1267 SH73A0_PIN_IO_PU(82),
1268 SH73A0_PIN_IO_PU(83),
1269 SH73A0_PIN_IO_PU(84),
1270 SH73A0_PIN_IO_PU(85),
1271 SH73A0_PIN_IO_PU(86),
1272 SH73A0_PIN_IO_PU(87),
1273 SH73A0_PIN_IO_PU(88),
1274 SH73A0_PIN_IO_PU(89),
1275 SH73A0_PIN_O(90),
1276 SH73A0_PIN_IO_PU(91),
1277 SH73A0_PIN_O(92),
1278 SH73A0_PIN_IO_PU(93),
1279 SH73A0_PIN_O(94),
1280 SH73A0_PIN_I_PU_PD(95),
1281 SH73A0_PIN_IO(96),
1282 SH73A0_PIN_IO(97),
1283 SH73A0_PIN_IO(98),
1284 SH73A0_PIN_I_PU(99),
1285 SH73A0_PIN_O(100),
1286 SH73A0_PIN_O(101),
1287 SH73A0_PIN_I_PU(102),
1288 SH73A0_PIN_IO_PD(103),
1289 SH73A0_PIN_I_PU_PD(104),
1290 SH73A0_PIN_I_PD(105),
1291 SH73A0_PIN_I_PD(106),
1292 SH73A0_PIN_I_PU_PD(107),
1293 SH73A0_PIN_I_PU_PD(108),
1294 SH73A0_PIN_IO_PD(109),
1295 SH73A0_PIN_IO_PD(110),
1296 SH73A0_PIN_IO_PU_PD(111),
1297 SH73A0_PIN_IO_PU_PD(112),
1298 SH73A0_PIN_IO_PU_PD(113),
1299 SH73A0_PIN_IO_PD(114),
1300 SH73A0_PIN_IO_PU(115),
1301 SH73A0_PIN_IO_PU(116),
1302 SH73A0_PIN_IO_PU_PD(117),
1303 SH73A0_PIN_IO_PU_PD(118),
1304 SH73A0_PIN_IO_PD(128),
1305 SH73A0_PIN_IO_PD(129),
1306 SH73A0_PIN_IO_PU_PD(130),
1307 SH73A0_PIN_IO_PD(131),
1308 SH73A0_PIN_IO_PD(132),
1309 SH73A0_PIN_IO_PD(133),
1310 SH73A0_PIN_IO_PU_PD(134),
1311 SH73A0_PIN_IO_PU_PD(135),
1312 SH73A0_PIN_IO_PU_PD(136),
1313 SH73A0_PIN_IO_PU_PD(137),
1314 SH73A0_PIN_IO_PD(138),
1315 SH73A0_PIN_IO_PD(139),
1316 SH73A0_PIN_IO_PD(140),
1317 SH73A0_PIN_IO_PD(141),
1318 SH73A0_PIN_IO_PD(142),
1319 SH73A0_PIN_IO_PD(143),
1320 SH73A0_PIN_IO_PU_PD(144),
1321 SH73A0_PIN_IO_PD(145),
1322 SH73A0_PIN_IO_PU_PD(146),
1323 SH73A0_PIN_IO_PU_PD(147),
1324 SH73A0_PIN_IO_PU_PD(148),
1325 SH73A0_PIN_IO_PU_PD(149),
1326 SH73A0_PIN_I_PU_PD(150),
1327 SH73A0_PIN_IO_PU_PD(151),
1328 SH73A0_PIN_IO_PU_PD(152),
1329 SH73A0_PIN_IO_PD(153),
1330 SH73A0_PIN_IO_PD(154),
1331 SH73A0_PIN_I_PU_PD(155),
1332 SH73A0_PIN_IO_PU_PD(156),
1333 SH73A0_PIN_I_PD(157),
1334 SH73A0_PIN_IO_PD(158),
1335 SH73A0_PIN_IO_PU_PD(159),
1336 SH73A0_PIN_IO_PU_PD(160),
1337 SH73A0_PIN_I_PU_PD(161),
1338 SH73A0_PIN_I_PU_PD(162),
1339 SH73A0_PIN_IO_PU_PD(163),
1340 SH73A0_PIN_I_PU_PD(164),
1341 SH73A0_PIN_IO_PD(192),
1342 SH73A0_PIN_IO_PU_PD(193),
1343 SH73A0_PIN_IO_PD(194),
1344 SH73A0_PIN_IO_PU_PD(195),
1345 SH73A0_PIN_IO_PD(196),
1346 SH73A0_PIN_IO_PD(197),
1347 SH73A0_PIN_IO_PD(198),
1348 SH73A0_PIN_IO_PD(199),
1349 SH73A0_PIN_IO_PU_PD(200),
1350 SH73A0_PIN_IO_PU_PD(201),
1351 SH73A0_PIN_IO_PU_PD(202),
1352 SH73A0_PIN_IO_PU_PD(203),
1353 SH73A0_PIN_IO_PU_PD(204),
1354 SH73A0_PIN_IO_PU_PD(205),
1355 SH73A0_PIN_IO_PU_PD(206),
1356 SH73A0_PIN_IO_PD(207),
1357 SH73A0_PIN_IO_PD(208),
1358 SH73A0_PIN_IO_PD(209),
1359 SH73A0_PIN_IO_PD(210),
1360 SH73A0_PIN_IO_PD(211),
1361 SH73A0_PIN_IO_PD(212),
1362 SH73A0_PIN_IO_PD(213),
1363 SH73A0_PIN_IO_PU_PD(214),
1364 SH73A0_PIN_IO_PU_PD(215),
1365 SH73A0_PIN_IO_PD(216),
1366 SH73A0_PIN_IO_PD(217),
1367 SH73A0_PIN_O(218),
1368 SH73A0_PIN_IO_PD(219),
1369 SH73A0_PIN_IO_PD(220),
1370 SH73A0_PIN_IO_PU_PD(221),
1371 SH73A0_PIN_IO_PU_PD(222),
1372 SH73A0_PIN_I_PU_PD(223),
1373 SH73A0_PIN_I_PU_PD(224),
1374 SH73A0_PIN_IO_PU_PD(225),
1375 SH73A0_PIN_O(226),
1376 SH73A0_PIN_IO_PU_PD(227),
1377 SH73A0_PIN_I_PU_PD(228),
1378 SH73A0_PIN_I_PD(229),
1379 SH73A0_PIN_IO(230),
1380 SH73A0_PIN_IO_PU_PD(231),
1381 SH73A0_PIN_IO_PU_PD(232),
1382 SH73A0_PIN_I_PU_PD(233),
1383 SH73A0_PIN_IO_PU_PD(234),
1384 SH73A0_PIN_IO_PU_PD(235),
1385 SH73A0_PIN_IO_PU_PD(236),
1386 SH73A0_PIN_IO_PD(237),
1387 SH73A0_PIN_IO_PU_PD(238),
1388 SH73A0_PIN_IO_PU_PD(239),
1389 SH73A0_PIN_IO_PU_PD(240),
1390 SH73A0_PIN_O(241),
1391 SH73A0_PIN_I_PD(242),
1392 SH73A0_PIN_IO_PU_PD(243),
1393 SH73A0_PIN_IO_PU_PD(244),
1394 SH73A0_PIN_IO_PU_PD(245),
1395 SH73A0_PIN_IO_PU_PD(246),
1396 SH73A0_PIN_IO_PU_PD(247),
1397 SH73A0_PIN_IO_PU_PD(248),
1398 SH73A0_PIN_IO_PU_PD(249),
1399 SH73A0_PIN_IO_PU_PD(250),
1400 SH73A0_PIN_IO_PU_PD(251),
1401 SH73A0_PIN_IO_PU_PD(252),
1402 SH73A0_PIN_IO_PU_PD(253),
1403 SH73A0_PIN_IO_PU_PD(254),
1404 SH73A0_PIN_IO_PU_PD(255),
1405 SH73A0_PIN_IO_PU_PD(256),
1406 SH73A0_PIN_IO_PU_PD(257),
1407 SH73A0_PIN_IO_PU_PD(258),
1408 SH73A0_PIN_IO_PU_PD(259),
1409 SH73A0_PIN_IO_PU_PD(260),
1410 SH73A0_PIN_IO_PU_PD(261),
1411 SH73A0_PIN_IO_PU_PD(262),
1412 SH73A0_PIN_IO_PU_PD(263),
1413 SH73A0_PIN_IO_PU_PD(264),
1414 SH73A0_PIN_IO_PU_PD(265),
1415 SH73A0_PIN_IO_PU_PD(266),
1416 SH73A0_PIN_IO_PU_PD(267),
1417 SH73A0_PIN_IO_PU_PD(268),
1418 SH73A0_PIN_IO_PU_PD(269),
1419 SH73A0_PIN_IO_PU_PD(270),
1420 SH73A0_PIN_IO_PU_PD(271),
1421 SH73A0_PIN_IO_PU_PD(272),
1422 SH73A0_PIN_IO_PU_PD(273),
1423 SH73A0_PIN_IO_PU_PD(274),
1424 SH73A0_PIN_IO_PU_PD(275),
1425 SH73A0_PIN_IO_PU_PD(276),
1426 SH73A0_PIN_IO_PU_PD(277),
1427 SH73A0_PIN_IO_PU_PD(278),
1428 SH73A0_PIN_IO_PU_PD(279),
1429 SH73A0_PIN_IO_PU_PD(280),
1430 SH73A0_PIN_O(281),
1431 SH73A0_PIN_O(282),
1432 SH73A0_PIN_I_PU(288),
1433 SH73A0_PIN_IO_PU_PD(289),
1434 SH73A0_PIN_IO_PU_PD(290),
1435 SH73A0_PIN_IO_PU_PD(291),
1436 SH73A0_PIN_IO_PU_PD(292),
1437 SH73A0_PIN_IO_PU_PD(293),
1438 SH73A0_PIN_IO_PU_PD(294),
1439 SH73A0_PIN_IO_PU_PD(295),
1440 SH73A0_PIN_IO_PU_PD(296),
1441 SH73A0_PIN_IO_PU_PD(297),
1442 SH73A0_PIN_IO_PU_PD(298),
1443 SH73A0_PIN_IO_PU_PD(299),
1444 SH73A0_PIN_IO_PU_PD(300),
1445 SH73A0_PIN_IO_PU_PD(301),
1446 SH73A0_PIN_IO_PU_PD(302),
1447 SH73A0_PIN_IO_PU_PD(303),
1448 SH73A0_PIN_IO_PU_PD(304),
1449 SH73A0_PIN_IO_PU_PD(305),
1450 SH73A0_PIN_O(306),
1451 SH73A0_PIN_O(307),
1452 SH73A0_PIN_I_PU(308),
1453 SH73A0_PIN_O(309),
1454};
1455
1456static const struct pinmux_range pinmux_ranges[] = {
1457 {.begin = 0, .end = 118,},
1458 {.begin = 128, .end = 164,},
1459 {.begin = 192, .end = 282,},
1460 {.begin = 288, .end = 309,},
1461};
1462
1463/* Pin numbers for pins without a corresponding GPIO port number are computed
1464 * from the row and column numbers with a 1000 offset to avoid collisions with
1465 * GPIO port numbers.
1466 */
1467#define PIN_NUMBER(row, col) (1000+((row)-1)*34+(col)-1)
1468
1469/* - BSC -------------------------------------------------------------------- */
1470static const unsigned int bsc_data_0_7_pins[] = {
1471 /* D[0:7] */
1472 74, 75, 76, 77, 78, 79, 80, 81,
1473};
1474static const unsigned int bsc_data_0_7_mux[] = {
1475 D0_NAF0_MARK, D1_NAF1_MARK, D2_NAF2_MARK, D3_NAF3_MARK,
1476 D4_NAF4_MARK, D5_NAF5_MARK, D6_NAF6_MARK, D7_NAF7_MARK,
1477};
1478static const unsigned int bsc_data_8_15_pins[] = {
1479 /* D[8:15] */
1480 82, 83, 84, 85, 86, 87, 88, 89,
1481};
1482static const unsigned int bsc_data_8_15_mux[] = {
1483 D8_NAF8_MARK, D9_NAF9_MARK, D10_NAF10_MARK, D11_NAF11_MARK,
1484 D12_NAF12_MARK, D13_NAF13_MARK, D14_NAF14_MARK, D15_NAF15_MARK,
1485};
1486static const unsigned int bsc_cs4_pins[] = {
1487 /* CS */
1488 90,
1489};
1490static const unsigned int bsc_cs4_mux[] = {
1491 CS4__MARK,
1492};
1493static const unsigned int bsc_cs5_a_pins[] = {
1494 /* CS */
1495 91,
1496};
1497static const unsigned int bsc_cs5_a_mux[] = {
1498 CS5A__MARK,
1499};
1500static const unsigned int bsc_cs5_b_pins[] = {
1501 /* CS */
1502 92,
1503};
1504static const unsigned int bsc_cs5_b_mux[] = {
1505 CS5B__MARK,
1506};
1507static const unsigned int bsc_cs6_a_pins[] = {
1508 /* CS */
1509 94,
1510};
1511static const unsigned int bsc_cs6_a_mux[] = {
1512 CS6A__MARK,
1513};
1514static const unsigned int bsc_cs6_b_pins[] = {
1515 /* CS */
1516 93,
1517};
1518static const unsigned int bsc_cs6_b_mux[] = {
1519 CS6B__MARK,
1520};
1521static const unsigned int bsc_rd_pins[] = {
1522 /* RD */
1523 96,
1524};
1525static const unsigned int bsc_rd_mux[] = {
1526 RD__FSC_MARK,
1527};
1528static const unsigned int bsc_rdwr_0_pins[] = {
1529 /* RDWR */
1530 91,
1531};
1532static const unsigned int bsc_rdwr_0_mux[] = {
1533 PORT91_RDWR_MARK,
1534};
1535static const unsigned int bsc_rdwr_1_pins[] = {
1536 /* RDWR */
1537 97,
1538};
1539static const unsigned int bsc_rdwr_1_mux[] = {
1540 RDWR_FWE_MARK,
1541};
1542static const unsigned int bsc_rdwr_2_pins[] = {
1543 /* RDWR */
1544 149,
1545};
1546static const unsigned int bsc_rdwr_2_mux[] = {
1547 PORT149_RDWR_MARK,
1548};
1549static const unsigned int bsc_we0_pins[] = {
1550 /* WE0 */
1551 97,
1552};
1553static const unsigned int bsc_we0_mux[] = {
1554 WE0__FWE_MARK,
1555};
1556static const unsigned int bsc_we1_pins[] = {
1557 /* WE1 */
1558 98,
1559};
1560static const unsigned int bsc_we1_mux[] = {
1561 WE1__MARK,
1562};
1563/* - FSIA ------------------------------------------------------------------- */
1564static const unsigned int fsia_mclk_in_pins[] = {
1565 /* CK */
1566 49,
1567};
1568static const unsigned int fsia_mclk_in_mux[] = {
1569 FSIACK_MARK,
1570};
1571static const unsigned int fsia_mclk_out_pins[] = {
1572 /* OMC */
1573 49,
1574};
1575static const unsigned int fsia_mclk_out_mux[] = {
1576 FSIAOMC_MARK,
1577};
1578static const unsigned int fsia_sclk_in_pins[] = {
1579 /* ILR, IBT */
1580 50, 51,
1581};
1582static const unsigned int fsia_sclk_in_mux[] = {
1583 FSIAILR_MARK, FSIAIBT_MARK,
1584};
1585static const unsigned int fsia_sclk_out_pins[] = {
1586 /* OLR, OBT */
1587 50, 51,
1588};
1589static const unsigned int fsia_sclk_out_mux[] = {
1590 FSIAOLR_MARK, FSIAOBT_MARK,
1591};
1592static const unsigned int fsia_data_in_pins[] = {
1593 /* ISLD */
1594 55,
1595};
1596static const unsigned int fsia_data_in_mux[] = {
1597 FSIAISLD_MARK,
1598};
1599static const unsigned int fsia_data_out_pins[] = {
1600 /* OSLD */
1601 52,
1602};
1603static const unsigned int fsia_data_out_mux[] = {
1604 FSIAOSLD_MARK,
1605};
1606static const unsigned int fsia_spdif_pins[] = {
1607 /* SPDIF */
1608 53,
1609};
1610static const unsigned int fsia_spdif_mux[] = {
1611 FSIASPDIF_MARK,
1612};
1613/* - FSIB ------------------------------------------------------------------- */
1614static const unsigned int fsib_mclk_in_pins[] = {
1615 /* CK */
1616 54,
1617};
1618static const unsigned int fsib_mclk_in_mux[] = {
1619 FSIBCK_MARK,
1620};
1621static const unsigned int fsib_mclk_out_pins[] = {
1622 /* OMC */
1623 54,
1624};
1625static const unsigned int fsib_mclk_out_mux[] = {
1626 FSIBOMC_MARK,
1627};
1628static const unsigned int fsib_sclk_in_pins[] = {
1629 /* ILR, IBT */
1630 37, 36,
1631};
1632static const unsigned int fsib_sclk_in_mux[] = {
1633 FSIBILR_MARK, FSIBIBT_MARK,
1634};
1635static const unsigned int fsib_sclk_out_pins[] = {
1636 /* OLR, OBT */
1637 37, 36,
1638};
1639static const unsigned int fsib_sclk_out_mux[] = {
1640 FSIBOLR_MARK, FSIBOBT_MARK,
1641};
1642static const unsigned int fsib_data_in_pins[] = {
1643 /* ISLD */
1644 39,
1645};
1646static const unsigned int fsib_data_in_mux[] = {
1647 FSIBISLD_MARK,
1648};
1649static const unsigned int fsib_data_out_pins[] = {
1650 /* OSLD */
1651 38,
1652};
1653static const unsigned int fsib_data_out_mux[] = {
1654 FSIBOSLD_MARK,
1655};
1656static const unsigned int fsib_spdif_pins[] = {
1657 /* SPDIF */
1658 53,
1659};
1660static const unsigned int fsib_spdif_mux[] = {
1661 FSIBSPDIF_MARK,
1662};
1663/* - FSIC ------------------------------------------------------------------- */
1664static const unsigned int fsic_mclk_in_pins[] = {
1665 /* CK */
1666 54,
1667};
1668static const unsigned int fsic_mclk_in_mux[] = {
1669 FSICCK_MARK,
1670};
1671static const unsigned int fsic_mclk_out_pins[] = {
1672 /* OMC */
1673 54,
1674};
1675static const unsigned int fsic_mclk_out_mux[] = {
1676 FSICOMC_MARK,
1677};
1678static const unsigned int fsic_sclk_in_pins[] = {
1679 /* ILR, IBT */
1680 46, 45,
1681};
1682static const unsigned int fsic_sclk_in_mux[] = {
1683 FSICILR_MARK, FSICIBT_MARK,
1684};
1685static const unsigned int fsic_sclk_out_pins[] = {
1686 /* OLR, OBT */
1687 46, 45,
1688};
1689static const unsigned int fsic_sclk_out_mux[] = {
1690 FSICOLR_MARK, FSICOBT_MARK,
1691};
1692static const unsigned int fsic_data_in_pins[] = {
1693 /* ISLD */
1694 48,
1695};
1696static const unsigned int fsic_data_in_mux[] = {
1697 FSICISLD_MARK,
1698};
1699static const unsigned int fsic_data_out_pins[] = {
1700 /* OSLD, OSLDT1, OSLDT2, OSLDT3 */
1701 47, 44, 42, 16,
1702};
1703static const unsigned int fsic_data_out_mux[] = {
1704 FSICOSLD_MARK, FSICOSLDT1_MARK, FSICOSLDT2_MARK, FSICOSLDT3_MARK,
1705};
1706static const unsigned int fsic_spdif_0_pins[] = {
1707 /* SPDIF */
1708 53,
1709};
1710static const unsigned int fsic_spdif_0_mux[] = {
1711 PORT53_FSICSPDIF_MARK,
1712};
1713static const unsigned int fsic_spdif_1_pins[] = {
1714 /* SPDIF */
1715 47,
1716};
1717static const unsigned int fsic_spdif_1_mux[] = {
1718 PORT47_FSICSPDIF_MARK,
1719};
1720/* - FSID ------------------------------------------------------------------- */
1721static const unsigned int fsid_sclk_in_pins[] = {
1722 /* ILR, IBT */
1723 46, 45,
1724};
1725static const unsigned int fsid_sclk_in_mux[] = {
1726 FSIDILR_MARK, FSIDIBT_MARK,
1727};
1728static const unsigned int fsid_sclk_out_pins[] = {
1729 /* OLR, OBT */
1730 46, 45,
1731};
1732static const unsigned int fsid_sclk_out_mux[] = {
1733 FSIDOLR_MARK, FSIDOBT_MARK,
1734};
1735static const unsigned int fsid_data_in_pins[] = {
1736 /* ISLD */
1737 48,
1738};
1739static const unsigned int fsid_data_in_mux[] = {
1740 FSIDISLD_MARK,
1741};
1742/* - I2C2 ------------------------------------------------------------------- */
1743static const unsigned int i2c2_0_pins[] = {
1744 /* SCL, SDA */
1745 237, 236,
1746};
1747static const unsigned int i2c2_0_mux[] = {
1748 PORT237_I2C_SCL2_MARK, PORT236_I2C_SDA2_MARK,
1749};
1750static const unsigned int i2c2_1_pins[] = {
1751 /* SCL, SDA */
1752 27, 28,
1753};
1754static const unsigned int i2c2_1_mux[] = {
1755 PORT27_I2C_SCL2_MARK, PORT28_I2C_SDA2_MARK,
1756};
1757static const unsigned int i2c2_2_pins[] = {
1758 /* SCL, SDA */
1759 115, 116,
1760};
1761static const unsigned int i2c2_2_mux[] = {
1762 PORT115_I2C_SCL2_MARK, PORT116_I2C_SDA2_MARK,
1763};
1764/* - I2C3 ------------------------------------------------------------------- */
1765static const unsigned int i2c3_0_pins[] = {
1766 /* SCL, SDA */
1767 248, 249,
1768};
1769static const unsigned int i2c3_0_mux[] = {
1770 PORT248_I2C_SCL3_MARK, PORT249_I2C_SDA3_MARK,
1771};
1772static const unsigned int i2c3_1_pins[] = {
1773 /* SCL, SDA */
1774 27, 28,
1775};
1776static const unsigned int i2c3_1_mux[] = {
1777 PORT27_I2C_SCL3_MARK, PORT28_I2C_SDA3_MARK,
1778};
1779static const unsigned int i2c3_2_pins[] = {
1780 /* SCL, SDA */
1781 115, 116,
1782};
1783static const unsigned int i2c3_2_mux[] = {
1784 PORT115_I2C_SCL3_MARK, PORT116_I2C_SDA3_MARK,
1785};
1786/* - IrDA ------------------------------------------------------------------- */
1787static const unsigned int irda_0_pins[] = {
1788 /* OUT, IN, FIRSEL */
1789 241, 242, 243,
1790};
1791static const unsigned int irda_0_mux[] = {
1792 PORT241_IRDA_OUT_MARK, PORT242_IRDA_IN_MARK, PORT243_IRDA_FIRSEL_MARK,
1793};
1794static const unsigned int irda_1_pins[] = {
1795 /* OUT, IN, FIRSEL */
1796 49, 53, 54,
1797};
1798static const unsigned int irda_1_mux[] = {
1799 PORT49_IRDA_OUT_MARK, PORT53_IRDA_IN_MARK, PORT54_IRDA_FIRSEL_MARK,
1800};
1801/* - KEYSC ------------------------------------------------------------------ */
1802static const unsigned int keysc_in5_pins[] = {
1803 /* KEYIN[0:4] */
1804 66, 67, 68, 69, 70,
1805};
1806static const unsigned int keysc_in5_mux[] = {
1807 KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
1808 KEYIN4_MARK,
1809};
1810static const unsigned int keysc_in6_pins[] = {
1811 /* KEYIN[0:5] */
1812 66, 67, 68, 69, 70, 71,
1813};
1814static const unsigned int keysc_in6_mux[] = {
1815 KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
1816 KEYIN4_MARK, KEYIN5_MARK,
1817};
1818static const unsigned int keysc_in7_pins[] = {
1819 /* KEYIN[0:6] */
1820 66, 67, 68, 69, 70, 71, 72,
1821};
1822static const unsigned int keysc_in7_mux[] = {
1823 KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
1824 KEYIN4_MARK, KEYIN5_MARK, KEYIN6_MARK,
1825};
1826static const unsigned int keysc_in8_pins[] = {
1827 /* KEYIN[0:7] */
1828 66, 67, 68, 69, 70, 71, 72, 73,
1829};
1830static const unsigned int keysc_in8_mux[] = {
1831 KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
1832 KEYIN4_MARK, KEYIN5_MARK, KEYIN6_MARK, KEYIN7_MARK,
1833};
1834static const unsigned int keysc_out04_pins[] = {
1835 /* KEYOUT[0:4] */
1836 65, 64, 63, 62, 61,
1837};
1838static const unsigned int keysc_out04_mux[] = {
1839 KEYOUT0_MARK, KEYOUT1_MARK, KEYOUT2_MARK, KEYOUT3_MARK, KEYOUT4_MARK,
1840};
1841static const unsigned int keysc_out5_pins[] = {
1842 /* KEYOUT5 */
1843 60,
1844};
1845static const unsigned int keysc_out5_mux[] = {
1846 KEYOUT5_MARK,
1847};
1848static const unsigned int keysc_out6_0_pins[] = {
1849 /* KEYOUT6 */
1850 59,
1851};
1852static const unsigned int keysc_out6_0_mux[] = {
1853 PORT59_KEYOUT6_MARK,
1854};
1855static const unsigned int keysc_out6_1_pins[] = {
1856 /* KEYOUT6 */
1857 131,
1858};
1859static const unsigned int keysc_out6_1_mux[] = {
1860 PORT131_KEYOUT6_MARK,
1861};
1862static const unsigned int keysc_out6_2_pins[] = {
1863 /* KEYOUT6 */
1864 143,
1865};
1866static const unsigned int keysc_out6_2_mux[] = {
1867 PORT143_KEYOUT6_MARK,
1868};
1869static const unsigned int keysc_out7_0_pins[] = {
1870 /* KEYOUT7 */
1871 58,
1872};
1873static const unsigned int keysc_out7_0_mux[] = {
1874 PORT58_KEYOUT7_MARK,
1875};
1876static const unsigned int keysc_out7_1_pins[] = {
1877 /* KEYOUT7 */
1878 132,
1879};
1880static const unsigned int keysc_out7_1_mux[] = {
1881 PORT132_KEYOUT7_MARK,
1882};
1883static const unsigned int keysc_out7_2_pins[] = {
1884 /* KEYOUT7 */
1885 144,
1886};
1887static const unsigned int keysc_out7_2_mux[] = {
1888 PORT144_KEYOUT7_MARK,
1889};
1890static const unsigned int keysc_out8_0_pins[] = {
1891 /* KEYOUT8 */
1892 PIN_NUMBER(6, 26),
1893};
1894static const unsigned int keysc_out8_0_mux[] = {
1895 KEYOUT8_MARK,
1896};
1897static const unsigned int keysc_out8_1_pins[] = {
1898 /* KEYOUT8 */
1899 136,
1900};
1901static const unsigned int keysc_out8_1_mux[] = {
1902 PORT136_KEYOUT8_MARK,
1903};
1904static const unsigned int keysc_out8_2_pins[] = {
1905 /* KEYOUT8 */
1906 138,
1907};
1908static const unsigned int keysc_out8_2_mux[] = {
1909 PORT138_KEYOUT8_MARK,
1910};
1911static const unsigned int keysc_out9_0_pins[] = {
1912 /* KEYOUT9 */
1913 137,
1914};
1915static const unsigned int keysc_out9_0_mux[] = {
1916 PORT137_KEYOUT9_MARK,
1917};
1918static const unsigned int keysc_out9_1_pins[] = {
1919 /* KEYOUT9 */
1920 139,
1921};
1922static const unsigned int keysc_out9_1_mux[] = {
1923 PORT139_KEYOUT9_MARK,
1924};
1925static const unsigned int keysc_out9_2_pins[] = {
1926 /* KEYOUT9 */
1927 149,
1928};
1929static const unsigned int keysc_out9_2_mux[] = {
1930 PORT149_KEYOUT9_MARK,
1931};
1932static const unsigned int keysc_out10_0_pins[] = {
1933 /* KEYOUT10 */
1934 132,
1935};
1936static const unsigned int keysc_out10_0_mux[] = {
1937 PORT132_KEYOUT10_MARK,
1938};
1939static const unsigned int keysc_out10_1_pins[] = {
1940 /* KEYOUT10 */
1941 142,
1942};
1943static const unsigned int keysc_out10_1_mux[] = {
1944 PORT142_KEYOUT10_MARK,
1945};
1946static const unsigned int keysc_out11_0_pins[] = {
1947 /* KEYOUT11 */
1948 131,
1949};
1950static const unsigned int keysc_out11_0_mux[] = {
1951 PORT131_KEYOUT11_MARK,
1952};
1953static const unsigned int keysc_out11_1_pins[] = {
1954 /* KEYOUT11 */
1955 143,
1956};
1957static const unsigned int keysc_out11_1_mux[] = {
1958 PORT143_KEYOUT11_MARK,
1959};
1960/* - LCD -------------------------------------------------------------------- */
1961static const unsigned int lcd_data8_pins[] = {
1962 /* D[0:7] */
1963 192, 193, 194, 195, 196, 197, 198, 199,
1964};
1965static const unsigned int lcd_data8_mux[] = {
1966 LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
1967 LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
1968};
1969static const unsigned int lcd_data9_pins[] = {
1970 /* D[0:8] */
1971 192, 193, 194, 195, 196, 197, 198, 199,
1972 200,
1973};
1974static const unsigned int lcd_data9_mux[] = {
1975 LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
1976 LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
1977 LCDD8_MARK,
1978};
1979static const unsigned int lcd_data12_pins[] = {
1980 /* D[0:11] */
1981 192, 193, 194, 195, 196, 197, 198, 199,
1982 200, 201, 202, 203,
1983};
1984static const unsigned int lcd_data12_mux[] = {
1985 LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
1986 LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
1987 LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
1988};
1989static const unsigned int lcd_data16_pins[] = {
1990 /* D[0:15] */
1991 192, 193, 194, 195, 196, 197, 198, 199,
1992 200, 201, 202, 203, 204, 205, 206, 207,
1993};
1994static const unsigned int lcd_data16_mux[] = {
1995 LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
1996 LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
1997 LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
1998 LCDD12_MARK, LCDD13_MARK, LCDD14_MARK, LCDD15_MARK,
1999};
2000static const unsigned int lcd_data18_pins[] = {
2001 /* D[0:17] */
2002 192, 193, 194, 195, 196, 197, 198, 199,
2003 200, 201, 202, 203, 204, 205, 206, 207,
2004 208, 209,
2005};
2006static const unsigned int lcd_data18_mux[] = {
2007 LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
2008 LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
2009 LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
2010 LCDD12_MARK, LCDD13_MARK, LCDD14_MARK, LCDD15_MARK,
2011 LCDD16_MARK, LCDD17_MARK,
2012};
2013static const unsigned int lcd_data24_pins[] = {
2014 /* D[0:23] */
2015 192, 193, 194, 195, 196, 197, 198, 199,
2016 200, 201, 202, 203, 204, 205, 206, 207,
2017 208, 209, 210, 211, 212, 213, 214, 215
2018};
2019static const unsigned int lcd_data24_mux[] = {
2020 LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
2021 LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
2022 LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
2023 LCDD12_MARK, LCDD13_MARK, LCDD14_MARK, LCDD15_MARK,
2024 LCDD16_MARK, LCDD17_MARK, LCDD18_MARK, LCDD19_MARK,
2025 LCDD20_MARK, LCDD21_MARK, LCDD22_MARK, LCDD23_MARK,
2026};
2027static const unsigned int lcd_display_pins[] = {
2028 /* DON */
2029 222,
2030};
2031static const unsigned int lcd_display_mux[] = {
2032 LCDDON_MARK,
2033};
2034static const unsigned int lcd_lclk_pins[] = {
2035 /* LCLK */
2036 221,
2037};
2038static const unsigned int lcd_lclk_mux[] = {
2039 LCDLCLK_MARK,
2040};
2041static const unsigned int lcd_sync_pins[] = {
2042 /* VSYN, HSYN, DCK, DISP */
2043 220, 218, 216, 219,
2044};
2045static const unsigned int lcd_sync_mux[] = {
2046 LCDVSYN_MARK, LCDHSYN_MARK, LCDDCK_MARK, LCDDISP_MARK,
2047};
2048static const unsigned int lcd_sys_pins[] = {
2049 /* CS, WR, RD, RS */
2050 218, 216, 217, 219,
2051};
2052static const unsigned int lcd_sys_mux[] = {
2053 LCDCS__MARK, LCDWR__MARK, LCDRD__MARK, LCDRS_MARK,
2054};
2055/* - LCD2 ------------------------------------------------------------------- */
2056static const unsigned int lcd2_data8_pins[] = {
2057 /* D[0:7] */
2058 128, 129, 142, 143, 144, 145, 138, 139,
2059};
2060static const unsigned int lcd2_data8_mux[] = {
2061 LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
2062 LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
2063};
2064static const unsigned int lcd2_data9_pins[] = {
2065 /* D[0:8] */
2066 128, 129, 142, 143, 144, 145, 138, 139,
2067 140,
2068};
2069static const unsigned int lcd2_data9_mux[] = {
2070 LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
2071 LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
2072 LCD2D8_MARK,
2073};
2074static const unsigned int lcd2_data12_pins[] = {
2075 /* D[0:12] */
2076 128, 129, 142, 143, 144, 145, 138, 139,
2077 140, 141, 130, 131,
2078};
2079static const unsigned int lcd2_data12_mux[] = {
2080 LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
2081 LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
2082 LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
2083};
2084static const unsigned int lcd2_data16_pins[] = {
2085 /* D[0:15] */
2086 128, 129, 142, 143, 144, 145, 138, 139,
2087 140, 141, 130, 131, 132, 133, 134, 135,
2088};
2089static const unsigned int lcd2_data16_mux[] = {
2090 LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
2091 LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
2092 LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
2093 LCD2D12_MARK, LCD2D13_MARK, LCD2D14_MARK, LCD2D15_MARK,
2094};
2095static const unsigned int lcd2_data18_pins[] = {
2096 /* D[0:17] */
2097 128, 129, 142, 143, 144, 145, 138, 139,
2098 140, 141, 130, 131, 132, 133, 134, 135,
2099 136, 137,
2100};
2101static const unsigned int lcd2_data18_mux[] = {
2102 LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
2103 LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
2104 LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
2105 LCD2D12_MARK, LCD2D13_MARK, LCD2D14_MARK, LCD2D15_MARK,
2106 LCD2D16_MARK, LCD2D17_MARK,
2107};
2108static const unsigned int lcd2_data24_pins[] = {
2109 /* D[0:23] */
2110 128, 129, 142, 143, 144, 145, 138, 139,
2111 140, 141, 130, 131, 132, 133, 134, 135,
2112 136, 137, 146, 147, 234, 235, 238, 239
2113};
2114static const unsigned int lcd2_data24_mux[] = {
2115 LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
2116 LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
2117 LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
2118 LCD2D12_MARK, LCD2D13_MARK, LCD2D14_MARK, LCD2D15_MARK,
2119 LCD2D16_MARK, LCD2D17_MARK, LCD2D18_MARK, LCD2D19_MARK,
2120 LCD2D20_MARK, LCD2D21_MARK, LCD2D22_MARK, LCD2D23_MARK,
2121};
2122static const unsigned int lcd2_sync_0_pins[] = {
2123 /* VSYN, HSYN, DCK, DISP */
2124 128, 129, 146, 145,
2125};
2126static const unsigned int lcd2_sync_0_mux[] = {
2127 PORT128_LCD2VSYN_MARK, PORT129_LCD2HSYN_MARK,
2128 LCD2DCK_MARK, PORT145_LCD2DISP_MARK,
2129};
2130static const unsigned int lcd2_sync_1_pins[] = {
2131 /* VSYN, HSYN, DCK, DISP */
2132 222, 221, 219, 217,
2133};
2134static const unsigned int lcd2_sync_1_mux[] = {
2135 PORT222_LCD2VSYN_MARK, PORT221_LCD2HSYN_MARK,
2136 LCD2DCK_2_MARK, PORT217_LCD2DISP_MARK,
2137};
2138static const unsigned int lcd2_sys_0_pins[] = {
2139 /* CS, WR, RD, RS */
2140 129, 146, 147, 145,
2141};
2142static const unsigned int lcd2_sys_0_mux[] = {
2143 PORT129_LCD2CS__MARK, PORT146_LCD2WR__MARK,
2144 LCD2RD__MARK, PORT145_LCD2RS_MARK,
2145};
2146static const unsigned int lcd2_sys_1_pins[] = {
2147 /* CS, WR, RD, RS */
2148 221, 219, 147, 217,
2149};
2150static const unsigned int lcd2_sys_1_mux[] = {
2151 PORT221_LCD2CS__MARK, PORT219_LCD2WR__MARK,
2152 LCD2RD__MARK, PORT217_LCD2RS_MARK,
2153};
2154/* - MMCIF ------------------------------------------------------------------ */
2155static const unsigned int mmc0_data1_0_pins[] = {
2156 /* D[0] */
2157 271,
2158};
2159static const unsigned int mmc0_data1_0_mux[] = {
2160 MMCD0_0_MARK,
2161};
2162static const unsigned int mmc0_data4_0_pins[] = {
2163 /* D[0:3] */
2164 271, 272, 273, 274,
2165};
2166static const unsigned int mmc0_data4_0_mux[] = {
2167 MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
2168};
2169static const unsigned int mmc0_data8_0_pins[] = {
2170 /* D[0:7] */
2171 271, 272, 273, 274, 275, 276, 277, 278,
2172};
2173static const unsigned int mmc0_data8_0_mux[] = {
2174 MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
2175 MMCD0_4_MARK, MMCD0_5_MARK, MMCD0_6_MARK, MMCD0_7_MARK,
2176};
2177static const unsigned int mmc0_ctrl_0_pins[] = {
2178 /* CMD, CLK */
2179 279, 270,
2180};
2181static const unsigned int mmc0_ctrl_0_mux[] = {
2182 MMCCMD0_MARK, MMCCLK0_MARK,
2183};
1488 2184
1489 /* Functions with pull-ups */ 2185static const unsigned int mmc0_data1_1_pins[] = {
1490 PINMUX_DATA(KEYIN0_PU_MARK, PORT66_FN2, PORT66_IN_PU), 2186 /* D[0] */
1491 PINMUX_DATA(KEYIN1_PU_MARK, PORT67_FN2, PORT67_IN_PU), 2187 305,
1492 PINMUX_DATA(KEYIN2_PU_MARK, PORT68_FN2, PORT68_IN_PU), 2188};
1493 PINMUX_DATA(KEYIN3_PU_MARK, PORT69_FN2, PORT69_IN_PU), 2189static const unsigned int mmc0_data1_1_mux[] = {
1494 PINMUX_DATA(KEYIN4_PU_MARK, PORT70_FN2, PORT70_IN_PU), 2190 MMCD1_0_MARK,
1495 PINMUX_DATA(KEYIN5_PU_MARK, PORT71_FN2, PORT71_IN_PU), 2191};
1496 PINMUX_DATA(KEYIN6_PU_MARK, PORT72_FN2, PORT72_IN_PU), 2192static const unsigned int mmc0_data4_1_pins[] = {
1497 PINMUX_DATA(KEYIN7_PU_MARK, PORT73_FN2, PORT73_IN_PU), 2193 /* D[0:3] */
1498 2194 305, 304, 303, 302,
1499 PINMUX_DATA(SDHICD0_PU_MARK, PORT251_FN1, PORT251_IN_PU), 2195};
1500 PINMUX_DATA(SDHID0_0_PU_MARK, PORT252_FN1, PORT252_IN_PU), 2196static const unsigned int mmc0_data4_1_mux[] = {
1501 PINMUX_DATA(SDHID0_1_PU_MARK, PORT253_FN1, PORT253_IN_PU), 2197 MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
1502 PINMUX_DATA(SDHID0_2_PU_MARK, PORT254_FN1, PORT254_IN_PU), 2198};
1503 PINMUX_DATA(SDHID0_3_PU_MARK, PORT255_FN1, PORT255_IN_PU), 2199static const unsigned int mmc0_data8_1_pins[] = {
1504 PINMUX_DATA(SDHICMD0_PU_MARK, PORT256_FN1, PORT256_IN_PU), 2200 /* D[0:7] */
1505 PINMUX_DATA(SDHIWP0_PU_MARK, PORT257_FN1, PORT256_IN_PU), 2201 305, 304, 303, 302, 301, 300, 299, 298,
1506 PINMUX_DATA(SDHID1_0_PU_MARK, PORT259_FN1, PORT259_IN_PU), 2202};
1507 PINMUX_DATA(SDHID1_1_PU_MARK, PORT260_FN1, PORT260_IN_PU), 2203static const unsigned int mmc0_data8_1_mux[] = {
1508 PINMUX_DATA(SDHID1_2_PU_MARK, PORT261_FN1, PORT261_IN_PU), 2204 MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
1509 PINMUX_DATA(SDHID1_3_PU_MARK, PORT262_FN1, PORT262_IN_PU), 2205 MMCD1_4_MARK, MMCD1_5_MARK, MMCD1_6_MARK, MMCD1_7_MARK,
1510 PINMUX_DATA(SDHICMD1_PU_MARK, PORT263_FN1, PORT263_IN_PU), 2206};
1511 PINMUX_DATA(SDHID2_0_PU_MARK, PORT265_FN1, PORT265_IN_PU), 2207static const unsigned int mmc0_ctrl_1_pins[] = {
1512 PINMUX_DATA(SDHID2_1_PU_MARK, PORT266_FN1, PORT266_IN_PU), 2208 /* CMD, CLK */
1513 PINMUX_DATA(SDHID2_2_PU_MARK, PORT267_FN1, PORT267_IN_PU), 2209 297, 289,
1514 PINMUX_DATA(SDHID2_3_PU_MARK, PORT268_FN1, PORT268_IN_PU), 2210};
1515 PINMUX_DATA(SDHICMD2_PU_MARK, PORT269_FN1, PORT269_IN_PU), 2211static const unsigned int mmc0_ctrl_1_mux[] = {
1516 2212 MMCCMD1_MARK, MMCCLK1_MARK,
1517 PINMUX_DATA(MMCCMD0_PU_MARK, PORT279_FN1, PORT279_IN_PU, 2213};
1518 MSEL4CR_MSEL15_0), 2214/* - SCIFA0 ----------------------------------------------------------------- */
1519 PINMUX_DATA(MMCCMD1_PU_MARK, PORT297_FN2, PORT297_IN_PU, 2215static const unsigned int scifa0_data_pins[] = {
1520 MSEL4CR_MSEL15_1), 2216 /* RXD, TXD */
1521 2217 43, 17,
1522 PINMUX_DATA(MMCD0_0_PU_MARK, 2218};
1523 PORT271_FN1, PORT271_IN_PU, MSEL4CR_MSEL15_0), 2219static const unsigned int scifa0_data_mux[] = {
1524 PINMUX_DATA(MMCD0_1_PU_MARK, 2220 SCIFA0_RXD_MARK, SCIFA0_TXD_MARK,
1525 PORT272_FN1, PORT272_IN_PU, MSEL4CR_MSEL15_0), 2221};
1526 PINMUX_DATA(MMCD0_2_PU_MARK, 2222static const unsigned int scifa0_clk_pins[] = {
1527 PORT273_FN1, PORT273_IN_PU, MSEL4CR_MSEL15_0), 2223 /* SCK */
1528 PINMUX_DATA(MMCD0_3_PU_MARK, 2224 16,
1529 PORT274_FN1, PORT274_IN_PU, MSEL4CR_MSEL15_0), 2225};
1530 PINMUX_DATA(MMCD0_4_PU_MARK, 2226static const unsigned int scifa0_clk_mux[] = {
1531 PORT275_FN1, PORT275_IN_PU, MSEL4CR_MSEL15_0), 2227 SCIFA0_SCK_MARK,
1532 PINMUX_DATA(MMCD0_5_PU_MARK, 2228};
1533 PORT276_FN1, PORT276_IN_PU, MSEL4CR_MSEL15_0), 2229static const unsigned int scifa0_ctrl_pins[] = {
1534 PINMUX_DATA(MMCD0_6_PU_MARK, 2230 /* RTS, CTS */
1535 PORT277_FN1, PORT277_IN_PU, MSEL4CR_MSEL15_0), 2231 42, 44,
1536 PINMUX_DATA(MMCD0_7_PU_MARK, 2232};
1537 PORT278_FN1, PORT278_IN_PU, MSEL4CR_MSEL15_0), 2233static const unsigned int scifa0_ctrl_mux[] = {
1538 2234 SCIFA0_RTS__MARK, SCIFA0_CTS__MARK,
1539 PINMUX_DATA(FSIBISLD_PU_MARK, PORT39_FN1, PORT39_IN_PU), 2235};
1540 PINMUX_DATA(FSIACK_PU_MARK, PORT49_FN1, PORT49_IN_PU), 2236/* - SCIFA1 ----------------------------------------------------------------- */
1541 PINMUX_DATA(FSIAILR_PU_MARK, PORT50_FN5, PORT50_IN_PU), 2237static const unsigned int scifa1_data_pins[] = {
1542 PINMUX_DATA(FSIAIBT_PU_MARK, PORT51_FN5, PORT51_IN_PU), 2238 /* RXD, TXD */
1543 PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), 2239 228, 225,
1544}; 2240};
1545 2241static const unsigned int scifa1_data_mux[] = {
1546static struct pinmux_gpio pinmux_gpios[] = { 2242 SCIFA1_RXD_MARK, SCIFA1_TXD_MARK,
1547 GPIO_PORT_ALL(), 2243};
2244static const unsigned int scifa1_clk_pins[] = {
2245 /* SCK */
2246 226,
2247};
2248static const unsigned int scifa1_clk_mux[] = {
2249 SCIFA1_SCK_MARK,
2250};
2251static const unsigned int scifa1_ctrl_pins[] = {
2252 /* RTS, CTS */
2253 227, 229,
2254};
2255static const unsigned int scifa1_ctrl_mux[] = {
2256 SCIFA1_RTS__MARK, SCIFA1_CTS__MARK,
2257};
2258/* - SCIFA2 ----------------------------------------------------------------- */
2259static const unsigned int scifa2_data_0_pins[] = {
2260 /* RXD, TXD */
2261 155, 154,
2262};
2263static const unsigned int scifa2_data_0_mux[] = {
2264 SCIFA2_RXD1_MARK, SCIFA2_TXD1_MARK,
2265};
2266static const unsigned int scifa2_clk_0_pins[] = {
2267 /* SCK */
2268 158,
2269};
2270static const unsigned int scifa2_clk_0_mux[] = {
2271 SCIFA2_SCK1_MARK,
2272};
2273static const unsigned int scifa2_ctrl_0_pins[] = {
2274 /* RTS, CTS */
2275 156, 157,
2276};
2277static const unsigned int scifa2_ctrl_0_mux[] = {
2278 SCIFA2_RTS1__MARK, SCIFA2_CTS1__MARK,
2279};
2280static const unsigned int scifa2_data_1_pins[] = {
2281 /* RXD, TXD */
2282 233, 230,
2283};
2284static const unsigned int scifa2_data_1_mux[] = {
2285 SCIFA2_RXD2_MARK, SCIFA2_TXD2_MARK,
2286};
2287static const unsigned int scifa2_clk_1_pins[] = {
2288 /* SCK */
2289 232,
2290};
2291static const unsigned int scifa2_clk_1_mux[] = {
2292 SCIFA2_SCK2_MARK,
2293};
2294static const unsigned int scifa2_ctrl_1_pins[] = {
2295 /* RTS, CTS */
2296 234, 231,
2297};
2298static const unsigned int scifa2_ctrl_1_mux[] = {
2299 SCIFA2_RTS2__MARK, SCIFA2_CTS2__MARK,
2300};
2301/* - SCIFA3 ----------------------------------------------------------------- */
2302static const unsigned int scifa3_data_pins[] = {
2303 /* RXD, TXD */
2304 108, 110,
2305};
2306static const unsigned int scifa3_data_mux[] = {
2307 SCIFA3_RXD_MARK, SCIFA3_TXD_MARK,
2308};
2309static const unsigned int scifa3_ctrl_pins[] = {
2310 /* RTS, CTS */
2311 109, 107,
2312};
2313static const unsigned int scifa3_ctrl_mux[] = {
2314 SCIFA3_RTS__MARK, SCIFA3_CTS__MARK,
2315};
2316/* - SCIFA4 ----------------------------------------------------------------- */
2317static const unsigned int scifa4_data_pins[] = {
2318 /* RXD, TXD */
2319 33, 32,
2320};
2321static const unsigned int scifa4_data_mux[] = {
2322 SCIFA4_RXD_MARK, SCIFA4_TXD_MARK,
2323};
2324static const unsigned int scifa4_ctrl_pins[] = {
2325 /* RTS, CTS */
2326 34, 35,
2327};
2328static const unsigned int scifa4_ctrl_mux[] = {
2329 SCIFA4_RTS__MARK, SCIFA4_CTS__MARK,
2330};
2331/* - SCIFA5 ----------------------------------------------------------------- */
2332static const unsigned int scifa5_data_0_pins[] = {
2333 /* RXD, TXD */
2334 246, 247,
2335};
2336static const unsigned int scifa5_data_0_mux[] = {
2337 PORT246_SCIFA5_RXD_MARK, PORT247_SCIFA5_TXD_MARK,
2338};
2339static const unsigned int scifa5_clk_0_pins[] = {
2340 /* SCK */
2341 248,
2342};
2343static const unsigned int scifa5_clk_0_mux[] = {
2344 PORT248_SCIFA5_SCK_MARK,
2345};
2346static const unsigned int scifa5_ctrl_0_pins[] = {
2347 /* RTS, CTS */
2348 245, 244,
2349};
2350static const unsigned int scifa5_ctrl_0_mux[] = {
2351 PORT245_SCIFA5_RTS__MARK, PORT244_SCIFA5_CTS__MARK,
2352};
2353static const unsigned int scifa5_data_1_pins[] = {
2354 /* RXD, TXD */
2355 195, 196,
2356};
2357static const unsigned int scifa5_data_1_mux[] = {
2358 PORT195_SCIFA5_RXD_MARK, PORT196_SCIFA5_TXD_MARK,
2359};
2360static const unsigned int scifa5_clk_1_pins[] = {
2361 /* SCK */
2362 197,
2363};
2364static const unsigned int scifa5_clk_1_mux[] = {
2365 PORT197_SCIFA5_SCK_MARK,
2366};
2367static const unsigned int scifa5_ctrl_1_pins[] = {
2368 /* RTS, CTS */
2369 194, 193,
2370};
2371static const unsigned int scifa5_ctrl_1_mux[] = {
2372 PORT194_SCIFA5_RTS__MARK, PORT193_SCIFA5_CTS__MARK,
2373};
2374static const unsigned int scifa5_data_2_pins[] = {
2375 /* RXD, TXD */
2376 162, 160,
2377};
2378static const unsigned int scifa5_data_2_mux[] = {
2379 PORT162_SCIFA5_RXD_MARK, PORT160_SCIFA5_TXD_MARK,
2380};
2381static const unsigned int scifa5_clk_2_pins[] = {
2382 /* SCK */
2383 159,
2384};
2385static const unsigned int scifa5_clk_2_mux[] = {
2386 PORT159_SCIFA5_SCK_MARK,
2387};
2388static const unsigned int scifa5_ctrl_2_pins[] = {
2389 /* RTS, CTS */
2390 163, 161,
2391};
2392static const unsigned int scifa5_ctrl_2_mux[] = {
2393 PORT163_SCIFA5_RTS__MARK, PORT161_SCIFA5_CTS__MARK,
2394};
2395/* - SCIFA6 ----------------------------------------------------------------- */
2396static const unsigned int scifa6_pins[] = {
2397 /* TXD */
2398 240,
2399};
2400static const unsigned int scifa6_mux[] = {
2401 SCIFA6_TXD_MARK,
2402};
2403/* - SCIFA7 ----------------------------------------------------------------- */
2404static const unsigned int scifa7_data_pins[] = {
2405 /* RXD, TXD */
2406 12, 18,
2407};
2408static const unsigned int scifa7_data_mux[] = {
2409 SCIFA7_RXD_MARK, SCIFA7_TXD_MARK,
2410};
2411static const unsigned int scifa7_ctrl_pins[] = {
2412 /* RTS, CTS */
2413 19, 13,
2414};
2415static const unsigned int scifa7_ctrl_mux[] = {
2416 SCIFA7_RTS__MARK, SCIFA7_CTS__MARK,
2417};
2418/* - SCIFB ------------------------------------------------------------------ */
2419static const unsigned int scifb_data_0_pins[] = {
2420 /* RXD, TXD */
2421 162, 160,
2422};
2423static const unsigned int scifb_data_0_mux[] = {
2424 PORT162_SCIFB_RXD_MARK, PORT160_SCIFB_TXD_MARK,
2425};
2426static const unsigned int scifb_clk_0_pins[] = {
2427 /* SCK */
2428 159,
2429};
2430static const unsigned int scifb_clk_0_mux[] = {
2431 PORT159_SCIFB_SCK_MARK,
2432};
2433static const unsigned int scifb_ctrl_0_pins[] = {
2434 /* RTS, CTS */
2435 163, 161,
2436};
2437static const unsigned int scifb_ctrl_0_mux[] = {
2438 PORT163_SCIFB_RTS__MARK, PORT161_SCIFB_CTS__MARK,
2439};
2440static const unsigned int scifb_data_1_pins[] = {
2441 /* RXD, TXD */
2442 246, 247,
2443};
2444static const unsigned int scifb_data_1_mux[] = {
2445 PORT246_SCIFB_RXD_MARK, PORT247_SCIFB_TXD_MARK,
2446};
2447static const unsigned int scifb_clk_1_pins[] = {
2448 /* SCK */
2449 248,
2450};
2451static const unsigned int scifb_clk_1_mux[] = {
2452 PORT248_SCIFB_SCK_MARK,
2453};
2454static const unsigned int scifb_ctrl_1_pins[] = {
2455 /* RTS, CTS */
2456 245, 244,
2457};
2458static const unsigned int scifb_ctrl_1_mux[] = {
2459 PORT245_SCIFB_RTS__MARK, PORT244_SCIFB_CTS__MARK,
2460};
2461/* - SDHI0 ------------------------------------------------------------------ */
2462static const unsigned int sdhi0_data1_pins[] = {
2463 /* D0 */
2464 252,
2465};
2466static const unsigned int sdhi0_data1_mux[] = {
2467 SDHID0_0_MARK,
2468};
2469static const unsigned int sdhi0_data4_pins[] = {
2470 /* D[0:3] */
2471 252, 253, 254, 255,
2472};
2473static const unsigned int sdhi0_data4_mux[] = {
2474 SDHID0_0_MARK, SDHID0_1_MARK, SDHID0_2_MARK, SDHID0_3_MARK,
2475};
2476static const unsigned int sdhi0_ctrl_pins[] = {
2477 /* CMD, CLK */
2478 256, 250,
2479};
2480static const unsigned int sdhi0_ctrl_mux[] = {
2481 SDHICMD0_MARK, SDHICLK0_MARK,
2482};
2483static const unsigned int sdhi0_cd_pins[] = {
2484 /* CD */
2485 251,
2486};
2487static const unsigned int sdhi0_cd_mux[] = {
2488 SDHICD0_MARK,
2489};
2490static const unsigned int sdhi0_wp_pins[] = {
2491 /* WP */
2492 257,
2493};
2494static const unsigned int sdhi0_wp_mux[] = {
2495 SDHIWP0_MARK,
2496};
2497/* - SDHI1 ------------------------------------------------------------------ */
2498static const unsigned int sdhi1_data1_pins[] = {
2499 /* D0 */
2500 259,
2501};
2502static const unsigned int sdhi1_data1_mux[] = {
2503 SDHID1_0_MARK,
2504};
2505static const unsigned int sdhi1_data4_pins[] = {
2506 /* D[0:3] */
2507 259, 260, 261, 262,
2508};
2509static const unsigned int sdhi1_data4_mux[] = {
2510 SDHID1_0_MARK, SDHID1_1_MARK, SDHID1_2_MARK, SDHID1_3_MARK,
2511};
2512static const unsigned int sdhi1_ctrl_pins[] = {
2513 /* CMD, CLK */
2514 263, 258,
2515};
2516static const unsigned int sdhi1_ctrl_mux[] = {
2517 SDHICMD1_MARK, SDHICLK1_MARK,
2518};
2519/* - SDHI2 ------------------------------------------------------------------ */
2520static const unsigned int sdhi2_data1_pins[] = {
2521 /* D0 */
2522 265,
2523};
2524static const unsigned int sdhi2_data1_mux[] = {
2525 SDHID2_0_MARK,
2526};
2527static const unsigned int sdhi2_data4_pins[] = {
2528 /* D[0:3] */
2529 265, 266, 267, 268,
2530};
2531static const unsigned int sdhi2_data4_mux[] = {
2532 SDHID2_0_MARK, SDHID2_1_MARK, SDHID2_2_MARK, SDHID2_3_MARK,
2533};
2534static const unsigned int sdhi2_ctrl_pins[] = {
2535 /* CMD, CLK */
2536 269, 264,
2537};
2538static const unsigned int sdhi2_ctrl_mux[] = {
2539 SDHICMD2_MARK, SDHICLK2_MARK,
2540};
2541/* - USB -------------------------------------------------------------------- */
2542static const unsigned int usb_vbus_pins[] = {
2543 /* VBUS */
2544 0,
2545};
2546static const unsigned int usb_vbus_mux[] = {
2547 VBUS_0_MARK,
2548};
2549
2550static const struct sh_pfc_pin_group pinmux_groups[] = {
2551 SH_PFC_PIN_GROUP(bsc_data_0_7),
2552 SH_PFC_PIN_GROUP(bsc_data_8_15),
2553 SH_PFC_PIN_GROUP(bsc_cs4),
2554 SH_PFC_PIN_GROUP(bsc_cs5_a),
2555 SH_PFC_PIN_GROUP(bsc_cs5_b),
2556 SH_PFC_PIN_GROUP(bsc_cs6_a),
2557 SH_PFC_PIN_GROUP(bsc_cs6_b),
2558 SH_PFC_PIN_GROUP(bsc_rd),
2559 SH_PFC_PIN_GROUP(bsc_rdwr_0),
2560 SH_PFC_PIN_GROUP(bsc_rdwr_1),
2561 SH_PFC_PIN_GROUP(bsc_rdwr_2),
2562 SH_PFC_PIN_GROUP(bsc_we0),
2563 SH_PFC_PIN_GROUP(bsc_we1),
2564 SH_PFC_PIN_GROUP(fsia_mclk_in),
2565 SH_PFC_PIN_GROUP(fsia_mclk_out),
2566 SH_PFC_PIN_GROUP(fsia_sclk_in),
2567 SH_PFC_PIN_GROUP(fsia_sclk_out),
2568 SH_PFC_PIN_GROUP(fsia_data_in),
2569 SH_PFC_PIN_GROUP(fsia_data_out),
2570 SH_PFC_PIN_GROUP(fsia_spdif),
2571 SH_PFC_PIN_GROUP(fsib_mclk_in),
2572 SH_PFC_PIN_GROUP(fsib_mclk_out),
2573 SH_PFC_PIN_GROUP(fsib_sclk_in),
2574 SH_PFC_PIN_GROUP(fsib_sclk_out),
2575 SH_PFC_PIN_GROUP(fsib_data_in),
2576 SH_PFC_PIN_GROUP(fsib_data_out),
2577 SH_PFC_PIN_GROUP(fsib_spdif),
2578 SH_PFC_PIN_GROUP(fsic_mclk_in),
2579 SH_PFC_PIN_GROUP(fsic_mclk_out),
2580 SH_PFC_PIN_GROUP(fsic_sclk_in),
2581 SH_PFC_PIN_GROUP(fsic_sclk_out),
2582 SH_PFC_PIN_GROUP(fsic_data_in),
2583 SH_PFC_PIN_GROUP(fsic_data_out),
2584 SH_PFC_PIN_GROUP(fsic_spdif_0),
2585 SH_PFC_PIN_GROUP(fsic_spdif_1),
2586 SH_PFC_PIN_GROUP(fsid_sclk_in),
2587 SH_PFC_PIN_GROUP(fsid_sclk_out),
2588 SH_PFC_PIN_GROUP(fsid_data_in),
2589 SH_PFC_PIN_GROUP(i2c2_0),
2590 SH_PFC_PIN_GROUP(i2c2_1),
2591 SH_PFC_PIN_GROUP(i2c2_2),
2592 SH_PFC_PIN_GROUP(i2c3_0),
2593 SH_PFC_PIN_GROUP(i2c3_1),
2594 SH_PFC_PIN_GROUP(i2c3_2),
2595 SH_PFC_PIN_GROUP(irda_0),
2596 SH_PFC_PIN_GROUP(irda_1),
2597 SH_PFC_PIN_GROUP(keysc_in5),
2598 SH_PFC_PIN_GROUP(keysc_in6),
2599 SH_PFC_PIN_GROUP(keysc_in7),
2600 SH_PFC_PIN_GROUP(keysc_in8),
2601 SH_PFC_PIN_GROUP(keysc_out04),
2602 SH_PFC_PIN_GROUP(keysc_out5),
2603 SH_PFC_PIN_GROUP(keysc_out6_0),
2604 SH_PFC_PIN_GROUP(keysc_out6_1),
2605 SH_PFC_PIN_GROUP(keysc_out6_2),
2606 SH_PFC_PIN_GROUP(keysc_out7_0),
2607 SH_PFC_PIN_GROUP(keysc_out7_1),
2608 SH_PFC_PIN_GROUP(keysc_out7_2),
2609 SH_PFC_PIN_GROUP(keysc_out8_0),
2610 SH_PFC_PIN_GROUP(keysc_out8_1),
2611 SH_PFC_PIN_GROUP(keysc_out8_2),
2612 SH_PFC_PIN_GROUP(keysc_out9_0),
2613 SH_PFC_PIN_GROUP(keysc_out9_1),
2614 SH_PFC_PIN_GROUP(keysc_out9_2),
2615 SH_PFC_PIN_GROUP(keysc_out10_0),
2616 SH_PFC_PIN_GROUP(keysc_out10_1),
2617 SH_PFC_PIN_GROUP(keysc_out11_0),
2618 SH_PFC_PIN_GROUP(keysc_out11_1),
2619 SH_PFC_PIN_GROUP(lcd_data8),
2620 SH_PFC_PIN_GROUP(lcd_data9),
2621 SH_PFC_PIN_GROUP(lcd_data12),
2622 SH_PFC_PIN_GROUP(lcd_data16),
2623 SH_PFC_PIN_GROUP(lcd_data18),
2624 SH_PFC_PIN_GROUP(lcd_data24),
2625 SH_PFC_PIN_GROUP(lcd_display),
2626 SH_PFC_PIN_GROUP(lcd_lclk),
2627 SH_PFC_PIN_GROUP(lcd_sync),
2628 SH_PFC_PIN_GROUP(lcd_sys),
2629 SH_PFC_PIN_GROUP(lcd2_data8),
2630 SH_PFC_PIN_GROUP(lcd2_data9),
2631 SH_PFC_PIN_GROUP(lcd2_data12),
2632 SH_PFC_PIN_GROUP(lcd2_data16),
2633 SH_PFC_PIN_GROUP(lcd2_data18),
2634 SH_PFC_PIN_GROUP(lcd2_data24),
2635 SH_PFC_PIN_GROUP(lcd2_sync_0),
2636 SH_PFC_PIN_GROUP(lcd2_sync_1),
2637 SH_PFC_PIN_GROUP(lcd2_sys_0),
2638 SH_PFC_PIN_GROUP(lcd2_sys_1),
2639 SH_PFC_PIN_GROUP(mmc0_data1_0),
2640 SH_PFC_PIN_GROUP(mmc0_data4_0),
2641 SH_PFC_PIN_GROUP(mmc0_data8_0),
2642 SH_PFC_PIN_GROUP(mmc0_ctrl_0),
2643 SH_PFC_PIN_GROUP(mmc0_data1_1),
2644 SH_PFC_PIN_GROUP(mmc0_data4_1),
2645 SH_PFC_PIN_GROUP(mmc0_data8_1),
2646 SH_PFC_PIN_GROUP(mmc0_ctrl_1),
2647 SH_PFC_PIN_GROUP(scifa0_data),
2648 SH_PFC_PIN_GROUP(scifa0_clk),
2649 SH_PFC_PIN_GROUP(scifa0_ctrl),
2650 SH_PFC_PIN_GROUP(scifa1_data),
2651 SH_PFC_PIN_GROUP(scifa1_clk),
2652 SH_PFC_PIN_GROUP(scifa1_ctrl),
2653 SH_PFC_PIN_GROUP(scifa2_data_0),
2654 SH_PFC_PIN_GROUP(scifa2_clk_0),
2655 SH_PFC_PIN_GROUP(scifa2_ctrl_0),
2656 SH_PFC_PIN_GROUP(scifa2_data_1),
2657 SH_PFC_PIN_GROUP(scifa2_clk_1),
2658 SH_PFC_PIN_GROUP(scifa2_ctrl_1),
2659 SH_PFC_PIN_GROUP(scifa3_data),
2660 SH_PFC_PIN_GROUP(scifa3_ctrl),
2661 SH_PFC_PIN_GROUP(scifa4_data),
2662 SH_PFC_PIN_GROUP(scifa4_ctrl),
2663 SH_PFC_PIN_GROUP(scifa5_data_0),
2664 SH_PFC_PIN_GROUP(scifa5_clk_0),
2665 SH_PFC_PIN_GROUP(scifa5_ctrl_0),
2666 SH_PFC_PIN_GROUP(scifa5_data_1),
2667 SH_PFC_PIN_GROUP(scifa5_clk_1),
2668 SH_PFC_PIN_GROUP(scifa5_ctrl_1),
2669 SH_PFC_PIN_GROUP(scifa5_data_2),
2670 SH_PFC_PIN_GROUP(scifa5_clk_2),
2671 SH_PFC_PIN_GROUP(scifa5_ctrl_2),
2672 SH_PFC_PIN_GROUP(scifa6),
2673 SH_PFC_PIN_GROUP(scifa7_data),
2674 SH_PFC_PIN_GROUP(scifa7_ctrl),
2675 SH_PFC_PIN_GROUP(scifb_data_0),
2676 SH_PFC_PIN_GROUP(scifb_clk_0),
2677 SH_PFC_PIN_GROUP(scifb_ctrl_0),
2678 SH_PFC_PIN_GROUP(scifb_data_1),
2679 SH_PFC_PIN_GROUP(scifb_clk_1),
2680 SH_PFC_PIN_GROUP(scifb_ctrl_1),
2681 SH_PFC_PIN_GROUP(sdhi0_data1),
2682 SH_PFC_PIN_GROUP(sdhi0_data4),
2683 SH_PFC_PIN_GROUP(sdhi0_ctrl),
2684 SH_PFC_PIN_GROUP(sdhi0_cd),
2685 SH_PFC_PIN_GROUP(sdhi0_wp),
2686 SH_PFC_PIN_GROUP(sdhi1_data1),
2687 SH_PFC_PIN_GROUP(sdhi1_data4),
2688 SH_PFC_PIN_GROUP(sdhi1_ctrl),
2689 SH_PFC_PIN_GROUP(sdhi2_data1),
2690 SH_PFC_PIN_GROUP(sdhi2_data4),
2691 SH_PFC_PIN_GROUP(sdhi2_ctrl),
2692 SH_PFC_PIN_GROUP(usb_vbus),
2693};
2694
2695static const char * const bsc_groups[] = {
2696 "bsc_data_0_7",
2697 "bsc_data_8_15",
2698 "bsc_cs4",
2699 "bsc_cs5_a",
2700 "bsc_cs5_b",
2701 "bsc_cs6_a",
2702 "bsc_cs6_b",
2703 "bsc_rd",
2704 "bsc_rdwr_0",
2705 "bsc_rdwr_1",
2706 "bsc_rdwr_2",
2707 "bsc_we0",
2708 "bsc_we1",
2709};
2710
2711static const char * const fsia_groups[] = {
2712 "fsia_mclk_in",
2713 "fsia_mclk_out",
2714 "fsia_sclk_in",
2715 "fsia_sclk_out",
2716 "fsia_data_in",
2717 "fsia_data_out",
2718 "fsia_spdif",
2719};
2720
2721static const char * const fsib_groups[] = {
2722 "fsib_mclk_in",
2723 "fsib_mclk_out",
2724 "fsib_sclk_in",
2725 "fsib_sclk_out",
2726 "fsib_data_in",
2727 "fsib_data_out",
2728 "fsib_spdif",
2729};
2730
2731static const char * const fsic_groups[] = {
2732 "fsic_mclk_in",
2733 "fsic_mclk_out",
2734 "fsic_sclk_in",
2735 "fsic_sclk_out",
2736 "fsic_data_in",
2737 "fsic_data_out",
2738 "fsic_spdif",
2739};
2740
2741static const char * const fsid_groups[] = {
2742 "fsid_sclk_in",
2743 "fsid_sclk_out",
2744 "fsid_data_in",
2745};
2746
2747static const char * const i2c2_groups[] = {
2748 "i2c2_0",
2749 "i2c2_1",
2750 "i2c2_2",
2751};
2752
2753static const char * const i2c3_groups[] = {
2754 "i2c3_0",
2755 "i2c3_1",
2756 "i2c3_2",
2757};
2758
2759static const char * const irda_groups[] = {
2760 "irda_0",
2761 "irda_1",
2762};
1548 2763
2764static const char * const keysc_groups[] = {
2765 "keysc_in5",
2766 "keysc_in6",
2767 "keysc_in7",
2768 "keysc_in8",
2769 "keysc_out04",
2770 "keysc_out5",
2771 "keysc_out6_0",
2772 "keysc_out6_1",
2773 "keysc_out6_2",
2774 "keysc_out7_0",
2775 "keysc_out7_1",
2776 "keysc_out7_2",
2777 "keysc_out8_0",
2778 "keysc_out8_1",
2779 "keysc_out8_2",
2780 "keysc_out9_0",
2781 "keysc_out9_1",
2782 "keysc_out9_2",
2783 "keysc_out10_0",
2784 "keysc_out10_1",
2785 "keysc_out11_0",
2786 "keysc_out11_1",
2787};
2788
2789static const char * const lcd_groups[] = {
2790 "lcd_data8",
2791 "lcd_data9",
2792 "lcd_data12",
2793 "lcd_data16",
2794 "lcd_data18",
2795 "lcd_data24",
2796 "lcd_display",
2797 "lcd_lclk",
2798 "lcd_sync",
2799 "lcd_sys",
2800};
2801
2802static const char * const lcd2_groups[] = {
2803 "lcd2_data8",
2804 "lcd2_data9",
2805 "lcd2_data12",
2806 "lcd2_data16",
2807 "lcd2_data18",
2808 "lcd2_data24",
2809 "lcd2_sync_0",
2810 "lcd2_sync_1",
2811 "lcd2_sys_0",
2812 "lcd2_sys_1",
2813};
2814
2815static const char * const mmc0_groups[] = {
2816 "mmc0_data1_0",
2817 "mmc0_data4_0",
2818 "mmc0_data8_0",
2819 "mmc0_ctrl_0",
2820 "mmc0_data1_1",
2821 "mmc0_data4_1",
2822 "mmc0_data8_1",
2823 "mmc0_ctrl_1",
2824};
2825
2826static const char * const scifa0_groups[] = {
2827 "scifa0_data",
2828 "scifa0_clk",
2829 "scifa0_ctrl",
2830};
2831
2832static const char * const scifa1_groups[] = {
2833 "scifa1_data",
2834 "scifa1_clk",
2835 "scifa1_ctrl",
2836};
2837
2838static const char * const scifa2_groups[] = {
2839 "scifa2_data_0",
2840 "scifa2_clk_0",
2841 "scifa2_ctrl_0",
2842 "scifa2_data_1",
2843 "scifa2_clk_1",
2844 "scifa2_ctrl_1",
2845};
2846
2847static const char * const scifa3_groups[] = {
2848 "scifa3_data",
2849 "scifa3_ctrl",
2850};
2851
2852static const char * const scifa4_groups[] = {
2853 "scifa4_data",
2854 "scifa4_ctrl",
2855};
2856
2857static const char * const scifa5_groups[] = {
2858 "scifa5_data_0",
2859 "scifa5_clk_0",
2860 "scifa5_ctrl_0",
2861 "scifa5_data_1",
2862 "scifa5_clk_1",
2863 "scifa5_ctrl_1",
2864 "scifa5_data_2",
2865 "scifa5_clk_2",
2866 "scifa5_ctrl_2",
2867};
2868
2869static const char * const scifa6_groups[] = {
2870 "scifa6",
2871};
2872
2873static const char * const scifa7_groups[] = {
2874 "scifa7_data",
2875 "scifa7_ctrl",
2876};
2877
2878static const char * const scifb_groups[] = {
2879 "scifb_data_0",
2880 "scifb_clk_0",
2881 "scifb_ctrl_0",
2882 "scifb_data_1",
2883 "scifb_clk_1",
2884 "scifb_ctrl_1",
2885};
2886
2887static const char * const sdhi0_groups[] = {
2888 "sdhi0_data1",
2889 "sdhi0_data4",
2890 "sdhi0_ctrl",
2891 "sdhi0_cd",
2892 "sdhi0_wp",
2893};
2894
2895static const char * const sdhi1_groups[] = {
2896 "sdhi1_data1",
2897 "sdhi1_data4",
2898 "sdhi1_ctrl",
2899};
2900
2901static const char * const sdhi2_groups[] = {
2902 "sdhi2_data1",
2903 "sdhi2_data4",
2904 "sdhi2_ctrl",
2905};
2906
2907static const char * const usb_groups[] = {
2908 "usb_vbus",
2909};
2910
2911static const struct sh_pfc_function pinmux_functions[] = {
2912 SH_PFC_FUNCTION(bsc),
2913 SH_PFC_FUNCTION(fsia),
2914 SH_PFC_FUNCTION(fsib),
2915 SH_PFC_FUNCTION(fsic),
2916 SH_PFC_FUNCTION(fsid),
2917 SH_PFC_FUNCTION(i2c2),
2918 SH_PFC_FUNCTION(i2c3),
2919 SH_PFC_FUNCTION(irda),
2920 SH_PFC_FUNCTION(keysc),
2921 SH_PFC_FUNCTION(lcd),
2922 SH_PFC_FUNCTION(lcd2),
2923 SH_PFC_FUNCTION(mmc0),
2924 SH_PFC_FUNCTION(scifa0),
2925 SH_PFC_FUNCTION(scifa1),
2926 SH_PFC_FUNCTION(scifa2),
2927 SH_PFC_FUNCTION(scifa3),
2928 SH_PFC_FUNCTION(scifa4),
2929 SH_PFC_FUNCTION(scifa5),
2930 SH_PFC_FUNCTION(scifa6),
2931 SH_PFC_FUNCTION(scifa7),
2932 SH_PFC_FUNCTION(scifb),
2933 SH_PFC_FUNCTION(sdhi0),
2934 SH_PFC_FUNCTION(sdhi1),
2935 SH_PFC_FUNCTION(sdhi2),
2936 SH_PFC_FUNCTION(usb),
2937};
2938
2939#define PINMUX_FN_BASE GPIO_FN_GPI0
2940
2941static const struct pinmux_func pinmux_func_gpios[] = {
1549 /* Table 25-1 (Functions 0-7) */ 2942 /* Table 25-1 (Functions 0-7) */
1550 GPIO_FN(VBUS_0),
1551 GPIO_FN(GPI0), 2943 GPIO_FN(GPI0),
1552 GPIO_FN(GPI1), 2944 GPIO_FN(GPI1),
1553 GPIO_FN(GPI2), 2945 GPIO_FN(GPI2),
@@ -1556,19 +2948,12 @@ static struct pinmux_gpio pinmux_gpios[] = {
1556 GPIO_FN(GPI5), 2948 GPIO_FN(GPI5),
1557 GPIO_FN(GPI6), 2949 GPIO_FN(GPI6),
1558 GPIO_FN(GPI7), 2950 GPIO_FN(GPI7),
1559 GPIO_FN(SCIFA7_RXD),
1560 GPIO_FN(SCIFA7_CTS_),
1561 GPIO_FN(GPO7), \ 2951 GPIO_FN(GPO7), \
1562 GPIO_FN(MFG0_OUT2), 2952 GPIO_FN(MFG0_OUT2),
1563 GPIO_FN(GPO6), \ 2953 GPIO_FN(GPO6), \
1564 GPIO_FN(MFG1_OUT2), 2954 GPIO_FN(MFG1_OUT2),
1565 GPIO_FN(GPO5), \ 2955 GPIO_FN(GPO5), \
1566 GPIO_FN(SCIFA0_SCK), \
1567 GPIO_FN(FSICOSLDT3), \
1568 GPIO_FN(PORT16_VIO_CKOR), 2956 GPIO_FN(PORT16_VIO_CKOR),
1569 GPIO_FN(SCIFA0_TXD),
1570 GPIO_FN(SCIFA7_TXD),
1571 GPIO_FN(SCIFA7_RTS_), \
1572 GPIO_FN(PORT19_VIO_CKO2), 2957 GPIO_FN(PORT19_VIO_CKO2),
1573 GPIO_FN(GPO0), 2958 GPIO_FN(GPO0),
1574 GPIO_FN(GPO1), 2959 GPIO_FN(GPO1),
@@ -1581,13 +2966,9 @@ static struct pinmux_gpio pinmux_gpios[] = {
1581 GPIO_FN(VINT), 2966 GPIO_FN(VINT),
1582 GPIO_FN(TCKON), 2967 GPIO_FN(TCKON),
1583 GPIO_FN(XDVFS1), \ 2968 GPIO_FN(XDVFS1), \
1584 GPIO_FN(PORT27_I2C_SCL2), \
1585 GPIO_FN(PORT27_I2C_SCL3), \
1586 GPIO_FN(MFG0_OUT1), \ 2969 GPIO_FN(MFG0_OUT1), \
1587 GPIO_FN(PORT27_IROUT), 2970 GPIO_FN(PORT27_IROUT),
1588 GPIO_FN(XDVFS2), \ 2971 GPIO_FN(XDVFS2), \
1589 GPIO_FN(PORT28_I2C_SDA2), \
1590 GPIO_FN(PORT28_I2C_SDA3), \
1591 GPIO_FN(PORT28_TPU1TO1), 2972 GPIO_FN(PORT28_TPU1TO1),
1592 GPIO_FN(SIM_RST), \ 2973 GPIO_FN(SIM_RST), \
1593 GPIO_FN(PORT29_TPU1TO1), 2974 GPIO_FN(PORT29_TPU1TO1),
@@ -1595,140 +2976,53 @@ static struct pinmux_gpio pinmux_gpios[] = {
1595 GPIO_FN(PORT30_VIO_CKOR), 2976 GPIO_FN(PORT30_VIO_CKOR),
1596 GPIO_FN(SIM_D), \ 2977 GPIO_FN(SIM_D), \
1597 GPIO_FN(PORT31_IROUT), 2978 GPIO_FN(PORT31_IROUT),
1598 GPIO_FN(SCIFA4_TXD),
1599 GPIO_FN(SCIFA4_RXD), \
1600 GPIO_FN(XWUP), 2979 GPIO_FN(XWUP),
1601 GPIO_FN(SCIFA4_RTS_),
1602 GPIO_FN(SCIFA4_CTS_),
1603 GPIO_FN(FSIBOBT), \
1604 GPIO_FN(FSIBIBT),
1605 GPIO_FN(FSIBOLR), \
1606 GPIO_FN(FSIBILR),
1607 GPIO_FN(FSIBOSLD),
1608 GPIO_FN(FSIBISLD),
1609 GPIO_FN(VACK), 2980 GPIO_FN(VACK),
1610 GPIO_FN(XTAL1L), 2981 GPIO_FN(XTAL1L),
1611 GPIO_FN(SCIFA0_RTS_), \
1612 GPIO_FN(FSICOSLDT2),
1613 GPIO_FN(SCIFA0_RXD),
1614 GPIO_FN(SCIFA0_CTS_), \
1615 GPIO_FN(FSICOSLDT1),
1616 GPIO_FN(FSICOBT), \
1617 GPIO_FN(FSICIBT), \
1618 GPIO_FN(FSIDOBT), \
1619 GPIO_FN(FSIDIBT),
1620 GPIO_FN(FSICOLR), \
1621 GPIO_FN(FSICILR), \
1622 GPIO_FN(FSIDOLR), \
1623 GPIO_FN(FSIDILR),
1624 GPIO_FN(FSICOSLD), \
1625 GPIO_FN(PORT47_FSICSPDIF),
1626 GPIO_FN(FSICISLD), \
1627 GPIO_FN(FSIDISLD),
1628 GPIO_FN(FSIACK), \
1629 GPIO_FN(PORT49_IRDA_OUT), \
1630 GPIO_FN(PORT49_IROUT), \ 2982 GPIO_FN(PORT49_IROUT), \
1631 GPIO_FN(FSIAOMC),
1632 GPIO_FN(FSIAOLR), \
1633 GPIO_FN(BBIF2_TSYNC2), \ 2983 GPIO_FN(BBIF2_TSYNC2), \
1634 GPIO_FN(TPU2TO2), \ 2984 GPIO_FN(TPU2TO2), \
1635 GPIO_FN(FSIAILR),
1636 2985
1637 GPIO_FN(FSIAOBT), \
1638 GPIO_FN(BBIF2_TSCK2), \ 2986 GPIO_FN(BBIF2_TSCK2), \
1639 GPIO_FN(TPU2TO3), \ 2987 GPIO_FN(TPU2TO3), \
1640 GPIO_FN(FSIAIBT),
1641 GPIO_FN(FSIAOSLD), \
1642 GPIO_FN(BBIF2_TXD2), 2988 GPIO_FN(BBIF2_TXD2),
1643 GPIO_FN(FSIASPDIF), \
1644 GPIO_FN(PORT53_IRDA_IN), \
1645 GPIO_FN(TPU3TO3), \ 2989 GPIO_FN(TPU3TO3), \
1646 GPIO_FN(FSIBSPDIF), \
1647 GPIO_FN(PORT53_FSICSPDIF),
1648 GPIO_FN(FSIBCK), \
1649 GPIO_FN(PORT54_IRDA_FIRSEL), \
1650 GPIO_FN(TPU3TO2), \ 2990 GPIO_FN(TPU3TO2), \
1651 GPIO_FN(FSIBOMC), \
1652 GPIO_FN(FSICCK), \
1653 GPIO_FN(FSICOMC),
1654 GPIO_FN(FSIAISLD), \
1655 GPIO_FN(TPU0TO0), 2991 GPIO_FN(TPU0TO0),
1656 GPIO_FN(A0), \ 2992 GPIO_FN(A0), \
1657 GPIO_FN(BS_), 2993 GPIO_FN(BS_),
1658 GPIO_FN(A12), \ 2994 GPIO_FN(A12), \
1659 GPIO_FN(PORT58_KEYOUT7), \
1660 GPIO_FN(TPU4TO2), 2995 GPIO_FN(TPU4TO2),
1661 GPIO_FN(A13), \ 2996 GPIO_FN(A13), \
1662 GPIO_FN(PORT59_KEYOUT6), \
1663 GPIO_FN(TPU0TO1), 2997 GPIO_FN(TPU0TO1),
1664 GPIO_FN(A14), \ 2998 GPIO_FN(A14), \
1665 GPIO_FN(KEYOUT5),
1666 GPIO_FN(A15), \ 2999 GPIO_FN(A15), \
1667 GPIO_FN(KEYOUT4),
1668 GPIO_FN(A16), \ 3000 GPIO_FN(A16), \
1669 GPIO_FN(KEYOUT3), \
1670 GPIO_FN(MSIOF0_SS1), 3001 GPIO_FN(MSIOF0_SS1),
1671 GPIO_FN(A17), \ 3002 GPIO_FN(A17), \
1672 GPIO_FN(KEYOUT2), \
1673 GPIO_FN(MSIOF0_TSYNC), 3003 GPIO_FN(MSIOF0_TSYNC),
1674 GPIO_FN(A18), \ 3004 GPIO_FN(A18), \
1675 GPIO_FN(KEYOUT1), \
1676 GPIO_FN(MSIOF0_TSCK), 3005 GPIO_FN(MSIOF0_TSCK),
1677 GPIO_FN(A19), \ 3006 GPIO_FN(A19), \
1678 GPIO_FN(KEYOUT0), \
1679 GPIO_FN(MSIOF0_TXD), 3007 GPIO_FN(MSIOF0_TXD),
1680 GPIO_FN(A20), \ 3008 GPIO_FN(A20), \
1681 GPIO_FN(KEYIN0), \
1682 GPIO_FN(MSIOF0_RSCK), 3009 GPIO_FN(MSIOF0_RSCK),
1683 GPIO_FN(A21), \ 3010 GPIO_FN(A21), \
1684 GPIO_FN(KEYIN1), \
1685 GPIO_FN(MSIOF0_RSYNC), 3011 GPIO_FN(MSIOF0_RSYNC),
1686 GPIO_FN(A22), \ 3012 GPIO_FN(A22), \
1687 GPIO_FN(KEYIN2), \
1688 GPIO_FN(MSIOF0_MCK0), 3013 GPIO_FN(MSIOF0_MCK0),
1689 GPIO_FN(A23), \ 3014 GPIO_FN(A23), \
1690 GPIO_FN(KEYIN3), \
1691 GPIO_FN(MSIOF0_MCK1), 3015 GPIO_FN(MSIOF0_MCK1),
1692 GPIO_FN(A24), \ 3016 GPIO_FN(A24), \
1693 GPIO_FN(KEYIN4), \
1694 GPIO_FN(MSIOF0_RXD), 3017 GPIO_FN(MSIOF0_RXD),
1695 GPIO_FN(A25), \ 3018 GPIO_FN(A25), \
1696 GPIO_FN(KEYIN5), \
1697 GPIO_FN(MSIOF0_SS2), 3019 GPIO_FN(MSIOF0_SS2),
1698 GPIO_FN(A26), \ 3020 GPIO_FN(A26), \
1699 GPIO_FN(KEYIN6),
1700 GPIO_FN(KEYIN7),
1701 GPIO_FN(D0_NAF0),
1702 GPIO_FN(D1_NAF1),
1703 GPIO_FN(D2_NAF2),
1704 GPIO_FN(D3_NAF3),
1705 GPIO_FN(D4_NAF4),
1706 GPIO_FN(D5_NAF5),
1707 GPIO_FN(D6_NAF6),
1708 GPIO_FN(D7_NAF7),
1709 GPIO_FN(D8_NAF8),
1710 GPIO_FN(D9_NAF9),
1711 GPIO_FN(D10_NAF10),
1712 GPIO_FN(D11_NAF11),
1713 GPIO_FN(D12_NAF12),
1714 GPIO_FN(D13_NAF13),
1715 GPIO_FN(D14_NAF14),
1716 GPIO_FN(D15_NAF15),
1717 GPIO_FN(CS4_),
1718 GPIO_FN(CS5A_), \
1719 GPIO_FN(PORT91_RDWR),
1720 GPIO_FN(CS5B_), \
1721 GPIO_FN(FCE1_), 3021 GPIO_FN(FCE1_),
1722 GPIO_FN(CS6B_), \
1723 GPIO_FN(DACK0), 3022 GPIO_FN(DACK0),
1724 GPIO_FN(FCE0_), \ 3023 GPIO_FN(FCE0_), \
1725 GPIO_FN(CS6A_),
1726 GPIO_FN(WAIT_), \ 3024 GPIO_FN(WAIT_), \
1727 GPIO_FN(DREQ0), 3025 GPIO_FN(DREQ0),
1728 GPIO_FN(RD__FSC),
1729 GPIO_FN(WE0__FWE), \
1730 GPIO_FN(RDWR_FWE),
1731 GPIO_FN(WE1_),
1732 GPIO_FN(FRB), 3026 GPIO_FN(FRB),
1733 GPIO_FN(CKO), 3027 GPIO_FN(CKO),
1734 GPIO_FN(NBRSTOUT_), 3028 GPIO_FN(NBRSTOUT_),
@@ -1737,14 +3031,10 @@ static struct pinmux_gpio pinmux_gpios[] = {
1737 GPIO_FN(BBIF2_RXD), 3031 GPIO_FN(BBIF2_RXD),
1738 GPIO_FN(BBIF2_SYNC), 3032 GPIO_FN(BBIF2_SYNC),
1739 GPIO_FN(BBIF2_SCK), 3033 GPIO_FN(BBIF2_SCK),
1740 GPIO_FN(SCIFA3_CTS_), \
1741 GPIO_FN(MFG3_IN2), 3034 GPIO_FN(MFG3_IN2),
1742 GPIO_FN(SCIFA3_RXD), \
1743 GPIO_FN(MFG3_IN1), 3035 GPIO_FN(MFG3_IN1),
1744 GPIO_FN(BBIF1_SS2), \ 3036 GPIO_FN(BBIF1_SS2), \
1745 GPIO_FN(SCIFA3_RTS_), \
1746 GPIO_FN(MFG3_OUT1), 3037 GPIO_FN(MFG3_OUT1),
1747 GPIO_FN(SCIFA3_TXD),
1748 GPIO_FN(HSI_RX_DATA), \ 3038 GPIO_FN(HSI_RX_DATA), \
1749 GPIO_FN(BBIF1_RXD), 3039 GPIO_FN(BBIF1_RXD),
1750 GPIO_FN(HSI_TX_WAKE), \ 3040 GPIO_FN(HSI_TX_WAKE), \
@@ -1755,103 +3045,57 @@ static struct pinmux_gpio pinmux_gpios[] = {
1755 GPIO_FN(BBIF1_TXD), 3045 GPIO_FN(BBIF1_TXD),
1756 GPIO_FN(HSI_RX_READY), \ 3046 GPIO_FN(HSI_RX_READY), \
1757 GPIO_FN(BBIF1_RSCK), \ 3047 GPIO_FN(BBIF1_RSCK), \
1758 GPIO_FN(PORT115_I2C_SCL2), \
1759 GPIO_FN(PORT115_I2C_SCL3),
1760 GPIO_FN(HSI_RX_WAKE), \ 3048 GPIO_FN(HSI_RX_WAKE), \
1761 GPIO_FN(BBIF1_RSYNC), \ 3049 GPIO_FN(BBIF1_RSYNC), \
1762 GPIO_FN(PORT116_I2C_SDA2), \
1763 GPIO_FN(PORT116_I2C_SDA3),
1764 GPIO_FN(HSI_RX_FLAG), \ 3050 GPIO_FN(HSI_RX_FLAG), \
1765 GPIO_FN(BBIF1_SS1), \ 3051 GPIO_FN(BBIF1_SS1), \
1766 GPIO_FN(BBIF1_FLOW), 3052 GPIO_FN(BBIF1_FLOW),
1767 GPIO_FN(HSI_TX_FLAG), 3053 GPIO_FN(HSI_TX_FLAG),
1768 GPIO_FN(VIO_VD), \ 3054 GPIO_FN(VIO_VD), \
1769 GPIO_FN(PORT128_LCD2VSYN), \
1770 GPIO_FN(VIO2_VD), \ 3055 GPIO_FN(VIO2_VD), \
1771 GPIO_FN(LCD2D0),
1772 3056
1773 GPIO_FN(VIO_HD), \ 3057 GPIO_FN(VIO_HD), \
1774 GPIO_FN(PORT129_LCD2HSYN), \
1775 GPIO_FN(PORT129_LCD2CS_), \
1776 GPIO_FN(VIO2_HD), \ 3058 GPIO_FN(VIO2_HD), \
1777 GPIO_FN(LCD2D1),
1778 GPIO_FN(VIO_D0), \ 3059 GPIO_FN(VIO_D0), \
1779 GPIO_FN(PORT130_MSIOF2_RXD), \ 3060 GPIO_FN(PORT130_MSIOF2_RXD), \
1780 GPIO_FN(LCD2D10),
1781 GPIO_FN(VIO_D1), \ 3061 GPIO_FN(VIO_D1), \
1782 GPIO_FN(PORT131_KEYOUT6), \
1783 GPIO_FN(PORT131_MSIOF2_SS1), \ 3062 GPIO_FN(PORT131_MSIOF2_SS1), \
1784 GPIO_FN(PORT131_KEYOUT11), \
1785 GPIO_FN(LCD2D11),
1786 GPIO_FN(VIO_D2), \ 3063 GPIO_FN(VIO_D2), \
1787 GPIO_FN(PORT132_KEYOUT7), \
1788 GPIO_FN(PORT132_MSIOF2_SS2), \ 3064 GPIO_FN(PORT132_MSIOF2_SS2), \
1789 GPIO_FN(PORT132_KEYOUT10), \
1790 GPIO_FN(LCD2D12),
1791 GPIO_FN(VIO_D3), \ 3065 GPIO_FN(VIO_D3), \
1792 GPIO_FN(MSIOF2_TSYNC), \ 3066 GPIO_FN(MSIOF2_TSYNC), \
1793 GPIO_FN(LCD2D13),
1794 GPIO_FN(VIO_D4), \ 3067 GPIO_FN(VIO_D4), \
1795 GPIO_FN(MSIOF2_TXD), \ 3068 GPIO_FN(MSIOF2_TXD), \
1796 GPIO_FN(LCD2D14),
1797 GPIO_FN(VIO_D5), \ 3069 GPIO_FN(VIO_D5), \
1798 GPIO_FN(MSIOF2_TSCK), \ 3070 GPIO_FN(MSIOF2_TSCK), \
1799 GPIO_FN(LCD2D15),
1800 GPIO_FN(VIO_D6), \ 3071 GPIO_FN(VIO_D6), \
1801 GPIO_FN(PORT136_KEYOUT8), \
1802 GPIO_FN(LCD2D16),
1803 GPIO_FN(VIO_D7), \ 3072 GPIO_FN(VIO_D7), \
1804 GPIO_FN(PORT137_KEYOUT9), \
1805 GPIO_FN(LCD2D17),
1806 GPIO_FN(VIO_D8), \ 3073 GPIO_FN(VIO_D8), \
1807 GPIO_FN(PORT138_KEYOUT8), \
1808 GPIO_FN(VIO2_D0), \ 3074 GPIO_FN(VIO2_D0), \
1809 GPIO_FN(LCD2D6),
1810 GPIO_FN(VIO_D9), \ 3075 GPIO_FN(VIO_D9), \
1811 GPIO_FN(PORT139_KEYOUT9), \
1812 GPIO_FN(VIO2_D1), \ 3076 GPIO_FN(VIO2_D1), \
1813 GPIO_FN(LCD2D7),
1814 GPIO_FN(VIO_D10), \ 3077 GPIO_FN(VIO_D10), \
1815 GPIO_FN(TPU0TO2), \ 3078 GPIO_FN(TPU0TO2), \
1816 GPIO_FN(VIO2_D2), \ 3079 GPIO_FN(VIO2_D2), \
1817 GPIO_FN(LCD2D8),
1818 GPIO_FN(VIO_D11), \ 3080 GPIO_FN(VIO_D11), \
1819 GPIO_FN(TPU0TO3), \ 3081 GPIO_FN(TPU0TO3), \
1820 GPIO_FN(VIO2_D3), \ 3082 GPIO_FN(VIO2_D3), \
1821 GPIO_FN(LCD2D9),
1822 GPIO_FN(VIO_D12), \ 3083 GPIO_FN(VIO_D12), \
1823 GPIO_FN(PORT142_KEYOUT10), \
1824 GPIO_FN(VIO2_D4), \ 3084 GPIO_FN(VIO2_D4), \
1825 GPIO_FN(LCD2D2),
1826 GPIO_FN(VIO_D13), \ 3085 GPIO_FN(VIO_D13), \
1827 GPIO_FN(PORT143_KEYOUT11), \
1828 GPIO_FN(PORT143_KEYOUT6), \
1829 GPIO_FN(VIO2_D5), \ 3086 GPIO_FN(VIO2_D5), \
1830 GPIO_FN(LCD2D3),
1831 GPIO_FN(VIO_D14), \ 3087 GPIO_FN(VIO_D14), \
1832 GPIO_FN(PORT144_KEYOUT7), \
1833 GPIO_FN(VIO2_D6), \ 3088 GPIO_FN(VIO2_D6), \
1834 GPIO_FN(LCD2D4),
1835 GPIO_FN(VIO_D15), \ 3089 GPIO_FN(VIO_D15), \
1836 GPIO_FN(TPU1TO3), \ 3090 GPIO_FN(TPU1TO3), \
1837 GPIO_FN(PORT145_LCD2DISP), \
1838 GPIO_FN(PORT145_LCD2RS), \
1839 GPIO_FN(VIO2_D7), \ 3091 GPIO_FN(VIO2_D7), \
1840 GPIO_FN(LCD2D5),
1841 GPIO_FN(VIO_CLK), \ 3092 GPIO_FN(VIO_CLK), \
1842 GPIO_FN(LCD2DCK), \
1843 GPIO_FN(PORT146_LCD2WR_), \
1844 GPIO_FN(VIO2_CLK), \ 3093 GPIO_FN(VIO2_CLK), \
1845 GPIO_FN(LCD2D18),
1846 GPIO_FN(VIO_FIELD), \ 3094 GPIO_FN(VIO_FIELD), \
1847 GPIO_FN(LCD2RD_), \
1848 GPIO_FN(VIO2_FIELD), \ 3095 GPIO_FN(VIO2_FIELD), \
1849 GPIO_FN(LCD2D19),
1850 GPIO_FN(VIO_CKO), 3096 GPIO_FN(VIO_CKO),
1851 GPIO_FN(A27), \ 3097 GPIO_FN(A27), \
1852 GPIO_FN(PORT149_RDWR), \
1853 GPIO_FN(MFG0_IN1), \ 3098 GPIO_FN(MFG0_IN1), \
1854 GPIO_FN(PORT149_KEYOUT9),
1855 GPIO_FN(MFG0_IN2), 3099 GPIO_FN(MFG0_IN2),
1856 GPIO_FN(TS_SPSYNC3), \ 3100 GPIO_FN(TS_SPSYNC3), \
1857 GPIO_FN(MSIOF2_RSCK), 3101 GPIO_FN(MSIOF2_RSCK),
@@ -1860,201 +3104,105 @@ static struct pinmux_gpio pinmux_gpios[] = {
1860 GPIO_FN(TPU1TO2), \ 3104 GPIO_FN(TPU1TO2), \
1861 GPIO_FN(TS_SDEN3), \ 3105 GPIO_FN(TS_SDEN3), \
1862 GPIO_FN(PORT153_MSIOF2_SS1), 3106 GPIO_FN(PORT153_MSIOF2_SS1),
1863 GPIO_FN(SCIFA2_TXD1), \
1864 GPIO_FN(MSIOF2_MCK0), 3107 GPIO_FN(MSIOF2_MCK0),
1865 GPIO_FN(SCIFA2_RXD1), \
1866 GPIO_FN(MSIOF2_MCK1), 3108 GPIO_FN(MSIOF2_MCK1),
1867 GPIO_FN(SCIFA2_RTS1_), \
1868 GPIO_FN(PORT156_MSIOF2_SS2), 3109 GPIO_FN(PORT156_MSIOF2_SS2),
1869 GPIO_FN(SCIFA2_CTS1_), \
1870 GPIO_FN(PORT157_MSIOF2_RXD), 3110 GPIO_FN(PORT157_MSIOF2_RXD),
1871 GPIO_FN(DINT_), \ 3111 GPIO_FN(DINT_), \
1872 GPIO_FN(SCIFA2_SCK1), \
1873 GPIO_FN(TS_SCK3), 3112 GPIO_FN(TS_SCK3),
1874 GPIO_FN(PORT159_SCIFB_SCK), \
1875 GPIO_FN(PORT159_SCIFA5_SCK), \
1876 GPIO_FN(NMI), 3113 GPIO_FN(NMI),
1877 GPIO_FN(PORT160_SCIFB_TXD), \
1878 GPIO_FN(PORT160_SCIFA5_TXD),
1879 GPIO_FN(PORT161_SCIFB_CTS_), \
1880 GPIO_FN(PORT161_SCIFA5_CTS_),
1881 GPIO_FN(PORT162_SCIFB_RXD), \
1882 GPIO_FN(PORT162_SCIFA5_RXD),
1883 GPIO_FN(PORT163_SCIFB_RTS_), \
1884 GPIO_FN(PORT163_SCIFA5_RTS_), \
1885 GPIO_FN(TPU3TO0), 3114 GPIO_FN(TPU3TO0),
1886 GPIO_FN(LCDD0),
1887 GPIO_FN(LCDD1), \
1888 GPIO_FN(PORT193_SCIFA5_CTS_), \
1889 GPIO_FN(BBIF2_TSYNC1), 3115 GPIO_FN(BBIF2_TSYNC1),
1890 GPIO_FN(LCDD2), \
1891 GPIO_FN(PORT194_SCIFA5_RTS_), \
1892 GPIO_FN(BBIF2_TSCK1), 3116 GPIO_FN(BBIF2_TSCK1),
1893 GPIO_FN(LCDD3), \
1894 GPIO_FN(PORT195_SCIFA5_RXD), \
1895 GPIO_FN(BBIF2_TXD1), 3117 GPIO_FN(BBIF2_TXD1),
1896 GPIO_FN(LCDD4), \
1897 GPIO_FN(PORT196_SCIFA5_TXD),
1898 GPIO_FN(LCDD5), \
1899 GPIO_FN(PORT197_SCIFA5_SCK), \
1900 GPIO_FN(MFG2_OUT2), \ 3118 GPIO_FN(MFG2_OUT2), \
1901 GPIO_FN(TPU2TO1), 3119 GPIO_FN(TPU2TO1),
1902 GPIO_FN(LCDD6),
1903 GPIO_FN(LCDD7), \
1904 GPIO_FN(TPU4TO1), \ 3120 GPIO_FN(TPU4TO1), \
1905 GPIO_FN(MFG4_OUT2), 3121 GPIO_FN(MFG4_OUT2),
1906 GPIO_FN(LCDD8), \
1907 GPIO_FN(D16), 3122 GPIO_FN(D16),
1908 GPIO_FN(LCDD9), \
1909 GPIO_FN(D17), 3123 GPIO_FN(D17),
1910 GPIO_FN(LCDD10), \
1911 GPIO_FN(D18), 3124 GPIO_FN(D18),
1912 GPIO_FN(LCDD11), \
1913 GPIO_FN(D19), 3125 GPIO_FN(D19),
1914 GPIO_FN(LCDD12), \
1915 GPIO_FN(D20), 3126 GPIO_FN(D20),
1916 GPIO_FN(LCDD13), \
1917 GPIO_FN(D21), 3127 GPIO_FN(D21),
1918 GPIO_FN(LCDD14), \
1919 GPIO_FN(D22), 3128 GPIO_FN(D22),
1920 GPIO_FN(LCDD15), \
1921 GPIO_FN(PORT207_MSIOF0L_SS1), \ 3129 GPIO_FN(PORT207_MSIOF0L_SS1), \
1922 GPIO_FN(D23), 3130 GPIO_FN(D23),
1923 GPIO_FN(LCDD16), \
1924 GPIO_FN(PORT208_MSIOF0L_SS2), \ 3131 GPIO_FN(PORT208_MSIOF0L_SS2), \
1925 GPIO_FN(D24), 3132 GPIO_FN(D24),
1926 GPIO_FN(LCDD17), \
1927 GPIO_FN(D25), 3133 GPIO_FN(D25),
1928 GPIO_FN(LCDD18), \
1929 GPIO_FN(DREQ2), \ 3134 GPIO_FN(DREQ2), \
1930 GPIO_FN(PORT210_MSIOF0L_SS1), \ 3135 GPIO_FN(PORT210_MSIOF0L_SS1), \
1931 GPIO_FN(D26), 3136 GPIO_FN(D26),
1932 GPIO_FN(LCDD19), \
1933 GPIO_FN(PORT211_MSIOF0L_SS2), \ 3137 GPIO_FN(PORT211_MSIOF0L_SS2), \
1934 GPIO_FN(D27), 3138 GPIO_FN(D27),
1935 GPIO_FN(LCDD20), \
1936 GPIO_FN(TS_SPSYNC1), \ 3139 GPIO_FN(TS_SPSYNC1), \
1937 GPIO_FN(MSIOF0L_MCK0), \ 3140 GPIO_FN(MSIOF0L_MCK0), \
1938 GPIO_FN(D28), 3141 GPIO_FN(D28),
1939 GPIO_FN(LCDD21), \
1940 GPIO_FN(TS_SDAT1), \ 3142 GPIO_FN(TS_SDAT1), \
1941 GPIO_FN(MSIOF0L_MCK1), \ 3143 GPIO_FN(MSIOF0L_MCK1), \
1942 GPIO_FN(D29), 3144 GPIO_FN(D29),
1943 GPIO_FN(LCDD22), \
1944 GPIO_FN(TS_SDEN1), \ 3145 GPIO_FN(TS_SDEN1), \
1945 GPIO_FN(MSIOF0L_RSCK), \ 3146 GPIO_FN(MSIOF0L_RSCK), \
1946 GPIO_FN(D30), 3147 GPIO_FN(D30),
1947 GPIO_FN(LCDD23), \
1948 GPIO_FN(TS_SCK1), \ 3148 GPIO_FN(TS_SCK1), \
1949 GPIO_FN(MSIOF0L_RSYNC), \ 3149 GPIO_FN(MSIOF0L_RSYNC), \
1950 GPIO_FN(D31), 3150 GPIO_FN(D31),
1951 GPIO_FN(LCDDCK), \
1952 GPIO_FN(LCDWR_),
1953 GPIO_FN(LCDRD_), \
1954 GPIO_FN(DACK2), \ 3151 GPIO_FN(DACK2), \
1955 GPIO_FN(PORT217_LCD2RS), \
1956 GPIO_FN(MSIOF0L_TSYNC), \ 3152 GPIO_FN(MSIOF0L_TSYNC), \
1957 GPIO_FN(VIO2_FIELD3), \ 3153 GPIO_FN(VIO2_FIELD3), \
1958 GPIO_FN(PORT217_LCD2DISP),
1959 GPIO_FN(LCDHSYN), \
1960 GPIO_FN(LCDCS_), \
1961 GPIO_FN(LCDCS2_), \
1962 GPIO_FN(DACK3), \ 3154 GPIO_FN(DACK3), \
1963 GPIO_FN(PORT218_VIO_CKOR), 3155 GPIO_FN(PORT218_VIO_CKOR),
1964 GPIO_FN(LCDDISP), \
1965 GPIO_FN(LCDRS), \
1966 GPIO_FN(PORT219_LCD2WR_), \
1967 GPIO_FN(DREQ3), \ 3156 GPIO_FN(DREQ3), \
1968 GPIO_FN(MSIOF0L_TSCK), \ 3157 GPIO_FN(MSIOF0L_TSCK), \
1969 GPIO_FN(VIO2_CLK3), \ 3158 GPIO_FN(VIO2_CLK3), \
1970 GPIO_FN(LCD2DCK_2),
1971 GPIO_FN(LCDVSYN), \
1972 GPIO_FN(LCDVSYN2),
1973 GPIO_FN(LCDLCLK), \
1974 GPIO_FN(DREQ1), \ 3159 GPIO_FN(DREQ1), \
1975 GPIO_FN(PORT221_LCD2CS_), \
1976 GPIO_FN(PWEN), \ 3160 GPIO_FN(PWEN), \
1977 GPIO_FN(MSIOF0L_RXD), \ 3161 GPIO_FN(MSIOF0L_RXD), \
1978 GPIO_FN(VIO2_HD3), \ 3162 GPIO_FN(VIO2_HD3), \
1979 GPIO_FN(PORT221_LCD2HSYN),
1980 GPIO_FN(LCDDON), \
1981 GPIO_FN(LCDDON2), \
1982 GPIO_FN(DACK1), \ 3163 GPIO_FN(DACK1), \
1983 GPIO_FN(OVCN), \ 3164 GPIO_FN(OVCN), \
1984 GPIO_FN(MSIOF0L_TXD), \ 3165 GPIO_FN(MSIOF0L_TXD), \
1985 GPIO_FN(VIO2_VD3), \ 3166 GPIO_FN(VIO2_VD3), \
1986 GPIO_FN(PORT222_LCD2VSYN),
1987 3167
1988 GPIO_FN(SCIFA1_TXD), \
1989 GPIO_FN(OVCN2), 3168 GPIO_FN(OVCN2),
1990 GPIO_FN(EXTLP), \ 3169 GPIO_FN(EXTLP), \
1991 GPIO_FN(SCIFA1_SCK), \
1992 GPIO_FN(PORT226_VIO_CKO2), 3170 GPIO_FN(PORT226_VIO_CKO2),
1993 GPIO_FN(SCIFA1_RTS_), \
1994 GPIO_FN(IDIN), 3171 GPIO_FN(IDIN),
1995 GPIO_FN(SCIFA1_RXD),
1996 GPIO_FN(SCIFA1_CTS_), \
1997 GPIO_FN(MFG1_IN1), 3172 GPIO_FN(MFG1_IN1),
1998 GPIO_FN(MSIOF1_TXD), \ 3173 GPIO_FN(MSIOF1_TXD), \
1999 GPIO_FN(SCIFA2_TXD2),
2000 GPIO_FN(MSIOF1_TSYNC), \ 3174 GPIO_FN(MSIOF1_TSYNC), \
2001 GPIO_FN(SCIFA2_CTS2_),
2002 GPIO_FN(MSIOF1_TSCK), \ 3175 GPIO_FN(MSIOF1_TSCK), \
2003 GPIO_FN(SCIFA2_SCK2),
2004 GPIO_FN(MSIOF1_RXD), \ 3176 GPIO_FN(MSIOF1_RXD), \
2005 GPIO_FN(SCIFA2_RXD2),
2006 GPIO_FN(MSIOF1_RSCK), \ 3177 GPIO_FN(MSIOF1_RSCK), \
2007 GPIO_FN(SCIFA2_RTS2_), \
2008 GPIO_FN(VIO2_CLK2), \ 3178 GPIO_FN(VIO2_CLK2), \
2009 GPIO_FN(LCD2D20),
2010 GPIO_FN(MSIOF1_RSYNC), \ 3179 GPIO_FN(MSIOF1_RSYNC), \
2011 GPIO_FN(MFG1_IN2), \ 3180 GPIO_FN(MFG1_IN2), \
2012 GPIO_FN(VIO2_VD2), \ 3181 GPIO_FN(VIO2_VD2), \
2013 GPIO_FN(LCD2D21),
2014 GPIO_FN(MSIOF1_MCK0), \ 3182 GPIO_FN(MSIOF1_MCK0), \
2015 GPIO_FN(PORT236_I2C_SDA2),
2016 GPIO_FN(MSIOF1_MCK1), \ 3183 GPIO_FN(MSIOF1_MCK1), \
2017 GPIO_FN(PORT237_I2C_SCL2),
2018 GPIO_FN(MSIOF1_SS1), \ 3184 GPIO_FN(MSIOF1_SS1), \
2019 GPIO_FN(VIO2_FIELD2), \ 3185 GPIO_FN(VIO2_FIELD2), \
2020 GPIO_FN(LCD2D22),
2021 GPIO_FN(MSIOF1_SS2), \ 3186 GPIO_FN(MSIOF1_SS2), \
2022 GPIO_FN(VIO2_HD2), \ 3187 GPIO_FN(VIO2_HD2), \
2023 GPIO_FN(LCD2D23),
2024 GPIO_FN(SCIFA6_TXD),
2025 GPIO_FN(PORT241_IRDA_OUT), \
2026 GPIO_FN(PORT241_IROUT), \ 3188 GPIO_FN(PORT241_IROUT), \
2027 GPIO_FN(MFG4_OUT1), \ 3189 GPIO_FN(MFG4_OUT1), \
2028 GPIO_FN(TPU4TO0), 3190 GPIO_FN(TPU4TO0),
2029 GPIO_FN(PORT242_IRDA_IN), \
2030 GPIO_FN(MFG4_IN2), 3191 GPIO_FN(MFG4_IN2),
2031 GPIO_FN(PORT243_IRDA_FIRSEL), \
2032 GPIO_FN(PORT243_VIO_CKO2), 3192 GPIO_FN(PORT243_VIO_CKO2),
2033 GPIO_FN(PORT244_SCIFA5_CTS_), \
2034 GPIO_FN(MFG2_IN1), \ 3193 GPIO_FN(MFG2_IN1), \
2035 GPIO_FN(PORT244_SCIFB_CTS_), \
2036 GPIO_FN(MSIOF2R_RXD), 3194 GPIO_FN(MSIOF2R_RXD),
2037 GPIO_FN(PORT245_SCIFA5_RTS_), \
2038 GPIO_FN(MFG2_IN2), \ 3195 GPIO_FN(MFG2_IN2), \
2039 GPIO_FN(PORT245_SCIFB_RTS_), \
2040 GPIO_FN(MSIOF2R_TXD), 3196 GPIO_FN(MSIOF2R_TXD),
2041 GPIO_FN(PORT246_SCIFA5_RXD), \
2042 GPIO_FN(MFG1_OUT1), \ 3197 GPIO_FN(MFG1_OUT1), \
2043 GPIO_FN(PORT246_SCIFB_RXD), \
2044 GPIO_FN(TPU1TO0), 3198 GPIO_FN(TPU1TO0),
2045 GPIO_FN(PORT247_SCIFA5_TXD), \
2046 GPIO_FN(MFG3_OUT2), \ 3199 GPIO_FN(MFG3_OUT2), \
2047 GPIO_FN(PORT247_SCIFB_TXD), \
2048 GPIO_FN(TPU3TO1), 3200 GPIO_FN(TPU3TO1),
2049 GPIO_FN(PORT248_SCIFA5_SCK), \
2050 GPIO_FN(MFG2_OUT1), \ 3201 GPIO_FN(MFG2_OUT1), \
2051 GPIO_FN(PORT248_SCIFB_SCK), \
2052 GPIO_FN(TPU2TO0), \ 3202 GPIO_FN(TPU2TO0), \
2053 GPIO_FN(PORT248_I2C_SCL3), \
2054 GPIO_FN(MSIOF2R_TSCK), 3203 GPIO_FN(MSIOF2R_TSCK),
2055 GPIO_FN(PORT249_IROUT), \ 3204 GPIO_FN(PORT249_IROUT), \
2056 GPIO_FN(MFG4_IN1), \ 3205 GPIO_FN(MFG4_IN1), \
2057 GPIO_FN(PORT249_I2C_SDA3), \
2058 GPIO_FN(MSIOF2R_TSYNC), 3206 GPIO_FN(MSIOF2R_TSYNC),
2059 GPIO_FN(SDHICLK0), 3207 GPIO_FN(SDHICLK0),
2060 GPIO_FN(SDHICD0), 3208 GPIO_FN(SDHICD0),
@@ -2172,56 +3320,24 @@ static struct pinmux_gpio pinmux_gpios[] = {
2172 GPIO_FN(IRQ9_MEM_INT), 3320 GPIO_FN(IRQ9_MEM_INT),
2173 GPIO_FN(IRQ9_MCP_INT), 3321 GPIO_FN(IRQ9_MCP_INT),
2174 GPIO_FN(A11), 3322 GPIO_FN(A11),
2175 GPIO_FN(KEYOUT8),
2176 GPIO_FN(TPU4TO3), 3323 GPIO_FN(TPU4TO3),
2177 GPIO_FN(RESETA_N_PU_ON), 3324 GPIO_FN(RESETA_N_PU_ON),
2178 GPIO_FN(RESETA_N_PU_OFF), 3325 GPIO_FN(RESETA_N_PU_OFF),
2179 GPIO_FN(EDBGREQ_PD), 3326 GPIO_FN(EDBGREQ_PD),
2180 GPIO_FN(EDBGREQ_PU), 3327 GPIO_FN(EDBGREQ_PU),
3328};
2181 3329
2182 /* Functions with pull-ups */ 3330#undef PORTCR
2183 GPIO_FN(KEYIN0_PU), 3331#define PORTCR(nr, reg) \
2184 GPIO_FN(KEYIN1_PU), 3332 { \
2185 GPIO_FN(KEYIN2_PU), 3333 PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
2186 GPIO_FN(KEYIN3_PU), 3334 _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT), \
2187 GPIO_FN(KEYIN4_PU), 3335 PORT##nr##_FN0, PORT##nr##_FN1, \
2188 GPIO_FN(KEYIN5_PU), 3336 PORT##nr##_FN2, PORT##nr##_FN3, \
2189 GPIO_FN(KEYIN6_PU), 3337 PORT##nr##_FN4, PORT##nr##_FN5, \
2190 GPIO_FN(KEYIN7_PU), 3338 PORT##nr##_FN6, PORT##nr##_FN7 } \
2191 GPIO_FN(SDHICD0_PU), 3339 }
2192 GPIO_FN(SDHID0_0_PU), 3340static const struct pinmux_cfg_reg pinmux_config_regs[] = {
2193 GPIO_FN(SDHID0_1_PU),
2194 GPIO_FN(SDHID0_2_PU),
2195 GPIO_FN(SDHID0_3_PU),
2196 GPIO_FN(SDHICMD0_PU),
2197 GPIO_FN(SDHIWP0_PU),
2198 GPIO_FN(SDHID1_0_PU),
2199 GPIO_FN(SDHID1_1_PU),
2200 GPIO_FN(SDHID1_2_PU),
2201 GPIO_FN(SDHID1_3_PU),
2202 GPIO_FN(SDHICMD1_PU),
2203 GPIO_FN(SDHID2_0_PU),
2204 GPIO_FN(SDHID2_1_PU),
2205 GPIO_FN(SDHID2_2_PU),
2206 GPIO_FN(SDHID2_3_PU),
2207 GPIO_FN(SDHICMD2_PU),
2208 GPIO_FN(MMCCMD0_PU),
2209 GPIO_FN(MMCCMD1_PU),
2210 GPIO_FN(MMCD0_0_PU),
2211 GPIO_FN(MMCD0_1_PU),
2212 GPIO_FN(MMCD0_2_PU),
2213 GPIO_FN(MMCD0_3_PU),
2214 GPIO_FN(MMCD0_4_PU),
2215 GPIO_FN(MMCD0_5_PU),
2216 GPIO_FN(MMCD0_6_PU),
2217 GPIO_FN(MMCD0_7_PU),
2218 GPIO_FN(FSIACK_PU),
2219 GPIO_FN(FSIAILR_PU),
2220 GPIO_FN(FSIAIBT_PU),
2221 GPIO_FN(FSIAISLD_PU),
2222};
2223
2224static struct pinmux_cfg_reg pinmux_config_regs[] = {
2225 PORTCR(0, 0xe6050000), /* PORT0CR */ 3341 PORTCR(0, 0xe6050000), /* PORT0CR */
2226 PORTCR(1, 0xe6050001), /* PORT1CR */ 3342 PORTCR(1, 0xe6050001), /* PORT1CR */
2227 PORTCR(2, 0xe6050002), /* PORT2CR */ 3343 PORTCR(2, 0xe6050002), /* PORT2CR */
@@ -2629,7 +3745,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2629 { }, 3745 { },
2630}; 3746};
2631 3747
2632static struct pinmux_data_reg pinmux_data_regs[] = { 3748static const struct pinmux_data_reg pinmux_data_regs[] = {
2633 { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054000, 32) { 3749 { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054000, 32) {
2634 PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA, 3750 PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA,
2635 PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA, 3751 PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA,
@@ -2737,56 +3853,112 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2737#define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5)) 3853#define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5))
2738#define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5)) 3854#define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5))
2739 3855
2740static struct pinmux_irq pinmux_irqs[] = { 3856static const struct pinmux_irq pinmux_irqs[] = {
2741 PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0), 3857 PINMUX_IRQ(EXT_IRQ16H(19), 9),
2742 PINMUX_IRQ(EXT_IRQ16L(1), PORT10_FN0), 3858 PINMUX_IRQ(EXT_IRQ16L(1), 10),
2743 PINMUX_IRQ(EXT_IRQ16L(0), PORT11_FN0), 3859 PINMUX_IRQ(EXT_IRQ16L(0), 11),
2744 PINMUX_IRQ(EXT_IRQ16H(18), PORT13_FN0), 3860 PINMUX_IRQ(EXT_IRQ16H(18), 13),
2745 PINMUX_IRQ(EXT_IRQ16H(20), PORT14_FN0), 3861 PINMUX_IRQ(EXT_IRQ16H(20), 14),
2746 PINMUX_IRQ(EXT_IRQ16H(21), PORT15_FN0), 3862 PINMUX_IRQ(EXT_IRQ16H(21), 15),
2747 PINMUX_IRQ(EXT_IRQ16H(31), PORT26_FN0), 3863 PINMUX_IRQ(EXT_IRQ16H(31), 26),
2748 PINMUX_IRQ(EXT_IRQ16H(30), PORT27_FN0), 3864 PINMUX_IRQ(EXT_IRQ16H(30), 27),
2749 PINMUX_IRQ(EXT_IRQ16H(29), PORT28_FN0), 3865 PINMUX_IRQ(EXT_IRQ16H(29), 28),
2750 PINMUX_IRQ(EXT_IRQ16H(22), PORT40_FN0), 3866 PINMUX_IRQ(EXT_IRQ16H(22), 40),
2751 PINMUX_IRQ(EXT_IRQ16H(23), PORT53_FN0), 3867 PINMUX_IRQ(EXT_IRQ16H(23), 53),
2752 PINMUX_IRQ(EXT_IRQ16L(10), PORT54_FN0), 3868 PINMUX_IRQ(EXT_IRQ16L(10), 54),
2753 PINMUX_IRQ(EXT_IRQ16L(9), PORT56_FN0), 3869 PINMUX_IRQ(EXT_IRQ16L(9), 56),
2754 PINMUX_IRQ(EXT_IRQ16H(26), PORT115_FN0), 3870 PINMUX_IRQ(EXT_IRQ16H(26), 115),
2755 PINMUX_IRQ(EXT_IRQ16H(27), PORT116_FN0), 3871 PINMUX_IRQ(EXT_IRQ16H(27), 116),
2756 PINMUX_IRQ(EXT_IRQ16H(28), PORT117_FN0), 3872 PINMUX_IRQ(EXT_IRQ16H(28), 117),
2757 PINMUX_IRQ(EXT_IRQ16H(24), PORT118_FN0), 3873 PINMUX_IRQ(EXT_IRQ16H(24), 118),
2758 PINMUX_IRQ(EXT_IRQ16L(6), PORT147_FN0), 3874 PINMUX_IRQ(EXT_IRQ16L(6), 147),
2759 PINMUX_IRQ(EXT_IRQ16L(2), PORT149_FN0), 3875 PINMUX_IRQ(EXT_IRQ16L(2), 149),
2760 PINMUX_IRQ(EXT_IRQ16L(7), PORT150_FN0), 3876 PINMUX_IRQ(EXT_IRQ16L(7), 150),
2761 PINMUX_IRQ(EXT_IRQ16L(12), PORT156_FN0), 3877 PINMUX_IRQ(EXT_IRQ16L(12), 156),
2762 PINMUX_IRQ(EXT_IRQ16L(4), PORT159_FN0), 3878 PINMUX_IRQ(EXT_IRQ16L(4), 159),
2763 PINMUX_IRQ(EXT_IRQ16H(25), PORT164_FN0), 3879 PINMUX_IRQ(EXT_IRQ16H(25), 164),
2764 PINMUX_IRQ(EXT_IRQ16L(8), PORT223_FN0), 3880 PINMUX_IRQ(EXT_IRQ16L(8), 223),
2765 PINMUX_IRQ(EXT_IRQ16L(3), PORT224_FN0), 3881 PINMUX_IRQ(EXT_IRQ16L(3), 224),
2766 PINMUX_IRQ(EXT_IRQ16L(5), PORT227_FN0), 3882 PINMUX_IRQ(EXT_IRQ16L(5), 227),
2767 PINMUX_IRQ(EXT_IRQ16H(17), PORT234_FN0), 3883 PINMUX_IRQ(EXT_IRQ16H(17), 234),
2768 PINMUX_IRQ(EXT_IRQ16L(11), PORT238_FN0), 3884 PINMUX_IRQ(EXT_IRQ16L(11), 238),
2769 PINMUX_IRQ(EXT_IRQ16L(13), PORT239_FN0), 3885 PINMUX_IRQ(EXT_IRQ16L(13), 239),
2770 PINMUX_IRQ(EXT_IRQ16H(16), PORT249_FN0), 3886 PINMUX_IRQ(EXT_IRQ16H(16), 249),
2771 PINMUX_IRQ(EXT_IRQ16L(14), PORT251_FN0), 3887 PINMUX_IRQ(EXT_IRQ16L(14), 251),
2772 PINMUX_IRQ(EXT_IRQ16L(9), PORT308_FN0), 3888 PINMUX_IRQ(EXT_IRQ16L(9), 308),
2773}; 3889};
2774 3890
2775struct sh_pfc_soc_info sh73a0_pinmux_info = { 3891#define PORTnCR_PULMD_OFF (0 << 6)
3892#define PORTnCR_PULMD_DOWN (2 << 6)
3893#define PORTnCR_PULMD_UP (3 << 6)
3894#define PORTnCR_PULMD_MASK (3 << 6)
3895
3896static const unsigned int sh73a0_portcr_offsets[] = {
3897 0x00000000, 0x00001000, 0x00001000, 0x00002000, 0x00002000,
3898 0x00002000, 0x00002000, 0x00003000, 0x00003000, 0x00002000,
3899};
3900
3901static unsigned int sh73a0_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin)
3902{
3903 void __iomem *addr = pfc->window->virt
3904 + sh73a0_portcr_offsets[pin >> 5] + pin;
3905 u32 value = ioread8(addr) & PORTnCR_PULMD_MASK;
3906
3907 switch (value) {
3908 case PORTnCR_PULMD_UP:
3909 return PIN_CONFIG_BIAS_PULL_UP;
3910 case PORTnCR_PULMD_DOWN:
3911 return PIN_CONFIG_BIAS_PULL_DOWN;
3912 case PORTnCR_PULMD_OFF:
3913 default:
3914 return PIN_CONFIG_BIAS_DISABLE;
3915 }
3916}
3917
3918static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
3919 unsigned int bias)
3920{
3921 void __iomem *addr = pfc->window->virt
3922 + sh73a0_portcr_offsets[pin >> 5] + pin;
3923 u32 value = ioread8(addr) & ~PORTnCR_PULMD_MASK;
3924
3925 switch (bias) {
3926 case PIN_CONFIG_BIAS_PULL_UP:
3927 value |= PORTnCR_PULMD_UP;
3928 break;
3929 case PIN_CONFIG_BIAS_PULL_DOWN:
3930 value |= PORTnCR_PULMD_DOWN;
3931 break;
3932 }
3933
3934 iowrite8(value, addr);
3935}
3936
3937static const struct sh_pfc_soc_operations sh73a0_pinmux_ops = {
3938 .get_bias = sh73a0_pinmux_get_bias,
3939 .set_bias = sh73a0_pinmux_set_bias,
3940};
3941
3942const struct sh_pfc_soc_info sh73a0_pinmux_info = {
2776 .name = "sh73a0_pfc", 3943 .name = "sh73a0_pfc",
2777 .reserved_id = PINMUX_RESERVED, 3944 .ops = &sh73a0_pinmux_ops,
2778 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END }, 3945
2779 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 3946 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2780 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
2781 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END },
2782 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 3947 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
2783 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2784 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 3948 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2785 3949
2786 .first_gpio = GPIO_PORT0, 3950 .pins = pinmux_pins,
2787 .last_gpio = GPIO_FN_FSIAISLD_PU, 3951 .nr_pins = ARRAY_SIZE(pinmux_pins),
3952 .ranges = pinmux_ranges,
3953 .nr_ranges = ARRAY_SIZE(pinmux_ranges),
3954 .groups = pinmux_groups,
3955 .nr_groups = ARRAY_SIZE(pinmux_groups),
3956 .functions = pinmux_functions,
3957 .nr_functions = ARRAY_SIZE(pinmux_functions),
3958
3959 .func_gpios = pinmux_func_gpios,
3960 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2788 3961
2789 .gpios = pinmux_gpios,
2790 .cfg_regs = pinmux_config_regs, 3962 .cfg_regs = pinmux_config_regs,
2791 .data_regs = pinmux_data_regs, 3963 .data_regs = pinmux_data_regs,
2792 3964
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7720.c b/drivers/pinctrl/sh-pfc/pfc-sh7720.c
index 10872ed688a6..52e9f6be665f 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7720.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7720.c
@@ -262,7 +262,7 @@ enum {
262 PINMUX_MARK_END, 262 PINMUX_MARK_END,
263}; 263};
264 264
265static pinmux_enum_t pinmux_data[] = { 265static const pinmux_enum_t pinmux_data[] = {
266 /* PTA GPIO */ 266 /* PTA GPIO */
267 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT, PTA7_IN_PU), 267 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT, PTA7_IN_PU),
268 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT, PTA6_IN_PU), 268 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT, PTA6_IN_PU),
@@ -606,7 +606,7 @@ static pinmux_enum_t pinmux_data[] = {
606 PINMUX_DATA(SIM_CLK_MARK, PSELD_1_0_10, PTV0_FN), 606 PINMUX_DATA(SIM_CLK_MARK, PSELD_1_0_10, PTV0_FN),
607}; 607};
608 608
609static struct pinmux_gpio pinmux_gpios[] = { 609static struct sh_pfc_pin pinmux_pins[] = {
610 /* PTA */ 610 /* PTA */
611 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), 611 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA),
612 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), 612 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA),
@@ -759,202 +759,205 @@ static struct pinmux_gpio pinmux_gpios[] = {
759 PINMUX_GPIO(GPIO_PTV2, PTV2_DATA), 759 PINMUX_GPIO(GPIO_PTV2, PTV2_DATA),
760 PINMUX_GPIO(GPIO_PTV1, PTV1_DATA), 760 PINMUX_GPIO(GPIO_PTV1, PTV1_DATA),
761 PINMUX_GPIO(GPIO_PTV0, PTV0_DATA), 761 PINMUX_GPIO(GPIO_PTV0, PTV0_DATA),
762};
763
764#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
762 765
766static const struct pinmux_func pinmux_func_gpios[] = {
763 /* BSC */ 767 /* BSC */
764 PINMUX_GPIO(GPIO_FN_D31, D31_MARK), 768 GPIO_FN(D31),
765 PINMUX_GPIO(GPIO_FN_D30, D30_MARK), 769 GPIO_FN(D30),
766 PINMUX_GPIO(GPIO_FN_D29, D29_MARK), 770 GPIO_FN(D29),
767 PINMUX_GPIO(GPIO_FN_D28, D28_MARK), 771 GPIO_FN(D28),
768 PINMUX_GPIO(GPIO_FN_D27, D27_MARK), 772 GPIO_FN(D27),
769 PINMUX_GPIO(GPIO_FN_D26, D26_MARK), 773 GPIO_FN(D26),
770 PINMUX_GPIO(GPIO_FN_D25, D25_MARK), 774 GPIO_FN(D25),
771 PINMUX_GPIO(GPIO_FN_D24, D24_MARK), 775 GPIO_FN(D24),
772 PINMUX_GPIO(GPIO_FN_D23, D23_MARK), 776 GPIO_FN(D23),
773 PINMUX_GPIO(GPIO_FN_D22, D22_MARK), 777 GPIO_FN(D22),
774 PINMUX_GPIO(GPIO_FN_D21, D21_MARK), 778 GPIO_FN(D21),
775 PINMUX_GPIO(GPIO_FN_D20, D20_MARK), 779 GPIO_FN(D20),
776 PINMUX_GPIO(GPIO_FN_D19, D19_MARK), 780 GPIO_FN(D19),
777 PINMUX_GPIO(GPIO_FN_D18, D18_MARK), 781 GPIO_FN(D18),
778 PINMUX_GPIO(GPIO_FN_D17, D17_MARK), 782 GPIO_FN(D17),
779 PINMUX_GPIO(GPIO_FN_D16, D16_MARK), 783 GPIO_FN(D16),
780 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 784 GPIO_FN(IOIS16),
781 PINMUX_GPIO(GPIO_FN_RAS, RAS_MARK), 785 GPIO_FN(RAS),
782 PINMUX_GPIO(GPIO_FN_CAS, CAS_MARK), 786 GPIO_FN(CAS),
783 PINMUX_GPIO(GPIO_FN_CKE, CKE_MARK), 787 GPIO_FN(CKE),
784 PINMUX_GPIO(GPIO_FN_CS5B_CE1A, CS5B_CE1A_MARK), 788 GPIO_FN(CS5B_CE1A),
785 PINMUX_GPIO(GPIO_FN_CS6B_CE1B, CS6B_CE1B_MARK), 789 GPIO_FN(CS6B_CE1B),
786 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 790 GPIO_FN(A25),
787 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 791 GPIO_FN(A24),
788 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 792 GPIO_FN(A23),
789 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 793 GPIO_FN(A22),
790 PINMUX_GPIO(GPIO_FN_A21, A21_MARK), 794 GPIO_FN(A21),
791 PINMUX_GPIO(GPIO_FN_A20, A20_MARK), 795 GPIO_FN(A20),
792 PINMUX_GPIO(GPIO_FN_A19, A19_MARK), 796 GPIO_FN(A19),
793 PINMUX_GPIO(GPIO_FN_A0, A0_MARK), 797 GPIO_FN(A0),
794 PINMUX_GPIO(GPIO_FN_REFOUT, REFOUT_MARK), 798 GPIO_FN(REFOUT),
795 PINMUX_GPIO(GPIO_FN_IRQOUT, IRQOUT_MARK), 799 GPIO_FN(IRQOUT),
796 800
797 /* LCDC */ 801 /* LCDC */
798 PINMUX_GPIO(GPIO_FN_LCD_DATA15, LCD_DATA15_MARK), 802 GPIO_FN(LCD_DATA15),
799 PINMUX_GPIO(GPIO_FN_LCD_DATA14, LCD_DATA14_MARK), 803 GPIO_FN(LCD_DATA14),
800 PINMUX_GPIO(GPIO_FN_LCD_DATA13, LCD_DATA13_MARK), 804 GPIO_FN(LCD_DATA13),
801 PINMUX_GPIO(GPIO_FN_LCD_DATA12, LCD_DATA12_MARK), 805 GPIO_FN(LCD_DATA12),
802 PINMUX_GPIO(GPIO_FN_LCD_DATA11, LCD_DATA11_MARK), 806 GPIO_FN(LCD_DATA11),
803 PINMUX_GPIO(GPIO_FN_LCD_DATA10, LCD_DATA10_MARK), 807 GPIO_FN(LCD_DATA10),
804 PINMUX_GPIO(GPIO_FN_LCD_DATA9, LCD_DATA9_MARK), 808 GPIO_FN(LCD_DATA9),
805 PINMUX_GPIO(GPIO_FN_LCD_DATA8, LCD_DATA8_MARK), 809 GPIO_FN(LCD_DATA8),
806 PINMUX_GPIO(GPIO_FN_LCD_DATA7, LCD_DATA7_MARK), 810 GPIO_FN(LCD_DATA7),
807 PINMUX_GPIO(GPIO_FN_LCD_DATA6, LCD_DATA6_MARK), 811 GPIO_FN(LCD_DATA6),
808 PINMUX_GPIO(GPIO_FN_LCD_DATA5, LCD_DATA5_MARK), 812 GPIO_FN(LCD_DATA5),
809 PINMUX_GPIO(GPIO_FN_LCD_DATA4, LCD_DATA4_MARK), 813 GPIO_FN(LCD_DATA4),
810 PINMUX_GPIO(GPIO_FN_LCD_DATA3, LCD_DATA3_MARK), 814 GPIO_FN(LCD_DATA3),
811 PINMUX_GPIO(GPIO_FN_LCD_DATA2, LCD_DATA2_MARK), 815 GPIO_FN(LCD_DATA2),
812 PINMUX_GPIO(GPIO_FN_LCD_DATA1, LCD_DATA1_MARK), 816 GPIO_FN(LCD_DATA1),
813 PINMUX_GPIO(GPIO_FN_LCD_DATA0, LCD_DATA0_MARK), 817 GPIO_FN(LCD_DATA0),
814 PINMUX_GPIO(GPIO_FN_LCD_M_DISP, LCD_M_DISP_MARK), 818 GPIO_FN(LCD_M_DISP),
815 PINMUX_GPIO(GPIO_FN_LCD_CL1, LCD_CL1_MARK), 819 GPIO_FN(LCD_CL1),
816 PINMUX_GPIO(GPIO_FN_LCD_CL2, LCD_CL2_MARK), 820 GPIO_FN(LCD_CL2),
817 PINMUX_GPIO(GPIO_FN_LCD_DON, LCD_DON_MARK), 821 GPIO_FN(LCD_DON),
818 PINMUX_GPIO(GPIO_FN_LCD_FLM, LCD_FLM_MARK), 822 GPIO_FN(LCD_FLM),
819 PINMUX_GPIO(GPIO_FN_LCD_VEPWC, LCD_VEPWC_MARK), 823 GPIO_FN(LCD_VEPWC),
820 PINMUX_GPIO(GPIO_FN_LCD_VCPWC, LCD_VCPWC_MARK), 824 GPIO_FN(LCD_VCPWC),
821 825
822 /* AFEIF */ 826 /* AFEIF */
823 PINMUX_GPIO(GPIO_FN_AFE_RXIN, AFE_RXIN_MARK), 827 GPIO_FN(AFE_RXIN),
824 PINMUX_GPIO(GPIO_FN_AFE_RDET, AFE_RDET_MARK), 828 GPIO_FN(AFE_RDET),
825 PINMUX_GPIO(GPIO_FN_AFE_FS, AFE_FS_MARK), 829 GPIO_FN(AFE_FS),
826 PINMUX_GPIO(GPIO_FN_AFE_TXOUT, AFE_TXOUT_MARK), 830 GPIO_FN(AFE_TXOUT),
827 PINMUX_GPIO(GPIO_FN_AFE_SCLK, AFE_SCLK_MARK), 831 GPIO_FN(AFE_SCLK),
828 PINMUX_GPIO(GPIO_FN_AFE_RLYCNT, AFE_RLYCNT_MARK), 832 GPIO_FN(AFE_RLYCNT),
829 PINMUX_GPIO(GPIO_FN_AFE_HC1, AFE_HC1_MARK), 833 GPIO_FN(AFE_HC1),
830 834
831 /* IIC */ 835 /* IIC */
832 PINMUX_GPIO(GPIO_FN_IIC_SCL, IIC_SCL_MARK), 836 GPIO_FN(IIC_SCL),
833 PINMUX_GPIO(GPIO_FN_IIC_SDA, IIC_SDA_MARK), 837 GPIO_FN(IIC_SDA),
834 838
835 /* DAC */ 839 /* DAC */
836 PINMUX_GPIO(GPIO_FN_DA1, DA1_MARK), 840 GPIO_FN(DA1),
837 PINMUX_GPIO(GPIO_FN_DA0, DA0_MARK), 841 GPIO_FN(DA0),
838 842
839 /* ADC */ 843 /* ADC */
840 PINMUX_GPIO(GPIO_FN_AN3, AN3_MARK), 844 GPIO_FN(AN3),
841 PINMUX_GPIO(GPIO_FN_AN2, AN2_MARK), 845 GPIO_FN(AN2),
842 PINMUX_GPIO(GPIO_FN_AN1, AN1_MARK), 846 GPIO_FN(AN1),
843 PINMUX_GPIO(GPIO_FN_AN0, AN0_MARK), 847 GPIO_FN(AN0),
844 PINMUX_GPIO(GPIO_FN_ADTRG, ADTRG_MARK), 848 GPIO_FN(ADTRG),
845 849
846 /* USB */ 850 /* USB */
847 PINMUX_GPIO(GPIO_FN_USB1D_RCV, USB1D_RCV_MARK), 851 GPIO_FN(USB1D_RCV),
848 PINMUX_GPIO(GPIO_FN_USB1D_TXSE0, USB1D_TXSE0_MARK), 852 GPIO_FN(USB1D_TXSE0),
849 PINMUX_GPIO(GPIO_FN_USB1D_TXDPLS, USB1D_TXDPLS_MARK), 853 GPIO_FN(USB1D_TXDPLS),
850 PINMUX_GPIO(GPIO_FN_USB1D_DMNS, USB1D_DMNS_MARK), 854 GPIO_FN(USB1D_DMNS),
851 PINMUX_GPIO(GPIO_FN_USB1D_DPLS, USB1D_DPLS_MARK), 855 GPIO_FN(USB1D_DPLS),
852 PINMUX_GPIO(GPIO_FN_USB1D_SPEED, USB1D_SPEED_MARK), 856 GPIO_FN(USB1D_SPEED),
853 PINMUX_GPIO(GPIO_FN_USB1D_TXENL, USB1D_TXENL_MARK), 857 GPIO_FN(USB1D_TXENL),
854 858
855 PINMUX_GPIO(GPIO_FN_USB2_PWR_EN, USB2_PWR_EN_MARK), 859 GPIO_FN(USB2_PWR_EN),
856 PINMUX_GPIO(GPIO_FN_USB1_PWR_EN_USBF_UPLUP, 860 GPIO_FN(USB1_PWR_EN_USBF_UPLUP),
857 USB1_PWR_EN_USBF_UPLUP_MARK), 861 GPIO_FN(USB1D_SUSPEND),
858 PINMUX_GPIO(GPIO_FN_USB1D_SUSPEND, USB1D_SUSPEND_MARK),
859 862
860 /* INTC */ 863 /* INTC */
861 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK), 864 GPIO_FN(IRQ5),
862 PINMUX_GPIO(GPIO_FN_IRQ4, IRQ4_MARK), 865 GPIO_FN(IRQ4),
863 PINMUX_GPIO(GPIO_FN_IRQ3_IRL3, IRQ3_IRL3_MARK), 866 GPIO_FN(IRQ3_IRL3),
864 PINMUX_GPIO(GPIO_FN_IRQ2_IRL2, IRQ2_IRL2_MARK), 867 GPIO_FN(IRQ2_IRL2),
865 PINMUX_GPIO(GPIO_FN_IRQ1_IRL1, IRQ1_IRL1_MARK), 868 GPIO_FN(IRQ1_IRL1),
866 PINMUX_GPIO(GPIO_FN_IRQ0_IRL0, IRQ0_IRL0_MARK), 869 GPIO_FN(IRQ0_IRL0),
867 870
868 /* PCC */ 871 /* PCC */
869 PINMUX_GPIO(GPIO_FN_PCC_REG, PCC_REG_MARK), 872 GPIO_FN(PCC_REG),
870 PINMUX_GPIO(GPIO_FN_PCC_DRV, PCC_DRV_MARK), 873 GPIO_FN(PCC_DRV),
871 PINMUX_GPIO(GPIO_FN_PCC_BVD2, PCC_BVD2_MARK), 874 GPIO_FN(PCC_BVD2),
872 PINMUX_GPIO(GPIO_FN_PCC_BVD1, PCC_BVD1_MARK), 875 GPIO_FN(PCC_BVD1),
873 PINMUX_GPIO(GPIO_FN_PCC_CD2, PCC_CD2_MARK), 876 GPIO_FN(PCC_CD2),
874 PINMUX_GPIO(GPIO_FN_PCC_CD1, PCC_CD1_MARK), 877 GPIO_FN(PCC_CD1),
875 PINMUX_GPIO(GPIO_FN_PCC_RESET, PCC_RESET_MARK), 878 GPIO_FN(PCC_RESET),
876 PINMUX_GPIO(GPIO_FN_PCC_RDY, PCC_RDY_MARK), 879 GPIO_FN(PCC_RDY),
877 PINMUX_GPIO(GPIO_FN_PCC_VS2, PCC_VS2_MARK), 880 GPIO_FN(PCC_VS2),
878 PINMUX_GPIO(GPIO_FN_PCC_VS1, PCC_VS1_MARK), 881 GPIO_FN(PCC_VS1),
879 882
880 /* HUDI */ 883 /* HUDI */
881 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK), 884 GPIO_FN(AUDATA3),
882 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK), 885 GPIO_FN(AUDATA2),
883 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK), 886 GPIO_FN(AUDATA1),
884 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK), 887 GPIO_FN(AUDATA0),
885 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK), 888 GPIO_FN(AUDCK),
886 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK), 889 GPIO_FN(AUDSYNC),
887 PINMUX_GPIO(GPIO_FN_ASEBRKAK, ASEBRKAK_MARK), 890 GPIO_FN(ASEBRKAK),
888 PINMUX_GPIO(GPIO_FN_TRST, TRST_MARK), 891 GPIO_FN(TRST),
889 PINMUX_GPIO(GPIO_FN_TMS, TMS_MARK), 892 GPIO_FN(TMS),
890 PINMUX_GPIO(GPIO_FN_TDO, TDO_MARK), 893 GPIO_FN(TDO),
891 PINMUX_GPIO(GPIO_FN_TDI, TDI_MARK), 894 GPIO_FN(TDI),
892 PINMUX_GPIO(GPIO_FN_TCK, TCK_MARK), 895 GPIO_FN(TCK),
893 896
894 /* DMAC */ 897 /* DMAC */
895 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 898 GPIO_FN(DACK1),
896 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 899 GPIO_FN(DREQ1),
897 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 900 GPIO_FN(DACK0),
898 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 901 GPIO_FN(DREQ0),
899 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK), 902 GPIO_FN(TEND1),
900 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK), 903 GPIO_FN(TEND0),
901 904
902 /* SIOF0 */ 905 /* SIOF0 */
903 PINMUX_GPIO(GPIO_FN_SIOF0_SYNC, SIOF0_SYNC_MARK), 906 GPIO_FN(SIOF0_SYNC),
904 PINMUX_GPIO(GPIO_FN_SIOF0_MCLK, SIOF0_MCLK_MARK), 907 GPIO_FN(SIOF0_MCLK),
905 PINMUX_GPIO(GPIO_FN_SIOF0_TXD, SIOF0_TXD_MARK), 908 GPIO_FN(SIOF0_TXD),
906 PINMUX_GPIO(GPIO_FN_SIOF0_RXD, SIOF0_RXD_MARK), 909 GPIO_FN(SIOF0_RXD),
907 PINMUX_GPIO(GPIO_FN_SIOF0_SCK, SIOF0_SCK_MARK), 910 GPIO_FN(SIOF0_SCK),
908 911
909 /* SIOF1 */ 912 /* SIOF1 */
910 PINMUX_GPIO(GPIO_FN_SIOF1_SYNC, SIOF1_SYNC_MARK), 913 GPIO_FN(SIOF1_SYNC),
911 PINMUX_GPIO(GPIO_FN_SIOF1_MCLK, SIOF1_MCLK_MARK), 914 GPIO_FN(SIOF1_MCLK),
912 PINMUX_GPIO(GPIO_FN_SIOF1_TXD, SIOF1_TXD_MARK), 915 GPIO_FN(SIOF1_TXD),
913 PINMUX_GPIO(GPIO_FN_SIOF1_RXD, SIOF1_RXD_MARK), 916 GPIO_FN(SIOF1_RXD),
914 PINMUX_GPIO(GPIO_FN_SIOF1_SCK, SIOF1_SCK_MARK), 917 GPIO_FN(SIOF1_SCK),
915 918
916 /* SCIF0 */ 919 /* SCIF0 */
917 PINMUX_GPIO(GPIO_FN_SCIF0_TXD, SCIF0_TXD_MARK), 920 GPIO_FN(SCIF0_TXD),
918 PINMUX_GPIO(GPIO_FN_SCIF0_RXD, SCIF0_RXD_MARK), 921 GPIO_FN(SCIF0_RXD),
919 PINMUX_GPIO(GPIO_FN_SCIF0_RTS, SCIF0_RTS_MARK), 922 GPIO_FN(SCIF0_RTS),
920 PINMUX_GPIO(GPIO_FN_SCIF0_CTS, SCIF0_CTS_MARK), 923 GPIO_FN(SCIF0_CTS),
921 PINMUX_GPIO(GPIO_FN_SCIF0_SCK, SCIF0_SCK_MARK), 924 GPIO_FN(SCIF0_SCK),
922 925
923 /* SCIF1 */ 926 /* SCIF1 */
924 PINMUX_GPIO(GPIO_FN_SCIF1_TXD, SCIF1_TXD_MARK), 927 GPIO_FN(SCIF1_TXD),
925 PINMUX_GPIO(GPIO_FN_SCIF1_RXD, SCIF1_RXD_MARK), 928 GPIO_FN(SCIF1_RXD),
926 PINMUX_GPIO(GPIO_FN_SCIF1_RTS, SCIF1_RTS_MARK), 929 GPIO_FN(SCIF1_RTS),
927 PINMUX_GPIO(GPIO_FN_SCIF1_CTS, SCIF1_CTS_MARK), 930 GPIO_FN(SCIF1_CTS),
928 PINMUX_GPIO(GPIO_FN_SCIF1_SCK, SCIF1_SCK_MARK), 931 GPIO_FN(SCIF1_SCK),
929 932
930 /* TPU */ 933 /* TPU */
931 PINMUX_GPIO(GPIO_FN_TPU_TO1, TPU_TO1_MARK), 934 GPIO_FN(TPU_TO1),
932 PINMUX_GPIO(GPIO_FN_TPU_TO0, TPU_TO0_MARK), 935 GPIO_FN(TPU_TO0),
933 PINMUX_GPIO(GPIO_FN_TPU_TI3B, TPU_TI3B_MARK), 936 GPIO_FN(TPU_TI3B),
934 PINMUX_GPIO(GPIO_FN_TPU_TI3A, TPU_TI3A_MARK), 937 GPIO_FN(TPU_TI3A),
935 PINMUX_GPIO(GPIO_FN_TPU_TI2B, TPU_TI2B_MARK), 938 GPIO_FN(TPU_TI2B),
936 PINMUX_GPIO(GPIO_FN_TPU_TI2A, TPU_TI2A_MARK), 939 GPIO_FN(TPU_TI2A),
937 PINMUX_GPIO(GPIO_FN_TPU_TO3, TPU_TO3_MARK), 940 GPIO_FN(TPU_TO3),
938 PINMUX_GPIO(GPIO_FN_TPU_TO2, TPU_TO2_MARK), 941 GPIO_FN(TPU_TO2),
939 942
940 /* SIM */ 943 /* SIM */
941 PINMUX_GPIO(GPIO_FN_SIM_D, SIM_D_MARK), 944 GPIO_FN(SIM_D),
942 PINMUX_GPIO(GPIO_FN_SIM_CLK, SIM_CLK_MARK), 945 GPIO_FN(SIM_CLK),
943 PINMUX_GPIO(GPIO_FN_SIM_RST, SIM_RST_MARK), 946 GPIO_FN(SIM_RST),
944 947
945 /* MMC */ 948 /* MMC */
946 PINMUX_GPIO(GPIO_FN_MMC_DAT, MMC_DAT_MARK), 949 GPIO_FN(MMC_DAT),
947 PINMUX_GPIO(GPIO_FN_MMC_CMD, MMC_CMD_MARK), 950 GPIO_FN(MMC_CMD),
948 PINMUX_GPIO(GPIO_FN_MMC_CLK, MMC_CLK_MARK), 951 GPIO_FN(MMC_CLK),
949 PINMUX_GPIO(GPIO_FN_MMC_VDDON, MMC_VDDON_MARK), 952 GPIO_FN(MMC_VDDON),
950 PINMUX_GPIO(GPIO_FN_MMC_ODMOD, MMC_ODMOD_MARK), 953 GPIO_FN(MMC_ODMOD),
951 954
952 /* SYSC */ 955 /* SYSC */
953 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 956 GPIO_FN(STATUS0),
954 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK), 957 GPIO_FN(STATUS1),
955}; 958};
956 959
957static struct pinmux_cfg_reg pinmux_config_regs[] = { 960static const struct pinmux_cfg_reg pinmux_config_regs[] = {
958 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) { 961 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) {
959 PTA7_FN, PTA7_OUT, PTA7_IN_PU, PTA7_IN, 962 PTA7_FN, PTA7_OUT, PTA7_IN_PU, PTA7_IN,
960 PTA6_FN, PTA6_OUT, PTA6_IN_PU, PTA6_IN, 963 PTA6_FN, PTA6_OUT, PTA6_IN_PU, PTA6_IN,
@@ -1138,7 +1141,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1138 {} 1141 {}
1139}; 1142};
1140 1143
1141static struct pinmux_data_reg pinmux_data_regs[] = { 1144static const struct pinmux_data_reg pinmux_data_regs[] = {
1142 { PINMUX_DATA_REG("PADR", 0xa4050140, 8) { 1145 { PINMUX_DATA_REG("PADR", 0xa4050140, 8) {
1143 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, 1146 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
1144 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA } 1147 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA }
@@ -1214,20 +1217,18 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1214 { }, 1217 { },
1215}; 1218};
1216 1219
1217struct sh_pfc_soc_info sh7720_pinmux_info = { 1220const struct sh_pfc_soc_info sh7720_pinmux_info = {
1218 .name = "sh7720_pfc", 1221 .name = "sh7720_pfc",
1219 .reserved_id = PINMUX_RESERVED,
1220 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1221 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 1222 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1222 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 1223 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1223 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 1224 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1224 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1225 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 1225 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1226 1226
1227 .first_gpio = GPIO_PTA7, 1227 .pins = pinmux_pins,
1228 .last_gpio = GPIO_FN_STATUS1, 1228 .nr_pins = ARRAY_SIZE(pinmux_pins),
1229 .func_gpios = pinmux_func_gpios,
1230 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
1229 1231
1230 .gpios = pinmux_gpios,
1231 .cfg_regs = pinmux_config_regs, 1232 .cfg_regs = pinmux_config_regs,
1232 .data_regs = pinmux_data_regs, 1233 .data_regs = pinmux_data_regs,
1233 1234
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7722.c b/drivers/pinctrl/sh-pfc/pfc-sh7722.c
index 2de0929315e6..32034387477b 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7722.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7722.c
@@ -296,7 +296,7 @@ enum {
296 PINMUX_FUNCTION_END, 296 PINMUX_FUNCTION_END,
297}; 297};
298 298
299static pinmux_enum_t pinmux_data[] = { 299static const pinmux_enum_t pinmux_data[] = {
300 /* PTA */ 300 /* PTA */
301 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_IN_PD, PTA7_OUT), 301 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_IN_PD, PTA7_OUT),
302 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_IN_PD), 302 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_IN_PD),
@@ -787,7 +787,7 @@ static pinmux_enum_t pinmux_data[] = {
787 PINMUX_DATA(KEYOUT5_IN5_MARK, HIZA14_KEYSC, KEYOUT5_IN5), 787 PINMUX_DATA(KEYOUT5_IN5_MARK, HIZA14_KEYSC, KEYOUT5_IN5),
788}; 788};
789 789
790static struct pinmux_gpio pinmux_gpios[] = { 790static struct sh_pfc_pin pinmux_pins[] = {
791 /* PTA */ 791 /* PTA */
792 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), 792 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA),
793 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), 793 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA),
@@ -982,289 +982,293 @@ static struct pinmux_gpio pinmux_gpios[] = {
982 PINMUX_GPIO(GPIO_PTZ3, PTZ3_DATA), 982 PINMUX_GPIO(GPIO_PTZ3, PTZ3_DATA),
983 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), 983 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA),
984 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), 984 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA),
985};
986
987#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
985 988
989static const struct pinmux_func pinmux_func_gpios[] = {
986 /* SCIF0 */ 990 /* SCIF0 */
987 PINMUX_GPIO(GPIO_FN_SCIF0_TXD, SCIF0_TXD_MARK), 991 GPIO_FN(SCIF0_TXD),
988 PINMUX_GPIO(GPIO_FN_SCIF0_RXD, SCIF0_RXD_MARK), 992 GPIO_FN(SCIF0_RXD),
989 PINMUX_GPIO(GPIO_FN_SCIF0_RTS, SCIF0_RTS_MARK), 993 GPIO_FN(SCIF0_RTS),
990 PINMUX_GPIO(GPIO_FN_SCIF0_CTS, SCIF0_CTS_MARK), 994 GPIO_FN(SCIF0_CTS),
991 PINMUX_GPIO(GPIO_FN_SCIF0_SCK, SCIF0_SCK_MARK), 995 GPIO_FN(SCIF0_SCK),
992 996
993 /* SCIF1 */ 997 /* SCIF1 */
994 PINMUX_GPIO(GPIO_FN_SCIF1_TXD, SCIF1_TXD_MARK), 998 GPIO_FN(SCIF1_TXD),
995 PINMUX_GPIO(GPIO_FN_SCIF1_RXD, SCIF1_RXD_MARK), 999 GPIO_FN(SCIF1_RXD),
996 PINMUX_GPIO(GPIO_FN_SCIF1_RTS, SCIF1_RTS_MARK), 1000 GPIO_FN(SCIF1_RTS),
997 PINMUX_GPIO(GPIO_FN_SCIF1_CTS, SCIF1_CTS_MARK), 1001 GPIO_FN(SCIF1_CTS),
998 PINMUX_GPIO(GPIO_FN_SCIF1_SCK, SCIF1_SCK_MARK), 1002 GPIO_FN(SCIF1_SCK),
999 1003
1000 /* SCIF2 */ 1004 /* SCIF2 */
1001 PINMUX_GPIO(GPIO_FN_SCIF2_TXD, SCIF2_TXD_MARK), 1005 GPIO_FN(SCIF2_TXD),
1002 PINMUX_GPIO(GPIO_FN_SCIF2_RXD, SCIF2_RXD_MARK), 1006 GPIO_FN(SCIF2_RXD),
1003 PINMUX_GPIO(GPIO_FN_SCIF2_RTS, SCIF2_RTS_MARK), 1007 GPIO_FN(SCIF2_RTS),
1004 PINMUX_GPIO(GPIO_FN_SCIF2_CTS, SCIF2_CTS_MARK), 1008 GPIO_FN(SCIF2_CTS),
1005 PINMUX_GPIO(GPIO_FN_SCIF2_SCK, SCIF2_SCK_MARK), 1009 GPIO_FN(SCIF2_SCK),
1006 1010
1007 /* SIO */ 1011 /* SIO */
1008 PINMUX_GPIO(GPIO_FN_SIOTXD, SIOTXD_MARK), 1012 GPIO_FN(SIOTXD),
1009 PINMUX_GPIO(GPIO_FN_SIORXD, SIORXD_MARK), 1013 GPIO_FN(SIORXD),
1010 PINMUX_GPIO(GPIO_FN_SIOD, SIOD_MARK), 1014 GPIO_FN(SIOD),
1011 PINMUX_GPIO(GPIO_FN_SIOSTRB0, SIOSTRB0_MARK), 1015 GPIO_FN(SIOSTRB0),
1012 PINMUX_GPIO(GPIO_FN_SIOSTRB1, SIOSTRB1_MARK), 1016 GPIO_FN(SIOSTRB1),
1013 PINMUX_GPIO(GPIO_FN_SIOSCK, SIOSCK_MARK), 1017 GPIO_FN(SIOSCK),
1014 PINMUX_GPIO(GPIO_FN_SIOMCK, SIOMCK_MARK), 1018 GPIO_FN(SIOMCK),
1015 1019
1016 /* CEU */ 1020 /* CEU */
1017 PINMUX_GPIO(GPIO_FN_VIO_D15, VIO_D15_MARK), 1021 GPIO_FN(VIO_D15),
1018 PINMUX_GPIO(GPIO_FN_VIO_D14, VIO_D14_MARK), 1022 GPIO_FN(VIO_D14),
1019 PINMUX_GPIO(GPIO_FN_VIO_D13, VIO_D13_MARK), 1023 GPIO_FN(VIO_D13),
1020 PINMUX_GPIO(GPIO_FN_VIO_D12, VIO_D12_MARK), 1024 GPIO_FN(VIO_D12),
1021 PINMUX_GPIO(GPIO_FN_VIO_D11, VIO_D11_MARK), 1025 GPIO_FN(VIO_D11),
1022 PINMUX_GPIO(GPIO_FN_VIO_D10, VIO_D10_MARK), 1026 GPIO_FN(VIO_D10),
1023 PINMUX_GPIO(GPIO_FN_VIO_D9, VIO_D9_MARK), 1027 GPIO_FN(VIO_D9),
1024 PINMUX_GPIO(GPIO_FN_VIO_D8, VIO_D8_MARK), 1028 GPIO_FN(VIO_D8),
1025 PINMUX_GPIO(GPIO_FN_VIO_D7, VIO_D7_MARK), 1029 GPIO_FN(VIO_D7),
1026 PINMUX_GPIO(GPIO_FN_VIO_D6, VIO_D6_MARK), 1030 GPIO_FN(VIO_D6),
1027 PINMUX_GPIO(GPIO_FN_VIO_D5, VIO_D5_MARK), 1031 GPIO_FN(VIO_D5),
1028 PINMUX_GPIO(GPIO_FN_VIO_D4, VIO_D4_MARK), 1032 GPIO_FN(VIO_D4),
1029 PINMUX_GPIO(GPIO_FN_VIO_D3, VIO_D3_MARK), 1033 GPIO_FN(VIO_D3),
1030 PINMUX_GPIO(GPIO_FN_VIO_D2, VIO_D2_MARK), 1034 GPIO_FN(VIO_D2),
1031 PINMUX_GPIO(GPIO_FN_VIO_D1, VIO_D1_MARK), 1035 GPIO_FN(VIO_D1),
1032 PINMUX_GPIO(GPIO_FN_VIO_D0, VIO_D0_MARK), 1036 GPIO_FN(VIO_D0),
1033 PINMUX_GPIO(GPIO_FN_VIO_CLK, VIO_CLK_MARK), 1037 GPIO_FN(VIO_CLK),
1034 PINMUX_GPIO(GPIO_FN_VIO_VD, VIO_VD_MARK), 1038 GPIO_FN(VIO_VD),
1035 PINMUX_GPIO(GPIO_FN_VIO_HD, VIO_HD_MARK), 1039 GPIO_FN(VIO_HD),
1036 PINMUX_GPIO(GPIO_FN_VIO_FLD, VIO_FLD_MARK), 1040 GPIO_FN(VIO_FLD),
1037 PINMUX_GPIO(GPIO_FN_VIO_CKO, VIO_CKO_MARK), 1041 GPIO_FN(VIO_CKO),
1038 PINMUX_GPIO(GPIO_FN_VIO_STEX, VIO_STEX_MARK), 1042 GPIO_FN(VIO_STEX),
1039 PINMUX_GPIO(GPIO_FN_VIO_STEM, VIO_STEM_MARK), 1043 GPIO_FN(VIO_STEM),
1040 PINMUX_GPIO(GPIO_FN_VIO_VD2, VIO_VD2_MARK), 1044 GPIO_FN(VIO_VD2),
1041 PINMUX_GPIO(GPIO_FN_VIO_HD2, VIO_HD2_MARK), 1045 GPIO_FN(VIO_HD2),
1042 PINMUX_GPIO(GPIO_FN_VIO_CLK2, VIO_CLK2_MARK), 1046 GPIO_FN(VIO_CLK2),
1043 1047
1044 /* LCDC */ 1048 /* LCDC */
1045 PINMUX_GPIO(GPIO_FN_LCDD23, LCDD23_MARK), 1049 GPIO_FN(LCDD23),
1046 PINMUX_GPIO(GPIO_FN_LCDD22, LCDD22_MARK), 1050 GPIO_FN(LCDD22),
1047 PINMUX_GPIO(GPIO_FN_LCDD21, LCDD21_MARK), 1051 GPIO_FN(LCDD21),
1048 PINMUX_GPIO(GPIO_FN_LCDD20, LCDD20_MARK), 1052 GPIO_FN(LCDD20),
1049 PINMUX_GPIO(GPIO_FN_LCDD19, LCDD19_MARK), 1053 GPIO_FN(LCDD19),
1050 PINMUX_GPIO(GPIO_FN_LCDD18, LCDD18_MARK), 1054 GPIO_FN(LCDD18),
1051 PINMUX_GPIO(GPIO_FN_LCDD17, LCDD17_MARK), 1055 GPIO_FN(LCDD17),
1052 PINMUX_GPIO(GPIO_FN_LCDD16, LCDD16_MARK), 1056 GPIO_FN(LCDD16),
1053 PINMUX_GPIO(GPIO_FN_LCDD15, LCDD15_MARK), 1057 GPIO_FN(LCDD15),
1054 PINMUX_GPIO(GPIO_FN_LCDD14, LCDD14_MARK), 1058 GPIO_FN(LCDD14),
1055 PINMUX_GPIO(GPIO_FN_LCDD13, LCDD13_MARK), 1059 GPIO_FN(LCDD13),
1056 PINMUX_GPIO(GPIO_FN_LCDD12, LCDD12_MARK), 1060 GPIO_FN(LCDD12),
1057 PINMUX_GPIO(GPIO_FN_LCDD11, LCDD11_MARK), 1061 GPIO_FN(LCDD11),
1058 PINMUX_GPIO(GPIO_FN_LCDD10, LCDD10_MARK), 1062 GPIO_FN(LCDD10),
1059 PINMUX_GPIO(GPIO_FN_LCDD9, LCDD9_MARK), 1063 GPIO_FN(LCDD9),
1060 PINMUX_GPIO(GPIO_FN_LCDD8, LCDD8_MARK), 1064 GPIO_FN(LCDD8),
1061 PINMUX_GPIO(GPIO_FN_LCDD7, LCDD7_MARK), 1065 GPIO_FN(LCDD7),
1062 PINMUX_GPIO(GPIO_FN_LCDD6, LCDD6_MARK), 1066 GPIO_FN(LCDD6),
1063 PINMUX_GPIO(GPIO_FN_LCDD5, LCDD5_MARK), 1067 GPIO_FN(LCDD5),
1064 PINMUX_GPIO(GPIO_FN_LCDD4, LCDD4_MARK), 1068 GPIO_FN(LCDD4),
1065 PINMUX_GPIO(GPIO_FN_LCDD3, LCDD3_MARK), 1069 GPIO_FN(LCDD3),
1066 PINMUX_GPIO(GPIO_FN_LCDD2, LCDD2_MARK), 1070 GPIO_FN(LCDD2),
1067 PINMUX_GPIO(GPIO_FN_LCDD1, LCDD1_MARK), 1071 GPIO_FN(LCDD1),
1068 PINMUX_GPIO(GPIO_FN_LCDD0, LCDD0_MARK), 1072 GPIO_FN(LCDD0),
1069 PINMUX_GPIO(GPIO_FN_LCDLCLK, LCDLCLK_MARK), 1073 GPIO_FN(LCDLCLK),
1070 /* Main LCD */ 1074 /* Main LCD */
1071 PINMUX_GPIO(GPIO_FN_LCDDON, LCDDON_MARK), 1075 GPIO_FN(LCDDON),
1072 PINMUX_GPIO(GPIO_FN_LCDVCPWC, LCDVCPWC_MARK), 1076 GPIO_FN(LCDVCPWC),
1073 PINMUX_GPIO(GPIO_FN_LCDVEPWC, LCDVEPWC_MARK), 1077 GPIO_FN(LCDVEPWC),
1074 PINMUX_GPIO(GPIO_FN_LCDVSYN, LCDVSYN_MARK), 1078 GPIO_FN(LCDVSYN),
1075 /* Main LCD - RGB Mode */ 1079 /* Main LCD - RGB Mode */
1076 PINMUX_GPIO(GPIO_FN_LCDDCK, LCDDCK_MARK), 1080 GPIO_FN(LCDDCK),
1077 PINMUX_GPIO(GPIO_FN_LCDHSYN, LCDHSYN_MARK), 1081 GPIO_FN(LCDHSYN),
1078 PINMUX_GPIO(GPIO_FN_LCDDISP, LCDDISP_MARK), 1082 GPIO_FN(LCDDISP),
1079 /* Main LCD - SYS Mode */ 1083 /* Main LCD - SYS Mode */
1080 PINMUX_GPIO(GPIO_FN_LCDRS, LCDRS_MARK), 1084 GPIO_FN(LCDRS),
1081 PINMUX_GPIO(GPIO_FN_LCDCS, LCDCS_MARK), 1085 GPIO_FN(LCDCS),
1082 PINMUX_GPIO(GPIO_FN_LCDWR, LCDWR_MARK), 1086 GPIO_FN(LCDWR),
1083 PINMUX_GPIO(GPIO_FN_LCDRD, LCDRD_MARK), 1087 GPIO_FN(LCDRD),
1084 /* Sub LCD - SYS Mode */ 1088 /* Sub LCD - SYS Mode */
1085 PINMUX_GPIO(GPIO_FN_LCDDON2, LCDDON2_MARK), 1089 GPIO_FN(LCDDON2),
1086 PINMUX_GPIO(GPIO_FN_LCDVCPWC2, LCDVCPWC2_MARK), 1090 GPIO_FN(LCDVCPWC2),
1087 PINMUX_GPIO(GPIO_FN_LCDVEPWC2, LCDVEPWC2_MARK), 1091 GPIO_FN(LCDVEPWC2),
1088 PINMUX_GPIO(GPIO_FN_LCDVSYN2, LCDVSYN2_MARK), 1092 GPIO_FN(LCDVSYN2),
1089 PINMUX_GPIO(GPIO_FN_LCDCS2, LCDCS2_MARK), 1093 GPIO_FN(LCDCS2),
1090 1094
1091 /* BSC */ 1095 /* BSC */
1092 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 1096 GPIO_FN(IOIS16),
1093 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 1097 GPIO_FN(A25),
1094 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 1098 GPIO_FN(A24),
1095 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1099 GPIO_FN(A23),
1096 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1100 GPIO_FN(A22),
1097 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1101 GPIO_FN(BS),
1098 PINMUX_GPIO(GPIO_FN_CS6B_CE1B, CS6B_CE1B_MARK), 1102 GPIO_FN(CS6B_CE1B),
1099 PINMUX_GPIO(GPIO_FN_WAIT, WAIT_MARK), 1103 GPIO_FN(WAIT),
1100 PINMUX_GPIO(GPIO_FN_CS6A_CE2B, CS6A_CE2B_MARK), 1104 GPIO_FN(CS6A_CE2B),
1101 1105
1102 /* SBSC */ 1106 /* SBSC */
1103 PINMUX_GPIO(GPIO_FN_HPD63, HPD63_MARK), 1107 GPIO_FN(HPD63),
1104 PINMUX_GPIO(GPIO_FN_HPD62, HPD62_MARK), 1108 GPIO_FN(HPD62),
1105 PINMUX_GPIO(GPIO_FN_HPD61, HPD61_MARK), 1109 GPIO_FN(HPD61),
1106 PINMUX_GPIO(GPIO_FN_HPD60, HPD60_MARK), 1110 GPIO_FN(HPD60),
1107 PINMUX_GPIO(GPIO_FN_HPD59, HPD59_MARK), 1111 GPIO_FN(HPD59),
1108 PINMUX_GPIO(GPIO_FN_HPD58, HPD58_MARK), 1112 GPIO_FN(HPD58),
1109 PINMUX_GPIO(GPIO_FN_HPD57, HPD57_MARK), 1113 GPIO_FN(HPD57),
1110 PINMUX_GPIO(GPIO_FN_HPD56, HPD56_MARK), 1114 GPIO_FN(HPD56),
1111 PINMUX_GPIO(GPIO_FN_HPD55, HPD55_MARK), 1115 GPIO_FN(HPD55),
1112 PINMUX_GPIO(GPIO_FN_HPD54, HPD54_MARK), 1116 GPIO_FN(HPD54),
1113 PINMUX_GPIO(GPIO_FN_HPD53, HPD53_MARK), 1117 GPIO_FN(HPD53),
1114 PINMUX_GPIO(GPIO_FN_HPD52, HPD52_MARK), 1118 GPIO_FN(HPD52),
1115 PINMUX_GPIO(GPIO_FN_HPD51, HPD51_MARK), 1119 GPIO_FN(HPD51),
1116 PINMUX_GPIO(GPIO_FN_HPD50, HPD50_MARK), 1120 GPIO_FN(HPD50),
1117 PINMUX_GPIO(GPIO_FN_HPD49, HPD49_MARK), 1121 GPIO_FN(HPD49),
1118 PINMUX_GPIO(GPIO_FN_HPD48, HPD48_MARK), 1122 GPIO_FN(HPD48),
1119 PINMUX_GPIO(GPIO_FN_HPDQM7, HPDQM7_MARK), 1123 GPIO_FN(HPDQM7),
1120 PINMUX_GPIO(GPIO_FN_HPDQM6, HPDQM6_MARK), 1124 GPIO_FN(HPDQM6),
1121 PINMUX_GPIO(GPIO_FN_HPDQM5, HPDQM5_MARK), 1125 GPIO_FN(HPDQM5),
1122 PINMUX_GPIO(GPIO_FN_HPDQM4, HPDQM4_MARK), 1126 GPIO_FN(HPDQM4),
1123 1127
1124 /* IRQ */ 1128 /* IRQ */
1125 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK), 1129 GPIO_FN(IRQ0),
1126 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK), 1130 GPIO_FN(IRQ1),
1127 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK), 1131 GPIO_FN(IRQ2),
1128 PINMUX_GPIO(GPIO_FN_IRQ3, IRQ3_MARK), 1132 GPIO_FN(IRQ3),
1129 PINMUX_GPIO(GPIO_FN_IRQ4, IRQ4_MARK), 1133 GPIO_FN(IRQ4),
1130 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK), 1134 GPIO_FN(IRQ5),
1131 PINMUX_GPIO(GPIO_FN_IRQ6, IRQ6_MARK), 1135 GPIO_FN(IRQ6),
1132 PINMUX_GPIO(GPIO_FN_IRQ7, IRQ7_MARK), 1136 GPIO_FN(IRQ7),
1133 1137
1134 /* SDHI */ 1138 /* SDHI */
1135 PINMUX_GPIO(GPIO_FN_SDHICD, SDHICD_MARK), 1139 GPIO_FN(SDHICD),
1136 PINMUX_GPIO(GPIO_FN_SDHIWP, SDHIWP_MARK), 1140 GPIO_FN(SDHIWP),
1137 PINMUX_GPIO(GPIO_FN_SDHID3, SDHID3_MARK), 1141 GPIO_FN(SDHID3),
1138 PINMUX_GPIO(GPIO_FN_SDHID2, SDHID2_MARK), 1142 GPIO_FN(SDHID2),
1139 PINMUX_GPIO(GPIO_FN_SDHID1, SDHID1_MARK), 1143 GPIO_FN(SDHID1),
1140 PINMUX_GPIO(GPIO_FN_SDHID0, SDHID0_MARK), 1144 GPIO_FN(SDHID0),
1141 PINMUX_GPIO(GPIO_FN_SDHICMD, SDHICMD_MARK), 1145 GPIO_FN(SDHICMD),
1142 PINMUX_GPIO(GPIO_FN_SDHICLK, SDHICLK_MARK), 1146 GPIO_FN(SDHICLK),
1143 1147
1144 /* SIU - Port A */ 1148 /* SIU - Port A */
1145 PINMUX_GPIO(GPIO_FN_SIUAOLR, SIUAOLR_MARK), 1149 GPIO_FN(SIUAOLR),
1146 PINMUX_GPIO(GPIO_FN_SIUAOBT, SIUAOBT_MARK), 1150 GPIO_FN(SIUAOBT),
1147 PINMUX_GPIO(GPIO_FN_SIUAISLD, SIUAISLD_MARK), 1151 GPIO_FN(SIUAISLD),
1148 PINMUX_GPIO(GPIO_FN_SIUAILR, SIUAILR_MARK), 1152 GPIO_FN(SIUAILR),
1149 PINMUX_GPIO(GPIO_FN_SIUAIBT, SIUAIBT_MARK), 1153 GPIO_FN(SIUAIBT),
1150 PINMUX_GPIO(GPIO_FN_SIUAOSLD, SIUAOSLD_MARK), 1154 GPIO_FN(SIUAOSLD),
1151 PINMUX_GPIO(GPIO_FN_SIUMCKA, SIUMCKA_MARK), 1155 GPIO_FN(SIUMCKA),
1152 PINMUX_GPIO(GPIO_FN_SIUFCKA, SIUFCKA_MARK), 1156 GPIO_FN(SIUFCKA),
1153 1157
1154 /* SIU - Port B */ 1158 /* SIU - Port B */
1155 PINMUX_GPIO(GPIO_FN_SIUBOLR, SIUBOLR_MARK), 1159 GPIO_FN(SIUBOLR),
1156 PINMUX_GPIO(GPIO_FN_SIUBOBT, SIUBOBT_MARK), 1160 GPIO_FN(SIUBOBT),
1157 PINMUX_GPIO(GPIO_FN_SIUBISLD, SIUBISLD_MARK), 1161 GPIO_FN(SIUBISLD),
1158 PINMUX_GPIO(GPIO_FN_SIUBILR, SIUBILR_MARK), 1162 GPIO_FN(SIUBILR),
1159 PINMUX_GPIO(GPIO_FN_SIUBIBT, SIUBIBT_MARK), 1163 GPIO_FN(SIUBIBT),
1160 PINMUX_GPIO(GPIO_FN_SIUBOSLD, SIUBOSLD_MARK), 1164 GPIO_FN(SIUBOSLD),
1161 PINMUX_GPIO(GPIO_FN_SIUMCKB, SIUMCKB_MARK), 1165 GPIO_FN(SIUMCKB),
1162 PINMUX_GPIO(GPIO_FN_SIUFCKB, SIUFCKB_MARK), 1166 GPIO_FN(SIUFCKB),
1163 1167
1164 /* AUD */ 1168 /* AUD */
1165 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK), 1169 GPIO_FN(AUDSYNC),
1166 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK), 1170 GPIO_FN(AUDATA3),
1167 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK), 1171 GPIO_FN(AUDATA2),
1168 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK), 1172 GPIO_FN(AUDATA1),
1169 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK), 1173 GPIO_FN(AUDATA0),
1170 1174
1171 /* DMAC */ 1175 /* DMAC */
1172 PINMUX_GPIO(GPIO_FN_DACK, DACK_MARK), 1176 GPIO_FN(DACK),
1173 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 1177 GPIO_FN(DREQ0),
1174 1178
1175 /* VOU */ 1179 /* VOU */
1176 PINMUX_GPIO(GPIO_FN_DV_CLKI, DV_CLKI_MARK), 1180 GPIO_FN(DV_CLKI),
1177 PINMUX_GPIO(GPIO_FN_DV_CLK, DV_CLK_MARK), 1181 GPIO_FN(DV_CLK),
1178 PINMUX_GPIO(GPIO_FN_DV_HSYNC, DV_HSYNC_MARK), 1182 GPIO_FN(DV_HSYNC),
1179 PINMUX_GPIO(GPIO_FN_DV_VSYNC, DV_VSYNC_MARK), 1183 GPIO_FN(DV_VSYNC),
1180 PINMUX_GPIO(GPIO_FN_DV_D15, DV_D15_MARK), 1184 GPIO_FN(DV_D15),
1181 PINMUX_GPIO(GPIO_FN_DV_D14, DV_D14_MARK), 1185 GPIO_FN(DV_D14),
1182 PINMUX_GPIO(GPIO_FN_DV_D13, DV_D13_MARK), 1186 GPIO_FN(DV_D13),
1183 PINMUX_GPIO(GPIO_FN_DV_D12, DV_D12_MARK), 1187 GPIO_FN(DV_D12),
1184 PINMUX_GPIO(GPIO_FN_DV_D11, DV_D11_MARK), 1188 GPIO_FN(DV_D11),
1185 PINMUX_GPIO(GPIO_FN_DV_D10, DV_D10_MARK), 1189 GPIO_FN(DV_D10),
1186 PINMUX_GPIO(GPIO_FN_DV_D9, DV_D9_MARK), 1190 GPIO_FN(DV_D9),
1187 PINMUX_GPIO(GPIO_FN_DV_D8, DV_D8_MARK), 1191 GPIO_FN(DV_D8),
1188 PINMUX_GPIO(GPIO_FN_DV_D7, DV_D7_MARK), 1192 GPIO_FN(DV_D7),
1189 PINMUX_GPIO(GPIO_FN_DV_D6, DV_D6_MARK), 1193 GPIO_FN(DV_D6),
1190 PINMUX_GPIO(GPIO_FN_DV_D5, DV_D5_MARK), 1194 GPIO_FN(DV_D5),
1191 PINMUX_GPIO(GPIO_FN_DV_D4, DV_D4_MARK), 1195 GPIO_FN(DV_D4),
1192 PINMUX_GPIO(GPIO_FN_DV_D3, DV_D3_MARK), 1196 GPIO_FN(DV_D3),
1193 PINMUX_GPIO(GPIO_FN_DV_D2, DV_D2_MARK), 1197 GPIO_FN(DV_D2),
1194 PINMUX_GPIO(GPIO_FN_DV_D1, DV_D1_MARK), 1198 GPIO_FN(DV_D1),
1195 PINMUX_GPIO(GPIO_FN_DV_D0, DV_D0_MARK), 1199 GPIO_FN(DV_D0),
1196 1200
1197 /* CPG */ 1201 /* CPG */
1198 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 1202 GPIO_FN(STATUS0),
1199 PINMUX_GPIO(GPIO_FN_PDSTATUS, PDSTATUS_MARK), 1203 GPIO_FN(PDSTATUS),
1200 1204
1201 /* SIOF0 */ 1205 /* SIOF0 */
1202 PINMUX_GPIO(GPIO_FN_SIOF0_MCK, SIOF0_MCK_MARK), 1206 GPIO_FN(SIOF0_MCK),
1203 PINMUX_GPIO(GPIO_FN_SIOF0_SCK, SIOF0_SCK_MARK), 1207 GPIO_FN(SIOF0_SCK),
1204 PINMUX_GPIO(GPIO_FN_SIOF0_SYNC, SIOF0_SYNC_MARK), 1208 GPIO_FN(SIOF0_SYNC),
1205 PINMUX_GPIO(GPIO_FN_SIOF0_SS1, SIOF0_SS1_MARK), 1209 GPIO_FN(SIOF0_SS1),
1206 PINMUX_GPIO(GPIO_FN_SIOF0_SS2, SIOF0_SS2_MARK), 1210 GPIO_FN(SIOF0_SS2),
1207 PINMUX_GPIO(GPIO_FN_SIOF0_TXD, SIOF0_TXD_MARK), 1211 GPIO_FN(SIOF0_TXD),
1208 PINMUX_GPIO(GPIO_FN_SIOF0_RXD, SIOF0_RXD_MARK), 1212 GPIO_FN(SIOF0_RXD),
1209 1213
1210 /* SIOF1 */ 1214 /* SIOF1 */
1211 PINMUX_GPIO(GPIO_FN_SIOF1_MCK, SIOF1_MCK_MARK), 1215 GPIO_FN(SIOF1_MCK),
1212 PINMUX_GPIO(GPIO_FN_SIOF1_SCK, SIOF1_SCK_MARK), 1216 GPIO_FN(SIOF1_SCK),
1213 PINMUX_GPIO(GPIO_FN_SIOF1_SYNC, SIOF1_SYNC_MARK), 1217 GPIO_FN(SIOF1_SYNC),
1214 PINMUX_GPIO(GPIO_FN_SIOF1_SS1, SIOF1_SS1_MARK), 1218 GPIO_FN(SIOF1_SS1),
1215 PINMUX_GPIO(GPIO_FN_SIOF1_SS2, SIOF1_SS2_MARK), 1219 GPIO_FN(SIOF1_SS2),
1216 PINMUX_GPIO(GPIO_FN_SIOF1_TXD, SIOF1_TXD_MARK), 1220 GPIO_FN(SIOF1_TXD),
1217 PINMUX_GPIO(GPIO_FN_SIOF1_RXD, SIOF1_RXD_MARK), 1221 GPIO_FN(SIOF1_RXD),
1218 1222
1219 /* SIM */ 1223 /* SIM */
1220 PINMUX_GPIO(GPIO_FN_SIM_D, SIM_D_MARK), 1224 GPIO_FN(SIM_D),
1221 PINMUX_GPIO(GPIO_FN_SIM_CLK, SIM_CLK_MARK), 1225 GPIO_FN(SIM_CLK),
1222 PINMUX_GPIO(GPIO_FN_SIM_RST, SIM_RST_MARK), 1226 GPIO_FN(SIM_RST),
1223 1227
1224 /* TSIF */ 1228 /* TSIF */
1225 PINMUX_GPIO(GPIO_FN_TS_SDAT, TS_SDAT_MARK), 1229 GPIO_FN(TS_SDAT),
1226 PINMUX_GPIO(GPIO_FN_TS_SCK, TS_SCK_MARK), 1230 GPIO_FN(TS_SCK),
1227 PINMUX_GPIO(GPIO_FN_TS_SDEN, TS_SDEN_MARK), 1231 GPIO_FN(TS_SDEN),
1228 PINMUX_GPIO(GPIO_FN_TS_SPSYNC, TS_SPSYNC_MARK), 1232 GPIO_FN(TS_SPSYNC),
1229 1233
1230 /* IRDA */ 1234 /* IRDA */
1231 PINMUX_GPIO(GPIO_FN_IRDA_IN, IRDA_IN_MARK), 1235 GPIO_FN(IRDA_IN),
1232 PINMUX_GPIO(GPIO_FN_IRDA_OUT, IRDA_OUT_MARK), 1236 GPIO_FN(IRDA_OUT),
1233 1237
1234 /* TPU */ 1238 /* TPU */
1235 PINMUX_GPIO(GPIO_FN_TPUTO, TPUTO_MARK), 1239 GPIO_FN(TPUTO),
1236 1240
1237 /* FLCTL */ 1241 /* FLCTL */
1238 PINMUX_GPIO(GPIO_FN_FCE, FCE_MARK), 1242 GPIO_FN(FCE),
1239 PINMUX_GPIO(GPIO_FN_NAF7, NAF7_MARK), 1243 GPIO_FN(NAF7),
1240 PINMUX_GPIO(GPIO_FN_NAF6, NAF6_MARK), 1244 GPIO_FN(NAF6),
1241 PINMUX_GPIO(GPIO_FN_NAF5, NAF5_MARK), 1245 GPIO_FN(NAF5),
1242 PINMUX_GPIO(GPIO_FN_NAF4, NAF4_MARK), 1246 GPIO_FN(NAF4),
1243 PINMUX_GPIO(GPIO_FN_NAF3, NAF3_MARK), 1247 GPIO_FN(NAF3),
1244 PINMUX_GPIO(GPIO_FN_NAF2, NAF2_MARK), 1248 GPIO_FN(NAF2),
1245 PINMUX_GPIO(GPIO_FN_NAF1, NAF1_MARK), 1249 GPIO_FN(NAF1),
1246 PINMUX_GPIO(GPIO_FN_NAF0, NAF0_MARK), 1250 GPIO_FN(NAF0),
1247 PINMUX_GPIO(GPIO_FN_FCDE, FCDE_MARK), 1251 GPIO_FN(FCDE),
1248 PINMUX_GPIO(GPIO_FN_FOE, FOE_MARK), 1252 GPIO_FN(FOE),
1249 PINMUX_GPIO(GPIO_FN_FSC, FSC_MARK), 1253 GPIO_FN(FSC),
1250 PINMUX_GPIO(GPIO_FN_FWE, FWE_MARK), 1254 GPIO_FN(FWE),
1251 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 1255 GPIO_FN(FRB),
1252 1256
1253 /* KEYSC */ 1257 /* KEYSC */
1254 PINMUX_GPIO(GPIO_FN_KEYIN0, KEYIN0_MARK), 1258 GPIO_FN(KEYIN0),
1255 PINMUX_GPIO(GPIO_FN_KEYIN1, KEYIN1_MARK), 1259 GPIO_FN(KEYIN1),
1256 PINMUX_GPIO(GPIO_FN_KEYIN2, KEYIN2_MARK), 1260 GPIO_FN(KEYIN2),
1257 PINMUX_GPIO(GPIO_FN_KEYIN3, KEYIN3_MARK), 1261 GPIO_FN(KEYIN3),
1258 PINMUX_GPIO(GPIO_FN_KEYIN4, KEYIN4_MARK), 1262 GPIO_FN(KEYIN4),
1259 PINMUX_GPIO(GPIO_FN_KEYOUT0, KEYOUT0_MARK), 1263 GPIO_FN(KEYOUT0),
1260 PINMUX_GPIO(GPIO_FN_KEYOUT1, KEYOUT1_MARK), 1264 GPIO_FN(KEYOUT1),
1261 PINMUX_GPIO(GPIO_FN_KEYOUT2, KEYOUT2_MARK), 1265 GPIO_FN(KEYOUT2),
1262 PINMUX_GPIO(GPIO_FN_KEYOUT3, KEYOUT3_MARK), 1266 GPIO_FN(KEYOUT3),
1263 PINMUX_GPIO(GPIO_FN_KEYOUT4_IN6, KEYOUT4_IN6_MARK), 1267 GPIO_FN(KEYOUT4_IN6),
1264 PINMUX_GPIO(GPIO_FN_KEYOUT5_IN5, KEYOUT5_IN5_MARK), 1268 GPIO_FN(KEYOUT5_IN5),
1265}; 1269};
1266 1270
1267static struct pinmux_cfg_reg pinmux_config_regs[] = { 1271static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1268 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) { 1272 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) {
1269 VIO_D7_SCIF1_SCK, PTA7_OUT, PTA7_IN_PD, PTA7_IN, 1273 VIO_D7_SCIF1_SCK, PTA7_OUT, PTA7_IN_PD, PTA7_IN,
1270 VIO_D6_SCIF1_RXD, 0, PTA6_IN_PD, PTA6_IN, 1274 VIO_D6_SCIF1_RXD, 0, PTA6_IN_PD, PTA6_IN,
@@ -1660,7 +1664,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1660 {} 1664 {}
1661}; 1665};
1662 1666
1663static struct pinmux_data_reg pinmux_data_regs[] = { 1667static const struct pinmux_data_reg pinmux_data_regs[] = {
1664 { PINMUX_DATA_REG("PADR", 0xa4050120, 8) { 1668 { PINMUX_DATA_REG("PADR", 0xa4050120, 8) {
1665 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, 1669 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
1666 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA } 1670 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA }
@@ -1756,21 +1760,19 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1756 { }, 1760 { },
1757}; 1761};
1758 1762
1759struct sh_pfc_soc_info sh7722_pinmux_info = { 1763const struct sh_pfc_soc_info sh7722_pinmux_info = {
1760 .name = "sh7722_pfc", 1764 .name = "sh7722_pfc",
1761 .reserved_id = PINMUX_RESERVED,
1762 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1763 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 1765 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1764 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END }, 1766 .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_END },
1765 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 1767 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1766 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 1768 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1767 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1768 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 1769 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1769 1770
1770 .first_gpio = GPIO_PTA7, 1771 .pins = pinmux_pins,
1771 .last_gpio = GPIO_FN_KEYOUT5_IN5, 1772 .nr_pins = ARRAY_SIZE(pinmux_pins),
1773 .func_gpios = pinmux_func_gpios,
1774 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
1772 1775
1773 .gpios = pinmux_gpios,
1774 .cfg_regs = pinmux_config_regs, 1776 .cfg_regs = pinmux_config_regs,
1775 .data_regs = pinmux_data_regs, 1777 .data_regs = pinmux_data_regs,
1776 1778
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7723.c b/drivers/pinctrl/sh-pfc/pfc-sh7723.c
index 609673d3d70e..07ad1d8d6c8b 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7723.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7723.c
@@ -350,7 +350,7 @@ enum {
350 PINMUX_MARK_END, 350 PINMUX_MARK_END,
351}; 351};
352 352
353static pinmux_enum_t pinmux_data[] = { 353static const pinmux_enum_t pinmux_data[] = {
354 /* PTA GPIO */ 354 /* PTA GPIO */
355 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT), 355 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT),
356 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT), 356 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT),
@@ -923,7 +923,7 @@ static pinmux_enum_t pinmux_data[] = {
923 PINMUX_DATA(SIUBISLD_MARK, PSD1_PSD0_FN2, PTZ0_FN), 923 PINMUX_DATA(SIUBISLD_MARK, PSD1_PSD0_FN2, PTZ0_FN),
924}; 924};
925 925
926static struct pinmux_gpio pinmux_gpios[] = { 926static struct sh_pfc_pin pinmux_pins[] = {
927 /* PTA */ 927 /* PTA */
928 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), 928 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA),
929 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), 929 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA),
@@ -1139,379 +1139,383 @@ static struct pinmux_gpio pinmux_gpios[] = {
1139 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), 1139 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA),
1140 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), 1140 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA),
1141 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), 1141 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA),
1142};
1143
1144#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1142 1145
1146static const struct pinmux_func pinmux_func_gpios[] = {
1143 /* SCIF0 */ 1147 /* SCIF0 */
1144 PINMUX_GPIO(GPIO_FN_SCIF0_PTT_TXD, SCIF0_PTT_TXD_MARK), 1148 GPIO_FN(SCIF0_PTT_TXD),
1145 PINMUX_GPIO(GPIO_FN_SCIF0_PTT_RXD, SCIF0_PTT_RXD_MARK), 1149 GPIO_FN(SCIF0_PTT_RXD),
1146 PINMUX_GPIO(GPIO_FN_SCIF0_PTT_SCK, SCIF0_PTT_SCK_MARK), 1150 GPIO_FN(SCIF0_PTT_SCK),
1147 PINMUX_GPIO(GPIO_FN_SCIF0_PTU_TXD, SCIF0_PTU_TXD_MARK), 1151 GPIO_FN(SCIF0_PTU_TXD),
1148 PINMUX_GPIO(GPIO_FN_SCIF0_PTU_RXD, SCIF0_PTU_RXD_MARK), 1152 GPIO_FN(SCIF0_PTU_RXD),
1149 PINMUX_GPIO(GPIO_FN_SCIF0_PTU_SCK, SCIF0_PTU_SCK_MARK), 1153 GPIO_FN(SCIF0_PTU_SCK),
1150 1154
1151 /* SCIF1 */ 1155 /* SCIF1 */
1152 PINMUX_GPIO(GPIO_FN_SCIF1_PTS_TXD, SCIF1_PTS_TXD_MARK), 1156 GPIO_FN(SCIF1_PTS_TXD),
1153 PINMUX_GPIO(GPIO_FN_SCIF1_PTS_RXD, SCIF1_PTS_RXD_MARK), 1157 GPIO_FN(SCIF1_PTS_RXD),
1154 PINMUX_GPIO(GPIO_FN_SCIF1_PTS_SCK, SCIF1_PTS_SCK_MARK), 1158 GPIO_FN(SCIF1_PTS_SCK),
1155 PINMUX_GPIO(GPIO_FN_SCIF1_PTV_TXD, SCIF1_PTV_TXD_MARK), 1159 GPIO_FN(SCIF1_PTV_TXD),
1156 PINMUX_GPIO(GPIO_FN_SCIF1_PTV_RXD, SCIF1_PTV_RXD_MARK), 1160 GPIO_FN(SCIF1_PTV_RXD),
1157 PINMUX_GPIO(GPIO_FN_SCIF1_PTV_SCK, SCIF1_PTV_SCK_MARK), 1161 GPIO_FN(SCIF1_PTV_SCK),
1158 1162
1159 /* SCIF2 */ 1163 /* SCIF2 */
1160 PINMUX_GPIO(GPIO_FN_SCIF2_PTT_TXD, SCIF2_PTT_TXD_MARK), 1164 GPIO_FN(SCIF2_PTT_TXD),
1161 PINMUX_GPIO(GPIO_FN_SCIF2_PTT_RXD, SCIF2_PTT_RXD_MARK), 1165 GPIO_FN(SCIF2_PTT_RXD),
1162 PINMUX_GPIO(GPIO_FN_SCIF2_PTT_SCK, SCIF2_PTT_SCK_MARK), 1166 GPIO_FN(SCIF2_PTT_SCK),
1163 PINMUX_GPIO(GPIO_FN_SCIF2_PTU_TXD, SCIF2_PTU_TXD_MARK), 1167 GPIO_FN(SCIF2_PTU_TXD),
1164 PINMUX_GPIO(GPIO_FN_SCIF2_PTU_RXD, SCIF2_PTU_RXD_MARK), 1168 GPIO_FN(SCIF2_PTU_RXD),
1165 PINMUX_GPIO(GPIO_FN_SCIF2_PTU_SCK, SCIF2_PTU_SCK_MARK), 1169 GPIO_FN(SCIF2_PTU_SCK),
1166 1170
1167 /* SCIF3 */ 1171 /* SCIF3 */
1168 PINMUX_GPIO(GPIO_FN_SCIF3_PTS_TXD, SCIF3_PTS_TXD_MARK), 1172 GPIO_FN(SCIF3_PTS_TXD),
1169 PINMUX_GPIO(GPIO_FN_SCIF3_PTS_RXD, SCIF3_PTS_RXD_MARK), 1173 GPIO_FN(SCIF3_PTS_RXD),
1170 PINMUX_GPIO(GPIO_FN_SCIF3_PTS_SCK, SCIF3_PTS_SCK_MARK), 1174 GPIO_FN(SCIF3_PTS_SCK),
1171 PINMUX_GPIO(GPIO_FN_SCIF3_PTS_RTS, SCIF3_PTS_RTS_MARK), 1175 GPIO_FN(SCIF3_PTS_RTS),
1172 PINMUX_GPIO(GPIO_FN_SCIF3_PTS_CTS, SCIF3_PTS_CTS_MARK), 1176 GPIO_FN(SCIF3_PTS_CTS),
1173 PINMUX_GPIO(GPIO_FN_SCIF3_PTV_TXD, SCIF3_PTV_TXD_MARK), 1177 GPIO_FN(SCIF3_PTV_TXD),
1174 PINMUX_GPIO(GPIO_FN_SCIF3_PTV_RXD, SCIF3_PTV_RXD_MARK), 1178 GPIO_FN(SCIF3_PTV_RXD),
1175 PINMUX_GPIO(GPIO_FN_SCIF3_PTV_SCK, SCIF3_PTV_SCK_MARK), 1179 GPIO_FN(SCIF3_PTV_SCK),
1176 PINMUX_GPIO(GPIO_FN_SCIF3_PTV_RTS, SCIF3_PTV_RTS_MARK), 1180 GPIO_FN(SCIF3_PTV_RTS),
1177 PINMUX_GPIO(GPIO_FN_SCIF3_PTV_CTS, SCIF3_PTV_CTS_MARK), 1181 GPIO_FN(SCIF3_PTV_CTS),
1178 1182
1179 /* SCIF4 */ 1183 /* SCIF4 */
1180 PINMUX_GPIO(GPIO_FN_SCIF4_PTE_TXD, SCIF4_PTE_TXD_MARK), 1184 GPIO_FN(SCIF4_PTE_TXD),
1181 PINMUX_GPIO(GPIO_FN_SCIF4_PTE_RXD, SCIF4_PTE_RXD_MARK), 1185 GPIO_FN(SCIF4_PTE_RXD),
1182 PINMUX_GPIO(GPIO_FN_SCIF4_PTE_SCK, SCIF4_PTE_SCK_MARK), 1186 GPIO_FN(SCIF4_PTE_SCK),
1183 PINMUX_GPIO(GPIO_FN_SCIF4_PTN_TXD, SCIF4_PTN_TXD_MARK), 1187 GPIO_FN(SCIF4_PTN_TXD),
1184 PINMUX_GPIO(GPIO_FN_SCIF4_PTN_RXD, SCIF4_PTN_RXD_MARK), 1188 GPIO_FN(SCIF4_PTN_RXD),
1185 PINMUX_GPIO(GPIO_FN_SCIF4_PTN_SCK, SCIF4_PTN_SCK_MARK), 1189 GPIO_FN(SCIF4_PTN_SCK),
1186 1190
1187 /* SCIF5 */ 1191 /* SCIF5 */
1188 PINMUX_GPIO(GPIO_FN_SCIF5_PTE_TXD, SCIF5_PTE_TXD_MARK), 1192 GPIO_FN(SCIF5_PTE_TXD),
1189 PINMUX_GPIO(GPIO_FN_SCIF5_PTE_RXD, SCIF5_PTE_RXD_MARK), 1193 GPIO_FN(SCIF5_PTE_RXD),
1190 PINMUX_GPIO(GPIO_FN_SCIF5_PTE_SCK, SCIF5_PTE_SCK_MARK), 1194 GPIO_FN(SCIF5_PTE_SCK),
1191 PINMUX_GPIO(GPIO_FN_SCIF5_PTN_TXD, SCIF5_PTN_TXD_MARK), 1195 GPIO_FN(SCIF5_PTN_TXD),
1192 PINMUX_GPIO(GPIO_FN_SCIF5_PTN_RXD, SCIF5_PTN_RXD_MARK), 1196 GPIO_FN(SCIF5_PTN_RXD),
1193 PINMUX_GPIO(GPIO_FN_SCIF5_PTN_SCK, SCIF5_PTN_SCK_MARK), 1197 GPIO_FN(SCIF5_PTN_SCK),
1194 1198
1195 /* CEU */ 1199 /* CEU */
1196 PINMUX_GPIO(GPIO_FN_VIO_D15, VIO_D15_MARK), 1200 GPIO_FN(VIO_D15),
1197 PINMUX_GPIO(GPIO_FN_VIO_D14, VIO_D14_MARK), 1201 GPIO_FN(VIO_D14),
1198 PINMUX_GPIO(GPIO_FN_VIO_D13, VIO_D13_MARK), 1202 GPIO_FN(VIO_D13),
1199 PINMUX_GPIO(GPIO_FN_VIO_D12, VIO_D12_MARK), 1203 GPIO_FN(VIO_D12),
1200 PINMUX_GPIO(GPIO_FN_VIO_D11, VIO_D11_MARK), 1204 GPIO_FN(VIO_D11),
1201 PINMUX_GPIO(GPIO_FN_VIO_D10, VIO_D10_MARK), 1205 GPIO_FN(VIO_D10),
1202 PINMUX_GPIO(GPIO_FN_VIO_D9, VIO_D9_MARK), 1206 GPIO_FN(VIO_D9),
1203 PINMUX_GPIO(GPIO_FN_VIO_D8, VIO_D8_MARK), 1207 GPIO_FN(VIO_D8),
1204 PINMUX_GPIO(GPIO_FN_VIO_D7, VIO_D7_MARK), 1208 GPIO_FN(VIO_D7),
1205 PINMUX_GPIO(GPIO_FN_VIO_D6, VIO_D6_MARK), 1209 GPIO_FN(VIO_D6),
1206 PINMUX_GPIO(GPIO_FN_VIO_D5, VIO_D5_MARK), 1210 GPIO_FN(VIO_D5),
1207 PINMUX_GPIO(GPIO_FN_VIO_D4, VIO_D4_MARK), 1211 GPIO_FN(VIO_D4),
1208 PINMUX_GPIO(GPIO_FN_VIO_D3, VIO_D3_MARK), 1212 GPIO_FN(VIO_D3),
1209 PINMUX_GPIO(GPIO_FN_VIO_D2, VIO_D2_MARK), 1213 GPIO_FN(VIO_D2),
1210 PINMUX_GPIO(GPIO_FN_VIO_D1, VIO_D1_MARK), 1214 GPIO_FN(VIO_D1),
1211 PINMUX_GPIO(GPIO_FN_VIO_D0, VIO_D0_MARK), 1215 GPIO_FN(VIO_D0),
1212 PINMUX_GPIO(GPIO_FN_VIO_CLK1, VIO_CLK1_MARK), 1216 GPIO_FN(VIO_CLK1),
1213 PINMUX_GPIO(GPIO_FN_VIO_VD1, VIO_VD1_MARK), 1217 GPIO_FN(VIO_VD1),
1214 PINMUX_GPIO(GPIO_FN_VIO_HD1, VIO_HD1_MARK), 1218 GPIO_FN(VIO_HD1),
1215 PINMUX_GPIO(GPIO_FN_VIO_FLD, VIO_FLD_MARK), 1219 GPIO_FN(VIO_FLD),
1216 PINMUX_GPIO(GPIO_FN_VIO_CKO, VIO_CKO_MARK), 1220 GPIO_FN(VIO_CKO),
1217 PINMUX_GPIO(GPIO_FN_VIO_VD2, VIO_VD2_MARK), 1221 GPIO_FN(VIO_VD2),
1218 PINMUX_GPIO(GPIO_FN_VIO_HD2, VIO_HD2_MARK), 1222 GPIO_FN(VIO_HD2),
1219 PINMUX_GPIO(GPIO_FN_VIO_CLK2, VIO_CLK2_MARK), 1223 GPIO_FN(VIO_CLK2),
1220 1224
1221 /* LCDC */ 1225 /* LCDC */
1222 PINMUX_GPIO(GPIO_FN_LCDD23, LCDD23_MARK), 1226 GPIO_FN(LCDD23),
1223 PINMUX_GPIO(GPIO_FN_LCDD22, LCDD22_MARK), 1227 GPIO_FN(LCDD22),
1224 PINMUX_GPIO(GPIO_FN_LCDD21, LCDD21_MARK), 1228 GPIO_FN(LCDD21),
1225 PINMUX_GPIO(GPIO_FN_LCDD20, LCDD20_MARK), 1229 GPIO_FN(LCDD20),
1226 PINMUX_GPIO(GPIO_FN_LCDD19, LCDD19_MARK), 1230 GPIO_FN(LCDD19),
1227 PINMUX_GPIO(GPIO_FN_LCDD18, LCDD18_MARK), 1231 GPIO_FN(LCDD18),
1228 PINMUX_GPIO(GPIO_FN_LCDD17, LCDD17_MARK), 1232 GPIO_FN(LCDD17),
1229 PINMUX_GPIO(GPIO_FN_LCDD16, LCDD16_MARK), 1233 GPIO_FN(LCDD16),
1230 PINMUX_GPIO(GPIO_FN_LCDD15, LCDD15_MARK), 1234 GPIO_FN(LCDD15),
1231 PINMUX_GPIO(GPIO_FN_LCDD14, LCDD14_MARK), 1235 GPIO_FN(LCDD14),
1232 PINMUX_GPIO(GPIO_FN_LCDD13, LCDD13_MARK), 1236 GPIO_FN(LCDD13),
1233 PINMUX_GPIO(GPIO_FN_LCDD12, LCDD12_MARK), 1237 GPIO_FN(LCDD12),
1234 PINMUX_GPIO(GPIO_FN_LCDD11, LCDD11_MARK), 1238 GPIO_FN(LCDD11),
1235 PINMUX_GPIO(GPIO_FN_LCDD10, LCDD10_MARK), 1239 GPIO_FN(LCDD10),
1236 PINMUX_GPIO(GPIO_FN_LCDD9, LCDD9_MARK), 1240 GPIO_FN(LCDD9),
1237 PINMUX_GPIO(GPIO_FN_LCDD8, LCDD8_MARK), 1241 GPIO_FN(LCDD8),
1238 PINMUX_GPIO(GPIO_FN_LCDD7, LCDD7_MARK), 1242 GPIO_FN(LCDD7),
1239 PINMUX_GPIO(GPIO_FN_LCDD6, LCDD6_MARK), 1243 GPIO_FN(LCDD6),
1240 PINMUX_GPIO(GPIO_FN_LCDD5, LCDD5_MARK), 1244 GPIO_FN(LCDD5),
1241 PINMUX_GPIO(GPIO_FN_LCDD4, LCDD4_MARK), 1245 GPIO_FN(LCDD4),
1242 PINMUX_GPIO(GPIO_FN_LCDD3, LCDD3_MARK), 1246 GPIO_FN(LCDD3),
1243 PINMUX_GPIO(GPIO_FN_LCDD2, LCDD2_MARK), 1247 GPIO_FN(LCDD2),
1244 PINMUX_GPIO(GPIO_FN_LCDD1, LCDD1_MARK), 1248 GPIO_FN(LCDD1),
1245 PINMUX_GPIO(GPIO_FN_LCDD0, LCDD0_MARK), 1249 GPIO_FN(LCDD0),
1246 PINMUX_GPIO(GPIO_FN_LCDLCLK_PTR, LCDLCLK_PTR_MARK), 1250 GPIO_FN(LCDLCLK_PTR),
1247 PINMUX_GPIO(GPIO_FN_LCDLCLK_PTW, LCDLCLK_PTW_MARK), 1251 GPIO_FN(LCDLCLK_PTW),
1248 /* Main LCD */ 1252 /* Main LCD */
1249 PINMUX_GPIO(GPIO_FN_LCDDON, LCDDON_MARK), 1253 GPIO_FN(LCDDON),
1250 PINMUX_GPIO(GPIO_FN_LCDVCPWC, LCDVCPWC_MARK), 1254 GPIO_FN(LCDVCPWC),
1251 PINMUX_GPIO(GPIO_FN_LCDVEPWC, LCDVEPWC_MARK), 1255 GPIO_FN(LCDVEPWC),
1252 PINMUX_GPIO(GPIO_FN_LCDVSYN, LCDVSYN_MARK), 1256 GPIO_FN(LCDVSYN),
1253 /* Main LCD - RGB Mode */ 1257 /* Main LCD - RGB Mode */
1254 PINMUX_GPIO(GPIO_FN_LCDDCK, LCDDCK_MARK), 1258 GPIO_FN(LCDDCK),
1255 PINMUX_GPIO(GPIO_FN_LCDHSYN, LCDHSYN_MARK), 1259 GPIO_FN(LCDHSYN),
1256 PINMUX_GPIO(GPIO_FN_LCDDISP, LCDDISP_MARK), 1260 GPIO_FN(LCDDISP),
1257 /* Main LCD - SYS Mode */ 1261 /* Main LCD - SYS Mode */
1258 PINMUX_GPIO(GPIO_FN_LCDRS, LCDRS_MARK), 1262 GPIO_FN(LCDRS),
1259 PINMUX_GPIO(GPIO_FN_LCDCS, LCDCS_MARK), 1263 GPIO_FN(LCDCS),
1260 PINMUX_GPIO(GPIO_FN_LCDWR, LCDWR_MARK), 1264 GPIO_FN(LCDWR),
1261 PINMUX_GPIO(GPIO_FN_LCDRD, LCDRD_MARK), 1265 GPIO_FN(LCDRD),
1262 1266
1263 /* IRQ */ 1267 /* IRQ */
1264 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK), 1268 GPIO_FN(IRQ0),
1265 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK), 1269 GPIO_FN(IRQ1),
1266 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK), 1270 GPIO_FN(IRQ2),
1267 PINMUX_GPIO(GPIO_FN_IRQ3, IRQ3_MARK), 1271 GPIO_FN(IRQ3),
1268 PINMUX_GPIO(GPIO_FN_IRQ4, IRQ4_MARK), 1272 GPIO_FN(IRQ4),
1269 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK), 1273 GPIO_FN(IRQ5),
1270 PINMUX_GPIO(GPIO_FN_IRQ6, IRQ6_MARK), 1274 GPIO_FN(IRQ6),
1271 PINMUX_GPIO(GPIO_FN_IRQ7, IRQ7_MARK), 1275 GPIO_FN(IRQ7),
1272 1276
1273 /* AUD */ 1277 /* AUD */
1274 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK), 1278 GPIO_FN(AUDCK),
1275 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK), 1279 GPIO_FN(AUDSYNC),
1276 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK), 1280 GPIO_FN(AUDATA3),
1277 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK), 1281 GPIO_FN(AUDATA2),
1278 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK), 1282 GPIO_FN(AUDATA1),
1279 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK), 1283 GPIO_FN(AUDATA0),
1280 1284
1281 /* SDHI0 (PTD) */ 1285 /* SDHI0 (PTD) */
1282 PINMUX_GPIO(GPIO_FN_SDHI0CD_PTD, SDHI0CD_PTD_MARK), 1286 GPIO_FN(SDHI0CD_PTD),
1283 PINMUX_GPIO(GPIO_FN_SDHI0WP_PTD, SDHI0WP_PTD_MARK), 1287 GPIO_FN(SDHI0WP_PTD),
1284 PINMUX_GPIO(GPIO_FN_SDHI0D3_PTD, SDHI0D3_PTD_MARK), 1288 GPIO_FN(SDHI0D3_PTD),
1285 PINMUX_GPIO(GPIO_FN_SDHI0D2_PTD, SDHI0D2_PTD_MARK), 1289 GPIO_FN(SDHI0D2_PTD),
1286 PINMUX_GPIO(GPIO_FN_SDHI0D1_PTD, SDHI0D1_PTD_MARK), 1290 GPIO_FN(SDHI0D1_PTD),
1287 PINMUX_GPIO(GPIO_FN_SDHI0D0_PTD, SDHI0D0_PTD_MARK), 1291 GPIO_FN(SDHI0D0_PTD),
1288 PINMUX_GPIO(GPIO_FN_SDHI0CMD_PTD, SDHI0CMD_PTD_MARK), 1292 GPIO_FN(SDHI0CMD_PTD),
1289 PINMUX_GPIO(GPIO_FN_SDHI0CLK_PTD, SDHI0CLK_PTD_MARK), 1293 GPIO_FN(SDHI0CLK_PTD),
1290 1294
1291 /* SDHI0 (PTS) */ 1295 /* SDHI0 (PTS) */
1292 PINMUX_GPIO(GPIO_FN_SDHI0CD_PTS, SDHI0CD_PTS_MARK), 1296 GPIO_FN(SDHI0CD_PTS),
1293 PINMUX_GPIO(GPIO_FN_SDHI0WP_PTS, SDHI0WP_PTS_MARK), 1297 GPIO_FN(SDHI0WP_PTS),
1294 PINMUX_GPIO(GPIO_FN_SDHI0D3_PTS, SDHI0D3_PTS_MARK), 1298 GPIO_FN(SDHI0D3_PTS),
1295 PINMUX_GPIO(GPIO_FN_SDHI0D2_PTS, SDHI0D2_PTS_MARK), 1299 GPIO_FN(SDHI0D2_PTS),
1296 PINMUX_GPIO(GPIO_FN_SDHI0D1_PTS, SDHI0D1_PTS_MARK), 1300 GPIO_FN(SDHI0D1_PTS),
1297 PINMUX_GPIO(GPIO_FN_SDHI0D0_PTS, SDHI0D0_PTS_MARK), 1301 GPIO_FN(SDHI0D0_PTS),
1298 PINMUX_GPIO(GPIO_FN_SDHI0CMD_PTS, SDHI0CMD_PTS_MARK), 1302 GPIO_FN(SDHI0CMD_PTS),
1299 PINMUX_GPIO(GPIO_FN_SDHI0CLK_PTS, SDHI0CLK_PTS_MARK), 1303 GPIO_FN(SDHI0CLK_PTS),
1300 1304
1301 /* SDHI1 */ 1305 /* SDHI1 */
1302 PINMUX_GPIO(GPIO_FN_SDHI1CD, SDHI1CD_MARK), 1306 GPIO_FN(SDHI1CD),
1303 PINMUX_GPIO(GPIO_FN_SDHI1WP, SDHI1WP_MARK), 1307 GPIO_FN(SDHI1WP),
1304 PINMUX_GPIO(GPIO_FN_SDHI1D3, SDHI1D3_MARK), 1308 GPIO_FN(SDHI1D3),
1305 PINMUX_GPIO(GPIO_FN_SDHI1D2, SDHI1D2_MARK), 1309 GPIO_FN(SDHI1D2),
1306 PINMUX_GPIO(GPIO_FN_SDHI1D1, SDHI1D1_MARK), 1310 GPIO_FN(SDHI1D1),
1307 PINMUX_GPIO(GPIO_FN_SDHI1D0, SDHI1D0_MARK), 1311 GPIO_FN(SDHI1D0),
1308 PINMUX_GPIO(GPIO_FN_SDHI1CMD, SDHI1CMD_MARK), 1312 GPIO_FN(SDHI1CMD),
1309 PINMUX_GPIO(GPIO_FN_SDHI1CLK, SDHI1CLK_MARK), 1313 GPIO_FN(SDHI1CLK),
1310 1314
1311 /* SIUA */ 1315 /* SIUA */
1312 PINMUX_GPIO(GPIO_FN_SIUAFCK, SIUAFCK_MARK), 1316 GPIO_FN(SIUAFCK),
1313 PINMUX_GPIO(GPIO_FN_SIUAILR, SIUAILR_MARK), 1317 GPIO_FN(SIUAILR),
1314 PINMUX_GPIO(GPIO_FN_SIUAIBT, SIUAIBT_MARK), 1318 GPIO_FN(SIUAIBT),
1315 PINMUX_GPIO(GPIO_FN_SIUAISLD, SIUAISLD_MARK), 1319 GPIO_FN(SIUAISLD),
1316 PINMUX_GPIO(GPIO_FN_SIUAOLR, SIUAOLR_MARK), 1320 GPIO_FN(SIUAOLR),
1317 PINMUX_GPIO(GPIO_FN_SIUAOBT, SIUAOBT_MARK), 1321 GPIO_FN(SIUAOBT),
1318 PINMUX_GPIO(GPIO_FN_SIUAOSLD, SIUAOSLD_MARK), 1322 GPIO_FN(SIUAOSLD),
1319 PINMUX_GPIO(GPIO_FN_SIUAMCK, SIUAMCK_MARK), 1323 GPIO_FN(SIUAMCK),
1320 PINMUX_GPIO(GPIO_FN_SIUAISPD, SIUAISPD_MARK), 1324 GPIO_FN(SIUAISPD),
1321 PINMUX_GPIO(GPIO_FN_SIUAOSPD, SIUAOSPD_MARK), 1325 GPIO_FN(SIUAOSPD),
1322 1326
1323 /* SIUB */ 1327 /* SIUB */
1324 PINMUX_GPIO(GPIO_FN_SIUBFCK, SIUBFCK_MARK), 1328 GPIO_FN(SIUBFCK),
1325 PINMUX_GPIO(GPIO_FN_SIUBILR, SIUBILR_MARK), 1329 GPIO_FN(SIUBILR),
1326 PINMUX_GPIO(GPIO_FN_SIUBIBT, SIUBIBT_MARK), 1330 GPIO_FN(SIUBIBT),
1327 PINMUX_GPIO(GPIO_FN_SIUBISLD, SIUBISLD_MARK), 1331 GPIO_FN(SIUBISLD),
1328 PINMUX_GPIO(GPIO_FN_SIUBOLR, SIUBOLR_MARK), 1332 GPIO_FN(SIUBOLR),
1329 PINMUX_GPIO(GPIO_FN_SIUBOBT, SIUBOBT_MARK), 1333 GPIO_FN(SIUBOBT),
1330 PINMUX_GPIO(GPIO_FN_SIUBOSLD, SIUBOSLD_MARK), 1334 GPIO_FN(SIUBOSLD),
1331 PINMUX_GPIO(GPIO_FN_SIUBMCK, SIUBMCK_MARK), 1335 GPIO_FN(SIUBMCK),
1332 1336
1333 /* IRDA */ 1337 /* IRDA */
1334 PINMUX_GPIO(GPIO_FN_IRDA_IN, IRDA_IN_MARK), 1338 GPIO_FN(IRDA_IN),
1335 PINMUX_GPIO(GPIO_FN_IRDA_OUT, IRDA_OUT_MARK), 1339 GPIO_FN(IRDA_OUT),
1336 1340
1337 /* VOU */ 1341 /* VOU */
1338 PINMUX_GPIO(GPIO_FN_DV_CLKI, DV_CLKI_MARK), 1342 GPIO_FN(DV_CLKI),
1339 PINMUX_GPIO(GPIO_FN_DV_CLK, DV_CLK_MARK), 1343 GPIO_FN(DV_CLK),
1340 PINMUX_GPIO(GPIO_FN_DV_HSYNC, DV_HSYNC_MARK), 1344 GPIO_FN(DV_HSYNC),
1341 PINMUX_GPIO(GPIO_FN_DV_VSYNC, DV_VSYNC_MARK), 1345 GPIO_FN(DV_VSYNC),
1342 PINMUX_GPIO(GPIO_FN_DV_D15, DV_D15_MARK), 1346 GPIO_FN(DV_D15),
1343 PINMUX_GPIO(GPIO_FN_DV_D14, DV_D14_MARK), 1347 GPIO_FN(DV_D14),
1344 PINMUX_GPIO(GPIO_FN_DV_D13, DV_D13_MARK), 1348 GPIO_FN(DV_D13),
1345 PINMUX_GPIO(GPIO_FN_DV_D12, DV_D12_MARK), 1349 GPIO_FN(DV_D12),
1346 PINMUX_GPIO(GPIO_FN_DV_D11, DV_D11_MARK), 1350 GPIO_FN(DV_D11),
1347 PINMUX_GPIO(GPIO_FN_DV_D10, DV_D10_MARK), 1351 GPIO_FN(DV_D10),
1348 PINMUX_GPIO(GPIO_FN_DV_D9, DV_D9_MARK), 1352 GPIO_FN(DV_D9),
1349 PINMUX_GPIO(GPIO_FN_DV_D8, DV_D8_MARK), 1353 GPIO_FN(DV_D8),
1350 PINMUX_GPIO(GPIO_FN_DV_D7, DV_D7_MARK), 1354 GPIO_FN(DV_D7),
1351 PINMUX_GPIO(GPIO_FN_DV_D6, DV_D6_MARK), 1355 GPIO_FN(DV_D6),
1352 PINMUX_GPIO(GPIO_FN_DV_D5, DV_D5_MARK), 1356 GPIO_FN(DV_D5),
1353 PINMUX_GPIO(GPIO_FN_DV_D4, DV_D4_MARK), 1357 GPIO_FN(DV_D4),
1354 PINMUX_GPIO(GPIO_FN_DV_D3, DV_D3_MARK), 1358 GPIO_FN(DV_D3),
1355 PINMUX_GPIO(GPIO_FN_DV_D2, DV_D2_MARK), 1359 GPIO_FN(DV_D2),
1356 PINMUX_GPIO(GPIO_FN_DV_D1, DV_D1_MARK), 1360 GPIO_FN(DV_D1),
1357 PINMUX_GPIO(GPIO_FN_DV_D0, DV_D0_MARK), 1361 GPIO_FN(DV_D0),
1358 1362
1359 /* KEYSC */ 1363 /* KEYSC */
1360 PINMUX_GPIO(GPIO_FN_KEYIN0, KEYIN0_MARK), 1364 GPIO_FN(KEYIN0),
1361 PINMUX_GPIO(GPIO_FN_KEYIN1, KEYIN1_MARK), 1365 GPIO_FN(KEYIN1),
1362 PINMUX_GPIO(GPIO_FN_KEYIN2, KEYIN2_MARK), 1366 GPIO_FN(KEYIN2),
1363 PINMUX_GPIO(GPIO_FN_KEYIN3, KEYIN3_MARK), 1367 GPIO_FN(KEYIN3),
1364 PINMUX_GPIO(GPIO_FN_KEYIN4, KEYIN4_MARK), 1368 GPIO_FN(KEYIN4),
1365 PINMUX_GPIO(GPIO_FN_KEYOUT0, KEYOUT0_MARK), 1369 GPIO_FN(KEYOUT0),
1366 PINMUX_GPIO(GPIO_FN_KEYOUT1, KEYOUT1_MARK), 1370 GPIO_FN(KEYOUT1),
1367 PINMUX_GPIO(GPIO_FN_KEYOUT2, KEYOUT2_MARK), 1371 GPIO_FN(KEYOUT2),
1368 PINMUX_GPIO(GPIO_FN_KEYOUT3, KEYOUT3_MARK), 1372 GPIO_FN(KEYOUT3),
1369 PINMUX_GPIO(GPIO_FN_KEYOUT4_IN6, KEYOUT4_IN6_MARK), 1373 GPIO_FN(KEYOUT4_IN6),
1370 PINMUX_GPIO(GPIO_FN_KEYOUT5_IN5, KEYOUT5_IN5_MARK), 1374 GPIO_FN(KEYOUT5_IN5),
1371 1375
1372 /* MSIOF0 (PTF) */ 1376 /* MSIOF0 (PTF) */
1373 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_TXD, MSIOF0_PTF_TXD_MARK), 1377 GPIO_FN(MSIOF0_PTF_TXD),
1374 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_RXD, MSIOF0_PTF_RXD_MARK), 1378 GPIO_FN(MSIOF0_PTF_RXD),
1375 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_MCK, MSIOF0_PTF_MCK_MARK), 1379 GPIO_FN(MSIOF0_PTF_MCK),
1376 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_TSYNC, MSIOF0_PTF_TSYNC_MARK), 1380 GPIO_FN(MSIOF0_PTF_TSYNC),
1377 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_TSCK, MSIOF0_PTF_TSCK_MARK), 1381 GPIO_FN(MSIOF0_PTF_TSCK),
1378 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_RSYNC, MSIOF0_PTF_RSYNC_MARK), 1382 GPIO_FN(MSIOF0_PTF_RSYNC),
1379 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_RSCK, MSIOF0_PTF_RSCK_MARK), 1383 GPIO_FN(MSIOF0_PTF_RSCK),
1380 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_SS1, MSIOF0_PTF_SS1_MARK), 1384 GPIO_FN(MSIOF0_PTF_SS1),
1381 PINMUX_GPIO(GPIO_FN_MSIOF0_PTF_SS2, MSIOF0_PTF_SS2_MARK), 1385 GPIO_FN(MSIOF0_PTF_SS2),
1382 1386
1383 /* MSIOF0 (PTT+PTX) */ 1387 /* MSIOF0 (PTT+PTX) */
1384 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_TXD, MSIOF0_PTT_TXD_MARK), 1388 GPIO_FN(MSIOF0_PTT_TXD),
1385 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_RXD, MSIOF0_PTT_RXD_MARK), 1389 GPIO_FN(MSIOF0_PTT_RXD),
1386 PINMUX_GPIO(GPIO_FN_MSIOF0_PTX_MCK, MSIOF0_PTX_MCK_MARK), 1390 GPIO_FN(MSIOF0_PTX_MCK),
1387 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_TSYNC, MSIOF0_PTT_TSYNC_MARK), 1391 GPIO_FN(MSIOF0_PTT_TSYNC),
1388 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_TSCK, MSIOF0_PTT_TSCK_MARK), 1392 GPIO_FN(MSIOF0_PTT_TSCK),
1389 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_RSYNC, MSIOF0_PTT_RSYNC_MARK), 1393 GPIO_FN(MSIOF0_PTT_RSYNC),
1390 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_RSCK, MSIOF0_PTT_RSCK_MARK), 1394 GPIO_FN(MSIOF0_PTT_RSCK),
1391 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_SS1, MSIOF0_PTT_SS1_MARK), 1395 GPIO_FN(MSIOF0_PTT_SS1),
1392 PINMUX_GPIO(GPIO_FN_MSIOF0_PTT_SS2, MSIOF0_PTT_SS2_MARK), 1396 GPIO_FN(MSIOF0_PTT_SS2),
1393 1397
1394 /* MSIOF1 */ 1398 /* MSIOF1 */
1395 PINMUX_GPIO(GPIO_FN_MSIOF1_TXD, MSIOF1_TXD_MARK), 1399 GPIO_FN(MSIOF1_TXD),
1396 PINMUX_GPIO(GPIO_FN_MSIOF1_RXD, MSIOF1_RXD_MARK), 1400 GPIO_FN(MSIOF1_RXD),
1397 PINMUX_GPIO(GPIO_FN_MSIOF1_MCK, MSIOF1_MCK_MARK), 1401 GPIO_FN(MSIOF1_MCK),
1398 PINMUX_GPIO(GPIO_FN_MSIOF1_TSYNC, MSIOF1_TSYNC_MARK), 1402 GPIO_FN(MSIOF1_TSYNC),
1399 PINMUX_GPIO(GPIO_FN_MSIOF1_TSCK, MSIOF1_TSCK_MARK), 1403 GPIO_FN(MSIOF1_TSCK),
1400 PINMUX_GPIO(GPIO_FN_MSIOF1_RSYNC, MSIOF1_RSYNC_MARK), 1404 GPIO_FN(MSIOF1_RSYNC),
1401 PINMUX_GPIO(GPIO_FN_MSIOF1_RSCK, MSIOF1_RSCK_MARK), 1405 GPIO_FN(MSIOF1_RSCK),
1402 PINMUX_GPIO(GPIO_FN_MSIOF1_SS1, MSIOF1_SS1_MARK), 1406 GPIO_FN(MSIOF1_SS1),
1403 PINMUX_GPIO(GPIO_FN_MSIOF1_SS2, MSIOF1_SS2_MARK), 1407 GPIO_FN(MSIOF1_SS2),
1404 1408
1405 /* TSIF */ 1409 /* TSIF */
1406 PINMUX_GPIO(GPIO_FN_TS0_SDAT, TS0_SDAT_MARK), 1410 GPIO_FN(TS0_SDAT),
1407 PINMUX_GPIO(GPIO_FN_TS0_SCK, TS0_SCK_MARK), 1411 GPIO_FN(TS0_SCK),
1408 PINMUX_GPIO(GPIO_FN_TS0_SDEN, TS0_SDEN_MARK), 1412 GPIO_FN(TS0_SDEN),
1409 PINMUX_GPIO(GPIO_FN_TS0_SPSYNC, TS0_SPSYNC_MARK), 1413 GPIO_FN(TS0_SPSYNC),
1410 1414
1411 /* FLCTL */ 1415 /* FLCTL */
1412 PINMUX_GPIO(GPIO_FN_FCE, FCE_MARK), 1416 GPIO_FN(FCE),
1413 PINMUX_GPIO(GPIO_FN_NAF7, NAF7_MARK), 1417 GPIO_FN(NAF7),
1414 PINMUX_GPIO(GPIO_FN_NAF6, NAF6_MARK), 1418 GPIO_FN(NAF6),
1415 PINMUX_GPIO(GPIO_FN_NAF5, NAF5_MARK), 1419 GPIO_FN(NAF5),
1416 PINMUX_GPIO(GPIO_FN_NAF4, NAF4_MARK), 1420 GPIO_FN(NAF4),
1417 PINMUX_GPIO(GPIO_FN_NAF3, NAF3_MARK), 1421 GPIO_FN(NAF3),
1418 PINMUX_GPIO(GPIO_FN_NAF2, NAF2_MARK), 1422 GPIO_FN(NAF2),
1419 PINMUX_GPIO(GPIO_FN_NAF1, NAF1_MARK), 1423 GPIO_FN(NAF1),
1420 PINMUX_GPIO(GPIO_FN_NAF0, NAF0_MARK), 1424 GPIO_FN(NAF0),
1421 PINMUX_GPIO(GPIO_FN_FCDE, FCDE_MARK), 1425 GPIO_FN(FCDE),
1422 PINMUX_GPIO(GPIO_FN_FOE, FOE_MARK), 1426 GPIO_FN(FOE),
1423 PINMUX_GPIO(GPIO_FN_FSC, FSC_MARK), 1427 GPIO_FN(FSC),
1424 PINMUX_GPIO(GPIO_FN_FWE, FWE_MARK), 1428 GPIO_FN(FWE),
1425 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 1429 GPIO_FN(FRB),
1426 1430
1427 /* DMAC */ 1431 /* DMAC */
1428 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 1432 GPIO_FN(DACK1),
1429 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 1433 GPIO_FN(DREQ1),
1430 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 1434 GPIO_FN(DACK0),
1431 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 1435 GPIO_FN(DREQ0),
1432 1436
1433 /* ADC */ 1437 /* ADC */
1434 PINMUX_GPIO(GPIO_FN_AN3, AN3_MARK), 1438 GPIO_FN(AN3),
1435 PINMUX_GPIO(GPIO_FN_AN2, AN2_MARK), 1439 GPIO_FN(AN2),
1436 PINMUX_GPIO(GPIO_FN_AN1, AN1_MARK), 1440 GPIO_FN(AN1),
1437 PINMUX_GPIO(GPIO_FN_AN0, AN0_MARK), 1441 GPIO_FN(AN0),
1438 PINMUX_GPIO(GPIO_FN_ADTRG, ADTRG_MARK), 1442 GPIO_FN(ADTRG),
1439 1443
1440 /* CPG */ 1444 /* CPG */
1441 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 1445 GPIO_FN(STATUS0),
1442 PINMUX_GPIO(GPIO_FN_PDSTATUS, PDSTATUS_MARK), 1446 GPIO_FN(PDSTATUS),
1443 1447
1444 /* TPU */ 1448 /* TPU */
1445 PINMUX_GPIO(GPIO_FN_TPUTO0, TPUTO0_MARK), 1449 GPIO_FN(TPUTO0),
1446 PINMUX_GPIO(GPIO_FN_TPUTO1, TPUTO1_MARK), 1450 GPIO_FN(TPUTO1),
1447 PINMUX_GPIO(GPIO_FN_TPUTO2, TPUTO2_MARK), 1451 GPIO_FN(TPUTO2),
1448 PINMUX_GPIO(GPIO_FN_TPUTO3, TPUTO3_MARK), 1452 GPIO_FN(TPUTO3),
1449 1453
1450 /* BSC */ 1454 /* BSC */
1451 PINMUX_GPIO(GPIO_FN_D31, D31_MARK), 1455 GPIO_FN(D31),
1452 PINMUX_GPIO(GPIO_FN_D30, D30_MARK), 1456 GPIO_FN(D30),
1453 PINMUX_GPIO(GPIO_FN_D29, D29_MARK), 1457 GPIO_FN(D29),
1454 PINMUX_GPIO(GPIO_FN_D28, D28_MARK), 1458 GPIO_FN(D28),
1455 PINMUX_GPIO(GPIO_FN_D27, D27_MARK), 1459 GPIO_FN(D27),
1456 PINMUX_GPIO(GPIO_FN_D26, D26_MARK), 1460 GPIO_FN(D26),
1457 PINMUX_GPIO(GPIO_FN_D25, D25_MARK), 1461 GPIO_FN(D25),
1458 PINMUX_GPIO(GPIO_FN_D24, D24_MARK), 1462 GPIO_FN(D24),
1459 PINMUX_GPIO(GPIO_FN_D23, D23_MARK), 1463 GPIO_FN(D23),
1460 PINMUX_GPIO(GPIO_FN_D22, D22_MARK), 1464 GPIO_FN(D22),
1461 PINMUX_GPIO(GPIO_FN_D21, D21_MARK), 1465 GPIO_FN(D21),
1462 PINMUX_GPIO(GPIO_FN_D20, D20_MARK), 1466 GPIO_FN(D20),
1463 PINMUX_GPIO(GPIO_FN_D19, D19_MARK), 1467 GPIO_FN(D19),
1464 PINMUX_GPIO(GPIO_FN_D18, D18_MARK), 1468 GPIO_FN(D18),
1465 PINMUX_GPIO(GPIO_FN_D17, D17_MARK), 1469 GPIO_FN(D17),
1466 PINMUX_GPIO(GPIO_FN_D16, D16_MARK), 1470 GPIO_FN(D16),
1467 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 1471 GPIO_FN(IOIS16),
1468 PINMUX_GPIO(GPIO_FN_WAIT, WAIT_MARK), 1472 GPIO_FN(WAIT),
1469 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1473 GPIO_FN(BS),
1470 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 1474 GPIO_FN(A25),
1471 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 1475 GPIO_FN(A24),
1472 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1476 GPIO_FN(A23),
1473 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1477 GPIO_FN(A22),
1474 PINMUX_GPIO(GPIO_FN_CS6B_CE1B, CS6B_CE1B_MARK), 1478 GPIO_FN(CS6B_CE1B),
1475 PINMUX_GPIO(GPIO_FN_CS6A_CE2B, CS6A_CE2B_MARK), 1479 GPIO_FN(CS6A_CE2B),
1476 PINMUX_GPIO(GPIO_FN_CS5B_CE1A, CS5B_CE1A_MARK), 1480 GPIO_FN(CS5B_CE1A),
1477 PINMUX_GPIO(GPIO_FN_CS5A_CE2A, CS5A_CE2A_MARK), 1481 GPIO_FN(CS5A_CE2A),
1478 PINMUX_GPIO(GPIO_FN_WE3_ICIOWR, WE3_ICIOWR_MARK), 1482 GPIO_FN(WE3_ICIOWR),
1479 PINMUX_GPIO(GPIO_FN_WE2_ICIORD, WE2_ICIORD_MARK), 1483 GPIO_FN(WE2_ICIORD),
1480 1484
1481 /* ATAPI */ 1485 /* ATAPI */
1482 PINMUX_GPIO(GPIO_FN_IDED15, IDED15_MARK), 1486 GPIO_FN(IDED15),
1483 PINMUX_GPIO(GPIO_FN_IDED14, IDED14_MARK), 1487 GPIO_FN(IDED14),
1484 PINMUX_GPIO(GPIO_FN_IDED13, IDED13_MARK), 1488 GPIO_FN(IDED13),
1485 PINMUX_GPIO(GPIO_FN_IDED12, IDED12_MARK), 1489 GPIO_FN(IDED12),
1486 PINMUX_GPIO(GPIO_FN_IDED11, IDED11_MARK), 1490 GPIO_FN(IDED11),
1487 PINMUX_GPIO(GPIO_FN_IDED10, IDED10_MARK), 1491 GPIO_FN(IDED10),
1488 PINMUX_GPIO(GPIO_FN_IDED9, IDED9_MARK), 1492 GPIO_FN(IDED9),
1489 PINMUX_GPIO(GPIO_FN_IDED8, IDED8_MARK), 1493 GPIO_FN(IDED8),
1490 PINMUX_GPIO(GPIO_FN_IDED7, IDED7_MARK), 1494 GPIO_FN(IDED7),
1491 PINMUX_GPIO(GPIO_FN_IDED6, IDED6_MARK), 1495 GPIO_FN(IDED6),
1492 PINMUX_GPIO(GPIO_FN_IDED5, IDED5_MARK), 1496 GPIO_FN(IDED5),
1493 PINMUX_GPIO(GPIO_FN_IDED4, IDED4_MARK), 1497 GPIO_FN(IDED4),
1494 PINMUX_GPIO(GPIO_FN_IDED3, IDED3_MARK), 1498 GPIO_FN(IDED3),
1495 PINMUX_GPIO(GPIO_FN_IDED2, IDED2_MARK), 1499 GPIO_FN(IDED2),
1496 PINMUX_GPIO(GPIO_FN_IDED1, IDED1_MARK), 1500 GPIO_FN(IDED1),
1497 PINMUX_GPIO(GPIO_FN_IDED0, IDED0_MARK), 1501 GPIO_FN(IDED0),
1498 PINMUX_GPIO(GPIO_FN_DIRECTION, DIRECTION_MARK), 1502 GPIO_FN(DIRECTION),
1499 PINMUX_GPIO(GPIO_FN_EXBUF_ENB, EXBUF_ENB_MARK), 1503 GPIO_FN(EXBUF_ENB),
1500 PINMUX_GPIO(GPIO_FN_IDERST, IDERST_MARK), 1504 GPIO_FN(IDERST),
1501 PINMUX_GPIO(GPIO_FN_IODACK, IODACK_MARK), 1505 GPIO_FN(IODACK),
1502 PINMUX_GPIO(GPIO_FN_IODREQ, IODREQ_MARK), 1506 GPIO_FN(IODREQ),
1503 PINMUX_GPIO(GPIO_FN_IDEIORDY, IDEIORDY_MARK), 1507 GPIO_FN(IDEIORDY),
1504 PINMUX_GPIO(GPIO_FN_IDEINT, IDEINT_MARK), 1508 GPIO_FN(IDEINT),
1505 PINMUX_GPIO(GPIO_FN_IDEIOWR, IDEIOWR_MARK), 1509 GPIO_FN(IDEIOWR),
1506 PINMUX_GPIO(GPIO_FN_IDEIORD, IDEIORD_MARK), 1510 GPIO_FN(IDEIORD),
1507 PINMUX_GPIO(GPIO_FN_IDECS1, IDECS1_MARK), 1511 GPIO_FN(IDECS1),
1508 PINMUX_GPIO(GPIO_FN_IDECS0, IDECS0_MARK), 1512 GPIO_FN(IDECS0),
1509 PINMUX_GPIO(GPIO_FN_IDEA2, IDEA2_MARK), 1513 GPIO_FN(IDEA2),
1510 PINMUX_GPIO(GPIO_FN_IDEA1, IDEA1_MARK), 1514 GPIO_FN(IDEA1),
1511 PINMUX_GPIO(GPIO_FN_IDEA0, IDEA0_MARK), 1515 GPIO_FN(IDEA0),
1512}; 1516};
1513 1517
1514static struct pinmux_cfg_reg pinmux_config_regs[] = { 1518static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1515 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) { 1519 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) {
1516 PTA7_FN, PTA7_OUT, 0, PTA7_IN, 1520 PTA7_FN, PTA7_OUT, 0, PTA7_IN,
1517 PTA6_FN, PTA6_OUT, 0, PTA6_IN, 1521 PTA6_FN, PTA6_OUT, 0, PTA6_IN,
@@ -1785,7 +1789,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1785 {} 1789 {}
1786}; 1790};
1787 1791
1788static struct pinmux_data_reg pinmux_data_regs[] = { 1792static const struct pinmux_data_reg pinmux_data_regs[] = {
1789 { PINMUX_DATA_REG("PADR", 0xa4050120, 8) { 1793 { PINMUX_DATA_REG("PADR", 0xa4050120, 8) {
1790 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, 1794 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
1791 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA } 1795 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA }
@@ -1881,20 +1885,18 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1881 { }, 1885 { },
1882}; 1886};
1883 1887
1884struct sh_pfc_soc_info sh7723_pinmux_info = { 1888const struct sh_pfc_soc_info sh7723_pinmux_info = {
1885 .name = "sh7723_pfc", 1889 .name = "sh7723_pfc",
1886 .reserved_id = PINMUX_RESERVED,
1887 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1888 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 1890 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1889 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 1891 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1890 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 1892 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1891 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1892 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 1893 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1893 1894
1894 .first_gpio = GPIO_PTA7, 1895 .pins = pinmux_pins,
1895 .last_gpio = GPIO_FN_IDEA0, 1896 .nr_pins = ARRAY_SIZE(pinmux_pins),
1897 .func_gpios = pinmux_func_gpios,
1898 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
1896 1899
1897 .gpios = pinmux_gpios,
1898 .cfg_regs = pinmux_config_regs, 1900 .cfg_regs = pinmux_config_regs,
1899 .data_regs = pinmux_data_regs, 1901 .data_regs = pinmux_data_regs,
1900 1902
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7724.c b/drivers/pinctrl/sh-pfc/pfc-sh7724.c
index 233fbf750b39..35e551609805 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7724.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7724.c
@@ -572,7 +572,7 @@ enum {
572 PINMUX_MARK_END, 572 PINMUX_MARK_END,
573}; 573};
574 574
575static pinmux_enum_t pinmux_data[] = { 575static const pinmux_enum_t pinmux_data[] = {
576 /* PTA GPIO */ 576 /* PTA GPIO */
577 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT, PTA7_IN_PU), 577 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT, PTA7_IN_PU),
578 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT, PTA6_IN_PU), 578 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT, PTA6_IN_PU),
@@ -1192,7 +1192,7 @@ static pinmux_enum_t pinmux_data[] = {
1192 PINMUX_DATA(SCIF3_I_TXD_MARK, PSB14_1, PTZ3_FN), 1192 PINMUX_DATA(SCIF3_I_TXD_MARK, PSB14_1, PTZ3_FN),
1193}; 1193};
1194 1194
1195static struct pinmux_gpio pinmux_gpios[] = { 1195static struct sh_pfc_pin pinmux_pins[] = {
1196 /* PTA */ 1196 /* PTA */
1197 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), 1197 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA),
1198 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), 1198 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA),
@@ -1418,372 +1418,376 @@ static struct pinmux_gpio pinmux_gpios[] = {
1418 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), 1418 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA),
1419 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), 1419 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA),
1420 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), 1420 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA),
1421};
1422
1423#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1421 1424
1425static const struct pinmux_func pinmux_func_gpios[] = {
1422 /* BSC */ 1426 /* BSC */
1423 PINMUX_GPIO(GPIO_FN_D31, D31_MARK), 1427 GPIO_FN(D31),
1424 PINMUX_GPIO(GPIO_FN_D30, D30_MARK), 1428 GPIO_FN(D30),
1425 PINMUX_GPIO(GPIO_FN_D29, D29_MARK), 1429 GPIO_FN(D29),
1426 PINMUX_GPIO(GPIO_FN_D28, D28_MARK), 1430 GPIO_FN(D28),
1427 PINMUX_GPIO(GPIO_FN_D27, D27_MARK), 1431 GPIO_FN(D27),
1428 PINMUX_GPIO(GPIO_FN_D26, D26_MARK), 1432 GPIO_FN(D26),
1429 PINMUX_GPIO(GPIO_FN_D25, D25_MARK), 1433 GPIO_FN(D25),
1430 PINMUX_GPIO(GPIO_FN_D24, D24_MARK), 1434 GPIO_FN(D24),
1431 PINMUX_GPIO(GPIO_FN_D23, D23_MARK), 1435 GPIO_FN(D23),
1432 PINMUX_GPIO(GPIO_FN_D22, D22_MARK), 1436 GPIO_FN(D22),
1433 PINMUX_GPIO(GPIO_FN_D21, D21_MARK), 1437 GPIO_FN(D21),
1434 PINMUX_GPIO(GPIO_FN_D20, D20_MARK), 1438 GPIO_FN(D20),
1435 PINMUX_GPIO(GPIO_FN_D19, D19_MARK), 1439 GPIO_FN(D19),
1436 PINMUX_GPIO(GPIO_FN_D18, D18_MARK), 1440 GPIO_FN(D18),
1437 PINMUX_GPIO(GPIO_FN_D17, D17_MARK), 1441 GPIO_FN(D17),
1438 PINMUX_GPIO(GPIO_FN_D16, D16_MARK), 1442 GPIO_FN(D16),
1439 PINMUX_GPIO(GPIO_FN_D15, D15_MARK), 1443 GPIO_FN(D15),
1440 PINMUX_GPIO(GPIO_FN_D14, D14_MARK), 1444 GPIO_FN(D14),
1441 PINMUX_GPIO(GPIO_FN_D13, D13_MARK), 1445 GPIO_FN(D13),
1442 PINMUX_GPIO(GPIO_FN_D12, D12_MARK), 1446 GPIO_FN(D12),
1443 PINMUX_GPIO(GPIO_FN_D11, D11_MARK), 1447 GPIO_FN(D11),
1444 PINMUX_GPIO(GPIO_FN_D10, D10_MARK), 1448 GPIO_FN(D10),
1445 PINMUX_GPIO(GPIO_FN_D9, D9_MARK), 1449 GPIO_FN(D9),
1446 PINMUX_GPIO(GPIO_FN_D8, D8_MARK), 1450 GPIO_FN(D8),
1447 PINMUX_GPIO(GPIO_FN_D7, D7_MARK), 1451 GPIO_FN(D7),
1448 PINMUX_GPIO(GPIO_FN_D6, D6_MARK), 1452 GPIO_FN(D6),
1449 PINMUX_GPIO(GPIO_FN_D5, D5_MARK), 1453 GPIO_FN(D5),
1450 PINMUX_GPIO(GPIO_FN_D4, D4_MARK), 1454 GPIO_FN(D4),
1451 PINMUX_GPIO(GPIO_FN_D3, D3_MARK), 1455 GPIO_FN(D3),
1452 PINMUX_GPIO(GPIO_FN_D2, D2_MARK), 1456 GPIO_FN(D2),
1453 PINMUX_GPIO(GPIO_FN_D1, D1_MARK), 1457 GPIO_FN(D1),
1454 PINMUX_GPIO(GPIO_FN_D0, D0_MARK), 1458 GPIO_FN(D0),
1455 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 1459 GPIO_FN(A25),
1456 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 1460 GPIO_FN(A24),
1457 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1461 GPIO_FN(A23),
1458 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1462 GPIO_FN(A22),
1459 PINMUX_GPIO(GPIO_FN_CS6B_CE1B, CS6B_CE1B_MARK), 1463 GPIO_FN(CS6B_CE1B),
1460 PINMUX_GPIO(GPIO_FN_CS6A_CE2B, CS6A_CE2B_MARK), 1464 GPIO_FN(CS6A_CE2B),
1461 PINMUX_GPIO(GPIO_FN_CS5B_CE1A, CS5B_CE1A_MARK), 1465 GPIO_FN(CS5B_CE1A),
1462 PINMUX_GPIO(GPIO_FN_CS5A_CE2A, CS5A_CE2A_MARK), 1466 GPIO_FN(CS5A_CE2A),
1463 PINMUX_GPIO(GPIO_FN_WE3_ICIOWR, WE3_ICIOWR_MARK), 1467 GPIO_FN(WE3_ICIOWR),
1464 PINMUX_GPIO(GPIO_FN_WE2_ICIORD, WE2_ICIORD_MARK), 1468 GPIO_FN(WE2_ICIORD),
1465 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 1469 GPIO_FN(IOIS16),
1466 PINMUX_GPIO(GPIO_FN_WAIT, WAIT_MARK), 1470 GPIO_FN(WAIT),
1467 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1471 GPIO_FN(BS),
1468 1472
1469 /* KEYSC */ 1473 /* KEYSC */
1470 PINMUX_GPIO(GPIO_FN_KEYOUT5_IN5, KEYOUT5_IN5_MARK), 1474 GPIO_FN(KEYOUT5_IN5),
1471 PINMUX_GPIO(GPIO_FN_KEYOUT4_IN6, KEYOUT4_IN6_MARK), 1475 GPIO_FN(KEYOUT4_IN6),
1472 PINMUX_GPIO(GPIO_FN_KEYIN4, KEYIN4_MARK), 1476 GPIO_FN(KEYIN4),
1473 PINMUX_GPIO(GPIO_FN_KEYIN3, KEYIN3_MARK), 1477 GPIO_FN(KEYIN3),
1474 PINMUX_GPIO(GPIO_FN_KEYIN2, KEYIN2_MARK), 1478 GPIO_FN(KEYIN2),
1475 PINMUX_GPIO(GPIO_FN_KEYIN1, KEYIN1_MARK), 1479 GPIO_FN(KEYIN1),
1476 PINMUX_GPIO(GPIO_FN_KEYIN0, KEYIN0_MARK), 1480 GPIO_FN(KEYIN0),
1477 PINMUX_GPIO(GPIO_FN_KEYOUT3, KEYOUT3_MARK), 1481 GPIO_FN(KEYOUT3),
1478 PINMUX_GPIO(GPIO_FN_KEYOUT2, KEYOUT2_MARK), 1482 GPIO_FN(KEYOUT2),
1479 PINMUX_GPIO(GPIO_FN_KEYOUT1, KEYOUT1_MARK), 1483 GPIO_FN(KEYOUT1),
1480 PINMUX_GPIO(GPIO_FN_KEYOUT0, KEYOUT0_MARK), 1484 GPIO_FN(KEYOUT0),
1481 1485
1482 /* ATAPI */ 1486 /* ATAPI */
1483 PINMUX_GPIO(GPIO_FN_IDED15, IDED15_MARK), 1487 GPIO_FN(IDED15),
1484 PINMUX_GPIO(GPIO_FN_IDED14, IDED14_MARK), 1488 GPIO_FN(IDED14),
1485 PINMUX_GPIO(GPIO_FN_IDED13, IDED13_MARK), 1489 GPIO_FN(IDED13),
1486 PINMUX_GPIO(GPIO_FN_IDED12, IDED12_MARK), 1490 GPIO_FN(IDED12),
1487 PINMUX_GPIO(GPIO_FN_IDED11, IDED11_MARK), 1491 GPIO_FN(IDED11),
1488 PINMUX_GPIO(GPIO_FN_IDED10, IDED10_MARK), 1492 GPIO_FN(IDED10),
1489 PINMUX_GPIO(GPIO_FN_IDED9, IDED9_MARK), 1493 GPIO_FN(IDED9),
1490 PINMUX_GPIO(GPIO_FN_IDED8, IDED8_MARK), 1494 GPIO_FN(IDED8),
1491 PINMUX_GPIO(GPIO_FN_IDED7, IDED7_MARK), 1495 GPIO_FN(IDED7),
1492 PINMUX_GPIO(GPIO_FN_IDED6, IDED6_MARK), 1496 GPIO_FN(IDED6),
1493 PINMUX_GPIO(GPIO_FN_IDED5, IDED5_MARK), 1497 GPIO_FN(IDED5),
1494 PINMUX_GPIO(GPIO_FN_IDED4, IDED4_MARK), 1498 GPIO_FN(IDED4),
1495 PINMUX_GPIO(GPIO_FN_IDED3, IDED3_MARK), 1499 GPIO_FN(IDED3),
1496 PINMUX_GPIO(GPIO_FN_IDED2, IDED2_MARK), 1500 GPIO_FN(IDED2),
1497 PINMUX_GPIO(GPIO_FN_IDED1, IDED1_MARK), 1501 GPIO_FN(IDED1),
1498 PINMUX_GPIO(GPIO_FN_IDED0, IDED0_MARK), 1502 GPIO_FN(IDED0),
1499 PINMUX_GPIO(GPIO_FN_IDEA2, IDEA2_MARK), 1503 GPIO_FN(IDEA2),
1500 PINMUX_GPIO(GPIO_FN_IDEA1, IDEA1_MARK), 1504 GPIO_FN(IDEA1),
1501 PINMUX_GPIO(GPIO_FN_IDEA0, IDEA0_MARK), 1505 GPIO_FN(IDEA0),
1502 PINMUX_GPIO(GPIO_FN_IDEIOWR, IDEIOWR_MARK), 1506 GPIO_FN(IDEIOWR),
1503 PINMUX_GPIO(GPIO_FN_IODREQ, IODREQ_MARK), 1507 GPIO_FN(IODREQ),
1504 PINMUX_GPIO(GPIO_FN_IDECS0, IDECS0_MARK), 1508 GPIO_FN(IDECS0),
1505 PINMUX_GPIO(GPIO_FN_IDECS1, IDECS1_MARK), 1509 GPIO_FN(IDECS1),
1506 PINMUX_GPIO(GPIO_FN_IDEIORD, IDEIORD_MARK), 1510 GPIO_FN(IDEIORD),
1507 PINMUX_GPIO(GPIO_FN_DIRECTION, DIRECTION_MARK), 1511 GPIO_FN(DIRECTION),
1508 PINMUX_GPIO(GPIO_FN_EXBUF_ENB, EXBUF_ENB_MARK), 1512 GPIO_FN(EXBUF_ENB),
1509 PINMUX_GPIO(GPIO_FN_IDERST, IDERST_MARK), 1513 GPIO_FN(IDERST),
1510 PINMUX_GPIO(GPIO_FN_IODACK, IODACK_MARK), 1514 GPIO_FN(IODACK),
1511 PINMUX_GPIO(GPIO_FN_IDEINT, IDEINT_MARK), 1515 GPIO_FN(IDEINT),
1512 PINMUX_GPIO(GPIO_FN_IDEIORDY, IDEIORDY_MARK), 1516 GPIO_FN(IDEIORDY),
1513 1517
1514 /* TPU */ 1518 /* TPU */
1515 PINMUX_GPIO(GPIO_FN_TPUTO3, TPUTO3_MARK), 1519 GPIO_FN(TPUTO3),
1516 PINMUX_GPIO(GPIO_FN_TPUTO2, TPUTO2_MARK), 1520 GPIO_FN(TPUTO2),
1517 PINMUX_GPIO(GPIO_FN_TPUTO1, TPUTO1_MARK), 1521 GPIO_FN(TPUTO1),
1518 PINMUX_GPIO(GPIO_FN_TPUTO0, TPUTO0_MARK), 1522 GPIO_FN(TPUTO0),
1519 PINMUX_GPIO(GPIO_FN_TPUTI3, TPUTI3_MARK), 1523 GPIO_FN(TPUTI3),
1520 PINMUX_GPIO(GPIO_FN_TPUTI2, TPUTI2_MARK), 1524 GPIO_FN(TPUTI2),
1521 1525
1522 /* LCDC */ 1526 /* LCDC */
1523 PINMUX_GPIO(GPIO_FN_LCDD23, LCDD23_MARK), 1527 GPIO_FN(LCDD23),
1524 PINMUX_GPIO(GPIO_FN_LCDD22, LCDD22_MARK), 1528 GPIO_FN(LCDD22),
1525 PINMUX_GPIO(GPIO_FN_LCDD21, LCDD21_MARK), 1529 GPIO_FN(LCDD21),
1526 PINMUX_GPIO(GPIO_FN_LCDD20, LCDD20_MARK), 1530 GPIO_FN(LCDD20),
1527 PINMUX_GPIO(GPIO_FN_LCDD19, LCDD19_MARK), 1531 GPIO_FN(LCDD19),
1528 PINMUX_GPIO(GPIO_FN_LCDD18, LCDD18_MARK), 1532 GPIO_FN(LCDD18),
1529 PINMUX_GPIO(GPIO_FN_LCDD17, LCDD17_MARK), 1533 GPIO_FN(LCDD17),
1530 PINMUX_GPIO(GPIO_FN_LCDD16, LCDD16_MARK), 1534 GPIO_FN(LCDD16),
1531 PINMUX_GPIO(GPIO_FN_LCDD15, LCDD15_MARK), 1535 GPIO_FN(LCDD15),
1532 PINMUX_GPIO(GPIO_FN_LCDD14, LCDD14_MARK), 1536 GPIO_FN(LCDD14),
1533 PINMUX_GPIO(GPIO_FN_LCDD13, LCDD13_MARK), 1537 GPIO_FN(LCDD13),
1534 PINMUX_GPIO(GPIO_FN_LCDD12, LCDD12_MARK), 1538 GPIO_FN(LCDD12),
1535 PINMUX_GPIO(GPIO_FN_LCDD11, LCDD11_MARK), 1539 GPIO_FN(LCDD11),
1536 PINMUX_GPIO(GPIO_FN_LCDD10, LCDD10_MARK), 1540 GPIO_FN(LCDD10),
1537 PINMUX_GPIO(GPIO_FN_LCDD9, LCDD9_MARK), 1541 GPIO_FN(LCDD9),
1538 PINMUX_GPIO(GPIO_FN_LCDD8, LCDD8_MARK), 1542 GPIO_FN(LCDD8),
1539 PINMUX_GPIO(GPIO_FN_LCDD7, LCDD7_MARK), 1543 GPIO_FN(LCDD7),
1540 PINMUX_GPIO(GPIO_FN_LCDD6, LCDD6_MARK), 1544 GPIO_FN(LCDD6),
1541 PINMUX_GPIO(GPIO_FN_LCDD5, LCDD5_MARK), 1545 GPIO_FN(LCDD5),
1542 PINMUX_GPIO(GPIO_FN_LCDD4, LCDD4_MARK), 1546 GPIO_FN(LCDD4),
1543 PINMUX_GPIO(GPIO_FN_LCDD3, LCDD3_MARK), 1547 GPIO_FN(LCDD3),
1544 PINMUX_GPIO(GPIO_FN_LCDD2, LCDD2_MARK), 1548 GPIO_FN(LCDD2),
1545 PINMUX_GPIO(GPIO_FN_LCDD1, LCDD1_MARK), 1549 GPIO_FN(LCDD1),
1546 PINMUX_GPIO(GPIO_FN_LCDD0, LCDD0_MARK), 1550 GPIO_FN(LCDD0),
1547 PINMUX_GPIO(GPIO_FN_LCDVSYN, LCDVSYN_MARK), 1551 GPIO_FN(LCDVSYN),
1548 PINMUX_GPIO(GPIO_FN_LCDDISP, LCDDISP_MARK), 1552 GPIO_FN(LCDDISP),
1549 PINMUX_GPIO(GPIO_FN_LCDRS, LCDRS_MARK), 1553 GPIO_FN(LCDRS),
1550 PINMUX_GPIO(GPIO_FN_LCDHSYN, LCDHSYN_MARK), 1554 GPIO_FN(LCDHSYN),
1551 PINMUX_GPIO(GPIO_FN_LCDCS, LCDCS_MARK), 1555 GPIO_FN(LCDCS),
1552 PINMUX_GPIO(GPIO_FN_LCDDON, LCDDON_MARK), 1556 GPIO_FN(LCDDON),
1553 PINMUX_GPIO(GPIO_FN_LCDDCK, LCDDCK_MARK), 1557 GPIO_FN(LCDDCK),
1554 PINMUX_GPIO(GPIO_FN_LCDWR, LCDWR_MARK), 1558 GPIO_FN(LCDWR),
1555 PINMUX_GPIO(GPIO_FN_LCDVEPWC, LCDVEPWC_MARK), 1559 GPIO_FN(LCDVEPWC),
1556 PINMUX_GPIO(GPIO_FN_LCDVCPWC, LCDVCPWC_MARK), 1560 GPIO_FN(LCDVCPWC),
1557 PINMUX_GPIO(GPIO_FN_LCDRD, LCDRD_MARK), 1561 GPIO_FN(LCDRD),
1558 PINMUX_GPIO(GPIO_FN_LCDLCLK, LCDLCLK_MARK), 1562 GPIO_FN(LCDLCLK),
1559 1563
1560 /* SCIF0 */ 1564 /* SCIF0 */
1561 PINMUX_GPIO(GPIO_FN_SCIF0_TXD, SCIF0_TXD_MARK), 1565 GPIO_FN(SCIF0_TXD),
1562 PINMUX_GPIO(GPIO_FN_SCIF0_RXD, SCIF0_RXD_MARK), 1566 GPIO_FN(SCIF0_RXD),
1563 PINMUX_GPIO(GPIO_FN_SCIF0_SCK, SCIF0_SCK_MARK), 1567 GPIO_FN(SCIF0_SCK),
1564 1568
1565 /* SCIF1 */ 1569 /* SCIF1 */
1566 PINMUX_GPIO(GPIO_FN_SCIF1_SCK, SCIF1_SCK_MARK), 1570 GPIO_FN(SCIF1_SCK),
1567 PINMUX_GPIO(GPIO_FN_SCIF1_RXD, SCIF1_RXD_MARK), 1571 GPIO_FN(SCIF1_RXD),
1568 PINMUX_GPIO(GPIO_FN_SCIF1_TXD, SCIF1_TXD_MARK), 1572 GPIO_FN(SCIF1_TXD),
1569 1573
1570 /* SCIF2 */ 1574 /* SCIF2 */
1571 PINMUX_GPIO(GPIO_FN_SCIF2_L_TXD, SCIF2_L_TXD_MARK), 1575 GPIO_FN(SCIF2_L_TXD),
1572 PINMUX_GPIO(GPIO_FN_SCIF2_L_SCK, SCIF2_L_SCK_MARK), 1576 GPIO_FN(SCIF2_L_SCK),
1573 PINMUX_GPIO(GPIO_FN_SCIF2_L_RXD, SCIF2_L_RXD_MARK), 1577 GPIO_FN(SCIF2_L_RXD),
1574 PINMUX_GPIO(GPIO_FN_SCIF2_V_TXD, SCIF2_V_TXD_MARK), 1578 GPIO_FN(SCIF2_V_TXD),
1575 PINMUX_GPIO(GPIO_FN_SCIF2_V_SCK, SCIF2_V_SCK_MARK), 1579 GPIO_FN(SCIF2_V_SCK),
1576 PINMUX_GPIO(GPIO_FN_SCIF2_V_RXD, SCIF2_V_RXD_MARK), 1580 GPIO_FN(SCIF2_V_RXD),
1577 1581
1578 /* SCIF3 */ 1582 /* SCIF3 */
1579 PINMUX_GPIO(GPIO_FN_SCIF3_V_SCK, SCIF3_V_SCK_MARK), 1583 GPIO_FN(SCIF3_V_SCK),
1580 PINMUX_GPIO(GPIO_FN_SCIF3_V_RXD, SCIF3_V_RXD_MARK), 1584 GPIO_FN(SCIF3_V_RXD),
1581 PINMUX_GPIO(GPIO_FN_SCIF3_V_TXD, SCIF3_V_TXD_MARK), 1585 GPIO_FN(SCIF3_V_TXD),
1582 PINMUX_GPIO(GPIO_FN_SCIF3_V_CTS, SCIF3_V_CTS_MARK), 1586 GPIO_FN(SCIF3_V_CTS),
1583 PINMUX_GPIO(GPIO_FN_SCIF3_V_RTS, SCIF3_V_RTS_MARK), 1587 GPIO_FN(SCIF3_V_RTS),
1584 PINMUX_GPIO(GPIO_FN_SCIF3_I_SCK, SCIF3_I_SCK_MARK), 1588 GPIO_FN(SCIF3_I_SCK),
1585 PINMUX_GPIO(GPIO_FN_SCIF3_I_RXD, SCIF3_I_RXD_MARK), 1589 GPIO_FN(SCIF3_I_RXD),
1586 PINMUX_GPIO(GPIO_FN_SCIF3_I_TXD, SCIF3_I_TXD_MARK), 1590 GPIO_FN(SCIF3_I_TXD),
1587 PINMUX_GPIO(GPIO_FN_SCIF3_I_CTS, SCIF3_I_CTS_MARK), 1591 GPIO_FN(SCIF3_I_CTS),
1588 PINMUX_GPIO(GPIO_FN_SCIF3_I_RTS, SCIF3_I_RTS_MARK), 1592 GPIO_FN(SCIF3_I_RTS),
1589 1593
1590 /* SCIF4 */ 1594 /* SCIF4 */
1591 PINMUX_GPIO(GPIO_FN_SCIF4_SCK, SCIF4_SCK_MARK), 1595 GPIO_FN(SCIF4_SCK),
1592 PINMUX_GPIO(GPIO_FN_SCIF4_RXD, SCIF4_RXD_MARK), 1596 GPIO_FN(SCIF4_RXD),
1593 PINMUX_GPIO(GPIO_FN_SCIF4_TXD, SCIF4_TXD_MARK), 1597 GPIO_FN(SCIF4_TXD),
1594 1598
1595 /* SCIF5 */ 1599 /* SCIF5 */
1596 PINMUX_GPIO(GPIO_FN_SCIF5_SCK, SCIF5_SCK_MARK), 1600 GPIO_FN(SCIF5_SCK),
1597 PINMUX_GPIO(GPIO_FN_SCIF5_RXD, SCIF5_RXD_MARK), 1601 GPIO_FN(SCIF5_RXD),
1598 PINMUX_GPIO(GPIO_FN_SCIF5_TXD, SCIF5_TXD_MARK), 1602 GPIO_FN(SCIF5_TXD),
1599 1603
1600 /* FSI */ 1604 /* FSI */
1601 PINMUX_GPIO(GPIO_FN_FSIMCKB, FSIMCKB_MARK), 1605 GPIO_FN(FSIMCKB),
1602 PINMUX_GPIO(GPIO_FN_FSIMCKA, FSIMCKA_MARK), 1606 GPIO_FN(FSIMCKA),
1603 PINMUX_GPIO(GPIO_FN_FSIOASD, FSIOASD_MARK), 1607 GPIO_FN(FSIOASD),
1604 PINMUX_GPIO(GPIO_FN_FSIIABCK, FSIIABCK_MARK), 1608 GPIO_FN(FSIIABCK),
1605 PINMUX_GPIO(GPIO_FN_FSIIALRCK, FSIIALRCK_MARK), 1609 GPIO_FN(FSIIALRCK),
1606 PINMUX_GPIO(GPIO_FN_FSIOABCK, FSIOABCK_MARK), 1610 GPIO_FN(FSIOABCK),
1607 PINMUX_GPIO(GPIO_FN_FSIOALRCK, FSIOALRCK_MARK), 1611 GPIO_FN(FSIOALRCK),
1608 PINMUX_GPIO(GPIO_FN_CLKAUDIOAO, CLKAUDIOAO_MARK), 1612 GPIO_FN(CLKAUDIOAO),
1609 PINMUX_GPIO(GPIO_FN_FSIIBSD, FSIIBSD_MARK), 1613 GPIO_FN(FSIIBSD),
1610 PINMUX_GPIO(GPIO_FN_FSIOBSD, FSIOBSD_MARK), 1614 GPIO_FN(FSIOBSD),
1611 PINMUX_GPIO(GPIO_FN_FSIIBBCK, FSIIBBCK_MARK), 1615 GPIO_FN(FSIIBBCK),
1612 PINMUX_GPIO(GPIO_FN_FSIIBLRCK, FSIIBLRCK_MARK), 1616 GPIO_FN(FSIIBLRCK),
1613 PINMUX_GPIO(GPIO_FN_FSIOBBCK, FSIOBBCK_MARK), 1617 GPIO_FN(FSIOBBCK),
1614 PINMUX_GPIO(GPIO_FN_FSIOBLRCK, FSIOBLRCK_MARK), 1618 GPIO_FN(FSIOBLRCK),
1615 PINMUX_GPIO(GPIO_FN_CLKAUDIOBO, CLKAUDIOBO_MARK), 1619 GPIO_FN(CLKAUDIOBO),
1616 PINMUX_GPIO(GPIO_FN_FSIIASD, FSIIASD_MARK), 1620 GPIO_FN(FSIIASD),
1617 1621
1618 /* AUD */ 1622 /* AUD */
1619 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK), 1623 GPIO_FN(AUDCK),
1620 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK), 1624 GPIO_FN(AUDSYNC),
1621 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK), 1625 GPIO_FN(AUDATA3),
1622 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK), 1626 GPIO_FN(AUDATA2),
1623 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK), 1627 GPIO_FN(AUDATA1),
1624 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK), 1628 GPIO_FN(AUDATA0),
1625 1629
1626 /* VIO */ 1630 /* VIO */
1627 PINMUX_GPIO(GPIO_FN_VIO_CKO, VIO_CKO_MARK), 1631 GPIO_FN(VIO_CKO),
1628 1632
1629 /* VIO0 */ 1633 /* VIO0 */
1630 PINMUX_GPIO(GPIO_FN_VIO0_D15, VIO0_D15_MARK), 1634 GPIO_FN(VIO0_D15),
1631 PINMUX_GPIO(GPIO_FN_VIO0_D14, VIO0_D14_MARK), 1635 GPIO_FN(VIO0_D14),
1632 PINMUX_GPIO(GPIO_FN_VIO0_D13, VIO0_D13_MARK), 1636 GPIO_FN(VIO0_D13),
1633 PINMUX_GPIO(GPIO_FN_VIO0_D12, VIO0_D12_MARK), 1637 GPIO_FN(VIO0_D12),
1634 PINMUX_GPIO(GPIO_FN_VIO0_D11, VIO0_D11_MARK), 1638 GPIO_FN(VIO0_D11),
1635 PINMUX_GPIO(GPIO_FN_VIO0_D10, VIO0_D10_MARK), 1639 GPIO_FN(VIO0_D10),
1636 PINMUX_GPIO(GPIO_FN_VIO0_D9, VIO0_D9_MARK), 1640 GPIO_FN(VIO0_D9),
1637 PINMUX_GPIO(GPIO_FN_VIO0_D8, VIO0_D8_MARK), 1641 GPIO_FN(VIO0_D8),
1638 PINMUX_GPIO(GPIO_FN_VIO0_D7, VIO0_D7_MARK), 1642 GPIO_FN(VIO0_D7),
1639 PINMUX_GPIO(GPIO_FN_VIO0_D6, VIO0_D6_MARK), 1643 GPIO_FN(VIO0_D6),
1640 PINMUX_GPIO(GPIO_FN_VIO0_D5, VIO0_D5_MARK), 1644 GPIO_FN(VIO0_D5),
1641 PINMUX_GPIO(GPIO_FN_VIO0_D4, VIO0_D4_MARK), 1645 GPIO_FN(VIO0_D4),
1642 PINMUX_GPIO(GPIO_FN_VIO0_D3, VIO0_D3_MARK), 1646 GPIO_FN(VIO0_D3),
1643 PINMUX_GPIO(GPIO_FN_VIO0_D2, VIO0_D2_MARK), 1647 GPIO_FN(VIO0_D2),
1644 PINMUX_GPIO(GPIO_FN_VIO0_D1, VIO0_D1_MARK), 1648 GPIO_FN(VIO0_D1),
1645 PINMUX_GPIO(GPIO_FN_VIO0_D0, VIO0_D0_MARK), 1649 GPIO_FN(VIO0_D0),
1646 PINMUX_GPIO(GPIO_FN_VIO0_VD, VIO0_VD_MARK), 1650 GPIO_FN(VIO0_VD),
1647 PINMUX_GPIO(GPIO_FN_VIO0_CLK, VIO0_CLK_MARK), 1651 GPIO_FN(VIO0_CLK),
1648 PINMUX_GPIO(GPIO_FN_VIO0_FLD, VIO0_FLD_MARK), 1652 GPIO_FN(VIO0_FLD),
1649 PINMUX_GPIO(GPIO_FN_VIO0_HD, VIO0_HD_MARK), 1653 GPIO_FN(VIO0_HD),
1650 1654
1651 /* VIO1 */ 1655 /* VIO1 */
1652 PINMUX_GPIO(GPIO_FN_VIO1_D7, VIO1_D7_MARK), 1656 GPIO_FN(VIO1_D7),
1653 PINMUX_GPIO(GPIO_FN_VIO1_D6, VIO1_D6_MARK), 1657 GPIO_FN(VIO1_D6),
1654 PINMUX_GPIO(GPIO_FN_VIO1_D5, VIO1_D5_MARK), 1658 GPIO_FN(VIO1_D5),
1655 PINMUX_GPIO(GPIO_FN_VIO1_D4, VIO1_D4_MARK), 1659 GPIO_FN(VIO1_D4),
1656 PINMUX_GPIO(GPIO_FN_VIO1_D3, VIO1_D3_MARK), 1660 GPIO_FN(VIO1_D3),
1657 PINMUX_GPIO(GPIO_FN_VIO1_D2, VIO1_D2_MARK), 1661 GPIO_FN(VIO1_D2),
1658 PINMUX_GPIO(GPIO_FN_VIO1_D1, VIO1_D1_MARK), 1662 GPIO_FN(VIO1_D1),
1659 PINMUX_GPIO(GPIO_FN_VIO1_D0, VIO1_D0_MARK), 1663 GPIO_FN(VIO1_D0),
1660 PINMUX_GPIO(GPIO_FN_VIO1_FLD, VIO1_FLD_MARK), 1664 GPIO_FN(VIO1_FLD),
1661 PINMUX_GPIO(GPIO_FN_VIO1_HD, VIO1_HD_MARK), 1665 GPIO_FN(VIO1_HD),
1662 PINMUX_GPIO(GPIO_FN_VIO1_VD, VIO1_VD_MARK), 1666 GPIO_FN(VIO1_VD),
1663 PINMUX_GPIO(GPIO_FN_VIO1_CLK, VIO1_CLK_MARK), 1667 GPIO_FN(VIO1_CLK),
1664 1668
1665 /* Eth */ 1669 /* Eth */
1666 PINMUX_GPIO(GPIO_FN_RMII_RXD0, RMII_RXD0_MARK), 1670 GPIO_FN(RMII_RXD0),
1667 PINMUX_GPIO(GPIO_FN_RMII_RXD1, RMII_RXD1_MARK), 1671 GPIO_FN(RMII_RXD1),
1668 PINMUX_GPIO(GPIO_FN_RMII_TXD0, RMII_TXD0_MARK), 1672 GPIO_FN(RMII_TXD0),
1669 PINMUX_GPIO(GPIO_FN_RMII_TXD1, RMII_TXD1_MARK), 1673 GPIO_FN(RMII_TXD1),
1670 PINMUX_GPIO(GPIO_FN_RMII_REF_CLK, RMII_REF_CLK_MARK), 1674 GPIO_FN(RMII_REF_CLK),
1671 PINMUX_GPIO(GPIO_FN_RMII_TX_EN, RMII_TX_EN_MARK), 1675 GPIO_FN(RMII_TX_EN),
1672 PINMUX_GPIO(GPIO_FN_RMII_RX_ER, RMII_RX_ER_MARK), 1676 GPIO_FN(RMII_RX_ER),
1673 PINMUX_GPIO(GPIO_FN_RMII_CRS_DV, RMII_CRS_DV_MARK), 1677 GPIO_FN(RMII_CRS_DV),
1674 PINMUX_GPIO(GPIO_FN_LNKSTA, LNKSTA_MARK), 1678 GPIO_FN(LNKSTA),
1675 PINMUX_GPIO(GPIO_FN_MDIO, MDIO_MARK), 1679 GPIO_FN(MDIO),
1676 PINMUX_GPIO(GPIO_FN_MDC, MDC_MARK), 1680 GPIO_FN(MDC),
1677 1681
1678 /* System */ 1682 /* System */
1679 PINMUX_GPIO(GPIO_FN_PDSTATUS, PDSTATUS_MARK), 1683 GPIO_FN(PDSTATUS),
1680 PINMUX_GPIO(GPIO_FN_STATUS2, STATUS2_MARK), 1684 GPIO_FN(STATUS2),
1681 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 1685 GPIO_FN(STATUS0),
1682 1686
1683 /* VOU */ 1687 /* VOU */
1684 PINMUX_GPIO(GPIO_FN_DV_D15, DV_D15_MARK), 1688 GPIO_FN(DV_D15),
1685 PINMUX_GPIO(GPIO_FN_DV_D14, DV_D14_MARK), 1689 GPIO_FN(DV_D14),
1686 PINMUX_GPIO(GPIO_FN_DV_D13, DV_D13_MARK), 1690 GPIO_FN(DV_D13),
1687 PINMUX_GPIO(GPIO_FN_DV_D12, DV_D12_MARK), 1691 GPIO_FN(DV_D12),
1688 PINMUX_GPIO(GPIO_FN_DV_D11, DV_D11_MARK), 1692 GPIO_FN(DV_D11),
1689 PINMUX_GPIO(GPIO_FN_DV_D10, DV_D10_MARK), 1693 GPIO_FN(DV_D10),
1690 PINMUX_GPIO(GPIO_FN_DV_D9, DV_D9_MARK), 1694 GPIO_FN(DV_D9),
1691 PINMUX_GPIO(GPIO_FN_DV_D8, DV_D8_MARK), 1695 GPIO_FN(DV_D8),
1692 PINMUX_GPIO(GPIO_FN_DV_D7, DV_D7_MARK), 1696 GPIO_FN(DV_D7),
1693 PINMUX_GPIO(GPIO_FN_DV_D6, DV_D6_MARK), 1697 GPIO_FN(DV_D6),
1694 PINMUX_GPIO(GPIO_FN_DV_D5, DV_D5_MARK), 1698 GPIO_FN(DV_D5),
1695 PINMUX_GPIO(GPIO_FN_DV_D4, DV_D4_MARK), 1699 GPIO_FN(DV_D4),
1696 PINMUX_GPIO(GPIO_FN_DV_D3, DV_D3_MARK), 1700 GPIO_FN(DV_D3),
1697 PINMUX_GPIO(GPIO_FN_DV_D2, DV_D2_MARK), 1701 GPIO_FN(DV_D2),
1698 PINMUX_GPIO(GPIO_FN_DV_D1, DV_D1_MARK), 1702 GPIO_FN(DV_D1),
1699 PINMUX_GPIO(GPIO_FN_DV_D0, DV_D0_MARK), 1703 GPIO_FN(DV_D0),
1700 PINMUX_GPIO(GPIO_FN_DV_CLKI, DV_CLKI_MARK), 1704 GPIO_FN(DV_CLKI),
1701 PINMUX_GPIO(GPIO_FN_DV_CLK, DV_CLK_MARK), 1705 GPIO_FN(DV_CLK),
1702 PINMUX_GPIO(GPIO_FN_DV_VSYNC, DV_VSYNC_MARK), 1706 GPIO_FN(DV_VSYNC),
1703 PINMUX_GPIO(GPIO_FN_DV_HSYNC, DV_HSYNC_MARK), 1707 GPIO_FN(DV_HSYNC),
1704 1708
1705 /* MSIOF0 */ 1709 /* MSIOF0 */
1706 PINMUX_GPIO(GPIO_FN_MSIOF0_RXD, MSIOF0_RXD_MARK), 1710 GPIO_FN(MSIOF0_RXD),
1707 PINMUX_GPIO(GPIO_FN_MSIOF0_TXD, MSIOF0_TXD_MARK), 1711 GPIO_FN(MSIOF0_TXD),
1708 PINMUX_GPIO(GPIO_FN_MSIOF0_MCK, MSIOF0_MCK_MARK), 1712 GPIO_FN(MSIOF0_MCK),
1709 PINMUX_GPIO(GPIO_FN_MSIOF0_TSCK, MSIOF0_TSCK_MARK), 1713 GPIO_FN(MSIOF0_TSCK),
1710 PINMUX_GPIO(GPIO_FN_MSIOF0_SS1, MSIOF0_SS1_MARK), 1714 GPIO_FN(MSIOF0_SS1),
1711 PINMUX_GPIO(GPIO_FN_MSIOF0_SS2, MSIOF0_SS2_MARK), 1715 GPIO_FN(MSIOF0_SS2),
1712 PINMUX_GPIO(GPIO_FN_MSIOF0_TSYNC, MSIOF0_TSYNC_MARK), 1716 GPIO_FN(MSIOF0_TSYNC),
1713 PINMUX_GPIO(GPIO_FN_MSIOF0_RSCK, MSIOF0_RSCK_MARK), 1717 GPIO_FN(MSIOF0_RSCK),
1714 PINMUX_GPIO(GPIO_FN_MSIOF0_RSYNC, MSIOF0_RSYNC_MARK), 1718 GPIO_FN(MSIOF0_RSYNC),
1715 1719
1716 /* MSIOF1 */ 1720 /* MSIOF1 */
1717 PINMUX_GPIO(GPIO_FN_MSIOF1_RXD, MSIOF1_RXD_MARK), 1721 GPIO_FN(MSIOF1_RXD),
1718 PINMUX_GPIO(GPIO_FN_MSIOF1_TXD, MSIOF1_TXD_MARK), 1722 GPIO_FN(MSIOF1_TXD),
1719 PINMUX_GPIO(GPIO_FN_MSIOF1_MCK, MSIOF1_MCK_MARK), 1723 GPIO_FN(MSIOF1_MCK),
1720 PINMUX_GPIO(GPIO_FN_MSIOF1_TSCK, MSIOF1_TSCK_MARK), 1724 GPIO_FN(MSIOF1_TSCK),
1721 PINMUX_GPIO(GPIO_FN_MSIOF1_SS1, MSIOF1_SS1_MARK), 1725 GPIO_FN(MSIOF1_SS1),
1722 PINMUX_GPIO(GPIO_FN_MSIOF1_SS2, MSIOF1_SS2_MARK), 1726 GPIO_FN(MSIOF1_SS2),
1723 PINMUX_GPIO(GPIO_FN_MSIOF1_TSYNC, MSIOF1_TSYNC_MARK), 1727 GPIO_FN(MSIOF1_TSYNC),
1724 PINMUX_GPIO(GPIO_FN_MSIOF1_RSCK, MSIOF1_RSCK_MARK), 1728 GPIO_FN(MSIOF1_RSCK),
1725 PINMUX_GPIO(GPIO_FN_MSIOF1_RSYNC, MSIOF1_RSYNC_MARK), 1729 GPIO_FN(MSIOF1_RSYNC),
1726 1730
1727 /* DMAC */ 1731 /* DMAC */
1728 PINMUX_GPIO(GPIO_FN_DMAC_DACK0, DMAC_DACK0_MARK), 1732 GPIO_FN(DMAC_DACK0),
1729 PINMUX_GPIO(GPIO_FN_DMAC_DREQ0, DMAC_DREQ0_MARK), 1733 GPIO_FN(DMAC_DREQ0),
1730 PINMUX_GPIO(GPIO_FN_DMAC_DACK1, DMAC_DACK1_MARK), 1734 GPIO_FN(DMAC_DACK1),
1731 PINMUX_GPIO(GPIO_FN_DMAC_DREQ1, DMAC_DREQ1_MARK), 1735 GPIO_FN(DMAC_DREQ1),
1732 1736
1733 /* SDHI0 */ 1737 /* SDHI0 */
1734 PINMUX_GPIO(GPIO_FN_SDHI0CD, SDHI0CD_MARK), 1738 GPIO_FN(SDHI0CD),
1735 PINMUX_GPIO(GPIO_FN_SDHI0WP, SDHI0WP_MARK), 1739 GPIO_FN(SDHI0WP),
1736 PINMUX_GPIO(GPIO_FN_SDHI0CMD, SDHI0CMD_MARK), 1740 GPIO_FN(SDHI0CMD),
1737 PINMUX_GPIO(GPIO_FN_SDHI0CLK, SDHI0CLK_MARK), 1741 GPIO_FN(SDHI0CLK),
1738 PINMUX_GPIO(GPIO_FN_SDHI0D3, SDHI0D3_MARK), 1742 GPIO_FN(SDHI0D3),
1739 PINMUX_GPIO(GPIO_FN_SDHI0D2, SDHI0D2_MARK), 1743 GPIO_FN(SDHI0D2),
1740 PINMUX_GPIO(GPIO_FN_SDHI0D1, SDHI0D1_MARK), 1744 GPIO_FN(SDHI0D1),
1741 PINMUX_GPIO(GPIO_FN_SDHI0D0, SDHI0D0_MARK), 1745 GPIO_FN(SDHI0D0),
1742 1746
1743 /* SDHI1 */ 1747 /* SDHI1 */
1744 PINMUX_GPIO(GPIO_FN_SDHI1CD, SDHI1CD_MARK), 1748 GPIO_FN(SDHI1CD),
1745 PINMUX_GPIO(GPIO_FN_SDHI1WP, SDHI1WP_MARK), 1749 GPIO_FN(SDHI1WP),
1746 PINMUX_GPIO(GPIO_FN_SDHI1CMD, SDHI1CMD_MARK), 1750 GPIO_FN(SDHI1CMD),
1747 PINMUX_GPIO(GPIO_FN_SDHI1CLK, SDHI1CLK_MARK), 1751 GPIO_FN(SDHI1CLK),
1748 PINMUX_GPIO(GPIO_FN_SDHI1D3, SDHI1D3_MARK), 1752 GPIO_FN(SDHI1D3),
1749 PINMUX_GPIO(GPIO_FN_SDHI1D2, SDHI1D2_MARK), 1753 GPIO_FN(SDHI1D2),
1750 PINMUX_GPIO(GPIO_FN_SDHI1D1, SDHI1D1_MARK), 1754 GPIO_FN(SDHI1D1),
1751 PINMUX_GPIO(GPIO_FN_SDHI1D0, SDHI1D0_MARK), 1755 GPIO_FN(SDHI1D0),
1752 1756
1753 /* MMC */ 1757 /* MMC */
1754 PINMUX_GPIO(GPIO_FN_MMC_D7, MMC_D7_MARK), 1758 GPIO_FN(MMC_D7),
1755 PINMUX_GPIO(GPIO_FN_MMC_D6, MMC_D6_MARK), 1759 GPIO_FN(MMC_D6),
1756 PINMUX_GPIO(GPIO_FN_MMC_D5, MMC_D5_MARK), 1760 GPIO_FN(MMC_D5),
1757 PINMUX_GPIO(GPIO_FN_MMC_D4, MMC_D4_MARK), 1761 GPIO_FN(MMC_D4),
1758 PINMUX_GPIO(GPIO_FN_MMC_D3, MMC_D3_MARK), 1762 GPIO_FN(MMC_D3),
1759 PINMUX_GPIO(GPIO_FN_MMC_D2, MMC_D2_MARK), 1763 GPIO_FN(MMC_D2),
1760 PINMUX_GPIO(GPIO_FN_MMC_D1, MMC_D1_MARK), 1764 GPIO_FN(MMC_D1),
1761 PINMUX_GPIO(GPIO_FN_MMC_D0, MMC_D0_MARK), 1765 GPIO_FN(MMC_D0),
1762 PINMUX_GPIO(GPIO_FN_MMC_CLK, MMC_CLK_MARK), 1766 GPIO_FN(MMC_CLK),
1763 PINMUX_GPIO(GPIO_FN_MMC_CMD, MMC_CMD_MARK), 1767 GPIO_FN(MMC_CMD),
1764 1768
1765 /* IrDA */ 1769 /* IrDA */
1766 PINMUX_GPIO(GPIO_FN_IRDA_OUT, IRDA_OUT_MARK), 1770 GPIO_FN(IRDA_OUT),
1767 PINMUX_GPIO(GPIO_FN_IRDA_IN, IRDA_IN_MARK), 1771 GPIO_FN(IRDA_IN),
1768 1772
1769 /* TSIF */ 1773 /* TSIF */
1770 PINMUX_GPIO(GPIO_FN_TSIF_TS0_SDAT, TSIF_TS0_SDAT_MARK), 1774 GPIO_FN(TSIF_TS0_SDAT),
1771 PINMUX_GPIO(GPIO_FN_TSIF_TS0_SCK, TSIF_TS0_SCK_MARK), 1775 GPIO_FN(TSIF_TS0_SCK),
1772 PINMUX_GPIO(GPIO_FN_TSIF_TS0_SDEN, TSIF_TS0_SDEN_MARK), 1776 GPIO_FN(TSIF_TS0_SDEN),
1773 PINMUX_GPIO(GPIO_FN_TSIF_TS0_SPSYNC, TSIF_TS0_SPSYNC_MARK), 1777 GPIO_FN(TSIF_TS0_SPSYNC),
1774 1778
1775 /* IRQ */ 1779 /* IRQ */
1776 PINMUX_GPIO(GPIO_FN_INTC_IRQ7, INTC_IRQ7_MARK), 1780 GPIO_FN(INTC_IRQ7),
1777 PINMUX_GPIO(GPIO_FN_INTC_IRQ6, INTC_IRQ6_MARK), 1781 GPIO_FN(INTC_IRQ6),
1778 PINMUX_GPIO(GPIO_FN_INTC_IRQ5, INTC_IRQ5_MARK), 1782 GPIO_FN(INTC_IRQ5),
1779 PINMUX_GPIO(GPIO_FN_INTC_IRQ4, INTC_IRQ4_MARK), 1783 GPIO_FN(INTC_IRQ4),
1780 PINMUX_GPIO(GPIO_FN_INTC_IRQ3, INTC_IRQ3_MARK), 1784 GPIO_FN(INTC_IRQ3),
1781 PINMUX_GPIO(GPIO_FN_INTC_IRQ2, INTC_IRQ2_MARK), 1785 GPIO_FN(INTC_IRQ2),
1782 PINMUX_GPIO(GPIO_FN_INTC_IRQ1, INTC_IRQ1_MARK), 1786 GPIO_FN(INTC_IRQ1),
1783 PINMUX_GPIO(GPIO_FN_INTC_IRQ0, INTC_IRQ0_MARK), 1787 GPIO_FN(INTC_IRQ0),
1784}; 1788};
1785 1789
1786static struct pinmux_cfg_reg pinmux_config_regs[] = { 1790static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1787 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) { 1791 { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) {
1788 PTA7_FN, PTA7_OUT, PTA7_IN_PU, PTA7_IN, 1792 PTA7_FN, PTA7_OUT, PTA7_IN_PU, PTA7_IN,
1789 PTA6_FN, PTA6_OUT, PTA6_IN_PU, PTA6_IN, 1793 PTA6_FN, PTA6_OUT, PTA6_IN_PU, PTA6_IN,
@@ -2107,7 +2111,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2107 {} 2111 {}
2108}; 2112};
2109 2113
2110static struct pinmux_data_reg pinmux_data_regs[] = { 2114static const struct pinmux_data_reg pinmux_data_regs[] = {
2111 { PINMUX_DATA_REG("PADR", 0xa4050120, 8) { 2115 { PINMUX_DATA_REG("PADR", 0xa4050120, 8) {
2112 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, 2116 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
2113 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA } 2117 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA }
@@ -2203,20 +2207,18 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2203 { }, 2207 { },
2204}; 2208};
2205 2209
2206struct sh_pfc_soc_info sh7724_pinmux_info = { 2210const struct sh_pfc_soc_info sh7724_pinmux_info = {
2207 .name = "sh7724_pfc", 2211 .name = "sh7724_pfc",
2208 .reserved_id = PINMUX_RESERVED,
2209 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
2210 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 2212 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2211 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 2213 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
2212 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 2214 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
2213 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2214 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 2215 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2215 2216
2216 .first_gpio = GPIO_PTA7, 2217 .pins = pinmux_pins,
2217 .last_gpio = GPIO_FN_INTC_IRQ0, 2218 .nr_pins = ARRAY_SIZE(pinmux_pins),
2219 .func_gpios = pinmux_func_gpios,
2220 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2218 2221
2219 .gpios = pinmux_gpios,
2220 .cfg_regs = pinmux_config_regs, 2222 .cfg_regs = pinmux_config_regs,
2221 .data_regs = pinmux_data_regs, 2223 .data_regs = pinmux_data_regs,
2222 2224
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c
index 23d76d262c32..2fd5b7d4cb94 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c
@@ -14,11 +14,6 @@
14 14
15#include "sh_pfc.h" 15#include "sh_pfc.h"
16 16
17#define CPU_32_PORT(fn, pfx, sfx) \
18 PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \
19 PORT_10(fn, pfx##2, sfx), PORT_1(fn, pfx##30, sfx), \
20 PORT_1(fn, pfx##31, sfx)
21
22#define CPU_32_PORT5(fn, pfx, sfx) \ 17#define CPU_32_PORT5(fn, pfx, sfx) \
23 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ 18 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
24 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ 19 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
@@ -29,11 +24,11 @@
29 24
30/* GPSR0 - GPSR5 */ 25/* GPSR0 - GPSR5 */
31#define CPU_ALL_PORT(fn, pfx, sfx) \ 26#define CPU_ALL_PORT(fn, pfx, sfx) \
32 CPU_32_PORT(fn, pfx##_0_, sfx), \ 27 PORT_32(fn, pfx##_0_, sfx), \
33 CPU_32_PORT(fn, pfx##_1_, sfx), \ 28 PORT_32(fn, pfx##_1_, sfx), \
34 CPU_32_PORT(fn, pfx##_2_, sfx), \ 29 PORT_32(fn, pfx##_2_, sfx), \
35 CPU_32_PORT(fn, pfx##_3_, sfx), \ 30 PORT_32(fn, pfx##_3_, sfx), \
36 CPU_32_PORT(fn, pfx##_4_, sfx), \ 31 PORT_32(fn, pfx##_4_, sfx), \
37 CPU_32_PORT5(fn, pfx##_5_, sfx) 32 CPU_32_PORT5(fn, pfx##_5_, sfx)
38 33
39#define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) 34#define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA)
@@ -47,20 +42,8 @@
47#define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) 42#define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused)
48#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) 43#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused)
49 44
50#define PORT_10_REV(fn, pfx, sfx) \ 45#define GP_INOUTSEL(bank) PORT_32_REV(_GP_INOUTSEL, _##bank##_, unused)
51 PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \ 46#define GP_INDT(bank) PORT_32_REV(_GP_INDT, _##bank##_, unused)
52 PORT_1(fn, pfx##7, sfx), PORT_1(fn, pfx##6, sfx), \
53 PORT_1(fn, pfx##5, sfx), PORT_1(fn, pfx##4, sfx), \
54 PORT_1(fn, pfx##3, sfx), PORT_1(fn, pfx##2, sfx), \
55 PORT_1(fn, pfx##1, sfx), PORT_1(fn, pfx##0, sfx)
56
57#define CPU_32_PORT_REV(fn, pfx, sfx) \
58 PORT_1(fn, pfx##31, sfx), PORT_1(fn, pfx##30, sfx), \
59 PORT_10_REV(fn, pfx##2, sfx), PORT_10_REV(fn, pfx##1, sfx), \
60 PORT_10_REV(fn, pfx, sfx)
61
62#define GP_INOUTSEL(bank) CPU_32_PORT_REV(_GP_INOUTSEL, _##bank##_, unused)
63#define GP_INDT(bank) CPU_32_PORT_REV(_GP_INDT, _##bank##_, unused)
64 47
65#define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) 48#define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn)
66#define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ 49#define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \
@@ -609,7 +592,7 @@ enum {
609 PINMUX_MARK_END, 592 PINMUX_MARK_END,
610}; 593};
611 594
612static pinmux_enum_t pinmux_data[] = { 595static const pinmux_enum_t pinmux_data[] = {
613 PINMUX_DATA_GP_ALL(), /* PINMUX_DATA(GP_M_N_DATA, GP_M_N_FN...), */ 596 PINMUX_DATA_GP_ALL(), /* PINMUX_DATA(GP_M_N_DATA, GP_M_N_FN...), */
614 597
615 PINMUX_DATA(CLKOUT_MARK, FN_CLKOUT), 598 PINMUX_DATA(CLKOUT_MARK, FN_CLKOUT),
@@ -1384,9 +1367,13 @@ static pinmux_enum_t pinmux_data[] = {
1384 PINMUX_IPSR_DATA(IP11_28, ST_CLKOUT), 1367 PINMUX_IPSR_DATA(IP11_28, ST_CLKOUT),
1385}; 1368};
1386 1369
1387static struct pinmux_gpio pinmux_gpios[] = { 1370static struct sh_pfc_pin pinmux_pins[] = {
1388 PINMUX_GPIO_GP_ALL(), 1371 PINMUX_GPIO_GP_ALL(),
1372};
1373
1374#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1389 1375
1376static const struct pinmux_func pinmux_func_gpios[] = {
1390 GPIO_FN(CLKOUT), GPIO_FN(BS), GPIO_FN(CS0), GPIO_FN(EX_CS0), 1377 GPIO_FN(CLKOUT), GPIO_FN(BS), GPIO_FN(CS0), GPIO_FN(EX_CS0),
1391 GPIO_FN(RD), GPIO_FN(WE0), GPIO_FN(WE1), 1378 GPIO_FN(RD), GPIO_FN(WE0), GPIO_FN(WE1),
1392 GPIO_FN(SCL0), GPIO_FN(PENC0), GPIO_FN(USB_OVC0), 1379 GPIO_FN(SCL0), GPIO_FN(PENC0), GPIO_FN(USB_OVC0),
@@ -1665,7 +1652,7 @@ static struct pinmux_gpio pinmux_gpios[] = {
1665 GPIO_FN(SCL1), GPIO_FN(SCIF_CLK_C), 1652 GPIO_FN(SCL1), GPIO_FN(SCIF_CLK_C),
1666}; 1653};
1667 1654
1668static struct pinmux_cfg_reg pinmux_config_regs[] = { 1655static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1669 { PINMUX_CFG_REG("GPSR0", 0xFFFC0004, 32, 1) { 1656 { PINMUX_CFG_REG("GPSR0", 0xFFFC0004, 32, 1) {
1670 GP_0_31_FN, FN_IP2_2_0, 1657 GP_0_31_FN, FN_IP2_2_0,
1671 GP_0_30_FN, FN_IP1_31_29, 1658 GP_0_30_FN, FN_IP1_31_29,
@@ -2434,7 +2421,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2434 { }, 2421 { },
2435}; 2422};
2436 2423
2437static struct pinmux_data_reg pinmux_data_regs[] = { 2424static const struct pinmux_data_reg pinmux_data_regs[] = {
2438 /* GPIO 0 - 5*/ 2425 /* GPIO 0 - 5*/
2439 { PINMUX_DATA_REG("INDT0", 0xFFC4000C, 32) { GP_INDT(0) } }, 2426 { PINMUX_DATA_REG("INDT0", 0xFFC4000C, 32) { GP_INDT(0) } },
2440 { PINMUX_DATA_REG("INDT1", 0xFFC4100C, 32) { GP_INDT(1) } }, 2427 { PINMUX_DATA_REG("INDT1", 0xFFC4100C, 32) { GP_INDT(1) } },
@@ -2451,22 +2438,20 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2451 { }, 2438 { },
2452}; 2439};
2453 2440
2454struct sh_pfc_soc_info sh7734_pinmux_info = { 2441const struct sh_pfc_soc_info sh7734_pinmux_info = {
2455 .name = "sh7734_pfc", 2442 .name = "sh7734_pfc",
2456 2443
2457 .unlock_reg = 0xFFFC0000, 2444 .unlock_reg = 0xFFFC0000,
2458 2445
2459 .reserved_id = PINMUX_RESERVED,
2460 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
2461 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 2446 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2462 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 2447 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
2463 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2464 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 2448 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2465 2449
2466 .first_gpio = GPIO_GP_0_0, 2450 .pins = pinmux_pins,
2467 .last_gpio = GPIO_FN_ST_CLKOUT, 2451 .nr_pins = ARRAY_SIZE(pinmux_pins),
2452 .func_gpios = pinmux_func_gpios,
2453 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2468 2454
2469 .gpios = pinmux_gpios,
2470 .cfg_regs = pinmux_config_regs, 2455 .cfg_regs = pinmux_config_regs,
2471 .data_regs = pinmux_data_regs, 2456 .data_regs = pinmux_data_regs,
2472 2457
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7757.c b/drivers/pinctrl/sh-pfc/pfc-sh7757.c
index 5ed74cd0ba99..e074230e6243 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7757.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7757.c
@@ -526,7 +526,7 @@ enum {
526 PINMUX_MARK_END, 526 PINMUX_MARK_END,
527}; 527};
528 528
529static pinmux_enum_t pinmux_data[] = { 529static const pinmux_enum_t pinmux_data[] = {
530 /* PTA GPIO */ 530 /* PTA GPIO */
531 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT), 531 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT),
532 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT), 532 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT),
@@ -1114,7 +1114,7 @@ static pinmux_enum_t pinmux_data[] = {
1114 PINMUX_DATA(ON_DQ0_MARK, PS8_8_FN2, PTZ0_FN), 1114 PINMUX_DATA(ON_DQ0_MARK, PS8_8_FN2, PTZ0_FN),
1115}; 1115};
1116 1116
1117static struct pinmux_gpio pinmux_gpios[] = { 1117static struct sh_pfc_pin pinmux_pins[] = {
1118 /* PTA */ 1118 /* PTA */
1119 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), 1119 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA),
1120 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), 1120 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA),
@@ -1370,359 +1370,363 @@ static struct pinmux_gpio pinmux_gpios[] = {
1370 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), 1370 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA),
1371 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), 1371 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA),
1372 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), 1372 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA),
1373};
1374
1375#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
1373 1376
1377static const struct pinmux_func pinmux_func_gpios[] = {
1374 /* PTA (mobule: LBSC, RGMII) */ 1378 /* PTA (mobule: LBSC, RGMII) */
1375 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1379 GPIO_FN(BS),
1376 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK), 1380 GPIO_FN(RDWR),
1377 PINMUX_GPIO(GPIO_FN_WE1, WE1_MARK), 1381 GPIO_FN(WE1),
1378 PINMUX_GPIO(GPIO_FN_RDY, RDY_MARK), 1382 GPIO_FN(RDY),
1379 PINMUX_GPIO(GPIO_FN_ET0_MDC, ET0_MDC_MARK), 1383 GPIO_FN(ET0_MDC),
1380 PINMUX_GPIO(GPIO_FN_ET0_MDIO, ET0_MDIO_MARK), 1384 GPIO_FN(ET0_MDIO),
1381 PINMUX_GPIO(GPIO_FN_ET1_MDC, ET1_MDC_MARK), 1385 GPIO_FN(ET1_MDC),
1382 PINMUX_GPIO(GPIO_FN_ET1_MDIO, ET1_MDIO_MARK), 1386 GPIO_FN(ET1_MDIO),
1383 1387
1384 /* PTB (mobule: INTC, ONFI, TMU) */ 1388 /* PTB (mobule: INTC, ONFI, TMU) */
1385 PINMUX_GPIO(GPIO_FN_IRQ15, IRQ15_MARK), 1389 GPIO_FN(IRQ15),
1386 PINMUX_GPIO(GPIO_FN_IRQ14, IRQ14_MARK), 1390 GPIO_FN(IRQ14),
1387 PINMUX_GPIO(GPIO_FN_IRQ13, IRQ13_MARK), 1391 GPIO_FN(IRQ13),
1388 PINMUX_GPIO(GPIO_FN_IRQ12, IRQ12_MARK), 1392 GPIO_FN(IRQ12),
1389 PINMUX_GPIO(GPIO_FN_IRQ11, IRQ11_MARK), 1393 GPIO_FN(IRQ11),
1390 PINMUX_GPIO(GPIO_FN_IRQ10, IRQ10_MARK), 1394 GPIO_FN(IRQ10),
1391 PINMUX_GPIO(GPIO_FN_IRQ9, IRQ9_MARK), 1395 GPIO_FN(IRQ9),
1392 PINMUX_GPIO(GPIO_FN_IRQ8, IRQ8_MARK), 1396 GPIO_FN(IRQ8),
1393 PINMUX_GPIO(GPIO_FN_ON_NRE, ON_NRE_MARK), 1397 GPIO_FN(ON_NRE),
1394 PINMUX_GPIO(GPIO_FN_ON_NWE, ON_NWE_MARK), 1398 GPIO_FN(ON_NWE),
1395 PINMUX_GPIO(GPIO_FN_ON_NWP, ON_NWP_MARK), 1399 GPIO_FN(ON_NWP),
1396 PINMUX_GPIO(GPIO_FN_ON_NCE0, ON_NCE0_MARK), 1400 GPIO_FN(ON_NCE0),
1397 PINMUX_GPIO(GPIO_FN_ON_R_B0, ON_R_B0_MARK), 1401 GPIO_FN(ON_R_B0),
1398 PINMUX_GPIO(GPIO_FN_ON_ALE, ON_ALE_MARK), 1402 GPIO_FN(ON_ALE),
1399 PINMUX_GPIO(GPIO_FN_ON_CLE, ON_CLE_MARK), 1403 GPIO_FN(ON_CLE),
1400 PINMUX_GPIO(GPIO_FN_TCLK, TCLK_MARK), 1404 GPIO_FN(TCLK),
1401 1405
1402 /* PTC (mobule: IRQ, PWMU) */ 1406 /* PTC (mobule: IRQ, PWMU) */
1403 PINMUX_GPIO(GPIO_FN_IRQ7, IRQ7_MARK), 1407 GPIO_FN(IRQ7),
1404 PINMUX_GPIO(GPIO_FN_IRQ6, IRQ6_MARK), 1408 GPIO_FN(IRQ6),
1405 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK), 1409 GPIO_FN(IRQ5),
1406 PINMUX_GPIO(GPIO_FN_IRQ4, IRQ4_MARK), 1410 GPIO_FN(IRQ4),
1407 PINMUX_GPIO(GPIO_FN_IRQ3, IRQ3_MARK), 1411 GPIO_FN(IRQ3),
1408 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK), 1412 GPIO_FN(IRQ2),
1409 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK), 1413 GPIO_FN(IRQ1),
1410 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK), 1414 GPIO_FN(IRQ0),
1411 PINMUX_GPIO(GPIO_FN_PWMU0, PWMU0_MARK), 1415 GPIO_FN(PWMU0),
1412 PINMUX_GPIO(GPIO_FN_PWMU1, PWMU1_MARK), 1416 GPIO_FN(PWMU1),
1413 PINMUX_GPIO(GPIO_FN_PWMU2, PWMU2_MARK), 1417 GPIO_FN(PWMU2),
1414 PINMUX_GPIO(GPIO_FN_PWMU3, PWMU3_MARK), 1418 GPIO_FN(PWMU3),
1415 PINMUX_GPIO(GPIO_FN_PWMU4, PWMU4_MARK), 1419 GPIO_FN(PWMU4),
1416 PINMUX_GPIO(GPIO_FN_PWMU5, PWMU5_MARK), 1420 GPIO_FN(PWMU5),
1417 1421
1418 /* PTD (mobule: SPI0, DMAC) */ 1422 /* PTD (mobule: SPI0, DMAC) */
1419 PINMUX_GPIO(GPIO_FN_SP0_MOSI, SP0_MOSI_MARK), 1423 GPIO_FN(SP0_MOSI),
1420 PINMUX_GPIO(GPIO_FN_SP0_MISO, SP0_MISO_MARK), 1424 GPIO_FN(SP0_MISO),
1421 PINMUX_GPIO(GPIO_FN_SP0_SCK, SP0_SCK_MARK), 1425 GPIO_FN(SP0_SCK),
1422 PINMUX_GPIO(GPIO_FN_SP0_SCK_FB, SP0_SCK_FB_MARK), 1426 GPIO_FN(SP0_SCK_FB),
1423 PINMUX_GPIO(GPIO_FN_SP0_SS0, SP0_SS0_MARK), 1427 GPIO_FN(SP0_SS0),
1424 PINMUX_GPIO(GPIO_FN_SP0_SS1, SP0_SS1_MARK), 1428 GPIO_FN(SP0_SS1),
1425 PINMUX_GPIO(GPIO_FN_SP0_SS2, SP0_SS2_MARK), 1429 GPIO_FN(SP0_SS2),
1426 PINMUX_GPIO(GPIO_FN_SP0_SS3, SP0_SS3_MARK), 1430 GPIO_FN(SP0_SS3),
1427 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 1431 GPIO_FN(DREQ0),
1428 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 1432 GPIO_FN(DACK0),
1429 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK), 1433 GPIO_FN(TEND0),
1430 1434
1431 /* PTE (mobule: RMII) */ 1435 /* PTE (mobule: RMII) */
1432 PINMUX_GPIO(GPIO_FN_RMII0_CRS_DV, RMII0_CRS_DV_MARK), 1436 GPIO_FN(RMII0_CRS_DV),
1433 PINMUX_GPIO(GPIO_FN_RMII0_TXD1, RMII0_TXD1_MARK), 1437 GPIO_FN(RMII0_TXD1),
1434 PINMUX_GPIO(GPIO_FN_RMII0_TXD0, RMII0_TXD0_MARK), 1438 GPIO_FN(RMII0_TXD0),
1435 PINMUX_GPIO(GPIO_FN_RMII0_TXEN, RMII0_TXEN_MARK), 1439 GPIO_FN(RMII0_TXEN),
1436 PINMUX_GPIO(GPIO_FN_RMII0_REFCLK, RMII0_REFCLK_MARK), 1440 GPIO_FN(RMII0_REFCLK),
1437 PINMUX_GPIO(GPIO_FN_RMII0_RXD1, RMII0_RXD1_MARK), 1441 GPIO_FN(RMII0_RXD1),
1438 PINMUX_GPIO(GPIO_FN_RMII0_RXD0, RMII0_RXD0_MARK), 1442 GPIO_FN(RMII0_RXD0),
1439 PINMUX_GPIO(GPIO_FN_RMII0_RX_ER, RMII0_RX_ER_MARK), 1443 GPIO_FN(RMII0_RX_ER),
1440 1444
1441 /* PTF (mobule: RMII, SerMux) */ 1445 /* PTF (mobule: RMII, SerMux) */
1442 PINMUX_GPIO(GPIO_FN_RMII1_CRS_DV, RMII1_CRS_DV_MARK), 1446 GPIO_FN(RMII1_CRS_DV),
1443 PINMUX_GPIO(GPIO_FN_RMII1_TXD1, RMII1_TXD1_MARK), 1447 GPIO_FN(RMII1_TXD1),
1444 PINMUX_GPIO(GPIO_FN_RMII1_TXD0, RMII1_TXD0_MARK), 1448 GPIO_FN(RMII1_TXD0),
1445 PINMUX_GPIO(GPIO_FN_RMII1_TXEN, RMII1_TXEN_MARK), 1449 GPIO_FN(RMII1_TXEN),
1446 PINMUX_GPIO(GPIO_FN_RMII1_REFCLK, RMII1_REFCLK_MARK), 1450 GPIO_FN(RMII1_REFCLK),
1447 PINMUX_GPIO(GPIO_FN_RMII1_RXD1, RMII1_RXD1_MARK), 1451 GPIO_FN(RMII1_RXD1),
1448 PINMUX_GPIO(GPIO_FN_RMII1_RXD0, RMII1_RXD0_MARK), 1452 GPIO_FN(RMII1_RXD0),
1449 PINMUX_GPIO(GPIO_FN_RMII1_RX_ER, RMII1_RX_ER_MARK), 1453 GPIO_FN(RMII1_RX_ER),
1450 PINMUX_GPIO(GPIO_FN_RAC_RI, RAC_RI_MARK), 1454 GPIO_FN(RAC_RI),
1451 1455
1452 /* PTG (mobule: system, LBSC, LPC, WDT, LPC, eMMC) */ 1456 /* PTG (mobule: system, LBSC, LPC, WDT, LPC, eMMC) */
1453 PINMUX_GPIO(GPIO_FN_BOOTFMS, BOOTFMS_MARK), 1457 GPIO_FN(BOOTFMS),
1454 PINMUX_GPIO(GPIO_FN_BOOTWP, BOOTWP_MARK), 1458 GPIO_FN(BOOTWP),
1455 PINMUX_GPIO(GPIO_FN_A25, A25_MARK), 1459 GPIO_FN(A25),
1456 PINMUX_GPIO(GPIO_FN_A24, A24_MARK), 1460 GPIO_FN(A24),
1457 PINMUX_GPIO(GPIO_FN_SERIRQ, SERIRQ_MARK), 1461 GPIO_FN(SERIRQ),
1458 PINMUX_GPIO(GPIO_FN_WDTOVF, WDTOVF_MARK), 1462 GPIO_FN(WDTOVF),
1459 PINMUX_GPIO(GPIO_FN_LPCPD, LPCPD_MARK), 1463 GPIO_FN(LPCPD),
1460 PINMUX_GPIO(GPIO_FN_LDRQ, LDRQ_MARK), 1464 GPIO_FN(LDRQ),
1461 PINMUX_GPIO(GPIO_FN_MMCCLK, MMCCLK_MARK), 1465 GPIO_FN(MMCCLK),
1462 PINMUX_GPIO(GPIO_FN_MMCCMD, MMCCMD_MARK), 1466 GPIO_FN(MMCCMD),
1463 1467
1464 /* PTH (mobule: SPI1, LPC, DMAC, ADC) */ 1468 /* PTH (mobule: SPI1, LPC, DMAC, ADC) */
1465 PINMUX_GPIO(GPIO_FN_SP1_MOSI, SP1_MOSI_MARK), 1469 GPIO_FN(SP1_MOSI),
1466 PINMUX_GPIO(GPIO_FN_SP1_MISO, SP1_MISO_MARK), 1470 GPIO_FN(SP1_MISO),
1467 PINMUX_GPIO(GPIO_FN_SP1_SCK, SP1_SCK_MARK), 1471 GPIO_FN(SP1_SCK),
1468 PINMUX_GPIO(GPIO_FN_SP1_SCK_FB, SP1_SCK_FB_MARK), 1472 GPIO_FN(SP1_SCK_FB),
1469 PINMUX_GPIO(GPIO_FN_SP1_SS0, SP1_SS0_MARK), 1473 GPIO_FN(SP1_SS0),
1470 PINMUX_GPIO(GPIO_FN_SP1_SS1, SP1_SS1_MARK), 1474 GPIO_FN(SP1_SS1),
1471 PINMUX_GPIO(GPIO_FN_WP, WP_MARK), 1475 GPIO_FN(WP),
1472 PINMUX_GPIO(GPIO_FN_FMS0, FMS0_MARK), 1476 GPIO_FN(FMS0),
1473 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK), 1477 GPIO_FN(TEND1),
1474 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 1478 GPIO_FN(DREQ1),
1475 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 1479 GPIO_FN(DACK1),
1476 PINMUX_GPIO(GPIO_FN_ADTRG1, ADTRG1_MARK), 1480 GPIO_FN(ADTRG1),
1477 PINMUX_GPIO(GPIO_FN_ADTRG0, ADTRG0_MARK), 1481 GPIO_FN(ADTRG0),
1478 1482
1479 /* PTI (mobule: LBSC, SDHI) */ 1483 /* PTI (mobule: LBSC, SDHI) */
1480 PINMUX_GPIO(GPIO_FN_D15, D15_MARK), 1484 GPIO_FN(D15),
1481 PINMUX_GPIO(GPIO_FN_D14, D14_MARK), 1485 GPIO_FN(D14),
1482 PINMUX_GPIO(GPIO_FN_D13, D13_MARK), 1486 GPIO_FN(D13),
1483 PINMUX_GPIO(GPIO_FN_D12, D12_MARK), 1487 GPIO_FN(D12),
1484 PINMUX_GPIO(GPIO_FN_D11, D11_MARK), 1488 GPIO_FN(D11),
1485 PINMUX_GPIO(GPIO_FN_D10, D10_MARK), 1489 GPIO_FN(D10),
1486 PINMUX_GPIO(GPIO_FN_D9, D9_MARK), 1490 GPIO_FN(D9),
1487 PINMUX_GPIO(GPIO_FN_D8, D8_MARK), 1491 GPIO_FN(D8),
1488 PINMUX_GPIO(GPIO_FN_SD_WP, SD_WP_MARK), 1492 GPIO_FN(SD_WP),
1489 PINMUX_GPIO(GPIO_FN_SD_CD, SD_CD_MARK), 1493 GPIO_FN(SD_CD),
1490 PINMUX_GPIO(GPIO_FN_SD_CLK, SD_CLK_MARK), 1494 GPIO_FN(SD_CLK),
1491 PINMUX_GPIO(GPIO_FN_SD_CMD, SD_CMD_MARK), 1495 GPIO_FN(SD_CMD),
1492 PINMUX_GPIO(GPIO_FN_SD_D3, SD_D3_MARK), 1496 GPIO_FN(SD_D3),
1493 PINMUX_GPIO(GPIO_FN_SD_D2, SD_D2_MARK), 1497 GPIO_FN(SD_D2),
1494 PINMUX_GPIO(GPIO_FN_SD_D1, SD_D1_MARK), 1498 GPIO_FN(SD_D1),
1495 PINMUX_GPIO(GPIO_FN_SD_D0, SD_D0_MARK), 1499 GPIO_FN(SD_D0),
1496 1500
1497 /* PTJ (mobule: SCIF234, SERMUX) */ 1501 /* PTJ (mobule: SCIF234, SERMUX) */
1498 PINMUX_GPIO(GPIO_FN_RTS3, RTS3_MARK), 1502 GPIO_FN(RTS3),
1499 PINMUX_GPIO(GPIO_FN_CTS3, CTS3_MARK), 1503 GPIO_FN(CTS3),
1500 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK), 1504 GPIO_FN(TXD3),
1501 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK), 1505 GPIO_FN(RXD3),
1502 PINMUX_GPIO(GPIO_FN_RTS4, RTS4_MARK), 1506 GPIO_FN(RTS4),
1503 PINMUX_GPIO(GPIO_FN_RXD4, RXD4_MARK), 1507 GPIO_FN(RXD4),
1504 PINMUX_GPIO(GPIO_FN_TXD4, TXD4_MARK), 1508 GPIO_FN(TXD4),
1505 1509
1506 /* PTK (mobule: SERMUX, LBSC, SCIF) */ 1510 /* PTK (mobule: SERMUX, LBSC, SCIF) */
1507 PINMUX_GPIO(GPIO_FN_COM2_TXD, COM2_TXD_MARK), 1511 GPIO_FN(COM2_TXD),
1508 PINMUX_GPIO(GPIO_FN_COM2_RXD, COM2_RXD_MARK), 1512 GPIO_FN(COM2_RXD),
1509 PINMUX_GPIO(GPIO_FN_COM2_RTS, COM2_RTS_MARK), 1513 GPIO_FN(COM2_RTS),
1510 PINMUX_GPIO(GPIO_FN_COM2_CTS, COM2_CTS_MARK), 1514 GPIO_FN(COM2_CTS),
1511 PINMUX_GPIO(GPIO_FN_COM2_DTR, COM2_DTR_MARK), 1515 GPIO_FN(COM2_DTR),
1512 PINMUX_GPIO(GPIO_FN_COM2_DSR, COM2_DSR_MARK), 1516 GPIO_FN(COM2_DSR),
1513 PINMUX_GPIO(GPIO_FN_COM2_DCD, COM2_DCD_MARK), 1517 GPIO_FN(COM2_DCD),
1514 PINMUX_GPIO(GPIO_FN_CLKOUT, CLKOUT_MARK), 1518 GPIO_FN(CLKOUT),
1515 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK), 1519 GPIO_FN(SCK2),
1516 PINMUX_GPIO(GPIO_FN_SCK4, SCK4_MARK), 1520 GPIO_FN(SCK4),
1517 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK), 1521 GPIO_FN(SCK3),
1518 1522
1519 /* PTL (mobule: SERMUX, SCIF, LBSC, AUD) */ 1523 /* PTL (mobule: SERMUX, SCIF, LBSC, AUD) */
1520 PINMUX_GPIO(GPIO_FN_RAC_RXD, RAC_RXD_MARK), 1524 GPIO_FN(RAC_RXD),
1521 PINMUX_GPIO(GPIO_FN_RAC_RTS, RAC_RTS_MARK), 1525 GPIO_FN(RAC_RTS),
1522 PINMUX_GPIO(GPIO_FN_RAC_CTS, RAC_CTS_MARK), 1526 GPIO_FN(RAC_CTS),
1523 PINMUX_GPIO(GPIO_FN_RAC_DTR, RAC_DTR_MARK), 1527 GPIO_FN(RAC_DTR),
1524 PINMUX_GPIO(GPIO_FN_RAC_DSR, RAC_DSR_MARK), 1528 GPIO_FN(RAC_DSR),
1525 PINMUX_GPIO(GPIO_FN_RAC_DCD, RAC_DCD_MARK), 1529 GPIO_FN(RAC_DCD),
1526 PINMUX_GPIO(GPIO_FN_RAC_TXD, RAC_TXD_MARK), 1530 GPIO_FN(RAC_TXD),
1527 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK), 1531 GPIO_FN(RXD2),
1528 PINMUX_GPIO(GPIO_FN_CS5, CS5_MARK), 1532 GPIO_FN(CS5),
1529 PINMUX_GPIO(GPIO_FN_CS6, CS6_MARK), 1533 GPIO_FN(CS6),
1530 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK), 1534 GPIO_FN(AUDSYNC),
1531 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK), 1535 GPIO_FN(AUDCK),
1532 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK), 1536 GPIO_FN(TXD2),
1533 1537
1534 /* PTM (mobule: LBSC, IIC) */ 1538 /* PTM (mobule: LBSC, IIC) */
1535 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK), 1539 GPIO_FN(CS4),
1536 PINMUX_GPIO(GPIO_FN_RD, RD_MARK), 1540 GPIO_FN(RD),
1537 PINMUX_GPIO(GPIO_FN_WE0, WE0_MARK), 1541 GPIO_FN(WE0),
1538 PINMUX_GPIO(GPIO_FN_CS0, CS0_MARK), 1542 GPIO_FN(CS0),
1539 PINMUX_GPIO(GPIO_FN_SDA6, SDA6_MARK), 1543 GPIO_FN(SDA6),
1540 PINMUX_GPIO(GPIO_FN_SCL6, SCL6_MARK), 1544 GPIO_FN(SCL6),
1541 PINMUX_GPIO(GPIO_FN_SDA7, SDA7_MARK), 1545 GPIO_FN(SDA7),
1542 PINMUX_GPIO(GPIO_FN_SCL7, SCL7_MARK), 1546 GPIO_FN(SCL7),
1543 1547
1544 /* PTN (mobule: USB, JMC, SGPIO, WDT) */ 1548 /* PTN (mobule: USB, JMC, SGPIO, WDT) */
1545 PINMUX_GPIO(GPIO_FN_VBUS_EN, VBUS_EN_MARK), 1549 GPIO_FN(VBUS_EN),
1546 PINMUX_GPIO(GPIO_FN_VBUS_OC, VBUS_OC_MARK), 1550 GPIO_FN(VBUS_OC),
1547 PINMUX_GPIO(GPIO_FN_JMCTCK, JMCTCK_MARK), 1551 GPIO_FN(JMCTCK),
1548 PINMUX_GPIO(GPIO_FN_JMCTMS, JMCTMS_MARK), 1552 GPIO_FN(JMCTMS),
1549 PINMUX_GPIO(GPIO_FN_JMCTDO, JMCTDO_MARK), 1553 GPIO_FN(JMCTDO),
1550 PINMUX_GPIO(GPIO_FN_JMCTDI, JMCTDI_MARK), 1554 GPIO_FN(JMCTDI),
1551 PINMUX_GPIO(GPIO_FN_JMCTRST, JMCTRST_MARK), 1555 GPIO_FN(JMCTRST),
1552 PINMUX_GPIO(GPIO_FN_SGPIO1_CLK, SGPIO1_CLK_MARK), 1556 GPIO_FN(SGPIO1_CLK),
1553 PINMUX_GPIO(GPIO_FN_SGPIO1_LOAD, SGPIO1_LOAD_MARK), 1557 GPIO_FN(SGPIO1_LOAD),
1554 PINMUX_GPIO(GPIO_FN_SGPIO1_DI, SGPIO1_DI_MARK), 1558 GPIO_FN(SGPIO1_DI),
1555 PINMUX_GPIO(GPIO_FN_SGPIO1_DO, SGPIO1_DO_MARK), 1559 GPIO_FN(SGPIO1_DO),
1556 PINMUX_GPIO(GPIO_FN_SUB_CLKIN, SUB_CLKIN_MARK), 1560 GPIO_FN(SUB_CLKIN),
1557 1561
1558 /* PTO (mobule: SGPIO, SerMux) */ 1562 /* PTO (mobule: SGPIO, SerMux) */
1559 PINMUX_GPIO(GPIO_FN_SGPIO0_CLK, SGPIO0_CLK_MARK), 1563 GPIO_FN(SGPIO0_CLK),
1560 PINMUX_GPIO(GPIO_FN_SGPIO0_LOAD, SGPIO0_LOAD_MARK), 1564 GPIO_FN(SGPIO0_LOAD),
1561 PINMUX_GPIO(GPIO_FN_SGPIO0_DI, SGPIO0_DI_MARK), 1565 GPIO_FN(SGPIO0_DI),
1562 PINMUX_GPIO(GPIO_FN_SGPIO0_DO, SGPIO0_DO_MARK), 1566 GPIO_FN(SGPIO0_DO),
1563 PINMUX_GPIO(GPIO_FN_SGPIO2_CLK, SGPIO2_CLK_MARK), 1567 GPIO_FN(SGPIO2_CLK),
1564 PINMUX_GPIO(GPIO_FN_SGPIO2_LOAD, SGPIO2_LOAD_MARK), 1568 GPIO_FN(SGPIO2_LOAD),
1565 PINMUX_GPIO(GPIO_FN_SGPIO2_DI, SGPIO2_DI_MARK), 1569 GPIO_FN(SGPIO2_DI),
1566 PINMUX_GPIO(GPIO_FN_SGPIO2_DO, SGPIO2_DO_MARK), 1570 GPIO_FN(SGPIO2_DO),
1567 PINMUX_GPIO(GPIO_FN_COM1_TXD, COM1_TXD_MARK), 1571 GPIO_FN(COM1_TXD),
1568 PINMUX_GPIO(GPIO_FN_COM1_RXD, COM1_RXD_MARK), 1572 GPIO_FN(COM1_RXD),
1569 PINMUX_GPIO(GPIO_FN_COM1_RTS, COM1_RTS_MARK), 1573 GPIO_FN(COM1_RTS),
1570 PINMUX_GPIO(GPIO_FN_COM1_CTS, COM1_CTS_MARK), 1574 GPIO_FN(COM1_CTS),
1571 1575
1572 /* PTP (mobule: EVC, ADC) */ 1576 /* PTP (mobule: EVC, ADC) */
1573 1577
1574 /* PTQ (mobule: LPC) */ 1578 /* PTQ (mobule: LPC) */
1575 PINMUX_GPIO(GPIO_FN_LAD3, LAD3_MARK), 1579 GPIO_FN(LAD3),
1576 PINMUX_GPIO(GPIO_FN_LAD2, LAD2_MARK), 1580 GPIO_FN(LAD2),
1577 PINMUX_GPIO(GPIO_FN_LAD1, LAD1_MARK), 1581 GPIO_FN(LAD1),
1578 PINMUX_GPIO(GPIO_FN_LAD0, LAD0_MARK), 1582 GPIO_FN(LAD0),
1579 PINMUX_GPIO(GPIO_FN_LFRAME, LFRAME_MARK), 1583 GPIO_FN(LFRAME),
1580 PINMUX_GPIO(GPIO_FN_LRESET, LRESET_MARK), 1584 GPIO_FN(LRESET),
1581 PINMUX_GPIO(GPIO_FN_LCLK, LCLK_MARK), 1585 GPIO_FN(LCLK),
1582 1586
1583 /* PTR (mobule: GRA, IIC) */ 1587 /* PTR (mobule: GRA, IIC) */
1584 PINMUX_GPIO(GPIO_FN_DDC3, DDC3_MARK), 1588 GPIO_FN(DDC3),
1585 PINMUX_GPIO(GPIO_FN_DDC2, DDC2_MARK), 1589 GPIO_FN(DDC2),
1586 PINMUX_GPIO(GPIO_FN_SDA8, SDA8_MARK), 1590 GPIO_FN(SDA8),
1587 PINMUX_GPIO(GPIO_FN_SCL8, SCL8_MARK), 1591 GPIO_FN(SCL8),
1588 PINMUX_GPIO(GPIO_FN_SDA2, SDA2_MARK), 1592 GPIO_FN(SDA2),
1589 PINMUX_GPIO(GPIO_FN_SCL2, SCL2_MARK), 1593 GPIO_FN(SCL2),
1590 PINMUX_GPIO(GPIO_FN_SDA1, SDA1_MARK), 1594 GPIO_FN(SDA1),
1591 PINMUX_GPIO(GPIO_FN_SCL1, SCL1_MARK), 1595 GPIO_FN(SCL1),
1592 PINMUX_GPIO(GPIO_FN_SDA0, SDA0_MARK), 1596 GPIO_FN(SDA0),
1593 PINMUX_GPIO(GPIO_FN_SCL0, SCL0_MARK), 1597 GPIO_FN(SCL0),
1594 1598
1595 /* PTS (mobule: GRA, IIC) */ 1599 /* PTS (mobule: GRA, IIC) */
1596 PINMUX_GPIO(GPIO_FN_DDC1, DDC1_MARK), 1600 GPIO_FN(DDC1),
1597 PINMUX_GPIO(GPIO_FN_DDC0, DDC0_MARK), 1601 GPIO_FN(DDC0),
1598 PINMUX_GPIO(GPIO_FN_SDA9, SDA9_MARK), 1602 GPIO_FN(SDA9),
1599 PINMUX_GPIO(GPIO_FN_SCL9, SCL9_MARK), 1603 GPIO_FN(SCL9),
1600 PINMUX_GPIO(GPIO_FN_SDA5, SDA5_MARK), 1604 GPIO_FN(SDA5),
1601 PINMUX_GPIO(GPIO_FN_SCL5, SCL5_MARK), 1605 GPIO_FN(SCL5),
1602 PINMUX_GPIO(GPIO_FN_SDA4, SDA4_MARK), 1606 GPIO_FN(SDA4),
1603 PINMUX_GPIO(GPIO_FN_SCL4, SCL4_MARK), 1607 GPIO_FN(SCL4),
1604 PINMUX_GPIO(GPIO_FN_SDA3, SDA3_MARK), 1608 GPIO_FN(SDA3),
1605 PINMUX_GPIO(GPIO_FN_SCL3, SCL3_MARK), 1609 GPIO_FN(SCL3),
1606 1610
1607 /* PTT (mobule: PWMX, AUD) */ 1611 /* PTT (mobule: PWMX, AUD) */
1608 PINMUX_GPIO(GPIO_FN_PWMX7, PWMX7_MARK), 1612 GPIO_FN(PWMX7),
1609 PINMUX_GPIO(GPIO_FN_PWMX6, PWMX6_MARK), 1613 GPIO_FN(PWMX6),
1610 PINMUX_GPIO(GPIO_FN_PWMX5, PWMX5_MARK), 1614 GPIO_FN(PWMX5),
1611 PINMUX_GPIO(GPIO_FN_PWMX4, PWMX4_MARK), 1615 GPIO_FN(PWMX4),
1612 PINMUX_GPIO(GPIO_FN_PWMX3, PWMX3_MARK), 1616 GPIO_FN(PWMX3),
1613 PINMUX_GPIO(GPIO_FN_PWMX2, PWMX2_MARK), 1617 GPIO_FN(PWMX2),
1614 PINMUX_GPIO(GPIO_FN_PWMX1, PWMX1_MARK), 1618 GPIO_FN(PWMX1),
1615 PINMUX_GPIO(GPIO_FN_PWMX0, PWMX0_MARK), 1619 GPIO_FN(PWMX0),
1616 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK), 1620 GPIO_FN(AUDATA3),
1617 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK), 1621 GPIO_FN(AUDATA2),
1618 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK), 1622 GPIO_FN(AUDATA1),
1619 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK), 1623 GPIO_FN(AUDATA0),
1620 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK), 1624 GPIO_FN(STATUS1),
1621 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 1625 GPIO_FN(STATUS0),
1622 1626
1623 /* PTU (mobule: LPC, APM) */ 1627 /* PTU (mobule: LPC, APM) */
1624 PINMUX_GPIO(GPIO_FN_LGPIO7, LGPIO7_MARK), 1628 GPIO_FN(LGPIO7),
1625 PINMUX_GPIO(GPIO_FN_LGPIO6, LGPIO6_MARK), 1629 GPIO_FN(LGPIO6),
1626 PINMUX_GPIO(GPIO_FN_LGPIO5, LGPIO5_MARK), 1630 GPIO_FN(LGPIO5),
1627 PINMUX_GPIO(GPIO_FN_LGPIO4, LGPIO4_MARK), 1631 GPIO_FN(LGPIO4),
1628 PINMUX_GPIO(GPIO_FN_LGPIO3, LGPIO3_MARK), 1632 GPIO_FN(LGPIO3),
1629 PINMUX_GPIO(GPIO_FN_LGPIO2, LGPIO2_MARK), 1633 GPIO_FN(LGPIO2),
1630 PINMUX_GPIO(GPIO_FN_LGPIO1, LGPIO1_MARK), 1634 GPIO_FN(LGPIO1),
1631 PINMUX_GPIO(GPIO_FN_LGPIO0, LGPIO0_MARK), 1635 GPIO_FN(LGPIO0),
1632 PINMUX_GPIO(GPIO_FN_APMONCTL_O, APMONCTL_O_MARK), 1636 GPIO_FN(APMONCTL_O),
1633 PINMUX_GPIO(GPIO_FN_APMPWBTOUT_O, APMPWBTOUT_O_MARK), 1637 GPIO_FN(APMPWBTOUT_O),
1634 PINMUX_GPIO(GPIO_FN_APMSCI_O, APMSCI_O_MARK), 1638 GPIO_FN(APMSCI_O),
1635 PINMUX_GPIO(GPIO_FN_APMVDDON, APMVDDON_MARK), 1639 GPIO_FN(APMVDDON),
1636 PINMUX_GPIO(GPIO_FN_APMSLPBTN, APMSLPBTN_MARK), 1640 GPIO_FN(APMSLPBTN),
1637 PINMUX_GPIO(GPIO_FN_APMPWRBTN, APMPWRBTN_MARK), 1641 GPIO_FN(APMPWRBTN),
1638 PINMUX_GPIO(GPIO_FN_APMS5N, APMS5N_MARK), 1642 GPIO_FN(APMS5N),
1639 PINMUX_GPIO(GPIO_FN_APMS3N, APMS3N_MARK), 1643 GPIO_FN(APMS3N),
1640 1644
1641 /* PTV (mobule: LBSC, SerMux, R-SPI, EVC, GRA) */ 1645 /* PTV (mobule: LBSC, SerMux, R-SPI, EVC, GRA) */
1642 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1646 GPIO_FN(A23),
1643 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1647 GPIO_FN(A22),
1644 PINMUX_GPIO(GPIO_FN_A21, A21_MARK), 1648 GPIO_FN(A21),
1645 PINMUX_GPIO(GPIO_FN_A20, A20_MARK), 1649 GPIO_FN(A20),
1646 PINMUX_GPIO(GPIO_FN_A19, A19_MARK), 1650 GPIO_FN(A19),
1647 PINMUX_GPIO(GPIO_FN_A18, A18_MARK), 1651 GPIO_FN(A18),
1648 PINMUX_GPIO(GPIO_FN_A17, A17_MARK), 1652 GPIO_FN(A17),
1649 PINMUX_GPIO(GPIO_FN_A16, A16_MARK), 1653 GPIO_FN(A16),
1650 PINMUX_GPIO(GPIO_FN_COM2_RI, COM2_RI_MARK), 1654 GPIO_FN(COM2_RI),
1651 PINMUX_GPIO(GPIO_FN_R_SPI_MOSI, R_SPI_MOSI_MARK), 1655 GPIO_FN(R_SPI_MOSI),
1652 PINMUX_GPIO(GPIO_FN_R_SPI_MISO, R_SPI_MISO_MARK), 1656 GPIO_FN(R_SPI_MISO),
1653 PINMUX_GPIO(GPIO_FN_R_SPI_RSPCK, R_SPI_RSPCK_MARK), 1657 GPIO_FN(R_SPI_RSPCK),
1654 PINMUX_GPIO(GPIO_FN_R_SPI_SSL0, R_SPI_SSL0_MARK), 1658 GPIO_FN(R_SPI_SSL0),
1655 PINMUX_GPIO(GPIO_FN_R_SPI_SSL1, R_SPI_SSL1_MARK), 1659 GPIO_FN(R_SPI_SSL1),
1656 PINMUX_GPIO(GPIO_FN_EVENT7, EVENT7_MARK), 1660 GPIO_FN(EVENT7),
1657 PINMUX_GPIO(GPIO_FN_EVENT6, EVENT6_MARK), 1661 GPIO_FN(EVENT6),
1658 PINMUX_GPIO(GPIO_FN_VBIOS_DI, VBIOS_DI_MARK), 1662 GPIO_FN(VBIOS_DI),
1659 PINMUX_GPIO(GPIO_FN_VBIOS_DO, VBIOS_DO_MARK), 1663 GPIO_FN(VBIOS_DO),
1660 PINMUX_GPIO(GPIO_FN_VBIOS_CLK, VBIOS_CLK_MARK), 1664 GPIO_FN(VBIOS_CLK),
1661 PINMUX_GPIO(GPIO_FN_VBIOS_CS, VBIOS_CS_MARK), 1665 GPIO_FN(VBIOS_CS),
1662 1666
1663 /* PTW (mobule: LBSC, EVC, SCIF) */ 1667 /* PTW (mobule: LBSC, EVC, SCIF) */
1664 PINMUX_GPIO(GPIO_FN_A16, A16_MARK), 1668 GPIO_FN(A16),
1665 PINMUX_GPIO(GPIO_FN_A15, A15_MARK), 1669 GPIO_FN(A15),
1666 PINMUX_GPIO(GPIO_FN_A14, A14_MARK), 1670 GPIO_FN(A14),
1667 PINMUX_GPIO(GPIO_FN_A13, A13_MARK), 1671 GPIO_FN(A13),
1668 PINMUX_GPIO(GPIO_FN_A12, A12_MARK), 1672 GPIO_FN(A12),
1669 PINMUX_GPIO(GPIO_FN_A11, A11_MARK), 1673 GPIO_FN(A11),
1670 PINMUX_GPIO(GPIO_FN_A10, A10_MARK), 1674 GPIO_FN(A10),
1671 PINMUX_GPIO(GPIO_FN_A9, A9_MARK), 1675 GPIO_FN(A9),
1672 PINMUX_GPIO(GPIO_FN_A8, A8_MARK), 1676 GPIO_FN(A8),
1673 PINMUX_GPIO(GPIO_FN_EVENT5, EVENT5_MARK), 1677 GPIO_FN(EVENT5),
1674 PINMUX_GPIO(GPIO_FN_EVENT4, EVENT4_MARK), 1678 GPIO_FN(EVENT4),
1675 PINMUX_GPIO(GPIO_FN_EVENT3, EVENT3_MARK), 1679 GPIO_FN(EVENT3),
1676 PINMUX_GPIO(GPIO_FN_EVENT2, EVENT2_MARK), 1680 GPIO_FN(EVENT2),
1677 PINMUX_GPIO(GPIO_FN_EVENT1, EVENT1_MARK), 1681 GPIO_FN(EVENT1),
1678 PINMUX_GPIO(GPIO_FN_EVENT0, EVENT0_MARK), 1682 GPIO_FN(EVENT0),
1679 PINMUX_GPIO(GPIO_FN_CTS4, CTS4_MARK), 1683 GPIO_FN(CTS4),
1680 PINMUX_GPIO(GPIO_FN_CTS2, CTS2_MARK), 1684 GPIO_FN(CTS2),
1681 1685
1682 /* PTX (mobule: LBSC) */ 1686 /* PTX (mobule: LBSC) */
1683 PINMUX_GPIO(GPIO_FN_A7, A7_MARK), 1687 GPIO_FN(A7),
1684 PINMUX_GPIO(GPIO_FN_A6, A6_MARK), 1688 GPIO_FN(A6),
1685 PINMUX_GPIO(GPIO_FN_A5, A5_MARK), 1689 GPIO_FN(A5),
1686 PINMUX_GPIO(GPIO_FN_A4, A4_MARK), 1690 GPIO_FN(A4),
1687 PINMUX_GPIO(GPIO_FN_A3, A3_MARK), 1691 GPIO_FN(A3),
1688 PINMUX_GPIO(GPIO_FN_A2, A2_MARK), 1692 GPIO_FN(A2),
1689 PINMUX_GPIO(GPIO_FN_A1, A1_MARK), 1693 GPIO_FN(A1),
1690 PINMUX_GPIO(GPIO_FN_A0, A0_MARK), 1694 GPIO_FN(A0),
1691 PINMUX_GPIO(GPIO_FN_RTS2, RTS2_MARK), 1695 GPIO_FN(RTS2),
1692 PINMUX_GPIO(GPIO_FN_SIM_D, SIM_D_MARK), 1696 GPIO_FN(SIM_D),
1693 PINMUX_GPIO(GPIO_FN_SIM_CLK, SIM_CLK_MARK), 1697 GPIO_FN(SIM_CLK),
1694 PINMUX_GPIO(GPIO_FN_SIM_RST, SIM_RST_MARK), 1698 GPIO_FN(SIM_RST),
1695 1699
1696 /* PTY (mobule: LBSC) */ 1700 /* PTY (mobule: LBSC) */
1697 PINMUX_GPIO(GPIO_FN_D7, D7_MARK), 1701 GPIO_FN(D7),
1698 PINMUX_GPIO(GPIO_FN_D6, D6_MARK), 1702 GPIO_FN(D6),
1699 PINMUX_GPIO(GPIO_FN_D5, D5_MARK), 1703 GPIO_FN(D5),
1700 PINMUX_GPIO(GPIO_FN_D4, D4_MARK), 1704 GPIO_FN(D4),
1701 PINMUX_GPIO(GPIO_FN_D3, D3_MARK), 1705 GPIO_FN(D3),
1702 PINMUX_GPIO(GPIO_FN_D2, D2_MARK), 1706 GPIO_FN(D2),
1703 PINMUX_GPIO(GPIO_FN_D1, D1_MARK), 1707 GPIO_FN(D1),
1704 PINMUX_GPIO(GPIO_FN_D0, D0_MARK), 1708 GPIO_FN(D0),
1705 1709
1706 /* PTZ (mobule: eMMC, ONFI) */ 1710 /* PTZ (mobule: eMMC, ONFI) */
1707 PINMUX_GPIO(GPIO_FN_MMCDAT7, MMCDAT7_MARK), 1711 GPIO_FN(MMCDAT7),
1708 PINMUX_GPIO(GPIO_FN_MMCDAT6, MMCDAT6_MARK), 1712 GPIO_FN(MMCDAT6),
1709 PINMUX_GPIO(GPIO_FN_MMCDAT5, MMCDAT5_MARK), 1713 GPIO_FN(MMCDAT5),
1710 PINMUX_GPIO(GPIO_FN_MMCDAT4, MMCDAT4_MARK), 1714 GPIO_FN(MMCDAT4),
1711 PINMUX_GPIO(GPIO_FN_MMCDAT3, MMCDAT3_MARK), 1715 GPIO_FN(MMCDAT3),
1712 PINMUX_GPIO(GPIO_FN_MMCDAT2, MMCDAT2_MARK), 1716 GPIO_FN(MMCDAT2),
1713 PINMUX_GPIO(GPIO_FN_MMCDAT1, MMCDAT1_MARK), 1717 GPIO_FN(MMCDAT1),
1714 PINMUX_GPIO(GPIO_FN_MMCDAT0, MMCDAT0_MARK), 1718 GPIO_FN(MMCDAT0),
1715 PINMUX_GPIO(GPIO_FN_ON_DQ7, ON_DQ7_MARK), 1719 GPIO_FN(ON_DQ7),
1716 PINMUX_GPIO(GPIO_FN_ON_DQ6, ON_DQ6_MARK), 1720 GPIO_FN(ON_DQ6),
1717 PINMUX_GPIO(GPIO_FN_ON_DQ5, ON_DQ5_MARK), 1721 GPIO_FN(ON_DQ5),
1718 PINMUX_GPIO(GPIO_FN_ON_DQ4, ON_DQ4_MARK), 1722 GPIO_FN(ON_DQ4),
1719 PINMUX_GPIO(GPIO_FN_ON_DQ3, ON_DQ3_MARK), 1723 GPIO_FN(ON_DQ3),
1720 PINMUX_GPIO(GPIO_FN_ON_DQ2, ON_DQ2_MARK), 1724 GPIO_FN(ON_DQ2),
1721 PINMUX_GPIO(GPIO_FN_ON_DQ1, ON_DQ1_MARK), 1725 GPIO_FN(ON_DQ1),
1722 PINMUX_GPIO(GPIO_FN_ON_DQ0, ON_DQ0_MARK), 1726 GPIO_FN(ON_DQ0),
1723}; 1727};
1724 1728
1725static struct pinmux_cfg_reg pinmux_config_regs[] = { 1729static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1726 { PINMUX_CFG_REG("PACR", 0xffec0000, 16, 2) { 1730 { PINMUX_CFG_REG("PACR", 0xffec0000, 16, 2) {
1727 PTA7_FN, PTA7_OUT, PTA7_IN, PTA7_IN_PU, 1731 PTA7_FN, PTA7_OUT, PTA7_IN, PTA7_IN_PU,
1728 PTA6_FN, PTA6_OUT, PTA6_IN, PTA6_IN_PU, 1732 PTA6_FN, PTA6_OUT, PTA6_IN, PTA6_IN_PU,
@@ -2152,7 +2156,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2152 {} 2156 {}
2153}; 2157};
2154 2158
2155static struct pinmux_data_reg pinmux_data_regs[] = { 2159static const struct pinmux_data_reg pinmux_data_regs[] = {
2156 { PINMUX_DATA_REG("PADR", 0xffec0034, 8) { 2160 { PINMUX_DATA_REG("PADR", 0xffec0034, 8) {
2157 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA, 2161 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
2158 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA } 2162 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA }
@@ -2260,20 +2264,18 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2260 { }, 2264 { },
2261}; 2265};
2262 2266
2263struct sh_pfc_soc_info sh7757_pinmux_info = { 2267const struct sh_pfc_soc_info sh7757_pinmux_info = {
2264 .name = "sh7757_pfc", 2268 .name = "sh7757_pfc",
2265 .reserved_id = PINMUX_RESERVED,
2266 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
2267 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 2269 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2268 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 2270 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
2269 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 2271 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
2270 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2271 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 2272 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2272 2273
2273 .first_gpio = GPIO_PTA0, 2274 .pins = pinmux_pins,
2274 .last_gpio = GPIO_FN_ON_DQ0, 2275 .nr_pins = ARRAY_SIZE(pinmux_pins),
2276 .func_gpios = pinmux_func_gpios,
2277 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
2275 2278
2276 .gpios = pinmux_gpios,
2277 .cfg_regs = pinmux_config_regs, 2279 .cfg_regs = pinmux_config_regs,
2278 .data_regs = pinmux_data_regs, 2280 .data_regs = pinmux_data_regs,
2279 2281
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7785.c b/drivers/pinctrl/sh-pfc/pfc-sh7785.c
index 3b1825d925bb..c176b794f240 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7785.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7785.c
@@ -355,7 +355,7 @@ enum {
355 PINMUX_MARK_END, 355 PINMUX_MARK_END,
356}; 356};
357 357
358static pinmux_enum_t pinmux_data[] = { 358static const pinmux_enum_t pinmux_data[] = {
359 359
360 /* PA GPIO */ 360 /* PA GPIO */
361 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU), 361 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU),
@@ -702,7 +702,7 @@ static pinmux_enum_t pinmux_data[] = {
702 PINMUX_DATA(IRQOUT_MARK, P2MSEL2_1), 702 PINMUX_DATA(IRQOUT_MARK, P2MSEL2_1),
703}; 703};
704 704
705static struct pinmux_gpio pinmux_gpios[] = { 705static struct sh_pfc_pin pinmux_pins[] = {
706 /* PA */ 706 /* PA */
707 PINMUX_GPIO(GPIO_PA7, PA7_DATA), 707 PINMUX_GPIO(GPIO_PA7, PA7_DATA),
708 PINMUX_GPIO(GPIO_PA6, PA6_DATA), 708 PINMUX_GPIO(GPIO_PA6, PA6_DATA),
@@ -845,176 +845,180 @@ static struct pinmux_gpio pinmux_gpios[] = {
845 PINMUX_GPIO(GPIO_PR2, PR2_DATA), 845 PINMUX_GPIO(GPIO_PR2, PR2_DATA),
846 PINMUX_GPIO(GPIO_PR1, PR1_DATA), 846 PINMUX_GPIO(GPIO_PR1, PR1_DATA),
847 PINMUX_GPIO(GPIO_PR0, PR0_DATA), 847 PINMUX_GPIO(GPIO_PR0, PR0_DATA),
848};
849
850#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
848 851
852static const struct pinmux_func pinmux_func_gpios[] = {
849 /* FN */ 853 /* FN */
850 PINMUX_GPIO(GPIO_FN_D63_AD31, D63_AD31_MARK), 854 GPIO_FN(D63_AD31),
851 PINMUX_GPIO(GPIO_FN_D62_AD30, D62_AD30_MARK), 855 GPIO_FN(D62_AD30),
852 PINMUX_GPIO(GPIO_FN_D61_AD29, D61_AD29_MARK), 856 GPIO_FN(D61_AD29),
853 PINMUX_GPIO(GPIO_FN_D60_AD28, D60_AD28_MARK), 857 GPIO_FN(D60_AD28),
854 PINMUX_GPIO(GPIO_FN_D59_AD27, D59_AD27_MARK), 858 GPIO_FN(D59_AD27),
855 PINMUX_GPIO(GPIO_FN_D58_AD26, D58_AD26_MARK), 859 GPIO_FN(D58_AD26),
856 PINMUX_GPIO(GPIO_FN_D57_AD25, D57_AD25_MARK), 860 GPIO_FN(D57_AD25),
857 PINMUX_GPIO(GPIO_FN_D56_AD24, D56_AD24_MARK), 861 GPIO_FN(D56_AD24),
858 PINMUX_GPIO(GPIO_FN_D55_AD23, D55_AD23_MARK), 862 GPIO_FN(D55_AD23),
859 PINMUX_GPIO(GPIO_FN_D54_AD22, D54_AD22_MARK), 863 GPIO_FN(D54_AD22),
860 PINMUX_GPIO(GPIO_FN_D53_AD21, D53_AD21_MARK), 864 GPIO_FN(D53_AD21),
861 PINMUX_GPIO(GPIO_FN_D52_AD20, D52_AD20_MARK), 865 GPIO_FN(D52_AD20),
862 PINMUX_GPIO(GPIO_FN_D51_AD19, D51_AD19_MARK), 866 GPIO_FN(D51_AD19),
863 PINMUX_GPIO(GPIO_FN_D50_AD18, D50_AD18_MARK), 867 GPIO_FN(D50_AD18),
864 PINMUX_GPIO(GPIO_FN_D49_AD17_DB5, D49_AD17_DB5_MARK), 868 GPIO_FN(D49_AD17_DB5),
865 PINMUX_GPIO(GPIO_FN_D48_AD16_DB4, D48_AD16_DB4_MARK), 869 GPIO_FN(D48_AD16_DB4),
866 PINMUX_GPIO(GPIO_FN_D47_AD15_DB3, D47_AD15_DB3_MARK), 870 GPIO_FN(D47_AD15_DB3),
867 PINMUX_GPIO(GPIO_FN_D46_AD14_DB2, D46_AD14_DB2_MARK), 871 GPIO_FN(D46_AD14_DB2),
868 PINMUX_GPIO(GPIO_FN_D45_AD13_DB1, D45_AD13_DB1_MARK), 872 GPIO_FN(D45_AD13_DB1),
869 PINMUX_GPIO(GPIO_FN_D44_AD12_DB0, D44_AD12_DB0_MARK), 873 GPIO_FN(D44_AD12_DB0),
870 PINMUX_GPIO(GPIO_FN_D43_AD11_DG5, D43_AD11_DG5_MARK), 874 GPIO_FN(D43_AD11_DG5),
871 PINMUX_GPIO(GPIO_FN_D42_AD10_DG4, D42_AD10_DG4_MARK), 875 GPIO_FN(D42_AD10_DG4),
872 PINMUX_GPIO(GPIO_FN_D41_AD9_DG3, D41_AD9_DG3_MARK), 876 GPIO_FN(D41_AD9_DG3),
873 PINMUX_GPIO(GPIO_FN_D40_AD8_DG2, D40_AD8_DG2_MARK), 877 GPIO_FN(D40_AD8_DG2),
874 PINMUX_GPIO(GPIO_FN_D39_AD7_DG1, D39_AD7_DG1_MARK), 878 GPIO_FN(D39_AD7_DG1),
875 PINMUX_GPIO(GPIO_FN_D38_AD6_DG0, D38_AD6_DG0_MARK), 879 GPIO_FN(D38_AD6_DG0),
876 PINMUX_GPIO(GPIO_FN_D37_AD5_DR5, D37_AD5_DR5_MARK), 880 GPIO_FN(D37_AD5_DR5),
877 PINMUX_GPIO(GPIO_FN_D36_AD4_DR4, D36_AD4_DR4_MARK), 881 GPIO_FN(D36_AD4_DR4),
878 PINMUX_GPIO(GPIO_FN_D35_AD3_DR3, D35_AD3_DR3_MARK), 882 GPIO_FN(D35_AD3_DR3),
879 PINMUX_GPIO(GPIO_FN_D34_AD2_DR2, D34_AD2_DR2_MARK), 883 GPIO_FN(D34_AD2_DR2),
880 PINMUX_GPIO(GPIO_FN_D33_AD1_DR1, D33_AD1_DR1_MARK), 884 GPIO_FN(D33_AD1_DR1),
881 PINMUX_GPIO(GPIO_FN_D32_AD0_DR0, D32_AD0_DR0_MARK), 885 GPIO_FN(D32_AD0_DR0),
882 PINMUX_GPIO(GPIO_FN_REQ1, REQ1_MARK), 886 GPIO_FN(REQ1),
883 PINMUX_GPIO(GPIO_FN_REQ2, REQ2_MARK), 887 GPIO_FN(REQ2),
884 PINMUX_GPIO(GPIO_FN_REQ3, REQ3_MARK), 888 GPIO_FN(REQ3),
885 PINMUX_GPIO(GPIO_FN_GNT1, GNT1_MARK), 889 GPIO_FN(GNT1),
886 PINMUX_GPIO(GPIO_FN_GNT2, GNT2_MARK), 890 GPIO_FN(GNT2),
887 PINMUX_GPIO(GPIO_FN_GNT3, GNT3_MARK), 891 GPIO_FN(GNT3),
888 PINMUX_GPIO(GPIO_FN_MMCCLK, MMCCLK_MARK), 892 GPIO_FN(MMCCLK),
889 PINMUX_GPIO(GPIO_FN_D31, D31_MARK), 893 GPIO_FN(D31),
890 PINMUX_GPIO(GPIO_FN_D30, D30_MARK), 894 GPIO_FN(D30),
891 PINMUX_GPIO(GPIO_FN_D29, D29_MARK), 895 GPIO_FN(D29),
892 PINMUX_GPIO(GPIO_FN_D28, D28_MARK), 896 GPIO_FN(D28),
893 PINMUX_GPIO(GPIO_FN_D27, D27_MARK), 897 GPIO_FN(D27),
894 PINMUX_GPIO(GPIO_FN_D26, D26_MARK), 898 GPIO_FN(D26),
895 PINMUX_GPIO(GPIO_FN_D25, D25_MARK), 899 GPIO_FN(D25),
896 PINMUX_GPIO(GPIO_FN_D24, D24_MARK), 900 GPIO_FN(D24),
897 PINMUX_GPIO(GPIO_FN_D23, D23_MARK), 901 GPIO_FN(D23),
898 PINMUX_GPIO(GPIO_FN_D22, D22_MARK), 902 GPIO_FN(D22),
899 PINMUX_GPIO(GPIO_FN_D21, D21_MARK), 903 GPIO_FN(D21),
900 PINMUX_GPIO(GPIO_FN_D20, D20_MARK), 904 GPIO_FN(D20),
901 PINMUX_GPIO(GPIO_FN_D19, D19_MARK), 905 GPIO_FN(D19),
902 PINMUX_GPIO(GPIO_FN_D18, D18_MARK), 906 GPIO_FN(D18),
903 PINMUX_GPIO(GPIO_FN_D17, D17_MARK), 907 GPIO_FN(D17),
904 PINMUX_GPIO(GPIO_FN_D16, D16_MARK), 908 GPIO_FN(D16),
905 PINMUX_GPIO(GPIO_FN_SCIF1_SCK, SCIF1_SCK_MARK), 909 GPIO_FN(SCIF1_SCK),
906 PINMUX_GPIO(GPIO_FN_SCIF1_RXD, SCIF1_RXD_MARK), 910 GPIO_FN(SCIF1_RXD),
907 PINMUX_GPIO(GPIO_FN_SCIF1_TXD, SCIF1_TXD_MARK), 911 GPIO_FN(SCIF1_TXD),
908 PINMUX_GPIO(GPIO_FN_SCIF0_CTS, SCIF0_CTS_MARK), 912 GPIO_FN(SCIF0_CTS),
909 PINMUX_GPIO(GPIO_FN_INTD, INTD_MARK), 913 GPIO_FN(INTD),
910 PINMUX_GPIO(GPIO_FN_FCE, FCE_MARK), 914 GPIO_FN(FCE),
911 PINMUX_GPIO(GPIO_FN_SCIF0_RTS, SCIF0_RTS_MARK), 915 GPIO_FN(SCIF0_RTS),
912 PINMUX_GPIO(GPIO_FN_HSPI_CS, HSPI_CS_MARK), 916 GPIO_FN(HSPI_CS),
913 PINMUX_GPIO(GPIO_FN_FSE, FSE_MARK), 917 GPIO_FN(FSE),
914 PINMUX_GPIO(GPIO_FN_SCIF0_SCK, SCIF0_SCK_MARK), 918 GPIO_FN(SCIF0_SCK),
915 PINMUX_GPIO(GPIO_FN_HSPI_CLK, HSPI_CLK_MARK), 919 GPIO_FN(HSPI_CLK),
916 PINMUX_GPIO(GPIO_FN_FRE, FRE_MARK), 920 GPIO_FN(FRE),
917 PINMUX_GPIO(GPIO_FN_SCIF0_RXD, SCIF0_RXD_MARK), 921 GPIO_FN(SCIF0_RXD),
918 PINMUX_GPIO(GPIO_FN_HSPI_RX, HSPI_RX_MARK), 922 GPIO_FN(HSPI_RX),
919 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 923 GPIO_FN(FRB),
920 PINMUX_GPIO(GPIO_FN_SCIF0_TXD, SCIF0_TXD_MARK), 924 GPIO_FN(SCIF0_TXD),
921 PINMUX_GPIO(GPIO_FN_HSPI_TX, HSPI_TX_MARK), 925 GPIO_FN(HSPI_TX),
922 PINMUX_GPIO(GPIO_FN_FWE, FWE_MARK), 926 GPIO_FN(FWE),
923 PINMUX_GPIO(GPIO_FN_SCIF5_TXD, SCIF5_TXD_MARK), 927 GPIO_FN(SCIF5_TXD),
924 PINMUX_GPIO(GPIO_FN_HAC1_SYNC, HAC1_SYNC_MARK), 928 GPIO_FN(HAC1_SYNC),
925 PINMUX_GPIO(GPIO_FN_SSI1_WS, SSI1_WS_MARK), 929 GPIO_FN(SSI1_WS),
926 PINMUX_GPIO(GPIO_FN_SIOF_TXD_PJ, SIOF_TXD_PJ_MARK), 930 GPIO_FN(SIOF_TXD_PJ),
927 PINMUX_GPIO(GPIO_FN_HAC0_SDOUT, HAC0_SDOUT_MARK), 931 GPIO_FN(HAC0_SDOUT),
928 PINMUX_GPIO(GPIO_FN_SSI0_SDATA, SSI0_SDATA_MARK), 932 GPIO_FN(SSI0_SDATA),
929 PINMUX_GPIO(GPIO_FN_SIOF_RXD_PJ, SIOF_RXD_PJ_MARK), 933 GPIO_FN(SIOF_RXD_PJ),
930 PINMUX_GPIO(GPIO_FN_HAC0_SDIN, HAC0_SDIN_MARK), 934 GPIO_FN(HAC0_SDIN),
931 PINMUX_GPIO(GPIO_FN_SSI0_SCK, SSI0_SCK_MARK), 935 GPIO_FN(SSI0_SCK),
932 PINMUX_GPIO(GPIO_FN_SIOF_SYNC_PJ, SIOF_SYNC_PJ_MARK), 936 GPIO_FN(SIOF_SYNC_PJ),
933 PINMUX_GPIO(GPIO_FN_HAC0_SYNC, HAC0_SYNC_MARK), 937 GPIO_FN(HAC0_SYNC),
934 PINMUX_GPIO(GPIO_FN_SSI0_WS, SSI0_WS_MARK), 938 GPIO_FN(SSI0_WS),
935 PINMUX_GPIO(GPIO_FN_SIOF_MCLK_PJ, SIOF_MCLK_PJ_MARK), 939 GPIO_FN(SIOF_MCLK_PJ),
936 PINMUX_GPIO(GPIO_FN_HAC_RES, HAC_RES_MARK), 940 GPIO_FN(HAC_RES),
937 PINMUX_GPIO(GPIO_FN_SIOF_SCK_PJ, SIOF_SCK_PJ_MARK), 941 GPIO_FN(SIOF_SCK_PJ),
938 PINMUX_GPIO(GPIO_FN_HAC0_BITCLK, HAC0_BITCLK_MARK), 942 GPIO_FN(HAC0_BITCLK),
939 PINMUX_GPIO(GPIO_FN_SSI0_CLK, SSI0_CLK_MARK), 943 GPIO_FN(SSI0_CLK),
940 PINMUX_GPIO(GPIO_FN_HAC1_BITCLK, HAC1_BITCLK_MARK), 944 GPIO_FN(HAC1_BITCLK),
941 PINMUX_GPIO(GPIO_FN_SSI1_CLK, SSI1_CLK_MARK), 945 GPIO_FN(SSI1_CLK),
942 PINMUX_GPIO(GPIO_FN_TCLK, TCLK_MARK), 946 GPIO_FN(TCLK),
943 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 947 GPIO_FN(IOIS16),
944 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 948 GPIO_FN(STATUS0),
945 PINMUX_GPIO(GPIO_FN_DRAK0_PK3, DRAK0_PK3_MARK), 949 GPIO_FN(DRAK0_PK3),
946 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK), 950 GPIO_FN(STATUS1),
947 PINMUX_GPIO(GPIO_FN_DRAK1_PK2, DRAK1_PK2_MARK), 951 GPIO_FN(DRAK1_PK2),
948 PINMUX_GPIO(GPIO_FN_DACK2, DACK2_MARK), 952 GPIO_FN(DACK2),
949 PINMUX_GPIO(GPIO_FN_SCIF2_TXD, SCIF2_TXD_MARK), 953 GPIO_FN(SCIF2_TXD),
950 PINMUX_GPIO(GPIO_FN_MMCCMD, MMCCMD_MARK), 954 GPIO_FN(MMCCMD),
951 PINMUX_GPIO(GPIO_FN_SIOF_TXD_PK, SIOF_TXD_PK_MARK), 955 GPIO_FN(SIOF_TXD_PK),
952 PINMUX_GPIO(GPIO_FN_DACK3, DACK3_MARK), 956 GPIO_FN(DACK3),
953 PINMUX_GPIO(GPIO_FN_SCIF2_SCK, SCIF2_SCK_MARK), 957 GPIO_FN(SCIF2_SCK),
954 PINMUX_GPIO(GPIO_FN_MMCDAT, MMCDAT_MARK), 958 GPIO_FN(MMCDAT),
955 PINMUX_GPIO(GPIO_FN_SIOF_SCK_PK, SIOF_SCK_PK_MARK), 959 GPIO_FN(SIOF_SCK_PK),
956 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 960 GPIO_FN(DREQ0),
957 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 961 GPIO_FN(DREQ1),
958 PINMUX_GPIO(GPIO_FN_DRAK0_PK1, DRAK0_PK1_MARK), 962 GPIO_FN(DRAK0_PK1),
959 PINMUX_GPIO(GPIO_FN_DRAK1_PK0, DRAK1_PK0_MARK), 963 GPIO_FN(DRAK1_PK0),
960 PINMUX_GPIO(GPIO_FN_DREQ2, DREQ2_MARK), 964 GPIO_FN(DREQ2),
961 PINMUX_GPIO(GPIO_FN_INTB, INTB_MARK), 965 GPIO_FN(INTB),
962 PINMUX_GPIO(GPIO_FN_DREQ3, DREQ3_MARK), 966 GPIO_FN(DREQ3),
963 PINMUX_GPIO(GPIO_FN_INTC, INTC_MARK), 967 GPIO_FN(INTC),
964 PINMUX_GPIO(GPIO_FN_DRAK2, DRAK2_MARK), 968 GPIO_FN(DRAK2),
965 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK), 969 GPIO_FN(CE2A),
966 PINMUX_GPIO(GPIO_FN_IRL4, IRL4_MARK), 970 GPIO_FN(IRL4),
967 PINMUX_GPIO(GPIO_FN_FD4, FD4_MARK), 971 GPIO_FN(FD4),
968 PINMUX_GPIO(GPIO_FN_IRL5, IRL5_MARK), 972 GPIO_FN(IRL5),
969 PINMUX_GPIO(GPIO_FN_FD5, FD5_MARK), 973 GPIO_FN(FD5),
970 PINMUX_GPIO(GPIO_FN_IRL6, IRL6_MARK), 974 GPIO_FN(IRL6),
971 PINMUX_GPIO(GPIO_FN_FD6, FD6_MARK), 975 GPIO_FN(FD6),
972 PINMUX_GPIO(GPIO_FN_IRL7, IRL7_MARK), 976 GPIO_FN(IRL7),
973 PINMUX_GPIO(GPIO_FN_FD7, FD7_MARK), 977 GPIO_FN(FD7),
974 PINMUX_GPIO(GPIO_FN_DRAK3, DRAK3_MARK), 978 GPIO_FN(DRAK3),
975 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK), 979 GPIO_FN(CE2B),
976 PINMUX_GPIO(GPIO_FN_BREQ_BSACK, BREQ_BSACK_MARK), 980 GPIO_FN(BREQ_BSACK),
977 PINMUX_GPIO(GPIO_FN_BACK_BSREQ, BACK_BSREQ_MARK), 981 GPIO_FN(BACK_BSREQ),
978 PINMUX_GPIO(GPIO_FN_SCIF5_RXD, SCIF5_RXD_MARK), 982 GPIO_FN(SCIF5_RXD),
979 PINMUX_GPIO(GPIO_FN_HAC1_SDIN, HAC1_SDIN_MARK), 983 GPIO_FN(HAC1_SDIN),
980 PINMUX_GPIO(GPIO_FN_SSI1_SCK, SSI1_SCK_MARK), 984 GPIO_FN(SSI1_SCK),
981 PINMUX_GPIO(GPIO_FN_SCIF5_SCK, SCIF5_SCK_MARK), 985 GPIO_FN(SCIF5_SCK),
982 PINMUX_GPIO(GPIO_FN_HAC1_SDOUT, HAC1_SDOUT_MARK), 986 GPIO_FN(HAC1_SDOUT),
983 PINMUX_GPIO(GPIO_FN_SSI1_SDATA, SSI1_SDATA_MARK), 987 GPIO_FN(SSI1_SDATA),
984 PINMUX_GPIO(GPIO_FN_SCIF3_TXD, SCIF3_TXD_MARK), 988 GPIO_FN(SCIF3_TXD),
985 PINMUX_GPIO(GPIO_FN_FCLE, FCLE_MARK), 989 GPIO_FN(FCLE),
986 PINMUX_GPIO(GPIO_FN_SCIF3_RXD, SCIF3_RXD_MARK), 990 GPIO_FN(SCIF3_RXD),
987 PINMUX_GPIO(GPIO_FN_FALE, FALE_MARK), 991 GPIO_FN(FALE),
988 PINMUX_GPIO(GPIO_FN_SCIF3_SCK, SCIF3_SCK_MARK), 992 GPIO_FN(SCIF3_SCK),
989 PINMUX_GPIO(GPIO_FN_FD0, FD0_MARK), 993 GPIO_FN(FD0),
990 PINMUX_GPIO(GPIO_FN_SCIF4_TXD, SCIF4_TXD_MARK), 994 GPIO_FN(SCIF4_TXD),
991 PINMUX_GPIO(GPIO_FN_FD1, FD1_MARK), 995 GPIO_FN(FD1),
992 PINMUX_GPIO(GPIO_FN_SCIF4_RXD, SCIF4_RXD_MARK), 996 GPIO_FN(SCIF4_RXD),
993 PINMUX_GPIO(GPIO_FN_FD2, FD2_MARK), 997 GPIO_FN(FD2),
994 PINMUX_GPIO(GPIO_FN_SCIF4_SCK, SCIF4_SCK_MARK), 998 GPIO_FN(SCIF4_SCK),
995 PINMUX_GPIO(GPIO_FN_FD3, FD3_MARK), 999 GPIO_FN(FD3),
996 PINMUX_GPIO(GPIO_FN_DEVSEL_DCLKOUT, DEVSEL_DCLKOUT_MARK), 1000 GPIO_FN(DEVSEL_DCLKOUT),
997 PINMUX_GPIO(GPIO_FN_STOP_CDE, STOP_CDE_MARK), 1001 GPIO_FN(STOP_CDE),
998 PINMUX_GPIO(GPIO_FN_LOCK_ODDF, LOCK_ODDF_MARK), 1002 GPIO_FN(LOCK_ODDF),
999 PINMUX_GPIO(GPIO_FN_TRDY_DISPL, TRDY_DISPL_MARK), 1003 GPIO_FN(TRDY_DISPL),
1000 PINMUX_GPIO(GPIO_FN_IRDY_HSYNC, IRDY_HSYNC_MARK), 1004 GPIO_FN(IRDY_HSYNC),
1001 PINMUX_GPIO(GPIO_FN_PCIFRAME_VSYNC, PCIFRAME_VSYNC_MARK), 1005 GPIO_FN(PCIFRAME_VSYNC),
1002 PINMUX_GPIO(GPIO_FN_INTA, INTA_MARK), 1006 GPIO_FN(INTA),
1003 PINMUX_GPIO(GPIO_FN_GNT0_GNTIN, GNT0_GNTIN_MARK), 1007 GPIO_FN(GNT0_GNTIN),
1004 PINMUX_GPIO(GPIO_FN_REQ0_REQOUT, REQ0_REQOUT_MARK), 1008 GPIO_FN(REQ0_REQOUT),
1005 PINMUX_GPIO(GPIO_FN_PERR, PERR_MARK), 1009 GPIO_FN(PERR),
1006 PINMUX_GPIO(GPIO_FN_SERR, SERR_MARK), 1010 GPIO_FN(SERR),
1007 PINMUX_GPIO(GPIO_FN_WE7_CBE3, WE7_CBE3_MARK), 1011 GPIO_FN(WE7_CBE3),
1008 PINMUX_GPIO(GPIO_FN_WE6_CBE2, WE6_CBE2_MARK), 1012 GPIO_FN(WE6_CBE2),
1009 PINMUX_GPIO(GPIO_FN_WE5_CBE1, WE5_CBE1_MARK), 1013 GPIO_FN(WE5_CBE1),
1010 PINMUX_GPIO(GPIO_FN_WE4_CBE0, WE4_CBE0_MARK), 1014 GPIO_FN(WE4_CBE0),
1011 PINMUX_GPIO(GPIO_FN_SCIF2_RXD, SCIF2_RXD_MARK), 1015 GPIO_FN(SCIF2_RXD),
1012 PINMUX_GPIO(GPIO_FN_SIOF_RXD, SIOF_RXD_MARK), 1016 GPIO_FN(SIOF_RXD),
1013 PINMUX_GPIO(GPIO_FN_MRESETOUT, MRESETOUT_MARK), 1017 GPIO_FN(MRESETOUT),
1014 PINMUX_GPIO(GPIO_FN_IRQOUT, IRQOUT_MARK), 1018 GPIO_FN(IRQOUT),
1015}; 1019};
1016 1020
1017static struct pinmux_cfg_reg pinmux_config_regs[] = { 1021static const struct pinmux_cfg_reg pinmux_config_regs[] = {
1018 { PINMUX_CFG_REG("PACR", 0xffe70000, 16, 2) { 1022 { PINMUX_CFG_REG("PACR", 0xffe70000, 16, 2) {
1019 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU, 1023 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU,
1020 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU, 1024 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU,
@@ -1214,7 +1218,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1214 {} 1218 {}
1215}; 1219};
1216 1220
1217static struct pinmux_data_reg pinmux_data_regs[] = { 1221static const struct pinmux_data_reg pinmux_data_regs[] = {
1218 { PINMUX_DATA_REG("PADR", 0xffe70020, 8) { 1222 { PINMUX_DATA_REG("PADR", 0xffe70020, 8) {
1219 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA, 1223 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
1220 PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA } 1224 PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA }
@@ -1282,20 +1286,18 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1282 { }, 1286 { },
1283}; 1287};
1284 1288
1285struct sh_pfc_soc_info sh7785_pinmux_info = { 1289const struct sh_pfc_soc_info sh7785_pinmux_info = {
1286 .name = "sh7785_pfc", 1290 .name = "sh7785_pfc",
1287 .reserved_id = PINMUX_RESERVED,
1288 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1289 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 1291 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1290 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 1292 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1291 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 1293 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1292 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1293 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 1294 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1294 1295
1295 .first_gpio = GPIO_PA7, 1296 .pins = pinmux_pins,
1296 .last_gpio = GPIO_FN_IRQOUT, 1297 .nr_pins = ARRAY_SIZE(pinmux_pins),
1298 .func_gpios = pinmux_func_gpios,
1299 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
1297 1300
1298 .gpios = pinmux_gpios,
1299 .cfg_regs = pinmux_config_regs, 1301 .cfg_regs = pinmux_config_regs,
1300 .data_regs = pinmux_data_regs, 1302 .data_regs = pinmux_data_regs,
1301 1303
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7786.c b/drivers/pinctrl/sh-pfc/pfc-sh7786.c
index 1e18b58f9e5f..8ae0e32844e9 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7786.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7786.c
@@ -191,7 +191,7 @@ enum {
191 PINMUX_MARK_END, 191 PINMUX_MARK_END,
192}; 192};
193 193
194static pinmux_enum_t pinmux_data[] = { 194static const pinmux_enum_t pinmux_data[] = {
195 195
196 /* PA GPIO */ 196 /* PA GPIO */
197 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU), 197 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU),
@@ -427,7 +427,7 @@ static pinmux_enum_t pinmux_data[] = {
427 PINMUX_DATA(SSI3_SCK_MARK, P2MSEL6_1, P2MSEL5_1, PJ1_FN), 427 PINMUX_DATA(SSI3_SCK_MARK, P2MSEL6_1, P2MSEL5_1, PJ1_FN),
428}; 428};
429 429
430static struct pinmux_gpio pinmux_gpios[] = { 430static struct sh_pfc_pin pinmux_pins[] = {
431 /* PA */ 431 /* PA */
432 PINMUX_GPIO(GPIO_PA7, PA7_DATA), 432 PINMUX_GPIO(GPIO_PA7, PA7_DATA),
433 PINMUX_GPIO(GPIO_PA6, PA6_DATA), 433 PINMUX_GPIO(GPIO_PA6, PA6_DATA),
@@ -505,147 +505,151 @@ static struct pinmux_gpio pinmux_gpios[] = {
505 PINMUX_GPIO(GPIO_PJ3, PJ3_DATA), 505 PINMUX_GPIO(GPIO_PJ3, PJ3_DATA),
506 PINMUX_GPIO(GPIO_PJ2, PJ2_DATA), 506 PINMUX_GPIO(GPIO_PJ2, PJ2_DATA),
507 PINMUX_GPIO(GPIO_PJ1, PJ1_DATA), 507 PINMUX_GPIO(GPIO_PJ1, PJ1_DATA),
508};
509
510#define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins)
508 511
512static const struct pinmux_func pinmux_func_gpios[] = {
509 /* FN */ 513 /* FN */
510 PINMUX_GPIO(GPIO_FN_CDE, CDE_MARK), 514 GPIO_FN(CDE),
511 PINMUX_GPIO(GPIO_FN_ETH_MAGIC, ETH_MAGIC_MARK), 515 GPIO_FN(ETH_MAGIC),
512 PINMUX_GPIO(GPIO_FN_DISP, DISP_MARK), 516 GPIO_FN(DISP),
513 PINMUX_GPIO(GPIO_FN_ETH_LINK, ETH_LINK_MARK), 517 GPIO_FN(ETH_LINK),
514 PINMUX_GPIO(GPIO_FN_DR5, DR5_MARK), 518 GPIO_FN(DR5),
515 PINMUX_GPIO(GPIO_FN_ETH_TX_ER, ETH_TX_ER_MARK), 519 GPIO_FN(ETH_TX_ER),
516 PINMUX_GPIO(GPIO_FN_DR4, DR4_MARK), 520 GPIO_FN(DR4),
517 PINMUX_GPIO(GPIO_FN_ETH_TX_EN, ETH_TX_EN_MARK), 521 GPIO_FN(ETH_TX_EN),
518 PINMUX_GPIO(GPIO_FN_DR3, DR3_MARK), 522 GPIO_FN(DR3),
519 PINMUX_GPIO(GPIO_FN_ETH_TXD3, ETH_TXD3_MARK), 523 GPIO_FN(ETH_TXD3),
520 PINMUX_GPIO(GPIO_FN_DR2, DR2_MARK), 524 GPIO_FN(DR2),
521 PINMUX_GPIO(GPIO_FN_ETH_TXD2, ETH_TXD2_MARK), 525 GPIO_FN(ETH_TXD2),
522 PINMUX_GPIO(GPIO_FN_DR1, DR1_MARK), 526 GPIO_FN(DR1),
523 PINMUX_GPIO(GPIO_FN_ETH_TXD1, ETH_TXD1_MARK), 527 GPIO_FN(ETH_TXD1),
524 PINMUX_GPIO(GPIO_FN_DR0, DR0_MARK), 528 GPIO_FN(DR0),
525 PINMUX_GPIO(GPIO_FN_ETH_TXD0, ETH_TXD0_MARK), 529 GPIO_FN(ETH_TXD0),
526 PINMUX_GPIO(GPIO_FN_VSYNC, VSYNC_MARK), 530 GPIO_FN(VSYNC),
527 PINMUX_GPIO(GPIO_FN_HSPI_CLK, HSPI_CLK_MARK), 531 GPIO_FN(HSPI_CLK),
528 PINMUX_GPIO(GPIO_FN_ODDF, ODDF_MARK), 532 GPIO_FN(ODDF),
529 PINMUX_GPIO(GPIO_FN_HSPI_CS, HSPI_CS_MARK), 533 GPIO_FN(HSPI_CS),
530 PINMUX_GPIO(GPIO_FN_DG5, DG5_MARK), 534 GPIO_FN(DG5),
531 PINMUX_GPIO(GPIO_FN_ETH_MDIO, ETH_MDIO_MARK), 535 GPIO_FN(ETH_MDIO),
532 PINMUX_GPIO(GPIO_FN_DG4, DG4_MARK), 536 GPIO_FN(DG4),
533 PINMUX_GPIO(GPIO_FN_ETH_RX_CLK, ETH_RX_CLK_MARK), 537 GPIO_FN(ETH_RX_CLK),
534 PINMUX_GPIO(GPIO_FN_DG3, DG3_MARK), 538 GPIO_FN(DG3),
535 PINMUX_GPIO(GPIO_FN_ETH_MDC, ETH_MDC_MARK), 539 GPIO_FN(ETH_MDC),
536 PINMUX_GPIO(GPIO_FN_DG2, DG2_MARK), 540 GPIO_FN(DG2),
537 PINMUX_GPIO(GPIO_FN_ETH_COL, ETH_COL_MARK), 541 GPIO_FN(ETH_COL),
538 PINMUX_GPIO(GPIO_FN_DG1, DG1_MARK), 542 GPIO_FN(DG1),
539 PINMUX_GPIO(GPIO_FN_ETH_TX_CLK, ETH_TX_CLK_MARK), 543 GPIO_FN(ETH_TX_CLK),
540 PINMUX_GPIO(GPIO_FN_DG0, DG0_MARK), 544 GPIO_FN(DG0),
541 PINMUX_GPIO(GPIO_FN_ETH_CRS, ETH_CRS_MARK), 545 GPIO_FN(ETH_CRS),
542 PINMUX_GPIO(GPIO_FN_DCLKIN, DCLKIN_MARK), 546 GPIO_FN(DCLKIN),
543 PINMUX_GPIO(GPIO_FN_HSPI_RX, HSPI_RX_MARK), 547 GPIO_FN(HSPI_RX),
544 PINMUX_GPIO(GPIO_FN_HSYNC, HSYNC_MARK), 548 GPIO_FN(HSYNC),
545 PINMUX_GPIO(GPIO_FN_HSPI_TX, HSPI_TX_MARK), 549 GPIO_FN(HSPI_TX),
546 PINMUX_GPIO(GPIO_FN_DB5, DB5_MARK), 550 GPIO_FN(DB5),
547 PINMUX_GPIO(GPIO_FN_ETH_RXD3, ETH_RXD3_MARK), 551 GPIO_FN(ETH_RXD3),
548 PINMUX_GPIO(GPIO_FN_DB4, DB4_MARK), 552 GPIO_FN(DB4),
549 PINMUX_GPIO(GPIO_FN_ETH_RXD2, ETH_RXD2_MARK), 553 GPIO_FN(ETH_RXD2),
550 PINMUX_GPIO(GPIO_FN_DB3, DB3_MARK), 554 GPIO_FN(DB3),
551 PINMUX_GPIO(GPIO_FN_ETH_RXD1, ETH_RXD1_MARK), 555 GPIO_FN(ETH_RXD1),
552 PINMUX_GPIO(GPIO_FN_DB2, DB2_MARK), 556 GPIO_FN(DB2),
553 PINMUX_GPIO(GPIO_FN_ETH_RXD0, ETH_RXD0_MARK), 557 GPIO_FN(ETH_RXD0),
554 PINMUX_GPIO(GPIO_FN_DB1, DB1_MARK), 558 GPIO_FN(DB1),
555 PINMUX_GPIO(GPIO_FN_ETH_RX_DV, ETH_RX_DV_MARK), 559 GPIO_FN(ETH_RX_DV),
556 PINMUX_GPIO(GPIO_FN_DB0, DB0_MARK), 560 GPIO_FN(DB0),
557 PINMUX_GPIO(GPIO_FN_ETH_RX_ER, ETH_RX_ER_MARK), 561 GPIO_FN(ETH_RX_ER),
558 PINMUX_GPIO(GPIO_FN_DCLKOUT, DCLKOUT_MARK), 562 GPIO_FN(DCLKOUT),
559 PINMUX_GPIO(GPIO_FN_SCIF1_SCK, SCIF1_SCK_MARK), 563 GPIO_FN(SCIF1_SCK),
560 PINMUX_GPIO(GPIO_FN_SCIF1_RXD, SCIF1_RXD_MARK), 564 GPIO_FN(SCIF1_RXD),
561 PINMUX_GPIO(GPIO_FN_SCIF1_TXD, SCIF1_TXD_MARK), 565 GPIO_FN(SCIF1_TXD),
562 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 566 GPIO_FN(DACK1),
563 PINMUX_GPIO(GPIO_FN_BACK, BACK_MARK), 567 GPIO_FN(BACK),
564 PINMUX_GPIO(GPIO_FN_FALE, FALE_MARK), 568 GPIO_FN(FALE),
565 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 569 GPIO_FN(DACK0),
566 PINMUX_GPIO(GPIO_FN_FCLE, FCLE_MARK), 570 GPIO_FN(FCLE),
567 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 571 GPIO_FN(DREQ1),
568 PINMUX_GPIO(GPIO_FN_BREQ, BREQ_MARK), 572 GPIO_FN(BREQ),
569 PINMUX_GPIO(GPIO_FN_USB_OVC1, USB_OVC1_MARK), 573 GPIO_FN(USB_OVC1),
570 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 574 GPIO_FN(DREQ0),
571 PINMUX_GPIO(GPIO_FN_USB_OVC0, USB_OVC0_MARK), 575 GPIO_FN(USB_OVC0),
572 PINMUX_GPIO(GPIO_FN_USB_PENC1, USB_PENC1_MARK), 576 GPIO_FN(USB_PENC1),
573 PINMUX_GPIO(GPIO_FN_USB_PENC0, USB_PENC0_MARK), 577 GPIO_FN(USB_PENC0),
574 PINMUX_GPIO(GPIO_FN_HAC1_SDOUT, HAC1_SDOUT_MARK), 578 GPIO_FN(HAC1_SDOUT),
575 PINMUX_GPIO(GPIO_FN_SSI1_SDATA, SSI1_SDATA_MARK), 579 GPIO_FN(SSI1_SDATA),
576 PINMUX_GPIO(GPIO_FN_SDIF1CMD, SDIF1CMD_MARK), 580 GPIO_FN(SDIF1CMD),
577 PINMUX_GPIO(GPIO_FN_HAC1_SDIN, HAC1_SDIN_MARK), 581 GPIO_FN(HAC1_SDIN),
578 PINMUX_GPIO(GPIO_FN_SSI1_SCK, SSI1_SCK_MARK), 582 GPIO_FN(SSI1_SCK),
579 PINMUX_GPIO(GPIO_FN_SDIF1CD, SDIF1CD_MARK), 583 GPIO_FN(SDIF1CD),
580 PINMUX_GPIO(GPIO_FN_HAC1_SYNC, HAC1_SYNC_MARK), 584 GPIO_FN(HAC1_SYNC),
581 PINMUX_GPIO(GPIO_FN_SSI1_WS, SSI1_WS_MARK), 585 GPIO_FN(SSI1_WS),
582 PINMUX_GPIO(GPIO_FN_SDIF1WP, SDIF1WP_MARK), 586 GPIO_FN(SDIF1WP),
583 PINMUX_GPIO(GPIO_FN_HAC1_BITCLK, HAC1_BITCLK_MARK), 587 GPIO_FN(HAC1_BITCLK),
584 PINMUX_GPIO(GPIO_FN_SSI1_CLK, SSI1_CLK_MARK), 588 GPIO_FN(SSI1_CLK),
585 PINMUX_GPIO(GPIO_FN_SDIF1CLK, SDIF1CLK_MARK), 589 GPIO_FN(SDIF1CLK),
586 PINMUX_GPIO(GPIO_FN_HAC0_SDOUT, HAC0_SDOUT_MARK), 590 GPIO_FN(HAC0_SDOUT),
587 PINMUX_GPIO(GPIO_FN_SSI0_SDATA, SSI0_SDATA_MARK), 591 GPIO_FN(SSI0_SDATA),
588 PINMUX_GPIO(GPIO_FN_SDIF1D3, SDIF1D3_MARK), 592 GPIO_FN(SDIF1D3),
589 PINMUX_GPIO(GPIO_FN_HAC0_SDIN, HAC0_SDIN_MARK), 593 GPIO_FN(HAC0_SDIN),
590 PINMUX_GPIO(GPIO_FN_SSI0_SCK, SSI0_SCK_MARK), 594 GPIO_FN(SSI0_SCK),
591 PINMUX_GPIO(GPIO_FN_SDIF1D2, SDIF1D2_MARK), 595 GPIO_FN(SDIF1D2),
592 PINMUX_GPIO(GPIO_FN_HAC0_SYNC, HAC0_SYNC_MARK), 596 GPIO_FN(HAC0_SYNC),
593 PINMUX_GPIO(GPIO_FN_SSI0_WS, SSI0_WS_MARK), 597 GPIO_FN(SSI0_WS),
594 PINMUX_GPIO(GPIO_FN_SDIF1D1, SDIF1D1_MARK), 598 GPIO_FN(SDIF1D1),
595 PINMUX_GPIO(GPIO_FN_HAC0_BITCLK, HAC0_BITCLK_MARK), 599 GPIO_FN(HAC0_BITCLK),
596 PINMUX_GPIO(GPIO_FN_SSI0_CLK, SSI0_CLK_MARK), 600 GPIO_FN(SSI0_CLK),
597 PINMUX_GPIO(GPIO_FN_SDIF1D0, SDIF1D0_MARK), 601 GPIO_FN(SDIF1D0),
598 PINMUX_GPIO(GPIO_FN_SCIF3_SCK, SCIF3_SCK_MARK), 602 GPIO_FN(SCIF3_SCK),
599 PINMUX_GPIO(GPIO_FN_SSI2_SDATA, SSI2_SDATA_MARK), 603 GPIO_FN(SSI2_SDATA),
600 PINMUX_GPIO(GPIO_FN_SCIF3_RXD, SCIF3_RXD_MARK), 604 GPIO_FN(SCIF3_RXD),
601 PINMUX_GPIO(GPIO_FN_TCLK, TCLK_MARK), 605 GPIO_FN(TCLK),
602 PINMUX_GPIO(GPIO_FN_SSI2_SCK, SSI2_SCK_MARK), 606 GPIO_FN(SSI2_SCK),
603 PINMUX_GPIO(GPIO_FN_SCIF3_TXD, SCIF3_TXD_MARK), 607 GPIO_FN(SCIF3_TXD),
604 PINMUX_GPIO(GPIO_FN_HAC_RES, HAC_RES_MARK), 608 GPIO_FN(HAC_RES),
605 PINMUX_GPIO(GPIO_FN_SSI2_WS, SSI2_WS_MARK), 609 GPIO_FN(SSI2_WS),
606 PINMUX_GPIO(GPIO_FN_DACK3, DACK3_MARK), 610 GPIO_FN(DACK3),
607 PINMUX_GPIO(GPIO_FN_SDIF0CMD, SDIF0CMD_MARK), 611 GPIO_FN(SDIF0CMD),
608 PINMUX_GPIO(GPIO_FN_DACK2, DACK2_MARK), 612 GPIO_FN(DACK2),
609 PINMUX_GPIO(GPIO_FN_SDIF0CD, SDIF0CD_MARK), 613 GPIO_FN(SDIF0CD),
610 PINMUX_GPIO(GPIO_FN_DREQ3, DREQ3_MARK), 614 GPIO_FN(DREQ3),
611 PINMUX_GPIO(GPIO_FN_SDIF0WP, SDIF0WP_MARK), 615 GPIO_FN(SDIF0WP),
612 PINMUX_GPIO(GPIO_FN_SCIF0_CTS, SCIF0_CTS_MARK), 616 GPIO_FN(SCIF0_CTS),
613 PINMUX_GPIO(GPIO_FN_DREQ2, DREQ2_MARK), 617 GPIO_FN(DREQ2),
614 PINMUX_GPIO(GPIO_FN_SDIF0CLK, SDIF0CLK_MARK), 618 GPIO_FN(SDIF0CLK),
615 PINMUX_GPIO(GPIO_FN_SCIF0_RTS, SCIF0_RTS_MARK), 619 GPIO_FN(SCIF0_RTS),
616 PINMUX_GPIO(GPIO_FN_IRL7, IRL7_MARK), 620 GPIO_FN(IRL7),
617 PINMUX_GPIO(GPIO_FN_SDIF0D3, SDIF0D3_MARK), 621 GPIO_FN(SDIF0D3),
618 PINMUX_GPIO(GPIO_FN_SCIF0_SCK, SCIF0_SCK_MARK), 622 GPIO_FN(SCIF0_SCK),
619 PINMUX_GPIO(GPIO_FN_IRL6, IRL6_MARK), 623 GPIO_FN(IRL6),
620 PINMUX_GPIO(GPIO_FN_SDIF0D2, SDIF0D2_MARK), 624 GPIO_FN(SDIF0D2),
621 PINMUX_GPIO(GPIO_FN_SCIF0_RXD, SCIF0_RXD_MARK), 625 GPIO_FN(SCIF0_RXD),
622 PINMUX_GPIO(GPIO_FN_IRL5, IRL5_MARK), 626 GPIO_FN(IRL5),
623 PINMUX_GPIO(GPIO_FN_SDIF0D1, SDIF0D1_MARK), 627 GPIO_FN(SDIF0D1),
624 PINMUX_GPIO(GPIO_FN_SCIF0_TXD, SCIF0_TXD_MARK), 628 GPIO_FN(SCIF0_TXD),
625 PINMUX_GPIO(GPIO_FN_IRL4, IRL4_MARK), 629 GPIO_FN(IRL4),
626 PINMUX_GPIO(GPIO_FN_SDIF0D0, SDIF0D0_MARK), 630 GPIO_FN(SDIF0D0),
627 PINMUX_GPIO(GPIO_FN_SCIF5_SCK, SCIF5_SCK_MARK), 631 GPIO_FN(SCIF5_SCK),
628 PINMUX_GPIO(GPIO_FN_FRB, FRB_MARK), 632 GPIO_FN(FRB),
629 PINMUX_GPIO(GPIO_FN_SCIF5_RXD, SCIF5_RXD_MARK), 633 GPIO_FN(SCIF5_RXD),
630 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 634 GPIO_FN(IOIS16),
631 PINMUX_GPIO(GPIO_FN_SCIF5_TXD, SCIF5_TXD_MARK), 635 GPIO_FN(SCIF5_TXD),
632 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK), 636 GPIO_FN(CE2B),
633 PINMUX_GPIO(GPIO_FN_DRAK3, DRAK3_MARK), 637 GPIO_FN(DRAK3),
634 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK), 638 GPIO_FN(CE2A),
635 PINMUX_GPIO(GPIO_FN_SCIF4_SCK, SCIF4_SCK_MARK), 639 GPIO_FN(SCIF4_SCK),
636 PINMUX_GPIO(GPIO_FN_DRAK2, DRAK2_MARK), 640 GPIO_FN(DRAK2),
637 PINMUX_GPIO(GPIO_FN_SSI3_WS, SSI3_WS_MARK), 641 GPIO_FN(SSI3_WS),
638 PINMUX_GPIO(GPIO_FN_SCIF4_RXD, SCIF4_RXD_MARK), 642 GPIO_FN(SCIF4_RXD),
639 PINMUX_GPIO(GPIO_FN_DRAK1, DRAK1_MARK), 643 GPIO_FN(DRAK1),
640 PINMUX_GPIO(GPIO_FN_SSI3_SDATA, SSI3_SDATA_MARK), 644 GPIO_FN(SSI3_SDATA),
641 PINMUX_GPIO(GPIO_FN_FSTATUS, FSTATUS_MARK), 645 GPIO_FN(FSTATUS),
642 PINMUX_GPIO(GPIO_FN_SCIF4_TXD, SCIF4_TXD_MARK), 646 GPIO_FN(SCIF4_TXD),
643 PINMUX_GPIO(GPIO_FN_DRAK0, DRAK0_MARK), 647 GPIO_FN(DRAK0),
644 PINMUX_GPIO(GPIO_FN_SSI3_SCK, SSI3_SCK_MARK), 648 GPIO_FN(SSI3_SCK),
645 PINMUX_GPIO(GPIO_FN_FSE, FSE_MARK), 649 GPIO_FN(FSE),
646}; 650};
647 651
648static struct pinmux_cfg_reg pinmux_config_regs[] = { 652static const struct pinmux_cfg_reg pinmux_config_regs[] = {
649 { PINMUX_CFG_REG("PACR", 0xffcc0000, 16, 2) { 653 { PINMUX_CFG_REG("PACR", 0xffcc0000, 16, 2) {
650 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU, 654 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU,
651 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU, 655 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU,
@@ -775,7 +779,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
775 {} 779 {}
776}; 780};
777 781
778static struct pinmux_data_reg pinmux_data_regs[] = { 782static const struct pinmux_data_reg pinmux_data_regs[] = {
779 { PINMUX_DATA_REG("PADR", 0xffcc0020, 8) { 783 { PINMUX_DATA_REG("PADR", 0xffcc0020, 8) {
780 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA, 784 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
781 PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA } 785 PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA }
@@ -815,20 +819,18 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
815 { }, 819 { },
816}; 820};
817 821
818struct sh_pfc_soc_info sh7786_pinmux_info = { 822const struct sh_pfc_soc_info sh7786_pinmux_info = {
819 .name = "sh7786_pfc", 823 .name = "sh7786_pfc",
820 .reserved_id = PINMUX_RESERVED,
821 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
822 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 824 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
823 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END }, 825 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
824 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 826 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
825 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
826 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 827 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
827 828
828 .first_gpio = GPIO_PA7, 829 .pins = pinmux_pins,
829 .last_gpio = GPIO_FN_IRL4, 830 .nr_pins = ARRAY_SIZE(pinmux_pins),
831 .func_gpios = pinmux_func_gpios,
832 .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios),
830 833
831 .gpios = pinmux_gpios,
832 .cfg_regs = pinmux_config_regs, 834 .cfg_regs = pinmux_config_regs,
833 .data_regs = pinmux_data_regs, 835 .data_regs = pinmux_data_regs,
834 836
diff --git a/drivers/pinctrl/sh-pfc/pfc-shx3.c b/drivers/pinctrl/sh-pfc/pfc-shx3.c
index ccf6918b03c6..6594c8c48747 100644
--- a/drivers/pinctrl/sh-pfc/pfc-shx3.c
+++ b/drivers/pinctrl/sh-pfc/pfc-shx3.c
@@ -147,7 +147,7 @@ enum {
147 PINMUX_MARK_END, 147 PINMUX_MARK_END,
148}; 148};
149 149
150static pinmux_enum_t shx3_pinmux_data[] = { 150static const pinmux_enum_t shx3_pinmux_data[] = {
151 151
152 /* PA GPIO */ 152 /* PA GPIO */
153 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU), 153 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU),
@@ -306,7 +306,7 @@ static pinmux_enum_t shx3_pinmux_data[] = {
306 PINMUX_DATA(IRQOUT_MARK, PH0_FN), 306 PINMUX_DATA(IRQOUT_MARK, PH0_FN),
307}; 307};
308 308
309static struct pinmux_gpio shx3_pinmux_gpios[] = { 309static struct sh_pfc_pin shx3_pinmux_pins[] = {
310 /* PA */ 310 /* PA */
311 PINMUX_GPIO(GPIO_PA7, PA7_DATA), 311 PINMUX_GPIO(GPIO_PA7, PA7_DATA),
312 PINMUX_GPIO(GPIO_PA6, PA6_DATA), 312 PINMUX_GPIO(GPIO_PA6, PA6_DATA),
@@ -384,73 +384,77 @@ static struct pinmux_gpio shx3_pinmux_gpios[] = {
384 PINMUX_GPIO(GPIO_PH2, PH2_DATA), 384 PINMUX_GPIO(GPIO_PH2, PH2_DATA),
385 PINMUX_GPIO(GPIO_PH1, PH1_DATA), 385 PINMUX_GPIO(GPIO_PH1, PH1_DATA),
386 PINMUX_GPIO(GPIO_PH0, PH0_DATA), 386 PINMUX_GPIO(GPIO_PH0, PH0_DATA),
387};
388
389#define PINMUX_FN_BASE ARRAY_SIZE(shx3_pinmux_pins)
387 390
391static const struct pinmux_func shx3_pinmux_func_gpios[] = {
388 /* FN */ 392 /* FN */
389 PINMUX_GPIO(GPIO_FN_D31, D31_MARK), 393 GPIO_FN(D31),
390 PINMUX_GPIO(GPIO_FN_D30, D30_MARK), 394 GPIO_FN(D30),
391 PINMUX_GPIO(GPIO_FN_D29, D29_MARK), 395 GPIO_FN(D29),
392 PINMUX_GPIO(GPIO_FN_D28, D28_MARK), 396 GPIO_FN(D28),
393 PINMUX_GPIO(GPIO_FN_D27, D27_MARK), 397 GPIO_FN(D27),
394 PINMUX_GPIO(GPIO_FN_D26, D26_MARK), 398 GPIO_FN(D26),
395 PINMUX_GPIO(GPIO_FN_D25, D25_MARK), 399 GPIO_FN(D25),
396 PINMUX_GPIO(GPIO_FN_D24, D24_MARK), 400 GPIO_FN(D24),
397 PINMUX_GPIO(GPIO_FN_D23, D23_MARK), 401 GPIO_FN(D23),
398 PINMUX_GPIO(GPIO_FN_D22, D22_MARK), 402 GPIO_FN(D22),
399 PINMUX_GPIO(GPIO_FN_D21, D21_MARK), 403 GPIO_FN(D21),
400 PINMUX_GPIO(GPIO_FN_D20, D20_MARK), 404 GPIO_FN(D20),
401 PINMUX_GPIO(GPIO_FN_D19, D19_MARK), 405 GPIO_FN(D19),
402 PINMUX_GPIO(GPIO_FN_D18, D18_MARK), 406 GPIO_FN(D18),
403 PINMUX_GPIO(GPIO_FN_D17, D17_MARK), 407 GPIO_FN(D17),
404 PINMUX_GPIO(GPIO_FN_D16, D16_MARK), 408 GPIO_FN(D16),
405 PINMUX_GPIO(GPIO_FN_BACK, BACK_MARK), 409 GPIO_FN(BACK),
406 PINMUX_GPIO(GPIO_FN_BREQ, BREQ_MARK), 410 GPIO_FN(BREQ),
407 PINMUX_GPIO(GPIO_FN_WE3, WE3_MARK), 411 GPIO_FN(WE3),
408 PINMUX_GPIO(GPIO_FN_WE2, WE2_MARK), 412 GPIO_FN(WE2),
409 PINMUX_GPIO(GPIO_FN_CS6, CS6_MARK), 413 GPIO_FN(CS6),
410 PINMUX_GPIO(GPIO_FN_CS5, CS5_MARK), 414 GPIO_FN(CS5),
411 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK), 415 GPIO_FN(CS4),
412 PINMUX_GPIO(GPIO_FN_CLKOUTENB, CLKOUTENB_MARK), 416 GPIO_FN(CLKOUTENB),
413 PINMUX_GPIO(GPIO_FN_DACK3, DACK3_MARK), 417 GPIO_FN(DACK3),
414 PINMUX_GPIO(GPIO_FN_DACK2, DACK2_MARK), 418 GPIO_FN(DACK2),
415 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 419 GPIO_FN(DACK1),
416 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK), 420 GPIO_FN(DACK0),
417 PINMUX_GPIO(GPIO_FN_DREQ3, DREQ3_MARK), 421 GPIO_FN(DREQ3),
418 PINMUX_GPIO(GPIO_FN_DREQ2, DREQ2_MARK), 422 GPIO_FN(DREQ2),
419 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 423 GPIO_FN(DREQ1),
420 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK), 424 GPIO_FN(DREQ0),
421 PINMUX_GPIO(GPIO_FN_IRQ3, IRQ3_MARK), 425 GPIO_FN(IRQ3),
422 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK), 426 GPIO_FN(IRQ2),
423 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK), 427 GPIO_FN(IRQ1),
424 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK), 428 GPIO_FN(IRQ0),
425 PINMUX_GPIO(GPIO_FN_DRAK3, DRAK3_MARK), 429 GPIO_FN(DRAK3),
426 PINMUX_GPIO(GPIO_FN_DRAK2, DRAK2_MARK), 430 GPIO_FN(DRAK2),
427 PINMUX_GPIO(GPIO_FN_DRAK1, DRAK1_MARK), 431 GPIO_FN(DRAK1),
428 PINMUX_GPIO(GPIO_FN_DRAK0, DRAK0_MARK), 432 GPIO_FN(DRAK0),
429 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK), 433 GPIO_FN(SCK3),
430 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK), 434 GPIO_FN(SCK2),
431 PINMUX_GPIO(GPIO_FN_SCK1, SCK1_MARK), 435 GPIO_FN(SCK1),
432 PINMUX_GPIO(GPIO_FN_SCK0, SCK0_MARK), 436 GPIO_FN(SCK0),
433 PINMUX_GPIO(GPIO_FN_IRL3, IRL3_MARK), 437 GPIO_FN(IRL3),
434 PINMUX_GPIO(GPIO_FN_IRL2, IRL2_MARK), 438 GPIO_FN(IRL2),
435 PINMUX_GPIO(GPIO_FN_IRL1, IRL1_MARK), 439 GPIO_FN(IRL1),
436 PINMUX_GPIO(GPIO_FN_IRL0, IRL0_MARK), 440 GPIO_FN(IRL0),
437 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK), 441 GPIO_FN(TXD3),
438 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK), 442 GPIO_FN(TXD2),
439 PINMUX_GPIO(GPIO_FN_TXD1, TXD1_MARK), 443 GPIO_FN(TXD1),
440 PINMUX_GPIO(GPIO_FN_TXD0, TXD0_MARK), 444 GPIO_FN(TXD0),
441 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK), 445 GPIO_FN(RXD3),
442 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK), 446 GPIO_FN(RXD2),
443 PINMUX_GPIO(GPIO_FN_RXD1, RXD1_MARK), 447 GPIO_FN(RXD1),
444 PINMUX_GPIO(GPIO_FN_RXD0, RXD0_MARK), 448 GPIO_FN(RXD0),
445 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK), 449 GPIO_FN(CE2B),
446 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK), 450 GPIO_FN(CE2A),
447 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK), 451 GPIO_FN(IOIS16),
448 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK), 452 GPIO_FN(STATUS1),
449 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 453 GPIO_FN(STATUS0),
450 PINMUX_GPIO(GPIO_FN_IRQOUT, IRQOUT_MARK), 454 GPIO_FN(IRQOUT),
451}; 455};
452 456
453static struct pinmux_cfg_reg shx3_pinmux_config_regs[] = { 457static const struct pinmux_cfg_reg shx3_pinmux_config_regs[] = {
454 { PINMUX_CFG_REG("PABCR", 0xffc70000, 32, 2) { 458 { PINMUX_CFG_REG("PABCR", 0xffc70000, 32, 2) {
455 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU, 459 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU,
456 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU, 460 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU,
@@ -526,7 +530,7 @@ static struct pinmux_cfg_reg shx3_pinmux_config_regs[] = {
526 { }, 530 { },
527}; 531};
528 532
529static struct pinmux_data_reg shx3_pinmux_data_regs[] = { 533static const struct pinmux_data_reg shx3_pinmux_data_regs[] = {
530 { PINMUX_DATA_REG("PABDR", 0xffc70010, 32) { 534 { PINMUX_DATA_REG("PABDR", 0xffc70010, 32) {
531 0, 0, 0, 0, 0, 0, 0, 0, 535 0, 0, 0, 0, 0, 0, 0, 0,
532 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA, 536 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
@@ -562,19 +566,17 @@ static struct pinmux_data_reg shx3_pinmux_data_regs[] = {
562 { }, 566 { },
563}; 567};
564 568
565struct sh_pfc_soc_info shx3_pinmux_info = { 569const struct sh_pfc_soc_info shx3_pinmux_info = {
566 .name = "shx3_pfc", 570 .name = "shx3_pfc",
567 .reserved_id = PINMUX_RESERVED,
568 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
569 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 571 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
570 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, 572 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN,
571 PINMUX_INPUT_PULLUP_END }, 573 PINMUX_INPUT_PULLUP_END },
572 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 574 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
573 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
574 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 575 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
575 .first_gpio = GPIO_PA7, 576 .pins = shx3_pinmux_pins,
576 .last_gpio = GPIO_FN_STATUS0, 577 .nr_pins = ARRAY_SIZE(shx3_pinmux_pins),
577 .gpios = shx3_pinmux_gpios, 578 .func_gpios = shx3_pinmux_func_gpios,
579 .nr_func_gpios = ARRAY_SIZE(shx3_pinmux_func_gpios),
578 .gpio_data = shx3_pinmux_data, 580 .gpio_data = shx3_pinmux_data,
579 .gpio_data_size = ARRAY_SIZE(shx3_pinmux_data), 581 .gpio_data_size = ARRAY_SIZE(shx3_pinmux_data),
580 .cfg_regs = shx3_pinmux_config_regs, 582 .cfg_regs = shx3_pinmux_config_regs,
diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index 11e0e1374d65..aef268bc17ba 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#define DRV_NAME "sh-pfc" 11#define DRV_NAME "sh-pfc"
12#define pr_fmt(fmt) KBUILD_MODNAME " pinctrl: " fmt
13 12
14#include <linux/device.h> 13#include <linux/device.h>
15#include <linux/err.h> 14#include <linux/err.h>
@@ -24,25 +23,28 @@
24#include <linux/spinlock.h> 23#include <linux/spinlock.h>
25 24
26#include "core.h" 25#include "core.h"
26#include "../core.h"
27#include "../pinconf.h"
28
29struct sh_pfc_pin_config {
30 u32 type;
31};
27 32
28struct sh_pfc_pinctrl { 33struct sh_pfc_pinctrl {
29 struct pinctrl_dev *pctl; 34 struct pinctrl_dev *pctl;
30 struct sh_pfc *pfc; 35 struct pinctrl_desc pctl_desc;
31
32 struct pinmux_gpio **functions;
33 unsigned int nr_functions;
34 36
35 struct pinctrl_pin_desc *pads; 37 struct sh_pfc *pfc;
36 unsigned int nr_pads;
37 38
38 spinlock_t lock; 39 struct pinctrl_pin_desc *pins;
40 struct sh_pfc_pin_config *configs;
39}; 41};
40 42
41static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev) 43static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev)
42{ 44{
43 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 45 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
44 46
45 return pmx->nr_pads; 47 return pmx->pfc->info->nr_groups;
46} 48}
47 49
48static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev, 50static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev,
@@ -50,16 +52,16 @@ static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev,
50{ 52{
51 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 53 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
52 54
53 return pmx->pads[selector].name; 55 return pmx->pfc->info->groups[selector].name;
54} 56}
55 57
56static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned group, 58static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
57 const unsigned **pins, unsigned *num_pins) 59 const unsigned **pins, unsigned *num_pins)
58{ 60{
59 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 61 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
60 62
61 *pins = &pmx->pads[group].number; 63 *pins = pmx->pfc->info->groups[selector].pins;
62 *num_pins = 1; 64 *num_pins = pmx->pfc->info->groups[selector].nr_pins;
63 65
64 return 0; 66 return 0;
65} 67}
@@ -70,7 +72,7 @@ static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
70 seq_printf(s, "%s", DRV_NAME); 72 seq_printf(s, "%s", DRV_NAME);
71} 73}
72 74
73static struct pinctrl_ops sh_pfc_pinctrl_ops = { 75static const struct pinctrl_ops sh_pfc_pinctrl_ops = {
74 .get_groups_count = sh_pfc_get_groups_count, 76 .get_groups_count = sh_pfc_get_groups_count,
75 .get_group_name = sh_pfc_get_group_name, 77 .get_group_name = sh_pfc_get_group_name,
76 .get_group_pins = sh_pfc_get_group_pins, 78 .get_group_pins = sh_pfc_get_group_pins,
@@ -81,7 +83,7 @@ static int sh_pfc_get_functions_count(struct pinctrl_dev *pctldev)
81{ 83{
82 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 84 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
83 85
84 return pmx->nr_functions; 86 return pmx->pfc->info->nr_functions;
85} 87}
86 88
87static const char *sh_pfc_get_function_name(struct pinctrl_dev *pctldev, 89static const char *sh_pfc_get_function_name(struct pinctrl_dev *pctldev,
@@ -89,136 +91,102 @@ static const char *sh_pfc_get_function_name(struct pinctrl_dev *pctldev,
89{ 91{
90 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 92 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
91 93
92 return pmx->functions[selector]->name; 94 return pmx->pfc->info->functions[selector].name;
93} 95}
94 96
95static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev, unsigned func, 97static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev,
98 unsigned selector,
96 const char * const **groups, 99 const char * const **groups,
97 unsigned * const num_groups) 100 unsigned * const num_groups)
98{ 101{
99 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 102 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
100 103
101 *groups = &pmx->functions[func]->name; 104 *groups = pmx->pfc->info->functions[selector].groups;
102 *num_groups = 1; 105 *num_groups = pmx->pfc->info->functions[selector].nr_groups;
103 106
104 return 0; 107 return 0;
105} 108}
106 109
107static int sh_pfc_noop_enable(struct pinctrl_dev *pctldev, unsigned func, 110static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector,
108 unsigned group) 111 unsigned group)
109{ 112{
110 return 0; 113 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
111} 114 struct sh_pfc *pfc = pmx->pfc;
115 const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
116 unsigned long flags;
117 unsigned int i;
118 int ret = 0;
112 119
113static void sh_pfc_noop_disable(struct pinctrl_dev *pctldev, unsigned func, 120 spin_lock_irqsave(&pfc->lock, flags);
114 unsigned group)
115{
116}
117 121
118static int sh_pfc_config_function(struct sh_pfc *pfc, unsigned offset) 122 for (i = 0; i < grp->nr_pins; ++i) {
119{ 123 int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
120 if (sh_pfc_config_gpio(pfc, offset, 124 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
121 PINMUX_TYPE_FUNCTION,
122 GPIO_CFG_DRYRUN) != 0)
123 return -EINVAL;
124 125
125 if (sh_pfc_config_gpio(pfc, offset, 126 if (cfg->type != PINMUX_TYPE_NONE) {
126 PINMUX_TYPE_FUNCTION, 127 ret = -EBUSY;
127 GPIO_CFG_REQ) != 0) 128 goto done;
128 return -EINVAL; 129 }
130 }
129 131
130 return 0; 132 for (i = 0; i < grp->nr_pins; ++i) {
133 ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
134 if (ret < 0)
135 break;
136 }
137
138done:
139 spin_unlock_irqrestore(&pfc->lock, flags);
140 return ret;
131} 141}
132 142
133static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, 143static void sh_pfc_func_disable(struct pinctrl_dev *pctldev, unsigned selector,
134 int new_type) 144 unsigned group)
135{ 145{
146 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
147 struct sh_pfc *pfc = pmx->pfc;
148 const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
136 unsigned long flags; 149 unsigned long flags;
137 int pinmux_type; 150 unsigned int i;
138 int ret = -EINVAL;
139 151
140 spin_lock_irqsave(&pfc->lock, flags); 152 spin_lock_irqsave(&pfc->lock, flags);
141 153
142 pinmux_type = pfc->info->gpios[offset].flags & PINMUX_FLAG_TYPE; 154 for (i = 0; i < grp->nr_pins; ++i) {
155 int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
156 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
143 157
144 /* 158 cfg->type = PINMUX_TYPE_NONE;
145 * See if the present config needs to first be de-configured.
146 */
147 switch (pinmux_type) {
148 case PINMUX_TYPE_GPIO:
149 break;
150 case PINMUX_TYPE_OUTPUT:
151 case PINMUX_TYPE_INPUT:
152 case PINMUX_TYPE_INPUT_PULLUP:
153 case PINMUX_TYPE_INPUT_PULLDOWN:
154 sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE);
155 break;
156 default:
157 goto err;
158 } 159 }
159 160
160 /*
161 * Dry run
162 */
163 if (sh_pfc_config_gpio(pfc, offset, new_type,
164 GPIO_CFG_DRYRUN) != 0)
165 goto err;
166
167 /*
168 * Request
169 */
170 if (sh_pfc_config_gpio(pfc, offset, new_type,
171 GPIO_CFG_REQ) != 0)
172 goto err;
173
174 pfc->info->gpios[offset].flags &= ~PINMUX_FLAG_TYPE;
175 pfc->info->gpios[offset].flags |= new_type;
176
177 ret = 0;
178
179err:
180 spin_unlock_irqrestore(&pfc->lock, flags); 161 spin_unlock_irqrestore(&pfc->lock, flags);
181
182 return ret;
183} 162}
184 163
185
186static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, 164static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
187 struct pinctrl_gpio_range *range, 165 struct pinctrl_gpio_range *range,
188 unsigned offset) 166 unsigned offset)
189{ 167{
190 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 168 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
191 struct sh_pfc *pfc = pmx->pfc; 169 struct sh_pfc *pfc = pmx->pfc;
170 int idx = sh_pfc_get_pin_index(pfc, offset);
171 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
192 unsigned long flags; 172 unsigned long flags;
193 int ret, pinmux_type; 173 int ret;
194 174
195 spin_lock_irqsave(&pfc->lock, flags); 175 spin_lock_irqsave(&pfc->lock, flags);
196 176
197 pinmux_type = pfc->info->gpios[offset].flags & PINMUX_FLAG_TYPE; 177 if (cfg->type != PINMUX_TYPE_NONE) {
198 178 dev_err(pfc->dev,
199 switch (pinmux_type) { 179 "Pin %u is busy, can't configure it as GPIO.\n",
200 case PINMUX_TYPE_FUNCTION: 180 offset);
201 pr_notice_once("Use of GPIO API for function requests is " 181 ret = -EBUSY;
202 "deprecated, convert to pinctrl\n"); 182 goto done;
203 /* handle for now */
204 ret = sh_pfc_config_function(pfc, offset);
205 if (unlikely(ret < 0))
206 goto err;
207
208 break;
209 case PINMUX_TYPE_GPIO:
210 case PINMUX_TYPE_INPUT:
211 case PINMUX_TYPE_OUTPUT:
212 break;
213 default:
214 pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type);
215 ret = -ENOTSUPP;
216 goto err;
217 } 183 }
218 184
185 cfg->type = PINMUX_TYPE_GPIO;
186
219 ret = 0; 187 ret = 0;
220 188
221err: 189done:
222 spin_unlock_irqrestore(&pfc->lock, flags); 190 spin_unlock_irqrestore(&pfc->lock, flags);
223 191
224 return ret; 192 return ret;
@@ -230,15 +198,12 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
230{ 198{
231 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 199 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
232 struct sh_pfc *pfc = pmx->pfc; 200 struct sh_pfc *pfc = pmx->pfc;
201 int idx = sh_pfc_get_pin_index(pfc, offset);
202 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
233 unsigned long flags; 203 unsigned long flags;
234 int pinmux_type;
235 204
236 spin_lock_irqsave(&pfc->lock, flags); 205 spin_lock_irqsave(&pfc->lock, flags);
237 206 cfg->type = PINMUX_TYPE_NONE;
238 pinmux_type = pfc->info->gpios[offset].flags & PINMUX_FLAG_TYPE;
239
240 sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE);
241
242 spin_unlock_irqrestore(&pfc->lock, flags); 207 spin_unlock_irqrestore(&pfc->lock, flags);
243} 208}
244 209
@@ -247,207 +212,242 @@ static int sh_pfc_gpio_set_direction(struct pinctrl_dev *pctldev,
247 unsigned offset, bool input) 212 unsigned offset, bool input)
248{ 213{
249 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 214 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
250 int type = input ? PINMUX_TYPE_INPUT : PINMUX_TYPE_OUTPUT; 215 struct sh_pfc *pfc = pmx->pfc;
216 int new_type = input ? PINMUX_TYPE_INPUT : PINMUX_TYPE_OUTPUT;
217 int idx = sh_pfc_get_pin_index(pfc, offset);
218 const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
219 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
220 unsigned long flags;
221 unsigned int dir;
222 int ret;
223
224 /* Check if the requested direction is supported by the pin. Not all SoC
225 * provide pin config data, so perform the check conditionally.
226 */
227 if (pin->configs) {
228 dir = input ? SH_PFC_PIN_CFG_INPUT : SH_PFC_PIN_CFG_OUTPUT;
229 if (!(pin->configs & dir))
230 return -EINVAL;
231 }
232
233 spin_lock_irqsave(&pfc->lock, flags);
234
235 ret = sh_pfc_config_mux(pfc, pin->enum_id, new_type);
236 if (ret < 0)
237 goto done;
238
239 cfg->type = new_type;
251 240
252 return sh_pfc_reconfig_pin(pmx->pfc, offset, type); 241done:
242 spin_unlock_irqrestore(&pfc->lock, flags);
243 return ret;
253} 244}
254 245
255static struct pinmux_ops sh_pfc_pinmux_ops = { 246static const struct pinmux_ops sh_pfc_pinmux_ops = {
256 .get_functions_count = sh_pfc_get_functions_count, 247 .get_functions_count = sh_pfc_get_functions_count,
257 .get_function_name = sh_pfc_get_function_name, 248 .get_function_name = sh_pfc_get_function_name,
258 .get_function_groups = sh_pfc_get_function_groups, 249 .get_function_groups = sh_pfc_get_function_groups,
259 .enable = sh_pfc_noop_enable, 250 .enable = sh_pfc_func_enable,
260 .disable = sh_pfc_noop_disable, 251 .disable = sh_pfc_func_disable,
261 .gpio_request_enable = sh_pfc_gpio_request_enable, 252 .gpio_request_enable = sh_pfc_gpio_request_enable,
262 .gpio_disable_free = sh_pfc_gpio_disable_free, 253 .gpio_disable_free = sh_pfc_gpio_disable_free,
263 .gpio_set_direction = sh_pfc_gpio_set_direction, 254 .gpio_set_direction = sh_pfc_gpio_set_direction,
264}; 255};
265 256
266static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, 257/* Check whether the requested parameter is supported for a pin. */
267 unsigned long *config) 258static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc, unsigned int _pin,
259 enum pin_config_param param)
268{ 260{
269 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 261 int idx = sh_pfc_get_pin_index(pfc, _pin);
270 struct sh_pfc *pfc = pmx->pfc; 262 const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
271 263
272 *config = pfc->info->gpios[pin].flags & PINMUX_FLAG_TYPE; 264 switch (param) {
265 case PIN_CONFIG_BIAS_DISABLE:
266 return true;
273 267
274 return 0; 268 case PIN_CONFIG_BIAS_PULL_UP:
275} 269 return pin->configs & SH_PFC_PIN_CFG_PULL_UP;
276 270
277static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin, 271 case PIN_CONFIG_BIAS_PULL_DOWN:
278 unsigned long config) 272 return pin->configs & SH_PFC_PIN_CFG_PULL_DOWN;
279{
280 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
281
282 /* Validate the new type */
283 if (config >= PINMUX_FLAG_TYPE)
284 return -EINVAL;
285 273
286 return sh_pfc_reconfig_pin(pmx->pfc, pin, config); 274 default:
275 return false;
276 }
287} 277}
288 278
289static void sh_pfc_pinconf_dbg_show(struct pinctrl_dev *pctldev, 279static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
290 struct seq_file *s, unsigned pin) 280 unsigned long *config)
291{ 281{
292 const char *pinmux_type_str[] = { 282 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
293 [PINMUX_TYPE_NONE] = "none", 283 struct sh_pfc *pfc = pmx->pfc;
294 [PINMUX_TYPE_FUNCTION] = "function", 284 enum pin_config_param param = pinconf_to_config_param(*config);
295 [PINMUX_TYPE_GPIO] = "gpio", 285 unsigned long flags;
296 [PINMUX_TYPE_OUTPUT] = "output", 286 unsigned int bias;
297 [PINMUX_TYPE_INPUT] = "input",
298 [PINMUX_TYPE_INPUT_PULLUP] = "input bias pull up",
299 [PINMUX_TYPE_INPUT_PULLDOWN] = "input bias pull down",
300 };
301 unsigned long config;
302 int rc;
303
304 rc = sh_pfc_pinconf_get(pctldev, pin, &config);
305 if (unlikely(rc != 0))
306 return;
307
308 seq_printf(s, " %s", pinmux_type_str[config]);
309}
310 287
311static struct pinconf_ops sh_pfc_pinconf_ops = { 288 if (!sh_pfc_pinconf_validate(pfc, _pin, param))
312 .pin_config_get = sh_pfc_pinconf_get, 289 return -ENOTSUPP;
313 .pin_config_set = sh_pfc_pinconf_set,
314 .pin_config_dbg_show = sh_pfc_pinconf_dbg_show,
315};
316 290
317static struct pinctrl_gpio_range sh_pfc_gpio_range = { 291 switch (param) {
318 .name = DRV_NAME, 292 case PIN_CONFIG_BIAS_DISABLE:
319 .id = 0, 293 case PIN_CONFIG_BIAS_PULL_UP:
320}; 294 case PIN_CONFIG_BIAS_PULL_DOWN:
295 if (!pfc->info->ops || !pfc->info->ops->get_bias)
296 return -ENOTSUPP;
321 297
322static struct pinctrl_desc sh_pfc_pinctrl_desc = { 298 spin_lock_irqsave(&pfc->lock, flags);
323 .name = DRV_NAME, 299 bias = pfc->info->ops->get_bias(pfc, _pin);
324 .owner = THIS_MODULE, 300 spin_unlock_irqrestore(&pfc->lock, flags);
325 .pctlops = &sh_pfc_pinctrl_ops,
326 .pmxops = &sh_pfc_pinmux_ops,
327 .confops = &sh_pfc_pinconf_ops,
328};
329 301
330static void sh_pfc_map_one_gpio(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx, 302 if (bias != param)
331 struct pinmux_gpio *gpio, unsigned offset) 303 return -EINVAL;
332{
333 struct pinmux_data_reg *dummy;
334 unsigned long flags;
335 int bit;
336
337 gpio->flags &= ~PINMUX_FLAG_TYPE;
338 304
339 if (sh_pfc_get_data_reg(pfc, offset, &dummy, &bit) == 0) 305 *config = 0;
340 gpio->flags |= PINMUX_TYPE_GPIO; 306 break;
341 else {
342 gpio->flags |= PINMUX_TYPE_FUNCTION;
343 307
344 spin_lock_irqsave(&pmx->lock, flags); 308 default:
345 pmx->nr_functions++; 309 return -ENOTSUPP;
346 spin_unlock_irqrestore(&pmx->lock, flags);
347 } 310 }
311
312 return 0;
348} 313}
349 314
350/* pinmux ranges -> pinctrl pin descs */ 315static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned _pin,
351static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) 316 unsigned long config)
352{ 317{
318 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
319 struct sh_pfc *pfc = pmx->pfc;
320 enum pin_config_param param = pinconf_to_config_param(config);
353 unsigned long flags; 321 unsigned long flags;
354 int i;
355 322
356 pmx->nr_pads = pfc->info->last_gpio - pfc->info->first_gpio + 1; 323 if (!sh_pfc_pinconf_validate(pfc, _pin, param))
324 return -ENOTSUPP;
357 325
358 pmx->pads = devm_kzalloc(pfc->dev, sizeof(*pmx->pads) * pmx->nr_pads, 326 switch (param) {
359 GFP_KERNEL); 327 case PIN_CONFIG_BIAS_PULL_UP:
360 if (unlikely(!pmx->pads)) { 328 case PIN_CONFIG_BIAS_PULL_DOWN:
361 pmx->nr_pads = 0; 329 case PIN_CONFIG_BIAS_DISABLE:
362 return -ENOMEM; 330 if (!pfc->info->ops || !pfc->info->ops->set_bias)
363 } 331 return -ENOTSUPP;
364 332
365 spin_lock_irqsave(&pfc->lock, flags); 333 spin_lock_irqsave(&pfc->lock, flags);
334 pfc->info->ops->set_bias(pfc, _pin, param);
335 spin_unlock_irqrestore(&pfc->lock, flags);
366 336
367 /* 337 break;
368 * We don't necessarily have a 1:1 mapping between pin and linux
369 * GPIO number, as the latter maps to the associated enum_id.
370 * Care needs to be taken to translate back to pin space when
371 * dealing with any pin configurations.
372 */
373 for (i = 0; i < pmx->nr_pads; i++) {
374 struct pinctrl_pin_desc *pin = pmx->pads + i;
375 struct pinmux_gpio *gpio = pfc->info->gpios + i;
376 338
377 pin->number = pfc->info->first_gpio + i; 339 default:
378 pin->name = gpio->name; 340 return -ENOTSUPP;
341 }
379 342
380 /* XXX */ 343 return 0;
381 if (unlikely(!gpio->enum_id)) 344}
382 continue;
383 345
384 sh_pfc_map_one_gpio(pfc, pmx, gpio, i); 346static int sh_pfc_pinconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
385 } 347 unsigned long config)
348{
349 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
350 const unsigned int *pins;
351 unsigned int num_pins;
352 unsigned int i;
386 353
387 spin_unlock_irqrestore(&pfc->lock, flags); 354 pins = pmx->pfc->info->groups[group].pins;
355 num_pins = pmx->pfc->info->groups[group].nr_pins;
388 356
389 sh_pfc_pinctrl_desc.pins = pmx->pads; 357 for (i = 0; i < num_pins; ++i)
390 sh_pfc_pinctrl_desc.npins = pmx->nr_pads; 358 sh_pfc_pinconf_set(pctldev, pins[i], config);
391 359
392 return 0; 360 return 0;
393} 361}
394 362
395static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) 363static const struct pinconf_ops sh_pfc_pinconf_ops = {
364 .is_generic = true,
365 .pin_config_get = sh_pfc_pinconf_get,
366 .pin_config_set = sh_pfc_pinconf_set,
367 .pin_config_group_set = sh_pfc_pinconf_group_set,
368 .pin_config_config_dbg_show = pinconf_generic_dump_config,
369};
370
371/* PFC ranges -> pinctrl pin descs */
372static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
396{ 373{
397 unsigned long flags; 374 const struct pinmux_range *ranges;
398 int i, fn; 375 struct pinmux_range def_range;
376 unsigned int nr_ranges;
377 unsigned int nr_pins;
378 unsigned int i;
379
380 if (pfc->info->ranges == NULL) {
381 def_range.begin = 0;
382 def_range.end = pfc->info->nr_pins - 1;
383 ranges = &def_range;
384 nr_ranges = 1;
385 } else {
386 ranges = pfc->info->ranges;
387 nr_ranges = pfc->info->nr_ranges;
388 }
399 389
400 pmx->functions = devm_kzalloc(pfc->dev, pmx->nr_functions * 390 pmx->pins = devm_kzalloc(pfc->dev,
401 sizeof(*pmx->functions), GFP_KERNEL); 391 sizeof(*pmx->pins) * pfc->info->nr_pins,
402 if (unlikely(!pmx->functions)) 392 GFP_KERNEL);
393 if (unlikely(!pmx->pins))
403 return -ENOMEM; 394 return -ENOMEM;
404 395
405 spin_lock_irqsave(&pmx->lock, flags); 396 pmx->configs = devm_kzalloc(pfc->dev,
406 397 sizeof(*pmx->configs) * pfc->info->nr_pins,
407 for (i = fn = 0; i < pmx->nr_pads; i++) { 398 GFP_KERNEL);
408 struct pinmux_gpio *gpio = pfc->info->gpios + i; 399 if (unlikely(!pmx->configs))
400 return -ENOMEM;
409 401
410 if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION) 402 for (i = 0, nr_pins = 0; i < nr_ranges; ++i) {
411 pmx->functions[fn++] = gpio; 403 const struct pinmux_range *range = &ranges[i];
404 unsigned int number;
405
406 for (number = range->begin; number <= range->end;
407 number++, nr_pins++) {
408 struct sh_pfc_pin_config *cfg = &pmx->configs[nr_pins];
409 struct pinctrl_pin_desc *pin = &pmx->pins[nr_pins];
410 const struct sh_pfc_pin *info =
411 &pfc->info->pins[nr_pins];
412
413 pin->number = number;
414 pin->name = info->name;
415 cfg->type = PINMUX_TYPE_NONE;
416 }
412 } 417 }
413 418
414 spin_unlock_irqrestore(&pmx->lock, flags); 419 pfc->nr_pins = ranges[nr_ranges-1].end + 1;
415 420
416 return 0; 421 return nr_ranges;
417} 422}
418 423
419int sh_pfc_register_pinctrl(struct sh_pfc *pfc) 424int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
420{ 425{
421 struct sh_pfc_pinctrl *pmx; 426 struct sh_pfc_pinctrl *pmx;
422 int ret; 427 int nr_ranges;
423 428
424 pmx = devm_kzalloc(pfc->dev, sizeof(*pmx), GFP_KERNEL); 429 pmx = devm_kzalloc(pfc->dev, sizeof(*pmx), GFP_KERNEL);
425 if (unlikely(!pmx)) 430 if (unlikely(!pmx))
426 return -ENOMEM; 431 return -ENOMEM;
427 432
428 spin_lock_init(&pmx->lock);
429
430 pmx->pfc = pfc; 433 pmx->pfc = pfc;
431 pfc->pinctrl = pmx; 434 pfc->pinctrl = pmx;
432 435
433 ret = sh_pfc_map_gpios(pfc, pmx); 436 nr_ranges = sh_pfc_map_pins(pfc, pmx);
434 if (unlikely(ret != 0)) 437 if (unlikely(nr_ranges < 0))
435 return ret; 438 return nr_ranges;
436 439
437 ret = sh_pfc_map_functions(pfc, pmx); 440 pmx->pctl_desc.name = DRV_NAME;
438 if (unlikely(ret != 0)) 441 pmx->pctl_desc.owner = THIS_MODULE;
439 return ret; 442 pmx->pctl_desc.pctlops = &sh_pfc_pinctrl_ops;
443 pmx->pctl_desc.pmxops = &sh_pfc_pinmux_ops;
444 pmx->pctl_desc.confops = &sh_pfc_pinconf_ops;
445 pmx->pctl_desc.pins = pmx->pins;
446 pmx->pctl_desc.npins = pfc->info->nr_pins;
440 447
441 pmx->pctl = pinctrl_register(&sh_pfc_pinctrl_desc, pfc->dev, pmx); 448 pmx->pctl = pinctrl_register(&pmx->pctl_desc, pfc->dev, pmx);
442 if (IS_ERR(pmx->pctl)) 449 if (pmx->pctl == NULL)
443 return PTR_ERR(pmx->pctl); 450 return -EINVAL;
444
445 sh_pfc_gpio_range.npins = pfc->info->last_gpio
446 - pfc->info->first_gpio + 1;
447 sh_pfc_gpio_range.base = pfc->info->first_gpio;
448 sh_pfc_gpio_range.pin_base = pfc->info->first_gpio;
449
450 pinctrl_add_gpio_range(pmx->pctl, &sh_pfc_gpio_range);
451 451
452 return 0; 452 return 0;
453} 453}
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 13049c4c8d30..3b785fc428d5 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -15,7 +15,8 @@
15#include <asm-generic/gpio.h> 15#include <asm-generic/gpio.h>
16 16
17typedef unsigned short pinmux_enum_t; 17typedef unsigned short pinmux_enum_t;
18typedef unsigned short pinmux_flag_t; 18
19#define SH_PFC_MARK_INVALID ((pinmux_enum_t)-1)
19 20
20enum { 21enum {
21 PINMUX_TYPE_NONE, 22 PINMUX_TYPE_NONE,
@@ -30,44 +31,81 @@ enum {
30 PINMUX_FLAG_TYPE, /* must be last */ 31 PINMUX_FLAG_TYPE, /* must be last */
31}; 32};
32 33
33#define PINMUX_FLAG_DBIT_SHIFT 5 34#define SH_PFC_PIN_CFG_INPUT (1 << 0)
34#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT) 35#define SH_PFC_PIN_CFG_OUTPUT (1 << 1)
35#define PINMUX_FLAG_DREG_SHIFT 10 36#define SH_PFC_PIN_CFG_PULL_UP (1 << 2)
36#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT) 37#define SH_PFC_PIN_CFG_PULL_DOWN (1 << 3)
37 38
38struct pinmux_gpio { 39struct sh_pfc_pin {
39 pinmux_enum_t enum_id; 40 const pinmux_enum_t enum_id;
40 pinmux_flag_t flags;
41 const char *name; 41 const char *name;
42 unsigned int configs;
42}; 43};
43 44
44#define PINMUX_GPIO(gpio, data_or_mark) \ 45#define SH_PFC_PIN_GROUP(n) \
45 [gpio] = { .name = __stringify(gpio), .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE } 46 { \
47 .name = #n, \
48 .pins = n##_pins, \
49 .mux = n##_mux, \
50 .nr_pins = ARRAY_SIZE(n##_pins), \
51 }
52
53struct sh_pfc_pin_group {
54 const char *name;
55 const unsigned int *pins;
56 const unsigned int *mux;
57 unsigned int nr_pins;
58};
59
60#define SH_PFC_FUNCTION(n) \
61 { \
62 .name = #n, \
63 .groups = n##_groups, \
64 .nr_groups = ARRAY_SIZE(n##_groups), \
65 }
66
67struct sh_pfc_function {
68 const char *name;
69 const char * const *groups;
70 unsigned int nr_groups;
71};
72
73struct pinmux_func {
74 const pinmux_enum_t enum_id;
75 const char *name;
76};
77
78#define PINMUX_GPIO(gpio, data_or_mark) \
79 [gpio] = { \
80 .name = __stringify(gpio), \
81 .enum_id = data_or_mark, \
82 }
83#define PINMUX_GPIO_FN(gpio, base, data_or_mark) \
84 [gpio - (base)] = { \
85 .name = __stringify(gpio), \
86 .enum_id = data_or_mark, \
87 }
46 88
47#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 89#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
48 90
49struct pinmux_cfg_reg { 91struct pinmux_cfg_reg {
50 unsigned long reg, reg_width, field_width; 92 unsigned long reg, reg_width, field_width;
51 unsigned long *cnt; 93 const pinmux_enum_t *enum_ids;
52 pinmux_enum_t *enum_ids; 94 const unsigned long *var_field_width;
53 unsigned long *var_field_width;
54}; 95};
55 96
56#define PINMUX_CFG_REG(name, r, r_width, f_width) \ 97#define PINMUX_CFG_REG(name, r, r_width, f_width) \
57 .reg = r, .reg_width = r_width, .field_width = f_width, \ 98 .reg = r, .reg_width = r_width, .field_width = f_width, \
58 .cnt = (unsigned long [r_width / f_width]) {}, \
59 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) 99 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
60 100
61#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \ 101#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
62 .reg = r, .reg_width = r_width, \ 102 .reg = r, .reg_width = r_width, \
63 .cnt = (unsigned long [r_width]) {}, \
64 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \ 103 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
65 .enum_ids = (pinmux_enum_t []) 104 .enum_ids = (pinmux_enum_t [])
66 105
67struct pinmux_data_reg { 106struct pinmux_data_reg {
68 unsigned long reg, reg_width, reg_shadow; 107 unsigned long reg, reg_width;
69 pinmux_enum_t *enum_ids; 108 const pinmux_enum_t *enum_ids;
70 void __iomem *mapped_reg;
71}; 109};
72 110
73#define PINMUX_DATA_REG(name, r, r_width) \ 111#define PINMUX_DATA_REG(name, r, r_width) \
@@ -76,11 +114,11 @@ struct pinmux_data_reg {
76 114
77struct pinmux_irq { 115struct pinmux_irq {
78 int irq; 116 int irq;
79 pinmux_enum_t *enum_ids; 117 unsigned short *gpios;
80}; 118};
81 119
82#define PINMUX_IRQ(irq_nr, ids...) \ 120#define PINMUX_IRQ(irq_nr, ids...) \
83 { .irq = irq_nr, .enum_ids = (pinmux_enum_t []) { ids, 0 } } \ 121 { .irq = irq_nr, .gpios = (unsigned short []) { ids, 0 } } \
84 122
85struct pinmux_range { 123struct pinmux_range {
86 pinmux_enum_t begin; 124 pinmux_enum_t begin;
@@ -88,33 +126,49 @@ struct pinmux_range {
88 pinmux_enum_t force; 126 pinmux_enum_t force;
89}; 127};
90 128
129struct sh_pfc;
130
131struct sh_pfc_soc_operations {
132 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
133 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
134 unsigned int bias);
135};
136
91struct sh_pfc_soc_info { 137struct sh_pfc_soc_info {
92 char *name; 138 const char *name;
93 pinmux_enum_t reserved_id; 139 const struct sh_pfc_soc_operations *ops;
94 struct pinmux_range data; 140
95 struct pinmux_range input; 141 struct pinmux_range input;
96 struct pinmux_range input_pd; 142 struct pinmux_range input_pd;
97 struct pinmux_range input_pu; 143 struct pinmux_range input_pu;
98 struct pinmux_range output; 144 struct pinmux_range output;
99 struct pinmux_range mark;
100 struct pinmux_range function; 145 struct pinmux_range function;
101 146
102 unsigned first_gpio, last_gpio; 147 const struct sh_pfc_pin *pins;
148 unsigned int nr_pins;
149 const struct pinmux_range *ranges;
150 unsigned int nr_ranges;
151 const struct sh_pfc_pin_group *groups;
152 unsigned int nr_groups;
153 const struct sh_pfc_function *functions;
154 unsigned int nr_functions;
155
156 const struct pinmux_func *func_gpios;
157 unsigned int nr_func_gpios;
103 158
104 struct pinmux_gpio *gpios; 159 const struct pinmux_cfg_reg *cfg_regs;
105 struct pinmux_cfg_reg *cfg_regs; 160 const struct pinmux_data_reg *data_regs;
106 struct pinmux_data_reg *data_regs;
107 161
108 pinmux_enum_t *gpio_data; 162 const pinmux_enum_t *gpio_data;
109 unsigned int gpio_data_size; 163 unsigned int gpio_data_size;
110 164
111 struct pinmux_irq *gpio_irq; 165 const struct pinmux_irq *gpio_irq;
112 unsigned int gpio_irq_size; 166 unsigned int gpio_irq_size;
113 167
114 unsigned long unlock_reg; 168 unsigned long unlock_reg;
115}; 169};
116 170
117enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }; 171enum { GPIO_CFG_REQ, GPIO_CFG_FREE };
118 172
119/* helper macro for port */ 173/* helper macro for port */
120#define PORT_1(fn, pfx, sfx) fn(pfx, sfx) 174#define PORT_1(fn, pfx, sfx) fn(pfx, sfx)
@@ -126,6 +180,23 @@ enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE };
126 PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \ 180 PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
127 PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx) 181 PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx)
128 182
183#define PORT_10_REV(fn, pfx, sfx) \
184 PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \
185 PORT_1(fn, pfx##7, sfx), PORT_1(fn, pfx##6, sfx), \
186 PORT_1(fn, pfx##5, sfx), PORT_1(fn, pfx##4, sfx), \
187 PORT_1(fn, pfx##3, sfx), PORT_1(fn, pfx##2, sfx), \
188 PORT_1(fn, pfx##1, sfx), PORT_1(fn, pfx##0, sfx)
189
190#define PORT_32(fn, pfx, sfx) \
191 PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \
192 PORT_10(fn, pfx##2, sfx), PORT_1(fn, pfx##30, sfx), \
193 PORT_1(fn, pfx##31, sfx)
194
195#define PORT_32_REV(fn, pfx, sfx) \
196 PORT_1(fn, pfx##31, sfx), PORT_1(fn, pfx##30, sfx), \
197 PORT_10_REV(fn, pfx##2, sfx), PORT_10_REV(fn, pfx##1, sfx), \
198 PORT_10_REV(fn, pfx, sfx)
199
129#define PORT_90(fn, pfx, sfx) \ 200#define PORT_90(fn, pfx, sfx) \
130 PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \ 201 PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \
131 PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \ 202 PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \
@@ -137,7 +208,7 @@ enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE };
137#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) 208#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
138#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str) 209#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str)
139#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused) 210#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused)
140#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) 211#define GPIO_FN(str) PINMUX_GPIO_FN(GPIO_FN_##str, PINMUX_FN_BASE, str##_MARK)
141 212
142/* helper macro for pinmux_enum_t */ 213/* helper macro for pinmux_enum_t */
143#define PORT_DATA_I(nr) \ 214#define PORT_DATA_I(nr) \
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 6a7dae70db08..116da0412c4b 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -198,7 +198,7 @@ static void spear_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
198 kfree(map); 198 kfree(map);
199} 199}
200 200
201static struct pinctrl_ops spear_pinctrl_ops = { 201static const struct pinctrl_ops spear_pinctrl_ops = {
202 .get_groups_count = spear_pinctrl_get_groups_cnt, 202 .get_groups_count = spear_pinctrl_get_groups_cnt,
203 .get_group_name = spear_pinctrl_get_group_name, 203 .get_group_name = spear_pinctrl_get_group_name,
204 .get_group_pins = spear_pinctrl_get_group_pins, 204 .get_group_pins = spear_pinctrl_get_group_pins,
@@ -340,7 +340,7 @@ static void gpio_disable_free(struct pinctrl_dev *pctldev,
340 gpio_request_endisable(pctldev, range, offset, false); 340 gpio_request_endisable(pctldev, range, offset, false);
341} 341}
342 342
343static struct pinmux_ops spear_pinmux_ops = { 343static const struct pinmux_ops spear_pinmux_ops = {
344 .get_functions_count = spear_pinctrl_get_funcs_count, 344 .get_functions_count = spear_pinctrl_get_funcs_count,
345 .get_function_name = spear_pinctrl_get_func_name, 345 .get_function_name = spear_pinctrl_get_func_name,
346 .get_function_groups = spear_pinctrl_get_func_groups, 346 .get_function_groups = spear_pinctrl_get_func_groups,
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 0a9f27e094ea..434ebc3a99dc 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -44,7 +44,6 @@ static DECLARE_COMPLETION(at91_rtc_updated);
44static unsigned int at91_alarm_year = AT91_RTC_EPOCH; 44static unsigned int at91_alarm_year = AT91_RTC_EPOCH;
45static void __iomem *at91_rtc_regs; 45static void __iomem *at91_rtc_regs;
46static int irq; 46static int irq;
47static u32 at91_rtc_imr;
48 47
49/* 48/*
50 * Decode time/date into rtc_time structure 49 * Decode time/date into rtc_time structure
@@ -109,11 +108,9 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm)
109 cr = at91_rtc_read(AT91_RTC_CR); 108 cr = at91_rtc_read(AT91_RTC_CR);
110 at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); 109 at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM);
111 110
112 at91_rtc_imr |= AT91_RTC_ACKUPD;
113 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); 111 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD);
114 wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ 112 wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */
115 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); 113 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD);
116 at91_rtc_imr &= ~AT91_RTC_ACKUPD;
117 114
118 at91_rtc_write(AT91_RTC_TIMR, 115 at91_rtc_write(AT91_RTC_TIMR,
119 bin2bcd(tm->tm_sec) << 0 116 bin2bcd(tm->tm_sec) << 0
@@ -145,7 +142,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
145 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); 142 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
146 tm->tm_year = at91_alarm_year - 1900; 143 tm->tm_year = at91_alarm_year - 1900;
147 144
148 alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM) 145 alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM)
149 ? 1 : 0; 146 ? 1 : 0;
150 147
151 dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, 148 dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__,
@@ -171,7 +168,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
171 tm.tm_sec = alrm->time.tm_sec; 168 tm.tm_sec = alrm->time.tm_sec;
172 169
173 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); 170 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
174 at91_rtc_imr &= ~AT91_RTC_ALARM;
175 at91_rtc_write(AT91_RTC_TIMALR, 171 at91_rtc_write(AT91_RTC_TIMALR,
176 bin2bcd(tm.tm_sec) << 0 172 bin2bcd(tm.tm_sec) << 0
177 | bin2bcd(tm.tm_min) << 8 173 | bin2bcd(tm.tm_min) << 8
@@ -184,7 +180,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
184 180
185 if (alrm->enabled) { 181 if (alrm->enabled) {
186 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); 182 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
187 at91_rtc_imr |= AT91_RTC_ALARM;
188 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); 183 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
189 } 184 }
190 185
@@ -201,12 +196,9 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
201 196
202 if (enabled) { 197 if (enabled) {
203 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); 198 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
204 at91_rtc_imr |= AT91_RTC_ALARM;
205 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); 199 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
206 } else { 200 } else
207 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); 201 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
208 at91_rtc_imr &= ~AT91_RTC_ALARM;
209 }
210 202
211 return 0; 203 return 0;
212} 204}
@@ -215,10 +207,12 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
215 */ 207 */
216static int at91_rtc_proc(struct device *dev, struct seq_file *seq) 208static int at91_rtc_proc(struct device *dev, struct seq_file *seq)
217{ 209{
210 unsigned long imr = at91_rtc_read(AT91_RTC_IMR);
211
218 seq_printf(seq, "update_IRQ\t: %s\n", 212 seq_printf(seq, "update_IRQ\t: %s\n",
219 (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no"); 213 (imr & AT91_RTC_ACKUPD) ? "yes" : "no");
220 seq_printf(seq, "periodic_IRQ\t: %s\n", 214 seq_printf(seq, "periodic_IRQ\t: %s\n",
221 (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no"); 215 (imr & AT91_RTC_SECEV) ? "yes" : "no");
222 216
223 return 0; 217 return 0;
224} 218}
@@ -233,7 +227,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id)
233 unsigned int rtsr; 227 unsigned int rtsr;
234 unsigned long events = 0; 228 unsigned long events = 0;
235 229
236 rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr; 230 rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR);
237 if (rtsr) { /* this interrupt is shared! Is it ours? */ 231 if (rtsr) { /* this interrupt is shared! Is it ours? */
238 if (rtsr & AT91_RTC_ALARM) 232 if (rtsr & AT91_RTC_ALARM)
239 events |= (RTC_AF | RTC_IRQF); 233 events |= (RTC_AF | RTC_IRQF);
@@ -297,7 +291,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
297 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | 291 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
298 AT91_RTC_SECEV | AT91_RTC_TIMEV | 292 AT91_RTC_SECEV | AT91_RTC_TIMEV |
299 AT91_RTC_CALEV); 293 AT91_RTC_CALEV);
300 at91_rtc_imr = 0;
301 294
302 ret = request_irq(irq, at91_rtc_interrupt, 295 ret = request_irq(irq, at91_rtc_interrupt,
303 IRQF_SHARED, 296 IRQF_SHARED,
@@ -336,7 +329,6 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
336 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | 329 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
337 AT91_RTC_SECEV | AT91_RTC_TIMEV | 330 AT91_RTC_SECEV | AT91_RTC_TIMEV |
338 AT91_RTC_CALEV); 331 AT91_RTC_CALEV);
339 at91_rtc_imr = 0;
340 free_irq(irq, pdev); 332 free_irq(irq, pdev);
341 333
342 rtc_device_unregister(rtc); 334 rtc_device_unregister(rtc);
@@ -349,35 +341,31 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
349 341
350/* AT91RM9200 RTC Power management control */ 342/* AT91RM9200 RTC Power management control */
351 343
352static u32 at91_rtc_bkpimr; 344static u32 at91_rtc_imr;
353
354 345
355static int at91_rtc_suspend(struct device *dev) 346static int at91_rtc_suspend(struct device *dev)
356{ 347{
357 /* this IRQ is shared with DBGU and other hardware which isn't 348 /* this IRQ is shared with DBGU and other hardware which isn't
358 * necessarily doing PM like we are... 349 * necessarily doing PM like we are...
359 */ 350 */
360 at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV); 351 at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR)
361 if (at91_rtc_bkpimr) { 352 & (AT91_RTC_ALARM|AT91_RTC_SECEV);
362 if (device_may_wakeup(dev)) { 353 if (at91_rtc_imr) {
354 if (device_may_wakeup(dev))
363 enable_irq_wake(irq); 355 enable_irq_wake(irq);
364 } else { 356 else
365 at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr); 357 at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr);
366 at91_rtc_imr &= ~at91_rtc_bkpimr; 358 }
367 }
368}
369 return 0; 359 return 0;
370} 360}
371 361
372static int at91_rtc_resume(struct device *dev) 362static int at91_rtc_resume(struct device *dev)
373{ 363{
374 if (at91_rtc_bkpimr) { 364 if (at91_rtc_imr) {
375 if (device_may_wakeup(dev)) { 365 if (device_may_wakeup(dev))
376 disable_irq_wake(irq); 366 disable_irq_wake(irq);
377 } else { 367 else
378 at91_rtc_imr |= at91_rtc_bkpimr; 368 at91_rtc_write(AT91_RTC_IER, at91_rtc_imr);
379 at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr);
380 }
381 } 369 }
382 return 0; 370 return 0;
383} 371}
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h
index 5f940b6844cb..da1945e5f714 100644
--- a/drivers/rtc/rtc-at91rm9200.h
+++ b/drivers/rtc/rtc-at91rm9200.h
@@ -64,6 +64,7 @@
64#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ 64#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */
65#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ 65#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */
66#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ 66#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
67#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
67 68
68#define AT91_RTC_VER 0x2c /* Valid Entry Register */ 69#define AT91_RTC_VER 0x2c /* Valid Entry Register */
69#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ 70#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 5ac9c935c151..e9b9c8392832 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -307,7 +307,7 @@ static void scm_blk_handle_error(struct scm_request *scmrq)
307 case EQC_WR_PROHIBIT: 307 case EQC_WR_PROHIBIT:
308 spin_lock_irqsave(&bdev->lock, flags); 308 spin_lock_irqsave(&bdev->lock, flags);
309 if (bdev->state != SCM_WR_PROHIBIT) 309 if (bdev->state != SCM_WR_PROHIBIT)
310 pr_info("%lu: Write access to the SCM increment is suspended\n", 310 pr_info("%lx: Write access to the SCM increment is suspended\n",
311 (unsigned long) bdev->scmdev->address); 311 (unsigned long) bdev->scmdev->address);
312 bdev->state = SCM_WR_PROHIBIT; 312 bdev->state = SCM_WR_PROHIBIT;
313 spin_unlock_irqrestore(&bdev->lock, flags); 313 spin_unlock_irqrestore(&bdev->lock, flags);
@@ -445,7 +445,7 @@ void scm_blk_set_available(struct scm_blk_dev *bdev)
445 445
446 spin_lock_irqsave(&bdev->lock, flags); 446 spin_lock_irqsave(&bdev->lock, flags);
447 if (bdev->state == SCM_WR_PROHIBIT) 447 if (bdev->state == SCM_WR_PROHIBIT)
448 pr_info("%lu: Write access to the SCM increment is restored\n", 448 pr_info("%lx: Write access to the SCM increment is restored\n",
449 (unsigned long) bdev->scmdev->address); 449 (unsigned long) bdev->scmdev->address);
450 bdev->state = SCM_OPER; 450 bdev->state = SCM_OPER;
451 spin_unlock_irqrestore(&bdev->lock, flags); 451 spin_unlock_irqrestore(&bdev->lock, flags);
@@ -463,12 +463,15 @@ static int __init scm_blk_init(void)
463 goto out; 463 goto out;
464 464
465 scm_major = ret; 465 scm_major = ret;
466 if (scm_alloc_rqs(nr_requests)) 466 ret = scm_alloc_rqs(nr_requests);
467 if (ret)
467 goto out_unreg; 468 goto out_unreg;
468 469
469 scm_debug = debug_register("scm_log", 16, 1, 16); 470 scm_debug = debug_register("scm_log", 16, 1, 16);
470 if (!scm_debug) 471 if (!scm_debug) {
472 ret = -ENOMEM;
471 goto out_free; 473 goto out_free;
474 }
472 475
473 debug_register_view(scm_debug, &debug_hex_ascii_view); 476 debug_register_view(scm_debug, &debug_hex_ascii_view);
474 debug_set_level(scm_debug, 2); 477 debug_set_level(scm_debug, 2);
diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c
index 5f6180d6ff08..c98cf52d78d1 100644
--- a/drivers/s390/block/scm_drv.c
+++ b/drivers/s390/block/scm_drv.c
@@ -19,7 +19,7 @@ static void scm_notify(struct scm_device *scmdev, enum scm_event event)
19 19
20 switch (event) { 20 switch (event) {
21 case SCM_CHANGE: 21 case SCM_CHANGE:
22 pr_info("%lu: The capabilities of the SCM increment changed\n", 22 pr_info("%lx: The capabilities of the SCM increment changed\n",
23 (unsigned long) scmdev->address); 23 (unsigned long) scmdev->address);
24 SCM_LOG(2, "State changed"); 24 SCM_LOG(2, "State changed");
25 SCM_LOG_STATE(2, scmdev); 25 SCM_LOG_STATE(2, scmdev);
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index b907dba24025..cee69dac3e18 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
915 int i, rc; 915 int i, rc;
916 916
917 /* Check if the tty3270 is already there. */ 917 /* Check if the tty3270 is already there. */
918 view = raw3270_find_view(&tty3270_fn, tty->index); 918 view = raw3270_find_view(&tty3270_fn, tty->index + RAW3270_FIRSTMINOR);
919 if (!IS_ERR(view)) { 919 if (!IS_ERR(view)) {
920 tp = container_of(view, struct tty3270, view); 920 tp = container_of(view, struct tty3270, view);
921 tty->driver_data = tp; 921 tty->driver_data = tp;
@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
927 tp->inattr = TF_INPUT; 927 tp->inattr = TF_INPUT;
928 return tty_port_install(&tp->port, driver, tty); 928 return tty_port_install(&tp->port, driver, tty);
929 } 929 }
930 if (tty3270_max_index < tty->index) 930 if (tty3270_max_index < tty->index + 1)
931 tty3270_max_index = tty->index; 931 tty3270_max_index = tty->index + 1;
932 932
933 /* Allocate tty3270 structure on first open. */ 933 /* Allocate tty3270 structure on first open. */
934 tp = tty3270_alloc_view(); 934 tp = tty3270_alloc_view();
935 if (IS_ERR(tp)) 935 if (IS_ERR(tp))
936 return PTR_ERR(tp); 936 return PTR_ERR(tp);
937 937
938 rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); 938 rc = raw3270_add_view(&tp->view, &tty3270_fn,
939 tty->index + RAW3270_FIRSTMINOR);
939 if (rc) { 940 if (rc) {
940 tty3270_free_view(tp); 941 tty3270_free_view(tp);
941 return rc; 942 return rc;
@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = {
1846 1847
1847void tty3270_create_cb(int minor) 1848void tty3270_create_cb(int minor)
1848{ 1849{
1849 tty_register_device(tty3270_driver, minor, NULL); 1850 tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL);
1850} 1851}
1851 1852
1852void tty3270_destroy_cb(int minor) 1853void tty3270_destroy_cb(int minor)
1853{ 1854{
1854 tty_unregister_device(tty3270_driver, minor); 1855 tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR);
1855} 1856}
1856 1857
1857struct raw3270_notifier tty3270_notifier = 1858struct raw3270_notifier tty3270_notifier =
@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void)
1884 driver->driver_name = "tty3270"; 1885 driver->driver_name = "tty3270";
1885 driver->name = "3270/tty"; 1886 driver->name = "3270/tty";
1886 driver->major = IBM_TTY3270_MAJOR; 1887 driver->major = IBM_TTY3270_MAJOR;
1887 driver->minor_start = 0; 1888 driver->minor_start = RAW3270_FIRSTMINOR;
1889 driver->name_base = RAW3270_FIRSTMINOR;
1888 driver->type = TTY_DRIVER_TYPE_SYSTEM; 1890 driver->type = TTY_DRIVER_TYPE_SYSTEM;
1889 driver->subtype = SYSTEM_TYPE_TTY; 1891 driver->subtype = SYSTEM_TYPE_TTY;
1890 driver->init_termios = tty_std_termios; 1892 driver->init_termios = tty_std_termios;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 2daf4b0da434..90bc7bd00966 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -940,6 +940,7 @@ static int bnx2fc_libfc_config(struct fc_lport *lport)
940 fc_exch_init(lport); 940 fc_exch_init(lport);
941 fc_rport_init(lport); 941 fc_rport_init(lport);
942 fc_disc_init(lport); 942 fc_disc_init(lport);
943 fc_disc_config(lport, lport);
943 return 0; 944 return 0;
944} 945}
945 946
@@ -2133,6 +2134,7 @@ static int _bnx2fc_create(struct net_device *netdev,
2133 } 2134 }
2134 2135
2135 ctlr = bnx2fc_to_ctlr(interface); 2136 ctlr = bnx2fc_to_ctlr(interface);
2137 cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
2136 interface->vlan_id = vlan_id; 2138 interface->vlan_id = vlan_id;
2137 2139
2138 interface->timer_work_queue = 2140 interface->timer_work_queue =
@@ -2143,7 +2145,7 @@ static int _bnx2fc_create(struct net_device *netdev,
2143 goto ifput_err; 2145 goto ifput_err;
2144 } 2146 }
2145 2147
2146 lport = bnx2fc_if_create(interface, &interface->hba->pcidev->dev, 0); 2148 lport = bnx2fc_if_create(interface, &cdev->dev, 0);
2147 if (!lport) { 2149 if (!lport) {
2148 printk(KERN_ERR PFX "Failed to create interface (%s)\n", 2150 printk(KERN_ERR PFX "Failed to create interface (%s)\n",
2149 netdev->name); 2151 netdev->name);
@@ -2159,8 +2161,6 @@ static int _bnx2fc_create(struct net_device *netdev,
2159 /* Make this master N_port */ 2161 /* Make this master N_port */
2160 ctlr->lp = lport; 2162 ctlr->lp = lport;
2161 2163
2162 cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
2163
2164 if (link_state == BNX2FC_CREATE_LINK_UP) 2164 if (link_state == BNX2FC_CREATE_LINK_UP)
2165 cdev->enabled = FCOE_CTLR_ENABLED; 2165 cdev->enabled = FCOE_CTLR_ENABLED;
2166 else 2166 else
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index b5d92fc93c70..9bfdc9a3f897 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -490,7 +490,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
490{ 490{
491 struct net_device *netdev = fcoe->netdev; 491 struct net_device *netdev = fcoe->netdev;
492 struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); 492 struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
493 struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip);
494 493
495 rtnl_lock(); 494 rtnl_lock();
496 if (!fcoe->removed) 495 if (!fcoe->removed)
@@ -501,7 +500,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
501 /* tear-down the FCoE controller */ 500 /* tear-down the FCoE controller */
502 fcoe_ctlr_destroy(fip); 501 fcoe_ctlr_destroy(fip);
503 scsi_host_put(fip->lp->host); 502 scsi_host_put(fip->lp->host);
504 fcoe_ctlr_device_delete(ctlr_dev);
505 dev_put(netdev); 503 dev_put(netdev);
506 module_put(THIS_MODULE); 504 module_put(THIS_MODULE);
507} 505}
@@ -2194,6 +2192,8 @@ out_nodev:
2194 */ 2192 */
2195static void fcoe_destroy_work(struct work_struct *work) 2193static void fcoe_destroy_work(struct work_struct *work)
2196{ 2194{
2195 struct fcoe_ctlr_device *cdev;
2196 struct fcoe_ctlr *ctlr;
2197 struct fcoe_port *port; 2197 struct fcoe_port *port;
2198 struct fcoe_interface *fcoe; 2198 struct fcoe_interface *fcoe;
2199 struct Scsi_Host *shost; 2199 struct Scsi_Host *shost;
@@ -2224,10 +2224,15 @@ static void fcoe_destroy_work(struct work_struct *work)
2224 mutex_lock(&fcoe_config_mutex); 2224 mutex_lock(&fcoe_config_mutex);
2225 2225
2226 fcoe = port->priv; 2226 fcoe = port->priv;
2227 ctlr = fcoe_to_ctlr(fcoe);
2228 cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
2229
2227 fcoe_if_destroy(port->lport); 2230 fcoe_if_destroy(port->lport);
2228 fcoe_interface_cleanup(fcoe); 2231 fcoe_interface_cleanup(fcoe);
2229 2232
2230 mutex_unlock(&fcoe_config_mutex); 2233 mutex_unlock(&fcoe_config_mutex);
2234
2235 fcoe_ctlr_device_delete(cdev);
2231} 2236}
2232 2237
2233/** 2238/**
@@ -2335,7 +2340,9 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode,
2335 rc = -EIO; 2340 rc = -EIO;
2336 rtnl_unlock(); 2341 rtnl_unlock();
2337 fcoe_interface_cleanup(fcoe); 2342 fcoe_interface_cleanup(fcoe);
2338 goto out_nortnl; 2343 mutex_unlock(&fcoe_config_mutex);
2344 fcoe_ctlr_device_delete(ctlr_dev);
2345 goto out;
2339 } 2346 }
2340 2347
2341 /* Make this the "master" N_Port */ 2348 /* Make this the "master" N_Port */
@@ -2375,8 +2382,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode,
2375 2382
2376out_nodev: 2383out_nodev:
2377 rtnl_unlock(); 2384 rtnl_unlock();
2378out_nortnl:
2379 mutex_unlock(&fcoe_config_mutex); 2385 mutex_unlock(&fcoe_config_mutex);
2386out:
2380 return rc; 2387 return rc;
2381} 2388}
2382 2389
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 08c3bc398da2..a76247201be5 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -2815,6 +2815,47 @@ unlock:
2815} 2815}
2816 2816
2817/** 2817/**
2818 * fcoe_ctlr_mode_set() - Set or reset the ctlr's mode
2819 * @lport: The local port to be (re)configured
2820 * @fip: The FCoE controller whose mode is changing
2821 * @fip_mode: The new fip mode
2822 *
2823 * Note that the we shouldn't be changing the libfc discovery settings
2824 * (fc_disc_config) while an lport is going through the libfc state
2825 * machine. The mode can only be changed when a fcoe_ctlr device is
2826 * disabled, so that should ensure that this routine is only called
2827 * when nothing is happening.
2828 */
2829void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip,
2830 enum fip_state fip_mode)
2831{
2832 void *priv;
2833
2834 WARN_ON(lport->state != LPORT_ST_RESET &&
2835 lport->state != LPORT_ST_DISABLED);
2836
2837 if (fip_mode == FIP_MODE_VN2VN) {
2838 lport->rport_priv_size = sizeof(struct fcoe_rport);
2839 lport->point_to_multipoint = 1;
2840 lport->tt.disc_recv_req = fcoe_ctlr_disc_recv;
2841 lport->tt.disc_start = fcoe_ctlr_disc_start;
2842 lport->tt.disc_stop = fcoe_ctlr_disc_stop;
2843 lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final;
2844 priv = fip;
2845 } else {
2846 lport->rport_priv_size = 0;
2847 lport->point_to_multipoint = 0;
2848 lport->tt.disc_recv_req = NULL;
2849 lport->tt.disc_start = NULL;
2850 lport->tt.disc_stop = NULL;
2851 lport->tt.disc_stop_final = NULL;
2852 priv = lport;
2853 }
2854
2855 fc_disc_config(lport, priv);
2856}
2857
2858/**
2818 * fcoe_libfc_config() - Sets up libfc related properties for local port 2859 * fcoe_libfc_config() - Sets up libfc related properties for local port
2819 * @lport: The local port to configure libfc for 2860 * @lport: The local port to configure libfc for
2820 * @fip: The FCoE controller in use by the local port 2861 * @fip: The FCoE controller in use by the local port
@@ -2833,21 +2874,9 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,
2833 fc_exch_init(lport); 2874 fc_exch_init(lport);
2834 fc_elsct_init(lport); 2875 fc_elsct_init(lport);
2835 fc_lport_init(lport); 2876 fc_lport_init(lport);
2836 if (fip->mode == FIP_MODE_VN2VN)
2837 lport->rport_priv_size = sizeof(struct fcoe_rport);
2838 fc_rport_init(lport); 2877 fc_rport_init(lport);
2839 if (fip->mode == FIP_MODE_VN2VN) { 2878 fc_disc_init(lport);
2840 lport->point_to_multipoint = 1; 2879 fcoe_ctlr_mode_set(lport, fip, fip->mode);
2841 lport->tt.disc_recv_req = fcoe_ctlr_disc_recv;
2842 lport->tt.disc_start = fcoe_ctlr_disc_start;
2843 lport->tt.disc_stop = fcoe_ctlr_disc_stop;
2844 lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final;
2845 mutex_init(&lport->disc.disc_mutex);
2846 INIT_LIST_HEAD(&lport->disc.rports);
2847 lport->disc.priv = fip;
2848 } else {
2849 fc_disc_init(lport);
2850 }
2851 return 0; 2880 return 0;
2852} 2881}
2853EXPORT_SYMBOL_GPL(fcoe_libfc_config); 2882EXPORT_SYMBOL_GPL(fcoe_libfc_config);
@@ -2875,6 +2904,7 @@ EXPORT_SYMBOL(fcoe_fcf_get_selected);
2875void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) 2904void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev)
2876{ 2905{
2877 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); 2906 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev);
2907 struct fc_lport *lport = ctlr->lp;
2878 2908
2879 mutex_lock(&ctlr->ctlr_mutex); 2909 mutex_lock(&ctlr->ctlr_mutex);
2880 switch (ctlr_dev->mode) { 2910 switch (ctlr_dev->mode) {
@@ -2888,5 +2918,7 @@ void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev)
2888 } 2918 }
2889 2919
2890 mutex_unlock(&ctlr->ctlr_mutex); 2920 mutex_unlock(&ctlr->ctlr_mutex);
2921
2922 fcoe_ctlr_mode_set(lport, ctlr, ctlr->mode);
2891} 2923}
2892EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); 2924EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode);
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 8e561e6a557c..880a9068ca12 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -712,12 +712,13 @@ static void fc_disc_stop_final(struct fc_lport *lport)
712} 712}
713 713
714/** 714/**
715 * fc_disc_init() - Initialize the discovery layer for a local port 715 * fc_disc_config() - Configure the discovery layer for a local port
716 * @lport: The local port that needs the discovery layer to be initialized 716 * @lport: The local port that needs the discovery layer to be configured
717 * @priv: Private data structre for users of the discovery layer
717 */ 718 */
718int fc_disc_init(struct fc_lport *lport) 719void fc_disc_config(struct fc_lport *lport, void *priv)
719{ 720{
720 struct fc_disc *disc; 721 struct fc_disc *disc = &lport->disc;
721 722
722 if (!lport->tt.disc_start) 723 if (!lport->tt.disc_start)
723 lport->tt.disc_start = fc_disc_start; 724 lport->tt.disc_start = fc_disc_start;
@@ -732,12 +733,21 @@ int fc_disc_init(struct fc_lport *lport)
732 lport->tt.disc_recv_req = fc_disc_recv_req; 733 lport->tt.disc_recv_req = fc_disc_recv_req;
733 734
734 disc = &lport->disc; 735 disc = &lport->disc;
736
737 disc->priv = priv;
738}
739EXPORT_SYMBOL(fc_disc_config);
740
741/**
742 * fc_disc_init() - Initialize the discovery layer for a local port
743 * @lport: The local port that needs the discovery layer to be initialized
744 */
745void fc_disc_init(struct fc_lport *lport)
746{
747 struct fc_disc *disc = &lport->disc;
748
735 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); 749 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout);
736 mutex_init(&disc->disc_mutex); 750 mutex_init(&disc->disc_mutex);
737 INIT_LIST_HEAD(&disc->rports); 751 INIT_LIST_HEAD(&disc->rports);
738
739 disc->priv = lport;
740
741 return 0;
742} 752}
743EXPORT_SYMBOL(fc_disc_init); 753EXPORT_SYMBOL(fc_disc_init);
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index f80eee74a311..2be0de920d67 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -55,6 +55,7 @@ comment "SPI Master Controller Drivers"
55 55
56config SPI_ALTERA 56config SPI_ALTERA
57 tristate "Altera SPI Controller" 57 tristate "Altera SPI Controller"
58 depends on GENERIC_HARDIRQS
58 select SPI_BITBANG 59 select SPI_BITBANG
59 help 60 help
60 This is the driver for the Altera SPI Controller. 61 This is the driver for the Altera SPI Controller.
@@ -310,7 +311,7 @@ config SPI_PXA2XX_DMA
310 311
311config SPI_PXA2XX 312config SPI_PXA2XX
312 tristate "PXA2xx SSP SPI master" 313 tristate "PXA2xx SSP SPI master"
313 depends on ARCH_PXA || PCI || ACPI 314 depends on (ARCH_PXA || PCI || ACPI) && GENERIC_HARDIRQS
314 select PXA_SSP if ARCH_PXA 315 select PXA_SSP if ARCH_PXA
315 help 316 help
316 This enables using a PXA2xx or Sodaville SSP port as a SPI master 317 This enables using a PXA2xx or Sodaville SSP port as a SPI master
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 9578af782a77..d7df435d962e 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -152,7 +152,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
152static int bcm63xx_spi_setup(struct spi_device *spi) 152static int bcm63xx_spi_setup(struct spi_device *spi)
153{ 153{
154 struct bcm63xx_spi *bs; 154 struct bcm63xx_spi *bs;
155 int ret;
156 155
157 bs = spi_master_get_devdata(spi->master); 156 bs = spi_master_get_devdata(spi->master);
158 157
@@ -490,7 +489,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
490 default: 489 default:
491 dev_err(dev, "unsupported MSG_CTL width: %d\n", 490 dev_err(dev, "unsupported MSG_CTL width: %d\n",
492 bs->msg_ctl_width); 491 bs->msg_ctl_width);
493 goto out_clk_disable; 492 goto out_err;
494 } 493 }
495 494
496 /* Initialize hardware */ 495 /* Initialize hardware */
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 89480b281d74..3e490ee7f275 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -164,7 +164,7 @@ static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi,
164 164
165 for (i = count; i > 0; i--) { 165 for (i = count; i > 0; i--) {
166 data = tx_buf ? *tx_buf++ : 0; 166 data = tx_buf ? *tx_buf++ : 0;
167 if (len == EOFBYTE) 167 if (len == EOFBYTE && t->cs_change)
168 setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF); 168 setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF);
169 out_8(&fifo->txdata_8, data); 169 out_8(&fifo->txdata_8, data);
170 len--; 170 len--;
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 90b27a3508a6..810413883c79 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1168,7 +1168,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1168 1168
1169 master->dev.parent = &pdev->dev; 1169 master->dev.parent = &pdev->dev;
1170 master->dev.of_node = pdev->dev.of_node; 1170 master->dev.of_node = pdev->dev.of_node;
1171 ACPI_HANDLE_SET(&master->dev, ACPI_HANDLE(&pdev->dev));
1172 /* the spi->mode bits understood by this driver: */ 1171 /* the spi->mode bits understood by this driver: */
1173 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; 1172 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
1174 1173
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index e862ab8853aa..4188b2faac5c 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -994,25 +994,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data)
994{ 994{
995 struct s3c64xx_spi_driver_data *sdd = data; 995 struct s3c64xx_spi_driver_data *sdd = data;
996 struct spi_master *spi = sdd->master; 996 struct spi_master *spi = sdd->master;
997 unsigned int val; 997 unsigned int val, clr = 0;
998 998
999 val = readl(sdd->regs + S3C64XX_SPI_PENDING_CLR); 999 val = readl(sdd->regs + S3C64XX_SPI_STATUS);
1000 1000
1001 val &= S3C64XX_SPI_PND_RX_OVERRUN_CLR | 1001 if (val & S3C64XX_SPI_ST_RX_OVERRUN_ERR) {
1002 S3C64XX_SPI_PND_RX_UNDERRUN_CLR | 1002 clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR;
1003 S3C64XX_SPI_PND_TX_OVERRUN_CLR |
1004 S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1005
1006 writel(val, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1007
1008 if (val & S3C64XX_SPI_PND_RX_OVERRUN_CLR)
1009 dev_err(&spi->dev, "RX overrun\n"); 1003 dev_err(&spi->dev, "RX overrun\n");
1010 if (val & S3C64XX_SPI_PND_RX_UNDERRUN_CLR) 1004 }
1005 if (val & S3C64XX_SPI_ST_RX_UNDERRUN_ERR) {
1006 clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR;
1011 dev_err(&spi->dev, "RX underrun\n"); 1007 dev_err(&spi->dev, "RX underrun\n");
1012 if (val & S3C64XX_SPI_PND_TX_OVERRUN_CLR) 1008 }
1009 if (val & S3C64XX_SPI_ST_TX_OVERRUN_ERR) {
1010 clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR;
1013 dev_err(&spi->dev, "TX overrun\n"); 1011 dev_err(&spi->dev, "TX overrun\n");
1014 if (val & S3C64XX_SPI_PND_TX_UNDERRUN_CLR) 1012 }
1013 if (val & S3C64XX_SPI_ST_TX_UNDERRUN_ERR) {
1014 clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1015 dev_err(&spi->dev, "TX underrun\n"); 1015 dev_err(&spi->dev, "TX underrun\n");
1016 }
1017
1018 /* Clear the pending irq by setting and then clearing it */
1019 writel(clr, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1020 writel(0, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1016 1021
1017 return IRQ_HANDLED; 1022 return IRQ_HANDLED;
1018} 1023}
@@ -1036,9 +1041,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
1036 writel(0, regs + S3C64XX_SPI_MODE_CFG); 1041 writel(0, regs + S3C64XX_SPI_MODE_CFG);
1037 writel(0, regs + S3C64XX_SPI_PACKET_CNT); 1042 writel(0, regs + S3C64XX_SPI_PACKET_CNT);
1038 1043
1039 /* Clear any irq pending bits */ 1044 /* Clear any irq pending bits, should set and clear the bits */
1040 writel(readl(regs + S3C64XX_SPI_PENDING_CLR), 1045 val = S3C64XX_SPI_PND_RX_OVERRUN_CLR |
1041 regs + S3C64XX_SPI_PENDING_CLR); 1046 S3C64XX_SPI_PND_RX_UNDERRUN_CLR |
1047 S3C64XX_SPI_PND_TX_OVERRUN_CLR |
1048 S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1049 writel(val, regs + S3C64XX_SPI_PENDING_CLR);
1050 writel(0, regs + S3C64XX_SPI_PENDING_CLR);
1042 1051
1043 writel(0, regs + S3C64XX_SPI_SWAP_CFG); 1052 writel(0, regs + S3C64XX_SPI_SWAP_CFG);
1044 1053
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index b8698b389ef3..a829563f4713 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -858,21 +858,6 @@ static int tegra_slink_setup(struct spi_device *spi)
858 return 0; 858 return 0;
859} 859}
860 860
861static int tegra_slink_prepare_transfer(struct spi_master *master)
862{
863 struct tegra_slink_data *tspi = spi_master_get_devdata(master);
864
865 return pm_runtime_get_sync(tspi->dev);
866}
867
868static int tegra_slink_unprepare_transfer(struct spi_master *master)
869{
870 struct tegra_slink_data *tspi = spi_master_get_devdata(master);
871
872 pm_runtime_put(tspi->dev);
873 return 0;
874}
875
876static int tegra_slink_transfer_one_message(struct spi_master *master, 861static int tegra_slink_transfer_one_message(struct spi_master *master,
877 struct spi_message *msg) 862 struct spi_message *msg)
878{ 863{
@@ -885,6 +870,12 @@ static int tegra_slink_transfer_one_message(struct spi_master *master,
885 870
886 msg->status = 0; 871 msg->status = 0;
887 msg->actual_length = 0; 872 msg->actual_length = 0;
873 ret = pm_runtime_get_sync(tspi->dev);
874 if (ret < 0) {
875 dev_err(tspi->dev, "runtime get failed: %d\n", ret);
876 goto done;
877 }
878
888 single_xfer = list_is_singular(&msg->transfers); 879 single_xfer = list_is_singular(&msg->transfers);
889 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 880 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
890 INIT_COMPLETION(tspi->xfer_completion); 881 INIT_COMPLETION(tspi->xfer_completion);
@@ -921,6 +912,8 @@ static int tegra_slink_transfer_one_message(struct spi_master *master,
921exit: 912exit:
922 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); 913 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND);
923 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); 914 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2);
915 pm_runtime_put(tspi->dev);
916done:
924 msg->status = ret; 917 msg->status = ret;
925 spi_finalize_current_message(master); 918 spi_finalize_current_message(master);
926 return ret; 919 return ret;
@@ -1148,9 +1141,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
1148 /* the spi->mode bits understood by this driver: */ 1141 /* the spi->mode bits understood by this driver: */
1149 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 1142 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1150 master->setup = tegra_slink_setup; 1143 master->setup = tegra_slink_setup;
1151 master->prepare_transfer_hardware = tegra_slink_prepare_transfer;
1152 master->transfer_one_message = tegra_slink_transfer_one_message; 1144 master->transfer_one_message = tegra_slink_transfer_one_message;
1153 master->unprepare_transfer_hardware = tegra_slink_unprepare_transfer;
1154 master->num_chipselect = MAX_CHIP_SELECT; 1145 master->num_chipselect = MAX_CHIP_SELECT;
1155 master->bus_num = -1; 1146 master->bus_num = -1;
1156 1147
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f996c600eb8c..004b10f184d4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -543,17 +543,16 @@ static void spi_pump_messages(struct kthread_work *work)
543 /* Lock queue and check for queue work */ 543 /* Lock queue and check for queue work */
544 spin_lock_irqsave(&master->queue_lock, flags); 544 spin_lock_irqsave(&master->queue_lock, flags);
545 if (list_empty(&master->queue) || !master->running) { 545 if (list_empty(&master->queue) || !master->running) {
546 if (master->busy && master->unprepare_transfer_hardware) { 546 if (!master->busy) {
547 ret = master->unprepare_transfer_hardware(master); 547 spin_unlock_irqrestore(&master->queue_lock, flags);
548 if (ret) { 548 return;
549 spin_unlock_irqrestore(&master->queue_lock, flags);
550 dev_err(&master->dev,
551 "failed to unprepare transfer hardware\n");
552 return;
553 }
554 } 549 }
555 master->busy = false; 550 master->busy = false;
556 spin_unlock_irqrestore(&master->queue_lock, flags); 551 spin_unlock_irqrestore(&master->queue_lock, flags);
552 if (master->unprepare_transfer_hardware &&
553 master->unprepare_transfer_hardware(master))
554 dev_err(&master->dev,
555 "failed to unprepare transfer hardware\n");
557 return; 556 return;
558 } 557 }
559 558
@@ -984,7 +983,7 @@ static void acpi_register_spi_devices(struct spi_master *master)
984 acpi_status status; 983 acpi_status status;
985 acpi_handle handle; 984 acpi_handle handle;
986 985
987 handle = ACPI_HANDLE(&master->dev); 986 handle = ACPI_HANDLE(master->dev.parent);
988 if (!handle) 987 if (!handle)
989 return; 988 return;
990 989
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 797f9d514732..65d4e55552c6 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -67,7 +67,6 @@ static void usb_port_device_release(struct device *dev)
67{ 67{
68 struct usb_port *port_dev = to_usb_port(dev); 68 struct usb_port *port_dev = to_usb_port(dev);
69 69
70 dev_pm_qos_hide_flags(dev);
71 kfree(port_dev); 70 kfree(port_dev);
72} 71}
73 72
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 94ad0f71383c..7f6709991a5c 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm,
1400 fbmode->vmode = 0; 1400 fbmode->vmode = 0;
1401 if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) 1401 if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
1402 fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; 1402 fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
1403 if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) 1403 if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH)
1404 fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; 1404 fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
1405 if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) 1405 if (vm->data_flags & DISPLAY_FLAGS_INTERLACED)
1406 fbmode->vmode |= FB_VMODE_INTERLACED; 1406 fbmode->vmode |= FB_VMODE_INTERLACED;
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 63203acef812..0264704a52be 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -858,6 +858,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
858 tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16) 858 tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16)
859 | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7); 859 | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7);
860 lcdc_write_chan(ch, LDHAJR, tmp); 860 lcdc_write_chan(ch, LDHAJR, tmp);
861 lcdc_write_chan_mirror(ch, LDHAJR, tmp);
861} 862}
862 863
863static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) 864static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl)
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b75db0186488..d4284458377e 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -1973,7 +1973,8 @@ static int uvesafb_init(void)
1973 err = -ENOMEM; 1973 err = -ENOMEM;
1974 1974
1975 if (err) { 1975 if (err) {
1976 platform_device_put(uvesafb_device); 1976 if (uvesafb_device)
1977 platform_device_put(uvesafb_device);
1977 platform_driver_unregister(&uvesafb_driver); 1978 platform_driver_unregister(&uvesafb_driver);
1978 cn_del_callback(&uvesafb_cn_id); 1979 cn_del_callback(&uvesafb_cn_id);
1979 return err; 1980 return err;
diff --git a/firmware/Makefile b/firmware/Makefile
index 5d8ee1319b5c..cbb09ce9730a 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -82,7 +82,7 @@ fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \
82fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ 82fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \
83 qlogic/12160.bin 83 qlogic/12160.bin
84fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin 84fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin
85fw-shipped-$(CONFIG_INFINIBAND_QIB) += intel/sd7220.fw 85fw-shipped-$(CONFIG_INFINIBAND_QIB) += qlogic/sd7220.fw
86fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp 86fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
87fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ 87fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \
88 ess/maestro3_assp_minisrc.fw 88 ess/maestro3_assp_minisrc.fw
diff --git a/firmware/intel/sd7220.fw.ihex b/firmware/qlogic/sd7220.fw.ihex
index a33636319112..a33636319112 100644
--- a/firmware/intel/sd7220.fw.ihex
+++ b/firmware/qlogic/sd7220.fw.ihex
diff --git a/fs/block_dev.c b/fs/block_dev.c
index aea605c98ba6..aae187a7f94a 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -551,6 +551,7 @@ struct block_device *bdgrab(struct block_device *bdev)
551 ihold(bdev->bd_inode); 551 ihold(bdev->bd_inode);
552 return bdev; 552 return bdev;
553} 553}
554EXPORT_SYMBOL(bdgrab);
554 555
555long nr_blockdev_pages(void) 556long nr_blockdev_pages(void)
556{ 557{
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 56efcaadf848..9c6d06dcef8b 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2999,20 +2999,23 @@ static int ext4_split_extent_at(handle_t *handle,
2999 if (split_flag & EXT4_EXT_DATA_VALID1) { 2999 if (split_flag & EXT4_EXT_DATA_VALID1) {
3000 err = ext4_ext_zeroout(inode, ex2); 3000 err = ext4_ext_zeroout(inode, ex2);
3001 zero_ex.ee_block = ex2->ee_block; 3001 zero_ex.ee_block = ex2->ee_block;
3002 zero_ex.ee_len = ext4_ext_get_actual_len(ex2); 3002 zero_ex.ee_len = cpu_to_le16(
3003 ext4_ext_get_actual_len(ex2));
3003 ext4_ext_store_pblock(&zero_ex, 3004 ext4_ext_store_pblock(&zero_ex,
3004 ext4_ext_pblock(ex2)); 3005 ext4_ext_pblock(ex2));
3005 } else { 3006 } else {
3006 err = ext4_ext_zeroout(inode, ex); 3007 err = ext4_ext_zeroout(inode, ex);
3007 zero_ex.ee_block = ex->ee_block; 3008 zero_ex.ee_block = ex->ee_block;
3008 zero_ex.ee_len = ext4_ext_get_actual_len(ex); 3009 zero_ex.ee_len = cpu_to_le16(
3010 ext4_ext_get_actual_len(ex));
3009 ext4_ext_store_pblock(&zero_ex, 3011 ext4_ext_store_pblock(&zero_ex,
3010 ext4_ext_pblock(ex)); 3012 ext4_ext_pblock(ex));
3011 } 3013 }
3012 } else { 3014 } else {
3013 err = ext4_ext_zeroout(inode, &orig_ex); 3015 err = ext4_ext_zeroout(inode, &orig_ex);
3014 zero_ex.ee_block = orig_ex.ee_block; 3016 zero_ex.ee_block = orig_ex.ee_block;
3015 zero_ex.ee_len = ext4_ext_get_actual_len(&orig_ex); 3017 zero_ex.ee_len = cpu_to_le16(
3018 ext4_ext_get_actual_len(&orig_ex));
3016 ext4_ext_store_pblock(&zero_ex, 3019 ext4_ext_store_pblock(&zero_ex,
3017 ext4_ext_pblock(&orig_ex)); 3020 ext4_ext_pblock(&orig_ex));
3018 } 3021 }
@@ -3272,7 +3275,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3272 if (err) 3275 if (err)
3273 goto out; 3276 goto out;
3274 zero_ex.ee_block = ex->ee_block; 3277 zero_ex.ee_block = ex->ee_block;
3275 zero_ex.ee_len = ext4_ext_get_actual_len(ex); 3278 zero_ex.ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex));
3276 ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); 3279 ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex));
3277 3280
3278 err = ext4_ext_get_access(handle, inode, path + depth); 3281 err = ext4_ext_get_access(handle, inode, path + depth);
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index b505a145a593..a04183127ef0 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -1539,9 +1539,9 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode,
1539 blk = *i_data; 1539 blk = *i_data;
1540 if (level > 0) { 1540 if (level > 0) {
1541 ext4_lblk_t first2; 1541 ext4_lblk_t first2;
1542 bh = sb_bread(inode->i_sb, blk); 1542 bh = sb_bread(inode->i_sb, le32_to_cpu(blk));
1543 if (!bh) { 1543 if (!bh) {
1544 EXT4_ERROR_INODE_BLOCK(inode, blk, 1544 EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk),
1545 "Read failure"); 1545 "Read failure");
1546 return -EIO; 1546 return -EIO;
1547 } 1547 }
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 019f45e45097..d79c2dadc536 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -923,8 +923,11 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
923 cmd = F_SETLK; 923 cmd = F_SETLK;
924 fl->fl_type = F_UNLCK; 924 fl->fl_type = F_UNLCK;
925 } 925 }
926 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 926 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
927 if (fl->fl_type == F_UNLCK)
928 posix_lock_file_wait(file, fl);
927 return -EIO; 929 return -EIO;
930 }
928 if (IS_GETLK(cmd)) 931 if (IS_GETLK(cmd))
929 return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); 932 return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl);
930 else if (fl->fl_type == F_UNLCK) 933 else if (fl->fl_type == F_UNLCK)
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 156e42ec84ea..5c29216e9cc1 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -588,6 +588,7 @@ struct lm_lockstruct {
588 struct dlm_lksb ls_control_lksb; /* control_lock */ 588 struct dlm_lksb ls_control_lksb; /* control_lock */
589 char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */ 589 char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */
590 struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */ 590 struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */
591 char *ls_lvb_bits;
591 592
592 spinlock_t ls_recover_spin; /* protects following fields */ 593 spinlock_t ls_recover_spin; /* protects following fields */
593 unsigned long ls_recover_flags; /* DFL_ */ 594 unsigned long ls_recover_flags; /* DFL_ */
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 9802de0f85e6..c8423d6de6c3 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -483,12 +483,8 @@ static void control_lvb_write(struct lm_lockstruct *ls, uint32_t lvb_gen,
483 483
484static int all_jid_bits_clear(char *lvb) 484static int all_jid_bits_clear(char *lvb)
485{ 485{
486 int i; 486 return !memchr_inv(lvb + JID_BITMAP_OFFSET, 0,
487 for (i = JID_BITMAP_OFFSET; i < GDLM_LVB_SIZE; i++) { 487 GDLM_LVB_SIZE - JID_BITMAP_OFFSET);
488 if (lvb[i])
489 return 0;
490 }
491 return 1;
492} 488}
493 489
494static void sync_wait_cb(void *arg) 490static void sync_wait_cb(void *arg)
@@ -580,7 +576,6 @@ static void gfs2_control_func(struct work_struct *work)
580{ 576{
581 struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work); 577 struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work);
582 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 578 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
583 char lvb_bits[GDLM_LVB_SIZE];
584 uint32_t block_gen, start_gen, lvb_gen, flags; 579 uint32_t block_gen, start_gen, lvb_gen, flags;
585 int recover_set = 0; 580 int recover_set = 0;
586 int write_lvb = 0; 581 int write_lvb = 0;
@@ -634,7 +629,7 @@ static void gfs2_control_func(struct work_struct *work)
634 return; 629 return;
635 } 630 }
636 631
637 control_lvb_read(ls, &lvb_gen, lvb_bits); 632 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits);
638 633
639 spin_lock(&ls->ls_recover_spin); 634 spin_lock(&ls->ls_recover_spin);
640 if (block_gen != ls->ls_recover_block || 635 if (block_gen != ls->ls_recover_block ||
@@ -664,10 +659,10 @@ static void gfs2_control_func(struct work_struct *work)
664 659
665 ls->ls_recover_result[i] = 0; 660 ls->ls_recover_result[i] = 0;
666 661
667 if (!test_bit_le(i, lvb_bits + JID_BITMAP_OFFSET)) 662 if (!test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET))
668 continue; 663 continue;
669 664
670 __clear_bit_le(i, lvb_bits + JID_BITMAP_OFFSET); 665 __clear_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET);
671 write_lvb = 1; 666 write_lvb = 1;
672 } 667 }
673 } 668 }
@@ -691,7 +686,7 @@ static void gfs2_control_func(struct work_struct *work)
691 continue; 686 continue;
692 if (ls->ls_recover_submit[i] < start_gen) { 687 if (ls->ls_recover_submit[i] < start_gen) {
693 ls->ls_recover_submit[i] = 0; 688 ls->ls_recover_submit[i] = 0;
694 __set_bit_le(i, lvb_bits + JID_BITMAP_OFFSET); 689 __set_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET);
695 } 690 }
696 } 691 }
697 /* even if there are no bits to set, we need to write the 692 /* even if there are no bits to set, we need to write the
@@ -705,7 +700,7 @@ static void gfs2_control_func(struct work_struct *work)
705 spin_unlock(&ls->ls_recover_spin); 700 spin_unlock(&ls->ls_recover_spin);
706 701
707 if (write_lvb) { 702 if (write_lvb) {
708 control_lvb_write(ls, start_gen, lvb_bits); 703 control_lvb_write(ls, start_gen, ls->ls_lvb_bits);
709 flags = DLM_LKF_CONVERT | DLM_LKF_VALBLK; 704 flags = DLM_LKF_CONVERT | DLM_LKF_VALBLK;
710 } else { 705 } else {
711 flags = DLM_LKF_CONVERT; 706 flags = DLM_LKF_CONVERT;
@@ -725,7 +720,7 @@ static void gfs2_control_func(struct work_struct *work)
725 */ 720 */
726 721
727 for (i = 0; i < recover_size; i++) { 722 for (i = 0; i < recover_size; i++) {
728 if (test_bit_le(i, lvb_bits + JID_BITMAP_OFFSET)) { 723 if (test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) {
729 fs_info(sdp, "recover generation %u jid %d\n", 724 fs_info(sdp, "recover generation %u jid %d\n",
730 start_gen, i); 725 start_gen, i);
731 gfs2_recover_set(sdp, i); 726 gfs2_recover_set(sdp, i);
@@ -758,7 +753,6 @@ static void gfs2_control_func(struct work_struct *work)
758static int control_mount(struct gfs2_sbd *sdp) 753static int control_mount(struct gfs2_sbd *sdp)
759{ 754{
760 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 755 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
761 char lvb_bits[GDLM_LVB_SIZE];
762 uint32_t start_gen, block_gen, mount_gen, lvb_gen; 756 uint32_t start_gen, block_gen, mount_gen, lvb_gen;
763 int mounted_mode; 757 int mounted_mode;
764 int retries = 0; 758 int retries = 0;
@@ -857,7 +851,7 @@ locks_done:
857 * lvb_gen will be non-zero. 851 * lvb_gen will be non-zero.
858 */ 852 */
859 853
860 control_lvb_read(ls, &lvb_gen, lvb_bits); 854 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits);
861 855
862 if (lvb_gen == 0xFFFFFFFF) { 856 if (lvb_gen == 0xFFFFFFFF) {
863 /* special value to force mount attempts to fail */ 857 /* special value to force mount attempts to fail */
@@ -887,7 +881,7 @@ locks_done:
887 * and all lvb bits to be clear (no pending journal recoveries.) 881 * and all lvb bits to be clear (no pending journal recoveries.)
888 */ 882 */
889 883
890 if (!all_jid_bits_clear(lvb_bits)) { 884 if (!all_jid_bits_clear(ls->ls_lvb_bits)) {
891 /* journals need recovery, wait until all are clear */ 885 /* journals need recovery, wait until all are clear */
892 fs_info(sdp, "control_mount wait for journal recovery\n"); 886 fs_info(sdp, "control_mount wait for journal recovery\n");
893 goto restart; 887 goto restart;
@@ -949,7 +943,6 @@ static int dlm_recovery_wait(void *word)
949static int control_first_done(struct gfs2_sbd *sdp) 943static int control_first_done(struct gfs2_sbd *sdp)
950{ 944{
951 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 945 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
952 char lvb_bits[GDLM_LVB_SIZE];
953 uint32_t start_gen, block_gen; 946 uint32_t start_gen, block_gen;
954 int error; 947 int error;
955 948
@@ -991,8 +984,8 @@ restart:
991 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); 984 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t));
992 spin_unlock(&ls->ls_recover_spin); 985 spin_unlock(&ls->ls_recover_spin);
993 986
994 memset(lvb_bits, 0, sizeof(lvb_bits)); 987 memset(ls->ls_lvb_bits, 0, GDLM_LVB_SIZE);
995 control_lvb_write(ls, start_gen, lvb_bits); 988 control_lvb_write(ls, start_gen, ls->ls_lvb_bits);
996 989
997 error = mounted_lock(sdp, DLM_LOCK_PR, DLM_LKF_CONVERT); 990 error = mounted_lock(sdp, DLM_LOCK_PR, DLM_LKF_CONVERT);
998 if (error) 991 if (error)
@@ -1022,6 +1015,12 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
1022 uint32_t old_size, new_size; 1015 uint32_t old_size, new_size;
1023 int i, max_jid; 1016 int i, max_jid;
1024 1017
1018 if (!ls->ls_lvb_bits) {
1019 ls->ls_lvb_bits = kzalloc(GDLM_LVB_SIZE, GFP_NOFS);
1020 if (!ls->ls_lvb_bits)
1021 return -ENOMEM;
1022 }
1023
1025 max_jid = 0; 1024 max_jid = 0;
1026 for (i = 0; i < num_slots; i++) { 1025 for (i = 0; i < num_slots; i++) {
1027 if (max_jid < slots[i].slot - 1) 1026 if (max_jid < slots[i].slot - 1)
@@ -1057,6 +1056,7 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
1057 1056
1058static void free_recover_size(struct lm_lockstruct *ls) 1057static void free_recover_size(struct lm_lockstruct *ls)
1059{ 1058{
1059 kfree(ls->ls_lvb_bits);
1060 kfree(ls->ls_recover_submit); 1060 kfree(ls->ls_recover_submit);
1061 kfree(ls->ls_recover_result); 1061 kfree(ls->ls_recover_result);
1062 ls->ls_recover_submit = NULL; 1062 ls->ls_recover_submit = NULL;
@@ -1205,6 +1205,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
1205 ls->ls_recover_size = 0; 1205 ls->ls_recover_size = 0;
1206 ls->ls_recover_submit = NULL; 1206 ls->ls_recover_submit = NULL;
1207 ls->ls_recover_result = NULL; 1207 ls->ls_recover_result = NULL;
1208 ls->ls_lvb_bits = NULL;
1208 1209
1209 error = set_recover_size(sdp, NULL, 0); 1210 error = set_recover_size(sdp, NULL, 0);
1210 if (error) 1211 if (error)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index d1f51fd73f86..5a51265a4341 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -576,7 +576,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
576 RB_CLEAR_NODE(&ip->i_res->rs_node); 576 RB_CLEAR_NODE(&ip->i_res->rs_node);
577out: 577out:
578 up_write(&ip->i_rw_mutex); 578 up_write(&ip->i_rw_mutex);
579 return 0; 579 return error;
580} 580}
581 581
582static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) 582static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs)
@@ -1181,12 +1181,9 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
1181 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed) 1181 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed)
1182{ 1182{
1183 struct super_block *sb = sdp->sd_vfs; 1183 struct super_block *sb = sdp->sd_vfs;
1184 struct block_device *bdev = sb->s_bdev;
1185 const unsigned int sects_per_blk = sdp->sd_sb.sb_bsize /
1186 bdev_logical_block_size(sb->s_bdev);
1187 u64 blk; 1184 u64 blk;
1188 sector_t start = 0; 1185 sector_t start = 0;
1189 sector_t nr_sects = 0; 1186 sector_t nr_blks = 0;
1190 int rv; 1187 int rv;
1191 unsigned int x; 1188 unsigned int x;
1192 u32 trimmed = 0; 1189 u32 trimmed = 0;
@@ -1206,35 +1203,34 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
1206 if (diff == 0) 1203 if (diff == 0)
1207 continue; 1204 continue;
1208 blk = offset + ((bi->bi_start + x) * GFS2_NBBY); 1205 blk = offset + ((bi->bi_start + x) * GFS2_NBBY);
1209 blk *= sects_per_blk; /* convert to sectors */
1210 while(diff) { 1206 while(diff) {
1211 if (diff & 1) { 1207 if (diff & 1) {
1212 if (nr_sects == 0) 1208 if (nr_blks == 0)
1213 goto start_new_extent; 1209 goto start_new_extent;
1214 if ((start + nr_sects) != blk) { 1210 if ((start + nr_blks) != blk) {
1215 if (nr_sects >= minlen) { 1211 if (nr_blks >= minlen) {
1216 rv = blkdev_issue_discard(bdev, 1212 rv = sb_issue_discard(sb,
1217 start, nr_sects, 1213 start, nr_blks,
1218 GFP_NOFS, 0); 1214 GFP_NOFS, 0);
1219 if (rv) 1215 if (rv)
1220 goto fail; 1216 goto fail;
1221 trimmed += nr_sects; 1217 trimmed += nr_blks;
1222 } 1218 }
1223 nr_sects = 0; 1219 nr_blks = 0;
1224start_new_extent: 1220start_new_extent:
1225 start = blk; 1221 start = blk;
1226 } 1222 }
1227 nr_sects += sects_per_blk; 1223 nr_blks++;
1228 } 1224 }
1229 diff >>= 2; 1225 diff >>= 2;
1230 blk += sects_per_blk; 1226 blk++;
1231 } 1227 }
1232 } 1228 }
1233 if (nr_sects >= minlen) { 1229 if (nr_blks >= minlen) {
1234 rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, 0); 1230 rv = sb_issue_discard(sb, start, nr_blks, GFP_NOFS, 0);
1235 if (rv) 1231 if (rv)
1236 goto fail; 1232 goto fail;
1237 trimmed += nr_sects; 1233 trimmed += nr_blks;
1238 } 1234 }
1239 if (ptrimmed) 1235 if (ptrimmed)
1240 *ptrimmed = trimmed; 1236 *ptrimmed = trimmed;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 01168865dd37..a2720071f282 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -264,7 +264,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
264 iattr->ia_valid |= ATTR_SIZE; 264 iattr->ia_valid |= ATTR_SIZE;
265 } 265 }
266 if (bmval[0] & FATTR4_WORD0_ACL) { 266 if (bmval[0] & FATTR4_WORD0_ACL) {
267 int nace; 267 u32 nace;
268 struct nfs4_ace *ace; 268 struct nfs4_ace *ace;
269 269
270 READ_BUF(4); len += 4; 270 READ_BUF(4); len += 4;
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index c196369fe408..4cce1d9552fb 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -187,8 +187,8 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset,
187 if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) 187 if (dbuf->count == ARRAY_SIZE(dbuf->dentries))
188 return -ENOSPC; 188 return -ENOSPC;
189 189
190 if (name[0] == '.' && (name[1] == '\0' || 190 if (name[0] == '.' && (namelen < 2 ||
191 (name[1] == '.' && name[2] == '\0'))) 191 (namelen == 2 && name[1] == '.')))
192 return 0; 192 return 0;
193 193
194 dentry = lookup_one_len(name, dbuf->xadir, namelen); 194 dentry = lookup_one_len(name, dbuf->xadir, namelen);
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index ac838b844936..f21acf0ef01f 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1568,6 +1568,12 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1568 c->remounting_rw = 1; 1568 c->remounting_rw = 1;
1569 c->ro_mount = 0; 1569 c->ro_mount = 0;
1570 1570
1571 if (c->space_fixup) {
1572 err = ubifs_fixup_free_space(c);
1573 if (err)
1574 return err;
1575 }
1576
1571 err = check_free_space(c); 1577 err = check_free_space(c);
1572 if (err) 1578 if (err)
1573 goto out; 1579 goto out;
@@ -1684,12 +1690,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1684 err = dbg_check_space_info(c); 1690 err = dbg_check_space_info(c);
1685 } 1691 }
1686 1692
1687 if (c->space_fixup) {
1688 err = ubifs_fixup_free_space(c);
1689 if (err)
1690 goto out;
1691 }
1692
1693 mutex_unlock(&c->umount_mutex); 1693 mutex_unlock(&c->umount_mutex);
1694 return err; 1694 return err;
1695 1695
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 76a87fb57ac2..377cd8c3395e 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -141,11 +141,11 @@ typedef struct {
141} compat_sigset_t; 141} compat_sigset_t;
142 142
143struct compat_sigaction { 143struct compat_sigaction {
144#ifndef __ARCH_HAS_ODD_SIGACTION 144#ifndef __ARCH_HAS_IRIX_SIGACTION
145 compat_uptr_t sa_handler; 145 compat_uptr_t sa_handler;
146 compat_ulong_t sa_flags; 146 compat_ulong_t sa_flags;
147#else 147#else
148 compat_ulong_t sa_flags; 148 compat_uint_t sa_flags;
149 compat_uptr_t sa_handler; 149 compat_uptr_t sa_handler;
150#endif 150#endif
151#ifdef __ARCH_HAS_SA_RESTORER 151#ifdef __ARCH_HAS_SA_RESTORER
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index e83ef39b3bea..fe8c4476f7e4 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -213,7 +213,7 @@ struct devfreq_simple_ondemand_data {
213#endif 213#endif
214 214
215#else /* !CONFIG_PM_DEVFREQ */ 215#else /* !CONFIG_PM_DEVFREQ */
216static struct devfreq *devfreq_add_device(struct device *dev, 216static inline struct devfreq *devfreq_add_device(struct device *dev,
217 struct devfreq_dev_profile *profile, 217 struct devfreq_dev_profile *profile,
218 const char *governor_name, 218 const char *governor_name,
219 void *data) 219 void *data)
@@ -221,34 +221,34 @@ static struct devfreq *devfreq_add_device(struct device *dev,
221 return NULL; 221 return NULL;
222} 222}
223 223
224static int devfreq_remove_device(struct devfreq *devfreq) 224static inline int devfreq_remove_device(struct devfreq *devfreq)
225{ 225{
226 return 0; 226 return 0;
227} 227}
228 228
229static int devfreq_suspend_device(struct devfreq *devfreq) 229static inline int devfreq_suspend_device(struct devfreq *devfreq)
230{ 230{
231 return 0; 231 return 0;
232} 232}
233 233
234static int devfreq_resume_device(struct devfreq *devfreq) 234static inline int devfreq_resume_device(struct devfreq *devfreq)
235{ 235{
236 return 0; 236 return 0;
237} 237}
238 238
239static struct opp *devfreq_recommended_opp(struct device *dev, 239static inline struct opp *devfreq_recommended_opp(struct device *dev,
240 unsigned long *freq, u32 flags) 240 unsigned long *freq, u32 flags)
241{ 241{
242 return -EINVAL; 242 return ERR_PTR(-EINVAL);
243} 243}
244 244
245static int devfreq_register_opp_notifier(struct device *dev, 245static inline int devfreq_register_opp_notifier(struct device *dev,
246 struct devfreq *devfreq) 246 struct devfreq *devfreq)
247{ 247{
248 return -EINVAL; 248 return -EINVAL;
249} 249}
250 250
251static int devfreq_unregister_opp_notifier(struct device *dev, 251static inline int devfreq_unregister_opp_notifier(struct device *dev,
252 struct devfreq *devfreq) 252 struct devfreq *devfreq)
253{ 253{
254 return -EINVAL; 254 return -EINVAL;
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
index d755b28ba635..d90ebbe02ca4 100644
--- a/include/linux/gpio-pxa.h
+++ b/include/linux/gpio-pxa.h
@@ -14,6 +14,7 @@ extern int pxa_last_gpio;
14extern int pxa_irq_to_gpio(int irq); 14extern int pxa_irq_to_gpio(int irq);
15 15
16struct pxa_gpio_platform_data { 16struct pxa_gpio_platform_data {
17 int irq_base;
17 int (*gpio_set_wake)(unsigned int gpio, unsigned int on); 18 int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
18}; 19};
19 20
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index cad77fe09d77..c13958251927 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -518,7 +518,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
518int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, 518int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
519 void *data, unsigned long len); 519 void *data, unsigned long len);
520int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, 520int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
521 gpa_t gpa); 521 gpa_t gpa, unsigned long len);
522int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); 522int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
523int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); 523int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
524struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); 524struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index fa7cc7244cbd..b0bcce0ddc95 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -71,6 +71,7 @@ struct gfn_to_hva_cache {
71 u64 generation; 71 u64 generation;
72 gpa_t gpa; 72 gpa_t gpa;
73 unsigned long hva; 73 unsigned long hva;
74 unsigned long len;
74 struct kvm_memory_slot *memslot; 75 struct kvm_memory_slot *memslot;
75}; 76};
76 77
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b3d00fa4b314..6151e903eef0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -210,9 +210,9 @@ struct netdev_hw_addr {
210#define NETDEV_HW_ADDR_T_SLAVE 3 210#define NETDEV_HW_ADDR_T_SLAVE 3
211#define NETDEV_HW_ADDR_T_UNICAST 4 211#define NETDEV_HW_ADDR_T_UNICAST 4
212#define NETDEV_HW_ADDR_T_MULTICAST 5 212#define NETDEV_HW_ADDR_T_MULTICAST 5
213 bool synced;
214 bool global_use; 213 bool global_use;
215 int refcount; 214 int refcount;
215 int synced;
216 struct rcu_head rcu_head; 216 struct rcu_head rcu_head;
217}; 217};
218 218
@@ -895,7 +895,7 @@ struct netdev_fcoe_hbainfo {
895 * 895 *
896 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) 896 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
897 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, 897 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
898 * struct net_device *dev) 898 * struct net_device *dev, u32 filter_mask)
899 * 899 *
900 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); 900 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
901 * Called to change device carrier. Soft-devices (like dummy, team, etc) 901 * Called to change device carrier. Soft-devices (like dummy, team, etc)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2461033a7987..710067f3618c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -916,6 +916,7 @@ void pci_disable_rom(struct pci_dev *pdev);
916void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 916void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
917void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 917void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
918size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); 918size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
919void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
919 920
920/* Power management related routines */ 921/* Power management related routines */
921int pci_save_state(struct pci_dev *dev); 922int pci_save_state(struct pci_dev *dev);
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 778804df293f..2c2a9e8d8578 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -118,9 +118,9 @@ struct pinctrl_desc {
118 const char *name; 118 const char *name;
119 struct pinctrl_pin_desc const *pins; 119 struct pinctrl_pin_desc const *pins;
120 unsigned int npins; 120 unsigned int npins;
121 struct pinctrl_ops *pctlops; 121 const struct pinctrl_ops *pctlops;
122 struct pinmux_ops *pmxops; 122 const struct pinmux_ops *pmxops;
123 struct pinconf_ops *confops; 123 const struct pinconf_ops *confops;
124 struct module *owner; 124 struct module *owner;
125}; 125};
126 126
diff --git a/include/linux/signal.h b/include/linux/signal.h
index a2dcb94ea49d..9475c5cb28bc 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -250,11 +250,11 @@ extern int show_unhandled_signals;
250extern int sigsuspend(sigset_t *); 250extern int sigsuspend(sigset_t *);
251 251
252struct sigaction { 252struct sigaction {
253#ifndef __ARCH_HAS_ODD_SIGACTION 253#ifndef __ARCH_HAS_IRIX_SIGACTION
254 __sighandler_t sa_handler; 254 __sighandler_t sa_handler;
255 unsigned long sa_flags; 255 unsigned long sa_flags;
256#else 256#else
257 unsigned long sa_flags; 257 unsigned int sa_flags;
258 __sighandler_t sa_handler; 258 __sighandler_t sa_handler;
259#endif 259#endif
260#ifdef __ARCH_HAS_SA_RESTORER 260#ifdef __ARCH_HAS_SA_RESTORER
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 441f5bfdab8e..b8292d8cc9fa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2643,6 +2643,13 @@ static inline void nf_reset(struct sk_buff *skb)
2643#endif 2643#endif
2644} 2644}
2645 2645
2646static inline void nf_reset_trace(struct sk_buff *skb)
2647{
2648#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)
2649 skb->nf_trace = 0;
2650#endif
2651}
2652
2646/* Note: This doesn't put any conntrack and bridge info in dst. */ 2653/* Note: This doesn't put any conntrack and bridge info in dst. */
2647static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) 2654static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2648{ 2655{
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 399162b50a8d..e1379b4e8faf 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -1074,7 +1074,8 @@ void fc_rport_terminate_io(struct fc_rport *);
1074/* 1074/*
1075 * DISCOVERY LAYER 1075 * DISCOVERY LAYER
1076 *****************************/ 1076 *****************************/
1077int fc_disc_init(struct fc_lport *); 1077void fc_disc_init(struct fc_lport *);
1078void fc_disc_config(struct fc_lport *, void *);
1078 1079
1079static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc) 1080static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)
1080{ 1081{
diff --git a/include/sound/max98090.h b/include/sound/max98090.h
index 95efb13f8478..95efb13f8478 100755..100644
--- a/include/sound/max98090.h
+++ b/include/sound/max98090.h
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index e1ef63d4a5c4..44a30b108683 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -488,6 +488,7 @@ struct snd_soc_dapm_path {
488 /* status */ 488 /* status */
489 u32 connect:1; /* source and sink widgets are connected */ 489 u32 connect:1; /* source and sink widgets are connected */
490 u32 walked:1; /* path has been walked */ 490 u32 walked:1; /* path has been walked */
491 u32 walking:1; /* path is in the process of being walked */
491 u32 weak:1; /* path ignored for power management */ 492 u32 weak:1; /* path ignored for power management */
492 493
493 int (*connected)(struct snd_soc_dapm_widget *source, 494 int (*connected)(struct snd_soc_dapm_widget *source,
diff --git a/ipc/msg.c b/ipc/msg.c
index 31cd1bf6af27..fede1d06ef30 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -872,6 +872,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
872 goto out_unlock; 872 goto out_unlock;
873 break; 873 break;
874 } 874 }
875 msg = ERR_PTR(-EAGAIN);
875 } else 876 } else
876 break; 877 break;
877 msg_counter++; 878 msg_counter++;
diff --git a/mm/mmap.c b/mm/mmap.c
index 6466699b16cb..0db0de1c2fbe 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1940,7 +1940,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
1940 1940
1941 /* Check the cache first. */ 1941 /* Check the cache first. */
1942 /* (Cache hit rate is typically around 35%.) */ 1942 /* (Cache hit rate is typically around 35%.) */
1943 vma = mm->mmap_cache; 1943 vma = ACCESS_ONCE(mm->mmap_cache);
1944 if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) { 1944 if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) {
1945 struct rb_node *rb_node; 1945 struct rb_node *rb_node;
1946 1946
diff --git a/mm/nommu.c b/mm/nommu.c
index e19328087534..2f3ea749c318 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -821,7 +821,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
821 struct vm_area_struct *vma; 821 struct vm_area_struct *vma;
822 822
823 /* check the cache first */ 823 /* check the cache first */
824 vma = mm->mmap_cache; 824 vma = ACCESS_ONCE(mm->mmap_cache);
825 if (vma && vma->vm_start <= addr && vma->vm_end > addr) 825 if (vma && vma->vm_start <= addr && vma->vm_end > addr)
826 return vma; 826 return vma;
827 827
diff --git a/net/core/dev.c b/net/core/dev.c
index b13e5c766c11..e7d68ed8aafe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1624,7 +1624,6 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1624 } 1624 }
1625 1625
1626 skb_orphan(skb); 1626 skb_orphan(skb);
1627 nf_reset(skb);
1628 1627
1629 if (unlikely(!is_skb_forwardable(dev, skb))) { 1628 if (unlikely(!is_skb_forwardable(dev, skb))) {
1630 atomic_long_inc(&dev->rx_dropped); 1629 atomic_long_inc(&dev->rx_dropped);
@@ -1640,6 +1639,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1640 skb->mark = 0; 1639 skb->mark = 0;
1641 secpath_reset(skb); 1640 secpath_reset(skb);
1642 nf_reset(skb); 1641 nf_reset(skb);
1642 nf_reset_trace(skb);
1643 return netif_rx(skb); 1643 return netif_rx(skb);
1644} 1644}
1645EXPORT_SYMBOL_GPL(dev_forward_skb); 1645EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -3314,6 +3314,7 @@ int netdev_rx_handler_register(struct net_device *dev,
3314 if (dev->rx_handler) 3314 if (dev->rx_handler)
3315 return -EBUSY; 3315 return -EBUSY;
3316 3316
3317 /* Note: rx_handler_data must be set before rx_handler */
3317 rcu_assign_pointer(dev->rx_handler_data, rx_handler_data); 3318 rcu_assign_pointer(dev->rx_handler_data, rx_handler_data);
3318 rcu_assign_pointer(dev->rx_handler, rx_handler); 3319 rcu_assign_pointer(dev->rx_handler, rx_handler);
3319 3320
@@ -3334,6 +3335,11 @@ void netdev_rx_handler_unregister(struct net_device *dev)
3334 3335
3335 ASSERT_RTNL(); 3336 ASSERT_RTNL();
3336 RCU_INIT_POINTER(dev->rx_handler, NULL); 3337 RCU_INIT_POINTER(dev->rx_handler, NULL);
3338 /* a reader seeing a non NULL rx_handler in a rcu_read_lock()
3339 * section has a guarantee to see a non NULL rx_handler_data
3340 * as well.
3341 */
3342 synchronize_net();
3337 RCU_INIT_POINTER(dev->rx_handler_data, NULL); 3343 RCU_INIT_POINTER(dev->rx_handler_data, NULL);
3338} 3344}
3339EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); 3345EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index bd2eb9d3e369..abdc9e6ef33e 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -37,7 +37,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
37 ha->type = addr_type; 37 ha->type = addr_type;
38 ha->refcount = 1; 38 ha->refcount = 1;
39 ha->global_use = global; 39 ha->global_use = global;
40 ha->synced = false; 40 ha->synced = 0;
41 list_add_tail_rcu(&ha->list, &list->list); 41 list_add_tail_rcu(&ha->list, &list->list);
42 list->count++; 42 list->count++;
43 43
@@ -165,7 +165,7 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
165 addr_len, ha->type); 165 addr_len, ha->type);
166 if (err) 166 if (err)
167 break; 167 break;
168 ha->synced = true; 168 ha->synced++;
169 ha->refcount++; 169 ha->refcount++;
170 } else if (ha->refcount == 1) { 170 } else if (ha->refcount == 1) {
171 __hw_addr_del(to_list, ha->addr, addr_len, ha->type); 171 __hw_addr_del(to_list, ha->addr, addr_len, ha->type);
@@ -186,7 +186,7 @@ void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
186 if (ha->synced) { 186 if (ha->synced) {
187 __hw_addr_del(to_list, ha->addr, 187 __hw_addr_del(to_list, ha->addr,
188 addr_len, ha->type); 188 addr_len, ha->type);
189 ha->synced = false; 189 ha->synced--;
190 __hw_addr_del(from_list, ha->addr, 190 __hw_addr_del(from_list, ha->addr,
191 addr_len, ha->type); 191 addr_len, ha->type);
192 } 192 }
diff --git a/net/core/flow.c b/net/core/flow.c
index c56ea6f7f6c7..2bfd081c59f7 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -328,7 +328,7 @@ static void flow_cache_flush_per_cpu(void *data)
328 struct flow_flush_info *info = data; 328 struct flow_flush_info *info = data;
329 struct tasklet_struct *tasklet; 329 struct tasklet_struct *tasklet;
330 330
331 tasklet = this_cpu_ptr(&info->cache->percpu->flush_tasklet); 331 tasklet = &this_cpu_ptr(info->cache->percpu)->flush_tasklet;
332 tasklet->data = (unsigned long)info; 332 tasklet->data = (unsigned long)info;
333 tasklet_schedule(tasklet); 333 tasklet_schedule(tasklet);
334} 334}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5fb8d7e47294..b65441da74ab 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -496,8 +496,10 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
496 } 496 }
497 if (ops->fill_info) { 497 if (ops->fill_info) {
498 data = nla_nest_start(skb, IFLA_INFO_DATA); 498 data = nla_nest_start(skb, IFLA_INFO_DATA);
499 if (data == NULL) 499 if (data == NULL) {
500 err = -EMSGSIZE;
500 goto err_cancel_link; 501 goto err_cancel_link;
502 }
501 err = ops->fill_info(skb, dev); 503 err = ops->fill_info(skb, dev);
502 if (err < 0) 504 if (err < 0)
503 goto err_cancel_data; 505 goto err_cancel_data;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index f678507bc829..96083b7a436b 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -802,8 +802,10 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg
802 if (nlh->nlmsg_flags & NLM_F_EXCL || 802 if (nlh->nlmsg_flags & NLM_F_EXCL ||
803 !(nlh->nlmsg_flags & NLM_F_REPLACE)) 803 !(nlh->nlmsg_flags & NLM_F_REPLACE))
804 return -EEXIST; 804 return -EEXIST;
805 805 ifa = ifa_existing;
806 set_ifa_lifetime(ifa_existing, valid_lft, prefered_lft); 806 set_ifa_lifetime(ifa, valid_lft, prefered_lft);
807 rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid);
808 blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
807 } 809 }
808 return 0; 810 return 0;
809} 811}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 26512250e095..a459c4f5b769 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2529,6 +2529,9 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2529static void init_loopback(struct net_device *dev) 2529static void init_loopback(struct net_device *dev)
2530{ 2530{
2531 struct inet6_dev *idev; 2531 struct inet6_dev *idev;
2532 struct net_device *sp_dev;
2533 struct inet6_ifaddr *sp_ifa;
2534 struct rt6_info *sp_rt;
2532 2535
2533 /* ::1 */ 2536 /* ::1 */
2534 2537
@@ -2540,6 +2543,30 @@ static void init_loopback(struct net_device *dev)
2540 } 2543 }
2541 2544
2542 add_addr(idev, &in6addr_loopback, 128, IFA_HOST); 2545 add_addr(idev, &in6addr_loopback, 128, IFA_HOST);
2546
2547 /* Add routes to other interface's IPv6 addresses */
2548 for_each_netdev(dev_net(dev), sp_dev) {
2549 if (!strcmp(sp_dev->name, dev->name))
2550 continue;
2551
2552 idev = __in6_dev_get(sp_dev);
2553 if (!idev)
2554 continue;
2555
2556 read_lock_bh(&idev->lock);
2557 list_for_each_entry(sp_ifa, &idev->addr_list, if_list) {
2558
2559 if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))
2560 continue;
2561
2562 sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);
2563
2564 /* Failure cases are ignored */
2565 if (!IS_ERR(sp_rt))
2566 ip6_ins_rt(sp_rt);
2567 }
2568 read_unlock_bh(&idev->lock);
2569 }
2543} 2570}
2544 2571
2545static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr) 2572static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr)
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index e33fe0ab2568..2bab2aa59745 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -118,6 +118,18 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
118 ipv6_addr_loopback(&hdr->daddr)) 118 ipv6_addr_loopback(&hdr->daddr))
119 goto err; 119 goto err;
120 120
121 /* RFC4291 Errata ID: 3480
122 * Interface-Local scope spans only a single interface on a
123 * node and is useful only for loopback transmission of
124 * multicast. Packets with interface-local scope received
125 * from another node must be discarded.
126 */
127 if (!(skb->pkt_type == PACKET_LOOPBACK ||
128 dev->flags & IFF_LOOPBACK) &&
129 ipv6_addr_is_multicast(&hdr->daddr) &&
130 IPV6_ADDR_MC_SCOPE(&hdr->daddr) == 1)
131 goto err;
132
121 /* RFC4291 2.7 133 /* RFC4291 2.7
122 * Nodes must not originate a packet to a multicast address whose scope 134 * Nodes must not originate a packet to a multicast address whose scope
123 * field contains the reserved value 0; if such a packet is received, it 135 * field contains the reserved value 0; if such a packet is received, it
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 33608c610276..cb631143721c 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -57,7 +57,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
57 if (pfx_len - i >= 32) 57 if (pfx_len - i >= 32)
58 mask = 0; 58 mask = 0;
59 else 59 else
60 mask = htonl(~((1 << (pfx_len - i)) - 1)); 60 mask = htonl((1 << (i - pfx_len + 32)) - 1);
61 61
62 idx = i / 32; 62 idx = i / 32;
63 addr->s6_addr32[idx] &= mask; 63 addr->s6_addr32[idx] &= mask;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 8555f331ea60..5b1e5af25713 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2693,6 +2693,7 @@ static int key_notify_policy_flush(const struct km_event *c)
2693 hdr->sadb_msg_pid = c->portid; 2693 hdr->sadb_msg_pid = c->portid;
2694 hdr->sadb_msg_version = PF_KEY_V2; 2694 hdr->sadb_msg_version = PF_KEY_V2;
2695 hdr->sadb_msg_errno = (uint8_t) 0; 2695 hdr->sadb_msg_errno = (uint8_t) 0;
2696 hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC;
2696 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); 2697 hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
2697 pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net); 2698 pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
2698 return 0; 2699 return 0;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index fb306814576a..a6893602f87a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2582,7 +2582,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2582 list_del(&dep->list); 2582 list_del(&dep->list);
2583 mutex_unlock(&local->mtx); 2583 mutex_unlock(&local->mtx);
2584 2584
2585 ieee80211_roc_notify_destroy(dep); 2585 ieee80211_roc_notify_destroy(dep, true);
2586 return 0; 2586 return 0;
2587 } 2587 }
2588 2588
@@ -2622,7 +2622,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2622 ieee80211_start_next_roc(local); 2622 ieee80211_start_next_roc(local);
2623 mutex_unlock(&local->mtx); 2623 mutex_unlock(&local->mtx);
2624 2624
2625 ieee80211_roc_notify_destroy(found); 2625 ieee80211_roc_notify_destroy(found, true);
2626 } else { 2626 } else {
2627 /* work may be pending so use it all the time */ 2627 /* work may be pending so use it all the time */
2628 found->abort = true; 2628 found->abort = true;
@@ -2632,6 +2632,8 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2632 2632
2633 /* work will clean up etc */ 2633 /* work will clean up etc */
2634 flush_delayed_work(&found->work); 2634 flush_delayed_work(&found->work);
2635 WARN_ON(!found->to_be_freed);
2636 kfree(found);
2635 } 2637 }
2636 2638
2637 return 0; 2639 return 0;
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 78c0d90dd641..931be419ab5a 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -63,6 +63,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
63 enum ieee80211_chanctx_mode mode) 63 enum ieee80211_chanctx_mode mode)
64{ 64{
65 struct ieee80211_chanctx *ctx; 65 struct ieee80211_chanctx *ctx;
66 u32 changed;
66 int err; 67 int err;
67 68
68 lockdep_assert_held(&local->chanctx_mtx); 69 lockdep_assert_held(&local->chanctx_mtx);
@@ -76,6 +77,13 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
76 ctx->conf.rx_chains_dynamic = 1; 77 ctx->conf.rx_chains_dynamic = 1;
77 ctx->mode = mode; 78 ctx->mode = mode;
78 79
80 /* acquire mutex to prevent idle from changing */
81 mutex_lock(&local->mtx);
82 /* turn idle off *before* setting channel -- some drivers need that */
83 changed = ieee80211_idle_off(local);
84 if (changed)
85 ieee80211_hw_config(local, changed);
86
79 if (!local->use_chanctx) { 87 if (!local->use_chanctx) {
80 local->_oper_channel_type = 88 local->_oper_channel_type =
81 cfg80211_get_chandef_type(chandef); 89 cfg80211_get_chandef_type(chandef);
@@ -85,14 +93,17 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
85 err = drv_add_chanctx(local, ctx); 93 err = drv_add_chanctx(local, ctx);
86 if (err) { 94 if (err) {
87 kfree(ctx); 95 kfree(ctx);
88 return ERR_PTR(err); 96 ctx = ERR_PTR(err);
97
98 ieee80211_recalc_idle(local);
99 goto out;
89 } 100 }
90 } 101 }
91 102
103 /* and keep the mutex held until the new chanctx is on the list */
92 list_add_rcu(&ctx->list, &local->chanctx_list); 104 list_add_rcu(&ctx->list, &local->chanctx_list);
93 105
94 mutex_lock(&local->mtx); 106 out:
95 ieee80211_recalc_idle(local);
96 mutex_unlock(&local->mtx); 107 mutex_unlock(&local->mtx);
97 108
98 return ctx; 109 return ctx;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 388580a1bada..5672533a0832 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -309,6 +309,7 @@ struct ieee80211_roc_work {
309 struct ieee80211_channel *chan; 309 struct ieee80211_channel *chan;
310 310
311 bool started, abort, hw_begun, notified; 311 bool started, abort, hw_begun, notified;
312 bool to_be_freed;
312 313
313 unsigned long hw_start_time; 314 unsigned long hw_start_time;
314 315
@@ -1347,7 +1348,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local);
1347void ieee80211_roc_setup(struct ieee80211_local *local); 1348void ieee80211_roc_setup(struct ieee80211_local *local);
1348void ieee80211_start_next_roc(struct ieee80211_local *local); 1349void ieee80211_start_next_roc(struct ieee80211_local *local);
1349void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); 1350void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata);
1350void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc); 1351void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free);
1351void ieee80211_sw_roc_work(struct work_struct *work); 1352void ieee80211_sw_roc_work(struct work_struct *work);
1352void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); 1353void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc);
1353 1354
@@ -1361,6 +1362,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
1361 enum nl80211_iftype type); 1362 enum nl80211_iftype type);
1362void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 1363void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
1363void ieee80211_remove_interfaces(struct ieee80211_local *local); 1364void ieee80211_remove_interfaces(struct ieee80211_local *local);
1365u32 ieee80211_idle_off(struct ieee80211_local *local);
1364void ieee80211_recalc_idle(struct ieee80211_local *local); 1366void ieee80211_recalc_idle(struct ieee80211_local *local);
1365void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 1367void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
1366 const int offset); 1368 const int offset);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index baaa8608e52d..58150f877ec3 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -78,7 +78,7 @@ void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)
78 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER); 78 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER);
79} 79}
80 80
81static u32 ieee80211_idle_off(struct ieee80211_local *local) 81u32 ieee80211_idle_off(struct ieee80211_local *local)
82{ 82{
83 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) 83 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE))
84 return 0; 84 return 0;
@@ -349,21 +349,19 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata)
349static int ieee80211_add_virtual_monitor(struct ieee80211_local *local) 349static int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
350{ 350{
351 struct ieee80211_sub_if_data *sdata; 351 struct ieee80211_sub_if_data *sdata;
352 int ret = 0; 352 int ret;
353 353
354 if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) 354 if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))
355 return 0; 355 return 0;
356 356
357 mutex_lock(&local->iflist_mtx); 357 ASSERT_RTNL();
358 358
359 if (local->monitor_sdata) 359 if (local->monitor_sdata)
360 goto out_unlock; 360 return 0;
361 361
362 sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, GFP_KERNEL); 362 sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, GFP_KERNEL);
363 if (!sdata) { 363 if (!sdata)
364 ret = -ENOMEM; 364 return -ENOMEM;
365 goto out_unlock;
366 }
367 365
368 /* set up data */ 366 /* set up data */
369 sdata->local = local; 367 sdata->local = local;
@@ -377,13 +375,13 @@ static int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
377 if (WARN_ON(ret)) { 375 if (WARN_ON(ret)) {
378 /* ok .. stupid driver, it asked for this! */ 376 /* ok .. stupid driver, it asked for this! */
379 kfree(sdata); 377 kfree(sdata);
380 goto out_unlock; 378 return ret;
381 } 379 }
382 380
383 ret = ieee80211_check_queues(sdata); 381 ret = ieee80211_check_queues(sdata);
384 if (ret) { 382 if (ret) {
385 kfree(sdata); 383 kfree(sdata);
386 goto out_unlock; 384 return ret;
387 } 385 }
388 386
389 ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef, 387 ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef,
@@ -391,13 +389,14 @@ static int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
391 if (ret) { 389 if (ret) {
392 drv_remove_interface(local, sdata); 390 drv_remove_interface(local, sdata);
393 kfree(sdata); 391 kfree(sdata);
394 goto out_unlock; 392 return ret;
395 } 393 }
396 394
395 mutex_lock(&local->iflist_mtx);
397 rcu_assign_pointer(local->monitor_sdata, sdata); 396 rcu_assign_pointer(local->monitor_sdata, sdata);
398 out_unlock:
399 mutex_unlock(&local->iflist_mtx); 397 mutex_unlock(&local->iflist_mtx);
400 return ret; 398
399 return 0;
401} 400}
402 401
403static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) 402static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
@@ -407,14 +406,20 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
407 if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) 406 if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))
408 return; 407 return;
409 408
409 ASSERT_RTNL();
410
410 mutex_lock(&local->iflist_mtx); 411 mutex_lock(&local->iflist_mtx);
411 412
412 sdata = rcu_dereference_protected(local->monitor_sdata, 413 sdata = rcu_dereference_protected(local->monitor_sdata,
413 lockdep_is_held(&local->iflist_mtx)); 414 lockdep_is_held(&local->iflist_mtx));
414 if (!sdata) 415 if (!sdata) {
415 goto out_unlock; 416 mutex_unlock(&local->iflist_mtx);
417 return;
418 }
416 419
417 rcu_assign_pointer(local->monitor_sdata, NULL); 420 rcu_assign_pointer(local->monitor_sdata, NULL);
421 mutex_unlock(&local->iflist_mtx);
422
418 synchronize_net(); 423 synchronize_net();
419 424
420 ieee80211_vif_release_channel(sdata); 425 ieee80211_vif_release_channel(sdata);
@@ -422,8 +427,6 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
422 drv_remove_interface(local, sdata); 427 drv_remove_interface(local, sdata);
423 428
424 kfree(sdata); 429 kfree(sdata);
425 out_unlock:
426 mutex_unlock(&local->iflist_mtx);
427} 430}
428 431
429/* 432/*
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 29ce2aa87e7b..4749b3858695 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -1060,7 +1060,8 @@ void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
1060 1060
1061 rcu_read_lock(); 1061 rcu_read_lock();
1062 list_for_each_entry_rcu(sdata, &local->interfaces, list) 1062 list_for_each_entry_rcu(sdata, &local->interfaces, list)
1063 if (ieee80211_vif_is_mesh(&sdata->vif)) 1063 if (ieee80211_vif_is_mesh(&sdata->vif) &&
1064 ieee80211_sdata_running(sdata))
1064 ieee80211_queue_work(&local->hw, &sdata->work); 1065 ieee80211_queue_work(&local->hw, &sdata->work);
1065 rcu_read_unlock(); 1066 rcu_read_unlock();
1066} 1067}
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 141577412d84..82cc30318a86 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3608,8 +3608,10 @@ void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local)
3608 3608
3609 /* Restart STA timers */ 3609 /* Restart STA timers */
3610 rcu_read_lock(); 3610 rcu_read_lock();
3611 list_for_each_entry_rcu(sdata, &local->interfaces, list) 3611 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
3612 ieee80211_restart_sta_timer(sdata); 3612 if (ieee80211_sdata_running(sdata))
3613 ieee80211_restart_sta_timer(sdata);
3614 }
3613 rcu_read_unlock(); 3615 rcu_read_unlock();
3614} 3616}
3615 3617
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index cc79b4a2e821..430bd254e496 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -297,10 +297,13 @@ void ieee80211_start_next_roc(struct ieee80211_local *local)
297 } 297 }
298} 298}
299 299
300void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc) 300void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free)
301{ 301{
302 struct ieee80211_roc_work *dep, *tmp; 302 struct ieee80211_roc_work *dep, *tmp;
303 303
304 if (WARN_ON(roc->to_be_freed))
305 return;
306
304 /* was never transmitted */ 307 /* was never transmitted */
305 if (roc->frame) { 308 if (roc->frame) {
306 cfg80211_mgmt_tx_status(&roc->sdata->wdev, 309 cfg80211_mgmt_tx_status(&roc->sdata->wdev,
@@ -316,9 +319,12 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
316 GFP_KERNEL); 319 GFP_KERNEL);
317 320
318 list_for_each_entry_safe(dep, tmp, &roc->dependents, list) 321 list_for_each_entry_safe(dep, tmp, &roc->dependents, list)
319 ieee80211_roc_notify_destroy(dep); 322 ieee80211_roc_notify_destroy(dep, true);
320 323
321 kfree(roc); 324 if (free)
325 kfree(roc);
326 else
327 roc->to_be_freed = true;
322} 328}
323 329
324void ieee80211_sw_roc_work(struct work_struct *work) 330void ieee80211_sw_roc_work(struct work_struct *work)
@@ -331,6 +337,9 @@ void ieee80211_sw_roc_work(struct work_struct *work)
331 337
332 mutex_lock(&local->mtx); 338 mutex_lock(&local->mtx);
333 339
340 if (roc->to_be_freed)
341 goto out_unlock;
342
334 if (roc->abort) 343 if (roc->abort)
335 goto finish; 344 goto finish;
336 345
@@ -370,7 +379,7 @@ void ieee80211_sw_roc_work(struct work_struct *work)
370 finish: 379 finish:
371 list_del(&roc->list); 380 list_del(&roc->list);
372 started = roc->started; 381 started = roc->started;
373 ieee80211_roc_notify_destroy(roc); 382 ieee80211_roc_notify_destroy(roc, !roc->abort);
374 383
375 if (started) { 384 if (started) {
376 drv_flush(local, false); 385 drv_flush(local, false);
@@ -410,7 +419,7 @@ static void ieee80211_hw_roc_done(struct work_struct *work)
410 419
411 list_del(&roc->list); 420 list_del(&roc->list);
412 421
413 ieee80211_roc_notify_destroy(roc); 422 ieee80211_roc_notify_destroy(roc, true);
414 423
415 /* if there's another roc, start it now */ 424 /* if there's another roc, start it now */
416 ieee80211_start_next_roc(local); 425 ieee80211_start_next_roc(local);
@@ -460,12 +469,14 @@ void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata)
460 list_for_each_entry_safe(roc, tmp, &tmp_list, list) { 469 list_for_each_entry_safe(roc, tmp, &tmp_list, list) {
461 if (local->ops->remain_on_channel) { 470 if (local->ops->remain_on_channel) {
462 list_del(&roc->list); 471 list_del(&roc->list);
463 ieee80211_roc_notify_destroy(roc); 472 ieee80211_roc_notify_destroy(roc, true);
464 } else { 473 } else {
465 ieee80211_queue_delayed_work(&local->hw, &roc->work, 0); 474 ieee80211_queue_delayed_work(&local->hw, &roc->work, 0);
466 475
467 /* work will clean up etc */ 476 /* work will clean up etc */
468 flush_delayed_work(&roc->work); 477 flush_delayed_work(&roc->work);
478 WARN_ON(!roc->to_be_freed);
479 kfree(roc);
469 } 480 }
470 } 481 }
471 482
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bb73ed2d20b9..c6844ad080be 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2675,7 +2675,19 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)
2675 2675
2676 memset(nskb->cb, 0, sizeof(nskb->cb)); 2676 memset(nskb->cb, 0, sizeof(nskb->cb));
2677 2677
2678 ieee80211_tx_skb(rx->sdata, nskb); 2678 if (rx->sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) {
2679 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(nskb);
2680
2681 info->flags = IEEE80211_TX_CTL_TX_OFFCHAN |
2682 IEEE80211_TX_INTFL_OFFCHAN_TX_OK |
2683 IEEE80211_TX_CTL_NO_CCK_RATE;
2684 if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)
2685 info->hw_queue =
2686 local->hw.offchannel_tx_hw_queue;
2687 }
2688
2689 __ieee80211_tx_skb_tid_band(rx->sdata, nskb, 7,
2690 status->band);
2679 } 2691 }
2680 dev_kfree_skb(rx->skb); 2692 dev_kfree_skb(rx->skb);
2681 return RX_QUEUED; 2693 return RX_QUEUED;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index a79ce820cb50..238a0cca320e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -766,6 +766,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
766 struct ieee80211_local *local; 766 struct ieee80211_local *local;
767 struct ieee80211_sub_if_data *sdata; 767 struct ieee80211_sub_if_data *sdata;
768 int ret, i; 768 int ret, i;
769 bool have_key = false;
769 770
770 might_sleep(); 771 might_sleep();
771 772
@@ -793,12 +794,19 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
793 list_del_rcu(&sta->list); 794 list_del_rcu(&sta->list);
794 795
795 mutex_lock(&local->key_mtx); 796 mutex_lock(&local->key_mtx);
796 for (i = 0; i < NUM_DEFAULT_KEYS; i++) 797 for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
797 __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i])); 798 __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]));
798 if (sta->ptk) 799 have_key = true;
800 }
801 if (sta->ptk) {
799 __ieee80211_key_free(key_mtx_dereference(local, sta->ptk)); 802 __ieee80211_key_free(key_mtx_dereference(local, sta->ptk));
803 have_key = true;
804 }
800 mutex_unlock(&local->key_mtx); 805 mutex_unlock(&local->key_mtx);
801 806
807 if (!have_key)
808 synchronize_net();
809
802 sta->dead = true; 810 sta->dead = true;
803 811
804 local->num_sta--; 812 local->num_sta--;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 6bcce401fd1c..fedee3943661 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -568,6 +568,7 @@ static int __init nf_conntrack_standalone_init(void)
568 register_net_sysctl(&init_net, "net", nf_ct_netfilter_table); 568 register_net_sysctl(&init_net, "net", nf_ct_netfilter_table);
569 if (!nf_ct_netfilter_header) { 569 if (!nf_ct_netfilter_header) {
570 pr_err("nf_conntrack: can't register to sysctl.\n"); 570 pr_err("nf_conntrack: can't register to sysctl.\n");
571 ret = -ENOMEM;
571 goto out_sysctl; 572 goto out_sysctl;
572 } 573 }
573#endif 574#endif
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 589d686f0b4c..dc3fd5d44464 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -49,6 +49,8 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb,
49 return -EINVAL; 49 return -EINVAL;
50 50
51 acct_name = nla_data(tb[NFACCT_NAME]); 51 acct_name = nla_data(tb[NFACCT_NAME]);
52 if (strlen(acct_name) == 0)
53 return -EINVAL;
52 54
53 list_for_each_entry(nfacct, &nfnl_acct_list, head) { 55 list_for_each_entry(nfacct, &nfnl_acct_list, head) {
54 if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0) 56 if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0)
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 1cb48540f86a..42680b2baa11 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -1062,8 +1062,10 @@ static int __init nfnetlink_queue_init(void)
1062 1062
1063#ifdef CONFIG_PROC_FS 1063#ifdef CONFIG_PROC_FS
1064 if (!proc_create("nfnetlink_queue", 0440, 1064 if (!proc_create("nfnetlink_queue", 0440,
1065 proc_net_netfilter, &nfqnl_file_ops)) 1065 proc_net_netfilter, &nfqnl_file_ops)) {
1066 status = -ENOMEM;
1066 goto cleanup_subsys; 1067 goto cleanup_subsys;
1068 }
1067#endif 1069#endif
1068 1070
1069 register_netdevice_notifier(&nfqnl_dev_notifier); 1071 register_netdevice_notifier(&nfqnl_dev_notifier);
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index b530afadd76c..ee25f25f0cd6 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -107,8 +107,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
107 accept_sk->sk_state_change(sk); 107 accept_sk->sk_state_change(sk);
108 108
109 bh_unlock_sock(accept_sk); 109 bh_unlock_sock(accept_sk);
110
111 sock_orphan(accept_sk);
112 } 110 }
113 111
114 if (listen == true) { 112 if (listen == true) {
@@ -134,8 +132,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
134 132
135 bh_unlock_sock(sk); 133 bh_unlock_sock(sk);
136 134
137 sock_orphan(sk);
138
139 sk_del_node_init(sk); 135 sk_del_node_init(sk);
140 } 136 }
141 137
@@ -164,8 +160,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
164 160
165 bh_unlock_sock(sk); 161 bh_unlock_sock(sk);
166 162
167 sock_orphan(sk);
168
169 sk_del_node_init(sk); 163 sk_del_node_init(sk);
170 } 164 }
171 165
@@ -827,7 +821,6 @@ static void nfc_llcp_recv_ui(struct nfc_llcp_local *local,
827 skb_get(skb); 821 skb_get(skb);
828 } else { 822 } else {
829 pr_err("Receive queue is full\n"); 823 pr_err("Receive queue is full\n");
830 kfree_skb(skb);
831 } 824 }
832 825
833 nfc_llcp_sock_put(llcp_sock); 826 nfc_llcp_sock_put(llcp_sock);
@@ -1028,7 +1021,6 @@ static void nfc_llcp_recv_hdlc(struct nfc_llcp_local *local,
1028 skb_get(skb); 1021 skb_get(skb);
1029 } else { 1022 } else {
1030 pr_err("Receive queue is full\n"); 1023 pr_err("Receive queue is full\n");
1031 kfree_skb(skb);
1032 } 1024 }
1033 } 1025 }
1034 1026
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 5c7cdf3f2a83..8f025746f337 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -270,7 +270,9 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
270 } 270 }
271 271
272 if (sk->sk_state == LLCP_CONNECTED || !newsock) { 272 if (sk->sk_state == LLCP_CONNECTED || !newsock) {
273 nfc_llcp_accept_unlink(sk); 273 list_del_init(&lsk->accept_queue);
274 sock_put(sk);
275
274 if (newsock) 276 if (newsock)
275 sock_graft(sk, newsock); 277 sock_graft(sk, newsock);
276 278
@@ -464,8 +466,6 @@ static int llcp_sock_release(struct socket *sock)
464 nfc_llcp_accept_unlink(accept_sk); 466 nfc_llcp_accept_unlink(accept_sk);
465 467
466 release_sock(accept_sk); 468 release_sock(accept_sk);
467
468 sock_orphan(accept_sk);
469 } 469 }
470 } 470 }
471 471
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 13aa47aa2ffb..1bc210ffcba2 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -962,8 +962,11 @@ cbq_dequeue(struct Qdisc *sch)
962 cbq_update(q); 962 cbq_update(q);
963 if ((incr -= incr2) < 0) 963 if ((incr -= incr2) < 0)
964 incr = 0; 964 incr = 0;
965 q->now += incr;
966 } else {
967 if (now > q->now)
968 q->now = now;
965 } 969 }
966 q->now += incr;
967 q->now_rt = now; 970 q->now_rt = now;
968 971
969 for (;;) { 972 for (;;) {
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 4e606fcb2534..55786283a3df 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -195,7 +195,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
195 flow->deficit = q->quantum; 195 flow->deficit = q->quantum;
196 flow->dropped = 0; 196 flow->dropped = 0;
197 } 197 }
198 if (++sch->q.qlen < sch->limit) 198 if (++sch->q.qlen <= sch->limit)
199 return NET_XMIT_SUCCESS; 199 return NET_XMIT_SUCCESS;
200 200
201 q->drop_overlimit++; 201 q->drop_overlimit++;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index ffad48109a22..eac7e0ee23c1 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -904,7 +904,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate)
904 u64 mult; 904 u64 mult;
905 int shift; 905 int shift;
906 906
907 r->rate_bps = rate << 3; 907 r->rate_bps = (u64)rate << 3;
908 r->shift = 0; 908 r->shift = 0;
909 r->mult = 1; 909 r->mult = 1;
910 /* 910 /*
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 971282b6f6a3..2db702d82e7d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1412,8 +1412,8 @@ static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock,
1412 if (UNIXCB(skb).cred) 1412 if (UNIXCB(skb).cred)
1413 return; 1413 return;
1414 if (test_bit(SOCK_PASSCRED, &sock->flags) || 1414 if (test_bit(SOCK_PASSCRED, &sock->flags) ||
1415 (other->sk_socket && 1415 !other->sk_socket ||
1416 test_bit(SOCK_PASSCRED, &other->sk_socket->flags))) { 1416 test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) {
1417 UNIXCB(skb).pid = get_pid(task_tgid(current)); 1417 UNIXCB(skb).pid = get_pid(task_tgid(current));
1418 UNIXCB(skb).cred = get_current_cred(); 1418 UNIXCB(skb).cred = get_current_cred();
1419 } 1419 }
@@ -1993,7 +1993,7 @@ again:
1993 if ((UNIXCB(skb).pid != siocb->scm->pid) || 1993 if ((UNIXCB(skb).pid != siocb->scm->pid) ||
1994 (UNIXCB(skb).cred != siocb->scm->cred)) 1994 (UNIXCB(skb).cred != siocb->scm->cred))
1995 break; 1995 break;
1996 } else { 1996 } else if (test_bit(SOCK_PASSCRED, &sock->flags)) {
1997 /* Copy credentials */ 1997 /* Copy credentials */
1998 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); 1998 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
1999 check_creds = 1; 1999 check_creds = 1;
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index ca511c4f388a..d8079daf1bde 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -207,7 +207,7 @@ static struct sock *__vsock_find_bound_socket(struct sockaddr_vm *addr)
207 struct vsock_sock *vsk; 207 struct vsock_sock *vsk;
208 208
209 list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table) 209 list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table)
210 if (vsock_addr_equals_addr_any(addr, &vsk->local_addr)) 210 if (addr->svm_port == vsk->local_addr.svm_port)
211 return sk_vsock(vsk); 211 return sk_vsock(vsk);
212 212
213 return NULL; 213 return NULL;
@@ -220,8 +220,8 @@ static struct sock *__vsock_find_connected_socket(struct sockaddr_vm *src,
220 220
221 list_for_each_entry(vsk, vsock_connected_sockets(src, dst), 221 list_for_each_entry(vsk, vsock_connected_sockets(src, dst),
222 connected_table) { 222 connected_table) {
223 if (vsock_addr_equals_addr(src, &vsk->remote_addr) 223 if (vsock_addr_equals_addr(src, &vsk->remote_addr) &&
224 && vsock_addr_equals_addr(dst, &vsk->local_addr)) { 224 dst->svm_port == vsk->local_addr.svm_port) {
225 return sk_vsock(vsk); 225 return sk_vsock(vsk);
226 } 226 }
227 } 227 }
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index a70ace83a153..1f6508e249ae 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -464,19 +464,16 @@ static struct sock *vmci_transport_get_pending(
464 struct vsock_sock *vlistener; 464 struct vsock_sock *vlistener;
465 struct vsock_sock *vpending; 465 struct vsock_sock *vpending;
466 struct sock *pending; 466 struct sock *pending;
467 struct sockaddr_vm src;
468
469 vsock_addr_init(&src, pkt->dg.src.context, pkt->src_port);
467 470
468 vlistener = vsock_sk(listener); 471 vlistener = vsock_sk(listener);
469 472
470 list_for_each_entry(vpending, &vlistener->pending_links, 473 list_for_each_entry(vpending, &vlistener->pending_links,
471 pending_links) { 474 pending_links) {
472 struct sockaddr_vm src;
473 struct sockaddr_vm dst;
474
475 vsock_addr_init(&src, pkt->dg.src.context, pkt->src_port);
476 vsock_addr_init(&dst, pkt->dg.dst.context, pkt->dst_port);
477
478 if (vsock_addr_equals_addr(&src, &vpending->remote_addr) && 475 if (vsock_addr_equals_addr(&src, &vpending->remote_addr) &&
479 vsock_addr_equals_addr(&dst, &vpending->local_addr)) { 476 pkt->dst_port == vpending->local_addr.svm_port) {
480 pending = sk_vsock(vpending); 477 pending = sk_vsock(vpending);
481 sock_hold(pending); 478 sock_hold(pending);
482 goto found; 479 goto found;
@@ -739,10 +736,15 @@ static int vmci_transport_recv_stream_cb(void *data, struct vmci_datagram *dg)
739 */ 736 */
740 bh_lock_sock(sk); 737 bh_lock_sock(sk);
741 738
742 if (!sock_owned_by_user(sk) && sk->sk_state == SS_CONNECTED) 739 if (!sock_owned_by_user(sk)) {
743 vmci_trans(vsk)->notify_ops->handle_notify_pkt( 740 /* The local context ID may be out of date, update it. */
744 sk, pkt, true, &dst, &src, 741 vsk->local_addr.svm_cid = dst.svm_cid;
745 &bh_process_pkt); 742
743 if (sk->sk_state == SS_CONNECTED)
744 vmci_trans(vsk)->notify_ops->handle_notify_pkt(
745 sk, pkt, true, &dst, &src,
746 &bh_process_pkt);
747 }
746 748
747 bh_unlock_sock(sk); 749 bh_unlock_sock(sk);
748 750
@@ -902,6 +904,9 @@ static void vmci_transport_recv_pkt_work(struct work_struct *work)
902 904
903 lock_sock(sk); 905 lock_sock(sk);
904 906
907 /* The local context ID may be out of date. */
908 vsock_sk(sk)->local_addr.svm_cid = pkt->dg.dst.context;
909
905 switch (sk->sk_state) { 910 switch (sk->sk_state) {
906 case SS_LISTEN: 911 case SS_LISTEN:
907 vmci_transport_recv_listen(sk, pkt); 912 vmci_transport_recv_listen(sk, pkt);
@@ -958,6 +963,10 @@ static int vmci_transport_recv_listen(struct sock *sk,
958 pending = vmci_transport_get_pending(sk, pkt); 963 pending = vmci_transport_get_pending(sk, pkt);
959 if (pending) { 964 if (pending) {
960 lock_sock(pending); 965 lock_sock(pending);
966
967 /* The local context ID may be out of date. */
968 vsock_sk(pending)->local_addr.svm_cid = pkt->dg.dst.context;
969
961 switch (pending->sk_state) { 970 switch (pending->sk_state) {
962 case SS_CONNECTING: 971 case SS_CONNECTING:
963 err = vmci_transport_recv_connecting_server(sk, 972 err = vmci_transport_recv_connecting_server(sk,
diff --git a/net/vmw_vsock/vsock_addr.c b/net/vmw_vsock/vsock_addr.c
index b7df1aea7c59..ec2611b4ea0e 100644
--- a/net/vmw_vsock/vsock_addr.c
+++ b/net/vmw_vsock/vsock_addr.c
@@ -64,16 +64,6 @@ bool vsock_addr_equals_addr(const struct sockaddr_vm *addr,
64} 64}
65EXPORT_SYMBOL_GPL(vsock_addr_equals_addr); 65EXPORT_SYMBOL_GPL(vsock_addr_equals_addr);
66 66
67bool vsock_addr_equals_addr_any(const struct sockaddr_vm *addr,
68 const struct sockaddr_vm *other)
69{
70 return (addr->svm_cid == VMADDR_CID_ANY ||
71 other->svm_cid == VMADDR_CID_ANY ||
72 addr->svm_cid == other->svm_cid) &&
73 addr->svm_port == other->svm_port;
74}
75EXPORT_SYMBOL_GPL(vsock_addr_equals_addr_any);
76
77int vsock_addr_cast(const struct sockaddr *addr, 67int vsock_addr_cast(const struct sockaddr *addr,
78 size_t len, struct sockaddr_vm **out_addr) 68 size_t len, struct sockaddr_vm **out_addr)
79{ 69{
diff --git a/net/vmw_vsock/vsock_addr.h b/net/vmw_vsock/vsock_addr.h
index cdfbcefdf843..9ccd5316eac0 100644
--- a/net/vmw_vsock/vsock_addr.h
+++ b/net/vmw_vsock/vsock_addr.h
@@ -24,8 +24,6 @@ bool vsock_addr_bound(const struct sockaddr_vm *addr);
24void vsock_addr_unbind(struct sockaddr_vm *addr); 24void vsock_addr_unbind(struct sockaddr_vm *addr);
25bool vsock_addr_equals_addr(const struct sockaddr_vm *addr, 25bool vsock_addr_equals_addr(const struct sockaddr_vm *addr,
26 const struct sockaddr_vm *other); 26 const struct sockaddr_vm *other);
27bool vsock_addr_equals_addr_any(const struct sockaddr_vm *addr,
28 const struct sockaddr_vm *other);
29int vsock_addr_cast(const struct sockaddr *addr, size_t len, 27int vsock_addr_cast(const struct sockaddr *addr, size_t len,
30 struct sockaddr_vm **out_addr); 28 struct sockaddr_vm **out_addr);
31 29
diff --git a/net/wireless/core.c b/net/wireless/core.c
index ea4155fe9733..6ddf74f0ae1e 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -212,6 +212,39 @@ static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
212 rdev_rfkill_poll(rdev); 212 rdev_rfkill_poll(rdev);
213} 213}
214 214
215void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
216 struct wireless_dev *wdev)
217{
218 lockdep_assert_held(&rdev->devlist_mtx);
219 lockdep_assert_held(&rdev->sched_scan_mtx);
220
221 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_P2P_DEVICE))
222 return;
223
224 if (!wdev->p2p_started)
225 return;
226
227 rdev_stop_p2p_device(rdev, wdev);
228 wdev->p2p_started = false;
229
230 rdev->opencount--;
231
232 if (rdev->scan_req && rdev->scan_req->wdev == wdev) {
233 bool busy = work_busy(&rdev->scan_done_wk);
234
235 /*
236 * If the work isn't pending or running (in which case it would
237 * be waiting for the lock we hold) the driver didn't properly
238 * cancel the scan when the interface was removed. In this case
239 * warn and leak the scan request object to not crash later.
240 */
241 WARN_ON(!busy);
242
243 rdev->scan_req->aborted = true;
244 ___cfg80211_scan_done(rdev, !busy);
245 }
246}
247
215static int cfg80211_rfkill_set_block(void *data, bool blocked) 248static int cfg80211_rfkill_set_block(void *data, bool blocked)
216{ 249{
217 struct cfg80211_registered_device *rdev = data; 250 struct cfg80211_registered_device *rdev = data;
@@ -221,7 +254,8 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked)
221 return 0; 254 return 0;
222 255
223 rtnl_lock(); 256 rtnl_lock();
224 mutex_lock(&rdev->devlist_mtx); 257
258 /* read-only iteration need not hold the devlist_mtx */
225 259
226 list_for_each_entry(wdev, &rdev->wdev_list, list) { 260 list_for_each_entry(wdev, &rdev->wdev_list, list) {
227 if (wdev->netdev) { 261 if (wdev->netdev) {
@@ -231,18 +265,18 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked)
231 /* otherwise, check iftype */ 265 /* otherwise, check iftype */
232 switch (wdev->iftype) { 266 switch (wdev->iftype) {
233 case NL80211_IFTYPE_P2P_DEVICE: 267 case NL80211_IFTYPE_P2P_DEVICE:
234 if (!wdev->p2p_started) 268 /* but this requires it */
235 break; 269 mutex_lock(&rdev->devlist_mtx);
236 rdev_stop_p2p_device(rdev, wdev); 270 mutex_lock(&rdev->sched_scan_mtx);
237 wdev->p2p_started = false; 271 cfg80211_stop_p2p_device(rdev, wdev);
238 rdev->opencount--; 272 mutex_unlock(&rdev->sched_scan_mtx);
273 mutex_unlock(&rdev->devlist_mtx);
239 break; 274 break;
240 default: 275 default:
241 break; 276 break;
242 } 277 }
243 } 278 }
244 279
245 mutex_unlock(&rdev->devlist_mtx);
246 rtnl_unlock(); 280 rtnl_unlock();
247 281
248 return 0; 282 return 0;
@@ -745,17 +779,13 @@ static void wdev_cleanup_work(struct work_struct *work)
745 wdev = container_of(work, struct wireless_dev, cleanup_work); 779 wdev = container_of(work, struct wireless_dev, cleanup_work);
746 rdev = wiphy_to_dev(wdev->wiphy); 780 rdev = wiphy_to_dev(wdev->wiphy);
747 781
748 cfg80211_lock_rdev(rdev); 782 mutex_lock(&rdev->sched_scan_mtx);
749 783
750 if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { 784 if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) {
751 rdev->scan_req->aborted = true; 785 rdev->scan_req->aborted = true;
752 ___cfg80211_scan_done(rdev, true); 786 ___cfg80211_scan_done(rdev, true);
753 } 787 }
754 788
755 cfg80211_unlock_rdev(rdev);
756
757 mutex_lock(&rdev->sched_scan_mtx);
758
759 if (WARN_ON(rdev->sched_scan_req && 789 if (WARN_ON(rdev->sched_scan_req &&
760 rdev->sched_scan_req->dev == wdev->netdev)) { 790 rdev->sched_scan_req->dev == wdev->netdev)) {
761 __cfg80211_stop_sched_scan(rdev, false); 791 __cfg80211_stop_sched_scan(rdev, false);
@@ -781,21 +811,19 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev)
781 return; 811 return;
782 812
783 mutex_lock(&rdev->devlist_mtx); 813 mutex_lock(&rdev->devlist_mtx);
814 mutex_lock(&rdev->sched_scan_mtx);
784 list_del_rcu(&wdev->list); 815 list_del_rcu(&wdev->list);
785 rdev->devlist_generation++; 816 rdev->devlist_generation++;
786 817
787 switch (wdev->iftype) { 818 switch (wdev->iftype) {
788 case NL80211_IFTYPE_P2P_DEVICE: 819 case NL80211_IFTYPE_P2P_DEVICE:
789 if (!wdev->p2p_started) 820 cfg80211_stop_p2p_device(rdev, wdev);
790 break;
791 rdev_stop_p2p_device(rdev, wdev);
792 wdev->p2p_started = false;
793 rdev->opencount--;
794 break; 821 break;
795 default: 822 default:
796 WARN_ON_ONCE(1); 823 WARN_ON_ONCE(1);
797 break; 824 break;
798 } 825 }
826 mutex_unlock(&rdev->sched_scan_mtx);
799 mutex_unlock(&rdev->devlist_mtx); 827 mutex_unlock(&rdev->devlist_mtx);
800} 828}
801EXPORT_SYMBOL(cfg80211_unregister_wdev); 829EXPORT_SYMBOL(cfg80211_unregister_wdev);
@@ -936,6 +964,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
936 cfg80211_update_iface_num(rdev, wdev->iftype, 1); 964 cfg80211_update_iface_num(rdev, wdev->iftype, 1);
937 cfg80211_lock_rdev(rdev); 965 cfg80211_lock_rdev(rdev);
938 mutex_lock(&rdev->devlist_mtx); 966 mutex_lock(&rdev->devlist_mtx);
967 mutex_lock(&rdev->sched_scan_mtx);
939 wdev_lock(wdev); 968 wdev_lock(wdev);
940 switch (wdev->iftype) { 969 switch (wdev->iftype) {
941#ifdef CONFIG_CFG80211_WEXT 970#ifdef CONFIG_CFG80211_WEXT
@@ -967,6 +996,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
967 break; 996 break;
968 } 997 }
969 wdev_unlock(wdev); 998 wdev_unlock(wdev);
999 mutex_unlock(&rdev->sched_scan_mtx);
970 rdev->opencount++; 1000 rdev->opencount++;
971 mutex_unlock(&rdev->devlist_mtx); 1001 mutex_unlock(&rdev->devlist_mtx);
972 cfg80211_unlock_rdev(rdev); 1002 cfg80211_unlock_rdev(rdev);
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 3aec0e429d8a..5845c2b37aa8 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -503,6 +503,9 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
503void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, 503void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
504 enum nl80211_iftype iftype, int num); 504 enum nl80211_iftype iftype, int num);
505 505
506void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
507 struct wireless_dev *wdev);
508
506#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 509#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
507 510
508#ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS 511#ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d44ab216c0ec..58e13a8c95f9 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4702,14 +4702,19 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4702 if (!rdev->ops->scan) 4702 if (!rdev->ops->scan)
4703 return -EOPNOTSUPP; 4703 return -EOPNOTSUPP;
4704 4704
4705 if (rdev->scan_req) 4705 mutex_lock(&rdev->sched_scan_mtx);
4706 return -EBUSY; 4706 if (rdev->scan_req) {
4707 err = -EBUSY;
4708 goto unlock;
4709 }
4707 4710
4708 if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { 4711 if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
4709 n_channels = validate_scan_freqs( 4712 n_channels = validate_scan_freqs(
4710 info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]); 4713 info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]);
4711 if (!n_channels) 4714 if (!n_channels) {
4712 return -EINVAL; 4715 err = -EINVAL;
4716 goto unlock;
4717 }
4713 } else { 4718 } else {
4714 enum ieee80211_band band; 4719 enum ieee80211_band band;
4715 n_channels = 0; 4720 n_channels = 0;
@@ -4723,23 +4728,29 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4723 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) 4728 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp)
4724 n_ssids++; 4729 n_ssids++;
4725 4730
4726 if (n_ssids > wiphy->max_scan_ssids) 4731 if (n_ssids > wiphy->max_scan_ssids) {
4727 return -EINVAL; 4732 err = -EINVAL;
4733 goto unlock;
4734 }
4728 4735
4729 if (info->attrs[NL80211_ATTR_IE]) 4736 if (info->attrs[NL80211_ATTR_IE])
4730 ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); 4737 ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
4731 else 4738 else
4732 ie_len = 0; 4739 ie_len = 0;
4733 4740
4734 if (ie_len > wiphy->max_scan_ie_len) 4741 if (ie_len > wiphy->max_scan_ie_len) {
4735 return -EINVAL; 4742 err = -EINVAL;
4743 goto unlock;
4744 }
4736 4745
4737 request = kzalloc(sizeof(*request) 4746 request = kzalloc(sizeof(*request)
4738 + sizeof(*request->ssids) * n_ssids 4747 + sizeof(*request->ssids) * n_ssids
4739 + sizeof(*request->channels) * n_channels 4748 + sizeof(*request->channels) * n_channels
4740 + ie_len, GFP_KERNEL); 4749 + ie_len, GFP_KERNEL);
4741 if (!request) 4750 if (!request) {
4742 return -ENOMEM; 4751 err = -ENOMEM;
4752 goto unlock;
4753 }
4743 4754
4744 if (n_ssids) 4755 if (n_ssids)
4745 request->ssids = (void *)&request->channels[n_channels]; 4756 request->ssids = (void *)&request->channels[n_channels];
@@ -4876,6 +4887,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4876 kfree(request); 4887 kfree(request);
4877 } 4888 }
4878 4889
4890 unlock:
4891 mutex_unlock(&rdev->sched_scan_mtx);
4879 return err; 4892 return err;
4880} 4893}
4881 4894
@@ -7749,20 +7762,9 @@ static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info)
7749 if (!rdev->ops->stop_p2p_device) 7762 if (!rdev->ops->stop_p2p_device)
7750 return -EOPNOTSUPP; 7763 return -EOPNOTSUPP;
7751 7764
7752 if (!wdev->p2p_started) 7765 mutex_lock(&rdev->sched_scan_mtx);
7753 return 0; 7766 cfg80211_stop_p2p_device(rdev, wdev);
7754 7767 mutex_unlock(&rdev->sched_scan_mtx);
7755 rdev_stop_p2p_device(rdev, wdev);
7756 wdev->p2p_started = false;
7757
7758 mutex_lock(&rdev->devlist_mtx);
7759 rdev->opencount--;
7760 mutex_unlock(&rdev->devlist_mtx);
7761
7762 if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) {
7763 rdev->scan_req->aborted = true;
7764 ___cfg80211_scan_done(rdev, true);
7765 }
7766 7768
7767 return 0; 7769 return 0;
7768} 7770}
@@ -8486,7 +8488,7 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
8486 struct nlattr *nest; 8488 struct nlattr *nest;
8487 int i; 8489 int i;
8488 8490
8489 ASSERT_RDEV_LOCK(rdev); 8491 lockdep_assert_held(&rdev->sched_scan_mtx);
8490 8492
8491 if (WARN_ON(!req)) 8493 if (WARN_ON(!req))
8492 return 0; 8494 return 0;
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 674aadca0079..fd99ea495b7e 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -169,7 +169,7 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
169 union iwreq_data wrqu; 169 union iwreq_data wrqu;
170#endif 170#endif
171 171
172 ASSERT_RDEV_LOCK(rdev); 172 lockdep_assert_held(&rdev->sched_scan_mtx);
173 173
174 request = rdev->scan_req; 174 request = rdev->scan_req;
175 175
@@ -230,9 +230,9 @@ void __cfg80211_scan_done(struct work_struct *wk)
230 rdev = container_of(wk, struct cfg80211_registered_device, 230 rdev = container_of(wk, struct cfg80211_registered_device,
231 scan_done_wk); 231 scan_done_wk);
232 232
233 cfg80211_lock_rdev(rdev); 233 mutex_lock(&rdev->sched_scan_mtx);
234 ___cfg80211_scan_done(rdev, false); 234 ___cfg80211_scan_done(rdev, false);
235 cfg80211_unlock_rdev(rdev); 235 mutex_unlock(&rdev->sched_scan_mtx);
236} 236}
237 237
238void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) 238void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
@@ -698,11 +698,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
698 found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); 698 found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR);
699 699
700 if (found) { 700 if (found) {
701 found->pub.beacon_interval = tmp->pub.beacon_interval;
702 found->pub.signal = tmp->pub.signal;
703 found->pub.capability = tmp->pub.capability;
704 found->ts = tmp->ts;
705
706 /* Update IEs */ 701 /* Update IEs */
707 if (rcu_access_pointer(tmp->pub.proberesp_ies)) { 702 if (rcu_access_pointer(tmp->pub.proberesp_ies)) {
708 const struct cfg80211_bss_ies *old; 703 const struct cfg80211_bss_ies *old;
@@ -723,6 +718,8 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
723 718
724 if (found->pub.hidden_beacon_bss && 719 if (found->pub.hidden_beacon_bss &&
725 !list_empty(&found->hidden_list)) { 720 !list_empty(&found->hidden_list)) {
721 const struct cfg80211_bss_ies *f;
722
726 /* 723 /*
727 * The found BSS struct is one of the probe 724 * The found BSS struct is one of the probe
728 * response members of a group, but we're 725 * response members of a group, but we're
@@ -732,6 +729,10 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
732 * SSID to showing it, which is confusing so 729 * SSID to showing it, which is confusing so
733 * drop this information. 730 * drop this information.
734 */ 731 */
732
733 f = rcu_access_pointer(tmp->pub.beacon_ies);
734 kfree_rcu((struct cfg80211_bss_ies *)f,
735 rcu_head);
735 goto drop; 736 goto drop;
736 } 737 }
737 738
@@ -761,6 +762,11 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
761 kfree_rcu((struct cfg80211_bss_ies *)old, 762 kfree_rcu((struct cfg80211_bss_ies *)old,
762 rcu_head); 763 rcu_head);
763 } 764 }
765
766 found->pub.beacon_interval = tmp->pub.beacon_interval;
767 found->pub.signal = tmp->pub.signal;
768 found->pub.capability = tmp->pub.capability;
769 found->ts = tmp->ts;
764 } else { 770 } else {
765 struct cfg80211_internal_bss *new; 771 struct cfg80211_internal_bss *new;
766 struct cfg80211_internal_bss *hidden; 772 struct cfg80211_internal_bss *hidden;
@@ -1056,6 +1062,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1056 if (IS_ERR(rdev)) 1062 if (IS_ERR(rdev))
1057 return PTR_ERR(rdev); 1063 return PTR_ERR(rdev);
1058 1064
1065 mutex_lock(&rdev->sched_scan_mtx);
1059 if (rdev->scan_req) { 1066 if (rdev->scan_req) {
1060 err = -EBUSY; 1067 err = -EBUSY;
1061 goto out; 1068 goto out;
@@ -1162,6 +1169,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1162 dev_hold(dev); 1169 dev_hold(dev);
1163 } 1170 }
1164 out: 1171 out:
1172 mutex_unlock(&rdev->sched_scan_mtx);
1165 kfree(creq); 1173 kfree(creq);
1166 cfg80211_unlock_rdev(rdev); 1174 cfg80211_unlock_rdev(rdev);
1167 return err; 1175 return err;
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index f432bd3755b1..09d994d192ff 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -85,6 +85,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
85 ASSERT_RTNL(); 85 ASSERT_RTNL();
86 ASSERT_RDEV_LOCK(rdev); 86 ASSERT_RDEV_LOCK(rdev);
87 ASSERT_WDEV_LOCK(wdev); 87 ASSERT_WDEV_LOCK(wdev);
88 lockdep_assert_held(&rdev->sched_scan_mtx);
88 89
89 if (rdev->scan_req) 90 if (rdev->scan_req)
90 return -EBUSY; 91 return -EBUSY;
@@ -320,11 +321,9 @@ void cfg80211_sme_scan_done(struct net_device *dev)
320{ 321{
321 struct wireless_dev *wdev = dev->ieee80211_ptr; 322 struct wireless_dev *wdev = dev->ieee80211_ptr;
322 323
323 mutex_lock(&wiphy_to_dev(wdev->wiphy)->devlist_mtx);
324 wdev_lock(wdev); 324 wdev_lock(wdev);
325 __cfg80211_sme_scan_done(dev); 325 __cfg80211_sme_scan_done(dev);
326 wdev_unlock(wdev); 326 wdev_unlock(wdev);
327 mutex_unlock(&wiphy_to_dev(wdev->wiphy)->devlist_mtx);
328} 327}
329 328
330void cfg80211_sme_rx_auth(struct net_device *dev, 329void cfg80211_sme_rx_auth(struct net_device *dev,
@@ -924,9 +923,12 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
924 int err; 923 int err;
925 924
926 mutex_lock(&rdev->devlist_mtx); 925 mutex_lock(&rdev->devlist_mtx);
926 /* might request scan - scan_mtx -> wdev_mtx dependency */
927 mutex_lock(&rdev->sched_scan_mtx);
927 wdev_lock(dev->ieee80211_ptr); 928 wdev_lock(dev->ieee80211_ptr);
928 err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL); 929 err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL);
929 wdev_unlock(dev->ieee80211_ptr); 930 wdev_unlock(dev->ieee80211_ptr);
931 mutex_unlock(&rdev->sched_scan_mtx);
930 mutex_unlock(&rdev->devlist_mtx); 932 mutex_unlock(&rdev->devlist_mtx);
931 933
932 return err; 934 return err;
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index b7a531380e19..7586de77a2f8 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -27,7 +27,8 @@
27#define WIPHY_PR_ARG __entry->wiphy_name 27#define WIPHY_PR_ARG __entry->wiphy_name
28 28
29#define WDEV_ENTRY __field(u32, id) 29#define WDEV_ENTRY __field(u32, id)
30#define WDEV_ASSIGN (__entry->id) = (wdev ? wdev->identifier : 0) 30#define WDEV_ASSIGN (__entry->id) = (!IS_ERR_OR_NULL(wdev) \
31 ? wdev->identifier : 0)
31#define WDEV_PR_FMT "wdev(%u)" 32#define WDEV_PR_FMT "wdev(%u)"
32#define WDEV_PR_ARG (__entry->id) 33#define WDEV_PR_ARG (__entry->id)
33 34
@@ -1778,7 +1779,7 @@ TRACE_EVENT(rdev_set_mac_acl,
1778 ), 1779 ),
1779 TP_fast_assign( 1780 TP_fast_assign(
1780 WIPHY_ASSIGN; 1781 WIPHY_ASSIGN;
1781 WIPHY_ASSIGN; 1782 NETDEV_ASSIGN;
1782 __entry->acl_policy = params->acl_policy; 1783 __entry->acl_policy = params->acl_policy;
1783 ), 1784 ),
1784 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", acl policy: %d", 1785 TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", acl policy: %d",
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index fb9622f6d99c..e79cb5c0655a 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -89,6 +89,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
89 89
90 cfg80211_lock_rdev(rdev); 90 cfg80211_lock_rdev(rdev);
91 mutex_lock(&rdev->devlist_mtx); 91 mutex_lock(&rdev->devlist_mtx);
92 mutex_lock(&rdev->sched_scan_mtx);
92 wdev_lock(wdev); 93 wdev_lock(wdev);
93 94
94 if (wdev->sme_state != CFG80211_SME_IDLE) { 95 if (wdev->sme_state != CFG80211_SME_IDLE) {
@@ -135,6 +136,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
135 err = cfg80211_mgd_wext_connect(rdev, wdev); 136 err = cfg80211_mgd_wext_connect(rdev, wdev);
136 out: 137 out:
137 wdev_unlock(wdev); 138 wdev_unlock(wdev);
139 mutex_unlock(&rdev->sched_scan_mtx);
138 mutex_unlock(&rdev->devlist_mtx); 140 mutex_unlock(&rdev->devlist_mtx);
139 cfg80211_unlock_rdev(rdev); 141 cfg80211_unlock_rdev(rdev);
140 return err; 142 return err;
@@ -190,6 +192,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
190 192
191 cfg80211_lock_rdev(rdev); 193 cfg80211_lock_rdev(rdev);
192 mutex_lock(&rdev->devlist_mtx); 194 mutex_lock(&rdev->devlist_mtx);
195 mutex_lock(&rdev->sched_scan_mtx);
193 wdev_lock(wdev); 196 wdev_lock(wdev);
194 197
195 err = 0; 198 err = 0;
@@ -223,6 +226,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
223 err = cfg80211_mgd_wext_connect(rdev, wdev); 226 err = cfg80211_mgd_wext_connect(rdev, wdev);
224 out: 227 out:
225 wdev_unlock(wdev); 228 wdev_unlock(wdev);
229 mutex_unlock(&rdev->sched_scan_mtx);
226 mutex_unlock(&rdev->devlist_mtx); 230 mutex_unlock(&rdev->devlist_mtx);
227 cfg80211_unlock_rdev(rdev); 231 cfg80211_unlock_rdev(rdev);
228 return err; 232 return err;
@@ -285,6 +289,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
285 289
286 cfg80211_lock_rdev(rdev); 290 cfg80211_lock_rdev(rdev);
287 mutex_lock(&rdev->devlist_mtx); 291 mutex_lock(&rdev->devlist_mtx);
292 mutex_lock(&rdev->sched_scan_mtx);
288 wdev_lock(wdev); 293 wdev_lock(wdev);
289 294
290 if (wdev->sme_state != CFG80211_SME_IDLE) { 295 if (wdev->sme_state != CFG80211_SME_IDLE) {
@@ -313,6 +318,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
313 err = cfg80211_mgd_wext_connect(rdev, wdev); 318 err = cfg80211_mgd_wext_connect(rdev, wdev);
314 out: 319 out:
315 wdev_unlock(wdev); 320 wdev_unlock(wdev);
321 mutex_unlock(&rdev->sched_scan_mtx);
316 mutex_unlock(&rdev->devlist_mtx); 322 mutex_unlock(&rdev->devlist_mtx);
317 cfg80211_unlock_rdev(rdev); 323 cfg80211_unlock_rdev(rdev);
318 return err; 324 return err;
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 35754cc8a9e5..8dafe6d3c6e4 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -334,6 +334,70 @@ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
334 x->xflags &= ~XFRM_TIME_DEFER; 334 x->xflags &= ~XFRM_TIME_DEFER;
335} 335}
336 336
337static void xfrm_replay_notify_esn(struct xfrm_state *x, int event)
338{
339 u32 seq_diff, oseq_diff;
340 struct km_event c;
341 struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
342 struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
343
344 /* we send notify messages in case
345 * 1. we updated on of the sequence numbers, and the seqno difference
346 * is at least x->replay_maxdiff, in this case we also update the
347 * timeout of our timer function
348 * 2. if x->replay_maxage has elapsed since last update,
349 * and there were changes
350 *
351 * The state structure must be locked!
352 */
353
354 switch (event) {
355 case XFRM_REPLAY_UPDATE:
356 if (!x->replay_maxdiff)
357 break;
358
359 if (replay_esn->seq_hi == preplay_esn->seq_hi)
360 seq_diff = replay_esn->seq - preplay_esn->seq;
361 else
362 seq_diff = ~preplay_esn->seq + replay_esn->seq + 1;
363
364 if (replay_esn->oseq_hi == preplay_esn->oseq_hi)
365 oseq_diff = replay_esn->oseq - preplay_esn->oseq;
366 else
367 oseq_diff = ~preplay_esn->oseq + replay_esn->oseq + 1;
368
369 if (seq_diff < x->replay_maxdiff &&
370 oseq_diff < x->replay_maxdiff) {
371
372 if (x->xflags & XFRM_TIME_DEFER)
373 event = XFRM_REPLAY_TIMEOUT;
374 else
375 return;
376 }
377
378 break;
379
380 case XFRM_REPLAY_TIMEOUT:
381 if (memcmp(x->replay_esn, x->preplay_esn,
382 xfrm_replay_state_esn_len(replay_esn)) == 0) {
383 x->xflags |= XFRM_TIME_DEFER;
384 return;
385 }
386
387 break;
388 }
389
390 memcpy(x->preplay_esn, x->replay_esn,
391 xfrm_replay_state_esn_len(replay_esn));
392 c.event = XFRM_MSG_NEWAE;
393 c.data.aevent = event;
394 km_state_notify(x, &c);
395
396 if (x->replay_maxage &&
397 !mod_timer(&x->rtimer, jiffies + x->replay_maxage))
398 x->xflags &= ~XFRM_TIME_DEFER;
399}
400
337static int xfrm_replay_overflow_esn(struct xfrm_state *x, struct sk_buff *skb) 401static int xfrm_replay_overflow_esn(struct xfrm_state *x, struct sk_buff *skb)
338{ 402{
339 int err = 0; 403 int err = 0;
@@ -510,7 +574,7 @@ static struct xfrm_replay xfrm_replay_esn = {
510 .advance = xfrm_replay_advance_esn, 574 .advance = xfrm_replay_advance_esn,
511 .check = xfrm_replay_check_esn, 575 .check = xfrm_replay_check_esn,
512 .recheck = xfrm_replay_recheck_esn, 576 .recheck = xfrm_replay_recheck_esn,
513 .notify = xfrm_replay_notify_bmp, 577 .notify = xfrm_replay_notify_esn,
514 .overflow = xfrm_replay_overflow_esn, 578 .overflow = xfrm_replay_overflow_esn,
515}; 579};
516 580
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ecdf30eb5879..4aba7646dd9c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -173,7 +173,7 @@ const char *snd_hda_get_jack_type(u32 cfg)
173 "Line Out", "Speaker", "HP Out", "CD", 173 "Line Out", "Speaker", "HP Out", "CD",
174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", 174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
175 "Line In", "Aux", "Mic", "Telephony", 175 "Line In", "Aux", "Mic", "Telephony",
176 "SPDIF In", "Digitial In", "Reserved", "Other" 176 "SPDIF In", "Digital In", "Reserved", "Other"
177 }; 177 };
178 178
179 return jack_types[(cfg & AC_DEFCFG_DEVICE) 179 return jack_types[(cfg & AC_DEFCFG_DEVICE)
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 7dd846380a50..d0d7ac1e99d2 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -320,7 +320,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
320 unsigned char *buf, int *eld_size) 320 unsigned char *buf, int *eld_size)
321{ 321{
322 int i; 322 int i;
323 int ret; 323 int ret = 0;
324 int size; 324 int size;
325 325
326 /* 326 /*
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 43c2ea539561..2dbe767be16b 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -740,7 +740,7 @@ EXPORT_SYMBOL_HDA(snd_hda_activate_path);
740static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) 740static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path)
741{ 741{
742 struct hda_gen_spec *spec = codec->spec; 742 struct hda_gen_spec *spec = codec->spec;
743 bool changed; 743 bool changed = false;
744 int i; 744 int i;
745 745
746 if (!spec->power_down_unused || path->active) 746 if (!spec->power_down_unused || path->active)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 418bfc0eb0a3..bcd40ee488e3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -134,8 +134,8 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
134 * this may give more power-saving, but will take longer time to 134 * this may give more power-saving, but will take longer time to
135 * wake up. 135 * wake up.
136 */ 136 */
137static int power_save_controller = -1; 137static bool power_save_controller = 1;
138module_param(power_save_controller, bint, 0644); 138module_param(power_save_controller, bool, 0644);
139MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 139MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
140#endif /* CONFIG_PM */ 140#endif /* CONFIG_PM */
141 141
@@ -2931,8 +2931,6 @@ static int azx_runtime_idle(struct device *dev)
2931 struct snd_card *card = dev_get_drvdata(dev); 2931 struct snd_card *card = dev_get_drvdata(dev);
2932 struct azx *chip = card->private_data; 2932 struct azx *chip = card->private_data;
2933 2933
2934 if (power_save_controller > 0)
2935 return 0;
2936 if (!power_save_controller || 2934 if (!power_save_controller ||
2937 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 2935 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2938 return -EBUSY; 2936 return -EBUSY;
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 78e1827d0a95..de8ac5c07fd0 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1196,7 +1196,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1196 1196
1197 _snd_printd(SND_PR_VERBOSE, 1197 _snd_printd(SND_PR_VERBOSE,
1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
1199 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); 1199 codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
1200 1200
1201 if (eld->eld_valid) { 1201 if (eld->eld_valid) {
1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer, 1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 563c24df4d6f..f15c36bde540 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3440,7 +3440,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
3440 const hda_nid_t *ssids; 3440 const hda_nid_t *ssids;
3441 3441
3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || 3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
3443 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) 3443 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
3444 codec->vendor_id == 0x10ec0671)
3444 ssids = alc663_ssids; 3445 ssids = alc663_ssids;
3445 else 3446 else
3446 ssids = alc662_ssids; 3447 ssids = alc662_ssids;
@@ -3894,6 +3895,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
3894 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, 3895 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
3895 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, 3896 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
3896 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, 3897 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
3898 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
3897 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, 3899 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
3898 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 3900 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
3899 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 3901 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index fc176044994d..fc176044994d 100755..100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 7e103f249053..7e103f249053 100755..100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index f2d61a187830..566ea3256e2d 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -159,6 +159,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
159 switch (params_format(params)) { 159 switch (params_format(params)) {
160 case SNDRV_PCM_FORMAT_S8: 160 case SNDRV_PCM_FORMAT_S8:
161 width = SI476X_PCM_FORMAT_S8; 161 width = SI476X_PCM_FORMAT_S8;
162 break;
162 case SNDRV_PCM_FORMAT_S16_LE: 163 case SNDRV_PCM_FORMAT_S16_LE:
163 width = SI476X_PCM_FORMAT_S16_LE; 164 width = SI476X_PCM_FORMAT_S16_LE;
164 break; 165 break;
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f3f7e75f8628..9af1bddc4c62 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -828,7 +828,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
828 &buf_list); 828 &buf_list);
829 if (!buf) { 829 if (!buf) {
830 adsp_err(dsp, "Out of memory\n"); 830 adsp_err(dsp, "Out of memory\n");
831 return -ENOMEM; 831 ret = -ENOMEM;
832 goto out_fw;
832 } 833 }
833 834
834 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", 835 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n",
@@ -865,7 +866,7 @@ out_fw:
865 wm_adsp_buf_free(&buf_list); 866 wm_adsp_buf_free(&buf_list);
866out: 867out:
867 kfree(file); 868 kfree(file);
868 return 0; 869 return ret;
869} 870}
870 871
871int wm_adsp1_init(struct wm_adsp *adsp) 872int wm_adsp1_init(struct wm_adsp *adsp)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 55464a5b0706..810c7eeb7b03 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -496,6 +496,8 @@ static void imx_ssi_ac97_reset(struct snd_ac97 *ac97)
496 496
497 if (imx_ssi->ac97_reset) 497 if (imx_ssi->ac97_reset)
498 imx_ssi->ac97_reset(ac97); 498 imx_ssi->ac97_reset(ac97);
499 /* First read sometimes fails, do a dummy read */
500 imx_ssi_ac97_read(ac97, 0);
499} 501}
500 502
501static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) 503static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
@@ -504,6 +506,9 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
504 506
505 if (imx_ssi->ac97_warm_reset) 507 if (imx_ssi->ac97_warm_reset)
506 imx_ssi->ac97_warm_reset(ac97); 508 imx_ssi->ac97_warm_reset(ac97);
509
510 /* First read sometimes fails, do a dummy read */
511 imx_ssi_ac97_read(ac97, 0);
507} 512}
508 513
509struct snd_ac97_bus_ops soc_ac97_ops = { 514struct snd_ac97_bus_ops soc_ac97_ops = {
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 8e52c1485df3..eb4373840bb6 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -51,7 +51,7 @@ static struct snd_soc_card pcm030_card = {
51 .num_links = ARRAY_SIZE(pcm030_fabric_dai), 51 .num_links = ARRAY_SIZE(pcm030_fabric_dai),
52}; 52};
53 53
54static int __init pcm030_fabric_probe(struct platform_device *op) 54static int pcm030_fabric_probe(struct platform_device *op)
55{ 55{
56 struct device_node *np = op->dev.of_node; 56 struct device_node *np = op->dev.of_node;
57 struct device_node *platform_np; 57 struct device_node *platform_np;
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index 19eff8fc4fdd..1a8b03e4b41b 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -342,8 +342,8 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd)
342 return 0; 342 return 0;
343} 343}
344 344
345static struct snd_soc_platform sh7760_soc_platform = { 345static struct snd_soc_platform_driver sh7760_soc_platform = {
346 .pcm_ops = &camelot_pcm_ops, 346 .ops = &camelot_pcm_ops,
347 .pcm_new = camelot_pcm_new, 347 .pcm_new = camelot_pcm_new,
348 .pcm_free = camelot_pcm_free, 348 .pcm_free = camelot_pcm_free,
349}; 349};
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b7e84a7cd9ee..507d251916af 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3140,7 +3140,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3140 if (params->mask) { 3140 if (params->mask) {
3141 ret = regmap_read(codec->control_data, params->base, &val); 3141 ret = regmap_read(codec->control_data, params->base, &val);
3142 if (ret != 0) 3142 if (ret != 0)
3143 return ret; 3143 goto out;
3144 3144
3145 val &= params->mask; 3145 val &= params->mask;
3146 3146
@@ -3158,13 +3158,15 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3158 ((u32 *)data)[0] |= cpu_to_be32(val); 3158 ((u32 *)data)[0] |= cpu_to_be32(val);
3159 break; 3159 break;
3160 default: 3160 default:
3161 return -EINVAL; 3161 ret = -EINVAL;
3162 goto out;
3162 } 3163 }
3163 } 3164 }
3164 3165
3165 ret = regmap_raw_write(codec->control_data, params->base, 3166 ret = regmap_raw_write(codec->control_data, params->base,
3166 data, len); 3167 data, len);
3167 3168
3169out:
3168 kfree(data); 3170 kfree(data);
3169 3171
3170 return ret; 3172 return ret;
@@ -4197,7 +4199,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4197 dev_err(card->dev, 4199 dev_err(card->dev,
4198 "ASoC: Property '%s' index %d could not be read: %d\n", 4200 "ASoC: Property '%s' index %d could not be read: %d\n",
4199 propname, 2 * i, ret); 4201 propname, 2 * i, ret);
4200 kfree(routes);
4201 return -EINVAL; 4202 return -EINVAL;
4202 } 4203 }
4203 ret = of_property_read_string_index(np, propname, 4204 ret = of_property_read_string_index(np, propname,
@@ -4206,7 +4207,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4206 dev_err(card->dev, 4207 dev_err(card->dev,
4207 "ASoC: Property '%s' index %d could not be read: %d\n", 4208 "ASoC: Property '%s' index %d could not be read: %d\n",
4208 propname, (2 * i) + 1, ret); 4209 propname, (2 * i) + 1, ret);
4209 kfree(routes);
4210 return -EINVAL; 4210 return -EINVAL;
4211 } 4211 }
4212 } 4212 }
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1d6a9b3ceb27..d6d9ba2e6916 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -831,6 +831,9 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
831 if (path->weak) 831 if (path->weak)
832 continue; 832 continue;
833 833
834 if (path->walking)
835 return 1;
836
834 if (path->walked) 837 if (path->walked)
835 continue; 838 continue;
836 839
@@ -838,6 +841,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
838 841
839 if (path->sink && path->connect) { 842 if (path->sink && path->connect) {
840 path->walked = 1; 843 path->walked = 1;
844 path->walking = 1;
841 845
842 /* do we need to add this widget to the list ? */ 846 /* do we need to add this widget to the list ? */
843 if (list) { 847 if (list) {
@@ -847,11 +851,14 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
847 dev_err(widget->dapm->dev, 851 dev_err(widget->dapm->dev,
848 "ASoC: could not add widget %s\n", 852 "ASoC: could not add widget %s\n",
849 widget->name); 853 widget->name);
854 path->walking = 0;
850 return con; 855 return con;
851 } 856 }
852 } 857 }
853 858
854 con += is_connected_output_ep(path->sink, list); 859 con += is_connected_output_ep(path->sink, list);
860
861 path->walking = 0;
855 } 862 }
856 } 863 }
857 864
@@ -931,6 +938,9 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
931 if (path->weak) 938 if (path->weak)
932 continue; 939 continue;
933 940
941 if (path->walking)
942 return 1;
943
934 if (path->walked) 944 if (path->walked)
935 continue; 945 continue;
936 946
@@ -938,6 +948,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
938 948
939 if (path->source && path->connect) { 949 if (path->source && path->connect) {
940 path->walked = 1; 950 path->walked = 1;
951 path->walking = 1;
941 952
942 /* do we need to add this widget to the list ? */ 953 /* do we need to add this widget to the list ? */
943 if (list) { 954 if (list) {
@@ -947,11 +958,14 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
947 dev_err(widget->dapm->dev, 958 dev_err(widget->dapm->dev,
948 "ASoC: could not add widget %s\n", 959 "ASoC: could not add widget %s\n",
949 widget->name); 960 widget->name);
961 path->walking = 0;
950 return con; 962 return con;
951 } 963 }
952 } 964 }
953 965
954 con += is_connected_input_ep(path->source, list); 966 con += is_connected_input_ep(path->source, list);
967
968 path->walking = 0;
955 } 969 }
956 } 970 }
957 971
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index 9b76cc5a1148..5e7aebe1e664 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -149,9 +149,9 @@ static void spear_pcm_free(struct snd_pcm *pcm)
149 149
150static u64 spear_pcm_dmamask = DMA_BIT_MASK(32); 150static u64 spear_pcm_dmamask = DMA_BIT_MASK(32);
151 151
152static int spear_pcm_new(struct snd_card *card, 152static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
153 struct snd_soc_dai *dai, struct snd_pcm *pcm)
154{ 153{
154 struct snd_card *card = rtd->card->snd_card;
155 int ret; 155 int ret;
156 156
157 if (!card->dev->dma_mask) 157 if (!card->dev->dma_mask)
@@ -159,16 +159,16 @@ static int spear_pcm_new(struct snd_card *card,
159 if (!card->dev->coherent_dma_mask) 159 if (!card->dev->coherent_dma_mask)
160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
161 161
162 if (dai->driver->playback.channels_min) { 162 if (rtd->cpu_dai->driver->playback.channels_min) {
163 ret = spear_pcm_preallocate_dma_buffer(pcm, 163 ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
164 SNDRV_PCM_STREAM_PLAYBACK, 164 SNDRV_PCM_STREAM_PLAYBACK,
165 spear_pcm_hardware.buffer_bytes_max); 165 spear_pcm_hardware.buffer_bytes_max);
166 if (ret) 166 if (ret)
167 return ret; 167 return ret;
168 } 168 }
169 169
170 if (dai->driver->capture.channels_min) { 170 if (rtd->cpu_dai->driver->capture.channels_min) {
171 ret = spear_pcm_preallocate_dma_buffer(pcm, 171 ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
172 SNDRV_PCM_STREAM_CAPTURE, 172 SNDRV_PCM_STREAM_CAPTURE,
173 spear_pcm_hardware.buffer_bytes_max); 173 spear_pcm_hardware.buffer_bytes_max);
174 if (ret) 174 if (ret)
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 5e634a2eb282..9e2703a25156 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -253,7 +253,7 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
253{ 253{
254 struct usb_device *dev = chip->dev; 254 struct usb_device *dev = chip->dev;
255 unsigned char data[4]; 255 unsigned char data[4];
256 int err, crate; 256 int err, cur_rate, prev_rate;
257 int clock = snd_usb_clock_find_source(chip, fmt->clock); 257 int clock = snd_usb_clock_find_source(chip, fmt->clock);
258 258
259 if (clock < 0) 259 if (clock < 0)
@@ -266,6 +266,19 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
266 return -ENXIO; 266 return -ENXIO;
267 } 267 }
268 268
269 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
270 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
271 UAC2_CS_CONTROL_SAM_FREQ << 8,
272 snd_usb_ctrl_intf(chip) | (clock << 8),
273 data, sizeof(data));
274 if (err < 0) {
275 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
276 dev->devnum, iface, fmt->altsetting);
277 prev_rate = 0;
278 } else {
279 prev_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
280 }
281
269 data[0] = rate; 282 data[0] = rate;
270 data[1] = rate >> 8; 283 data[1] = rate >> 8;
271 data[2] = rate >> 16; 284 data[2] = rate >> 16;
@@ -280,19 +293,31 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
280 return err; 293 return err;
281 } 294 }
282 295
283 if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 296 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
284 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 297 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
285 UAC2_CS_CONTROL_SAM_FREQ << 8, 298 UAC2_CS_CONTROL_SAM_FREQ << 8,
286 snd_usb_ctrl_intf(chip) | (clock << 8), 299 snd_usb_ctrl_intf(chip) | (clock << 8),
287 data, sizeof(data))) < 0) { 300 data, sizeof(data));
301 if (err < 0) {
288 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", 302 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
289 dev->devnum, iface, fmt->altsetting); 303 dev->devnum, iface, fmt->altsetting);
290 return err; 304 cur_rate = 0;
305 } else {
306 cur_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
291 } 307 }
292 308
293 crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); 309 if (cur_rate != rate) {
294 if (crate != rate) 310 snd_printd(KERN_WARNING
295 snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); 311 "current rate %d is different from the runtime rate %d\n",
312 cur_rate, rate);
313 }
314
315 /* Some devices doesn't respond to sample rate changes while the
316 * interface is active. */
317 if (rate != prev_rate) {
318 usb_set_interface(dev, iface, 0);
319 usb_set_interface(dev, iface, fmt->altsetting);
320 }
296 321
297 return 0; 322 return 0;
298} 323}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index adc68feb5c5a..f18013f09e68 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1541,21 +1541,38 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
1541} 1541}
1542 1542
1543int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, 1543int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
1544 gpa_t gpa) 1544 gpa_t gpa, unsigned long len)
1545{ 1545{
1546 struct kvm_memslots *slots = kvm_memslots(kvm); 1546 struct kvm_memslots *slots = kvm_memslots(kvm);
1547 int offset = offset_in_page(gpa); 1547 int offset = offset_in_page(gpa);
1548 gfn_t gfn = gpa >> PAGE_SHIFT; 1548 gfn_t start_gfn = gpa >> PAGE_SHIFT;
1549 gfn_t end_gfn = (gpa + len - 1) >> PAGE_SHIFT;
1550 gfn_t nr_pages_needed = end_gfn - start_gfn + 1;
1551 gfn_t nr_pages_avail;
1549 1552
1550 ghc->gpa = gpa; 1553 ghc->gpa = gpa;
1551 ghc->generation = slots->generation; 1554 ghc->generation = slots->generation;
1552 ghc->memslot = gfn_to_memslot(kvm, gfn); 1555 ghc->len = len;
1553 ghc->hva = gfn_to_hva_many(ghc->memslot, gfn, NULL); 1556 ghc->memslot = gfn_to_memslot(kvm, start_gfn);
1554 if (!kvm_is_error_hva(ghc->hva)) 1557 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail);
1558 if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) {
1555 ghc->hva += offset; 1559 ghc->hva += offset;
1556 else 1560 } else {
1557 return -EFAULT; 1561 /*
1558 1562 * If the requested region crosses two memslots, we still
1563 * verify that the entire region is valid here.
1564 */
1565 while (start_gfn <= end_gfn) {
1566 ghc->memslot = gfn_to_memslot(kvm, start_gfn);
1567 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn,
1568 &nr_pages_avail);
1569 if (kvm_is_error_hva(ghc->hva))
1570 return -EFAULT;
1571 start_gfn += nr_pages_avail;
1572 }
1573 /* Use the slow path for cross page reads and writes. */
1574 ghc->memslot = NULL;
1575 }
1559 return 0; 1576 return 0;
1560} 1577}
1561EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init); 1578EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init);
@@ -1566,8 +1583,13 @@ int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
1566 struct kvm_memslots *slots = kvm_memslots(kvm); 1583 struct kvm_memslots *slots = kvm_memslots(kvm);
1567 int r; 1584 int r;
1568 1585
1586 BUG_ON(len > ghc->len);
1587
1569 if (slots->generation != ghc->generation) 1588 if (slots->generation != ghc->generation)
1570 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa); 1589 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len);
1590
1591 if (unlikely(!ghc->memslot))
1592 return kvm_write_guest(kvm, ghc->gpa, data, len);
1571 1593
1572 if (kvm_is_error_hva(ghc->hva)) 1594 if (kvm_is_error_hva(ghc->hva))
1573 return -EFAULT; 1595 return -EFAULT;
@@ -1587,8 +1609,13 @@ int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
1587 struct kvm_memslots *slots = kvm_memslots(kvm); 1609 struct kvm_memslots *slots = kvm_memslots(kvm);
1588 int r; 1610 int r;
1589 1611
1612 BUG_ON(len > ghc->len);
1613
1590 if (slots->generation != ghc->generation) 1614 if (slots->generation != ghc->generation)
1591 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa); 1615 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len);
1616
1617 if (unlikely(!ghc->memslot))
1618 return kvm_read_guest(kvm, ghc->gpa, data, len);
1592 1619
1593 if (kvm_is_error_hva(ghc->hva)) 1620 if (kvm_is_error_hva(ghc->hva))
1594 return -EFAULT; 1621 return -EFAULT;