]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge tag 'mvebu-fixes-4.12-1' of git://git.infradead.org/linux-mvebu into next/dt64
authorArnd Bergmann <arnd@arndb.de>
Fri, 23 Jun 2017 12:29:17 +0000 (14:29 +0200)
committerArnd Bergmann <arnd@arndb.de>
Fri, 23 Jun 2017 12:29:17 +0000 (14:29 +0200)
mvebu fixes for 4.12

Fix the interrupt description of the crypto node for device tree of
the Armada 7K/8K SoCs

* tag 'mvebu-fixes-4.12-1' of git://git.infradead.org/linux-mvebu:
  arm64: marvell: dts: fix interrupts in 7k/8k crypto nodes

438 files changed:
Documentation/acpi/acpi-lid.txt
Documentation/admin-guide/pm/cpufreq.rst
Documentation/admin-guide/pm/index.rst
Documentation/admin-guide/pm/intel_pstate.rst [new file with mode: 0644]
Documentation/cpu-freq/intel-pstate.txt [deleted file]
Documentation/devicetree/bindings/arm/amlogic.txt
Documentation/devicetree/bindings/arm/bcm/brcm,stingray.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
Documentation/devicetree/bindings/arm/mediatek.txt
Documentation/devicetree/bindings/arm/realtek.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/rockchip.txt
Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt
Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt
Documentation/devicetree/bindings/i2c/i2c-mtk.txt [moved from Documentation/devicetree/bindings/i2c/i2c-mt6577.txt with 77% similarity]
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
Documentation/devicetree/bindings/mfd/hi6421.txt
Documentation/devicetree/bindings/mfd/hisilicon,hi655x.txt
Documentation/devicetree/bindings/mmc/fsl-esdhc.txt
Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
Documentation/devicetree/bindings/net/fsl-fec.txt
Documentation/devicetree/bindings/pci/kirin-pcie.txt [new file with mode: 0644]
Documentation/devicetree/bindings/serial/mtk-uart.txt
Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
Documentation/devicetree/bindings/vendor-prefixes.txt
Documentation/input/devices/edt-ft5x06.rst
Documentation/sound/hd-audio/models.rst
MAINTAINERS
Makefile
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/bcm2835-rpi.dtsi
arch/arm/boot/dts/bcm2835.dtsi
arch/arm/boot/dts/bcm2836.dtsi
arch/arm/boot/dts/bcm2837-rpi-3-b.dts [new file with mode: 0644]
arch/arm/boot/dts/bcm283x.dtsi
arch/arm/boot/dts/sunxi-h3-h5.dtsi
arch/arm64/boot/dts/Makefile
arch/arm64/boot/dts/allwinner/Makefile
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/Makefile
arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi
arch/arm64/boot/dts/amlogic/meson-gx.dtsi
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts
arch/arm64/boot/dts/amlogic/meson-gxl-s905x.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts [new file with mode: 0644]
arch/arm64/boot/dts/arm/juno-base.dtsi
arch/arm64/boot/dts/arm/juno-r1.dts
arch/arm64/boot/dts/arm/juno-r2.dts
arch/arm64/boot/dts/arm/juno.dts
arch/arm64/boot/dts/broadcom/Makefile
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
arch/arm64/boot/dts/broadcom/bcm2837.dtsi
arch/arm64/boot/dts/broadcom/ns2.dtsi
arch/arm64/boot/dts/broadcom/stingray/Makefile [new file with mode: 0644]
arch/arm64/boot/dts/broadcom/stingray/bcm958742-base.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/broadcom/stingray/bcm958742k.dts [new file with mode: 0644]
arch/arm64/boot/dts/broadcom/stingray/bcm958742t.dts [new file with mode: 0644]
arch/arm64/boot/dts/broadcom/stingray/stingray-clock.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
arch/arm64/boot/dts/freescale/fsl-ls1012a-frdm.dts
arch/arm64/boot/dts/freescale/fsl-ls1012a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls1012a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1088a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls2080a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls2080a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls2080a-simu.dts
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls2088a-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls2088a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls208xa-qds.dtsi
arch/arm64/boot/dts/freescale/fsl-ls208xa-rdb.dtsi
arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
arch/arm64/boot/dts/freescale/qoriq-bman-portals.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-10g-0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-10g-1.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-1.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-2.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-3.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-4.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-5.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-fman3-0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/qoriq-qman-portals.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
arch/arm64/boot/dts/hisilicon/hi3660.dtsi
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
arch/arm64/boot/dts/hisilicon/hi6220.dtsi
arch/arm64/boot/dts/hisilicon/hikey960-pinctrl.dtsi
arch/arm64/boot/dts/marvell/armada-3720-db.dts
arch/arm64/boot/dts/marvell/armada-37xx.dtsi
arch/arm64/boot/dts/marvell/armada-7020.dtsi
arch/arm64/boot/dts/marvell/armada-7040-db.dts
arch/arm64/boot/dts/marvell/armada-7040.dtsi
arch/arm64/boot/dts/marvell/armada-70x0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/marvell/armada-8020.dtsi
arch/arm64/boot/dts/marvell/armada-8040-db.dts
arch/arm64/boot/dts/marvell/armada-8040-mcbin.dts
arch/arm64/boot/dts/marvell/armada-8040.dtsi
arch/arm64/boot/dts/marvell/armada-80x0.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/marvell/armada-ap806.dtsi
arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi
arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi
arch/arm64/boot/dts/mediatek/Makefile
arch/arm64/boot/dts/mediatek/mt6797-evb.dts [new file with mode: 0644]
arch/arm64/boot/dts/mediatek/mt6797.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/mediatek/mt8173.dtsi
arch/arm64/boot/dts/nvidia/tegra132.dtsi
arch/arm64/boot/dts/nvidia/tegra186.dtsi
arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts
arch/arm64/boot/dts/nvidia/tegra210.dtsi
arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
arch/arm64/boot/dts/qcom/msm8916.dtsi
arch/arm64/boot/dts/qcom/msm8992.dtsi
arch/arm64/boot/dts/qcom/msm8996.dtsi
arch/arm64/boot/dts/realtek/Makefile [new file with mode: 0644]
arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts [new file with mode: 0644]
arch/arm64/boot/dts/realtek/rtd1295.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/Makefile
arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb.dts [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts [new file with mode: 0644]
arch/arm64/boot/dts/renesas/r8a7795.dtsi
arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
arch/arm64/boot/dts/renesas/r8a7796.dtsi
arch/arm64/boot/dts/renesas/salvator-common.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/salvator-x.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/salvator-xs.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/renesas/ulcb.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/Makefile
arch/arm64/boot/dts/rockchip/rk3328.dtsi
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi
arch/arm64/boot/dts/rockchip/rk3399.dtsi
arch/arm64/boot/dts/socionext/Makefile
arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts [new file with mode: 0644]
arch/arm64/boot/dts/socionext/uniphier-ld11-ref.dts
arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts [new file with mode: 0644]
arch/arm64/boot/dts/socionext/uniphier-ld20-ref.dts
arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
arch/arm64/boot/dts/zte/zx296718.dtsi
arch/powerpc/include/uapi/asm/cputable.h
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/prom.c
arch/powerpc/platforms/cell/spu_base.c
arch/powerpc/platforms/powernv/npu-dma.c
arch/x86/Kconfig
arch/x86/Makefile
arch/x86/boot/compressed/Makefile
arch/x86/entry/entry_32.S
arch/x86/entry/entry_64.S
arch/x86/include/asm/mce.h
arch/x86/kernel/alternative.c
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/kernel/ftrace.c
arch/x86/kernel/kprobes/core.c
arch/x86/kernel/setup.c
arch/x86/kernel/unwind_frame.c
arch/x86/mm/pageattr.c
arch/x86/mm/pat.c
block/blk-mq.c
block/blk-sysfs.c
block/blk-throttle.c
block/partition-generic.c
block/partitions/msdos.c
crypto/skcipher.c
drivers/acpi/button.c
drivers/acpi/nfit/mce.c
drivers/base/power/wakeup.c
drivers/cpufreq/Kconfig.arm
drivers/cpufreq/Makefile
drivers/firmware/efi/efi-pstore.c
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
drivers/gpu/drm/drm_plane.c
drivers/gpu/drm/gma500/psb_intel_lvds.c
drivers/gpu/drm/qxl/qxl_display.c
drivers/gpu/drm/radeon/ci_dpm.c
drivers/gpu/drm/radeon/cik.c
drivers/gpu/drm/radeon/evergreen.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/radeon_kms.c
drivers/gpu/drm/radeon/si.c
drivers/i2c/busses/i2c-designware-platdrv.c
drivers/i2c/busses/i2c-tiny-usb.c
drivers/input/mouse/elan_i2c_i2c.c
drivers/input/touchscreen/atmel_mxt_ts.c
drivers/input/touchscreen/edt-ft5x06.c
drivers/leds/leds-pca955x.c
drivers/mmc/core/pwrseq_simple.c
drivers/mmc/host/cavium-octeon.c
drivers/mmc/host/cavium-thunderx.c
drivers/mmc/host/cavium.c
drivers/mmc/host/sdhci-iproc.c
drivers/mmc/host/sdhci-xenon-phy.c
drivers/mmc/host/sdhci-xenon.c
drivers/mmc/host/sdhci-xenon.h
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_main.c
drivers/net/ethernet/8390/ax88796.c
drivers/net/ethernet/atheros/atlx/atl2.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/eq.c
drivers/net/ethernet/mellanox/mlx5/core/health.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/geneve.c
drivers/net/gtp.c
drivers/net/phy/Kconfig
drivers/net/phy/marvell.c
drivers/net/usb/cdc_ether.c
drivers/net/usb/smsc95xx.c
drivers/net/virtio_net.c
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/target/loop.c
drivers/of/platform.c
drivers/pci/dwc/pci-imx6.c
drivers/pci/endpoint/Kconfig
drivers/pci/pci.c
drivers/pci/switch/switchtec.c
drivers/powercap/powercap_sys.c
drivers/rtc/rtc-cmos.c
drivers/scsi/csiostor/csio_hw.c
drivers/scsi/libfc/fc_rport.c
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_debugfs.c
drivers/scsi/lpfc/lpfc_disc.h
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_hw4.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_mem.c
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_nvmet.c
drivers/scsi/lpfc/lpfc_nvmet.h
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_sli4.h
drivers/scsi/lpfc/lpfc_version.h
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/ufs/ufshcd.c
drivers/thermal/broadcom/Kconfig
drivers/thermal/qoriq_thermal.c
drivers/thermal/thermal_core.c
drivers/thermal/ti-soc-thermal/ti-bandgap.c
drivers/tty/ehv_bytechan.c
drivers/tty/serdev/core.c
drivers/tty/serdev/serdev-ttyport.c
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/altera_jtaguart.c
drivers/tty/serial/altera_uart.c
drivers/tty/serial/efm32-uart.c
drivers/tty/serial/ifx6x60.c
drivers/tty/serial/imx.c
drivers/tty/serial/serial_core.c
drivers/tty/tty_port.c
fs/ceph/file.c
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_btree.c
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_file.c
fs/xfs/xfs_fsmap.c
include/dt-bindings/clock/bcm-sr.h [new file with mode: 0644]
include/dt-bindings/pinctrl/brcm,pinctrl-stingray.h [new file with mode: 0644]
include/linux/blk-mq.h
include/linux/ceph/ceph_debug.h
include/linux/filter.h
include/linux/if_vlan.h
include/linux/mlx5/device.h
include/linux/mlx5/driver.h
include/linux/netfilter/x_tables.h
include/linux/netfilter_bridge/ebtables.h
include/linux/of_platform.h
include/linux/pci.h
include/linux/ptrace.h
include/linux/serdev.h
include/linux/tty.h
include/linux/usb/usbnet.h
include/net/dst.h
include/net/ip_fib.h
include/net/netfilter/nf_conntrack_helper.h
include/net/netfilter/nf_tables.h
include/net/tc_act/tc_csum.h
include/net/xfrm.h
kernel/bpf/arraymap.c
kernel/bpf/lpm_trie.c
kernel/bpf/stackmap.c
kernel/bpf/verifier.c
kernel/fork.c
kernel/kprobes.c
kernel/locking/rtmutex.c
kernel/power/snapshot.c
kernel/ptrace.c
kernel/sched/cpufreq_schedutil.c
kernel/time/posix-cpu-timers.c
kernel/trace/ftrace.c
lib/test_bpf.c
net/bridge/br_stp_if.c
net/bridge/br_stp_timer.c
net/bridge/netfilter/ebt_arpreply.c
net/bridge/netfilter/ebtables.c
net/ceph/auth_x.c
net/ceph/ceph_common.c
net/ceph/messenger.c
net/ceph/mon_client.c
net/ceph/osdmap.c
net/core/dst.c
net/core/filter.c
net/core/net_namespace.c
net/core/rtnetlink.c
net/core/sysctl_net_core.c
net/ipv4/arp.c
net/ipv4/esp4.c
net/ipv4/fib_semantics.c
net/ipv4/route.c
net/ipv4/tcp.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/key/af_key.c
net/llc/af_llc.c
net/mac80211/rx.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/nf_conntrack_helper.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_nat_core.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink_cthelper.c
net/netfilter/nft_bitwise.c
net/netfilter/nft_cmp.c
net/netfilter/nft_ct.c
net/netfilter/nft_immediate.c
net/netfilter/nft_range.c
net/netfilter/nft_set_hash.c
net/netfilter/x_tables.c
net/netfilter/xt_CT.c
net/openvswitch/conntrack.c
net/sched/cls_matchall.c
net/sctp/associola.c
net/sctp/input.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/vmw_vsock/af_vsock.c
net/wireless/scan.c
net/wireless/util.c
net/xfrm/xfrm_device.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/usb/quirks.c
tools/arch/arm/include/uapi/asm/kvm.h
tools/arch/arm64/include/uapi/asm/kvm.h
tools/arch/powerpc/include/uapi/asm/kvm.h
tools/arch/s390/include/uapi/asm/kvm.h
tools/arch/x86/include/asm/cpufeatures.h
tools/arch/x86/include/asm/disabled-features.h
tools/arch/x86/include/asm/required-features.h
tools/arch/x86/include/uapi/asm/kvm.h
tools/arch/x86/include/uapi/asm/vmx.h
tools/include/linux/filter.h
tools/include/uapi/linux/stat.h
tools/perf/Documentation/perf-script.txt
tools/perf/builtin-script.c
tools/perf/ui/hist.c
tools/perf/util/callchain.c
tools/perf/util/evsel_fprintf.c
tools/perf/util/srcline.c
tools/perf/util/unwind-libdw.c
tools/perf/util/unwind-libunwind-local.c
tools/power/acpi/.gitignore [new file with mode: 0644]
tools/testing/selftests/bpf/test_verifier.c
tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc [new file with mode: 0644]
tools/testing/selftests/powerpc/tm/tm-resched-dscr.c

index 22cb3091f29776b2acfb0df339db150393a8ad83..effe7af3a5af95d25f86efadaa7dd2b127a0dea9 100644 (file)
@@ -59,20 +59,28 @@ button driver uses the following 3 modes in order not to trigger issues.
 If the userspace hasn't been prepared to ignore the unreliable "opened"
 events and the unreliable initial state notification, Linux users can use
 the following kernel parameters to handle the possible issues:
-A. button.lid_init_state=open:
+A. button.lid_init_state=method:
+   When this option is specified, the ACPI button driver reports the
+   initial lid state using the returning value of the _LID control method
+   and whether the "opened"/"closed" events are paired fully relies on the
+   firmware implementation.
+   This option can be used to fix some platforms where the returning value
+   of the _LID control method is reliable but the initial lid state
+   notification is missing.
+   This option is the default behavior during the period the userspace
+   isn't ready to handle the buggy AML tables.
+B. button.lid_init_state=open:
    When this option is specified, the ACPI button driver always reports the
    initial lid state as "opened" and whether the "opened"/"closed" events
    are paired fully relies on the firmware implementation.
    This may fix some platforms where the returning value of the _LID
    control method is not reliable and the initial lid state notification is
    missing.
-   This option is the default behavior during the period the userspace
-   isn't ready to handle the buggy AML tables.
 
 If the userspace has been prepared to ignore the unreliable "opened" events
 and the unreliable initial state notification, Linux users should always
 use the following kernel parameter:
-B. button.lid_init_state=ignore:
+C. button.lid_init_state=ignore:
    When this option is specified, the ACPI button driver never reports the
    initial lid state and there is a compensation mechanism implemented to
    ensure that the reliable "closed" notifications can always be delievered
index 289c80f7760ebb966b13d91b5627e61963e5b3aa..09aa2e9497875acec984dc68727e14139c5d23ad 100644 (file)
@@ -1,4 +1,5 @@
 .. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>`
+.. |intel_pstate| replace:: :doc:`intel_pstate <intel_pstate>`
 
 =======================
 CPU Performance Scaling
@@ -75,7 +76,7 @@ feedback registers, as that information is typically specific to the hardware
 interface it comes from and may not be easily represented in an abstract,
 platform-independent way.  For this reason, ``CPUFreq`` allows scaling drivers
 to bypass the governor layer and implement their own performance scaling
-algorithms.  That is done by the ``intel_pstate`` scaling driver.
+algorithms.  That is done by the |intel_pstate| scaling driver.
 
 
 ``CPUFreq`` Policy Objects
@@ -174,13 +175,13 @@ necessary to restart the scaling governor so that it can take the new online CPU
 into account.  That is achieved by invoking the governor's ``->stop`` and
 ``->start()`` callbacks, in this order, for the entire policy.
 
-As mentioned before, the ``intel_pstate`` scaling driver bypasses the scaling
+As mentioned before, the |intel_pstate| scaling driver bypasses the scaling
 governor layer of ``CPUFreq`` and provides its own P-state selection algorithms.
-Consequently, if ``intel_pstate`` is used, scaling governors are not attached to
+Consequently, if |intel_pstate| is used, scaling governors are not attached to
 new policy objects.  Instead, the driver's ``->setpolicy()`` callback is invoked
 to register per-CPU utilization update callbacks for each policy.  These
 callbacks are invoked by the CPU scheduler in the same way as for scaling
-governors, but in the ``intel_pstate`` case they both determine the P-state to
+governors, but in the |intel_pstate| case they both determine the P-state to
 use and change the hardware configuration accordingly in one go from scheduler
 context.
 
@@ -257,7 +258,7 @@ are the following:
 
 ``scaling_available_governors``
        List of ``CPUFreq`` scaling governors present in the kernel that can
-       be attached to this policy or (if the ``intel_pstate`` scaling driver is
+       be attached to this policy or (if the |intel_pstate| scaling driver is
        in use) list of scaling algorithms provided by the driver that can be
        applied to this policy.
 
@@ -274,7 +275,7 @@ are the following:
        the CPU is actually running at (due to hardware design and other
        limitations).
 
-       Some scaling drivers (e.g. ``intel_pstate``) attempt to provide
+       Some scaling drivers (e.g. |intel_pstate|) attempt to provide
        information more precisely reflecting the current CPU frequency through
        this attribute, but that still may not be the exact current CPU
        frequency as seen by the hardware at the moment.
@@ -284,13 +285,13 @@ are the following:
 
 ``scaling_governor``
        The scaling governor currently attached to this policy or (if the
-       ``intel_pstate`` scaling driver is in use) the scaling algorithm
+       |intel_pstate| scaling driver is in use) the scaling algorithm
        provided by the driver that is currently applied to this policy.
 
        This attribute is read-write and writing to it will cause a new scaling
        governor to be attached to this policy or a new scaling algorithm
        provided by the scaling driver to be applied to it (in the
-       ``intel_pstate`` case), as indicated by the string written to this
+       |intel_pstate| case), as indicated by the string written to this
        attribute (which must be one of the names listed by the
        ``scaling_available_governors`` attribute described above).
 
@@ -619,7 +620,7 @@ This file is located under :file:`/sys/devices/system/cpu/cpufreq/` and controls
 the "boost" setting for the whole system.  It is not present if the underlying
 scaling driver does not support the frequency boost mechanism (or supports it,
 but provides a driver-specific interface for controlling it, like
-``intel_pstate``).
+|intel_pstate|).
 
 If the value in this file is 1, the frequency boost mechanism is enabled.  This
 means that either the hardware can be put into states in which it is able to
index c80f087321fcb704e549254c70ccb927f9659b4c..7f148f76f432cbfc62ed663a6be7b9849b66b3c6 100644 (file)
@@ -6,6 +6,7 @@ Power Management
    :maxdepth: 2
 
    cpufreq
+   intel_pstate
 
 .. only::  subproject and html
 
diff --git a/Documentation/admin-guide/pm/intel_pstate.rst b/Documentation/admin-guide/pm/intel_pstate.rst
new file mode 100644 (file)
index 0000000..33d7039
--- /dev/null
@@ -0,0 +1,755 @@
+===============================================
+``intel_pstate`` CPU Performance Scaling Driver
+===============================================
+
+::
+
+ Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+
+General Information
+===================
+
+``intel_pstate`` is a part of the
+:doc:`CPU performance scaling subsystem <cpufreq>` in the Linux kernel
+(``CPUFreq``).  It is a scaling driver for the Sandy Bridge and later
+generations of Intel processors.  Note, however, that some of those processors
+may not be supported.  [To understand ``intel_pstate`` it is necessary to know
+how ``CPUFreq`` works in general, so this is the time to read :doc:`cpufreq` if
+you have not done that yet.]
+
+For the processors supported by ``intel_pstate``, the P-state concept is broader
+than just an operating frequency or an operating performance point (see the
+`LinuxCon Europe 2015 presentation by Kristen Accardi <LCEU2015_>`_ for more
+information about that).  For this reason, the representation of P-states used
+by ``intel_pstate`` internally follows the hardware specification (for details
+refer to `Intel® 64 and IA-32 Architectures Software Developer’s Manual
+Volume 3: System Programming Guide <SDM_>`_).  However, the ``CPUFreq`` core
+uses frequencies for identifying operating performance points of CPUs and
+frequencies are involved in the user space interface exposed by it, so
+``intel_pstate`` maps its internal representation of P-states to frequencies too
+(fortunately, that mapping is unambiguous).  At the same time, it would not be
+practical for ``intel_pstate`` to supply the ``CPUFreq`` core with a table of
+available frequencies due to the possible size of it, so the driver does not do
+that.  Some functionality of the core is limited by that.
+
+Since the hardware P-state selection interface used by ``intel_pstate`` is
+available at the logical CPU level, the driver always works with individual
+CPUs.  Consequently, if ``intel_pstate`` is in use, every ``CPUFreq`` policy
+object corresponds to one logical CPU and ``CPUFreq`` policies are effectively
+equivalent to CPUs.  In particular, this means that they become "inactive" every
+time the corresponding CPU is taken offline and need to be re-initialized when
+it goes back online.
+
+``intel_pstate`` is not modular, so it cannot be unloaded, which means that the
+only way to pass early-configuration-time parameters to it is via the kernel
+command line.  However, its configuration can be adjusted via ``sysfs`` to a
+great extent.  In some configurations it even is possible to unregister it via
+``sysfs`` which allows another ``CPUFreq`` scaling driver to be loaded and
+registered (see `below <status_attr_>`_).
+
+
+Operation Modes
+===============
+
+``intel_pstate`` can operate in three different modes: in the active mode with
+or without hardware-managed P-states support and in the passive mode.  Which of
+them will be in effect depends on what kernel command line options are used and
+on the capabilities of the processor.
+
+Active Mode
+-----------
+
+This is the default operation mode of ``intel_pstate``.  If it works in this
+mode, the ``scaling_driver`` policy attribute in ``sysfs`` for all ``CPUFreq``
+policies contains the string "intel_pstate".
+
+In this mode the driver bypasses the scaling governors layer of ``CPUFreq`` and
+provides its own scaling algorithms for P-state selection.  Those algorithms
+can be applied to ``CPUFreq`` policies in the same way as generic scaling
+governors (that is, through the ``scaling_governor`` policy attribute in
+``sysfs``).  [Note that different P-state selection algorithms may be chosen for
+different policies, but that is not recommended.]
+
+They are not generic scaling governors, but their names are the same as the
+names of some of those governors.  Moreover, confusingly enough, they generally
+do not work in the same way as the generic governors they share the names with.
+For example, the ``powersave`` P-state selection algorithm provided by
+``intel_pstate`` is not a counterpart of the generic ``powersave`` governor
+(roughly, it corresponds to the ``schedutil`` and ``ondemand`` governors).
+
+There are two P-state selection algorithms provided by ``intel_pstate`` in the
+active mode: ``powersave`` and ``performance``.  The way they both operate
+depends on whether or not the hardware-managed P-states (HWP) feature has been
+enabled in the processor and possibly on the processor model.
+
+Which of the P-state selection algorithms is used by default depends on the
+:c:macro:`CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE` kernel configuration option.
+Namely, if that option is set, the ``performance`` algorithm will be used by
+default, and the other one will be used by default if it is not set.
+
+Active Mode With HWP
+~~~~~~~~~~~~~~~~~~~~
+
+If the processor supports the HWP feature, it will be enabled during the
+processor initialization and cannot be disabled after that.  It is possible
+to avoid enabling it by passing the ``intel_pstate=no_hwp`` argument to the
+kernel in the command line.
+
+If the HWP feature has been enabled, ``intel_pstate`` relies on the processor to
+select P-states by itself, but still it can give hints to the processor's
+internal P-state selection logic.  What those hints are depends on which P-state
+selection algorithm has been applied to the given policy (or to the CPU it
+corresponds to).
+
+Even though the P-state selection is carried out by the processor automatically,
+``intel_pstate`` registers utilization update callbacks with the CPU scheduler
+in this mode.  However, they are not used for running a P-state selection
+algorithm, but for periodic updates of the current CPU frequency information to
+be made available from the ``scaling_cur_freq`` policy attribute in ``sysfs``.
+
+HWP + ``performance``
+.....................
+
+In this configuration ``intel_pstate`` will write 0 to the processor's
+Energy-Performance Preference (EPP) knob (if supported) or its
+Energy-Performance Bias (EPB) knob (otherwise), which means that the processor's
+internal P-state selection logic is expected to focus entirely on performance.
+
+This will override the EPP/EPB setting coming from the ``sysfs`` interface
+(see `Energy vs Performance Hints`_ below).
+
+Also, in this configuration the range of P-states available to the processor's
+internal P-state selection logic is always restricted to the upper boundary
+(that is, the maximum P-state that the driver is allowed to use).
+
+HWP + ``powersave``
+...................
+
+In this configuration ``intel_pstate`` will set the processor's
+Energy-Performance Preference (EPP) knob (if supported) or its
+Energy-Performance Bias (EPB) knob (otherwise) to whatever value it was
+previously set to via ``sysfs`` (or whatever default value it was
+set to by the platform firmware).  This usually causes the processor's
+internal P-state selection logic to be less performance-focused.
+
+Active Mode Without HWP
+~~~~~~~~~~~~~~~~~~~~~~~
+
+This is the default operation mode for processors that do not support the HWP
+feature.  It also is used by default with the ``intel_pstate=no_hwp`` argument
+in the kernel command line.  However, in this mode ``intel_pstate`` may refuse
+to work with the given processor if it does not recognize it.  [Note that
+``intel_pstate`` will never refuse to work with any processor with the HWP
+feature enabled.]
+
+In this mode ``intel_pstate`` registers utilization update callbacks with the
+CPU scheduler in order to run a P-state selection algorithm, either
+``powersave`` or ``performance``, depending on the ``scaling_cur_freq`` policy
+setting in ``sysfs``.  The current CPU frequency information to be made
+available from the ``scaling_cur_freq`` policy attribute in ``sysfs`` is
+periodically updated by those utilization update callbacks too.
+
+``performance``
+...............
+
+Without HWP, this P-state selection algorithm is always the same regardless of
+the processor model and platform configuration.
+
+It selects the maximum P-state it is allowed to use, subject to limits set via
+``sysfs``, every time the P-state selection computations are carried out by the
+driver's utilization update callback for the given CPU (that does not happen
+more often than every 10 ms), but the hardware configuration will not be changed
+if the new P-state is the same as the current one.
+
+This is the default P-state selection algorithm if the
+:c:macro:`CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE` kernel configuration option
+is set.
+
+``powersave``
+.............
+
+Without HWP, this P-state selection algorithm generally depends on the
+processor model and/or the system profile setting in the ACPI tables and there
+are two variants of it.
+
+One of them is used with processors from the Atom line and (regardless of the
+processor model) on platforms with the system profile in the ACPI tables set to
+"mobile" (laptops mostly), "tablet", "appliance PC", "desktop", or
+"workstation".  It is also used with processors supporting the HWP feature if
+that feature has not been enabled (that is, with the ``intel_pstate=no_hwp``
+argument in the kernel command line).  It is similar to the algorithm
+implemented by the generic ``schedutil`` scaling governor except that the
+utilization metric used by it is based on numbers coming from feedback
+registers of the CPU.  It generally selects P-states proportional to the
+current CPU utilization, so it is referred to as the "proportional" algorithm.
+
+The second variant of the ``powersave`` P-state selection algorithm, used in all
+of the other cases (generally, on processors from the Core line, so it is
+referred to as the "Core" algorithm), is based on the values read from the APERF
+and MPERF feedback registers and the previously requested target P-state.
+It does not really take CPU utilization into account explicitly, but as a rule
+it causes the CPU P-state to ramp up very quickly in response to increased
+utilization which is generally desirable in server environments.
+
+Regardless of the variant, this algorithm is run by the driver's utilization
+update callback for the given CPU when it is invoked by the CPU scheduler, but
+not more often than every 10 ms (that can be tweaked via ``debugfs`` in `this
+particular case <Tuning Interface in debugfs_>`_).  Like in the ``performance``
+case, the hardware configuration is not touched if the new P-state turns out to
+be the same as the current one.
+
+This is the default P-state selection algorithm if the
+:c:macro:`CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE` kernel configuration option
+is not set.
+
+Passive Mode
+------------
+
+This mode is used if the ``intel_pstate=passive`` argument is passed to the
+kernel in the command line (it implies the ``intel_pstate=no_hwp`` setting too).
+Like in the active mode without HWP support, in this mode ``intel_pstate`` may
+refuse to work with the given processor if it does not recognize it.
+
+If the driver works in this mode, the ``scaling_driver`` policy attribute in
+``sysfs`` for all ``CPUFreq`` policies contains the string "intel_cpufreq".
+Then, the driver behaves like a regular ``CPUFreq`` scaling driver.  That is,
+it is invoked by generic scaling governors when necessary to talk to the
+hardware in order to change the P-state of a CPU (in particular, the
+``schedutil`` governor can invoke it directly from scheduler context).
+
+While in this mode, ``intel_pstate`` can be used with all of the (generic)
+scaling governors listed by the ``scaling_available_governors`` policy attribute
+in ``sysfs`` (and the P-state selection algorithms described above are not
+used).  Then, it is responsible for the configuration of policy objects
+corresponding to CPUs and provides the ``CPUFreq`` core (and the scaling
+governors attached to the policy objects) with accurate information on the
+maximum and minimum operating frequencies supported by the hardware (including
+the so-called "turbo" frequency ranges).  In other words, in the passive mode
+the entire range of available P-states is exposed by ``intel_pstate`` to the
+``CPUFreq`` core.  However, in this mode the driver does not register
+utilization update callbacks with the CPU scheduler and the ``scaling_cur_freq``
+information comes from the ``CPUFreq`` core (and is the last frequency selected
+by the current scaling governor for the given policy).
+
+
+.. _turbo:
+
+Turbo P-states Support
+======================
+
+In the majority of cases, the entire range of P-states available to
+``intel_pstate`` can be divided into two sub-ranges that correspond to
+different types of processor behavior, above and below a boundary that
+will be referred to as the "turbo threshold" in what follows.
+
+The P-states above the turbo threshold are referred to as "turbo P-states" and
+the whole sub-range of P-states they belong to is referred to as the "turbo
+range".  These names are related to the Turbo Boost technology allowing a
+multicore processor to opportunistically increase the P-state of one or more
+cores if there is enough power to do that and if that is not going to cause the
+thermal envelope of the processor package to be exceeded.
+
+Specifically, if software sets the P-state of a CPU core within the turbo range
+(that is, above the turbo threshold), the processor is permitted to take over
+performance scaling control for that core and put it into turbo P-states of its
+choice going forward.  However, that permission is interpreted differently by
+different processor generations.  Namely, the Sandy Bridge generation of
+processors will never use any P-states above the last one set by software for
+the given core, even if it is within the turbo range, whereas all of the later
+processor generations will take it as a license to use any P-states from the
+turbo range, even above the one set by software.  In other words, on those
+processors setting any P-state from the turbo range will enable the processor
+to put the given core into all turbo P-states up to and including the maximum
+supported one as it sees fit.
+
+One important property of turbo P-states is that they are not sustainable.  More
+precisely, there is no guarantee that any CPUs will be able to stay in any of
+those states indefinitely, because the power distribution within the processor
+package may change over time  or the thermal envelope it was designed for might
+be exceeded if a turbo P-state was used for too long.
+
+In turn, the P-states below the turbo threshold generally are sustainable.  In
+fact, if one of them is set by software, the processor is not expected to change
+it to a lower one unless in a thermal stress or a power limit violation
+situation (a higher P-state may still be used if it is set for another CPU in
+the same package at the same time, for example).
+
+Some processors allow multiple cores to be in turbo P-states at the same time,
+but the maximum P-state that can be set for them generally depends on the number
+of cores running concurrently.  The maximum turbo P-state that can be set for 3
+cores at the same time usually is lower than the analogous maximum P-state for
+2 cores, which in turn usually is lower than the maximum turbo P-state that can
+be set for 1 core.  The one-core maximum turbo P-state is thus the maximum
+supported one overall.
+
+The maximum supported turbo P-state, the turbo threshold (the maximum supported
+non-turbo P-state) and the minimum supported P-state are specific to the
+processor model and can be determined by reading the processor's model-specific
+registers (MSRs).  Moreover, some processors support the Configurable TDP
+(Thermal Design Power) feature and, when that feature is enabled, the turbo
+threshold effectively becomes a configurable value that can be set by the
+platform firmware.
+
+Unlike ``_PSS`` objects in the ACPI tables, ``intel_pstate`` always exposes
+the entire range of available P-states, including the whole turbo range, to the
+``CPUFreq`` core and (in the passive mode) to generic scaling governors.  This
+generally causes turbo P-states to be set more often when ``intel_pstate`` is
+used relative to ACPI-based CPU performance scaling (see `below <acpi-cpufreq_>`_
+for more information).
+
+Moreover, since ``intel_pstate`` always knows what the real turbo threshold is
+(even if the Configurable TDP feature is enabled in the processor), its
+``no_turbo`` attribute in ``sysfs`` (described `below <no_turbo_attr_>`_) should
+work as expected in all cases (that is, if set to disable turbo P-states, it
+always should prevent ``intel_pstate`` from using them).
+
+
+Processor Support
+=================
+
+To handle a given processor ``intel_pstate`` requires a number of different
+pieces of information on it to be known, including:
+
+ * The minimum supported P-state.
+
+ * The maximum supported `non-turbo P-state <turbo_>`_.
+
+ * Whether or not turbo P-states are supported at all.
+
+ * The maximum supported `one-core turbo P-state <turbo_>`_ (if turbo P-states
+   are supported).
+
+ * The scaling formula to translate the driver's internal representation
+   of P-states into frequencies and the other way around.
+
+Generally, ways to obtain that information are specific to the processor model
+or family.  Although it often is possible to obtain all of it from the processor
+itself (using model-specific registers), there are cases in which hardware
+manuals need to be consulted to get to it too.
+
+For this reason, there is a list of supported processors in ``intel_pstate`` and
+the driver initialization will fail if the detected processor is not in that
+list, unless it supports the `HWP feature <Active Mode_>`_.  [The interface to
+obtain all of the information listed above is the same for all of the processors
+supporting the HWP feature, which is why they all are supported by
+``intel_pstate``.]
+
+
+User Space Interface in ``sysfs``
+=================================
+
+Global Attributes
+-----------------
+
+``intel_pstate`` exposes several global attributes (files) in ``sysfs`` to
+control its functionality at the system level.  They are located in the
+``/sys/devices/system/cpu/cpufreq/intel_pstate/`` directory and affect all
+CPUs.
+
+Some of them are not present if the ``intel_pstate=per_cpu_perf_limits``
+argument is passed to the kernel in the command line.
+
+``max_perf_pct``
+       Maximum P-state the driver is allowed to set in percent of the
+       maximum supported performance level (the highest supported `turbo
+       P-state <turbo_>`_).
+
+       This attribute will not be exposed if the
+       ``intel_pstate=per_cpu_perf_limits`` argument is present in the kernel
+       command line.
+
+``min_perf_pct``
+       Minimum P-state the driver is allowed to set in percent of the
+       maximum supported performance level (the highest supported `turbo
+       P-state <turbo_>`_).
+
+       This attribute will not be exposed if the
+       ``intel_pstate=per_cpu_perf_limits`` argument is present in the kernel
+       command line.
+
+``num_pstates``
+       Number of P-states supported by the processor (between 0 and 255
+       inclusive) including both turbo and non-turbo P-states (see
+       `Turbo P-states Support`_).
+
+       The value of this attribute is not affected by the ``no_turbo``
+       setting described `below <no_turbo_attr_>`_.
+
+       This attribute is read-only.
+
+``turbo_pct``
+       Ratio of the `turbo range <turbo_>`_ size to the size of the entire
+       range of supported P-states, in percent.
+
+       This attribute is read-only.
+
+.. _no_turbo_attr:
+
+``no_turbo``
+       If set (equal to 1), the driver is not allowed to set any turbo P-states
+       (see `Turbo P-states Support`_).  If unset (equalt to 0, which is the
+       default), turbo P-states can be set by the driver.
+       [Note that ``intel_pstate`` does not support the general ``boost``
+       attribute (supported by some other scaling drivers) which is replaced
+       by this one.]
+
+       This attrubute does not affect the maximum supported frequency value
+       supplied to the ``CPUFreq`` core and exposed via the policy interface,
+       but it affects the maximum possible value of per-policy P-state limits
+       (see `Interpretation of Policy Attributes`_ below for details).
+
+.. _status_attr:
+
+``status``
+       Operation mode of the driver: "active", "passive" or "off".
+
+       "active"
+               The driver is functional and in the `active mode
+               <Active Mode_>`_.
+
+       "passive"
+               The driver is functional and in the `passive mode
+               <Passive Mode_>`_.
+
+       "off"
+               The driver is not functional (it is not registered as a scaling
+               driver with the ``CPUFreq`` core).
+
+       This attribute can be written to in order to change the driver's
+       operation mode or to unregister it.  The string written to it must be
+       one of the possible values of it and, if successful, the write will
+       cause the driver to switch over to the operation mode represented by
+       that string - or to be unregistered in the "off" case.  [Actually,
+       switching over from the active mode to the passive mode or the other
+       way around causes the driver to be unregistered and registered again
+       with a different set of callbacks, so all of its settings (the global
+       as well as the per-policy ones) are then reset to their default
+       values, possibly depending on the target operation mode.]
+
+       That only is supported in some configurations, though (for example, if
+       the `HWP feature is enabled in the processor <Active Mode With HWP_>`_,
+       the operation mode of the driver cannot be changed), and if it is not
+       supported in the current configuration, writes to this attribute with
+       fail with an appropriate error.
+
+Interpretation of Policy Attributes
+-----------------------------------
+
+The interpretation of some ``CPUFreq`` policy attributes described in
+:doc:`cpufreq` is special with ``intel_pstate`` as the current scaling driver
+and it generally depends on the driver's `operation mode <Operation Modes_>`_.
+
+First of all, the values of the ``cpuinfo_max_freq``, ``cpuinfo_min_freq`` and
+``scaling_cur_freq`` attributes are produced by applying a processor-specific
+multiplier to the internal P-state representation used by ``intel_pstate``.
+Also, the values of the ``scaling_max_freq`` and ``scaling_min_freq``
+attributes are capped by the frequency corresponding to the maximum P-state that
+the driver is allowed to set.
+
+If the ``no_turbo`` `global attribute <no_turbo_attr_>`_ is set, the driver is
+not allowed to use turbo P-states, so the maximum value of ``scaling_max_freq``
+and ``scaling_min_freq`` is limited to the maximum non-turbo P-state frequency.
+Accordingly, setting ``no_turbo`` causes ``scaling_max_freq`` and
+``scaling_min_freq`` to go down to that value if they were above it before.
+However, the old values of ``scaling_max_freq`` and ``scaling_min_freq`` will be
+restored after unsetting ``no_turbo``, unless these attributes have been written
+to after ``no_turbo`` was set.
+
+If ``no_turbo`` is not set, the maximum possible value of ``scaling_max_freq``
+and ``scaling_min_freq`` corresponds to the maximum supported turbo P-state,
+which also is the value of ``cpuinfo_max_freq`` in either case.
+
+Next, the following policy attributes have special meaning if
+``intel_pstate`` works in the `active mode <Active Mode_>`_:
+
+``scaling_available_governors``
+       List of P-state selection algorithms provided by ``intel_pstate``.
+
+``scaling_governor``
+       P-state selection algorithm provided by ``intel_pstate`` currently in
+       use with the given policy.
+
+``scaling_cur_freq``
+       Frequency of the average P-state of the CPU represented by the given
+       policy for the time interval between the last two invocations of the
+       driver's utilization update callback by the CPU scheduler for that CPU.
+
+The meaning of these attributes in the `passive mode <Passive Mode_>`_ is the
+same as for other scaling drivers.
+
+Additionally, the value of the ``scaling_driver`` attribute for ``intel_pstate``
+depends on the operation mode of the driver.  Namely, it is either
+"intel_pstate" (in the `active mode <Active Mode_>`_) or "intel_cpufreq" (in the
+`passive mode <Passive Mode_>`_).
+
+Coordination of P-State Limits
+------------------------------
+
+``intel_pstate`` allows P-state limits to be set in two ways: with the help of
+the ``max_perf_pct`` and ``min_perf_pct`` `global attributes
+<Global Attributes_>`_ or via the ``scaling_max_freq`` and ``scaling_min_freq``
+``CPUFreq`` policy attributes.  The coordination between those limits is based
+on the following rules, regardless of the current operation mode of the driver:
+
+ 1. All CPUs are affected by the global limits (that is, none of them can be
+    requested to run faster than the global maximum and none of them can be
+    requested to run slower than the global minimum).
+
+ 2. Each individual CPU is affected by its own per-policy limits (that is, it
+    cannot be requested to run faster than its own per-policy maximum and it
+    cannot be requested to run slower than its own per-policy minimum).
+
+ 3. The global and per-policy limits can be set independently.
+
+If the `HWP feature is enabled in the processor <Active Mode With HWP_>`_, the
+resulting effective values are written into its registers whenever the limits
+change in order to request its internal P-state selection logic to always set
+P-states within these limits.  Otherwise, the limits are taken into account by
+scaling governors (in the `passive mode <Passive Mode_>`_) and by the driver
+every time before setting a new P-state for a CPU.
+
+Additionally, if the ``intel_pstate=per_cpu_perf_limits`` command line argument
+is passed to the kernel, ``max_perf_pct`` and ``min_perf_pct`` are not exposed
+at all and the only way to set the limits is by using the policy attributes.
+
+
+Energy vs Performance Hints
+---------------------------
+
+If ``intel_pstate`` works in the `active mode with the HWP feature enabled
+<Active Mode With HWP_>`_ in the processor, additional attributes are present
+in every ``CPUFreq`` policy directory in ``sysfs``.  They are intended to allow
+user space to help ``intel_pstate`` to adjust the processor's internal P-state
+selection logic by focusing it on performance or on energy-efficiency, or
+somewhere between the two extremes:
+
+``energy_performance_preference``
+       Current value of the energy vs performance hint for the given policy
+       (or the CPU represented by it).
+
+       The hint can be changed by writing to this attribute.
+
+``energy_performance_available_preferences``
+       List of strings that can be written to the
+       ``energy_performance_preference`` attribute.
+
+       They represent different energy vs performance hints and should be
+       self-explanatory, except that ``default`` represents whatever hint
+       value was set by the platform firmware.
+
+Strings written to the ``energy_performance_preference`` attribute are
+internally translated to integer values written to the processor's
+Energy-Performance Preference (EPP) knob (if supported) or its
+Energy-Performance Bias (EPB) knob.
+
+[Note that tasks may by migrated from one CPU to another by the scheduler's
+load-balancing algorithm and if different energy vs performance hints are
+set for those CPUs, that may lead to undesirable outcomes.  To avoid such
+issues it is better to set the same energy vs performance hint for all CPUs
+or to pin every task potentially sensitive to them to a specific CPU.]
+
+.. _acpi-cpufreq:
+
+``intel_pstate`` vs ``acpi-cpufreq``
+====================================
+
+On the majority of systems supported by ``intel_pstate``, the ACPI tables
+provided by the platform firmware contain ``_PSS`` objects returning information
+that can be used for CPU performance scaling (refer to the `ACPI specification`_
+for details on the ``_PSS`` objects and the format of the information returned
+by them).
+
+The information returned by the ACPI ``_PSS`` objects is used by the
+``acpi-cpufreq`` scaling driver.  On systems supported by ``intel_pstate``
+the ``acpi-cpufreq`` driver uses the same hardware CPU performance scaling
+interface, but the set of P-states it can use is limited by the ``_PSS``
+output.
+
+On those systems each ``_PSS`` object returns a list of P-states supported by
+the corresponding CPU which basically is a subset of the P-states range that can
+be used by ``intel_pstate`` on the same system, with one exception: the whole
+`turbo range <turbo_>`_ is represented by one item in it (the topmost one).  By
+convention, the frequency returned by ``_PSS`` for that item is greater by 1 MHz
+than the frequency of the highest non-turbo P-state listed by it, but the
+corresponding P-state representation (following the hardware specification)
+returned for it matches the maximum supported turbo P-state (or is the
+special value 255 meaning essentially "go as high as you can get").
+
+The list of P-states returned by ``_PSS`` is reflected by the table of
+available frequencies supplied by ``acpi-cpufreq`` to the ``CPUFreq`` core and
+scaling governors and the minimum and maximum supported frequencies reported by
+it come from that list as well.  In particular, given the special representation
+of the turbo range described above, this means that the maximum supported
+frequency reported by ``acpi-cpufreq`` is higher by 1 MHz than the frequency
+of the highest supported non-turbo P-state listed by ``_PSS`` which, of course,
+affects decisions made by the scaling governors, except for ``powersave`` and
+``performance``.
+
+For example, if a given governor attempts to select a frequency proportional to
+estimated CPU load and maps the load of 100% to the maximum supported frequency
+(possibly multiplied by a constant), then it will tend to choose P-states below
+the turbo threshold if ``acpi-cpufreq`` is used as the scaling driver, because
+in that case the turbo range corresponds to a small fraction of the frequency
+band it can use (1 MHz vs 1 GHz or more).  In consequence, it will only go to
+the turbo range for the highest loads and the other loads above 50% that might
+benefit from running at turbo frequencies will be given non-turbo P-states
+instead.
+
+One more issue related to that may appear on systems supporting the
+`Configurable TDP feature <turbo_>`_ allowing the platform firmware to set the
+turbo threshold.  Namely, if that is not coordinated with the lists of P-states
+returned by ``_PSS`` properly, there may be more than one item corresponding to
+a turbo P-state in those lists and there may be a problem with avoiding the
+turbo range (if desirable or necessary).  Usually, to avoid using turbo
+P-states overall, ``acpi-cpufreq`` simply avoids using the topmost state listed
+by ``_PSS``, but that is not sufficient when there are other turbo P-states in
+the list returned by it.
+
+Apart from the above, ``acpi-cpufreq`` works like ``intel_pstate`` in the
+`passive mode <Passive Mode_>`_, except that the number of P-states it can set
+is limited to the ones listed by the ACPI ``_PSS`` objects.
+
+
+Kernel Command Line Options for ``intel_pstate``
+================================================
+
+Several kernel command line options can be used to pass early-configuration-time
+parameters to ``intel_pstate`` in order to enforce specific behavior of it.  All
+of them have to be prepended with the ``intel_pstate=`` prefix.
+
+``disable``
+       Do not register ``intel_pstate`` as the scaling driver even if the
+       processor is supported by it.
+
+``passive``
+       Register ``intel_pstate`` in the `passive mode <Passive Mode_>`_ to
+       start with.
+
+       This option implies the ``no_hwp`` one described below.
+
+``force``
+       Register ``intel_pstate`` as the scaling driver instead of
+       ``acpi-cpufreq`` even if the latter is preferred on the given system.
+
+       This may prevent some platform features (such as thermal controls and
+       power capping) that rely on the availability of ACPI P-states
+       information from functioning as expected, so it should be used with
+       caution.
+
+       This option does not work with processors that are not supported by
+       ``intel_pstate`` and on platforms where the ``pcc-cpufreq`` scaling
+       driver is used instead of ``acpi-cpufreq``.
+
+``no_hwp``
+       Do not enable the `hardware-managed P-states (HWP) feature
+       <Active Mode With HWP_>`_ even if it is supported by the processor.
+
+``hwp_only``
+       Register ``intel_pstate`` as the scaling driver only if the
+       `hardware-managed P-states (HWP) feature <Active Mode With HWP_>`_ is
+       supported by the processor.
+
+``support_acpi_ppc``
+       Take ACPI ``_PPC`` performance limits into account.
+
+       If the preferred power management profile in the FADT (Fixed ACPI
+       Description Table) is set to "Enterprise Server" or "Performance
+       Server", the ACPI ``_PPC`` limits are taken into account by default
+       and this option has no effect.
+
+``per_cpu_perf_limits``
+       Use per-logical-CPU P-State limits (see `Coordination of P-state
+       Limits`_ for details).
+
+
+Diagnostics and Tuning
+======================
+
+Trace Events
+------------
+
+There are two static trace events that can be used for ``intel_pstate``
+diagnostics.  One of them is the ``cpu_frequency`` trace event generally used
+by ``CPUFreq``, and the other one is the ``pstate_sample`` trace event specific
+to ``intel_pstate``.  Both of them are triggered by ``intel_pstate`` only if
+it works in the `active mode <Active Mode_>`_.
+
+The following sequence of shell commands can be used to enable them and see
+their output (if the kernel is generally configured to support event tracing)::
+
+ # cd /sys/kernel/debug/tracing/
+ # echo 1 > events/power/pstate_sample/enable
+ # echo 1 > events/power/cpu_frequency/enable
+ # cat trace
+ gnome-terminal--4510  [001] ..s.  1177.680733: pstate_sample: core_busy=107 scaled=94 from=26 to=26 mperf=1143818 aperf=1230607 tsc=29838618 freq=2474476
+ cat-5235  [002] ..s.  1177.681723: cpu_frequency: state=2900000 cpu_id=2
+
+If ``intel_pstate`` works in the `passive mode <Passive Mode_>`_, the
+``cpu_frequency`` trace event will be triggered either by the ``schedutil``
+scaling governor (for the policies it is attached to), or by the ``CPUFreq``
+core (for the policies with other scaling governors).
+
+``ftrace``
+----------
+
+The ``ftrace`` interface can be used for low-level diagnostics of
+``intel_pstate``.  For example, to check how often the function to set a
+P-state is called, the ``ftrace`` filter can be set to to
+:c:func:`intel_pstate_set_pstate`::
+
+ # cd /sys/kernel/debug/tracing/
+ # cat available_filter_functions | grep -i pstate
+ intel_pstate_set_pstate
+ intel_pstate_cpu_init
+ ...
+ # echo intel_pstate_set_pstate > set_ftrace_filter
+ # echo function > current_tracer
+ # cat trace | head -15
+ # tracer: function
+ #
+ # entries-in-buffer/entries-written: 80/80   #P:4
+ #
+ #                              _-----=> irqs-off
+ #                             / _----=> need-resched
+ #                            | / _---=> hardirq/softirq
+ #                            || / _--=> preempt-depth
+ #                            ||| /     delay
+ #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
+ #              | |       |   ||||       |         |
+             Xorg-3129  [000] ..s.  2537.644844: intel_pstate_set_pstate <-intel_pstate_timer_func
+  gnome-terminal--4510  [002] ..s.  2537.649844: intel_pstate_set_pstate <-intel_pstate_timer_func
+      gnome-shell-3409  [001] ..s.  2537.650850: intel_pstate_set_pstate <-intel_pstate_timer_func
+           <idle>-0     [000] ..s.  2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func
+
+Tuning Interface in ``debugfs``
+-------------------------------
+
+The ``powersave`` algorithm provided by ``intel_pstate`` for `the Core line of
+processors in the active mode <powersave_>`_ is based on a `PID controller`_
+whose parameters were chosen to address a number of different use cases at the
+same time.  However, it still is possible to fine-tune it to a specific workload
+and the ``debugfs`` interface under ``/sys/kernel/debug/pstate_snb/`` is
+provided for this purpose.  [Note that the ``pstate_snb`` directory will be
+present only if the specific P-state selection algorithm matching the interface
+in it actually is in use.]
+
+The following files present in that directory can be used to modify the PID
+controller parameters at run time:
+
+| ``deadband``
+| ``d_gain_pct``
+| ``i_gain_pct``
+| ``p_gain_pct``
+| ``sample_rate_ms``
+| ``setpoint``
+
+Note, however, that achieving desirable results this way generally requires
+expert-level understanding of the power vs performance tradeoff, so extra care
+is recommended when attempting to do that.
+
+
+.. _LCEU2015: http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf
+.. _SDM: http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html
+.. _ACPI specification: http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf
+.. _PID controller: https://en.wikipedia.org/wiki/PID_controller
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt
deleted file mode 100644 (file)
index 3fdcdfd..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-Intel P-State driver
---------------------
-
-This driver provides an interface to control the P-State selection for the
-SandyBridge+ Intel processors.
-
-The following document explains P-States:
-http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf
-As stated in the document, P-State doesn’t exactly mean a frequency. However, for
-the sake of the relationship with cpufreq, P-State and frequency are used
-interchangeably.
-
-Understanding the cpufreq core governors and policies are important before
-discussing more details about the Intel P-State driver. Based on what callbacks
-a cpufreq driver provides to the cpufreq core, it can support two types of
-drivers:
-- with target_index() callback: In this mode, the drivers using cpufreq core
-simply provide the minimum and maximum frequency limits and an additional
-interface target_index() to set the current frequency. The cpufreq subsystem
-has a number of scaling governors ("performance", "powersave", "ondemand",
-etc.). Depending on which governor is in use, cpufreq core will call for
-transitions to a specific frequency using target_index() callback.
-- setpolicy() callback: In this mode, drivers do not provide target_index()
-callback, so cpufreq core can't request a transition to a specific frequency.
-The driver provides minimum and maximum frequency limits and callbacks to set a
-policy. The policy in cpufreq sysfs is referred to as the "scaling governor".
-The cpufreq core can request the driver to operate in any of the two policies:
-"performance" and "powersave". The driver decides which frequency to use based
-on the above policy selection considering minimum and maximum frequency limits.
-
-The Intel P-State driver falls under the latter category, which implements the
-setpolicy() callback. This driver decides what P-State to use based on the
-requested policy from the cpufreq core. If the processor is capable of
-selecting its next P-State internally, then the driver will offload this
-responsibility to the processor (aka HWP: Hardware P-States). If not, the
-driver implements algorithms to select the next P-State.
-
-Since these policies are implemented in the driver, they are not same as the
-cpufreq scaling governors implementation, even if they have the same name in
-the cpufreq sysfs (scaling_governors). For example the "performance" policy is
-similar to cpufreq’s "performance" governor, but "powersave" is completely
-different than the cpufreq "powersave" governor. The strategy here is similar
-to cpufreq "ondemand", where the requested P-State is related to the system load.
-
-Sysfs Interface
-
-In addition to the frequency-controlling interfaces provided by the cpufreq
-core, the driver provides its own sysfs files to control the P-State selection.
-These files have been added to /sys/devices/system/cpu/intel_pstate/.
-Any changes made to these files are applicable to all CPUs (even in a
-multi-package system, Refer to later section on placing "Per-CPU limits").
-
-      max_perf_pct: Limits the maximum P-State that will be requested by
-      the driver. It states it as a percentage of the available performance. The
-      available (P-State) performance may be reduced by the no_turbo
-      setting described below.
-
-      min_perf_pct: Limits the minimum P-State that will be requested by
-      the driver. It states it as a percentage of the max (non-turbo)
-      performance level.
-
-      no_turbo: Limits the driver to selecting P-State below the turbo
-      frequency range.
-
-      turbo_pct: Displays the percentage of the total performance that
-      is supported by hardware that is in the turbo range. This number
-      is independent of whether turbo has been disabled or not.
-
-      num_pstates: Displays the number of P-States that are supported
-      by hardware. This number is independent of whether turbo has
-      been disabled or not.
-
-For example, if a system has these parameters:
-       Max 1 core turbo ratio: 0x21 (Max 1 core ratio is the maximum P-State)
-       Max non turbo ratio: 0x17
-       Minimum ratio : 0x08 (Here the ratio is called max efficiency ratio)
-
-Sysfs will show :
-       max_perf_pct:100, which corresponds to 1 core ratio
-       min_perf_pct:24, max_efficiency_ratio / max 1 Core ratio
-       no_turbo:0, turbo is not disabled
-       num_pstates:26 = (max 1 Core ratio - Max Efficiency Ratio + 1)
-       turbo_pct:39 = (max 1 core ratio - max non turbo ratio) / num_pstates
-
-Refer to "Intel® 64 and IA-32 Architectures Software Developer’s Manual
-Volume 3: System Programming Guide" to understand ratios.
-
-There is one more sysfs attribute in /sys/devices/system/cpu/intel_pstate/
-that can be used for controlling the operation mode of the driver:
-
-      status: Three settings are possible:
-      "off"     - The driver is not in use at this time.
-      "active"  - The driver works as a P-state governor (default).
-      "passive" - The driver works as a regular cpufreq one and collaborates
-                  with the generic cpufreq governors (it sets P-states as
-                  requested by those governors).
-      The current setting is returned by reads from this attribute.  Writing one
-      of the above strings to it changes the operation mode as indicated by that
-      string, if possible.  If HW-managed P-states (HWP) are enabled, it is not
-      possible to change the driver's operation mode and attempts to write to
-      this attribute will fail.
-
-cpufreq sysfs for Intel P-State
-
-Since this driver registers with cpufreq, cpufreq sysfs is also presented.
-There are some important differences, which need to be considered.
-
-scaling_cur_freq: This displays the real frequency which was used during
-the last sample period instead of what is requested. Some other cpufreq driver,
-like acpi-cpufreq, displays what is requested (Some changes are on the
-way to fix this for acpi-cpufreq driver). The same is true for frequencies
-displayed at /proc/cpuinfo.
-
-scaling_governor: This displays current active policy. Since each CPU has a
-cpufreq sysfs, it is possible to set a scaling governor to each CPU. But this
-is not possible with Intel P-States, as there is one common policy for all
-CPUs. Here, the last requested policy will be applicable to all CPUs. It is
-suggested that one use the cpupower utility to change policy to all CPUs at the
-same time.
-
-scaling_setspeed: This attribute can never be used with Intel P-State.
-
-scaling_max_freq/scaling_min_freq: This interface can be used similarly to
-the max_perf_pct/min_perf_pct of Intel P-State sysfs. However since frequencies
-are converted to nearest possible P-State, this is prone to rounding errors.
-This method is not preferred to limit performance.
-
-affected_cpus: Not used
-related_cpus: Not used
-
-For contemporary Intel processors, the frequency is controlled by the
-processor itself and the P-State exposed to software is related to
-performance levels.  The idea that frequency can be set to a single
-frequency is fictional for Intel Core processors. Even if the scaling
-driver selects a single P-State, the actual frequency the processor
-will run at is selected by the processor itself.
-
-Per-CPU limits
-
-The kernel command line option "intel_pstate=per_cpu_perf_limits" forces
-the intel_pstate driver to use per-CPU performance limits.  When it is set,
-the sysfs control interface described above is subject to limitations.
-- The following controls are not available for both read and write
-       /sys/devices/system/cpu/intel_pstate/max_perf_pct
-       /sys/devices/system/cpu/intel_pstate/min_perf_pct
-- The following controls can be used to set performance limits, as far as the
-architecture of the processor permits:
-       /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
-       /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
-       /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
-- User can still observe turbo percent and number of P-States from
-       /sys/devices/system/cpu/intel_pstate/turbo_pct
-       /sys/devices/system/cpu/intel_pstate/num_pstates
-- User can read write system wide turbo status
-       /sys/devices/system/cpu/no_turbo
-
-Support of energy performance hints
-It is possible to provide hints to the HWP algorithms in the processor
-to be more performance centric to more energy centric. When the driver
-is using HWP, two additional cpufreq sysfs attributes are presented for
-each logical CPU.
-These attributes are:
-       - energy_performance_available_preferences
-       - energy_performance_preference
-
-To get list of supported hints:
-$ cat energy_performance_available_preferences
-    default performance balance_performance balance_power power
-
-The current preference can be read or changed via cpufreq sysfs
-attribute "energy_performance_preference". Reading from this attribute
-will display current effective setting. User can write any of the valid
-preference string to this attribute. User can always restore to power-on
-default by writing "default".
-
-Since threads can migrate to different CPUs, this is possible that the
-new CPU may have different energy performance preference than the previous
-one. To avoid such issues, either threads can be pinned to specific CPUs
-or set the same energy performance preference value to all CPUs.
-
-Tuning Intel P-State driver
-
-When the performance can be tuned using PID (Proportional Integral
-Derivative) controller, debugfs files are provided for adjusting performance.
-They are presented under:
-/sys/kernel/debug/pstate_snb/
-
-The PID tunable parameters are:
-      deadband
-      d_gain_pct
-      i_gain_pct
-      p_gain_pct
-      sample_rate_ms
-      setpoint
-
-To adjust these parameters, some understanding of driver implementation is
-necessary. There are some tweeks described here, but be very careful. Adjusting
-them requires expert level understanding of power and performance relationship.
-These limits are only useful when the "powersave" policy is active.
-
--To make the system more responsive to load changes, sample_rate_ms can
-be adjusted  (current default is 10ms).
--To make the system use higher performance, even if the load is lower, setpoint
-can be adjusted to a lower number. This will also lead to faster ramp up time
-to reach the maximum P-State.
-If there are no derivative and integral coefficients, The next P-State will be
-equal to:
-       current P-State - ((setpoint - current cpu load) * p_gain_pct)
-
-For example, if the current PID parameters are (Which are defaults for the core
-processors like SandyBridge):
-      deadband = 0
-      d_gain_pct = 0
-      i_gain_pct = 0
-      p_gain_pct = 20
-      sample_rate_ms = 10
-      setpoint = 97
-
-If the current P-State = 0x08 and current load = 100, this will result in the
-next P-State = 0x08 - ((97 - 100) * 0.2) = 8.6 (rounded to 9). Here the P-State
-goes up by only 1. If during next sample interval the current load doesn't
-change and still 100, then P-State goes up by one again. This process will
-continue as long as the load is more than the setpoint until the maximum P-State
-is reached.
-
-For the same load at setpoint = 60, this will result in the next P-State
-= 0x08 - ((60 - 100) * 0.2) = 16
-So by changing the setpoint from 97 to 60, there is an increase of the
-next P-State from 9 to 16. So this will make processor execute at higher
-P-State for the same CPU load. If the load continues to be more than the
-setpoint during next sample intervals, then P-State will go up again till the
-maximum P-State is reached. But the ramp up time to reach the maximum P-State
-will be much faster when the setpoint is 60 compared to 97.
-
-Debugging Intel P-State driver
-
-Event tracing
-To debug P-State transition, the Linux event tracing interface can be used.
-There are two specific events, which can be enabled (Provided the kernel
-configs related to event tracing are enabled).
-
-# cd /sys/kernel/debug/tracing/
-# echo 1 > events/power/pstate_sample/enable
-# echo 1 > events/power/cpu_frequency/enable
-# cat trace
-gnome-terminal--4510  [001] ..s.  1177.680733: pstate_sample: core_busy=107
-       scaled=94 from=26 to=26 mperf=1143818 aperf=1230607 tsc=29838618
-               freq=2474476
-cat-5235  [002] ..s.  1177.681723: cpu_frequency: state=2900000 cpu_id=2
-
-
-Using ftrace
-
-If function level tracing is required, the Linux ftrace interface can be used.
-For example if we want to check how often a function to set a P-State is
-called, we can set ftrace filter to intel_pstate_set_pstate.
-
-# cd /sys/kernel/debug/tracing/
-# cat available_filter_functions | grep -i pstate
-intel_pstate_set_pstate
-intel_pstate_cpu_init
-...
-
-# echo intel_pstate_set_pstate > set_ftrace_filter
-# echo function > current_tracer
-# cat trace | head -15
-# tracer: function
-#
-# entries-in-buffer/entries-written: 80/80   #P:4
-#
-#                              _-----=> irqs-off
-#                             / _----=> need-resched
-#                            | / _---=> hardirq/softirq
-#                            || / _--=> preempt-depth
-#                            ||| /     delay
-#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
-#              | |       |   ||||       |         |
-            Xorg-3129  [000] ..s.  2537.644844: intel_pstate_set_pstate <-intel_pstate_timer_func
- gnome-terminal--4510  [002] ..s.  2537.649844: intel_pstate_set_pstate <-intel_pstate_timer_func
-     gnome-shell-3409  [001] ..s.  2537.650850: intel_pstate_set_pstate <-intel_pstate_timer_func
-          <idle>-0     [000] ..s.  2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func
index bfd5b558477d95bd1c2fe42d47861d791313872e..5c01e65951fa7bc4506407c4c4d0916120457457 100644 (file)
@@ -29,26 +29,34 @@ Boards with the Amlogic Meson GXM S912 SoC shall have the following properties:
   Required root node property:
     compatible: "amlogic,s912", "amlogic,meson-gxm";
 
-Board compatible values:
+Board compatible values (alphabetically, grouped by SoC):
+
   - "geniatech,atv1200" (Meson6)
+
   - "minix,neo-x8" (Meson8)
-  - "tronfy,mxq" (Meson8b)
+
   - "hardkernel,odroid-c1" (Meson8b)
+  - "tronfy,mxq" (Meson8b)
+
+  - "amlogic,p200" (Meson gxbb)
+  - "amlogic,p201" (Meson gxbb)
+  - "friendlyarm,nanopi-k2" (Meson gxbb)
+  - "hardkernel,odroid-c2" (Meson gxbb)
+  - "nexbox,a95x" (Meson gxbb or Meson gxl s905x)
   - "tronsmart,vega-s95-pro", "tronsmart,vega-s95" (Meson gxbb)
   - "tronsmart,vega-s95-meta", "tronsmart,vega-s95" (Meson gxbb)
   - "tronsmart,vega-s95-telos", "tronsmart,vega-s95" (Meson gxbb)
-  - "hardkernel,odroid-c2" (Meson gxbb)
-  - "amlogic,p200" (Meson gxbb)
-  - "amlogic,p201" (Meson gxbb)
   - "wetek,hub" (Meson gxbb)
   - "wetek,play2" (Meson gxbb)
+
   - "amlogic,p212" (Meson gxl s905x)
+  - "hwacom,amazetv" (Meson gxl s905x)
   - "khadas,vim" (Meson gxl s905x)
 
   - "amlogic,p230" (Meson gxl s905d)
   - "amlogic,p231" (Meson gxl s905d)
-  - "hwacom,amazetv" (Meson gxl s905x)
+
   - "amlogic,q200" (Meson gxm s912)
   - "amlogic,q201" (Meson gxm s912)
-  - "nexbox,a95x" (Meson gxbb or Meson gxl s905x)
+  - "kingnovel,r-box-pro" (Meson gxm S912)
   - "nexbox,a1" (Meson gxm s912)
diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,stingray.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,stingray.txt
new file mode 100644 (file)
index 0000000..23a0217
--- /dev/null
@@ -0,0 +1,12 @@
+Broadcom Stingray device tree bindings
+------------------------------------------------
+
+Boards with Stingray shall have the following properties:
+
+Required root node property:
+
+Stingray Combo SVK board
+compatible = "brcm,bcm958742k", "brcm,stingray";
+
+Stingray SST100 board
+compatible = "brcm,bcm958742t", "brcm,stingray";
index 2e732152064b5ae51ae33f38dd9f90e3c9fc90a1..7111fbc82a4e9bd11acd749262fa52947c6c59c0 100644 (file)
@@ -4,6 +4,10 @@ Hi3660 SoC
 Required root node properties:
        - compatible = "hisilicon,hi3660";
 
+HiKey960 Board
+Required root node properties:
+       - compatible = "hisilicon,hi3660-hikey960", "hisilicon,hi3660";
+
 Hi3798cv200 SoC
 Required root node properties:
        - compatible = "hisilicon,hi3798cv200";
index c860b245d8c812e20bd4076f4a2d1f69c18e8bd8..da7bd138e6f2133bb43107e8b3cb8885f9791cb7 100644 (file)
@@ -12,6 +12,8 @@ compatible: Must contain one of
    "mediatek,mt6592"
    "mediatek,mt6755"
    "mediatek,mt6795"
+   "mediatek,mt6797"
+   "mediatek,mt7622"
    "mediatek,mt7623"
    "mediatek,mt8127"
    "mediatek,mt8135"
@@ -38,6 +40,12 @@ Supported boards:
 - Evaluation board for MT6795(Helio X10):
     Required root node properties:
       - compatible = "mediatek,mt6795-evb", "mediatek,mt6795";
+- Evaluation board for MT6797(Helio X20):
+    Required root node properties:
+      - compatible = "mediatek,mt6797-evb", "mediatek,mt6797";
+- Reference board variant 1 for MT7622:
+    Required root node properties:
+      - compatible = "mediatek,mt7622-rfb1", "mediatek,mt7622";
 - Evaluation board for MT7623:
     Required root node properties:
       - compatible = "mediatek,mt7623-evb", "mediatek,mt7623";
diff --git a/Documentation/devicetree/bindings/arm/realtek.txt b/Documentation/devicetree/bindings/arm/realtek.txt
new file mode 100644 (file)
index 0000000..13d7557
--- /dev/null
@@ -0,0 +1,20 @@
+Realtek platforms device tree bindings
+--------------------------------------
+
+
+RTD1295 SoC
+===========
+
+Required root node properties:
+
+ - compatible :  must contain "realtek,rtd1295"
+
+
+Root node property compatible must contain, depending on board:
+
+ - Zidoo X9S: "zidoo,x9s"
+
+
+Example:
+
+    compatible = "zidoo,x9s", "realtek,rtd1295";
index c965d99e86c2b8413c5b5463d2bbc46966f53005..3c23b5de3324d2cafeb70e10801b6efb77da3dc9 100644 (file)
@@ -42,6 +42,10 @@ Rockchip platforms device tree bindings
     Required root node properties:
       - compatible = "firefly,firefly-rk3288-reload", "rockchip,rk3288";
 
+- Firefly Firefly-RK3399 board:
+    Required root node properties:
+      - compatible = "firefly,firefly-rk3399", "rockchip,rk3399";
+
 - ChipSPARK PopMetal-RK3288 board:
     Required root node properties:
       - compatible = "chipspark,popmetal-rk3288", "rockchip,rk3288";
index fc33ca01e9bae4186e180cd276e46c2679b8d9ec..7c3ca0e13de05716aef7d850896a6ecbe0c74645 100644 (file)
@@ -3,7 +3,7 @@ Binding for Freescale QorIQ AHCI SATA Controller
 Required properties:
   - reg: Physical base address and size of the controller's register area.
   - compatible: Compatibility string. Must be 'fsl,<chip>-ahci', where
-    chip could be ls1021a, ls1043a, ls1046a, ls2080a etc.
+    chip could be ls1021a, ls1043a, ls1046a, ls1088a, ls2080a etc.
   - clocks: Input clock specifier. Refer to common clock bindings.
   - interrupts: Interrupt specifier. Refer to interrupt binding.
 
index 6f66e9aa354c1996beb76e3e9c830dc25b288159..f2c5f0e4a363a5f247ccda48cc45d7a96f74362a 100644 (file)
@@ -219,3 +219,79 @@ BCM63138
 --------
 PLL and leaf clock compatible strings for BCM63138 are:
     "brcm,bcm63138-armpll"
+
+Stingray
+-----------
+PLL and leaf clock compatible strings for Stingray are:
+    "brcm,sr-genpll0"
+    "brcm,sr-genpll1"
+    "brcm,sr-genpll2"
+    "brcm,sr-genpll3"
+    "brcm,sr-genpll4"
+    "brcm,sr-genpll5"
+    "brcm,sr-genpll6"
+
+    "brcm,sr-lcpll0"
+    "brcm,sr-lcpll1"
+    "brcm,sr-lcpll-pcie"
+
+
+The following table defines the set of PLL/clock index and ID for Stingray.
+These clock IDs are defined in:
+    "include/dt-bindings/clock/bcm-sr.h"
+
+    Clock              Source          Index   ID
+    ---                        -----           -----   ---------
+    crystal            N/A             N/A     N/A
+    crmu_ref25m                crystal         N/A     N/A
+
+    genpll0            crystal         0       BCM_SR_GENPLL0
+    clk_125m           genpll0         1       BCM_SR_GENPLL0_125M_CLK
+    clk_scr            genpll0         2       BCM_SR_GENPLL0_SCR_CLK
+    clk_250            genpll0         3       BCM_SR_GENPLL0_250M_CLK
+    clk_pcie_axi       genpll0         4       BCM_SR_GENPLL0_PCIE_AXI_CLK
+    clk_paxc_axi_x2    genpll0         5       BCM_SR_GENPLL0_PAXC_AXI_X2_CLK
+    clk_paxc_axi       genpll0         6       BCM_SR_GENPLL0_PAXC_AXI_CLK
+
+    genpll1            crystal         0       BCM_SR_GENPLL1
+    clk_pcie_tl                genpll1         1       BCM_SR_GENPLL1_PCIE_TL_CLK
+    clk_mhb_apb                genpll1         2       BCM_SR_GENPLL1_MHB_APB_CLK
+
+    genpll2            crystal         0       BCM_SR_GENPLL2
+    clk_nic            genpll2         1       BCM_SR_GENPLL2_NIC_CLK
+    clk_ts_500_ref     genpll2         2       BCM_SR_GENPLL2_TS_500_REF_CLK
+    clk_125_nitro      genpll2         3       BCM_SR_GENPLL2_125_NITRO_CLK
+    clk_chimp          genpll2         4       BCM_SR_GENPLL2_CHIMP_CLK
+    clk_nic_flash      genpll2         5       BCM_SR_GENPLL2_NIC_FLASH
+
+    genpll3            crystal         0       BCM_SR_GENPLL3
+    clk_hsls           genpll3         1       BCM_SR_GENPLL3_HSLS_CLK
+    clk_sdio           genpll3         2       BCM_SR_GENPLL3_SDIO_CLK
+
+    genpll4            crystal         0       BCM_SR_GENPLL4
+    ccn                        genpll4         1       BCM_SR_GENPLL4_CCN_CLK
+    clk_tpiu_pll       genpll4         2       BCM_SR_GENPLL4_TPIU_PLL_CLK
+    noc_clk            genpll4         3       BCM_SR_GENPLL4_NOC_CLK
+    clk_chclk_fs4      genpll4         4       BCM_SR_GENPLL4_CHCLK_FS4_CLK
+    clk_bridge_fscpu   genpll4         5       BCM_SR_GENPLL4_BRIDGE_FSCPU_CLK
+
+
+    genpll5            crystal         0       BCM_SR_GENPLL5
+    fs4_hf_clk         genpll5         1       BCM_SR_GENPLL5_FS4_HF_CLK
+    crypto_ae_clk      genpll5         2       BCM_SR_GENPLL5_CRYPTO_AE_CLK
+    raid_ae_clk                genpll5         3       BCM_SR_GENPLL5_RAID_AE_CLK
+
+    genpll6            crystal         0       BCM_SR_GENPLL6
+    48_usb             genpll6         1       BCM_SR_GENPLL6_48_USB_CLK
+
+    lcpll0             crystal         0       BCM_SR_LCPLL0
+    clk_sata_refp      lcpll0          1       BCM_SR_LCPLL0_SATA_REFP_CLK
+    clk_sata_refn      lcpll0          2       BCM_SR_LCPLL0_SATA_REFN_CLK
+    clk_usb_ref                lcpll0          3       BCM_SR_LCPLL0_USB_REF_CLK
+    sata_refpn         lcpll0          3       BCM_SR_LCPLL0_SATA_REFPN_CLK
+
+    lcpll1             crystal         0       BCM_SR_LCPLL1
+    wan                lcpll1          1       BCM_SR_LCPLL0_WAN_CLK
+
+    lcpll_pcie         crystal         0       BCM_SR_LCPLL_PCIE
+    pcie_phy_ref       lcpll1          1       BCM_SR_LCPLL_PCIE_PHY_REF_CLK
similarity index 77%
rename from Documentation/devicetree/bindings/i2c/i2c-mt6577.txt
rename to Documentation/devicetree/bindings/i2c/i2c-mtk.txt
index 0ce6fa3242f08bece96f880000671453227aa3f8..bd5a7befd951f38314320e7c801b946dfdf7f3c7 100644 (file)
@@ -4,11 +4,11 @@ The Mediatek's I2C controller is used to interface with I2C devices.
 
 Required properties:
   - compatible: value should be either of the following.
-      (a) "mediatek,mt6577-i2c", for i2c compatible with mt6577 i2c.
-      (b) "mediatek,mt6589-i2c", for i2c compatible with mt6589 i2c.
-      (c) "mediatek,mt8127-i2c", for i2c compatible with mt8127 i2c.
-      (d) "mediatek,mt8135-i2c", for i2c compatible with mt8135 i2c.
-      (e) "mediatek,mt8173-i2c", for i2c compatible with mt8173 i2c.
+      "mediatek,mt2701-i2c", "mediatek,mt6577-i2c": for Mediatek mt2701
+      "mediatek,mt6577-i2c": for i2c compatible with mt6577.
+      "mediatek,mt6589-i2c": for i2c compatible with mt6589.
+      "mediatek,mt7623-i2c", "mediatek,mt6577-i2c": for i2c compatible with mt7623.
+      "mediatek,mt8173-i2c": for i2c compatible with mt8173.
   - reg: physical base address of the controller and dma base, length of memory
     mapped region.
   - interrupts: interrupt number to the cpu.
index 6db22103e2dd535952143a2bae9ba4c6790c6e56..025cf8c9324ac362eeee56b5d4f9df09db466180 100644 (file)
@@ -36,7 +36,7 @@ Optional properties:
                 control gpios
 
  - threshold:   allows setting the "click"-threshold in the range
-                from 20 to 80.
+                from 0 to 80.
 
  - gain:        allows setting the sensitivity in the range from 0 to
                 31. Note that lower values indicate higher
index a89c03bb1a81549c6029e8b4e7aeb48e3d726a4a..11cc87aeb276f0a25b869ba53ed2b6b9213888d8 100644 (file)
@@ -1,21 +1,23 @@
-+Mediatek 65xx/67xx/81xx sysirq
++Mediatek MT65xx/MT67xx/MT81xx sysirq
 
 Mediatek SOCs sysirq support controllable irq inverter for each GIC SPI
 interrupt.
 
 Required properties:
-- compatible: should be one of:
-       "mediatek,mt8173-sysirq"
-       "mediatek,mt8135-sysirq"
-       "mediatek,mt8127-sysirq"
-       "mediatek,mt6795-sysirq"
-       "mediatek,mt6755-sysirq"
-       "mediatek,mt6592-sysirq"
-       "mediatek,mt6589-sysirq"
-       "mediatek,mt6582-sysirq"
-       "mediatek,mt6580-sysirq"
-       "mediatek,mt6577-sysirq"
-       "mediatek,mt2701-sysirq"
+- compatible: should be
+       "mediatek,mt8173-sysirq", "mediatek,mt6577-sysirq": for MT8173
+       "mediatek,mt8135-sysirq", "mediatek,mt6577-sysirq": for MT8135
+       "mediatek,mt8127-sysirq", "mediatek,mt6577-sysirq": for MT8127
+       "mediatek,mt7622-sysirq", "mediatek,mt6577-sysirq": for MT7622
+       "mediatek,mt6795-sysirq", "mediatek,mt6577-sysirq": for MT6795
+       "mediatek,mt6797-sysirq", "mediatek,mt6577-sysirq": for MT6797
+       "mediatek,mt6755-sysirq", "mediatek,mt6577-sysirq": for MT6755
+       "mediatek,mt6592-sysirq", "mediatek,mt6577-sysirq": for MT6592
+       "mediatek,mt6589-sysirq", "mediatek,mt6577-sysirq": for MT6589
+       "mediatek,mt6582-sysirq", "mediatek,mt6577-sysirq": for MT6582
+       "mediatek,mt6580-sysirq", "mediatek,mt6577-sysirq": for MT6580
+       "mediatek,mt6577-sysirq": for MT6577
+       "mediatek,mt2701-sysirq", "mediatek,mt6577-sysirq": for MT2701
 - interrupt-controller : Identifies the node as an interrupt controller
 - #interrupt-cells : Use the same format as specified by GIC in arm,gic.txt.
 - interrupt-parent: phandle of irq parent for sysirq. The parent must
index 0d5a4466a494f6d473d9d7d85d077acf1e257e1d..22da96d344a7bc9b082942cd8e423616392bf4a5 100644 (file)
@@ -1,7 +1,9 @@
 * HI6421 Multi-Functional Device (MFD), by HiSilicon Ltd.
 
 Required parent device properties:
-- compatible   : contains "hisilicon,hi6421-pmic";
+- compatible    : One of the following chip-specific strings:
+       "hisilicon,hi6421-pmic";
+       "hisilicon,hi6421v530-pmic";
 - reg          : register range space of hi6421;
 
 Supported Hi6421 sub-devices include:
index 05485699d70e7c85cb25eb83f39b86f5be0daaca..9630ac0e4b56ef372f08a0850175be06d13cd9a7 100644 (file)
@@ -16,6 +16,11 @@ Required properties:
 - reg:                  Base address of PMIC on Hi6220 SoC.
 - interrupt-controller: Hi655x has internal IRQs (has own IRQ domain).
 - pmic-gpios:           The GPIO used by PMIC IRQ.
+- #clock-cells:                From common clock binding; shall be set to 0
+
+Optional properties:
+- clock-output-names: From common clock binding to override the
+  default output clock name
 
 Example:
        pmic: pmic@f8000000 {
@@ -24,4 +29,5 @@ Example:
                interrupt-controller;
                #interrupt-cells = <2>;
                pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+               #clock-cells = <0>;
        }
index dedfb02c744a9b03277cbe42e95237eb3c38b24b..a2cf5e1c87d894500cc2d453b254e92a2c6070c2 100644 (file)
@@ -7,6 +7,20 @@ This file documents differences between the core properties described
 by mmc.txt and the properties used by the sdhci-esdhc driver.
 
 Required properties:
+  - compatible : should be "fsl,esdhc", or "fsl,<chip>-esdhc".
+    Possible compatibles for PowerPC:
+       "fsl,mpc8536-esdhc"
+       "fsl,mpc8378-esdhc"
+       "fsl,p2020-esdhc"
+       "fsl,p4080-esdhc"
+       "fsl,t1040-esdhc"
+       "fsl,t4240-esdhc"
+    Possible compatibles for ARM:
+       "fsl,ls1012a-esdhc"
+       "fsl,ls1088a-esdhc"
+       "fsl,ls1043a-esdhc"
+       "fsl,ls1046a-esdhc"
+       "fsl,ls2080a-esdhc"
   - interrupt-parent : interrupt source phandle.
   - clock-frequency : specifies eSDHC base clock frequency.
 
index df370585cbccedc5454f547b50e2e3b1512351ca..8af1afcb86dcf8c375aec37e99103ad73ddf2551 100644 (file)
@@ -12,6 +12,7 @@ extensions to the Synopsys Designware Mobile Storage Host Controller.
 Required Properties:
 
 * compatible: should be one of the following.
+  - "hisilicon,hi3660-dw-mshc": for controllers with hi3660 specific extensions.
   - "hisilicon,hi4511-dw-mshc": for controllers with hi4511 specific extensions.
   - "hisilicon,hi6220-dw-mshc": for controllers with hi6220 specific extensions.
 
index e25436861867f28f75a2450ecbf28d1fd2df3921..9029b45b8a22a8d5b6a1afa3184bf389a85202f4 100644 (file)
@@ -18,6 +18,8 @@ Optional properties:
   "ext_clock" (External clock provided to the card).
 - post-power-on-delay-ms : Delay in ms after powering the card and
        de-asserting the reset-gpios (if any)
+- power-off-delay-us : Delay in us after asserting the reset-gpios (if any)
+       during power off of the card.
 
 Example:
 
index a1e3693cca1601e47096dc2edc2a9580b8b0569a..6f55bdd52f8a99be3c0741cf6411a00554c85778 100644 (file)
@@ -15,6 +15,10 @@ Optional properties:
 - phy-reset-active-high : If present then the reset sequence using the GPIO
   specified in the "phy-reset-gpios" property is reversed (H=reset state,
   L=operation state).
+- phy-reset-post-delay : Post reset delay in milliseconds. If present then
+  a delay of phy-reset-post-delay milliseconds will be observed after the
+  phy-reset-gpios has been toggled. Can be omitted thus no delay is
+  observed. Delay is in range of 1ms to 1000ms. Other delays are invalid.
 - phy-supply : regulator that powers the Ethernet PHY.
 - phy-handle : phandle to the PHY device connected to this device.
 - fixed-link : Assume a fixed link. See fixed-link.txt in the same directory.
diff --git a/Documentation/devicetree/bindings/pci/kirin-pcie.txt b/Documentation/devicetree/bindings/pci/kirin-pcie.txt
new file mode 100644 (file)
index 0000000..68ffa0f
--- /dev/null
@@ -0,0 +1,50 @@
+HiSilicon Kirin SoCs PCIe host DT description
+
+Kirin PCIe host controller is based on Designware PCI core.
+It shares common functions with PCIe Designware core driver
+and inherits common properties defined in
+Documentation/devicetree/bindings/pci/designware-pci.txt.
+
+Additional properties are described here:
+
+Required properties
+- compatible:
+       "hisilicon,kirin960-pcie" for PCIe of Kirin960 SoC
+- reg: Should contain rc_dbi, apb, phy, config registers location and length.
+- reg-names: Must include the following entries:
+  "dbi": controller configuration registers;
+  "apb": apb Ctrl register defined by Kirin;
+  "phy": apb PHY register defined by Kirin;
+  "config": PCIe configuration space registers.
+- reset-gpios: The gpio to generate PCIe perst assert and deassert signal.
+
+Optional properties:
+
+Example based on kirin960:
+
+       pcie@f4000000 {
+               compatible = "hisilicon,kirin-pcie";
+               reg = <0x0 0xf4000000 0x0 0x1000>, <0x0 0xff3fe000 0x0 0x1000>,
+                     <0x0 0xf3f20000 0x0 0x40000>, <0x0 0xF4000000 0 0x2000>;
+               reg-names = "dbi","apb","phy", "config";
+               bus-range = <0x0  0x1>;
+               #address-cells = <3>;
+               #size-cells = <2>;
+               device_type = "pci";
+               ranges = <0x02000000 0x0 0x00000000 0x0 0xf5000000 0x0 0x2000000>;
+               num-lanes = <1>;
+               #interrupt-cells = <1>;
+               interrupt-map-mask = <0xf800 0 0 7>;
+               interrupt-map = <0x0 0 0 1 &gic 0 0 0  282 4>,
+                               <0x0 0 0 2 &gic 0 0 0  283 4>,
+                               <0x0 0 0 3 &gic 0 0 0  284 4>,
+                               <0x0 0 0 4 &gic 0 0 0  285 4>;
+               clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+                        <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+                        <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+                        <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+                        <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+               clock-names = "pcie_phy_ref", "pcie_aux",
+                             "pcie_apb_phy", "pcie_apb_sys", "pcie_aclk";
+               reset-gpios = <&gpio11 1 0 >;
+       };
index 0015c722be7b1ef53c35b11daa5fa1a0cf703ea7..b6cf384597e1dabc5f5e090982235f0e0c56128a 100644 (file)
@@ -8,6 +8,8 @@ Required properties:
   * "mediatek,mt6589-uart" for MT6589 compatible UARTS
   * "mediatek,mt6755-uart" for MT6755 compatible UARTS
   * "mediatek,mt6795-uart" for MT6795 compatible UARTS
+  * "mediatek,mt6797-uart" for MT6797 compatible UARTS
+  * "mediatek,mt7622-uart" for MT7622 compatible UARTS
   * "mediatek,mt7623-uart" for MT7623 compatible UARTS
   * "mediatek,mt8127-uart" for MT8127 compatible UARTS
   * "mediatek,mt8135-uart" for MT8135 compatible UARTS
index 16fe94d7783c965e64288870b9391591af68bf7c..b1d165b4d4b31104e4c137c18ad8079ff66943e9 100644 (file)
@@ -9,11 +9,14 @@ domain control.
 
 The driver implements the Generic PM domain bindings described in
 power/power_domain.txt. It provides the power domains defined in
-include/dt-bindings/power/mt8173-power.h and mt2701-power.h.
+- include/dt-bindings/power/mt8173-power.h
+- include/dt-bindings/power/mt6797-power.h
+- include/dt-bindings/power/mt2701-power.h
 
 Required properties:
 - compatible: Should be one of:
        - "mediatek,mt2701-scpsys"
+       - "mediatek,mt6797-scpsys"
        - "mediatek,mt8173-scpsys"
 - #power-domain-cells: Must be 1
 - reg: Address range of the SCPSYS unit
@@ -22,6 +25,7 @@ Required properties:
                       These are clocks which hardware needs to be
                       enabled before enabling certain power domains.
        Required clocks for MT2701: "mm", "mfg", "ethif"
+       Required clocks for MT6797: "mm", "mfg", "vdec"
        Required clocks for MT8173: "mm", "mfg", "venc", "venc_lt"
 
 Optional properties:
index c03d201403661926164f1f9ba45ecd381a77b544..b10fe16cdaa1dbdfd3af6f81cb79dc7f907b189b 100644 (file)
@@ -165,6 +165,7 @@ keithkoep   Keith & Koep GmbH
 keymile        Keymile GmbH
 khadas Khadas
 kinetic Kinetic Technologies
+kingnovel      Kingnovel Technology Co., Ltd.
 kosagi Sutajio Ko-Usagi PTE Ltd.
 kyo    Kyocera Corporation
 lacie  LaCie
@@ -356,6 +357,7 @@ xlnx        Xilinx
 xunlong        Shenzhen Xunlong Software CO.,Limited
 zarlink        Zarlink Semiconductor
 zeitec ZEITEC Semiconductor Co., LTD.
+zidoo  Shenzhen Zidoo Technology Co., Ltd.
 zii    Zodiac Inflight Innovations
 zte    ZTE Corp.
 zyxel  ZyXEL Communications Corp.
index 2032f0b7a8fa125dc3c88842dbeccb25a41a3453..1ccc94b192b7edacd8a42ff81de923b4a35a27e7 100644 (file)
@@ -15,7 +15,7 @@ It has been tested with the following devices:
 The driver allows configuration of the touch screen via a set of sysfs files:
 
 /sys/class/input/eventX/device/device/threshold:
-    allows setting the "click"-threshold in the range from 20 to 80.
+    allows setting the "click"-threshold in the range from 0 to 80.
 
 /sys/class/input/eventX/device/device/gain:
     allows setting the sensitivity in the range from 0 to 31. Note that
index 5338673c88d950e21dbed11f7f030544eeb7fa2e..773d2bfacc6cc6b8e714fd89c249296d647d3f1f 100644 (file)
@@ -16,6 +16,8 @@ ALC880
     6-jack in back, 2-jack in front
 6stack-digout
     6-jack with a SPDIF out
+6stack-automute
+    6-jack with headphone jack detection
 
 ALC260
 ======
@@ -62,6 +64,8 @@ lenovo-dock
     Enables docking station I/O for some Lenovos
 hp-gpio-led
     GPIO LED support on HP laptops
+hp-dock-gpio-mic1-led
+    HP dock with mic LED support
 dell-headset-multi
     Headset jack, which can also be used as mic-in
 dell-headset-dock
@@ -72,6 +76,12 @@ alc283-sense-combo
     Combo jack sensing on ALC283
 tpt440-dock
     Pin configs for Lenovo Thinkpad Dock support
+tpt440
+    Lenovo Thinkpad T440s setup
+tpt460
+    Lenovo Thinkpad T460/560 setup
+dual-codecs
+    Lenovo laptops with dual codecs
 
 ALC66x/67x/892
 ==============
@@ -97,6 +107,8 @@ inv-dmic
     Inverted internal mic workaround
 dell-headset-multi
     Headset jack, which can also be used as mic-in
+dual-codecs
+    Lenovo laptops with dual codecs
 
 ALC680
 ======
@@ -114,6 +126,8 @@ inv-dmic
     Inverted internal mic workaround
 no-primary-hp
     VAIO Z/VGC-LN51JGB workaround (for fixed speaker DAC)
+dual-codecs
+    ALC1220 dual codecs for Gaming mobos
 
 ALC861/660
 ==========
@@ -206,65 +220,47 @@ auto
 
 Conexant 5045
 =============
-laptop-hpsense
-    Laptop with HP sense (old model laptop)
-laptop-micsense
-    Laptop with Mic sense (old model fujitsu)
-laptop-hpmicsense
-    Laptop with HP and Mic senses
-benq
-    Benq R55E
-laptop-hp530
-    HP 530 laptop
-test
-    for testing/debugging purpose, almost all controls can be
-    adjusted.  Appearing only when compiled with $CONFIG_SND_DEBUG=y
+cap-mix-amp
+    Fix max input level on mixer widget
+toshiba-p105
+    Toshiba P105 quirk
+hp-530
+    HP 530 quirk
 
 Conexant 5047
 =============
-laptop
-    Basic Laptop config 
-laptop-hp
-    Laptop config for some HP models (subdevice 30A5)
-laptop-eapd
-    Laptop config with EAPD support
-test
-    for testing/debugging purpose, almost all controls can be
-    adjusted.  Appearing only when compiled with $CONFIG_SND_DEBUG=y
+cap-mix-amp
+    Fix max input level on mixer widget
 
 Conexant 5051
 =============
-laptop
-    Basic Laptop config (default)
-hp
-    HP Spartan laptop
-hp-dv6736
-    HP dv6736
-hp-f700
-    HP Compaq Presario F700
-ideapad
-    Lenovo IdeaPad laptop
-toshiba
-    Toshiba Satellite M300
+lenovo-x200
+    Lenovo X200 quirk
 
 Conexant 5066
 =============
-laptop
-    Basic Laptop config (default)
-hp-laptop
-    HP laptops, e g G60
-asus
-    Asus K52JU, Lenovo G560
-dell-laptop
-    Dell laptops
-dell-vostro
-    Dell Vostro
-olpc-xo-1_5
-    OLPC XO 1.5
-ideapad
-    Lenovo IdeaPad U150
+stereo-dmic
+    Workaround for inverted stereo digital mic
+gpio1
+    Enable GPIO1 pin
+headphone-mic-pin
+    Enable headphone mic NID 0x18 without detection
+tp410
+    Thinkpad T400 & co quirks
 thinkpad
-    Lenovo Thinkpad
+    Thinkpad mute/mic LED quirk
+lemote-a1004
+    Lemote A1004 quirk
+lemote-a1205
+    Lemote A1205 quirk
+olpc-xo
+    OLPC XO quirk
+mute-led-eapd
+    Mute LED control via EAPD
+hp-dock
+    HP dock support
+mute-led-gpio
+    Mute LED control via GPIO
 
 STAC9200
 ========
@@ -444,6 +440,8 @@ dell-eq
     Dell desktops/laptops
 alienware
     Alienware M17x
+asus-mobo
+    Pin configs for ASUS mobo with 5.1/SPDIF out
 auto
     BIOS setup (default)
 
@@ -477,6 +475,8 @@ hp-envy-ts-bass
     Pin fixup for HP Envy TS bass speaker (NID 0x10)
 hp-bnb13-eq
     Hardware equalizer setup for HP laptops
+hp-envy-ts-bass
+    HP Envy TS bass support
 auto
     BIOS setup (default)
 
@@ -496,10 +496,22 @@ auto
 
 Cirrus Logic CS4206/4207
 ========================
+mbp53
+    MacBook Pro 5,3
 mbp55
     MacBook Pro 5,5
 imac27
     IMac 27 Inch
+imac27_122
+    iMac 12,2
+apple
+    Generic Apple quirk
+mbp101
+    MacBookPro 10,1
+mbp81
+    MacBookPro 8,1
+mba42
+    MacBookAir 4,2
 auto
     BIOS setup (default)
 
@@ -509,6 +521,10 @@ mba6
     MacBook Air 6,1 and 6,2
 gpio0
     Enable GPIO 0 amp
+mbp11
+    MacBookPro 11,2
+macmini
+    MacMini 7,1
 auto
     BIOS setup (default)
 
index 9e984645c4b08b9e20ebc839704a5d25b0c32032..053c3bdd1fe51c1e48983cfa2e3b4b00349035f2 100644 (file)
@@ -7143,7 +7143,7 @@ S:        Maintained
 F:     drivers/media/platform/rcar_jpu.c
 
 JSM Neo PCI based serial card
-M:     Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
+M:     Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
 L:     linux-serial@vger.kernel.org
 S:     Maintained
 F:     drivers/tty/serial/jsm/
index 63e10bd4f14ac25297b3841eec5b2be6ee03035b..470bd4d9513ac42eb164cb4513300966a726fa37 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 4
 PATCHLEVEL = 12
 SUBLEVEL = 0
-EXTRAVERSION = -rc2
+EXTRAVERSION = -rc3
 NAME = Fearless Coyote
 
 # *DOCUMENTATION*
index 9c5e1d944d1c714f0fcd49cfd1614e7957f0bd52..a3db77b7d3d19f8de8c66cc13b12ef5d47827095 100644 (file)
@@ -72,6 +72,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
        bcm2835-rpi-b-plus.dtb \
        bcm2835-rpi-a-plus.dtb \
        bcm2836-rpi-2-b.dtb \
+       bcm2837-rpi-3-b.dtb \
        bcm2835-rpi-zero.dtb
 dtb-$(CONFIG_ARCH_BCM_5301X) += \
        bcm4708-asus-rt-ac56u.dtb \
index a7b5ce133784f12bee9ff2199d9e85c757fd4e17..e55b362b9d6e92124a22d6e5718adf1f63be3818 100644 (file)
 &sdhci {
        pinctrl-names = "default";
        pinctrl-0 = <&emmc_gpio48>;
-       status = "okay";
        bus-width = <4>;
 };
 
 &sdhost {
        pinctrl-names = "default";
        pinctrl-0 = <&sdhost_gpio48>;
+       status = "okay";
        bus-width = <4>;
 };
 
index 0890d97e674d4b0ee542822a39b1000ba0715414..659b6e9513b1d28fdd28171fd7973dc3cc968e3f 100644 (file)
        };
 };
 
+&cpu_thermal {
+       coefficients = <(-538)  407000>;
+};
+
 /* enable thermal sensor with the correct compatible property set */
 &thermal {
        compatible = "brcm,bcm2835-thermal";
index 519a44f5d25a6aa49eaeb0d50e5361276e5ca995..da3deeb42592926f36b49770b50b549abcb6ece7 100644 (file)
        interrupts = <8>;
 };
 
+&cpu_thermal {
+       coefficients = <(-538)  407000>;
+};
+
 /* enable thermal sensor with the correct compatible property set */
 &thermal {
        compatible = "brcm,bcm2836-thermal";
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
new file mode 100644 (file)
index 0000000..c72a27d
--- /dev/null
@@ -0,0 +1 @@
+#include "arm64/broadcom/bcm2837-rpi-3-b.dts"
index 561f27d8d92224fe8f4f8c3224a5441f2d41175a..86a5db53da8fcbff5199de8b8c48cabef237425b 100644 (file)
                bootargs = "earlyprintk console=ttyAMA0";
        };
 
+       thermal-zones {
+               cpu_thermal: cpu-thermal {
+                       polling-delay-passive = <0>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&thermal>;
+
+                       trips {
+                               cpu-crit {
+                                       temperature     = <80000>;
+                                       hysteresis      = <0>;
+                                       type            = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                       };
+               };
+       };
+
        soc {
                compatible = "simple-bus";
                #address-cells = <1>;
                        compatible = "brcm,bcm2835-thermal";
                        reg = <0x7e212000 0x8>;
                        clocks = <&clocks BCM2835_CLOCK_TSENS>;
+                       #thermal-sensor-cells = <0>;
                        status = "disabled";
                };
 
index 1aeeacb3a8849b63b9c21796612f9a870084ce34..1fc663bdfdda7ec6b1ffb4c39aed083421591709 100644 (file)
  */
 
 #include <dt-bindings/clock/sun8i-h3-ccu.h>
+#include <dt-bindings/clock/sun8i-r-ccu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/reset/sun8i-h3-ccu.h>
+#include <dt-bindings/reset/sun8i-r-ccu.h>
 
 / {
        interrupt-parent = <&gic>;
                #size-cells = <1>;
                ranges;
 
+               syscon: syscon@1c00000 {
+                       compatible = "allwinner,sun8i-h3-system-controller",
+                               "syscon";
+                       reg = <0x01c00000 0x1000>;
+               };
+
                dma: dma-controller@01c02000 {
                        compatible = "allwinner,sun8i-h3-dma";
                        reg = <0x01c02000 0x1000>;
                        interrupt-controller;
                        #interrupt-cells = <3>;
 
+                       emac_rgmii_pins: emac0 {
+                               pins = "PD0", "PD1", "PD2", "PD3", "PD4",
+                                      "PD5", "PD7", "PD8", "PD9", "PD10",
+                                      "PD12", "PD13", "PD15", "PD16", "PD17";
+                               function = "emac";
+                               drive-strength = <40>;
+                       };
+
                        i2c0_pins: i2c0 {
                                pins = "PA11", "PA12";
                                function = "i2c0";
                        clocks = <&osc24M>;
                };
 
+               emac: ethernet@1c30000 {
+                       compatible = "allwinner,sun8i-h3-emac";
+                       syscon = <&syscon>;
+                       reg = <0x01c30000 0x104>;
+                       interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "macirq";
+                       resets = <&ccu RST_BUS_EMAC>;
+                       reset-names = "stmmaceth";
+                       clocks = <&ccu CLK_BUS_EMAC>;
+                       clock-names = "stmmaceth";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+
+                       mdio: mdio {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               int_mii_phy: ethernet-phy@1 {
+                                       compatible = "ethernet-phy-ieee802.3-c22";
+                                       reg = <1>;
+                                       clocks = <&ccu CLK_BUS_EPHY>;
+                                       resets = <&ccu RST_BUS_EPHY>;
+                               };
+                       };
+               };
+
                spi0: spi@01c68000 {
                        compatible = "allwinner,sun8i-h3-spi";
                        reg = <0x01c68000 0x1000>;
 
                ir: ir@01f02000 {
                        compatible = "allwinner,sun5i-a13-ir";
-                       clocks = <&r_ccu 4>, <&r_ccu 11>;
+                       clocks = <&r_ccu CLK_APB0_IR>, <&r_ccu CLK_IR>;
                        clock-names = "apb", "ir";
-                       resets = <&r_ccu 0>;
+                       resets = <&r_ccu RST_APB0_IR>;
                        interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
                        reg = <0x01f02000 0x40>;
                        status = "disabled";
                        compatible = "allwinner,sun8i-h3-r-pinctrl";
                        reg = <0x01f02c00 0x400>;
                        interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&r_ccu 3>, <&osc24M>, <&osc32k>;
+                       clocks = <&r_ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>;
                        clock-names = "apb", "hosc", "losc";
                        gpio-controller;
                        #gpio-cells = <3>;
index 080232b0270eafb817cafb52c0273d3e0eaca369..78f7991a5906fb4a05770ece93dda23ac738408f 100644 (file)
@@ -14,6 +14,7 @@ dts-dirs += marvell
 dts-dirs += mediatek
 dts-dirs += nvidia
 dts-dirs += qcom
+dts-dirs += realtek
 dts-dirs += renesas
 dts-dirs += rockchip
 dts-dirs += socionext
index 244e8b7565f9b5ab2ff4a5aac0c317e578728b3b..108f12ce6d1d0706900d46533b9dd3cb33bb368f 100644 (file)
@@ -1,6 +1,11 @@
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-bananapi-m64.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-orangepi-win.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-plus.dtb sun50i-a64-pine64.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-sopine-baseboard.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo2.dtb
 
 always         := $(dtb-y)
 subdir-y       := $(dts-dirs)
index 6872135d7f849b1df7e0529b9b95d2b0d9c86478..0d1f026d831aac7b7ecda69ac5ec0f57e693ec2b 100644 (file)
        };
 };
 
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       phy-mode = "rgmii";
+       phy-handle = <&ext_rgmii_phy>;
+       status = "okay";
+};
+
 &i2c1 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c1_pins>;
        bias-pull-up;
 };
 
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
 &mmc0 {
        pinctrl-names = "default";
        pinctrl-0 = <&mmc0_pins>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
new file mode 100644 (file)
index 0000000..5f8ff40
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "OrangePi Win/Win Plus";
+       compatible = "xunlong,orangepi-win", "allwinner,sun50i-a64";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
+
index 790d14daaa6a68f2b6ebe40594c5e78baea3f52a..24f1aac366d64355f5b6b37bb8e263bcce7f2e2d 100644 (file)
        model = "Pine64+";
        compatible = "pine64,pine64-plus", "allwinner,sun50i-a64";
 
-       /* TODO: Camera, Ethernet PHY, touchscreen, etc. */
+       /* TODO: Camera, touchscreen, etc. */
+};
+
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       phy-mode = "rgmii";
+       phy-handle = <&ext_rgmii_phy>;
+       status = "okay";
+};
+
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
 };
index c680ed385da3565da0291e325b5429fcb1e3eeec..08cda24ea194cbffd08fc8de50dc7a4d525e5019 100644 (file)
 
        aliases {
                serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
        };
 
        chosen {
        };
 };
 
+&ehci0 {
+       status = "okay";
+};
+
 &ehci1 {
        status = "okay";
 };
 
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rmii_pins>;
+       phy-mode = "rmii";
+       phy-handle = <&ext_rmii_phy1>;
+       status = "okay";
+
+};
+
 &i2c1 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c1_pins>;
        bias-pull-up;
 };
 
+&mdio {
+       ext_rmii_phy1: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
 &mmc0 {
        pinctrl-names = "default";
        pinctrl-0 = <&mmc0_pins>;
        status = "okay";
 };
 
+&ohci0 {
+       status = "okay";
+};
+
 &ohci1 {
        status = "okay";
 };
 
+/* On Exp and Euler connectors */
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pins_a>;
        status = "okay";
 };
 
+/* On Wifi/BT connector, with RTS/CTS */
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+       status = "disabled";
+};
+
+/* On Pi-2 connector */
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2_pins>;
+       status = "disabled";
+};
+
+/* On Euler connector */
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart3_pins>;
+       status = "disabled";
+};
+
+/* On Euler connector, RTS/CTS optional */
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart4_pins>;
+       status = "disabled";
+};
+
 &usb_otg {
        dr_mode = "host";
        status = "okay";
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
new file mode 100644 (file)
index 0000000..17eb1cc
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * Based on sun50i-a64-pine64.dts, which is:
+ *   Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64-sopine.dtsi"
+
+/ {
+       model = "SoPine with baseboard";
+       compatible = "pine64,sopine-baseboard", "pine64,sopine",
+                    "allwinner,sun50i-a64";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       reg_vcc1v8: vcc1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc1v8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       phy-mode = "rgmii";
+       phy-handle = <&ext_rgmii_phy>;
+       status = "okay";
+};
+
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
+&mmc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc2_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       vqmmc-supply = <&reg_vcc1v8>;
+       bus-width = <8>;
+       non-removable;
+       cap-mmc-hw-reset;
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usb_otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
new file mode 100644 (file)
index 0000000..475518b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * Based on sun50i-a64-pine64.dts, which is:
+ *   Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun50i-a64.dtsi"
+
+/ {
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       non-removable;
+       disable-wp;
+       bus-width = <4>;
+       status = "okay";
+};
index c7f669f5884f910c6e4be44ac1dd09a216cb97f0..06127f9ab61f88f0df06b3aefea9787e6a6d60a7 100644 (file)
@@ -43,6 +43,7 @@
  */
 
 #include <dt-bindings/clock/sun50i-a64-ccu.h>
+#include <dt-bindings/clock/sun8i-r-ccu.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/reset/sun50i-a64-ccu.h>
 
                #size-cells = <1>;
                ranges;
 
+               syscon: syscon@1c00000 {
+                       compatible = "allwinner,sun50i-a64-system-controller",
+                               "syscon";
+                       reg = <0x01c00000 0x1000>;
+               };
+
                mmc0: mmc@1c0f000 {
                        compatible = "allwinner,sun50i-a64-mmc";
                        reg = <0x01c0f000 0x1000>;
                        #phy-cells = <1>;
                };
 
+               ehci0: usb@01c1a000 {
+                       compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
+                       reg = <0x01c1a000 0x100>;
+                       interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_OHCI0>,
+                                <&ccu CLK_BUS_EHCI0>,
+                                <&ccu CLK_USB_OHCI0>;
+                       resets = <&ccu RST_BUS_OHCI0>,
+                                <&ccu RST_BUS_EHCI0>;
+                       status = "disabled";
+               };
+
+               ohci0: usb@01c1a400 {
+                       compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
+                       reg = <0x01c1a400 0x100>;
+                       interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_OHCI0>,
+                                <&ccu CLK_USB_OHCI0>;
+                       resets = <&ccu RST_BUS_OHCI0>;
+                       status = "disabled";
+               };
+
                ehci1: usb@01c1b000 {
                        compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
                        reg = <0x01c1b000 0x100>;
                                bias-pull-up;
                        };
 
+                       rmii_pins: rmii_pins {
+                               pins = "PD10", "PD11", "PD13", "PD14", "PD17",
+                                      "PD18", "PD19", "PD20", "PD22", "PD23";
+                               function = "emac";
+                               drive-strength = <40>;
+                       };
+
+                       rgmii_pins: rgmii_pins {
+                               pins = "PD8", "PD9", "PD10", "PD11", "PD12",
+                                      "PD13", "PD15", "PD16", "PD17", "PD18",
+                                      "PD19", "PD20", "PD21", "PD22", "PD23";
+                               function = "emac";
+                               drive-strength = <40>;
+                       };
+
                        uart0_pins_a: uart0@0 {
                                pins = "PB8", "PB9";
                                function = "uart0";
                                pins = "PG8", "PG9";
                                function = "uart1";
                        };
+
+                       uart2_pins: uart2-pins {
+                               pins = "PB0", "PB1";
+                               function = "uart2";
+                       };
+
+                       uart3_pins: uart3-pins {
+                               pins = "PD0", "PD1";
+                               function = "uart3";
+                       };
+
+                       uart4_pins: uart4-pins {
+                               pins = "PD2", "PD3";
+                               function = "uart4";
+                       };
+
+                       uart4_rts_cts_pins: uart4-rts-cts-pins {
+                               pins = "PD4", "PD5";
+                               function = "uart4";
+                       };
                };
 
                uart0: serial@1c28000 {
                        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&ccu 67>;
-                       resets = <&ccu 46>;
+                       clocks = <&ccu CLK_BUS_UART0>;
+                       resets = <&ccu RST_BUS_UART0>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&ccu 68>;
-                       resets = <&ccu 47>;
+                       clocks = <&ccu CLK_BUS_UART1>;
+                       resets = <&ccu RST_BUS_UART1>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&ccu 69>;
-                       resets = <&ccu 48>;
+                       clocks = <&ccu CLK_BUS_UART2>;
+                       resets = <&ccu RST_BUS_UART2>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&ccu 70>;
-                       resets = <&ccu 49>;
+                       clocks = <&ccu CLK_BUS_UART3>;
+                       resets = <&ccu RST_BUS_UART3>;
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
-                       clocks = <&ccu 71>;
-                       resets = <&ccu 50>;
+                       clocks = <&ccu CLK_BUS_UART4>;
+                       resets = <&ccu RST_BUS_UART4>;
                        status = "disabled";
                };
 
                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x01c2ac00 0x400>;
                        interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&ccu 63>;
-                       resets = <&ccu 42>;
+                       clocks = <&ccu CLK_BUS_I2C0>;
+                       resets = <&ccu RST_BUS_I2C0>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x01c2b000 0x400>;
                        interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&ccu 64>;
-                       resets = <&ccu 43>;
+                       clocks = <&ccu CLK_BUS_I2C1>;
+                       resets = <&ccu RST_BUS_I2C1>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x01c2b400 0x400>;
                        interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&ccu 65>;
-                       resets = <&ccu 44>;
+                       clocks = <&ccu CLK_BUS_I2C2>;
+                       resets = <&ccu RST_BUS_I2C2>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               emac: ethernet@1c30000 {
+                       compatible = "allwinner,sun50i-a64-emac";
+                       syscon = <&syscon>;
+                       reg = <0x01c30000 0x100>;
+                       interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "macirq";
+                       resets = <&ccu RST_BUS_EMAC>;
+                       reset-names = "stmmaceth";
+                       clocks = <&ccu CLK_BUS_EMAC>;
+                       clock-names = "stmmaceth";
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
+
+                       mdio: mdio {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
                };
 
                gic: interrupt-controller@1c81000 {
                        compatible = "allwinner,sun50i-a64-r-pinctrl";
                        reg = <0x01f02c00 0x400>;
                        interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&r_ccu 3>, <&osc24M>, <&osc32k>;
+                       clocks = <&r_ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>;
                        clock-names = "apb", "hosc", "losc";
                        gpio-controller;
                        #gpio-cells = <3>;
                        interrupt-controller;
                        #interrupt-cells = <3>;
+
+                       r_rsb_pins: rsb@0 {
+                               pins = "PL0", "PL1";
+                               function = "s_rsb";
+                       };
+               };
+
+               r_rsb: rsb@1f03400 {
+                       compatible = "allwinner,sun8i-a23-rsb";
+                       reg = <0x01f03400 0x400>;
+                       interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&r_ccu 6>;
+                       clock-frequency = <3000000>;
+                       resets = <&r_ccu 2>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&r_rsb_pins>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                };
        };
 };
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
new file mode 100644 (file)
index 0000000..9689087
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun50i-h5.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "FriendlyARM NanoPi NEO 2";
+       compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5";
+
+       aliases {
+               ethernet0 = &emac;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               pwr {
+                       label = "nanopi:green:pwr";
+                       gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+
+               status {
+                       label = "nanopi:blue:status";
+                       gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       reg_gmac_3v3: gmac-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "gmac-3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               startup-delay-us = <100000>;
+               enable-active-high;
+               gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       reg_usb0_vbus: usb0-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb0-vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               enable-active-high;
+               gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
+               status = "okay";
+       };
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&ehci3 {
+       status = "okay";
+};
+
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&emac_rgmii_pins>;
+       phy-supply = <&reg_gmac_3v3>;
+       phy-handle = <&ext_rgmii_phy>;
+       phy-mode = "rgmii";
+       status = "okay";
+};
+
+&mdio {
+       ext_rgmii_phy: ethernet-phy@7 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <7>;
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&ohci3 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&usb_otg {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbphy {
+       /* USB Type-A port's VBUS is always on */
+       usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+       usb0_vbus-supply = <&reg_usb0_vbus>;
+       status = "okay";
+};
index dfecc17dcc927bea1410f25d8bcfdd4c0512e61d..a8296feee88411718818ab5452202d8b19b7b921 100644 (file)
@@ -59,6 +59,7 @@
        };
 
        aliases {
+               ethernet0 = &emac;
                serial0 = &uart0;
        };
 
                };
        };
 
+       reg_gmac_3v3: gmac-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "gmac-3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               startup-delay-us = <100000>;
+               enable-active-high;
+               gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
+       };
+
        reg_usb0_vbus: usb0-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb0-vbus";
        status = "okay";
 };
 
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&emac_rgmii_pins>;
+       phy-supply = <&reg_gmac_3v3>;
+       phy-handle = <&ext_rgmii_phy>;
+       phy-mode = "rgmii";
+       status = "okay";
+};
+
 &ir {
        pinctrl-names = "default";
        pinctrl-0 = <&ir_pins_a>;
        status = "okay";
 };
 
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
 &mmc0 {
        pinctrl-names = "default";
        pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
new file mode 100644 (file)
index 0000000..d906b30
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * Based on sun50i-h5-orangepi-pc2.dts, which is:
+ *   Copyright (C) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun50i-h5.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Xunlong Orange Pi Prime";
+       compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
+
+       aliases {
+               ethernet0 = &emac;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               pwr {
+                       label = "orangepi:green:pwr";
+                       gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+
+               status {
+                       label = "orangepi:red:status";
+                       gpios = <&pio 0 20 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       r-gpio-keys {
+               compatible = "gpio-keys";
+
+               sw4 {
+                       label = "sw4";
+                       linux,code = <BTN_0>;
+                       gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       reg_gmac_3v3: gmac-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "gmac-3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               startup-delay-us = <100000>;
+               enable-active-high;
+               gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       reg_usb0_vbus: usb0-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb0-vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               enable-active-high;
+               gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
+               status = "okay";
+       };
+
+       wifi_pwrseq: wifi_pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               reset-gpios = <&pio 2 14 GPIO_ACTIVE_LOW>; /* PC14 */
+       };
+};
+
+&codec {
+       allwinner,audio-routing =
+               "Line Out", "LINEOUT",
+               "MIC1", "Mic",
+               "Mic",  "MBIAS";
+       status = "okay";
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&ehci2 {
+       status = "okay";
+};
+
+&ehci3 {
+       status = "okay";
+};
+
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&emac_rgmii_pins>;
+       phy-supply = <&reg_gmac_3v3>;
+       phy-handle = <&ext_rgmii_phy>;
+       phy-mode = "rgmii";
+       status = "okay";
+};
+
+&ir {
+       pinctrl-names = "default";
+       pinctrl-0 = <&ir_pins_a>;
+       status = "okay";
+};
+
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
+       status = "okay";
+};
+
+&mmc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_pins_a>;
+       vmmc-supply = <&reg_vcc3v3>;
+       mmc-pwrseq = <&wifi_pwrseq>;
+       bus-width = <4>;
+       non-removable;
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&ohci2 {
+       status = "okay";
+};
+
+&ohci3 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart1_pins>;
+       status = "disabled";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2_pins>;
+       status = "disabled";
+};
+
+&usb_otg {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbphy {
+       /* USB Type-A ports' VBUS is always on */
+       usb0_id_det-gpios = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
+       usb0_vbus-supply = <&reg_usb0_vbus>;
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
new file mode 100644 (file)
index 0000000..b6b7a56
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h5.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "OrangePi Zero Plus2";
+       compatible = "xunlong,orangepi-zero-plus2", "allwinner,sun50i-h5";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       reg_vcc3v3: vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&mmc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc2_8bit_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <8>;
+       non-removable;
+       cap-mmc-hw-reset;
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins_a>;
+       status = "okay";
+};
index b9ad2db7398ba6bc2457308accaf8bac28b78766..8a0e09250978686aa0a4b2c8b97e2b57538cf0b5 100644 (file)
@@ -1,3 +1,4 @@
+dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-odroidc2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-p200.dtb
@@ -7,15 +8,16 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-meta.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-telos.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-wetek-hub.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-wetek-play2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-hwacom-amazetv.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-khadas-vim.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p230.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p231.dtb
-dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-hwacom-amazetv.dtb
-dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q200.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q201.dtb
-dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-rbox-pro.dtb
 
 always         := $(dtb-y)
 subdir-y       := $(dts-dirs)
index a84e27622639724da6661540d1e0ccb5192e2d39..dc478d094c113a3b9ce1a7dd13d4352cbd1a4353 100644 (file)
        };
 };
 
-/* This UART is brought out to the DB9 connector */
-&uart_AO {
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&ethmac {
        status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
        pinctrl-names = "default";
 };
 
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
 &ir {
        status = "okay";
        pinctrl-0 = <&remote_input_ao_pins>;
        pinctrl-names = "default";
 };
 
+&pwm_ef {
+       status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
+};
+
 /* Wireless SDIO Module */
 &sd_emmc_a {
        status = "okay";
        vmmc-supply = <&vddao_3v3>;
        vqmmc-supply = <&vddio_boot>;
 
-       brcmf: bcrmf@1 {
+       brcmf: wifi@1 {
                reg = <1>;
                compatible = "brcm,bcm4329-fmac";
        };
        vqmmc-supply = <&vddio_boot>;
 };
 
-&pwm_ef {
-       status = "okay";
-       pinctrl-0 = <&pwm_e_pins>;
-       pinctrl-names = "default";
-       clocks = <&clkc CLKID_FCLK_DIV4>;
-       clock-names = "clkin0";
-};
-
-&ethmac {
-       status = "okay";
-};
-
-&cvbs_vdac_port {
-       cvbs_vdac_out: endpoint {
-               remote-endpoint = <&cvbs_connector_in>;
-       };
-};
-
-&hdmi_tx {
+/* This UART is brought out to the DB9 connector */
+&uart_AO {
        status = "okay";
-       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
 };
-
-&hdmi_tx_tmds_port {
-       hdmi_tx_tmds_out: endpoint {
-               remote-endpoint = <&hdmi_connector_in>;
-       };
-};
index 436b875060e708340beb6b8332655f259d63e450..603491df9f0f9a77e808cc5982514dde1cf78359 100644 (file)
                };
 
                scpi_sensors: sensors {
-                       compatible = "arm,scpi-sensors";
+                       compatible = "amlogic,meson-gxbb-scpi-sensors", "arm,scpi-sensors";
                        #thermal-sensor-cells = <1>;
                };
        };
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
new file mode 100644 (file)
index 0000000..fa46283
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2017 Andreas Färber
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb";
+
+       aliases {
+               serial0 = &uart_AO;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x80000000>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               stat {
+                       label = "nanopi-k2:blue:stat";
+                       gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+                       panic-indicator;
+               };
+       };
+
+       vdd_5v: regulator-vdd-5v {
+               compatible = "regulator-fixed";
+               regulator-name = "VDD_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+
+       vddio_ao18: regulator-vddio-ao18 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_AO18";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+
+       vddio_ao3v3: regulator-vddio-ao3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_AO3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       vddio_tf: regulator-vddio-tf {
+               compatible = "regulator-gpio";
+
+               regulator-name = "VDDIO_TF";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
+               gpios-states = <0>;
+
+               states = <3300000 0>,
+                        <1800000 1>;
+       };
+
+       wifi_32k: wifi-32k {
+               compatible = "pwm-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+               clocks = <&wifi_32k>;
+               clock-names = "ext_clock";
+       };
+
+       vcc1v8: regulator-vcc1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC1.8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+
+       vcc3v3: regulator-vcc3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       emmc_pwrseq: emmc-pwrseq {
+               compatible = "mmc-pwrseq-emmc";
+               reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&ethmac {
+       status = "okay";
+       pinctrl-0 = <&eth_rgmii_pins>;
+       pinctrl-names = "default";
+
+       phy-handle = <&eth_phy0>;
+       phy-mode = "rgmii";
+
+       amlogic,tx-delay-ns = <2>;
+
+       snps,reset-gpio = <&gpio GPIOZ_14 0>;
+       snps,reset-delays-us = <0 10000 1000000>;
+       snps,reset-active-low;
+
+       mdio {
+               compatible = "snps,dwmac-mdio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               eth_phy0: ethernet-phy@0 {
+                       /* Realtek RTL8211F (0x001cc916) */
+                       reg = <0>;
+               };
+       };
+};
+
+&ir {
+       status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
+};
+
+&pwm_ef {
+       status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
+};
+
+&saradc {
+       status = "okay";
+       vref-supply = <&vddio_ao18>;
+};
+
+/* SDIO */
+&sd_emmc_a {
+       status = "okay";
+       pinctrl-0 = <&sdio_pins>, <&sdio_irq_pins>;
+       pinctrl-names = "default";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <200000000>;
+
+       non-removable;
+       disable-wp;
+
+       mmc-pwrseq = <&sdio_pwrseq>;
+
+       vmmc-supply = <&vddio_ao3v3>;
+       vqmmc-supply = <&vddio_ao18>;
+
+       brcmf: wifi@1 {
+               compatible = "brcm,bcm4329-fmac";
+               reg = <1>;
+       };
+};
+
+/* SD */
+&sd_emmc_b {
+       status = "okay";
+       pinctrl-0 = <&sdcard_pins>;
+       pinctrl-names = "default";
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <100000000>;
+       disable-wp;
+
+       cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+
+       vmmc-supply = <&vddio_ao3v3>;
+       vqmmc-supply = <&vddio_tf>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+       status = "disabled";
+       pinctrl-0 = <&emmc_pins>;
+       pinctrl-names = "default";
+
+       bus-width = <8>;
+       cap-sd-highspeed;
+       max-frequency = <200000000>;
+       non-removable;
+       disable-wp;
+       cap-mmc-highspeed;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
+
+       mmc-pwrseq = <&emmc_pwrseq>;
+       vmmc-supply = <&vcc3v3>;
+       vqmmc-supply = <&vcc1v8>;
+};
+
+/* DBG_UART */
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+/* Bluetooth on AP6212 */
+&uart_A {
+       status = "disabled";
+       pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+       pinctrl-names = "default";
+};
+
+/* 40-pin CON1 */
+&uart_C {
+       status = "disabled";
+       pinctrl-0 = <&uart_c_pins>;
+       pinctrl-names = "default";
+};
+
+&usb0_phy {
+       status = "okay";
+       phy-supply = <&vdd_5v>;
+};
+
+&usb1_phy {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
+};
index 87198eafb04b678c840a0b5d047c7365ad4f7e63..a1078b3e1c760d2a1eeb7d8a70c906d25ca5a23e 100644 (file)
        };
 };
 
-&uart_AO {
-       status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
-       pinctrl-names = "default";
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
 };
 
 &ethmac {
        };
 };
 
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
 &ir {
        status = "okay";
        pinctrl-0 = <&remote_input_ao_pins>;
        pinctrl-names = "default";
 };
 
+&pwm_ef {
+       status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
+};
+
 /* Wireless SDIO Module */
 &sd_emmc_a {
        status = "okay";
        vqmmc-supply = <&vddio_boot>;
 };
 
-&pwm_ef {
-       status = "okay";
-       pinctrl-0 = <&pwm_e_pins>;
-       pinctrl-names = "default";
-       clocks = <&clkc CLKID_FCLK_DIV4>;
-       clock-names = "clkin0";
-};
-
-&cvbs_vdac_port {
-       cvbs_vdac_out: endpoint {
-               remote-endpoint = <&cvbs_connector_in>;
-       };
-};
-
-&hdmi_tx {
+&uart_AO {
        status = "okay";
-       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
 };
-
-&hdmi_tx_tmds_port {
-       hdmi_tx_tmds_out: endpoint {
-               remote-endpoint = <&hdmi_connector_in>;
-       };
-};
index 54a9c6a6b3923cda35270c3719a274882bc56ef5..d147c853ab054d86affa734311ae2c9df713ea58 100644 (file)
        };
 };
 
-&scpi_clocks {
-       status = "disabled";
-};
-
-&uart_AO {
-       status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
-       pinctrl-names = "default";
-};
-
 &ethmac {
        status = "okay";
        pinctrl-0 = <&eth_rgmii_pins>;
        };
 };
 
+&gpio_ao {
+       /*
+        * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
+        * to be turned high in order to be detected by the USB Controller
+        * This signal should be handled by a USB specific power sequence
+        * in order to reset the Hub when USB bus is powered down.
+        */
+       usb-hub {
+               gpio-hog;
+               gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "usb-hub-reset";
+       };
+};
+
+&i2c_A {
+       status = "okay";
+       pinctrl-0 = <&i2c_a_pins>;
+       pinctrl-names = "default";
+};
+
+&ir {
+       status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
+};
+
 &pinctrl_aobus {
        gpio-line-names = "UART TX", "UART RX", "VCCK En", "TF 3V3/1V8 En",
                          "USB HUB nRESET", "USB OTG Power En",
                          "";
 };
 
-&ir {
-       status = "okay";
-       pinctrl-0 = <&remote_input_ao_pins>;
-       pinctrl-names = "default";
-};
-
-&i2c_A {
-       status = "okay";
-       pinctrl-0 = <&i2c_a_pins>;
-       pinctrl-names = "default";
-};
-
-&gpio_ao {
-       /*
-        * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
-        * to be turned high in order to be detected by the USB Controller
-        * This signal should be handled by a USB specific power sequence
-        * in order to reset the Hub when USB bus is powered down.
-        */
-       usb-hub {
-               gpio-hog;
-               gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
-               output-high;
-               line-name = "usb-hub-reset";
-       };
-};
-
-&usb0_phy {
-       status = "okay";
-       phy-supply = <&usb_otg_pwr>;
-};
-
-&usb1_phy {
-       status = "okay";
-};
-
-&usb0 {
-       status = "okay";
-};
-
-&usb1 {
-       status = "okay";
-};
-
 &saradc {
        status = "okay";
        vref-supply = <&vcc1v8>;
 };
 
+&scpi_clocks {
+       status = "disabled";
+};
+
 /* SD */
 &sd_emmc_b {
        status = "okay";
        vmmc-supply = <&vcc3v3>;
        vqmmc-supply = <&vcc1v8>;
 };
+
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb0_phy {
+       status = "okay";
+       phy-supply = <&usb_otg_pwr>;
+};
+
+&usb1_phy {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
+};
index 3c6c0b7f4187dac8b4794e2e9117d45ca3fe0199..d904deb1018cefa602764167219d5ee3a82a385a 100644 (file)
                clock-names = "ext_clock";
        };
 
-       cvbs-connector {
+       cvbs_connector: cvbs-connector {
                compatible = "composite-video-connector";
 
                port {
        };
 };
 
-/* This UART is brought out to the DB9 connector */
-&uart_AO {
-       status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
-       pinctrl-names = "default";
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
 };
 
-&ir {
+&hdmi_tx {
        status = "okay";
-       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
        pinctrl-names = "default";
 };
 
-&usb0_phy {
-       status = "okay";
-       phy-supply = <&usb_pwr>;
-};
-
-&usb1_phy {
-       status = "okay";
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
 };
 
-&usb0 {
+&ir {
        status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
 };
 
-&usb1 {
+&pwm_ef {
        status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
 };
 
 /* Wireless SDIO Module */
        vmmc-supply = <&vddao_3v3>;
        vqmmc-supply = <&vddio_boot>;
 
-       brcmf: bcrmf@1 {
+       brcmf: wifi@1 {
                reg = <1>;
                compatible = "brcm,bcm4329-fmac";
        };
        vqmmc-supply = <&vddio_boot>;
 };
 
-&pwm_ef {
+/* This UART is brought out to the DB9 connector */
+&uart_AO {
        status = "okay";
-       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
-       clocks = <&clkc CLKID_FCLK_DIV4>;
-       clock-names = "clkin0";
 };
 
-&cvbs_vdac_port {
-       cvbs_vdac_out: endpoint {
-               remote-endpoint = <&cvbs_connector_in>;
-       };
+&usb0_phy {
+       status = "okay";
+       phy-supply = <&usb_pwr>;
 };
 
-&hdmi_tx {
+&usb1_phy {
        status = "okay";
-       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
-       pinctrl-names = "default";
 };
 
-&hdmi_tx_tmds_port {
-       hdmi_tx_tmds_out: endpoint {
-               remote-endpoint = <&hdmi_connector_in>;
-       };
+&usb0 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
 };
index aefa66dff72dc52042a01753d28734798cf75866..346753fb632431f1c2e2af4d9c72b740a3f8c3b8 100644 (file)
        };
 };
 
-&uart_AO {
-       status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
-       pinctrl-names = "default";
-};
-
-&ir {
-       status = "okay";
-       pinctrl-0 = <&remote_input_ao_pins>;
-       pinctrl-names = "default";
-};
-
 &ethmac {
        status = "okay";
        pinctrl-0 = <&eth_rgmii_pins>;
        };
 };
 
-&usb0_phy {
-       status = "okay";
-       phy-supply = <&usb_vbus>;
-};
-
-&usb1_phy {
-       status = "okay";
-};
-
-&usb0 {
+&ir {
        status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
 };
 
-&usb1 {
+&pwm_ef {
        status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
 };
 
 /* Wireless SDIO Module */
        vmmc-supply = <&vcc_3v3>;
        vqmmc-supply = <&vcc_1v8>;
 
-       brcmf: bcrmf@1 {
+       brcmf: wifi@1 {
                reg = <1>;
                compatible = "brcm,bcm4329-fmac";
        };
        vmmcq-sumpply = <&vcc_1v8>;
 };
 
-&pwm_ef {
+&uart_AO {
        status = "okay";
-       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
-       clocks = <&clkc CLKID_FCLK_DIV4>;
-       clock-names = "clkin0";
+};
+
+&usb0_phy {
+       status = "okay";
+       phy-supply = <&usb_vbus>;
+};
+
+&usb1_phy {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
 };
index f057fb48fee5563d2f9e0a3ba38a6753c559b922..1878ac2b2b83e6b31e622dfaa005fb6b568f00c3 100644 (file)
                        panic-indicator;
                };
        };
+};
 
-       cvbs-connector {
-               status = "disabled";
-       };
+&cvbs_connector {
+       status = "disabled";
 };
 
 &ethmac {
index 743acb5f5d06353e010c857ba5c3efd6489d26b2..e76ac313fef9cfb1ea97d4dc5c131d559a12d883 100644 (file)
                        gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
                };
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+};
+
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
 };
 
 &ethmac {
        };
 };
 
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
 &i2c_A {
        status = "okay";
        pinctrl-0 = <&i2c_a_pins>;
index 86105a69690aa8c66342e7e22e6846a6140203cb..dbd300fffa8aee9c2330d382a2c160a3ba1e12fe 100644 (file)
        };
 };
 
-&ethmac {
-       clocks = <&clkc CLKID_ETH>,
-                <&clkc CLKID_FCLK_DIV2>,
-                <&clkc CLKID_MPLL2>;
-       clock-names = "stmmaceth", "clkin0", "clkin1";
-};
-
 &aobus {
        pinctrl_aobus: pinctrl@14 {
                compatible = "amlogic,meson-gxbb-aobus-pinctrl";
                                function = "spdif_out_ao";
                        };
                };
+
+               ao_cec_pins: ao_cec {
+                       mux {
+                               groups = "ao_cec";
+                               function = "cec_ao";
+                       };
+               };
+
+               ee_cec_pins: ee_cec {
+                       mux {
+                               groups = "ee_cec";
+                               function = "cec_ao";
+                       };
+               };
        };
 };
 
+&apb {
+       mali: gpu@c0000 {
+               compatible = "amlogic,meson-gxbb-mali", "arm,mali-450";
+               reg = <0x0 0xc0000 0x0 0x40000>;
+               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "gp", "gpmmu", "pp", "pmu",
+                       "pp0", "ppmmu0", "pp1", "ppmmu1",
+                       "pp2", "ppmmu2";
+               clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
+               clock-names = "bus", "core";
+
+               /*
+                * Mali clocking is provided by two identical clock paths
+                * MALI_0 and MALI_1 muxed to a single clock by a glitch
+                * free mux to safely change frequency while running.
+                */
+               assigned-clocks = <&clkc CLKID_MALI_0_SEL>,
+                                 <&clkc CLKID_MALI_0>,
+                                 <&clkc CLKID_MALI>; /* Glitch free mux */
+               assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>,
+                                        <0>, /* Do Nothing */
+                                        <&clkc CLKID_MALI_0>;
+               assigned-clock-rates = <0>, /* Do Nothing */
+                                      <666666666>,
+                                      <0>; /* Do Nothing */
+       };
+};
+
+&cbus {
+       spifc: spi@8c80 {
+               compatible = "amlogic,meson-gxbb-spifc";
+               reg = <0x0 0x08c80 0x0 0x80>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&clkc CLKID_SPI>;
+               status = "disabled";
+       };
+};
+
+&ethmac {
+       clocks = <&clkc CLKID_ETH>,
+                <&clkc CLKID_FCLK_DIV2>,
+                <&clkc CLKID_MPLL2>;
+       clock-names = "stmmaceth", "clkin0", "clkin1";
+};
+
+&hdmi_tx {
+       compatible = "amlogic,meson-gxbb-dw-hdmi", "amlogic,meson-gx-dw-hdmi";
+       resets = <&reset RESET_HDMITX_CAPB3>,
+                <&reset RESET_HDMI_SYSTEM_RESET>,
+                <&reset RESET_HDMI_TX>;
+       reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
+       clocks = <&clkc CLKID_HDMI_PCLK>,
+                <&clkc CLKID_CLK81>,
+                <&clkc CLKID_GCLK_VENCI_INT0>;
+       clock-names = "isfr", "iahb", "venci";
+};
+
+&hiubus {
+       clkc: clock-controller@0 {
+               compatible = "amlogic,gxbb-clkc";
+               #clock-cells = <1>;
+               reg = <0x0 0x0 0x0 0x3db>;
+       };
+};
+
+&hwrng {
+       clocks = <&clkc CLKID_RNG0>;
+       clock-names = "core";
+};
+
+&i2c_A {
+       clocks = <&clkc CLKID_I2C>;
+};
+
+&i2c_AO {
+       clocks = <&clkc CLKID_AO_I2C>;
+};
+
+&i2c_B {
+       clocks = <&clkc CLKID_I2C>;
+};
+
+&i2c_C {
+       clocks = <&clkc CLKID_I2C>;
+};
+
 &periphs {
        pinctrl_periphs: pinctrl@4b0 {
                compatible = "amlogic,meson-gxbb-periphs-pinctrl";
                gpio: bank@4b0 {
                        reg = <0x0 0x004b0 0x0 0x28>,
                              <0x0 0x004e8 0x0 0x14>,
-                             <0x0 0x00120 0x0 0x14>,
+                             <0x0 0x00520 0x0 0x14>,
                              <0x0 0x00430 0x0 0x40>;
                        reg-names = "mux", "pull", "pull-enable", "gpio";
                        gpio-controller;
                        };
                };
 
+               spi_pins: spi {
+                       mux {
+                               groups = "spi_miso",
+                                       "spi_mosi",
+                                       "spi_sclk";
+                               function = "spi";
+                       };
+               };
+
+               spi_ss0_pins: spi-ss0 {
+                       mux {
+                               groups = "spi_ss0";
+                               function = "spi";
+                       };
+               };
+
                sdcard_pins: sdcard {
                        mux {
                                groups = "sdcard_d0",
        };
 };
 
-&hiubus {
-       clkc: clock-controller@0 {
-               compatible = "amlogic,gxbb-clkc";
-               #clock-cells = <1>;
-               reg = <0x0 0x0 0x0 0x3db>;
-       };
-};
-
-&apb {
-       mali: gpu@c0000 {
-               compatible = "amlogic,meson-gxbb-mali", "arm,mali-450";
-               reg = <0x0 0xc0000 0x0 0x40000>;
-               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
-               interrupt-names = "gp", "gpmmu", "pp", "pmu",
-                       "pp0", "ppmmu0", "pp1", "ppmmu1",
-                       "pp2", "ppmmu2";
-               clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
-               clock-names = "bus", "core";
-
-               /*
-                * Mali clocking is provided by two identical clock paths
-                * MALI_0 and MALI_1 muxed to a single clock by a glitch
-                * free mux to safely change frequency while running.
-                */
-               assigned-clocks = <&clkc CLKID_MALI_0_SEL>,
-                                 <&clkc CLKID_MALI_0>,
-                                 <&clkc CLKID_MALI>; /* Glitch free mux */
-               assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>,
-                                        <0>, /* Do Nothing */
-                                        <&clkc CLKID_MALI_0>;
-               assigned-clock-rates = <0>, /* Do Nothing */
-                                      <666666666>,
-                                      <0>; /* Do Nothing */
-       };
-};
-
-&i2c_A {
-       clocks = <&clkc CLKID_I2C>;
-};
-
-&i2c_AO {
-       clocks = <&clkc CLKID_AO_I2C>;
-};
-
-&i2c_B {
-       clocks = <&clkc CLKID_I2C>;
-};
-
-&i2c_C {
-       clocks = <&clkc CLKID_I2C>;
-};
-
 &saradc {
        compatible = "amlogic,meson-gxbb-saradc", "amlogic,meson-saradc";
        clocks = <&xtal>,
 &vpu {
        compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu";
 };
-
-&hwrng {
-       clocks = <&clkc CLKID_RNG0>;
-       clock-names = "core";
-};
-
-&hdmi_tx {
-       compatible = "amlogic,meson-gxbb-dw-hdmi", "amlogic,meson-gx-dw-hdmi";
-       resets = <&reset RESET_HDMITX_CAPB3>,
-                <&reset RESET_HDMI_SYSTEM_RESET>,
-                <&reset RESET_HDMI_TX>;
-       reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
-       clocks = <&clkc CLKID_HDMI_PCLK>,
-                <&clkc CLKID_CLK81>,
-                <&clkc CLKID_GCLK_VENCI_INT0>;
-       clock-names = "isfr", "iahb", "venci";
-};
index f9fbfdad8ddef6ca5fc291fc40672254a2bf61c8..3e0c023d6abde14afa98381e02c3f1dec0c271e4 100644 (file)
                regulator-min-microvolt = <1800000>;
                regulator-max-microvolt = <1800000>;
        };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
 };
 
 /* P230 has exclusive choice between internal or external PHY */
        };
 };
 
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
 &saradc {
        status = "okay";
        vref-supply = <&vddio_ao18>;
index 3c8b0b51ef276e652f1dd4dfe3696855c84ae7c5..72c5a9f64ca8499fe83a11bdbb17c1c95c4206c6 100644 (file)
                        linux,default-trigger = "default-on";
                };
        };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
 };
 
 &i2c_A {
 };
 
 &sd_emmc_a {
-       brcmf: bcrmf@1 {
+       brcmf: wifi@1 {
                reg = <1>;
                compatible = "brcm,bcm4329-fmac";
        };
index 8873c058fad232c1bd7c945f8dd9e0e9285c8421..6633a5d8fdd39193be747582e8facc8a581a9486 100644 (file)
        };
 };
 
-&uart_AO {
-       status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
-       pinctrl-names = "default";
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
 };
 
 &ethmac {
        phy-handle = <&internal_phy>;
 };
 
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
 &ir {
        status = "okay";
        pinctrl-0 = <&remote_input_ao_pins>;
        pinctrl-names = "default";
 };
 
+&pwm_ef {
+       status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
+};
+
 /* Wireless SDIO Module */
 &sd_emmc_a {
        status = "okay";
        vqmmc-supply = <&vddio_boot>;
 };
 
-&pwm_ef {
-       status = "okay";
-       pinctrl-0 = <&pwm_e_pins>;
-       pinctrl-names = "default";
-       clocks = <&clkc CLKID_FCLK_DIV4>;
-       clock-names = "clkin0";
-};
-
-&cvbs_vdac_port {
-       cvbs_vdac_out: endpoint {
-               remote-endpoint = <&cvbs_connector_in>;
-       };
-};
-
-&hdmi_tx {
+&uart_AO {
        status = "okay";
-       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
 };
-
-&hdmi_tx_tmds_port {
-       hdmi_tx_tmds_out: endpoint {
-               remote-endpoint = <&hdmi_connector_in>;
-       };
-};
index db31e093f40e07eaf2a0d8c253dffd6d38706c46..6ab17c1eeefdc198f7e4417baa780935b885c6c5 100644 (file)
                        };
                };
        };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
 };
 
 &cvbs_vdac_port {
        };
 };
 
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
 /* This UART is brought out to the DB9 connector */
 &uart_AO {
        status = "okay";
index 0f78d836edaf5d4977739fe61d176fc9bd58ffab..3314a0b3dad97de16aa92d372f5ba31da48b4c55 100644 (file)
@@ -48,7 +48,7 @@
        compatible = "amlogic,s905x", "amlogic,meson-gxl";
 };
 
-/* S905X Only has access to its internal PHY */
+/* S905X only has access to its internal PHY */
 &ethmac {
        phy-mode = "rmii";
        phy-handle = <&internal_phy>;
index d8e096dff10a4906e3125b6064e8ed8d301c68be..4dfc22b07bf01e9a9c180433621bdbd2f0647c4b 100644 (file)
                                function = "spdif_out_ao";
                        };
                };
+
+               ao_cec_pins: ao_cec {
+                       mux {
+                               groups = "ao_cec";
+                               function = "cec_ao";
+                       };
+               };
+
+               ee_cec_pins: ee_cec {
+                       mux {
+                               groups = "ee_cec";
+                               function = "cec_ao";
+                       };
+               };
+       };
+};
+
+&hdmi_tx {
+       compatible = "amlogic,meson-gxl-dw-hdmi", "amlogic,meson-gx-dw-hdmi";
+       resets = <&reset RESET_HDMITX_CAPB3>,
+                <&reset RESET_HDMI_SYSTEM_RESET>,
+                <&reset RESET_HDMI_TX>;
+       reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
+       clocks = <&clkc CLKID_HDMI_PCLK>,
+                <&clkc CLKID_CLK81>,
+                <&clkc CLKID_GCLK_VENCI_INT0>;
+       clock-names = "isfr", "iahb", "venci";
+};
+
+&hiubus {
+       clkc: clock-controller@0 {
+               compatible = "amlogic,gxl-clkc", "amlogic,gxbb-clkc";
+               #clock-cells = <1>;
+               reg = <0x0 0x0 0x0 0x3db>;
        };
 };
 
+&i2c_A {
+       clocks = <&clkc CLKID_I2C>;
+};
+
+&i2c_AO {
+       clocks = <&clkc CLKID_AO_I2C>;
+};
+
+&i2c_B {
+       clocks = <&clkc CLKID_I2C>;
+};
+
+&i2c_C {
+       clocks = <&clkc CLKID_I2C>;
+};
+
 &periphs {
        pinctrl_periphs: pinctrl@4b0 {
                compatible = "amlogic,meson-gxl-periphs-pinctrl";
                gpio: bank@4b0 {
                        reg = <0x0 0x004b0 0x0 0x28>,
                              <0x0 0x004e8 0x0 0x14>,
-                             <0x0 0x00120 0x0 0x14>,
+                             <0x0 0x00520 0x0 0x14>,
                              <0x0 0x00430 0x0 0x40>;
                        reg-names = "mux", "pull", "pull-enable", "gpio";
                        gpio-controller;
                        #gpio-cells = <2>;
-                       gpio-ranges = <&pinctrl_periphs 0 14 101>;
+                       gpio-ranges = <&pinctrl_periphs 0 10 101>;
                };
 
                emmc_pins: emmc {
                        };
                };
 
+               spi_pins: spi {
+                       mux {
+                               groups = "spi_miso",
+                                       "spi_mosi",
+                                       "spi_sclk";
+                               function = "spi";
+                       };
+               };
+
+               spi_ss0_pins: spi-ss0 {
+                       mux {
+                               groups = "spi_ss0";
+                               function = "spi";
+                       };
+               };
+
                sdcard_pins: sdcard {
                        mux {
                                groups = "sdcard_d0",
                        };
                };
 
+               eth_link_led_pins: eth_link_led {
+                       mux {
+                               groups = "eth_link_led";
+                               function = "eth_led";
+                       };
+               };
+
+               eth_act_led_pins: eth_act_led {
+                       mux {
+                               groups = "eth_act_led";
+                               function = "eth_led";
+                       };
+               };
+               
                pwm_a_pins: pwm_a {
                        mux {
                                groups = "pwm_a";
        };
 };
 
-&hiubus {
-       clkc: clock-controller@0 {
-               compatible = "amlogic,gxl-clkc", "amlogic,gxbb-clkc";
-               #clock-cells = <1>;
-               reg = <0x0 0x0 0x0 0x3db>;
-       };
-};
-
-&i2c_A {
-       clocks = <&clkc CLKID_I2C>;
-};
-
-&i2c_AO {
-       clocks = <&clkc CLKID_AO_I2C>;
-};
-
-&i2c_B {
-       clocks = <&clkc CLKID_I2C>;
-};
-
-&i2c_C {
-       clocks = <&clkc CLKID_I2C>;
-};
-
 &saradc {
        compatible = "amlogic,meson-gxl-saradc", "amlogic,meson-saradc";
        clocks = <&xtal>,
 &vpu {
        compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
 };
-
-&hdmi_tx {
-       compatible = "amlogic,meson-gxl-dw-hdmi", "amlogic,meson-gx-dw-hdmi";
-       resets = <&reset RESET_HDMITX_CAPB3>,
-                <&reset RESET_HDMI_SYSTEM_RESET>,
-                <&reset RESET_HDMI_TX>;
-       reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
-       clocks = <&clkc CLKID_HDMI_PCLK>,
-                <&clkc CLKID_CLK81>,
-                <&clkc CLKID_GCLK_VENCI_INT0>;
-       clock-names = "isfr", "iahb", "venci";
-};
index 11b0bf46a95c4df067741079255ff7f5b26a1b4d..5f626d6830883466b80b9364547efcf066f6317b 100644 (file)
        };
 };
 
-/* This UART is brought out to the DB9 connector */
-&uart_AO {
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&ethmac {
        status = "okay";
-       pinctrl-0 = <&uart_ao_a_pins>;
+
+       pinctrl-0 = <&eth_pins>;
        pinctrl-names = "default";
+
+       /* Select external PHY by default */
+       phy-handle = <&external_phy>;
+
+       amlogic,tx-delay-ns = <2>;
+
+       snps,reset-gpio = <&gpio GPIOZ_14 0>;
+       snps,reset-delays-us = <0 10000 1000000>;
+       snps,reset-active-low;
+
+       /* External PHY is in RGMII */
+       phy-mode = "rgmii";
+};
+
+&external_mdio {
+       external_phy: ethernet-phy@0 {
+               compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+               max-speed = <1000>;
+       };
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
 };
 
 &ir {
        vqmmc-supply = <&vddio_boot>;
 };
 
-&ethmac {
-       status = "okay";
-
-       pinctrl-0 = <&eth_pins>;
-       pinctrl-names = "default";
-
-       /* Select external PHY by default */
-       phy-handle = <&external_phy>;
-
-       amlogic,tx-delay-ns = <2>;
-
-       snps,reset-gpio = <&gpio GPIOZ_14 0>;
-       snps,reset-delays-us = <0 10000 1000000>;
-       snps,reset-active-low;
-
-       /* External PHY is in RGMII */
-       phy-mode = "rgmii";
-};
-
-&external_mdio {
-       external_phy: ethernet-phy@0 {
-               compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
-               reg = <0>;
-               max-speed = <1000>;
-       };
-};
-
-&cvbs_vdac_port {
-       cvbs_vdac_out: endpoint {
-               remote-endpoint = <&cvbs_connector_in>;
-       };
-};
-
-&hdmi_tx {
+&uart_AO {
        status = "okay";
-       pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+       pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
 };
-
-&hdmi_tx_tmds_port {
-       hdmi_tx_tmds_out: endpoint {
-               remote-endpoint = <&hdmi_connector_in>;
-       };
-};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts
new file mode 100644 (file)
index 0000000..08f1dd6
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2016-2017 Andreas Färber
+ *
+ * Based on nexbox-a1:
+ *
+ * Copyright (c) 2016 BayLibre, SAS.
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ *
+ * Copyright (c) 2016 Endless Computers, Inc.
+ * Author: Carlo Caione <carlo@endlessm.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+
+/ {
+       compatible = "kingnovel,r-box-pro", "amlogic,s912", "amlogic,meson-gxm";
+       model = "R-Box Pro";
+
+       aliases {
+               serial0 = &uart_AO;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               blue {
+                       label = "rbox-pro:blue:on";
+                       gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+
+               red {
+                       label = "rbox-pro:red:standby";
+                       gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+                       retain-state-suspended;
+                       panic-indicator;
+               };
+       };
+
+       vddio_boot: regulator-vddio-boot {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_BOOT";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+       };
+
+       vddao_3v3: regulator-vddao-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDAO_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       vcc_3v3: regulator-vcc-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       emmc_pwrseq: emmc-pwrseq {
+               compatible = "mmc-pwrseq-emmc";
+               reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
+       };
+
+       wifi32k: wifi32k {
+               compatible = "pwm-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+               clocks = <&wifi32k>;
+               clock-names = "ext_clock";
+       };
+};
+
+&ethmac {
+       status = "okay";
+
+       pinctrl-0 = <&eth_pins>;
+       pinctrl-names = "default";
+
+       /* Select external PHY by default */
+       phy-handle = <&external_phy>;
+
+       snps,reset-gpio = <&gpio GPIOZ_14 0>;
+       snps,reset-delays-us = <0 10000 1000000>;
+       snps,reset-active-low;
+
+       amlogic,tx-delay-ns = <2>;
+
+       /* External PHY is in RGMII */
+       phy-mode = "rgmii";
+};
+
+&external_mdio {
+       external_phy: ethernet-phy@0 {
+               compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
+               reg = <0>;
+               max-speed = <1000>;
+       };
+};
+
+&ir {
+       status = "okay";
+       pinctrl-0 = <&remote_input_ao_pins>;
+       pinctrl-names = "default";
+};
+
+&pwm_ef {
+       status = "okay";
+       pinctrl-0 = <&pwm_e_pins>;
+       pinctrl-names = "default";
+       clocks = <&clkc CLKID_FCLK_DIV4>;
+       clock-names = "clkin0";
+};
+
+/* Wireless SDIO Module */
+&sd_emmc_a {
+       status = "okay";
+       pinctrl-0 = <&sdio_pins>;
+       pinctrl-names = "default";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <100000000>;
+
+       non-removable;
+       disable-wp;
+
+       mmc-pwrseq = <&sdio_pwrseq>;
+
+       vmmc-supply = <&vddao_3v3>;
+       vqmmc-supply = <&vddio_boot>;
+
+       brcmf: brcmf@1 {
+               reg = <1>;
+               compatible = "brcm,bcm4329-fmac";
+       };
+};
+
+/* SD card */
+&sd_emmc_b {
+       status = "okay";
+       pinctrl-0 = <&sdcard_pins>;
+       pinctrl-names = "default";
+
+       bus-width = <4>;
+       cap-sd-highspeed;
+       max-frequency = <100000000>;
+       disable-wp;
+
+       cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
+       cd-inverted;
+
+       vmmc-supply = <&vddao_3v3>;
+       vqmmc-supply = <&vddio_boot>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+       status = "okay";
+       pinctrl-0 = <&emmc_pins>;
+       pinctrl-names = "default";
+
+       bus-width = <8>;
+       cap-sd-highspeed;
+       cap-mmc-highspeed;
+       max-frequency = <200000000>;
+       non-removable;
+       disable-wp;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
+
+       mmc-pwrseq = <&emmc_pwrseq>;
+       vmmc-supply = <&vcc_3v3>;
+       vqmmc-supply = <&vddio_boot>;
+};
+
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
index bfe7d683a42e1b27b6e90997f9ebf18abb79afce..e8b7413ec890b8fc88f1fb62d691d7ffcdae8570 100644 (file)
@@ -53,7 +53,6 @@
                #global-interrupts = <1>;
                dma-coherent;
                power-domains = <&scpi_devpd 0>;
-               status = "disabled";
        };
 
        gic: interrupt-controller@2c010000 {
                };
        };
 
+       cpu_debug0: cpu_debug@22010000 {
+               compatible = "arm,coresight-cpu-debug", "arm,primecell";
+               reg = <0x0 0x22010000 0x0 0x1000>;
+
+               clocks = <&soc_smc50mhz>;
+               clock-names = "apb_pclk";
+               power-domains = <&scpi_devpd 0>;
+       };
+
        etm0: etm@22040000 {
                compatible = "arm,coresight-etm4x", "arm,primecell";
                reg = <0 0x22040000 0 0x1000>;
                };
        };
 
+       cpu_debug1: cpu_debug@22110000 {
+               compatible = "arm,coresight-cpu-debug", "arm,primecell";
+               reg = <0x0 0x22110000 0x0 0x1000>;
+
+               clocks = <&soc_smc50mhz>;
+               clock-names = "apb_pclk";
+               power-domains = <&scpi_devpd 0>;
+       };
+
        etm1: etm@22140000 {
                compatible = "arm,coresight-etm4x", "arm,primecell";
                reg = <0 0x22140000 0 0x1000>;
                };
        };
 
+       cpu_debug2: cpu_debug@23010000 {
+               compatible = "arm,coresight-cpu-debug", "arm,primecell";
+               reg = <0x0 0x23010000 0x0 0x1000>;
+
+               clocks = <&soc_smc50mhz>;
+               clock-names = "apb_pclk";
+               power-domains = <&scpi_devpd 0>;
+       };
+
        etm2: etm@23040000 {
                compatible = "arm,coresight-etm4x", "arm,primecell";
                reg = <0 0x23040000 0 0x1000>;
                };
        };
 
+       cpu_debug3: cpu_debug@23110000 {
+               compatible = "arm,coresight-cpu-debug", "arm,primecell";
+               reg = <0x0 0x23110000 0x0 0x1000>;
+
+               clocks = <&soc_smc50mhz>;
+               clock-names = "apb_pclk";
+               power-domains = <&scpi_devpd 0>;
+       };
+
        etm3: etm@23140000 {
                compatible = "arm,coresight-etm4x", "arm,primecell";
                reg = <0 0x23140000 0 0x1000>;
                };
        };
 
+       cpu_debug4: cpu_debug@23210000 {
+               compatible = "arm,coresight-cpu-debug", "arm,primecell";
+               reg = <0x0 0x23210000 0x0 0x1000>;
+
+               clocks = <&soc_smc50mhz>;
+               clock-names = "apb_pclk";
+               power-domains = <&scpi_devpd 0>;
+       };
+
        etm4: etm@23240000 {
                compatible = "arm,coresight-etm4x", "arm,primecell";
                reg = <0 0x23240000 0 0x1000>;
                };
        };
 
+       cpu_debug5: cpu_debug@23310000 {
+               compatible = "arm,coresight-cpu-debug", "arm,primecell";
+               reg = <0x0 0x23310000 0x0 0x1000>;
+
+               clocks = <&soc_smc50mhz>;
+               clock-names = "apb_pclk";
+               power-domains = <&scpi_devpd 0>;
+       };
+
        etm5: etm@23340000 {
                compatible = "arm,coresight-etm4x", "arm,primecell";
                reg = <0 0x23340000 0 0x1000>;
                             <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
                #iommu-cells = <1>;
                #global-interrupts = <1>;
-               status = "disabled";
        };
 
        smmu_hdlcd0: iommu@7fb20000 {
                             <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
                #iommu-cells = <1>;
                #global-interrupts = <1>;
-               status = "disabled";
        };
 
        smmu_usb: iommu@7fb30000 {
                #iommu-cells = <1>;
                #global-interrupts = <1>;
                dma-coherent;
-               status = "disabled";
        };
 
        dma@7ff00000 {
index 0e8943ab94d77497ad28f6699e23d7bc4dec7958..aed6389468c4a1d386189265e2d7a0abe68f6b06 100644 (file)
 &stm_out_port {
        remote-endpoint = <&csys1_funnel_in_port0>;
 };
+
+&cpu_debug0 {
+       cpu = <&A57_0>;
+};
+
+&cpu_debug1 {
+       cpu = <&A57_1>;
+};
+
+&cpu_debug2 {
+       cpu = <&A53_0>;
+};
+
+&cpu_debug3 {
+       cpu = <&A53_1>;
+};
+
+&cpu_debug4 {
+       cpu = <&A53_2>;
+};
+
+&cpu_debug5 {
+       cpu = <&A53_3>;
+};
index 405e2fba025beeec73c8ba020fa2329f2438f533..b39b6d6ec5aa1be93c88e7a988bdbae3cfd40a9b 100644 (file)
 &stm_out_port {
        remote-endpoint = <&csys1_funnel_in_port0>;
 };
+
+&cpu_debug0 {
+       cpu = <&A72_0>;
+};
+
+&cpu_debug1 {
+       cpu = <&A72_1>;
+};
+
+&cpu_debug2 {
+       cpu = <&A53_0>;
+};
+
+&cpu_debug3 {
+       cpu = <&A53_1>;
+};
+
+&cpu_debug4 {
+       cpu = <&A53_2>;
+};
+
+&cpu_debug5 {
+       cpu = <&A53_3>;
+};
index 0220494c9b80222d742fb1285e52d1a01a7066ba..c9236c4b967d2f461b91730e0b8f3f941b32d307 100644 (file)
                };
        };
 };
+
+&cpu_debug0 {
+       cpu = <&A57_0>;
+};
+
+&cpu_debug1 {
+       cpu = <&A57_1>;
+};
+
+&cpu_debug2 {
+       cpu = <&A53_0>;
+};
+
+&cpu_debug3 {
+       cpu = <&A53_1>;
+};
+
+&cpu_debug4 {
+       cpu = <&A53_2>;
+};
+
+&cpu_debug5 {
+       cpu = <&A53_3>;
+};
index bfa8f8e4c5af0643a9cff94917ccf932a5ee98cb..f11bdd6689ea96b2fce04404ae2166349c7d2c26 100644 (file)
@@ -1,6 +1,7 @@
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
 dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb ns2-xmc.dtb
 
+dts-dirs       := stingray
 always         := $(dtb-y)
 subdir-y       := $(dts-dirs)
 clean-files    := *.dtb
index c309633a1e87480ae5047f45116197e0adaad17a..972f14db28accd1f25e5d5cd9d7ce2854c9976c8 100644 (file)
 &uart1 {
        status = "okay";
 };
+
+/* SDHCI is used to control the SDIO for wireless */
+&sdhci {
+       pinctrl-names = "default";
+       pinctrl-0 = <&emmc_gpio34>;
+       status = "okay";
+       bus-width = <4>;
+       non-removable;
+};
+
+/* SDHOST is used to drive the SD card */
+&sdhost {
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdhost_gpio48>;
+       status = "okay";
+       bus-width = <4>;
+};
index 19f2fe620a21c7ec66bd97db84d7f4c047d5f6fe..2d5de6f0f78d5be78559477f18f0940bba3e5a15 100644 (file)
        interrupts = <8>;
 };
 
+&cpu_thermal {
+       coefficients = <(-538)  412000>;
+};
+
 /* enable thermal sensor with the correct compatible property set */
 &thermal {
        compatible = "brcm,bcm2837-thermal";
index 35a309ae3ed87767c9b7525f3c03a1ae6e9d9206..35c8457e3d1f23d32c3db46cbf43f95a3e1ef795 100644 (file)
                        };
                };
 
+               usbdrd_phy: phy@66000960 {
+                       #phy-cells = <0>;
+                       compatible = "brcm,ns2-drd-phy";
+                       reg = <0x66000960 0x24>,
+                             <0x67012800 0x4>,
+                             <0x6501d148 0x4>,
+                             <0x664d0700 0x4>;
+                       reg-names = "icfg", "rst-ctrl",
+                                   "crmu-ctrl", "usb2-strap";
+                       id-gpios = <&gpio_g 30 0>;
+                       vbus-gpios = <&gpio_g 31 0>;
+                       status = "disabled";
+               };
+
                pwm: pwm@66010000 {
                        compatible = "brcm,iproc-pwm";
                        reg = <0x66010000 0x28>;
diff --git a/arch/arm64/boot/dts/broadcom/stingray/Makefile b/arch/arm64/boot/dts/broadcom/stingray/Makefile
new file mode 100644 (file)
index 0000000..f70028e
--- /dev/null
@@ -0,0 +1,6 @@
+dtb-$(CONFIG_ARCH_BCM_IPROC) += bcm958742k.dtb
+dtb-$(CONFIG_ARCH_BCM_IPROC) += bcm958742t.dtb
+
+always         := $(dtb-y)
+subdir-y       := $(dts-dirs)
+clean-files    := *.dtb
diff --git a/arch/arm64/boot/dts/broadcom/stingray/bcm958742-base.dtsi b/arch/arm64/boot/dts/broadcom/stingray/bcm958742-base.dtsi
new file mode 100644 (file)
index 0000000..5dca7d1
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2016-2017 Broadcom.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "stingray.dtsi"
+
+/ {
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       aliases {
+               serial0 = &uart1;
+               serial1 = &uart0;
+               serial2 = &uart2;
+               serial3 = &uart3;
+       };
+
+       sdio0_vddo_ctrl_reg: sdio0_vddo_ctrl {
+               compatible = "regulator-gpio";
+               regulator-name = "sdio0_vddo_ctrl_reg";
+               regulator-type = "voltage";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+               gpios = <&pca9505 18 0>;
+               states = <3300000 0x0
+                         1800000 0x1>;
+       };
+
+       sdio1_vddo_ctrl_reg: sdio1_vddo_ctrl {
+               compatible = "regulator-gpio";
+               regulator-name = "sdio1_vddo_ctrl_reg";
+               regulator-type = "voltage";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+               gpios = <&pca9505 19 0>;
+               states = <3300000 0x0
+                         1800000 0x1>;
+       };
+};
+
+&memory { /* Default DRAM banks */
+       reg = <0x00000000 0x80000000 0x0 0x80000000>, /* 2G @ 2G */
+             <0x00000008 0x80000000 0x1 0x80000000>; /* 6G @ 34G */
+};
+
+&uart1 {
+       status = "okay";
+};
+
+&pwm {
+       status = "okay";
+};
+
+&i2c0 {
+       status = "okay";
+
+       pca9505: pca9505@20 {
+               compatible = "nxp,pca9505";
+               gpio-controller;
+               #gpio-cells = <2>;
+               reg = <0x20>;
+       };
+};
+
+&i2c1 {
+       status = "okay";
+
+       pcf8574: pcf8574@20 {
+               compatible = "nxp,pcf8574a";
+               gpio-controller;
+               #gpio-cells = <2>;
+               reg = <0x27>;
+       };
+};
+
+&nand {
+       status = "ok";
+       nandcs@0 {
+               compatible = "brcm,nandcs";
+               reg = <0>;
+               nand-ecc-mode = "hw";
+               nand-ecc-strength = <8>;
+               nand-ecc-step-size = <512>;
+               nand-bus-width = <16>;
+               brcm,nand-oob-sector-size = <16>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+};
+
+&sdio0 {
+       vqmmc-supply = <&sdio0_vddo_ctrl_reg>;
+       non-removable;
+       full-pwr-cycle;
+       status = "okay";
+};
+
+&sdio1 {
+       vqmmc-supply = <&sdio1_vddo_ctrl_reg>;
+       full-pwr-cycle;
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/broadcom/stingray/bcm958742k.dts b/arch/arm64/boot/dts/broadcom/stingray/bcm958742k.dts
new file mode 100644 (file)
index 0000000..5671669
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2016-2017 Broadcom.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/dts-v1/;
+
+#include "bcm958742-base.dtsi"
+
+/ {
+       compatible = "brcm,bcm958742k", "brcm,stingray";
+       model = "Stingray Combo SVK (BCM958742K)";
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&uart3 {
+       status = "okay";
+};
+
+&ssp0 {
+       pinctrl-0 = <&spi0_pins>;
+       pinctrl-names = "default";
+       cs-gpios = <&gpio_hsls 34 0>;
+       status = "okay";
+
+       spi-flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <20000000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+};
+
+&ssp1 {
+       pinctrl-0 = <&spi1_pins>;
+       pinctrl-names = "default";
+       cs-gpios = <&gpio_hsls 96 0>;
+       status = "okay";
+
+       spi-flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <20000000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+};
diff --git a/arch/arm64/boot/dts/broadcom/stingray/bcm958742t.dts b/arch/arm64/boot/dts/broadcom/stingray/bcm958742t.dts
new file mode 100644 (file)
index 0000000..6ebe399
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Broadcom.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/dts-v1/;
+
+#include "bcm958742-base.dtsi"
+
+/ {
+       compatible = "brcm,bcm958742t", "brcm,stingray";
+       model = "Stingray SST100 (BCM958742T)";
+};
diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-clock.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-clock.dtsi
new file mode 100644 (file)
index 0000000..cbc4337
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2016-2017 Broadcom.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <dt-bindings/clock/bcm-sr.h>
+
+               osc: oscillator {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <50000000>;
+               };
+
+               crmu_ref25m: crmu_ref25m {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&osc>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+               };
+
+               genpll0: genpll0@0001d104 {
+                       #clock-cells = <1>;
+                       compatible = "brcm,sr-genpll0";
+                       reg = <0x0001d104 0x32>,
+                             <0x0001c854 0x4>;
+                       clocks = <&osc>;
+                       clock-output-names = "genpll0", "clk_125", "clk_scr",
+                                            "clk_250", "clk_pcie_axi",
+                                            "clk_paxc_axi_x2",
+                                            "clk_paxc_axi";
+               };
+
+               genpll3: genpll3@0001d1e0 {
+                       #clock-cells = <1>;
+                       compatible = "brcm,sr-genpll3";
+                       reg = <0x0001d1e0 0x32>,
+                             <0x0001c854 0x4>;
+                       clocks = <&osc>;
+                       clock-output-names = "genpll3", "clk_hsls",
+                                            "clk_sdio";
+               };
+
+               genpll4: genpll4@0001d214 {
+                       #clock-cells = <1>;
+                       compatible = "brcm,sr-genpll4";
+                       reg = <0x0001d214 0x32>,
+                             <0x0001c854 0x4>;
+                       clocks = <&osc>;
+                       clock-output-names = "genpll4", "clk_ccn",
+                                            "clk_tpiu_pll", "noc_clk",
+                                            "pll_chclk_fs4",
+                                            "clk_bridge_fscpu";
+               };
+
+               genpll5: genpll5@0001d248 {
+                       #clock-cells = <1>;
+                       compatible = "brcm,sr-genpll5";
+                       reg = <0x0001d248 0x32>,
+                             <0x0001c870 0x4>;
+                       clocks = <&osc>;
+                       clock-output-names = "genpll5", "fs4_hf_clk",
+                                            "crypto_ae_clk", "raid_ae_clk";
+               };
+
+               lcpll0: lcpll0@0001d0c4 {
+                       #clock-cells = <1>;
+                       compatible = "brcm,sr-lcpll0";
+                       reg = <0x0001d0c4 0x3c>,
+                             <0x0001c870 0x4>;
+                       clocks = <&osc>;
+                       clock-output-names = "lcpll0", "clk_sata_refp",
+                                            "clk_sata_refn", "clk_sata_350",
+                                            "clk_sata_500";
+               };
+
+               lcpll1: lcpll1@0001d138 {
+                       #clock-cells = <1>;
+                       compatible = "brcm,sr-lcpll1";
+                       reg = <0x0001d138 0x3c>,
+                             <0x0001c870 0x4>;
+                       clocks = <&osc>;
+                       clock-output-names = "lcpll1", "clk_wanpn",
+                                            "clk_usb_ref",
+                                            "timesync_evt_clk";
+               };
+
+               hsls_clk: hsls_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&genpll3 1>;
+                       clock-div = <1>;
+                       clock-mult = <1>;
+               };
+
+               hsls_div2_clk: hsls_div2_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&genpll3 BCM_SR_GENPLL3_HSLS_CLK>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+
+               };
+
+               hsls_div4_clk: hsls_div4_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&genpll3 BCM_SR_GENPLL3_HSLS_CLK>;
+                       clock-div = <4>;
+                       clock-mult = <1>;
+               };
+
+               hsls_25m_clk: hsls_25m_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&crmu_ref25m>;
+                       clock-div = <1>;
+                       clock-mult = <1>;
+               };
+
+               hsls_25m_div2_clk: hsls_25m_div2_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&hsls_25m_clk>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+               };
+
+               sdio0_clk: sdio0_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&genpll3 BCM_SR_GENPLL3_SDIO_CLK>;
+                       clock-div = <1>;
+                       clock-mult = <1>;
+               };
+
+               sdio1_clk: sdio1_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clocks = <&genpll3 BCM_SR_GENPLL3_SDIO_CLK>;
+                       clock-div = <1>;
+                       clock-mult = <1>;
+               };
diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi
new file mode 100644 (file)
index 0000000..15214d0
--- /dev/null
@@ -0,0 +1,345 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2016-2017 Broadcom.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <dt-bindings/pinctrl/brcm,pinctrl-stingray.h>
+
+               pinconf: pinconf@00140000 {
+                       compatible = "pinconf-single";
+                       reg = <0x00140000 0x250>;
+                       pinctrl-single,register-width = <32>;
+
+                       /* pinconf functions */
+               };
+
+               pinmux: pinmux@0014029c {
+                       compatible = "pinctrl-single";
+                       reg = <0x0014029c 0x250>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       pinctrl-single,register-width = <32>;
+                       pinctrl-single,function-mask = <0xf>;
+                       pinctrl-single,gpio-range = <
+                               &range 0 154 MODE_GPIO
+                               >;
+                       range: gpio-range {
+                               #pinctrl-single,gpio-range-cells = <3>;
+                       };
+
+                       /* pinctrl functions */
+                       tsio_pins: pinmux_gpio_14 {
+                               pinctrl-single,pins = <
+                                       0x038 MODE_NITRO /* tsio_0 */
+                                       0x03c MODE_NITRO /* tsio_1 */
+                               >;
+                       };
+
+                       nor_pins: pinmux_pnor_adv_n {
+                               pinctrl-single,pins = <
+                                       0x0ac MODE_PNOR /* nand_ce1_n */
+                                       0x0b0 MODE_PNOR /* nand_ce0_n */
+                                       0x0b4 MODE_PNOR /* nand_we_n */
+                                       0x0b8 MODE_PNOR /* nand_wp_n */
+                                       0x0bc MODE_PNOR /* nand_re_n */
+                                       0x0c0 MODE_PNOR /* nand_rdy_bsy_n */
+                                       0x0c4 MODE_PNOR /* nand_io0_0 */
+                                       0x0c8 MODE_PNOR /* nand_io1_0 */
+                                       0x0cc MODE_PNOR /* nand_io2_0 */
+                                       0x0d0 MODE_PNOR /* nand_io3_0 */
+                                       0x0d4 MODE_PNOR /* nand_io4_0 */
+                                       0x0d8 MODE_PNOR /* nand_io5_0 */
+                                       0x0dc MODE_PNOR /* nand_io6_0 */
+                                       0x0e0 MODE_PNOR /* nand_io7_0 */
+                                       0x0e4 MODE_PNOR /* nand_io8_0 */
+                                       0x0e8 MODE_PNOR /* nand_io9_0 */
+                                       0x0ec MODE_PNOR /* nand_io10_0 */
+                                       0x0f0 MODE_PNOR /* nand_io11_0 */
+                                       0x0f4 MODE_PNOR /* nand_io12_0 */
+                                       0x0f8 MODE_PNOR /* nand_io13_0 */
+                                       0x0fc MODE_PNOR /* nand_io14_0 */
+                                       0x100 MODE_PNOR /* nand_io15_0 */
+                                       0x104 MODE_PNOR /* nand_ale_0 */
+                                       0x108 MODE_PNOR /* nand_cle_0 */
+                                       0x040 MODE_PNOR /* pnor_adv_n */
+                                       0x044 MODE_PNOR /* pnor_baa_n */
+                                       0x048 MODE_PNOR /* pnor_bls_0_n */
+                                       0x04c MODE_PNOR /* pnor_bls_1_n */
+                                       0x050 MODE_PNOR /* pnor_cre */
+                                       0x054 MODE_PNOR /* pnor_cs_2_n */
+                                       0x058 MODE_PNOR /* pnor_cs_1_n */
+                                       0x05c MODE_PNOR /* pnor_cs_0_n */
+                                       0x060 MODE_PNOR /* pnor_we_n */
+                                       0x064 MODE_PNOR /* pnor_oe_n */
+                                       0x068 MODE_PNOR /* pnor_intr */
+                                       0x06c MODE_PNOR /* pnor_dat_0 */
+                                       0x070 MODE_PNOR /* pnor_dat_1 */
+                                       0x074 MODE_PNOR /* pnor_dat_2 */
+                                       0x078 MODE_PNOR /* pnor_dat_3 */
+                                       0x07c MODE_PNOR /* pnor_dat_4 */
+                                       0x080 MODE_PNOR /* pnor_dat_5 */
+                                       0x084 MODE_PNOR /* pnor_dat_6 */
+                                       0x088 MODE_PNOR /* pnor_dat_7 */
+                                       0x08c MODE_PNOR /* pnor_dat_8 */
+                                       0x090 MODE_PNOR /* pnor_dat_9 */
+                                       0x094 MODE_PNOR /* pnor_dat_10 */
+                                       0x098 MODE_PNOR /* pnor_dat_11 */
+                                       0x09c MODE_PNOR /* pnor_dat_12 */
+                                       0x0a0 MODE_PNOR /* pnor_dat_13 */
+                                       0x0a4 MODE_PNOR /* pnor_dat_14 */
+                                       0x0a8 MODE_PNOR /* pnor_dat_15 */
+                               >;
+                       };
+
+                       nand_pins: pinmux_nand_ce1_n {
+                               pinctrl-single,pins = <
+                                       0x0ac MODE_NAND /* nand_ce1_n */
+                                       0x0b0 MODE_NAND /* nand_ce0_n */
+                                       0x0b4 MODE_NAND /* nand_we_n */
+                                       0x0b8 MODE_NAND /* nand_wp_n */
+                                       0x0bc MODE_NAND /* nand_re_n */
+                                       0x0c0 MODE_NAND /* nand_rdy_bsy_n */
+                                       0x0c4 MODE_NAND /* nand_io0_0 */
+                                       0x0c8 MODE_NAND /* nand_io1_0 */
+                                       0x0cc MODE_NAND /* nand_io2_0 */
+                                       0x0d0 MODE_NAND /* nand_io3_0 */
+                                       0x0d4 MODE_NAND /* nand_io4_0 */
+                                       0x0d8 MODE_NAND /* nand_io5_0 */
+                                       0x0dc MODE_NAND /* nand_io6_0 */
+                                       0x0e0 MODE_NAND /* nand_io7_0 */
+                                       0x0e4 MODE_NAND /* nand_io8_0 */
+                                       0x0e8 MODE_NAND /* nand_io9_0 */
+                                       0x0ec MODE_NAND /* nand_io10_0 */
+                                       0x0f0 MODE_NAND /* nand_io11_0 */
+                                       0x0f4 MODE_NAND /* nand_io12_0 */
+                                       0x0f8 MODE_NAND /* nand_io13_0 */
+                                       0x0fc MODE_NAND /* nand_io14_0 */
+                                       0x100 MODE_NAND /* nand_io15_0 */
+                                       0x104 MODE_NAND /* nand_ale_0 */
+                                       0x108 MODE_NAND /* nand_cle_0 */
+                               >;
+                       };
+
+                       pwm0_pins: pinmux_pwm_0 {
+                               pinctrl-single,pins = <
+                                       0x10c MODE_NITRO
+                               >;
+                       };
+
+                       pwm1_pins: pinmux_pwm_1 {
+                               pinctrl-single,pins = <
+                                       0x110 MODE_NITRO
+                               >;
+                       };
+
+                       pwm2_pins: pinmux_pwm_2 {
+                               pinctrl-single,pins = <
+                                       0x114 MODE_NITRO
+                               >;
+                       };
+
+                       pwm3_pins: pinmux_pwm_3 {
+                               pinctrl-single,pins = <
+                                       0x118 MODE_NITRO
+                               >;
+                       };
+
+                       dbu_rxd_pins: pinmux_uart1_sin_nitro {
+                               pinctrl-single,pins = <
+                                       0x11c MODE_NITRO /* dbu_rxd */
+                                       0x120 MODE_NITRO /* dbu_txd */
+                               >;
+                       };
+
+                       uart1_pins: pinmux_uart1_sin_nand {
+                               pinctrl-single,pins = <
+                                       0x11c MODE_NAND /* uart1_sin */
+                                       0x120 MODE_NAND /* uart1_out */
+                               >;
+                       };
+
+                       uart2_pins: pinmux_uart2_sin {
+                               pinctrl-single,pins = <
+                                       0x124 MODE_NITRO /* uart2_sin */
+                                       0x128 MODE_NITRO /* uart2_out */
+                               >;
+                       };
+
+                       uart3_pins: pinmux_uart3_sin {
+                               pinctrl-single,pins = <
+                                       0x12c MODE_NITRO /* uart3_sin */
+                                       0x130 MODE_NITRO /* uart3_out */
+                               >;
+                       };
+
+                       i2s_pins: pinmux_i2s_bitclk {
+                               pinctrl-single,pins = <
+                                       0x134 MODE_NITRO /* i2s_bitclk */
+                                       0x138 MODE_NITRO /* i2s_sdout */
+                                       0x13c MODE_NITRO /* i2s_sdin */
+                                       0x140 MODE_NITRO /* i2s_ws */
+                                       0x144 MODE_NITRO /* i2s_mclk */
+                                       0x148 MODE_NITRO /* i2s_spdif_out */
+                               >;
+                       };
+
+                       qspi_pins: pinumx_qspi_hold_n {
+                               pinctrl-single,pins = <
+                                       0x14c MODE_NAND /* qspi_hold_n */
+                                       0x150 MODE_NAND /* qspi_wp_n */
+                                       0x154 MODE_NAND /* qspi_sck */
+                                       0x158 MODE_NAND /* qspi_cs_n */
+                                       0x15c MODE_NAND /* qspi_mosi */
+                                       0x160 MODE_NAND /* qspi_miso */
+                               >;
+                       };
+
+                       mdio_pins: pinumx_ext_mdio {
+                               pinctrl-single,pins = <
+                                       0x164 MODE_NITRO /* ext_mdio */
+                                       0x168 MODE_NITRO /* ext_mdc */
+                               >;
+                       };
+
+                       i2c0_pins: pinmux_i2c0_sda {
+                               pinctrl-single,pins = <
+                                       0x16c MODE_NITRO /* i2c0_sda */
+                                       0x170 MODE_NITRO /* i2c0_scl */
+                               >;
+                       };
+
+                       i2c1_pins: pinmux_i2c1_sda {
+                               pinctrl-single,pins = <
+                                       0x174 MODE_NITRO /* i2c1_sda */
+                                       0x178 MODE_NITRO /* i2c1_scl */
+                               >;
+                       };
+
+                       sdio0_pins: pinmux_sdio0_cd_l {
+                               pinctrl-single,pins = <
+                                       0x17c MODE_NITRO /* sdio0_cd_l */
+                                       0x180 MODE_NITRO /* sdio0_clk_sdcard */
+                                       0x184 MODE_NITRO /* sdio0_data0 */
+                                       0x188 MODE_NITRO /* sdio0_data1 */
+                                       0x18c MODE_NITRO /* sdio0_data2 */
+                                       0x190 MODE_NITRO /* sdio0_data3 */
+                                       0x194 MODE_NITRO /* sdio0_data4 */
+                                       0x198 MODE_NITRO /* sdio0_data5 */
+                                       0x19c MODE_NITRO /* sdio0_data6 */
+                                       0x1a0 MODE_NITRO /* sdio0_data7 */
+                                       0x1a4 MODE_NITRO /* sdio0_cmd */
+                                       0x1a8 MODE_NITRO /* sdio0_emmc_rst_n */
+                                       0x1ac MODE_NITRO /* sdio0_led_on */
+                                       0x1b0 MODE_NITRO /* sdio0_wp */
+                               >;
+                       };
+
+                       sdio1_pins: pinmux_sdio1_cd_l {
+                               pinctrl-single,pins = <
+                                       0x1b4 MODE_NITRO /* sdio1_cd_l */
+                                       0x1b8 MODE_NITRO /* sdio1_clk_sdcard */
+                                       0x1bc MODE_NITRO /* sdio1_data0 */
+                                       0x1c0 MODE_NITRO /* sdio1_data1 */
+                                       0x1c4 MODE_NITRO /* sdio1_data2 */
+                                       0x1c8 MODE_NITRO /* sdio1_data3 */
+                                       0x1cc MODE_NITRO /* sdio1_data4 */
+                                       0x1d0 MODE_NITRO /* sdio1_data5 */
+                                       0x1d4 MODE_NITRO /* sdio1_data6 */
+                                       0x1d8 MODE_NITRO /* sdio1_data7 */
+                                       0x1dc MODE_NITRO /* sdio1_cmd */
+                                       0x1e0 MODE_NITRO /* sdio1_emmc_rst_n */
+                                       0x1e4 MODE_NITRO /* sdio1_led_on */
+                                       0x1e8 MODE_NITRO /* sdio1_wp */
+                               >;
+                       };
+
+                       spi0_pins: pinmux_spi0_sck_nand {
+                               pinctrl-single,pins = <
+                                       0x1ec MODE_NITRO /* spi0_sck */
+                                       0x1f0 MODE_NITRO /* spi0_rxd */
+                                       0x1f4 MODE_NITRO /* spi0_fss */
+                                       0x1f8 MODE_NITRO /* spi0_txd */
+                               >;
+                       };
+
+                       spi1_pins: pinmux_spi1_sck_nand {
+                               pinctrl-single,pins = <
+                                       0x1fc MODE_NITRO /* spi1_sck */
+                                       0x200 MODE_NITRO /* spi1_rxd */
+                                       0x204 MODE_NITRO /* spi1_fss */
+                                       0x208 MODE_NITRO /* spi1_txd */
+                               >;
+                       };
+
+                       nuart_pins: pinmux_uart0_sin_nitro {
+                               pinctrl-single,pins = <
+                                       0x20c MODE_NITRO /* nuart_rxd */
+                                       0x210 MODE_NITRO /* nuart_txd */
+                               >;
+                       };
+
+                       uart0_pins: pinumux_uart0_sin_nand {
+                               pinctrl-single,pins = <
+                                       0x20c MODE_NAND /* uart0_sin */
+                                       0x210 MODE_NAND /* uart0_out */
+                                       0x214 MODE_NAND /* uart0_rts */
+                                       0x218 MODE_NAND /* uart0_cts */
+                                       0x21c MODE_NAND /* uart0_dtr */
+                                       0x220 MODE_NAND /* uart0_dcd */
+                                       0x224 MODE_NAND /* uart0_dsr */
+                                       0x228 MODE_NAND /* uart0_ri */
+                               >;
+                       };
+
+                       drdu2_pins: pinmux_drdu2_overcurrent {
+                               pinctrl-single,pins = <
+                                       0x22c MODE_NITRO /* drdu2_overcurrent */
+                                       0x230 MODE_NITRO /* drdu2_vbus_ppc */
+                                       0x234 MODE_NITRO /* drdu2_vbus_present */
+                                       0x238 MODE_NITRO /* drdu2_id */
+                               >;
+                       };
+
+                       drdu3_pins: pinmux_drdu3_overcurrent {
+                               pinctrl-single,pins = <
+                                       0x23c MODE_NITRO /* drdu3_overcurrent */
+                                       0x240 MODE_NITRO /* drdu3_vbus_ppc */
+                                       0x244 MODE_NITRO /* drdu3_vbus_present */
+                                       0x248 MODE_NITRO /* drdu3_id */
+                               >;
+                       };
+
+                       usb3h_pins: pinmux_usb3h_overcurrent {
+                               pinctrl-single,pins = <
+                                       0x24c MODE_NITRO /* usb3h_overcurrent */
+                                       0x250 MODE_NITRO /* usb3h_vbus_ppc */
+                               >;
+                       };
+               };
diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi
new file mode 100644 (file)
index 0000000..49933cf
--- /dev/null
@@ -0,0 +1,460 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015-2017 Broadcom.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       compatible = "brcm,stingray";
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <2>;
+               #size-cells = <0>;
+
+               cpu@000 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x0>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER0_L2>;
+               };
+
+               cpu@001 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x1>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER0_L2>;
+               };
+
+               cpu@100 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x100>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER1_L2>;
+               };
+
+               cpu@101 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x101>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER1_L2>;
+               };
+
+               cpu@200 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x200>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER2_L2>;
+               };
+
+               cpu@201 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x201>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER2_L2>;
+               };
+
+               cpu@300 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x300>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER3_L2>;
+               };
+
+               cpu@301 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72", "arm,armv8";
+                       reg = <0x0 0x301>;
+                       enable-method = "psci";
+                       next-level-cache = <&CLUSTER3_L2>;
+               };
+
+               CLUSTER0_L2: l2-cache@000 {
+                       compatible = "cache";
+               };
+
+               CLUSTER1_L2: l2-cache@100 {
+                       compatible = "cache";
+               };
+
+               CLUSTER2_L2: l2-cache@200 {
+                       compatible = "cache";
+               };
+
+               CLUSTER3_L2: l2-cache@300 {
+                       compatible = "cache";
+               };
+       };
+
+       memory: memory@80000000 {
+               device_type = "memory";
+               reg = <0x00000000 0x80000000 0 0x40000000>;
+       };
+
+       psci {
+               compatible = "arm,psci-0.2";
+               method = "smc";
+       };
+
+       pmu {
+               compatible = "arm,armv8-pmuv3";
+               interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+       };
+
+       scr {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x0 0x0 0x61000000 0x05000000>;
+
+               gic: interrupt-controller@02c00000 {
+                       compatible = "arm,gic-v3";
+                       #interrupt-cells = <3>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+                       interrupt-controller;
+                       reg = <0x02c00000 0x010000>, /* GICD */
+                             <0x02e00000 0x600000>; /* GICR */
+                       interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+
+                       gic_its: gic-its@63c20000 {
+                               compatible = "arm,gic-v3-its";
+                               msi-controller;
+                               #msi-cells = <1>;
+                               reg = <0x02c20000 0x10000>;
+                       };
+               };
+
+               smmu: mmu@03000000 {
+                       compatible = "arm,mmu-500";
+                       reg = <0x03000000 0x80000>;
+                       #global-interrupts = <1>;
+                       interrupts = <GIC_SPI 704 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 711 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 712 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 713 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 714 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 715 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 716 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 717 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 718 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 719 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 720 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 721 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 722 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 723 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 724 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 725 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 726 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 727 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 728 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 729 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 730 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 731 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 732 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 733 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 734 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 735 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 736 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 737 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 738 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 739 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 740 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 741 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 742 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 743 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 744 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 745 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 746 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 747 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 748 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 749 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 750 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 751 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 752 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 753 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 754 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 755 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 756 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 757 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 758 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 759 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 760 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 761 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 762 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 763 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 764 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 765 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 766 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 767 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 768 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 769 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 770 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 771 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 772 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 773 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 774 IRQ_TYPE_LEVEL_HIGH>;
+                       #iommu-cells = <2>;
+               };
+       };
+
+       crmu: crmu {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x0 0x0 0x66400000 0x100000>;
+
+               #include "stingray-clock.dtsi"
+
+               gpio_crmu: gpio@00024800 {
+                       compatible = "brcm,iproc-gpio";
+                       reg = <0x00024800 0x4c>;
+                       ngpios = <6>;
+                       #gpio-cells = <2>;
+                       gpio-controller;
+               };
+       };
+
+       hsls {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x0 0x0 0x68900000 0x17700000>;
+
+               #include "stingray-pinctrl.dtsi"
+
+               pwm: pwm@00010000 {
+                       compatible = "brcm,iproc-pwm";
+                       reg = <0x00010000 0x1000>;
+                       clocks = <&crmu_ref25m>;
+                       #pwm-cells = <3>;
+                       status = "disabled";
+               };
+
+               i2c0: i2c@000b0000 {
+                       compatible = "brcm,iproc-i2c";
+                       reg = <0x000b0000 0x100>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <GIC_SPI 177 IRQ_TYPE_NONE>;
+                       clock-frequency = <100000>;
+                       status = "disabled";
+               };
+
+               wdt0: watchdog@000c0000 {
+                       compatible = "arm,sp805", "arm,primecell";
+                       reg = <0x000c0000 0x1000>;
+                       interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&hsls_25m_div2_clk>, <&hsls_div4_clk>;
+                       clock-names = "wdogclk", "apb_pclk";
+               };
+
+               gpio_hsls: gpio@000d0000 {
+                       compatible = "brcm,iproc-gpio";
+                       reg = <0x000d0000 0x864>;
+                       ngpios = <151>;
+                       #gpio-cells = <2>;
+                       gpio-controller;
+                       interrupt-controller;
+                       interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-ranges = <&pinmux 0 0 16>,
+                                       <&pinmux 16 71 2>,
+                                       <&pinmux 18 131 8>,
+                                       <&pinmux 26 83 6>,
+                                       <&pinmux 32 123 4>,
+                                       <&pinmux 36 43 24>,
+                                       <&pinmux 60 89 2>,
+                                       <&pinmux 62 73 4>,
+                                       <&pinmux 66 95 28>,
+                                       <&pinmux 94 127 4>,
+                                       <&pinmux 98 139 10>,
+                                       <&pinmux 108 16 27>,
+                                       <&pinmux 135 77 6>,
+                                       <&pinmux 141 67 4>,
+                                       <&pinmux 145 149 6>,
+                                       <&pinmux 151 91 4>;
+               };
+
+               i2c1: i2c@000e0000 {
+                       compatible = "brcm,iproc-i2c";
+                       reg = <0x000e0000 0x100>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <GIC_SPI 178 IRQ_TYPE_NONE>;
+                       clock-frequency = <100000>;
+                       status = "disabled";
+               };
+
+               uart0: uart@00100000 {
+                       device_type = "serial";
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x00100000 0x1000>;
+                       reg-shift = <2>;
+                       clock-frequency = <25000000>;
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               uart1: uart@00110000 {
+                       device_type = "serial";
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x00110000 0x1000>;
+                       reg-shift = <2>;
+                       clock-frequency = <25000000>;
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               uart2: uart@00120000 {
+                       device_type = "serial";
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x00120000 0x1000>;
+                       reg-shift = <2>;
+                       clock-frequency = <25000000>;
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_SPI 175 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               uart3: uart@00130000 {
+                       device_type = "serial";
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x00130000 0x1000>;
+                       reg-shift = <2>;
+                       clock-frequency = <25000000>;
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               ssp0: ssp@00180000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0x00180000 0x1000>;
+                       interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&hsls_div2_clk>, <&hsls_div2_clk>;
+                       clock-names = "spiclk", "apb_pclk";
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               ssp1: ssp@00190000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0x00190000 0x1000>;
+                       interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&hsls_div2_clk>, <&hsls_div2_clk>;
+                       clock-names = "spiclk", "apb_pclk";
+                       num-cs = <1>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               hwrng: hwrng@00220000 {
+                       compatible = "brcm,iproc-rng200";
+                       reg = <0x00220000 0x28>;
+               };
+
+               dma0: dma@00310000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0x00310000 0x1000>;
+                       interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <32>;
+                       clocks = <&hsls_div2_clk>;
+                       clock-names = "apb_pclk";
+                       iommus = <&smmu 0x6000 0x0000>;
+               };
+
+               nand: nand@00360000 {
+                       compatible = "brcm,nand-iproc", "brcm,brcmnand-v6.1";
+                       reg = <0x00360000 0x600>,
+                             <0x0050a408 0x600>,
+                             <0x00360f00 0x20>;
+                       reg-names = "nand", "iproc-idm", "iproc-ext";
+                       interrupts = <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       brcm,nand-has-wp;
+                       status = "disabled";
+               };
+
+               sdio0: sdhci@003f1000 {
+                       compatible = "brcm,sdhci-iproc";
+                       reg = <0x003f1000 0x100>;
+                       interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_HIGH>;
+                       bus-width = <8>;
+                       clocks = <&sdio0_clk>;
+                       iommus = <&smmu 0x6002 0x0000>;
+                       status = "disabled";
+               };
+
+               sdio1: sdhci@003f2000 {
+                       compatible = "brcm,sdhci-iproc";
+                       reg = <0x003f2000 0x100>;
+                       interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
+                       bus-width = <8>;
+                       clocks = <&sdio1_clk>;
+                       iommus = <&smmu 0x6003 0x0000>;
+                       status = "disabled";
+               };
+       };
+};
index 3ff95277a8ec92b8981ab5a1cfc65acf17ad5468..23191eb9397c364fde053a167aa2252b2fdb8c26 100644 (file)
@@ -60,7 +60,6 @@
                vci-supply = <&ldo28_reg>;
                reset-gpios = <&gpg0 0 GPIO_ACTIVE_LOW>;
                enable-gpios = <&gpf1 5 GPIO_ACTIVE_HIGH>;
-               te-gpios = <&gpf1 3 GPIO_ACTIVE_HIGH>;
        };
 };
 
index 17fae8112e4d96d610ea6623e8f7c29fee9f8f9d..7286b1ebfd7acc155c2ed9f75f1c70fa08ab5147 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree file for Freescale LS1012A Freedom Board.
  *
- * Copyright 2016, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPLv2 or the X11 license, at your option. Note that this dual
index e2a93d53d3d8dc77c0b205fc617bed1cb4c1679e..8c013b54db148a6abd8b10266407e4b44ca255a7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree file for Freescale LS1012A QDS Board.
  *
- * Copyright 2016, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPLv2 or the X11 license, at your option. Note that this dual
        status = "okay";
 };
 
+&esdhc0 {
+       status = "okay";
+};
+
+&esdhc1 {
+       status = "okay";
+};
+
 &i2c0 {
        status = "okay";
 
index ed77f6b0937b278dc2ed881f70682727fa98bf32..c1a119effa6156603d52df2e5d952541c6faef0d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree file for Freescale LS1012A RDB Board.
  *
- * Copyright 2016, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPLv2 or the X11 license, at your option. Note that this dual
        status = "okay";
 };
 
+&esdhc0 {
+       sd-uhs-sdr104;
+       sd-uhs-sdr50;
+       sd-uhs-sdr25;
+       sd-uhs-sdr12;
+       status = "okay";
+};
+
+&esdhc1 {
+       mmc-hs200-1_8v;
+       status = "okay";
+};
+
 &i2c0 {
        status = "okay";
 };
index b497ac196ccc1e5ea2c2dd9bff6194e9a751ab15..b1554cbd2c54f4ca08be37f7add0370758b288d9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1012A family SoC.
  *
- * Copyright 2016, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPLv2 or the X11 license, at your option. Note that this dual
        sysclk: sysclk {
                compatible = "fixed-clock";
                #clock-cells = <0>;
-               clock-frequency = <100000000>;
+               clock-frequency = <125000000>;
                clock-output-names = "sysclk";
        };
 
+       coreclk: coreclk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <100000000>;
+               clock-output-names = "coreclk";
+       };
+
        timer {
                compatible = "arm,armv8-timer";
                interrupts = <1 13 IRQ_TYPE_LEVEL_LOW>,/* Physical Secure PPI */
                #size-cells = <2>;
                ranges;
 
+               esdhc0: esdhc@1560000 {
+                       compatible = "fsl,ls1012a-esdhc", "fsl,esdhc";
+                       reg = <0x0 0x1560000 0x0 0x10000>;
+                       interrupts = <0 62 0x4>;
+                       clocks = <&clockgen 4 0>;
+                       voltage-ranges = <1800 1800 3300 3300>;
+                       sdhci,auto-cmd12;
+                       big-endian;
+                       bus-width = <4>;
+                       status = "disabled";
+               };
+
                scfg: scfg@1570000 {
                        compatible = "fsl,ls1012a-scfg", "syscon";
                        reg = <0x0 0x1570000 0x0 0x10000>;
                        big-endian;
                };
 
+               esdhc1: esdhc@1580000 {
+                       compatible = "fsl,ls1012a-esdhc", "fsl,esdhc";
+                       reg = <0x0 0x1580000 0x0 0x10000>;
+                       interrupts = <0 65 0x4>;
+                       clocks = <&clockgen 4 0>;
+                       voltage-ranges = <1800 1800 3300 3300>;
+                       sdhci,auto-cmd12;
+                       big-endian;
+                       broken-cd;
+                       bus-width = <4>;
+                       status = "disabled";
+               };
+
                crypto: crypto@1700000 {
                        compatible = "fsl,sec-v5.4", "fsl,sec-v5.0",
                                     "fsl,sec-v4.0";
                        compatible = "fsl,ls1012a-clockgen";
                        reg = <0x0 0x1ee1000 0x0 0x1000>;
                        #clock-cells = <2>;
-                       clocks = <&sysclk>;
+                       clocks = <&sysclk &coreclk>;
+                       clock-names = "sysclk", "coreclk";
                };
 
                tmu: tmu@1f00000 {
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi
new file mode 100644 (file)
index 0000000..169e171
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * QorIQ FMan v3 device tree nodes for ls1043
+ *
+ * Copyright 2015-2016 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+&soc {
+
+/* include used FMan blocks */
+#include "qoriq-fman3-0.dtsi"
+#include "qoriq-fman3-0-1g-0.dtsi"
+#include "qoriq-fman3-0-1g-1.dtsi"
+#include "qoriq-fman3-0-1g-2.dtsi"
+#include "qoriq-fman3-0-1g-3.dtsi"
+#include "qoriq-fman3-0-1g-4.dtsi"
+#include "qoriq-fman3-0-1g-5.dtsi"
+#include "qoriq-fman3-0-10g-0.dtsi"
+
+};
+
+&fman0 {
+       /* these aliases provide the FMan ports mapping */
+       enet0: ethernet@e0000 {
+       };
+
+       enet1: ethernet@e2000 {
+       };
+
+       enet2: ethernet@e4000 {
+       };
+
+       enet3: ethernet@e6000 {
+       };
+
+       enet4: ethernet@e8000 {
+       };
+
+       enet5: ethernet@ea000 {
+       };
+
+       enet6: ethernet@f0000 {
+       };
+};
index 0989d635b558fbcff75ea32ef3712c60caef0833..6341281485cfe5ed87bd124a2c60ed5f456e9c95 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1043A family SoC.
  *
- * Copyright 2014-2015, Freescale Semiconductor
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * Mingkai Hu <Mingkai.hu@freescale.com>
  *
                reg = <0>;
        };
 };
+
+#include "fsl-ls1043-post.dtsi"
index c37110bc1506842578ad6af60154c4158b3b2f9a..3dc0c8e9663d435a00c938efbf11385c63c9db09 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1043A family SoC.
  *
- * Copyright 2014-2015, Freescale Semiconductor
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * Mingkai Hu <Mingkai.hu@freescale.com>
  *
                reg = <0x4c>;
        };
        eeprom@52 {
-               compatible = "at24,24c512";
+               compatible = "atmel,24c512";
                reg = <0x52>;
        };
        eeprom@53 {
-               compatible = "at24,24c512";
+               compatible = "atmel,24c512";
                reg = <0x53>;
        };
        rtc@68 {
 &duart1 {
        status = "okay";
 };
+
+#include "fsl-ls1043-post.dtsi"
+
+&fman0 {
+       ethernet@e0000 {
+               phy-handle = <&qsgmii_phy1>;
+               phy-connection-type = "qsgmii";
+       };
+
+       ethernet@e2000 {
+               phy-handle = <&qsgmii_phy2>;
+               phy-connection-type = "qsgmii";
+       };
+
+       ethernet@e4000 {
+               phy-handle = <&rgmii_phy1>;
+               phy-connection-type = "rgmii-txid";
+       };
+
+       ethernet@e6000 {
+               phy-handle = <&rgmii_phy2>;
+               phy-connection-type = "rgmii-txid";
+       };
+
+       ethernet@e8000 {
+               phy-handle = <&qsgmii_phy3>;
+               phy-connection-type = "qsgmii";
+       };
+
+       ethernet@ea000 {
+               phy-handle = <&qsgmii_phy4>;
+               phy-connection-type = "qsgmii";
+       };
+
+       ethernet@f0000 { /* 10GEC1 */
+               phy-handle = <&aqr105_phy>;
+               phy-connection-type = "xgmii";
+       };
+
+       mdio@fc000 {
+               rgmii_phy1: ethernet-phy@1 {
+                       reg = <0x1>;
+               };
+
+               rgmii_phy2: ethernet-phy@2 {
+                       reg = <0x2>;
+               };
+
+               qsgmii_phy1: ethernet-phy@4 {
+                       reg = <0x4>;
+               };
+
+               qsgmii_phy2: ethernet-phy@5 {
+                       reg = <0x5>;
+               };
+
+               qsgmii_phy3: ethernet-phy@6 {
+                       reg = <0x6>;
+               };
+
+               qsgmii_phy4: ethernet-phy@7 {
+                       reg = <0x7>;
+               };
+       };
+
+       mdio@fd000 {
+               aqr105_phy: ethernet-phy@1 {
+                       compatible = "ethernet-phy-ieee802.3-c45";
+                       interrupts = <0 132 4>;
+                       reg = <0x1>;
+               };
+       };
+};
index 45cface08cbbf6ae74537d01e6207987e190c5db..31fd77f82ced81364e9634165d692193972b00a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1043A family SoC.
  *
- * Copyright 2014-2015, Freescale Semiconductor
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * Mingkai Hu <Mingkai.hu@freescale.com>
  *
@@ -45,6 +45,7 @@
  */
 
 #include <dt-bindings/thermal/thermal.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
 
 / {
        compatible = "fsl,ls1043a";
        #address-cells = <2>;
        #size-cells = <2>;
 
+       aliases {
+               fman0 = &fman0;
+               ethernet0 = &enet0;
+               ethernet1 = &enet1;
+               ethernet2 = &enet2;
+               ethernet3 = &enet3;
+               ethernet4 = &enet4;
+               ethernet5 = &enet5;
+               ethernet6 = &enet6;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                      /* DRAM space 1, size: 2GiB DRAM */
        };
 
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               bman_fbpr: bman-fbpr {
+                       compatible = "shared-dma-pool";
+                       size = <0 0x1000000>;
+                       alignment = <0 0x1000000>;
+                       no-map;
+               };
+
+               qman_fqd: qman-fqd {
+                       compatible = "shared-dma-pool";
+                       size = <0 0x400000>;
+                       alignment = <0 0x400000>;
+                       no-map;
+               };
+
+               qman_pfdr: qman-pfdr {
+                       compatible = "shared-dma-pool";
+                       size = <0 0x2000000>;
+                       alignment = <0 0x2000000>;
+                       no-map;
+               };
+       };
+
        sysclk: sysclk {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                interrupts = <1 9 0xf08>;
        };
 
-       soc {
+       soc: soc {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                ifc: ifc@1530000 {
                        compatible = "fsl,ifc", "simple-bus";
                        reg = <0x0 0x1530000 0x0 0x10000>;
+                       big-endian;
                        interrupts = <0 43 0x4>;
                };
 
                        };
                };
 
+               qman: qman@1880000 {
+                       compatible = "fsl,qman";
+                       reg = <0x0 0x1880000 0x0 0x10000>;
+                       interrupts = <0 45 0x4>;
+                       memory-region = <&qman_fqd &qman_pfdr>;
+               };
+
+               bman: bman@1890000 {
+                       compatible = "fsl,bman";
+                       reg = <0x0 0x1890000 0x0 0x10000>;
+                       interrupts = <0 45 0x4>;
+                       memory-region = <&bman_fbpr>;
+               };
+
+               bportals: bman-portals@508000000 {
+                       ranges = <0x0 0x5 0x08000000 0x8000000>;
+               };
+
+               qportals: qman-portals@500000000 {
+                       ranges = <0x0 0x5 0x00000000 0x8000000>;
+               };
+
                dspi0: dspi@2100000 {
                        compatible = "fsl,ls1043a-dspi", "fsl,ls1021a-v1.0-dspi";
                        #address-cells = <1>;
        };
 
 };
+
+#include "qoriq-qman-portals.dtsi"
+#include "qoriq-bman-portals.dtsi"
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi
new file mode 100644 (file)
index 0000000..f5017db
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * QorIQ FMan v3 device tree nodes for ls1046
+ *
+ * Copyright 2015-2016 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+&soc {
+
+/* include used FMan blocks */
+#include "qoriq-fman3-0.dtsi"
+#include "qoriq-fman3-0-1g-0.dtsi"
+#include "qoriq-fman3-0-1g-1.dtsi"
+#include "qoriq-fman3-0-1g-2.dtsi"
+#include "qoriq-fman3-0-1g-3.dtsi"
+#include "qoriq-fman3-0-1g-4.dtsi"
+#include "qoriq-fman3-0-1g-5.dtsi"
+#include "qoriq-fman3-0-10g-0.dtsi"
+#include "qoriq-fman3-0-10g-1.dtsi"
+};
+
+&fman0 {
+       /* these aliases provide the FMan ports mapping */
+       enet0: ethernet@e0000 {
+       };
+
+       enet1: ethernet@e2000 {
+       };
+
+       enet2: ethernet@e4000 {
+       };
+
+       enet3: ethernet@e6000 {
+       };
+
+       enet4: ethernet@e8000 {
+       };
+
+       enet5: ethernet@ea000 {
+       };
+
+       enet6: ethernet@f0000 {
+       };
+
+       enet7: ethernet@f2000 {
+       };
+};
index 290e5b014414ffd2240eae5e90a6ad5ee28469da..434383bade0edc50df2b9176ae37e1961b7fc90b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1046A family SoC.
  *
- * Copyright 2016, Freescale Semiconductor, Inc.
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * Shaohui Xie <Shaohui.Xie@nxp.com>
  *
                reg = <0>;
        };
 };
+
+#include "fsl-ls1046-post.dtsi"
index d1ccc000d05aa42bf1ecbb8fe23cd6f0646ac909..5dc2782e2a58e785c8ec0263d2f2faafe9c07987 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1046A family SoC.
  *
- * Copyright 2016, Freescale Semiconductor, Inc.
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * Mingkai Hu <mingkai.hu@nxp.com>
  *
        status = "okay";
 };
 
+&esdhc {
+       mmc-hs200-1_8v;
+       sd-uhs-sdr104;
+       sd-uhs-sdr50;
+       sd-uhs-sdr25;
+       sd-uhs-sdr12;
+};
+
 &i2c0 {
        status = "okay";
 
                reg = <1>;
        };
 };
+
+#include "fsl-ls1046-post.dtsi"
+
+&fman0 {
+       ethernet@e4000 {
+               phy-handle = <&rgmii_phy1>;
+               phy-connection-type = "rgmii";
+       };
+
+       ethernet@e6000 {
+               phy-handle = <&rgmii_phy2>;
+               phy-connection-type = "rgmii";
+       };
+
+       ethernet@e8000 {
+               phy-handle = <&sgmii_phy1>;
+               phy-connection-type = "sgmii";
+       };
+
+       ethernet@ea000 {
+               phy-handle = <&sgmii_phy2>;
+               phy-connection-type = "sgmii";
+       };
+
+       ethernet@f0000 { /* 10GEC1 */
+               phy-handle = <&aqr106_phy>;
+               phy-connection-type = "xgmii";
+       };
+
+       ethernet@f2000 { /* 10GEC2 */
+               fixed-link = <0 1 1000 0 0>;
+               phy-connection-type = "xgmii";
+       };
+
+       mdio@fc000 {
+               rgmii_phy1: ethernet-phy@1 {
+                       reg = <0x1>;
+               };
+
+               rgmii_phy2: ethernet-phy@2 {
+                       reg = <0x2>;
+               };
+
+               sgmii_phy1: ethernet-phy@3 {
+                       reg = <0x3>;
+               };
+
+               sgmii_phy2: ethernet-phy@4 {
+                       reg = <0x4>;
+               };
+       };
+
+       mdio@fd000 {
+               aqr106_phy: ethernet-phy@0 {
+                       compatible = "ethernet-phy-ieee802.3-c45";
+                       interrupts = <0 131 4>;
+                       reg = <0x0>;
+               };
+       };
+};
index f4b8b7edaf9dbad72c1256fc6a220463ff5c3c19..dc1640be0345d3be0b0a601421edc7b5cbb9f433 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-1046A family SoC.
  *
- * Copyright 2016, Freescale Semiconductor, Inc.
+ * Copyright 2016 Freescale Semiconductor, Inc.
  *
  * Mingkai Hu <mingkai.hu@nxp.com>
  *
 
        aliases {
                crypto = &crypto;
+               fman0 = &fman0;
+               ethernet0 = &enet0;
+               ethernet1 = &enet1;
+               ethernet2 = &enet2;
+               ethernet3 = &enet3;
+               ethernet4 = &enet4;
+               ethernet5 = &enet5;
+               ethernet6 = &enet6;
+               ethernet7 = &enet7;
        };
 
        cpus {
                                         IRQ_TYPE_LEVEL_LOW)>;
        };
 
-       soc {
+       soc: soc {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                ifc: ifc@1530000 {
                        compatible = "fsl,ifc", "simple-bus";
                        reg = <0x0 0x1530000 0x0 0x10000>;
+                       big-endian;
                        interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
                };
 
                };
 
                esdhc: esdhc@1560000 {
-                       compatible = "fsl,esdhc";
+                       compatible = "fsl,ls1046a-esdhc", "fsl,esdhc";
                        reg = <0x0 0x1560000 0x0 0x10000>;
                        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
-                       clock-frequency = <0>;
+                       clocks = <&clockgen 2 1>;
                        voltage-ranges = <1800 1800 3300 3300>;
                        sdhci,auto-cmd12;
                        big-endian;
                        };
                };
 
+               qman: qman@1880000 {
+                       compatible = "fsl,qman";
+                       reg = <0x0 0x1880000 0x0 0x10000>;
+                       interrupts = <0 45 0x4>;
+                       memory-region = <&qman_fqd &qman_pfdr>;
+
+               };
+
+               bman: bman@1890000 {
+                       compatible = "fsl,bman";
+                       reg = <0x0 0x1890000 0x0 0x10000>;
+                       interrupts = <0 45 0x4>;
+                       memory-region = <&bman_fbpr>;
+
+               };
+
+               qportals: qman-portals@500000000 {
+                       ranges = <0x0 0x5 0x00000000 0x8000000>;
+               };
+
+               bportals: bman-portals@508000000 {
+                       ranges = <0x0 0x5 0x08000000 0x8000000>;
+               };
+
                dcfg: dcfg@1ee0000 {
                        compatible = "fsl,ls1046a-dcfg", "syscon";
                        reg = <0x0 0x1ee0000 0x0 0x10000>;
                        interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
                        dr_mode = "host";
                        snps,quirk-frame-length-adjustment = <0x20>;
+                       snps,dis_rxdet_inp3_quirk;
                };
 
                usb1: usb@3000000 {
                        interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
                        dr_mode = "host";
                        snps,quirk-frame-length-adjustment = <0x20>;
+                       snps,dis_rxdet_inp3_quirk;
                };
 
                usb2: usb@3100000 {
                        interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
                        dr_mode = "host";
                        snps,quirk-frame-length-adjustment = <0x20>;
+                       snps,dis_rxdet_inp3_quirk;
                };
 
                sata: sata@3200000 {
                        clocks = <&clockgen 4 1>;
                };
        };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               bman_fbpr: bman-fbpr {
+                       compatible = "shared-dma-pool";
+                       size = <0 0x1000000>;
+                       alignment = <0 0x1000000>;
+                       no-map;
+               };
+
+               qman_fqd: qman-fqd {
+                       compatible = "shared-dma-pool";
+                       size = <0 0x800000>;
+                       alignment = <0 0x800000>;
+                       no-map;
+               };
+
+               qman_pfdr: qman-pfdr {
+                       compatible = "shared-dma-pool";
+                       size = <0 0x2000000>;
+                       alignment = <0 0x2000000>;
+                       no-map;
+               };
+       };
 };
+
+#include "qoriq-qman-portals.dtsi"
+#include "qoriq-bman-portals.dtsi"
index 8c3cae530f8ff195ee35523669eae36edb62b67b..30128051d0c02ea3da6b61dc0b352a0216955eed 100644 (file)
        };
 };
 
+&ifc {
+       ranges = <0 0 0x5 0x80000000 0x08000000
+                 2 0 0x5 0x30000000 0x00010000
+                 3 0 0x5 0x20000000 0x00010000>;
+       status = "okay";
+
+       nor@0,0 {
+               compatible = "cfi-flash";
+               reg = <0x0 0x0 0x8000000>;
+               bank-width = <2>;
+               device-width = <1>;
+       };
+
+       nand@2,0 {
+               compatible = "fsl,ifc-nand";
+               reg = <0x2 0x0 0x10000>;
+       };
+
+       fpga: board-control@3,0 {
+               compatible = "fsl,ls1088aqds-fpga", "fsl,fpga-qixis";
+               reg = <0x3 0x0 0x0000100>;
+       };
+};
+
 &duart0 {
        status = "okay";
 };
        status = "okay";
 };
 
+&esdhc {
+       status = "okay";
+};
+
 &sata {
        status = "okay";
 };
index 8a04fbb25cb49939a1a7c26e43bbb51afb118084..213abb72de93e90891b42263adf06854fa1f9fdd 100644 (file)
        };
 };
 
+&ifc {
+       ranges = <0 0 0x5 0x30000000 0x00010000
+                 2 0 0x5 0x20000000 0x00010000>;
+       status = "okay";
+
+       nand@0,0 {
+               compatible = "fsl,ifc-nand";
+               reg = <0x0 0x0 0x10000>;
+       };
+
+       fpga: board-control@2,0 {
+               compatible = "fsl,ls1088ardb-fpga", "fsl,fpga-qixis";
+               reg = <0x2 0x0 0x0000100>;
+       };
+};
+
 &duart0 {
        status = "okay";
 };
        status = "okay";
 };
 
+&esdhc {
+       status = "okay";
+};
+
 &sata {
        status = "okay";
 };
index 2946fd79712148a1fd2d9d7817113e9a291830cc..c144d06a6e33150c313580b7144d6ededa08cf06 100644 (file)
@@ -44,6 +44,7 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
        compatible = "fsl,ls1088a";
@@ -61,6 +62,7 @@
                        compatible = "arm,cortex-a53";
                        reg = <0x0>;
                        clocks = <&clockgen 1 0>;
+                       #cooling-cells = <2>;
                };
 
                cpu1: cpu@1 {
@@ -89,6 +91,7 @@
                        compatible = "arm,cortex-a53";
                        reg = <0x100>;
                        clocks = <&clockgen 1 1>;
+                       #cooling-cells = <2>;
                };
 
                cpu5: cpu@101 {
                        clocks = <&sysclk>;
                };
 
+               tmu: tmu@1f80000 {
+                       compatible = "fsl,qoriq-tmu";
+                       reg = <0x0 0x1f80000 0x0 0x10000>;
+                       interrupts = <0 23 0x4>;
+                       fsl,tmu-range = <0xb0000 0x9002a 0x6004c 0x30062>;
+                       fsl,tmu-calibration =
+                               /* Calibration data group 1 */
+                               <0x00000000 0x00000026
+                               0x00000001 0x0000002d
+                               0x00000002 0x00000032
+                               0x00000003 0x00000039
+                               0x00000004 0x0000003f
+                               0x00000005 0x00000046
+                               0x00000006 0x0000004d
+                               0x00000007 0x00000054
+                               0x00000008 0x0000005a
+                               0x00000009 0x00000061
+                               0x0000000a 0x0000006a
+                               0x0000000b 0x00000071
+                               /* Calibration data group 2 */
+                               0x00010000 0x00000025
+                               0x00010001 0x0000002c
+                               0x00010002 0x00000035
+                               0x00010003 0x0000003d
+                               0x00010004 0x00000045
+                               0x00010005 0x0000004e
+                               0x00010006 0x00000057
+                               0x00010007 0x00000061
+                               0x00010008 0x0000006b
+                               0x00010009 0x00000076
+                               /* Calibration data group 3 */
+                               0x00020000 0x00000029
+                               0x00020001 0x00000033
+                               0x00020002 0x0000003d
+                               0x00020003 0x00000049
+                               0x00020004 0x00000056
+                               0x00020005 0x00000061
+                               0x00020006 0x0000006d
+                               /* Calibration data group 4 */
+                               0x00030000 0x00000021
+                               0x00030001 0x0000002a
+                               0x00030002 0x0000003c
+                               0x00030003 0x0000004e>;
+                       little-endian;
+                       #thermal-sensor-cells = <1>;
+               };
+
+               thermal-zones {
+                       cpu_thermal: cpu-thermal {
+                               polling-delay-passive = <1000>;
+                               polling-delay = <5000>;
+                               thermal-sensors = <&tmu 0>;
+
+                               trips {
+                                       cpu_alert: cpu-alert {
+                                               temperature = <85000>;
+                                               hysteresis = <2000>;
+                                               type = "passive";
+                                       };
+
+                                       cpu_crit: cpu-crit {
+                                               temperature = <95000>;
+                                               hysteresis = <2000>;
+                                               type = "critical";
+                                       };
+                               };
+
+                               cooling-maps {
+                                       map0 {
+                                               trip = <&cpu_alert>;
+                                               cooling-device =
+                                                       <&cpu0 THERMAL_NO_LIMIT
+                                                       THERMAL_NO_LIMIT>;
+                                       };
+
+                                       map1 {
+                                               trip = <&cpu_alert>;
+                                               cooling-device =
+                                                       <&cpu4 THERMAL_NO_LIMIT
+                                                       THERMAL_NO_LIMIT>;
+                                       };
+                               };
+                       };
+               };
+
                duart0: serial@21c0500 {
                        compatible = "fsl,ns16550", "ns16550a";
                        reg = <0x0 0x21c0500 0x0 0x100>;
                        little-endian;
                        #address-cells = <2>;
                        #size-cells = <1>;
-
-                       ranges = <0 0 0x5 0x80000000 0x08000000
-                                 2 0 0x5 0x30000000 0x00010000
-                                 3 0 0x5 0x20000000 0x00010000>;
                        status = "disabled";
                };
 
                        status = "disabled";
                };
 
+               esdhc: esdhc@2140000 {
+                       compatible = "fsl,ls1088a-esdhc", "fsl,esdhc";
+                       reg = <0x0 0x2140000 0x0 0x10000>;
+                       interrupts = <0 28 0x4>; /* Level high type */
+                       clock-frequency = <0>;
+                       voltage-ranges = <1800 1800 3300 3300>;
+                       sdhci,auto-cmd12;
+                       little-endian;
+                       bus-width = <4>;
+                       status = "disabled";
+               };
+
                sata: sata@3200000 {
-                       compatible = "fsl,ls1088a-ahci", "fsl,ls1043a-ahci";
-                       reg = <0x0 0x3200000 0x0 0x10000>;
+                       compatible = "fsl,ls1088a-ahci";
+                       reg = <0x0 0x3200000 0x0 0x10000>,
+                               <0x7 0x100520 0x0 0x4>;
+                       reg-names = "ahci", "sata-ecc";
                        interrupts = <0 133 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clockgen 4 3>;
+                       dma-coherent;
                        status = "disabled";
                };
        };
index c1e76dfca48efe22fe6d0686a14d7573abc4ffaf..ed209cd57283b66cc8d69640e696d9b3a6ee2935 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree file for Freescale LS2080a QDS Board.
  *
- * Copyright (C) 2015-17, Freescale Semiconductor
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  * Bhupesh Sharma <bhupesh.sharma@freescale.com>
index 18ad1958731175f6bc33f733e6d1e503bbb9bcfd..67ec3f9c81a14848255bed4d2f90dc00581d59f7 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree file for Freescale LS2080a RDB Board.
  *
- * Copyright (C) 2016-17, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  * Bhupesh Sharma <bhupesh.sharma@freescale.com>
index 290604b0a603ba80eec4f90f0520f47f436820b8..3ee718f0aaf85577866203e30189420934f8c5f9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree file for Freescale LS2080a software Simulator model
  *
- * Copyright (C) 2014-2015, Freescale Semiconductor
+ * Copyright 2014-2015 Freescale Semiconductor, Inc.
  *
  * Bhupesh Sharma <bhupesh.sharma@freescale.com>
  *
index 46a26c0214219c26a1e50527db55cfab2618a97a..d789c6814e6a57fd6e7b0d1e8e4700fd8ce2e7a7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Device Tree Include file for Freescale Layerscape-2080A family SoC.
  *
- * Copyright (C) 2014-2016, Freescale Semiconductor
+ * Copyright 2014-2016 Freescale Semiconductor, Inc.
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  * Bhupesh Sharma <bhupesh.sharma@freescale.com>
index ebcd6ee4da0d6daa04f6f8a43889221107a8e942..4a1df5ce3229c55d3f8ab62622792d6f9bf88219 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree file for Freescale LS2088A QDS Board.
  *
- * Copyright (C) 2016-17, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  *
index 5992dc130faa0f0e2ea70dbcd11ea2cea6a8b072..a76d4b4debd16cf7ff887f1d5d5f08213a4ea767 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree file for Freescale LS2088A RDB Board.
  *
- * Copyright (C) 2016-17, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  *
index 33ce404cf7e4fa0837cbe6933397f9f8c6bf87f1..5c695c6580566020a647f7bbe80efef7df227131 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree Include file for Freescale Layerscape-2088A family SoC.
  *
- * Copyright (C) 2016-17, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  *
index 8b62048459738b5bf55915ec51ae465234fbee33..b2374469a830101f64e0212e5510513b6ea3b30b 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree file for Freescale LS2080A QDS Board.
  *
- * Copyright (C) 2016-17, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  *
@@ -45,6 +46,7 @@
  */
 
 &esdhc {
+       mmc-hs200-1_8v;
        status = "okay";
 };
 
index 3737587ffb339de116c661606a69e5b99994a4ec..9a1d0d2ab1c3fdefbb8dec4e3732f3c3d6030c3c 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree file for Freescale LS2080A RDB Board.
  *
- * Copyright (C) 2016-17, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  *
index abb2fff7d1629757f42638688c3b36fc704820c1..94cdd30450371ada8dec5dd0fd1ef398b30d30d0 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Device Tree Include file for Freescale Layerscape-2080A family SoC.
  *
- * Copyright (C) 2016-2017, Freescale Semiconductor
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Abhimanyu Saini <abhimanyu.saini@nxp.com>
  *
                        compatible = "fsl,ls2080a-esdhc", "fsl,esdhc";
                        reg = <0x0 0x2140000 0x0 0x10000>;
                        interrupts = <0 28 0x4>; /* Level high type */
-                       clock-frequency = <0>;  /* Updated by bootloader */
+                       clocks = <&clockgen 4 1>;
                        voltage-ranges = <1800 1800 3300 3300>;
                        sdhci,auto-cmd12;
                        little-endian;
diff --git a/arch/arm64/boot/dts/freescale/qoriq-bman-portals.dtsi b/arch/arm64/boot/dts/freescale/qoriq-bman-portals.dtsi
new file mode 100644 (file)
index 0000000..c3c2be4
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * QorIQ BMan Portals device tree
+ *
+ * Copyright 2011-2016 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+&bportals {
+       #address-cells = <1>;
+       #size-cells = <1>;
+       compatible = "simple-bus";
+
+       bman-portal@0 {
+               /*
+                * bootloader fix-ups are expected to provide the
+                * "fsl,bman-portal-<hardware revision>" compatible
+                */
+               compatible = "fsl,bman-portal";
+               reg = <0x0 0x4000>, <0x4000000 0x4000>;
+               interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@10000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x10000 0x4000>, <0x4010000 0x4000>;
+               interrupts = <GIC_SPI 175 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@20000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x20000 0x4000>, <0x4020000 0x4000>;
+               interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@30000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x30000 0x4000>, <0x4030000 0x4000>;
+               interrupts = <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@40000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x40000 0x4000>, <0x4040000 0x4000>;
+               interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@50000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x50000 0x4000>, <0x4050000 0x4000>;
+               interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@60000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x60000 0x4000>, <0x4060000 0x4000>;
+               interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@70000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x70000 0x4000>, <0x4070000 0x4000>;
+               interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       bman-portal@80000 {
+               compatible = "fsl,bman-portal";
+               reg = <0x80000 0x4000>, <0x4080000 0x4000>;
+               interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-10g-0.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-10g-0.dtsi
new file mode 100644 (file)
index 0000000..ecdffe7
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * QorIQ FMan v3 10g port #0 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x10: port@90000 {
+               cell-index = <0x10>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x90000 0x1000>;
+               fsl,fman-10g-port;
+       };
+
+       fman0_tx_0x30: port@b0000 {
+               cell-index = <0x30>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xb0000 0x1000>;
+               fsl,fman-10g-port;
+       };
+
+       ethernet@f0000 {
+               cell-index = <0x8>;
+               compatible = "fsl,fman-memac";
+               reg = <0xf0000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x10 &fman0_tx_0x30>;
+               pcsphy-handle = <&pcsphy6>;
+       };
+
+       mdio@f1000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xf1000 0x1000>;
+
+               pcsphy6: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-10g-1.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-10g-1.dtsi
new file mode 100644 (file)
index 0000000..a7f6af5
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * QorIQ FMan v3 10g port #1 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x11: port@91000 {
+               cell-index = <0x11>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x91000 0x1000>;
+               fsl,fman-10g-port;
+       };
+
+       fman0_tx_0x31: port@b1000 {
+               cell-index = <0x31>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xb1000 0x1000>;
+               fsl,fman-10g-port;
+       };
+
+       ethernet@f2000 {
+               cell-index = <0x9>;
+               compatible = "fsl,fman-memac";
+               reg = <0xf2000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x11 &fman0_tx_0x31>;
+               pcsphy-handle = <&pcsphy7>;
+       };
+
+       mdio@f3000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xf3000 0x1000>;
+
+               pcsphy7: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-0.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-0.dtsi
new file mode 100644 (file)
index 0000000..d600786
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QorIQ FMan v3 1g port #0 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x08: port@88000 {
+               cell-index = <0x8>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x88000 0x1000>;
+       };
+
+       fman0_tx_0x28: port@a8000 {
+               cell-index = <0x28>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xa8000 0x1000>;
+       };
+
+       ethernet@e0000 {
+               cell-index = <0>;
+               compatible = "fsl,fman-memac";
+               reg = <0xe0000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
+               ptp-timer = <&ptp_timer0>;
+               pcsphy-handle = <&pcsphy0>;
+       };
+
+       mdio@e1000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xe1000 0x1000>;
+
+               pcsphy0: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-1.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-1.dtsi
new file mode 100644 (file)
index 0000000..3c0b76d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QorIQ FMan v3 1g port #1 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x09: port@89000 {
+               cell-index = <0x9>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x89000 0x1000>;
+       };
+
+       fman0_tx_0x29: port@a9000 {
+               cell-index = <0x29>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xa9000 0x1000>;
+       };
+
+       ethernet@e2000 {
+               cell-index = <1>;
+               compatible = "fsl,fman-memac";
+               reg = <0xe2000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
+               ptp-timer = <&ptp_timer0>;
+               pcsphy-handle = <&pcsphy1>;
+       };
+
+       mdio@e3000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xe3000 0x1000>;
+
+               pcsphy1: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-2.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-2.dtsi
new file mode 100644 (file)
index 0000000..89633af
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QorIQ FMan v3 1g port #2 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x0a: port@8a000 {
+               cell-index = <0xa>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x8a000 0x1000>;
+       };
+
+       fman0_tx_0x2a: port@aa000 {
+               cell-index = <0x2a>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xaa000 0x1000>;
+       };
+
+       ethernet@e4000 {
+               cell-index = <2>;
+               compatible = "fsl,fman-memac";
+               reg = <0xe4000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x0a &fman0_tx_0x2a>;
+               ptp-timer = <&ptp_timer0>;
+               pcsphy-handle = <&pcsphy2>;
+       };
+
+       mdio@e5000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xe5000 0x1000>;
+
+               pcsphy2: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-3.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-3.dtsi
new file mode 100644 (file)
index 0000000..87c2b70
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QorIQ FMan v3 1g port #3 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x0b: port@8b000 {
+               cell-index = <0xb>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x8b000 0x1000>;
+       };
+
+       fman0_tx_0x2b: port@ab000 {
+               cell-index = <0x2b>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xab000 0x1000>;
+       };
+
+       ethernet@e6000 {
+               cell-index = <3>;
+               compatible = "fsl,fman-memac";
+               reg = <0xe6000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x0b &fman0_tx_0x2b>;
+               ptp-timer = <&ptp_timer0>;
+               pcsphy-handle = <&pcsphy3>;
+       };
+
+       mdio@e7000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xe7000 0x1000>;
+
+               pcsphy3: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-4.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-4.dtsi
new file mode 100644 (file)
index 0000000..8f4d74b
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QorIQ FMan v3 1g port #4 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x0c: port@8c000 {
+               cell-index = <0xc>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x8c000 0x1000>;
+       };
+
+       fman0_tx_0x2c: port@ac000 {
+               cell-index = <0x2c>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xac000 0x1000>;
+       };
+
+       ethernet@e8000 {
+               cell-index = <4>;
+               compatible = "fsl,fman-memac";
+               reg = <0xe8000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>;
+               ptp-timer = <&ptp_timer0>;
+               pcsphy-handle = <&pcsphy4>;
+       };
+
+       mdio@e9000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xe9000 0x1000>;
+
+               pcsphy4: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-5.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0-1g-5.dtsi
new file mode 100644 (file)
index 0000000..d534f77
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QorIQ FMan v3 1g port #5 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman@1a00000 {
+       fman0_rx_0x0d: port@8d000 {
+               cell-index = <0xd>;
+               compatible = "fsl,fman-v3-port-rx";
+               reg = <0x8d000 0x1000>;
+       };
+
+       fman0_tx_0x2d: port@ad000 {
+               cell-index = <0x2d>;
+               compatible = "fsl,fman-v3-port-tx";
+               reg = <0xad000 0x1000>;
+       };
+
+       ethernet@ea000 {
+               cell-index = <5>;
+               compatible = "fsl,fman-memac";
+               reg = <0xea000 0x1000>;
+               fsl,fman-ports = <&fman0_rx_0x0d &fman0_tx_0x2d>;
+               ptp-timer = <&ptp_timer0>;
+               pcsphy-handle = <&pcsphy5>;
+       };
+
+       mdio@eb000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xeb000 0x1000>;
+
+               pcsphy5: ethernet-phy@0 {
+                       reg = <0x0>;
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-fman3-0.dtsi b/arch/arm64/boot/dts/freescale/qoriq-fman3-0.dtsi
new file mode 100644 (file)
index 0000000..4dd0676
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * QorIQ FMan v3 device tree
+ *
+ * Copyright 2012-2015 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+fman0: fman@1a00000 {
+       #address-cells = <1>;
+       #size-cells = <1>;
+       cell-index = <0>;
+       compatible = "fsl,fman";
+       ranges = <0x0 0x0 0x1a00000 0x100000>;
+       reg = <0x0 0x1a00000 0x0 0x100000>;
+       interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>,
+                    <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&clockgen 3 0>;
+       clock-names = "fmanclk";
+       fsl,qman-channel-range = <0x800 0x10>;
+
+       muram@0 {
+               compatible = "fsl,fman-muram";
+               reg = <0x0 0x60000>;
+       };
+
+       fman0_oh_0x2: port@82000 {
+               cell-index = <0x2>;
+               compatible = "fsl,fman-v3-port-oh";
+               reg = <0x82000 0x1000>;
+       };
+
+       fman0_oh_0x3: port@83000 {
+               cell-index = <0x3>;
+               compatible = "fsl,fman-v3-port-oh";
+               reg = <0x83000 0x1000>;
+       };
+
+       fman0_oh_0x4: port@84000 {
+               cell-index = <0x4>;
+               compatible = "fsl,fman-v3-port-oh";
+               reg = <0x84000 0x1000>;
+       };
+
+       fman0_oh_0x5: port@85000 {
+               cell-index = <0x5>;
+               compatible = "fsl,fman-v3-port-oh";
+               reg = <0x85000 0x1000>;
+       };
+
+       fman0_oh_0x6: port@86000 {
+               cell-index = <0x6>;
+               compatible = "fsl,fman-v3-port-oh";
+               reg = <0x86000 0x1000>;
+       };
+
+       fman0_oh_0x7: port@87000 {
+               cell-index = <0x7>;
+               compatible = "fsl,fman-v3-port-oh";
+               reg = <0x87000 0x1000>;
+       };
+
+       mdio0: mdio@fc000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xfc000 0x1000>;
+       };
+
+       xmdio0: mdio@fd000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+               reg = <0xfd000 0x1000>;
+       };
+
+       ptp_timer0: ptp-timer@fe000 {
+               compatible = "fsl,fman-ptp-timer";
+               reg = <0xfe000 0x1000>;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/qoriq-qman-portals.dtsi b/arch/arm64/boot/dts/freescale/qoriq-qman-portals.dtsi
new file mode 100644 (file)
index 0000000..2a9aa06
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * QorIQ QMan Portals device tree
+ *
+ * Copyright 2011-2016 Freescale Semiconductor Inc.
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+ */
+
+&qportals {
+       #address-cells = <1>;
+       #size-cells = <1>;
+       compatible = "simple-bus";
+
+       qportal0: qman-portal@0 {
+               /*
+                * bootloader fix-ups are expected to provide the
+                * "fsl,bman-portal-<hardware revision>" compatible
+                */
+               compatible = "fsl,qman-portal";
+               reg = <0x0 0x4000>, <0x4000000 0x4000>;
+               interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <0>;
+       };
+
+       qportal1: qman-portal@10000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x10000 0x4000>, <0x4010000 0x4000>;
+               interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <1>;
+       };
+
+       qportal2: qman-portal@20000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x20000 0x4000>, <0x4020000 0x4000>;
+               interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <2>;
+       };
+
+       qportal3: qman-portal@30000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x30000 0x4000>, <0x4030000 0x4000>;
+               interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <3>;
+       };
+
+       qportal4: qman-portal@40000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x40000 0x4000>, <0x4040000 0x4000>;
+               interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <4>;
+       };
+
+       qportal5: qman-portal@50000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x50000 0x4000>, <0x4050000 0x4000>;
+               interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <5>;
+       };
+
+       qportal6: qman-portal@60000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x60000 0x4000>, <0x4060000 0x4000>;
+               interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <6>;
+       };
+
+       qportal7: qman-portal@70000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x70000 0x4000>, <0x4070000 0x4000>;
+               interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <7>;
+       };
+
+       qportal8: qman-portal@80000 {
+               compatible = "fsl,qman-portal";
+               reg = <0x80000 0x4000>, <0x4080000 0x4000>;
+               interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+               cell-index = <8>;
+       };
+};
index 186251ffc6b200d7e1be4544aae67b98e6d56c4b..6609b0fe7a8b48ec02dba0a537731fa02b8061f5 100644 (file)
@@ -9,17 +9,28 @@
 
 #include "hi3660.dtsi"
 #include "hikey960-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "HiKey960";
-       compatible = "hisilicon,hi3660";
+       compatible = "hisilicon,hi3660-hikey960", "hisilicon,hi3660";
 
        aliases {
-               serial5 = &uart5;       /* console UART */
+               mshc1 = &dwmmc1;
+               mshc2 = &dwmmc2;
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+               serial5 = &uart5;
+               serial6 = &uart6;
        };
 
        chosen {
-               stdout-path = "serial5:115200n8";
+               stdout-path = "serial6:115200n8";
        };
 
        memory@0 {
                /* rewrite this at bootloader */
                reg = <0x0 0x0 0x0 0x0>;
        };
+
+       keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pwr_key_pmx_func &pwr_key_cfg_func>;
+
+               power {
+                       wakeup-source;
+                       gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;
+                       label = "GPIO Power";
+                       linux,code = <KEY_POWER>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               user_led1 {
+                       label = "user_led1";
+                       /* gpio_150_user_led1 */
+                       gpios = <&gpio18 6 0>;
+                       linux,default-trigger = "heartbeat";
+               };
+
+               user_led2 {
+                       label = "user_led2";
+                       /* gpio_151_user_led2 */
+                       gpios = <&gpio18 7 0>;
+                       linux,default-trigger = "mmc0";
+               };
+
+               user_led3 {
+                       label = "user_led3";
+                       /* gpio_189_user_led3 */
+                       gpios = <&gpio23 5 0>;
+                       default-state = "off";
+               };
+
+               user_led4 {
+                       label = "user_led4";
+                       /* gpio_190_user_led4 */
+                       gpios = <&gpio23 6 0>;
+                       linux,default-trigger = "cpu0";
+               };
+
+               wlan_active_led {
+                       label = "wifi_active";
+                       /* gpio_205_wifi_active */
+                       gpios = <&gpio25 5 0>;
+                       linux,default-trigger = "phy0tx";
+                       default-state = "off";
+               };
+
+               bt_active_led {
+                       label = "bt_active";
+                       gpios = <&gpio25 7 0>;
+                       /* gpio_207_user_led1 */
+                       linux,default-trigger = "hci0-power";
+                       default-state = "off";
+               };
+       };
+
+       pmic: pmic@fff34000 {
+               compatible = "hisilicon,hi6421v530-pmic";
+               reg = <0x0 0xfff34000 0x0 0x1000>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+
+               regulators {
+                       ldo3: LDO3 { /* HDMI */
+                               regulator-name = "VOUT3_1V85";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <2200000>;
+                               regulator-enable-ramp-delay = <120>;
+                       };
+
+                       ldo9: LDO9 { /* SDCARD I/O */
+                               regulator-name = "VOUT9_1V8_2V95";
+                               regulator-min-microvolt = <1750000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <240>;
+                       };
+
+                       ldo11: LDO11 { /* Low Speed Connector */
+                               regulator-name = "VOUT11_1V8_2V95";
+                               regulator-min-microvolt = <1750000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <240>;
+                       };
+
+                       ldo15: LDO15 { /* UFS VCC */
+                               regulator-name = "VOUT15_3V0";
+                               regulator-min-microvolt = <1750000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-enable-ramp-delay = <120>;
+                       };
+
+                       ldo16: LDO16 { /* SD VDD */
+                               regulator-name = "VOUT16_2V95";
+                               regulator-min-microvolt = <1750000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-enable-ramp-delay = <360>;
+                       };
+               };
+       };
+
+       wlan_en: wlan-en-1-8v {
+               compatible = "regulator-fixed";
+               regulator-name = "wlan-en-regulator";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+
+               /* GPIO_051_WIFI_EN */
+               gpio = <&gpio6 3 0>;
+
+               /* WLAN card specific delay */
+               startup-delay-us = <70000>;
+               enable-active-high;
+       };
+};
+
+&i2c0 {
+       /* On Low speed expansion */
+       label = "LS-I2C0";
+       status = "okay";
+};
+
+&i2c1 {
+       status = "okay";
+
+       adv7533: adv7533@39 {
+               status = "ok";
+               compatible = "adi,adv7533";
+               reg = <0x39>;
+       };
+};
+
+&i2c7 {
+       /* On Low speed expansion */
+       label = "LS-I2C1";
+       status = "okay";
+};
+
+&uart3 {
+       /* On Low speed expansion */
+       label = "LS-UART0";
+       status = "okay";
+};
+
+&uart4 {
+       status = "okay";
+
+       bluetooth {
+               compatible = "ti,wl1837-st";
+               enable-gpios = <&gpio15 6 GPIO_ACTIVE_HIGH>;
+               max-speed = <921600>;
+       };
 };
 
-&uart5 {
+&uart6 {
+       /* On Low speed expansion */
+       label = "LS-UART1";
        status = "okay";
 };
+
+&spi2 {
+       /* On Low speed expansion */
+       label = "LS-SPI0";
+       status = "okay";
+};
+
+&spi3 {
+       /* On High speed expansion */
+       label = "HS-SPI1";
+       status = "okay";
+};
+
+&dwmmc1 {
+       vmmc-supply = <&ldo16>;
+       vqmmc-supply = <&ldo9>;
+       status = "okay";
+};
+
+&dwmmc2 { /* WIFI */
+       broken-cd;
+       /* WL_EN */
+       vmmc-supply = <&wlan_en>;
+       ti,non-removable;
+       non-removable;
+       #address-cells = <0x1>;
+       #size-cells = <0x0>;
+       status = "ok";
+
+       wlcore: wlcore@2 {
+               compatible = "ti,wl1837";
+               reg = <2>;      /* sdio func num */
+               /* WL_IRQ, GPIO_179_WL_WAKEUP_AP */
+               interrupt-parent = <&gpio22>;
+               interrupts = <3 IRQ_TYPE_EDGE_RISING>;
+       };
+};
index 3983086bd67bfb3f1a9282f87886f2afd681152b..c6a1961e8d55ecb9bdb07e8696fe9a755c8d21e8 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/hi3660-clock.h>
 
 / {
        compatible = "hisilicon,hi3660";
                #size-cells = <2>;
                ranges;
 
-               fixed_uart5: fixed_19_2M {
-                       compatible = "fixed-clock";
-                       #clock-cells = <0>;
-                       clock-frequency = <19200000>;
-                       clock-output-names = "fixed:uart5";
+               crg_ctrl: crg_ctrl@fff35000 {
+                       compatible = "hisilicon,hi3660-crgctrl", "syscon";
+                       reg = <0x0 0xfff35000 0x0 0x1000>;
+                       #clock-cells = <1>;
                };
 
-               uart5: uart@fdf05000 {
+               crg_rst: crg_rst_controller {
+                       compatible = "hisilicon,hi3660-reset";
+                       #reset-cells = <2>;
+                       hisi,rst-syscon = <&crg_ctrl>;
+               };
+
+
+               pctrl: pctrl@e8a09000 {
+                       compatible = "hisilicon,hi3660-pctrl", "syscon";
+                       reg = <0x0 0xe8a09000 0x0 0x2000>;
+                       #clock-cells = <1>;
+               };
+
+               pmuctrl: crg_ctrl@fff34000 {
+                       compatible = "hisilicon,hi3660-pmuctrl", "syscon";
+                       reg = <0x0 0xfff34000 0x0 0x1000>;
+                       #clock-cells = <1>;
+               };
+
+               sctrl: sctrl@fff0a000 {
+                       compatible = "hisilicon,hi3660-sctrl", "syscon";
+                       reg = <0x0 0xfff0a000 0x0 0x1000>;
+                       #clock-cells = <1>;
+               };
+
+               iomcu: iomcu@ffd7e000 {
+                       compatible = "hisilicon,hi3660-iomcu", "syscon";
+                       reg = <0x0 0xffd7e000 0x0 0x1000>;
+                       #clock-cells = <1>;
+
+               };
+
+               iomcu_rst: reset {
+                       compatible = "hisilicon,hi3660-reset";
+                       hisi,rst-syscon = <&iomcu>;
+                       #reset-cells = <2>;
+               };
+
+               dual_timer0: timer@fff14000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0x0 0xfff14000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_OSC32K>,
+                                <&crg_ctrl HI3660_OSC32K>,
+                                <&crg_ctrl HI3660_OSC32K>;
+                       clock-names = "timer1", "timer2", "apb_pclk";
+               };
+
+               i2c0: i2c@ffd71000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0x0 0xffd71000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clock-frequency = <400000>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_I2C0>;
+                       resets = <&iomcu_rst 0x20 3>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c0_pmx_func &i2c0_cfg_func>;
+                       status = "disabled";
+               };
+
+               i2c1: i2c@ffd72000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0x0 0xffd72000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clock-frequency = <400000>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_I2C1>;
+                       resets = <&iomcu_rst 0x20 4>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c1_pmx_func &i2c1_cfg_func>;
+                       status = "disabled";
+               };
+
+               i2c3: i2c@fdf0c000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0x0 0xfdf0c000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clock-frequency = <400000>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_I2C3>;
+                       resets = <&crg_rst 0x78 7>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c3_pmx_func &i2c3_cfg_func>;
+                       status = "disabled";
+               };
+
+               i2c7: i2c@fdf0b000 {
+                       compatible = "snps,designware-i2c";
+                       reg = <0x0 0xfdf0b000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 314 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clock-frequency = <400000>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_I2C7>;
+                       resets = <&crg_rst 0x60 14>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c7_pmx_func &i2c7_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart0: serial@fdf02000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0x0 0xfdf02000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_MUX_UART0>,
+                                <&crg_ctrl HI3660_PCLK>;
+                       clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart0_pmx_func &uart0_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart1: serial@fdf00000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0x0 0xfdf00000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_UART1>,
+                                <&crg_ctrl HI3660_CLK_GATE_UART1>;
+                       clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart1_pmx_func &uart1_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart2: serial@fdf03000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0x0 0xfdf03000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_UART2>,
+                                <&crg_ctrl HI3660_PCLK>;
+                       clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart2_pmx_func &uart2_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart3: serial@ffd74000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0x0 0xffd74000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_FACTOR_UART3>,
+                                <&crg_ctrl HI3660_PCLK>;
+                       clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart3_pmx_func &uart3_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart4: serial@fdf01000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0x0 0xfdf01000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_UART4>,
+                                <&crg_ctrl HI3660_CLK_GATE_UART4>;
+                       clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart4_pmx_func &uart4_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart5: serial@fdf05000 {
                        compatible = "arm,pl011", "arm,primecell";
                        reg = <0x0 0xfdf05000 0x0 0x1000>;
                        interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&fixed_uart5 &fixed_uart5>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_UART5>,
+                                <&crg_ctrl HI3660_CLK_GATE_UART5>;
+                       clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart5_pmx_func &uart5_cfg_func>;
+                       status = "disabled";
+               };
+
+               uart6: serial@fff32000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0x0 0xfff32000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_UART6>,
+                                <&crg_ctrl HI3660_PCLK>;
                        clock-names = "uartclk", "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart6_pmx_func &uart6_cfg_func>;
+                       status = "disabled";
+               };
+
+               rtc0: rtc@fff04000 {
+                       compatible = "arm,pl031", "arm,primecell";
+                       reg = <0x0 0Xfff04000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_PCLK>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio0: gpio@e8a0b000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a0b000 0 0x1000>;
+                       interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 1 0 7>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO0>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio1: gpio@e8a0c000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a0c000 0 0x1000>;
+                       interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 1 7 7>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO1>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio2: gpio@e8a0d000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a0d000 0 0x1000>;
+                       interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 14 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO2>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio3: gpio@e8a0e000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a0e000 0 0x1000>;
+                       interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 22 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO3>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio4: gpio@e8a0f000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a0f000 0 0x1000>;
+                       interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 30 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO4>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio5: gpio@e8a10000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a10000 0 0x1000>;
+                       interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 38 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO5>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio6: gpio@e8a11000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a11000 0 0x1000>;
+                       interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 46 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO6>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio7: gpio@e8a12000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a12000 0 0x1000>;
+                       interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 54 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO7>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio8: gpio@e8a13000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a13000 0 0x1000>;
+                       interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 62 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO8>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio9: gpio@e8a14000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a14000 0 0x1000>;
+                       interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 70 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO9>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio10: gpio@e8a15000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a15000 0 0x1000>;
+                       interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 78 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO10>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio11: gpio@e8a16000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a16000 0 0x1000>;
+                       interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 86 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO11>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio12: gpio@e8a17000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a17000 0 0x1000>;
+                       interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 94 3 &pmx0 7 101 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO12>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio13: gpio@e8a18000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a18000 0 0x1000>;
+                       interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 102 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO13>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio14: gpio@e8a19000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a19000 0 0x1000>;
+                       interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 110 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO14>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio15: gpio@e8a1a000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a1a000 0 0x1000>;
+                       interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx0 0 118 6>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO15>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio16: gpio@e8a1b000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a1b000 0 0x1000>;
+                       interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO16>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio17: gpio@e8a1c000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a1c000 0 0x1000>;
+                       interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO17>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio18: gpio@ff3b4000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xff3b4000 0 0x1000>;
+                       interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx2 0 0 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO18>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio19: gpio@ff3b5000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xff3b5000 0 0x1000>;
+                       interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx2 0 8 4>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO19>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio20: gpio@e8a1f000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a1f000 0 0x1000>;
+                       interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = <&pmx1 0 0 6>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO20>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio21: gpio@e8a20000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xe8a20000 0 0x1000>;
+                       interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       gpio-ranges = <&pmx3 0 0 6>;
+                       clocks = <&crg_ctrl HI3660_PCLK_GPIO21>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio22: gpio@fff0b000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff0b000 0 0x1000>;
+                       interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       /* GPIO176 */
+                       gpio-ranges = <&pmx4 2 0 6>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO0>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio23: gpio@fff0c000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff0c000 0 0x1000>;
+                       interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       /* GPIO184 */
+                       gpio-ranges = <&pmx4 0 6 7>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO1>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio24: gpio@fff0d000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff0d000 0 0x1000>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       /* GPIO192 */
+                       gpio-ranges = <&pmx4 0 13 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO2>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio25: gpio@fff0e000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff0e000 0 0x1000>;
+                       interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       /* GPIO200 */
+                       gpio-ranges = <&pmx4 0 21 4 &pmx4 5 25 3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO3>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio26: gpio@fff0f000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff0f000 0 0x1000>;
+                       interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       /* GPIO208 */
+                       gpio-ranges = <&pmx4 0 28 8>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO4>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio27: gpio@fff10000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff10000 0 0x1000>;
+                       interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       /* GPIO216 */
+                       gpio-ranges = <&pmx4 0 36 6>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO5>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio28: gpio@fff1d000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0 0xfff1d000 0 0x1000>;
+                       interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&sctrl HI3660_PCLK_AO_GPIO6>;
+                       clock-names = "apb_pclk";
+               };
+
+               spi2: spi@ffd68000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0x0 0xffd68000 0x0 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_SPI2>;
+                       clock-names = "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi2_pmx_func>;
+                       num-cs = <1>;
+                       cs-gpios = <&gpio27 2 0>;
+                       status = "disabled";
+               };
+
+               spi3: spi@ff3b3000 {
+                       compatible = "arm,pl022", "arm,primecell";
+                       reg = <0x0 0xff3b3000 0x0 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_SPI3>;
+                       clock-names = "apb_pclk";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&spi3_pmx_func>;
+                       num-cs = <1>;
+                       cs-gpios = <&gpio18 5 0>;
+                       status = "disabled";
+               };
+
+               pcie@f4000000 {
+                       compatible = "hisilicon,kirin960-pcie";
+                       reg = <0x0 0xf4000000 0x0 0x1000>,
+                             <0x0 0xff3fe000 0x0 0x1000>,
+                             <0x0 0xf3f20000 0x0 0x40000>,
+                             <0x0 0xf5000000 0x0 0x2000>;
+                       reg-names = "dbi", "apb", "phy", "config";
+                       bus-range = <0x0  0x1>;
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       device_type = "pci";
+                       ranges = <0x02000000 0x0 0x00000000
+                                 0x0 0xf6000000
+                                 0x0 0x02000000>;
+                       num-lanes = <1>;
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0xf800 0 0 7>;
+                       interrupt-map = <0x0 0 0 1
+                                        &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0x0 0 0 2
+                                        &gic GIC_SPI 283 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0x0 0 0 3
+                                        &gic GIC_SPI 284 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0x0 0 0 4
+                                        &gic GIC_SPI 285 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+                                <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
+                                <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+                                <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
+                                <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
+                       clock-names = "pcie_phy_ref", "pcie_aux",
+                                     "pcie_apb_phy", "pcie_apb_sys",
+                                     "pcie_aclk";
+                       reset-gpios = <&gpio11 1 0 >;
+               };
+
+               /* SD */
+               dwmmc1: dwmmc1@ff37f000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       cd-inverted;
+                       compatible = "hisilicon,hi3660-dw-mshc";
+                       num-slots = <1>;
+                       bus-width = <0x4>;
+                       disable-wp;
+                       cap-sd-highspeed;
+                       supports-highspeed;
+                       card-detect-delay = <200>;
+                       reg = <0x0 0xff37f000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_SD>,
+                               <&crg_ctrl HI3660_HCLK_GATE_SD>;
+                       clock-names = "ciu", "biu";
+                       clock-frequency = <3200000>;
+                       resets = <&crg_rst 0x94 18>;
+                       cd-gpios = <&gpio25 3 0>;
+                       hisilicon,peripheral-syscon = <&sctrl>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&sd_pmx_func
+                                    &sd_clk_cfg_func
+                                    &sd_cfg_func>;
+                       sd-uhs-sdr12;
+                       sd-uhs-sdr25;
+                       sd-uhs-sdr50;
+                       sd-uhs-sdr104;
+                       status = "disabled";
+
+                       slot@0 {
+                               reg = <0x0>;
+                               bus-width = <4>;
+                               disable-wp;
+                       };
+               };
+
+               /* SDIO */
+               dwmmc2: dwmmc2@ff3ff000 {
+                       compatible = "hisilicon,hi3660-dw-mshc";
+                       reg = <0x0 0xff3ff000 0x0 0x1000>;
+                       interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
+                       num-slots = <1>;
+                       clocks = <&crg_ctrl HI3660_CLK_GATE_SDIO0>,
+                                <&crg_ctrl HI3660_HCLK_GATE_SDIO0>;
+                       clock-names = "ciu", "biu";
+                       resets = <&crg_rst 0x94 20>;
+                       card-detect-delay = <200>;
+                       supports-highspeed;
+                       keep-power-in-suspend;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&sdio_pmx_func
+                                    &sdio_clk_cfg_func
+                                    &sdio_cfg_func>;
                        status = "disabled";
                };
        };
index 75bce2d0b1a83fa9f953b55a75ebdcb2ff4dc526..afae4de6e53fa03b94ed9262322fabf9c47842d0 100644 (file)
                };
        };
 
+       reg_sys_5v: regulator@0 {
+               compatible = "regulator-fixed";
+               regulator-name = "SYS_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       reg_vdd_3v3: regulator@1 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDD_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+               vin-supply = <&reg_sys_5v>;
+       };
+
+       reg_5v_hub: regulator@2 {
+               compatible = "regulator-fixed";
+               regulator-name = "5V_HUB";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-boot-on;
+               gpio = <&gpio0 7 0>;
+               regulator-always-on;
+               vin-supply = <&reg_sys_5v>;
+       };
+
+       wl1835_pwrseq: wl1835-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               /* WLAN_EN GPIO */
+               reset-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
+               clocks = <&pmic>;
+               clock-names = "ext_clock";
+               power-off-delay-us = <10>;
+       };
+
        soc {
                spi0: spi@f7106000 {
                        status = "ok";
 
                /* GPIO blocks 16 thru 19 do not appear to be routed to pins */
 
+               dwmmc_0: dwmmc0@f723d000 {
+                       cap-mmc-highspeed;
+                       non-removable;
+                       bus-width = <0x8>;
+                       vmmc-supply = <&ldo19>;
+               };
+
+               dwmmc_1: dwmmc1@f723e000 {
+                       card-detect-delay = <200>;
+                       cap-sd-highspeed;
+                       sd-uhs-sdr12;
+                       sd-uhs-sdr25;
+                       sd-uhs-sdr50;
+                       vqmmc-supply = <&ldo7>;
+                       vmmc-supply = <&ldo10>;
+                       bus-width = <0x4>;
+                       disable-wp;
+                       cd-gpios = <&gpio1 0 1>;
+               };
+
                dwmmc_2: dwmmc2@f723f000 {
-                       ti,non-removable;
+                       bus-width = <0x4>;
                        non-removable;
-                       /* WL_EN */
-                       vmmc-supply = <&wlan_en_reg>;
+                       vmmc-supply = <&reg_vdd_3v3>;
+                       mmc-pwrseq = <&wl1835_pwrseq>;
 
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                                interrupts = <3 IRQ_TYPE_EDGE_RISING>;
                        };
                };
-
-               wlan_en_reg: regulator@1 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "wlan-en-regulator";
-                       regulator-min-microvolt = <1800000>;
-                       regulator-max-microvolt = <1800000>;
-                       /* WLAN_EN GPIO */
-                       gpio = <&gpio0 5 0>;
-                       /* WLAN card specific delay */
-                       startup-delay-us = <70000>;
-                       enable-active-high;
-               };
        };
 
        leds {
        pmic: pmic@f8000000 {
                compatible = "hisilicon,hi655x-pmic";
                reg = <0x0 0xf8000000 0x0 0x1000>;
+               #clock-cells = <0>;
                interrupt-controller;
                #interrupt-cells = <2>;
                pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
                        method = "smc";
                };
        };
+
+       sound_card {
+               compatible = "audio-graph-card";
+               dais = <&i2s0_port0>;
+       };
 };
 
 &uart2 {
                interrupts = <1 2>;
                pd-gpio = <&gpio0 4 0>;
                adi,dsi-lanes = <4>;
+               #sound-dai-cells = <0>;
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       port@0 {
+                               adv7533_in: endpoint {
+                                       remote-endpoint = <&dsi_out0>;
+                               };
+                       };
+                       port@2 {
+                               reg = <2>;
+                               codec_endpoint: endpoint {
+                                       remote-endpoint = <&i2s0_cpu_endpoint>;
+                               };
+                       };
+               };
+       };
+};
+
+&i2s0 {
 
-               port {
-                       adv7533_in: endpoint {
-                               remote-endpoint = <&dsi_out0>;
+       ports {
+               i2s0_port0: port@0 {
+                       i2s0_cpu_endpoint: endpoint {
+                               remote-endpoint = <&codec_endpoint>;
+                               dai-format = "i2s";
                        };
                };
        };
index 1e5129b19280bf8195a9ac24e506ec096493b084..f2e218cc71a4487f285aa6066a958a4316300366 100644 (file)
                        status = "disabled";
                };
 
+               dma0: dma@f7370000 {
+                       compatible = "hisilicon,k3-dma-1.0";
+                       reg = <0x0 0xf7370000 0x0 0x1000>;
+                       #dma-cells = <1>;
+                       dma-channels = <15>;
+                       dma-requests = <32>;
+                       interrupts = <0 84 4>;
+                       clocks = <&sys_ctrl HI6220_EDMAC_ACLK>;
+                       dma-no-cci;
+                       dma-type = "hi6220_dma";
+                       status = "ok";
+               };
+
                dual_timer0: timer@f8008000 {
                        compatible = "arm,sp804", "arm,primecell";
                        reg = <0x0 0xf8008000 0x0 0x1000>;
                        status = "disabled";
                };
 
-               fixed_5v_hub: regulator@0 {
-                       compatible = "regulator-fixed";
-                       regulator-name = "fixed_5v_hub";
-                       regulator-min-microvolt = <5000000>;
-                       regulator-max-microvolt = <5000000>;
-                       regulator-boot-on;
-                       gpio = <&gpio0 7 0>;
-                       regulator-always-on;
-               };
-
                usb_phy: usbphy {
                        compatible = "hisilicon,hi6220-usb-phy";
                        #phy-cells = <0>;
-                       phy-supply = <&fixed_5v_hub>;
+                       phy-supply = <&reg_5v_hub>;
                        hisilicon,peripheral-syscon = <&sys_ctrl>;
                };
 
 
                dwmmc_0: dwmmc0@f723d000 {
                        compatible = "hisilicon,hi6220-dw-mshc";
-                       num-slots = <0x1>;
-                       cap-mmc-highspeed;
-                       non-removable;
                        reg = <0x0 0xf723d000 0x0 0x1000>;
                        interrupts = <0x0 0x48 0x4>;
                        clocks = <&sys_ctrl 2>, <&sys_ctrl 1>;
                        clock-names = "ciu", "biu";
                        resets = <&sys_ctrl PERIPH_RSTDIS0_MMC0>;
                        reset-names = "reset";
-                       bus-width = <0x8>;
-                       vmmc-supply = <&ldo19>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&emmc_pmx_func &emmc_clk_cfg_func
                                     &emmc_cfg_func &emmc_rst_cfg_func>;
 
                dwmmc_1: dwmmc1@f723e000 {
                        compatible = "hisilicon,hi6220-dw-mshc";
-                       num-slots = <0x1>;
-                       card-detect-delay = <200>;
                        hisilicon,peripheral-syscon = <&ao_ctrl>;
-                       cap-sd-highspeed;
-                       sd-uhs-sdr12;
-                       sd-uhs-sdr25;
-                       sd-uhs-sdr50;
                        reg = <0x0 0xf723e000 0x0 0x1000>;
                        interrupts = <0x0 0x49 0x4>;
                        #address-cells = <0x1>;
                        clock-names = "ciu", "biu";
                        resets = <&sys_ctrl PERIPH_RSTDIS0_MMC1>;
                        reset-names = "reset";
-                       vqmmc-supply = <&ldo7>;
-                       vmmc-supply = <&ldo10>;
-                       bus-width = <0x4>;
-                       disable-wp;
-                       cd-gpios = <&gpio1 0 1>;
                        pinctrl-names = "default", "idle";
                        pinctrl-0 = <&sd_pmx_func &sd_clk_cfg_func &sd_cfg_func>;
                        pinctrl-1 = <&sd_pmx_idle &sd_clk_cfg_idle &sd_cfg_idle>;
 
                dwmmc_2: dwmmc2@f723f000 {
                        compatible = "hisilicon,hi6220-dw-mshc";
-                       num-slots = <0x1>;
                        reg = <0x0 0xf723f000 0x0 0x1000>;
                        interrupts = <0x0 0x4a 0x4>;
                        clocks = <&sys_ctrl HI6220_MMC2_CIUCLK>, <&sys_ctrl HI6220_MMC2_CLK>;
                        clock-names = "ciu", "biu";
                        resets = <&sys_ctrl PERIPH_RSTDIS0_MMC2>;
                        reset-names = "reset";
-                       bus-width = <0x4>;
-                       broken-cd;
                        pinctrl-names = "default", "idle";
                        pinctrl-0 = <&sdio_pmx_func &sdio_clk_cfg_func &sdio_cfg_func>;
                        pinctrl-1 = <&sdio_pmx_idle &sdio_clk_cfg_idle &sdio_cfg_idle>;
                        #thermal-sensor-cells = <1>;
                };
 
+               i2s0: i2s@f7118000{
+                       compatible = "hisilicon,hi6210-i2s";
+                       reg = <0x0 0xf7118000 0x0 0x8000>; /* i2s unit */
+                       interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>; /* 155 "DigACodec_intr"-32 */
+                       clocks = <&sys_ctrl HI6220_DACODEC_PCLK>,
+                                <&sys_ctrl HI6220_BBPPLL0_DIV>;
+                       clock-names = "dacodec", "i2s-base";
+                       dmas = <&dma0 15 &dma0 14>;
+                       dma-names = "rx", "tx";
+                       hisilicon,sysctrl-syscon = <&sys_ctrl>;
+                       #sound-dai-cells = <1>;
+               };
+
                thermal-zones {
 
                        cls0: cls0 {
index 719c4bc937a4bca818fed21fcb8053aae2bbf929..7e542d28dadbd53a24529178b6314a0b75beeb66 100644 (file)
                                &range 0 7 0
                                &range 8 116 0>;
 
+                       pmu_pmx_func: pmu_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x008 MUX_M1 /* PMU1_SSI */
+                                       0x00c MUX_M1 /* PMU2_SSI */
+                                       0x010 MUX_M1 /* PMU_CLKOUT */
+                                       0x100 MUX_M1 /* PMU_HKADC_SSI */
+                               >;
+                       };
+
+                       csi0_pwd_n_pmx_func: csi0_pwd_n_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x044 MUX_M0 /* CSI0_PWD_N */
+                               >;
+                       };
+
+                       csi1_pwd_n_pmx_func: csi1_pwd_n_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x04c MUX_M0 /* CSI1_PWD_N */
+                               >;
+                       };
+
                        isp0_pmx_func: isp0_pmx_func {
                                pinctrl-single,pins = <
                                        0x058 MUX_M1 /* ISP_CLK0 */
                                >;
                        };
 
+                       pwr_key_pmx_func: pwr_key_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x080 MUX_M0 /* GPIO_034 */
+                               >;
+                       };
+
                        i2c3_pmx_func: i2c3_pmx_func {
                                pinctrl-single,pins = <
                                        0x02c MUX_M1 /* I2C3_SCL */
                                >;
                        };
 
-                       spi1_pmx_func: spi1_pmx_func {
-                               pinctrl-single,pins = <
-                                       0x034 MUX_M1 /* SPI1_CLK */
-                                       0x038 MUX_M1 /* SPI1_DI */
-                                       0x03c MUX_M1 /* SPI1_DO */
-                                       0x040 MUX_M1 /* SPI1_CS_N */
-                               >;
-                       };
-
                        uart0_pmx_func: uart0_pmx_func {
                                pinctrl-single,pins = <
                                        0x0cc MUX_M2 /* UART0_RXD */
                                        0x0d0 MUX_M2 /* UART0_TXD */
-                                       0x0d4 MUX_M2 /* UART0_RXD_M */
-                                       0x0d8 MUX_M2 /* UART0_TXD_M */
                                >;
                        };
 
                                        0x0d8 MUX_M1 /* UART6_TXD */
                                >;
                        };
+
+                       cam0_rst_pmx_func: cam0_rst_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0c8 MUX_M0 /* CAM0_RST */
+                               >;
+                       };
+
+                       cam1_rst_pmx_func: cam1_rst_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x124 MUX_M0 /* CAM1_RST */
+                               >;
+                       };
                };
 
                /* [IOMG_MMC0_000, IOMG_MMC0_005] */
                        /* pin base, nr pins & gpio function */
                        pinctrl-single,gpio-range = <&range 0 12 0>;
 
+                       ufs_pmx_func: ufs_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x000 MUX_M1 /* UFS_REF_CLK */
+                                       0x004 MUX_M1 /* UFS_RST_N */
+                               >;
+                       };
+
                        spi3_pmx_func: spi3_pmx_func {
                                pinctrl-single,pins = <
                                        0x008 MUX_M1 /* SPI3_CLK */
                                >;
                        };
 
-                       i2c2_pmx_func: i2c2_pmx_func {
+                       i2c7_pmx_func: i2c7_pmx_func {
                                pinctrl-single,pins = <
-                                       0x024 MUX_M1 /* I2C2_SCL */
-                                       0x028 MUX_M1 /* I2C2_SDA */
+                                       0x024 MUX_M3 /* I2C7_SCL */
+                                       0x028 MUX_M3 /* I2C7_SDA */
                                >;
                        };
 
-                       i2c7_pmx_func: i2c7_pmx_func {
+                       pcie_pmx_func: pcie_pmx_func {
                                pinctrl-single,pins = <
-                                       0x024 MUX_M3 /* I2C7_SCL */
-                                       0x028 MUX_M3 /* I2C7_SDA */
+                                       0x084 MUX_M1 /* PCIE_CLKREQ_N */
+                                       0x088 MUX_M1 /* PCIE_WAKE_N */
                                >;
                        };
 
                                >;
                        };
 
-                       spi4_pmx_func: spi4_pmx_func {
-                               pinctrl-single,pins = <
-                                       0x08c MUX_M4 /* SPI4_CLK */
-                                       0x090 MUX_M4 /* SPI4_DI */
-                                       0x094 MUX_M4 /* SPI4_DO */
-                                       0x098 MUX_M4 /* SPI4_CS0_N */
-                               >;
-                       };
-
                        i2s0_pmx_func: i2s0_pmx_func {
                                pinctrl-single,pins = <
                                        0x034 MUX_M1 /* I2S0_DI */
                        };
                };
 
-               pmx5: pinmux@ff3fd800 {
+               pmx5: pinmux@e896c800 {
                        compatible = "pinconf-single";
-                       reg = <0x0 0xff3fd800 0x0 0x18>;
+                       reg = <0x0 0xe896c800 0x0 0x200>;
                        #pinctrl-cells = <1>;
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       pinctrl-single,register-width = <32>;
+                       pinctrl-single,register-width = <0x20>;
 
-                       sdio_clk_cfg_func: sdio_clk_cfg_func {
+                       pmu_cfg_func: pmu_cfg_func {
                                pinctrl-single,pins = <
-                                       0x000 0x0 /* SDIO_CLK */
+                                       0x010 0x0 /* PMU1_SSI */
+                                       0x014 0x0 /* PMU2_SSI */
+                                       0x018 0x0 /* PMU_CLKOUT */
+                                       0x10c 0x0 /* PMU_HKADC_SSI */
                                >;
                                pinctrl-single,bias-pulldown = <
                                        PULL_DIS
                                        PULL_UP
                                >;
                                pinctrl-single,drive-strength = <
-                                       DRIVE6_32MA
-                                       DRIVE6_MASK
+                                       DRIVE7_06MA DRIVE6_MASK
                                >;
                        };
 
-                       sdio_cfg_func: sdio_cfg_func {
+                       i2c3_cfg_func: i2c3_cfg_func {
                                pinctrl-single,pins = <
-                                       0x004 0x0 /* SDIO_CMD */
-                                       0x008 0x0 /* SDIO_DATA0 */
-                                       0x00c 0x0 /* SDIO_DATA1 */
-                                       0x010 0x0 /* SDIO_DATA2 */
-                                       0x014 0x0 /* SDIO_DATA3 */
+                                       0x038 0x0 /* I2C3_SCL */
+                                       0x03c 0x0 /* I2C3_SDA */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       csi0_pwd_n_cfg_func: csi0_pwd_n_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x050 0x0 /* CSI0_PWD_N */
                                >;
                                pinctrl-single,bias-pulldown = <
                                        PULL_DIS
                                        PULL_DOWN
                                >;
                                pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
                                        PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_04MA DRIVE6_MASK
+                               >;
+                       };
+
+                       csi1_pwd_n_cfg_func: csi1_pwd_n_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x058 0x0 /* CSI1_PWD_N */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
                                        PULL_UP
                                        PULL_DIS
                                        PULL_UP
                                >;
                                pinctrl-single,drive-strength = <
-                                       DRIVE6_19MA
-                                       DRIVE6_MASK
+                                       DRIVE7_04MA DRIVE6_MASK
                                >;
                        };
-               };
 
-               pmx6: pinmux@ff37e800 {
-                       compatible = "pinconf-single";
-                       reg = <0x0 0xff37e800 0x0 0x18>;
-                       #pinctrl-cells = <1>;
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       pinctrl-single,register-width = <32>;
+                       isp0_cfg_func: isp0_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x064 0x0 /* ISP_CLK0 */
+                                       0x070 0x0 /* ISP_SCL0 */
+                                       0x074 0x0 /* ISP_SDA0 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_04MA DRIVE6_MASK>;
+                       };
 
-                       sd_clk_cfg_func: sd_clk_cfg_func {
+                       isp1_cfg_func: isp1_cfg_func {
                                pinctrl-single,pins = <
-                                       0x000 0x0 /* SD_CLK */
+                                       0x068 0x0 /* ISP_CLK1 */
+                                       0x078 0x0 /* ISP_SCL1 */
+                                       0x07c 0x0 /* ISP_SDA1 */
                                >;
                                pinctrl-single,bias-pulldown = <
                                        PULL_DIS
                                        PULL_UP
                                >;
                                pinctrl-single,drive-strength = <
-                                       DRIVE6_32MA
-                                       DRIVE6_MASK
+                                       DRIVE7_04MA DRIVE6_MASK
                                >;
                        };
 
-                       sd_cfg_func: sd_cfg_func {
+                       pwr_key_cfg_func: pwr_key_cfg_func {
                                pinctrl-single,pins = <
-                                       0x004 0x0 /* SD_CMD */
-                                       0x008 0x0 /* SD_DATA0 */
-                                       0x00c 0x0 /* SD_DATA1 */
-                                       0x010 0x0 /* SD_DATA2 */
-                                       0x014 0x0 /* SD_DATA3 */
+                                       0x08c 0x0 /* GPIO_034 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart1_cfg_func: uart1_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0b4 0x0 /* UART1_RXD */
+                                       0x0b8 0x0 /* UART1_TXD */
+                                       0x0bc 0x0 /* UART1_CTS_N */
+                                       0x0c0 0x0 /* UART1_RTS_N */
                                >;
                                pinctrl-single,bias-pulldown = <
                                        PULL_DIS
                                        PULL_DOWN
                                >;
                                pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
                                        PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart2_cfg_func: uart2_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0c8 0x0 /* UART2_CTS_N */
+                                       0x0cc 0x0 /* UART2_RTS_N */
+                                       0x0d0 0x0 /* UART2_TXD */
+                                       0x0d4 0x0 /* UART2_RXD */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
                                        PULL_UP
                                        PULL_DIS
                                        PULL_UP
                                >;
                                pinctrl-single,drive-strength = <
-                                       DRIVE6_19MA
-                                       DRIVE6_MASK
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart5_cfg_func: uart5_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0c8 0x0 /* UART5_RXD */
+                                       0x0cc 0x0 /* UART5_TXD */
+                                       0x0d0 0x0 /* UART5_CTS_N */
+                                       0x0d4 0x0 /* UART5_RTS_N */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       cam0_rst_cfg_func: cam0_rst_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0d4 0x0 /* CAM0_RST */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_04MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart0_cfg_func: uart0_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0d8 0x0 /* UART0_RXD */
+                                       0x0dc 0x0 /* UART0_TXD */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart6_cfg_func: uart6_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0d8 0x0 /* UART6_CTS_N */
+                                       0x0dc 0x0 /* UART6_RTS_N */
+                                       0x0e0 0x0 /* UART6_RXD */
+                                       0x0e4 0x0 /* UART6_TXD */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart3_cfg_func: uart3_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0e8 0x0 /* UART3_CTS_N */
+                                       0x0ec 0x0 /* UART3_RTS_N */
+                                       0x0f0 0x0 /* UART3_RXD */
+                                       0x0f4 0x0 /* UART3_TXD */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       uart4_cfg_func: uart4_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0f8 0x0 /* UART4_CTS_N */
+                                       0x0fc 0x0 /* UART4_RTS_N */
+                                       0x100 0x0 /* UART4_RXD */
+                                       0x104 0x0 /* UART4_TXD */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       cam1_rst_cfg_func: cam1_rst_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x130 0x0 /* CAM1_RST */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_04MA DRIVE6_MASK
+                               >;
+                       };
+               };
+
+               pmx6: pinmux@ff3b6800 {
+                       compatible = "pinconf-single";
+                       reg = <0x0 0xff3b6800 0x0 0x18>;
+                       #pinctrl-cells = <1>;
+                       pinctrl-single,register-width = <0x20>;
+
+                       ufs_cfg_func: ufs_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x000 0x0 /* UFS_REF_CLK */
+                                       0x004 0x0 /* UFS_RST_N */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_08MA DRIVE6_MASK
+                               >;
+                       };
+
+                       spi3_cfg_func: spi3_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x008 0x0 /* SPI3_CLK */
+                                       0x0 /* SPI3_DI */
+                                       0x010 0x0 /* SPI3_DO */
+                                       0x014 0x0 /* SPI3_CS0_N */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+               };
+
+               pmx7: pinmux@ff3fd800 {
+                       compatible = "pinconf-single";
+                       reg = <0x0 0xff3fd800 0x0 0x18>;
+                       #pinctrl-cells = <1>;
+                       pinctrl-single,register-width = <0x20>;
+
+                       sdio_clk_cfg_func: sdio_clk_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x000 0x0 /* SDIO_CLK */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_32MA DRIVE6_MASK
+                               >;
+                       };
+
+                       sdio_cfg_func: sdio_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x004 0x0 /* SDIO_CMD */
+                                       0x008 0x0 /* SDIO_DATA0 */
+                                       0x00c 0x0 /* SDIO_DATA1 */
+                                       0x010 0x0 /* SDIO_DATA2 */
+                                       0x014 0x0 /* SDIO_DATA3 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_19MA DRIVE6_MASK
+                               >;
+                       };
+               };
+
+               pmx8: pinmux@ff37e800 {
+                       compatible = "pinconf-single";
+                       reg = <0x0 0xff37e800 0x0 0x18>;
+                       #pinctrl-cells = <1>;
+                       pinctrl-single,register-width = <0x20>;
+
+                       sd_clk_cfg_func: sd_clk_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x000 0x0 /* SD_CLK */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_32MA
+                                       DRIVE6_MASK
+                               >;
+                       };
+
+                       sd_cfg_func: sd_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x004 0x0 /* SD_CMD */
+                                       0x008 0x0 /* SD_DATA0 */
+                                       0x00c 0x0 /* SD_DATA1 */
+                                       0x010 0x0 /* SD_DATA2 */
+                                       0x014 0x0 /* SD_DATA3 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_19MA
+                                       DRIVE6_MASK
+                               >;
+                       };
+               };
+
+               pmx9: pinmux@fff11800 {
+                       compatible = "pinconf-single";
+                       reg = <0x0 0xfff11800 0x0 0xbc>;
+                       #pinctrl-cells = <1>;
+                       pinctrl-single,register-width = <0x20>;
+
+                       i2c0_cfg_func: i2c0_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x01c 0x0 /* I2C0_SCL */
+                                       0x020 0x0 /* I2C0_SDA */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       i2c1_cfg_func: i2c1_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x024 0x0 /* I2C1_SCL */
+                                       0x028 0x0 /* I2C1_SDA */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       i2c7_cfg_func: i2c7_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x02c 0x0 /* I2C7_SCL */
+                                       0x030 0x0 /* I2C7_SDA */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       slimbus_cfg_func: slimbus_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x034 0x0 /* SLIMBUS_CLK */
+                                       0x038 0x0 /* SLIMBUS_DATA */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       i2s0_cfg_func: i2s0_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x040 0x0 /* I2S0_DI */
+                                       0x044 0x0 /* I2S0_DO */
+                                       0x048 0x0 /* I2S0_XCLK */
+                                       0x04c 0x0 /* I2S0_XFS */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       i2s2_cfg_func: i2s2_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x050 0x0 /* I2S2_DI */
+                                       0x054 0x0 /* I2S2_DO */
+                                       0x058 0x0 /* I2S2_XCLK */
+                                       0x05c 0x0 /* I2S2_XFS */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       pcie_cfg_func: pcie_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x094 0x0 /* PCIE_CLKREQ_N */
+                                       0x098 0x0 /* PCIE_WAKE_N */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       spi2_cfg_func: spi2_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x09c 0x0 /* SPI2_CLK */
+                                       0x0a0 0x0 /* SPI2_DI */
+                                       0x0a4 0x0 /* SPI2_DO */
+                                       0x0a8 0x0 /* SPI2_CS0_N */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
+                               >;
+                       };
+
+                       usb_cfg_func: usb_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0ac 0x0 /* GPIO_219 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE7_02MA DRIVE6_MASK
                                >;
                        };
                };
index a89855f57091fac35d3ba4b9821fd2a902f5ed77..9df0f06ce6070a4c17c724d52bb956504dc8e2b7 100644 (file)
  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  *     OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * This file is compatible with the version 1.4 and the version 2.0 of
+ * the board, however the CON numbers are different between the 2
+ * version
  */
 
 /dts-v1/;
                compatible = "usb-nop-xceiv";
                vcc-supply = <&exp_usb3_vbus>;
        };
+
+       vcc_sd_reg1: regulator {
+               compatible = "regulator-gpio";
+               regulator-name = "vcc_sd1";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+
+               gpios = <&gpiosb 23 GPIO_ACTIVE_HIGH>;
+               gpios-states = <0>;
+               states = <1800000 0x1
+                         3300000 0x0>;
+               enable-active-high;
+       };
+};
+
+/* Gigabit module on CON19(V2.0)/CON21(V1.4) */
+&eth0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       phy-mode = "rgmii-id";
+       phy = <&phy0>;
+       status = "okay";
+};
+
+/* Gigabit module on CON18(V2.0)/CON20(V1.4) */
+&eth1 {
+       phy-mode = "sgmii";
+       phy = <&phy1>;
+       status = "okay";
 };
 
 &i2c0 {
        };
 };
 
+&mdio {
+       status = "okay";
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+
+       phy1: ethernet-phy@1 {
+               reg = <1>;
+       };
+};
+
+/* CON15(V2.0)/CON17(V1.4) : PCIe / CON15(V2.0)/CON12(V1.4) :mini-PCIe */
+&pcie0 {
+       status = "okay";
+};
+
 /* CON3 */
 &sata {
        status = "okay";
 };
 
+&sdhci0 {
+       non-removable;
+       bus-width = <8>;
+       mmc-ddr-1_8v;
+       mmc-hs400-1_8v;
+       marvell,pad-type = "fixed-1-8v";
+       status = "okay";
+};
+
+/* SD slot module on CON14(V2.0)/CON15(V1.4) */
+&sdhci1 {
+       wp-inverted;
+       cd-gpios = <&gpiosb 2 GPIO_ACTIVE_LOW>;
+       bus-width = <4>;
+       marvell,pad-type = "sd";
+       vqmmc-supply = <&vcc_sd_reg1>;
+       status = "okay";
+};
+
 &spi0 {
        status = "okay";
        pinctrl-names = "default";
        };
 };
 
-/* Exported on the micro USB connector CON32 through an FTDI */
+/*
+ * Exported on the micro USB connector CON30(V2.0)/CON32(V1.4) through
+ * an FTDI
+ */
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart1_pins>;
        status = "okay";
 };
 
-&sdhci0 {
-       non-removable;
-       bus-width = <8>;
-       mmc-ddr-1_8v;
-       mmc-hs400-1_8v;
-       marvell,pad-type = "fixed-1-8v";
+/* CON27(V2.0)/CON29(V1.4) */
+&usb2 {
        status = "okay";
 };
 
-/* CON31 */
+/* CON29(V2.0)/CON31(V1.4) */
 &usb3 {
        status = "okay";
        usb-phy = <&usb3_phy>;
 };
-
-/* CON17 (PCIe) / CON12 (mini-PCIe) */
-&pcie0 {
-       status = "okay";
-};
-
-/* CON27 */
-&usb2 {
-       status = "okay";
-};
-
-
-&mdio {
-       status = "okay";
-       phy0: ethernet-phy@0 {
-               reg = <0>;
-       };
-
-       phy1: ethernet-phy@1 {
-               reg = <1>;
-       };
-};
-
-&eth0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
-       phy-mode = "rgmii-id";
-       phy = <&phy0>;
-       status = "okay";
-};
-
-&eth1 {
-       phy-mode = "sgmii";
-       phy = <&phy1>;
-       status = "okay";
-};
index 4d495ec39202d0c34b46996598466ec87d116eea..b4d27857c61b0091c8fc569d0db51a8513d043a9 100644 (file)
 
                        pinctrl_nb: pinctrl@13800 {
                                compatible = "marvell,armada3710-nb-pinctrl",
-                               "syscon", "simple-mfd";
+                                            "syscon", "simple-mfd";
                                reg = <0x13800 0x100>, <0x13C00 0x20>;
                                gpionb: gpio {
                                        #gpio-cells = <2>;
 
                        pinctrl_sb: pinctrl@18800 {
                                compatible = "marvell,armada3710-sb-pinctrl",
-                               "syscon", "simple-mfd";
+                                            "syscon", "simple-mfd";
                                reg = <0x18800 0x100>, <0x18C00 0x20>;
                                gpiosb: gpio {
                                        #gpio-cells = <2>;
 
                        xor@60900 {
                                compatible = "marvell,armada-3700-xor";
-                               reg = <0x60900 0x100
-                                      0x60b00 0x100>;
+                               reg = <0x60900 0x100>,
+                                     <0x60b00 0x100>;
 
                                xor10 {
                                        interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
                                };
                        };
 
+                       sdhci1: sdhci@d0000 {
+                               compatible = "marvell,armada-3700-sdhci",
+                                            "marvell,sdhci-xenon";
+                               reg = <0xd0000 0x300>,
+                                     <0x1e808 0x4>;
+                               interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&nb_periph_clk 0>;
+                               clock-names = "core";
+                               status = "disabled";
+                       };
+
                        sdhci0: sdhci@d8000 {
                                compatible = "marvell,armada-3700-sdhci",
-                               "marvell,sdhci-xenon";
-                               reg = <0xd8000 0x300
-                                      0x17808 0x4>;
+                                            "marvell,sdhci-xenon";
+                               reg = <0xd8000 0x300>,
+                                     <0x17808 0x4>;
                                interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&nb_periph_clk 0>;
                                clock-names = "core";
index 975e73302753de53a48b30e331fe8af966489c69..4ab012991d9d974df21fb1d227f317507b65e2a9 100644 (file)
@@ -46,7 +46,7 @@
  */
 
 #include "armada-ap806-dual.dtsi"
-#include "armada-cp110-master.dtsi"
+#include "armada-70x0.dtsi"
 
 / {
        model = "Marvell Armada 7020";
index 12442329b80f1147da2c59e4ab0dc91f30b5d5e3..92c761c380d33c37f5d6070729b02c23a6d93752 100644 (file)
 };
 
 &cpm_mdio {
+       status = "okay";
+
        phy0: ethernet-phy@0 {
                reg = <0>;
        };
        phy = <&phy1>;
        phy-mode = "rgmii-id";
 };
-
-&cpm_crypto {
-       status = "okay";
-};
index 78d995d62707190dc19bc1f1e8cf20e6f7d64e45..cbe460b8fc0004d5ffd278a4a5d1af36f5b594a0 100644 (file)
@@ -46,7 +46,7 @@
  */
 
 #include "armada-ap806-quad.dtsi"
-#include "armada-cp110-master.dtsi"
+#include "armada-70x0.dtsi"
 
 / {
        model = "Marvell Armada 7040";
diff --git a/arch/arm64/boot/dts/marvell/armada-70x0.dtsi b/arch/arm64/boot/dts/marvell/armada-70x0.dtsi
new file mode 100644 (file)
index 0000000..860b6ae
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017 Marvell Technology Group Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPLv2 or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Device Tree file for the Armada 70x0 SoC
+ */
+
+#include "armada-cp110-master.dtsi"
+
+/ {
+       aliases {
+               gpio1 = &cpm_gpio1;
+               gpio2 = &cpm_gpio2;
+       };
+};
+
+&cpm_gpio1 {
+       status = "okay";
+};
+
+&cpm_gpio2 {
+       status = "okay";
+};
+
+&cpm_syscon0 {
+       cpm_pinctrl: pinctrl {
+               compatible = "marvell,armada-7k-pinctrl";
+       };
+};
index 7c08f1f28d9e05ab95c388b6aec41193970f52c1..0ba0bc9425985c10256234d4fd19613a2a9fc253 100644 (file)
@@ -46,8 +46,7 @@
  */
 
 #include "armada-ap806-dual.dtsi"
-#include "armada-cp110-master.dtsi"
-#include "armada-cp110-slave.dtsi"
+#include "armada-80x0.dtsi"
 
 / {
        model = "Marvell Armada 8020";
index dc0d084005b2ef1b23bc97bf8b940e75eda50576..1e8f7242ed6ff97f7fe153ee7dc26fa1e950def4 100644 (file)
 };
 
 &cpm_mdio {
+       status = "okay";
+
        phy1: ethernet-phy@1 {
                reg = <1>;
        };
        phy-mode = "rgmii-id";
 };
 
-&cpm_crypto {
-       status = "okay";
-};
-
 /* CON5 on CP1 expansion */
 &cps_pcie2 {
        status = "okay";
        status = "okay";
 };
 
+&cps_mdio {
+       status = "okay";
+
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+};
+
+&cps_ethernet {
+       status = "okay";
+};
+
+&cps_eth1 {
+       status = "okay";
+       phy = <&phy0>;
+       phy-mode = "rgmii-id";
+};
+
 &ap_sdhci0 {
        status = "okay";
        bus-width = <4>;
index f7bb0cc03147ad773034f74aed563a8feab03488..4968e731de612e3f781bed2760a0131cb5b42d55 100644 (file)
        status = "okay";
 };
 
+&ap_sdhci0 {
+       bus-width = <8>;
+       /*
+        * Not stable in HS modes - phy needs "more calibration", so add
+        * the "slow-mode" and disable SDR104, SDR50 and DDR50 modes.
+        */
+       marvell,xenon-phy-slow-mode;
+       no-1-8-v;
+       no-sd;
+       no-sdio;
+       non-removable;
+       status = "okay";
+       vqmmc-supply = <&v_vddo_h>;
+};
+
 &cpm_i2c0 {
        clock-frequency = <100000>;
        status = "okay";
 };
 
+&cpm_mdio {
+       status = "okay";
+
+       ge_phy: ethernet-phy@0 {
+               reg = <0>;
+       };
+};
+
 &cpm_sata0 {
        /* CPM Lane 0 - U29 */
        status = "okay";
 };
 
+&cpm_sdhci0 {
+       /* U6 */
+       broken-cd;
+       bus-width = <4>;
+       status = "okay";
+       vqmmc-supply = <&v_3_3>;
+};
+
 &cpm_usb3_0 {
        /* J38? - USB2.0 only */
        status = "okay";
        status = "okay";
 };
 
+&cps_ethernet {
+       status = "okay";
+};
+
+&cps_eth1 {
+       /* CPS Lane 0 - J5 (Gigabit RJ45) */
+       status = "okay";
+       phy = <&ge_phy>;
+       phy-mode = "sgmii";
+};
+
 &cps_sata0 {
        /* CPS Lane 1 - U32 */
        /* CPS Lane 3 - U31 */
index 33813a75bc309032cff84b51f97269c1c15abddc..60fe84f5cbcce45819ec5d7ac7c7dce68344aff5 100644 (file)
@@ -46,8 +46,7 @@
  */
 
 #include "armada-ap806-quad.dtsi"
-#include "armada-cp110-master.dtsi"
-#include "armada-cp110-slave.dtsi"
+#include "armada-80x0.dtsi"
 
 / {
        model = "Marvell Armada 8040";
diff --git a/arch/arm64/boot/dts/marvell/armada-80x0.dtsi b/arch/arm64/boot/dts/marvell/armada-80x0.dtsi
new file mode 100644 (file)
index 0000000..666ebe9
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2017 Marvell Technology Group Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPLv2 or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Device Tree file for the Armada 80x0 SoC family
+ */
+
+#include "armada-cp110-master.dtsi"
+#include "armada-cp110-slave.dtsi"
+
+/ {
+       aliases {
+               gpio1 = &cps_gpio1;
+               gpio2 = &cpm_gpio2;
+       };
+};
+
+/* The 80x0 has two CP blocks, but uses only one block from each. */
+&cps_gpio1 {
+       status = "okay";
+};
+
+&cpm_gpio2 {
+       status = "okay";
+};
+
+&cpm_syscon0 {
+       cpm_pinctrl: pinctrl {
+               compatible = "marvell,armada-8k-cpm-pinctrl";
+       };
+};
+
+&cps_syscon0 {
+       cps_pinctrl: pinctrl {
+               compatible = "marvell,armada-8k-cps-pinctrl";
+       };
+};
index fe41bf9c301e2f81e18da871b53f41e4f2ca77f0..1eb1f1e9aac4cfb36d2de827ff8c5bd4970a3ad0 100644 (file)
@@ -57,6 +57,7 @@
        aliases {
                serial0 = &uart0;
                serial1 = &uart1;
+               gpio0 = &ap_gpio;
        };
 
        psci {
                                marvell,spi-base = <128>, <136>, <144>, <152>;
                        };
 
+                       gicp: gicp@3f0040 {
+                               compatible = "marvell,ap806-gicp";
+                               reg = <0x3f0040 0x10>;
+                               marvell,spi-ranges = <64 64>, <288 64>;
+                               msi-controller;
+                       };
+
                        pic: interrupt-controller@3f0100 {
                                compatible = "marvell,armada-8k-pic";
                                reg = <0x3f0100 0x10>;
                                reg = <0x400000 0x1000>,
                                      <0x410000 0x1000>;
                                msi-parent = <&gic_v2m0>;
+                               clocks = <&ap_clk 3>;
                                dma-coherent;
                        };
 
                                reg = <0x420000 0x1000>,
                                      <0x430000 0x1000>;
                                msi-parent = <&gic_v2m0>;
+                               clocks = <&ap_clk 3>;
                                dma-coherent;
                        };
 
                                reg = <0x440000 0x1000>,
                                      <0x450000 0x1000>;
                                msi-parent = <&gic_v2m0>;
+                               clocks = <&ap_clk 3>;
                                dma-coherent;
                        };
 
                                reg = <0x460000 0x1000>,
                                      <0x470000 0x1000>;
                                msi-parent = <&gic_v2m0>;
+                               clocks = <&ap_clk 3>;
                                dma-coherent;
                        };
 
                                #size-cells = <0>;
                                cell-index = <0>;
                                interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&ap_syscon 3>;
+                               clocks = <&ap_clk 3>;
                                status = "disabled";
                        };
 
                                #size-cells = <0>;
                                interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
                                timeout-ms = <1000>;
-                               clocks = <&ap_syscon 3>;
+                               clocks = <&ap_clk 3>;
                                status = "disabled";
                        };
 
                                reg-shift = <2>;
                                interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
                                reg-io-width = <1>;
-                               clocks = <&ap_syscon 3>;
+                               clocks = <&ap_clk 3>;
                                status = "disabled";
                        };
 
                                reg-shift = <2>;
                                interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
                                reg-io-width = <1>;
-                               clocks = <&ap_syscon 3>;
+                               clocks = <&ap_clk 3>;
                                status = "disabled";
 
                        };
                                reg = <0x6e0000 0x300>;
                                interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
                                clock-names = "core";
-                               clocks = <&ap_syscon 4>;
+                               clocks = <&ap_clk 4>;
                                dma-coherent;
                                marvell,xenon-phy-slow-mode;
                                status = "disabled";
                        };
 
                        ap_syscon: system-controller@6f4000 {
-                               compatible = "marvell,ap806-system-controller",
-                                            "syscon";
-                               #clock-cells = <1>;
-                               clock-output-names = "ap-cpu-cluster-0",
-                                                    "ap-cpu-cluster-1",
-                                                    "ap-fixed", "ap-mss",
-                                                    "ap-emmc";
+                               compatible = "syscon", "simple-mfd";
                                reg = <0x6f4000 0x1000>;
+
+                               ap_clk: clock {
+                                       compatible = "marvell,ap806-clock";
+                                       #clock-cells = <1>;
+                               };
+
+                               ap_pinctrl: pinctrl {
+                                       compatible = "marvell,ap806-pinctrl";
+                               };
+
+                               ap_gpio: gpio {
+                                       compatible = "marvell,armada-8k-gpio";
+                                       offset = <0x1040>;
+                                       ngpios = <19>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-ranges = <&ap_pinctrl 0 0 19>;
+                               };
                        };
                };
        };
index b4bc42ece7541154431a5855c4bbe0f984094445..f611e843094c6d2e7decb3ce3e8f92384e921165 100644 (file)
  * Device Tree file for Marvell Armada CP110 Master.
  */
 
+#define ICU_GRP_NSR 0x0
+
 / {
        cp110-master {
                #address-cells = <2>;
                #size-cells = <2>;
                compatible = "simple-bus";
-               interrupt-parent = <&gic>;
+               interrupt-parent = <&cpm_icu>;
                ranges;
 
                config-space@f2000000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "simple-bus";
-                       interrupt-parent = <&gic>;
                        ranges = <0x0 0x0 0xf2000000 0x2000000>;
 
                        cpm_ethernet: ethernet@0 {
                                compatible = "marvell,armada-7k-pp22";
                                reg = <0x0 0x100000>, <0x129000 0xb000>;
-                               clocks = <&cpm_syscon0 1 3>, <&cpm_syscon0 1 9>, <&cpm_syscon0 1 5>;
+                               clocks = <&cpm_clk 1 3>, <&cpm_clk 1 9>, <&cpm_clk 1 5>;
                                clock-names = "pp_clk", "gop_clk", "mg_clk";
                                status = "disabled";
                                dma-coherent;
 
                                cpm_eth0: eth0 {
-                                       interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>;
                                        port-id = <0>;
                                        gop-port-id = <0>;
                                        status = "disabled";
                                };
 
                                cpm_eth1: eth1 {
-                                       interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupts = <ICU_GRP_NSR 40 IRQ_TYPE_LEVEL_HIGH>;
                                        port-id = <1>;
                                        gop-port-id = <2>;
                                        status = "disabled";
                                };
 
                                cpm_eth2: eth2 {
-                                       interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupts = <ICU_GRP_NSR 41 IRQ_TYPE_LEVEL_HIGH>;
                                        port-id = <2>;
                                        gop-port-id = <3>;
                                        status = "disabled";
                                #size-cells = <0>;
                                compatible = "marvell,orion-mdio";
                                reg = <0x12a200 0x10>;
+                               clocks = <&cpm_clk 1 9>, <&cpm_clk 1 5>;
+                               status = "disabled";
+                       };
+
+                       cpm_xmdio: mdio@12a600 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "marvell,xmdio";
+                               reg = <0x12a600 0x10>;
+                               status = "disabled";
+                       };
+
+                       cpm_icu: interrupt-controller@1e0000 {
+                               compatible = "marvell,cp110-icu";
+                               reg = <0x1e0000 0x10>;
+                               #interrupt-cells = <3>;
+                               interrupt-controller;
+                               msi-parent = <&gicp>;
                        };
 
                        cpm_syscon0: system-controller@440000 {
-                               compatible = "marvell,cp110-system-controller0",
-                                            "syscon";
+                               compatible = "syscon", "simple-mfd";
                                reg = <0x440000 0x1000>;
-                               #clock-cells = <2>;
-                               core-clock-output-names =
-                                       "cpm-apll", "cpm-ppv2-core", "cpm-eip",
-                                       "cpm-core", "cpm-nand-core";
-                               gate-clock-output-names =
-                                       "cpm-audio", "cpm-communit", "cpm-nand",
-                                       "cpm-ppv2", "cpm-sdio", "cpm-mg-domain",
-                                       "cpm-mg-core", "cpm-xor1", "cpm-xor0",
-                                       "cpm-gop-dp", "none", "cpm-pcie_x10",
-                                       "cpm-pcie_x11", "cpm-pcie_x4", "cpm-pcie-xor",
-                                       "cpm-sata", "cpm-sata-usb", "cpm-main",
-                                       "cpm-sd-mmc-gop", "none", "none",
-                                       "cpm-slow-io", "cpm-usb3h0", "cpm-usb3h1",
-                                       "cpm-usb3dev", "cpm-eip150", "cpm-eip197";
+
+                               cpm_clk: clock {
+                                       compatible = "marvell,cp110-clock";
+                                       #clock-cells = <2>;
+                               };
+
+                               cpm_gpio1: gpio@100 {
+                                       compatible = "marvell,armada-8k-gpio";
+                                       offset = <0x100>;
+                                       ngpios = <32>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-ranges = <&cpm_pinctrl 0 0 32>;
+                                       status = "disabled";
+
+                               };
+
+                               cpm_gpio2: gpio@140 {
+                                       compatible = "marvell,armada-8k-gpio";
+                                       offset = <0x140>;
+                                       ngpios = <31>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-ranges = <&cpm_pinctrl 0 32 31>;
+                                       status = "disabled";
+                               };
                        };
 
                        cpm_rtc: rtc@284000 {
                                compatible = "marvell,armada-8k-rtc";
                                reg = <0x284000 0x20>, <0x284080 0x24>;
                                reg-names = "rtc", "rtc-soc";
-                               interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <ICU_GRP_NSR 77 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        cpm_sata0: sata@540000 {
                                compatible = "marvell,armada-8k-ahci",
                                             "generic-ahci";
                                reg = <0x540000 0x30000>;
-                               interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cpm_syscon0 1 15>;
+                               interrupts = <ICU_GRP_NSR 107 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cpm_clk 1 15>;
                                status = "disabled";
                        };
 
                                             "generic-xhci";
                                reg = <0x500000 0x4000>;
                                dma-coherent;
-                               interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cpm_syscon0 1 22>;
+                               interrupts = <ICU_GRP_NSR 106 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cpm_clk 1 22>;
                                status = "disabled";
                        };
 
                                             "generic-xhci";
                                reg = <0x510000 0x4000>;
                                dma-coherent;
-                               interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cpm_syscon0 1 23>;
+                               interrupts = <ICU_GRP_NSR 105 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cpm_clk 1 23>;
                                status = "disabled";
                        };
 
                                      <0x6b0000 0x1000>;
                                dma-coherent;
                                msi-parent = <&gic_v2m0>;
-                               clocks = <&cpm_syscon0 1 8>;
+                               clocks = <&cpm_clk 1 8>;
                        };
 
                        cpm_xor1: xor@6c0000 {
                                      <0x6d0000 0x1000>;
                                dma-coherent;
                                msi-parent = <&gic_v2m0>;
-                               clocks = <&cpm_syscon0 1 7>;
+                               clocks = <&cpm_clk 1 7>;
                        };
 
                        cpm_spi0: spi@700600 {
                                #address-cells = <0x1>;
                                #size-cells = <0x0>;
                                cell-index = <1>;
-                               clocks = <&cpm_syscon0 1 21>;
+                               clocks = <&cpm_clk 1 21>;
                                status = "disabled";
                        };
 
                                #address-cells = <1>;
                                #size-cells = <0>;
                                cell-index = <2>;
-                               clocks = <&cpm_syscon0 1 21>;
+                               clocks = <&cpm_clk 1 21>;
                                status = "disabled";
                        };
 
                                reg = <0x701000 0x20>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cpm_syscon0 1 21>;
+                               interrupts = <ICU_GRP_NSR 120 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cpm_clk 1 21>;
                                status = "disabled";
                        };
 
                                reg = <0x701100 0x20>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cpm_syscon0 1 21>;
+                               interrupts = <ICU_GRP_NSR 121 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cpm_clk 1 21>;
                                status = "disabled";
                        };
 
                        cpm_trng: trng@760000 {
                                compatible = "marvell,armada-8k-rng", "inside-secure,safexcel-eip76";
                                reg = <0x760000 0x7d>;
-                               interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cpm_syscon0 1 25>;
+                               interrupts = <ICU_GRP_NSR 95 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cpm_clk 1 25>;
                                status = "okay";
                        };
 
                        cpm_sdhci0: sdhci@780000 {
                                compatible = "marvell,armada-cp110-sdhci";
                                reg = <0x780000 0x300>;
-                               interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <ICU_GRP_NSR 27 IRQ_TYPE_LEVEL_HIGH>;
                                clock-names = "core";
-                               clocks = <&cpm_syscon0 1 4>;
+                               clocks = <&cpm_clk 1 4>;
                                dma-coherent;
                                status = "disabled";
                        };
                        cpm_crypto: crypto@800000 {
                                compatible = "inside-secure,safexcel-eip197";
                                reg = <0x800000 0x200000>;
-                               interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <ICU_GRP_NSR 87 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 88 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 89 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 90 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 91 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 92 IRQ_TYPE_LEVEL_HIGH>;
                                interrupt-names = "mem", "ring0", "ring1",
                                "ring2", "ring3", "eip";
-                               clocks = <&cpm_syscon0 1 26>;
-                               status = "disabled";
+                               clocks = <&cpm_clk 1 26>;
+                               dma-mask = <0xff 0xffffffff>;
                        };
                };
 
                                /* non-prefetchable memory */
                                0x82000000 0 0xf6000000 0  0xf6000000 0 0xf00000>;
                        interrupt-map-mask = <0 0 0 0>;
-                       interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-map = <0 0 0 0 &cpm_icu 0 ICU_GRP_NSR 22 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupts = <ICU_GRP_NSR 22 IRQ_TYPE_LEVEL_HIGH>;
                        num-lanes = <1>;
-                       clocks = <&cpm_syscon0 1 13>;
+                       clocks = <&cpm_clk 1 13>;
                        status = "disabled";
                };
 
                                /* non-prefetchable memory */
                                0x82000000 0 0xf7000000 0  0xf7000000 0 0xf00000>;
                        interrupt-map-mask = <0 0 0 0>;
-                       interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-map = <0 0 0 0 &cpm_icu 0 ICU_GRP_NSR 24 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupts = <ICU_GRP_NSR 24 IRQ_TYPE_LEVEL_HIGH>;
 
                        num-lanes = <1>;
-                       clocks = <&cpm_syscon0 1 11>;
+                       clocks = <&cpm_clk 1 11>;
                        status = "disabled";
                };
 
                                /* non-prefetchable memory */
                                0x82000000 0 0xf8000000 0  0xf8000000 0 0xf00000>;
                        interrupt-map-mask = <0 0 0 0>;
-                       interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-map = <0 0 0 0 &cpm_icu 0 ICU_GRP_NSR 23 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupts = <ICU_GRP_NSR 23 IRQ_TYPE_LEVEL_HIGH>;
 
                        num-lanes = <1>;
-                       clocks = <&cpm_syscon0 1 12>;
+                       clocks = <&cpm_clk 1 12>;
                        status = "disabled";
                };
        };
index 6e2058847ddcd59ca9fd0d472bfb94f5331b00cd..84d3bd80eb51861f04a5aa9257edef50a9f9c0f6 100644 (file)
  * Device Tree file for Marvell Armada CP110 Slave.
  */
 
+#define ICU_GRP_NSR 0x0
+
 / {
        cp110-slave {
                #address-cells = <2>;
                #size-cells = <2>;
                compatible = "simple-bus";
-               interrupt-parent = <&gic>;
+               interrupt-parent = <&cps_icu>;
                ranges;
 
                config-space@f4000000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "simple-bus";
-                       interrupt-parent = <&gic>;
                        ranges = <0x0 0x0 0xf4000000 0x2000000>;
 
                        cps_rtc: rtc@284000 {
                        cps_ethernet: ethernet@0 {
                                compatible = "marvell,armada-7k-pp22";
                                reg = <0x0 0x100000>, <0x129000 0xb000>;
-                               clocks = <&cps_syscon0 1 3>, <&cps_syscon0 1 9>, <&cps_syscon0 1 5>;
+                               clocks = <&cps_clk 1 3>, <&cps_clk 1 9>, <&cps_clk 1 5>;
                                clock-names = "pp_clk", "gop_clk", "mg_clk";
                                status = "disabled";
                                dma-coherent;
 
                                cps_eth0: eth0 {
-                                       interrupts = <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupts = <ICU_GRP_NSR 39 IRQ_TYPE_LEVEL_HIGH>;
                                        port-id = <0>;
                                        gop-port-id = <0>;
                                        status = "disabled";
                                };
 
                                cps_eth1: eth1 {
-                                       interrupts = <GIC_SPI 262 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupts = <ICU_GRP_NSR 40 IRQ_TYPE_LEVEL_HIGH>;
                                        port-id = <1>;
                                        gop-port-id = <2>;
                                        status = "disabled";
                                };
 
                                cps_eth2: eth2 {
-                                       interrupts = <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupts = <ICU_GRP_NSR 41 IRQ_TYPE_LEVEL_HIGH>;
                                        port-id = <2>;
                                        gop-port-id = <3>;
                                        status = "disabled";
                                #size-cells = <0>;
                                compatible = "marvell,orion-mdio";
                                reg = <0x12a200 0x10>;
+                               clocks = <&cps_clk 1 9>, <&cps_clk 1 5>;
+                               status = "disabled";
+                       };
+
+                       cps_xmdio: mdio@12a600 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "marvell,xmdio";
+                               reg = <0x12a600 0x10>;
+                               status = "disabled";
+                       };
+
+                       cps_icu: interrupt-controller@1e0000 {
+                               compatible = "marvell,cp110-icu";
+                               reg = <0x1e0000 0x10>;
+                               #interrupt-cells = <3>;
+                               interrupt-controller;
+                               msi-parent = <&gicp>;
                        };
 
                        cps_syscon0: system-controller@440000 {
-                               compatible = "marvell,cp110-system-controller0",
-                                            "syscon";
+                               compatible = "syscon", "simple-mfd";
                                reg = <0x440000 0x1000>;
-                               #clock-cells = <2>;
-                               core-clock-output-names =
-                                       "cps-apll", "cps-ppv2-core", "cps-eip",
-                                       "cps-core", "cps-nand-core";
-                               gate-clock-output-names =
-                                       "cps-audio", "cps-communit", "cps-nand",
-                                       "cps-ppv2", "cps-sdio", "cps-mg-domain",
-                                       "cps-mg-core", "cps-xor1", "cps-xor0",
-                                       "cps-gop-dp", "none", "cps-pcie_x10",
-                                       "cps-pcie_x11", "cps-pcie_x4", "cps-pcie-xor",
-                                       "cps-sata", "cps-sata-usb", "cps-main",
-                                       "cps-sd-mmc-gop", "none", "none",
-                                       "cps-slow-io", "cps-usb3h0", "cps-usb3h1",
-                                       "cps-usb3dev", "cps-eip150", "cps-eip197";
+
+                               cps_clk: clock {
+                                       compatible = "marvell,cp110-clock";
+                                       #clock-cells = <2>;
+                               };
+
+                               cps_gpio1: gpio@100 {
+                                       compatible = "marvell,armada-8k-gpio";
+                                       offset = <0x100>;
+                                       ngpios = <32>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-ranges = <&cps_pinctrl 0 0 32>;
+                                       status = "disabled";
+
+                               };
+
+                               cps_gpio2: gpio@140 {
+                                       compatible = "marvell,armada-8k-gpio";
+                                       offset = <0x140>;
+                                       ngpios = <31>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       gpio-ranges = <&cps_pinctrl 0 32 31>;
+                                       status = "disabled";
+                               };
+
                        };
 
                        cps_sata0: sata@540000 {
                                compatible = "marvell,armada-8k-ahci",
                                             "generic-ahci";
                                reg = <0x540000 0x30000>;
-                               interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cps_syscon0 1 15>;
+                               interrupts = <ICU_GRP_NSR 107 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cps_clk 1 15>;
                                status = "disabled";
                        };
 
                                             "generic-xhci";
                                reg = <0x500000 0x4000>;
                                dma-coherent;
-                               interrupts = <GIC_SPI 286 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cps_syscon0 1 22>;
+                               interrupts = <ICU_GRP_NSR 106 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cps_clk 1 22>;
                                status = "disabled";
                        };
 
                                             "generic-xhci";
                                reg = <0x510000 0x4000>;
                                dma-coherent;
-                               interrupts = <GIC_SPI 285 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cps_syscon0 1 23>;
+                               interrupts = <ICU_GRP_NSR 105 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cps_clk 1 23>;
                                status = "disabled";
                        };
 
                                      <0x6b0000 0x1000>;
                                dma-coherent;
                                msi-parent = <&gic_v2m0>;
-                               clocks = <&cps_syscon0 1 8>;
+                               clocks = <&cps_clk 1 8>;
                        };
 
                        cps_xor1: xor@6c0000 {
                                      <0x6d0000 0x1000>;
                                dma-coherent;
                                msi-parent = <&gic_v2m0>;
-                               clocks = <&cps_syscon0 1 7>;
+                               clocks = <&cps_clk 1 7>;
                        };
 
                        cps_spi0: spi@700600 {
                                #address-cells = <0x1>;
                                #size-cells = <0x0>;
                                cell-index = <3>;
-                               clocks = <&cps_syscon0 1 21>;
+                               clocks = <&cps_clk 1 21>;
                                status = "disabled";
                        };
 
                                #address-cells = <1>;
                                #size-cells = <0>;
                                cell-index = <4>;
-                               clocks = <&cps_syscon0 1 21>;
+                               clocks = <&cps_clk 1 21>;
                                status = "disabled";
                        };
 
                                reg = <0x701000 0x20>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interrupts = <GIC_SPI 310 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cps_syscon0 1 21>;
+                               interrupts = <ICU_GRP_NSR 120 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cps_clk 1 21>;
                                status = "disabled";
                        };
 
                                reg = <0x701100 0x20>;
                                #address-cells = <1>;
                                #size-cells = <0>;
-                               interrupts = <GIC_SPI 311 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cps_syscon0 1 21>;
+                               interrupts = <ICU_GRP_NSR 121 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cps_clk 1 21>;
                                status = "disabled";
                        };
 
                        cps_trng: trng@760000 {
                                compatible = "marvell,armada-8k-rng", "inside-secure,safexcel-eip76";
                                reg = <0x760000 0x7d>;
-                               interrupts = <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&cps_syscon0 1 25>;
+                               interrupts = <ICU_GRP_NSR 95 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&cps_clk 1 25>;
                                status = "okay";
                        };
 
                        cps_crypto: crypto@800000 {
                                compatible = "inside-secure,safexcel-eip197";
                                reg = <0x800000 0x200000>;
-                               interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 279 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 280 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 281 IRQ_TYPE_LEVEL_HIGH>,
-                                            <GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <ICU_GRP_NSR 87 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 88 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 89 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 90 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 91 IRQ_TYPE_LEVEL_HIGH>,
+                                            <ICU_GRP_NSR 92 IRQ_TYPE_LEVEL_HIGH>;
                                interrupt-names = "mem", "ring0", "ring1",
                                                  "ring2", "ring3", "eip";
-                               clocks = <&cps_syscon0 1 26>;
+                               clocks = <&cps_clk 1 26>;
+                               dma-mask = <0xff 0xffffffff>;
+                               /*
+                                * The cryptographic engine found on the cp110
+                                * master is enabled by default at the SoC
+                                * level. Because it is not possible as of now
+                                * to enable two cryptographic engines in
+                                * parallel, disable this one by default.
+                                */
                                status = "disabled";
                        };
                };
                                /* non-prefetchable memory */
                                0x82000000 0 0xfa000000 0  0xfa000000 0 0xf00000>;
                        interrupt-map-mask = <0 0 0 0>;
-                       interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-map = <0 0 0 0 &cps_icu 0 ICU_GRP_NSR 22 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupts = <ICU_GRP_NSR 22 IRQ_TYPE_LEVEL_HIGH>;
                        num-lanes = <1>;
-                       clocks = <&cps_syscon0 1 13>;
+                       clocks = <&cps_clk 1 13>;
                        status = "disabled";
                };
 
                                /* non-prefetchable memory */
                                0x82000000 0 0xfb000000 0  0xfb000000 0 0xf00000>;
                        interrupt-map-mask = <0 0 0 0>;
-                       interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupts = <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-map = <0 0 0 0 &cps_icu 0 ICU_GRP_NSR 24 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupts = <ICU_GRP_NSR 24 IRQ_TYPE_LEVEL_HIGH>;
 
                        num-lanes = <1>;
-                       clocks = <&cps_syscon0 1 11>;
+                       clocks = <&cps_clk 1 11>;
                        status = "disabled";
                };
 
                                /* non-prefetchable memory */
                                0x82000000 0 0xfc000000 0  0xfc000000 0 0xf00000>;
                        interrupt-map-mask = <0 0 0 0>;
-                       interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupts = <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-map = <0 0 0 0 &cps_icu 0 ICU_GRP_NSR 23 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupts = <ICU_GRP_NSR 23 IRQ_TYPE_LEVEL_HIGH>;
 
                        num-lanes = <1>;
-                       clocks = <&cps_syscon0 1 12>;
+                       clocks = <&cps_clk 1 12>;
                        status = "disabled";
                };
        };
index 9fbfd323846997e2b077acb465533930a4e30468..015eb072ddef78ca3eeae9aff539c4233690898e 100644 (file)
@@ -1,5 +1,6 @@
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6755-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6795-evb.dtb
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt8173-evb.dtb
 
 always         := $(dtb-y)
diff --git a/arch/arm64/boot/dts/mediatek/mt6797-evb.dts b/arch/arm64/boot/dts/mediatek/mt6797-evb.dts
new file mode 100644 (file)
index 0000000..c79109c
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Mars.C <mars.cheng@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+#include "mt6797.dtsi"
+
+/ {
+       model = "MediaTek MT6797 Evaluation Board";
+       compatible = "mediatek,mt6797-evb", "mediatek,mt6797";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0 0x40000000 0 0x1e800000>;
+       };
+
+       chosen {};
+};
+
+&uart0 {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/mediatek/mt6797.dtsi b/arch/arm64/boot/dts/mediatek/mt6797.dtsi
new file mode 100644 (file)
index 0000000..31088a9
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Mars.C <mars.cheng@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <dt-bindings/clock/mt6797-clk.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       compatible = "mediatek,mt6797";
+       interrupt-parent = <&sysirq>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       psci {
+               compatible = "arm,psci-0.2";
+               method = "smc";
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x000>;
+               };
+
+               cpu1: cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x001>;
+               };
+
+               cpu2: cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x002>;
+               };
+
+               cpu3: cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x003>;
+               };
+
+               cpu4: cpu@100 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x100>;
+               };
+
+               cpu5: cpu@101 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x101>;
+               };
+
+               cpu6: cpu@102 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x102>;
+               };
+
+               cpu7: cpu@103 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       enable-method = "psci";
+                       reg = <0x103>;
+               };
+
+               cpu8: cpu@200 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72";
+                       enable-method = "psci";
+                       reg = <0x200>;
+               };
+
+               cpu9: cpu@201 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a72";
+                       enable-method = "psci";
+                       reg = <0x201>;
+               };
+       };
+
+       clk26m: oscillator@0 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <26000000>;
+               clock-output-names = "clk26m";
+       };
+
+       clk32k: oscillator@1 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32000>;
+               clock-output-names = "clk32k";
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+       };
+
+       topckgen: topckgen@10000000 {
+               compatible = "mediatek,mt6797-topckgen";
+               reg = <0 0x10000000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       infrasys: infracfg_ao@10001000 {
+               compatible = "mediatek,mt6797-infracfg", "syscon";
+               reg = <0 0x10001000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       scpsys: scpsys@10006000 {
+               compatible = "mediatek,mt6797-scpsys";
+               #power-domain-cells = <1>;
+               reg = <0 0x10006000 0 0x1000>;
+               clocks = <&topckgen CLK_TOP_MUX_MFG>,
+                        <&topckgen CLK_TOP_MUX_MM>,
+                        <&topckgen CLK_TOP_MUX_VDEC>;
+               clock-names = "mfg", "mm", "vdec";
+               infracfg = <&infrasys>;
+       };
+
+       apmixedsys: apmixed@1000c000 {
+               compatible = "mediatek,mt6797-apmixedsys";
+               reg = <0 0x1000c000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       sysirq: intpol-controller@10200620 {
+               compatible = "mediatek,mt6797-sysirq",
+                            "mediatek,mt6577-sysirq";
+               interrupt-controller;
+               #interrupt-cells = <3>;
+               interrupt-parent = <&gic>;
+               reg = <0 0x10220620 0 0x20>,
+                     <0 0x10220690 0 0x10>;
+       };
+
+       uart0: serial@11002000 {
+               compatible = "mediatek,mt6797-uart",
+                            "mediatek,mt6577-uart";
+               reg = <0 0x11002000 0 0x400>;
+               interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&infrasys CLK_INFRA_UART0>,
+                        <&infrasys CLK_INFRA_AP_DMA>;
+               clock-names = "baud", "bus";
+               status = "disabled";
+       };
+
+       uart1: serial@11003000 {
+               compatible = "mediatek,mt6797-uart",
+                            "mediatek,mt6577-uart";
+               reg = <0 0x11003000 0 0x400>;
+               interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&infrasys CLK_INFRA_UART1>,
+                        <&infrasys CLK_INFRA_AP_DMA>;
+               clock-names = "baud", "bus";
+               status = "disabled";
+       };
+
+       uart2: serial@11004000 {
+               compatible = "mediatek,mt6797-uart",
+                            "mediatek,mt6577-uart";
+               reg = <0 0x11004000 0 0x400>;
+               interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&infrasys CLK_INFRA_UART2>,
+                        <&infrasys CLK_INFRA_AP_DMA>;
+               clock-names = "baud", "bus";
+               status = "disabled";
+       };
+
+       uart3: serial@11005000 {
+               compatible = "mediatek,mt6797-uart",
+                            "mediatek,mt6577-uart";
+               reg = <0 0x11005000 0 0x400>;
+               interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_LOW>;
+               clocks = <&infrasys CLK_INFRA_UART3>,
+                        <&infrasys CLK_INFRA_AP_DMA>;
+               clock-names = "baud", "bus";
+               status = "disabled";
+       };
+
+       mmsys: mmsys_config@14000000 {
+               compatible = "mediatek,mt6797-mmsys", "syscon";
+               reg = <0 0x14000000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       imgsys: imgsys_config@15000000  {
+               compatible = "mediatek,mt6797-imgsys", "syscon";
+               reg = <0 0x15000000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       vdecsys: vdec_gcon@16000000 {
+               compatible = "mediatek,mt6797-vdecsys", "syscon";
+               reg = <0 0x16000000 0 0x10000>;
+               #clock-cells = <1>;
+       };
+
+       vencsys: venc_gcon@17000000 {
+               compatible = "mediatek,mt6797-vencsys", "syscon";
+               reg = <0 0x17000000 0 0x1000>;
+               #clock-cells = <1>;
+       };
+
+       gic: interrupt-controller@19000000 {
+               compatible = "arm,gic-v3";
+               #interrupt-cells = <3>;
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-controller;
+               reg = <0 0x19000000 0 0x10000>,    /* GICD */
+                     <0 0x19200000 0 0x200000>,   /* GICR */
+                     <0 0x10240000 0 0x2000>;     /* GICC */
+       };
+};
index 6922252f317bca508d1c8797dfc06941f5543859..b99a27372965ec82473112094d302a5a3e596092 100644 (file)
                              <0 0x11280700 0 0x0100>;
                        reg-names = "mac", "ippc";
                        interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_LOW>;
-                       phys = <&phy_port0 PHY_TYPE_USB3>,
-                              <&phy_port1 PHY_TYPE_USB2>;
+                       phys = <&u2port0 PHY_TYPE_USB2>,
+                              <&u3port0 PHY_TYPE_USB3>,
+                              <&u2port1 PHY_TYPE_USB2>;
                        power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
                        clocks = <&topckgen CLK_TOP_USB30_SEL>,
                                 <&clk26m>,
                u3phy: usb-phy@11290000 {
                        compatible = "mediatek,mt8173-u3phy";
                        reg = <0 0x11290000 0 0x800>;
-                       clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
-                       clock-names = "u3phya_ref";
                        #address-cells = <2>;
                        #size-cells = <2>;
                        ranges;
                        status = "okay";
 
-                       phy_port0: port@11290800 {
-                               reg = <0 0x11290800 0 0x800>;
+                       u2port0: usb-phy@11290800 {
+                               reg = <0 0x11290800 0 0x100>;
+                               clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
+                               clock-names = "ref";
                                #phy-cells = <1>;
                                status = "okay";
                        };
 
-                       phy_port1: port@11291000 {
-                               reg = <0 0x11291000 0 0x800>;
+                       u3port0: usb-phy@11290900 {
+                               reg = <0 0x11290900 0 0x700>;
+                               clocks = <&clk26m>;
+                               clock-names = "ref";
+                               #phy-cells = <1>;
+                               status = "okay";
+                       };
+
+                       u2port1: usb-phy@11291000 {
+                               reg = <0 0x11291000 0 0x100>;
+                               clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
+                               clock-names = "ref";
                                #phy-cells = <1>;
                                status = "okay";
                        };
                        #clock-cells = <1>;
                };
 
-               mdp {
-                       compatible = "mediatek,mt8173-mdp";
-                       #address-cells = <2>;
-                       #size-cells = <2>;
-                       ranges;
+               mdp_rdma0: rdma@14001000 {
+                       compatible = "mediatek,mt8173-mdp-rdma",
+                                    "mediatek,mt8173-mdp";
+                       reg = <0 0x14001000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_RDMA0>,
+                                <&mmsys CLK_MM_MUTEX_32K>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+                       iommus = <&iommu M4U_PORT_MDP_RDMA0>;
+                       mediatek,larb = <&larb0>;
                        mediatek,vpu = <&vpu>;
+               };
 
-                       mdp_rdma0: rdma@14001000 {
-                               compatible = "mediatek,mt8173-mdp-rdma";
-                               reg = <0 0x14001000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_RDMA0>,
-                                        <&mmsys CLK_MM_MUTEX_32K>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                               iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-                               mediatek,larb = <&larb0>;
-                       };
-
-                       mdp_rdma1: rdma@14002000 {
-                               compatible = "mediatek,mt8173-mdp-rdma";
-                               reg = <0 0x14002000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_RDMA1>,
-                                        <&mmsys CLK_MM_MUTEX_32K>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                               iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-                               mediatek,larb = <&larb4>;
-                       };
+               mdp_rdma1: rdma@14002000 {
+                       compatible = "mediatek,mt8173-mdp-rdma";
+                       reg = <0 0x14002000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_RDMA1>,
+                                <&mmsys CLK_MM_MUTEX_32K>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+                       iommus = <&iommu M4U_PORT_MDP_RDMA1>;
+                       mediatek,larb = <&larb4>;
+               };
 
-                       mdp_rsz0: rsz@14003000 {
-                               compatible = "mediatek,mt8173-mdp-rsz";
-                               reg = <0 0x14003000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_RSZ0>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                       };
+               mdp_rsz0: rsz@14003000 {
+                       compatible = "mediatek,mt8173-mdp-rsz";
+                       reg = <0 0x14003000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_RSZ0>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+               };
 
-                       mdp_rsz1: rsz@14004000 {
-                               compatible = "mediatek,mt8173-mdp-rsz";
-                               reg = <0 0x14004000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_RSZ1>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                       };
+               mdp_rsz1: rsz@14004000 {
+                       compatible = "mediatek,mt8173-mdp-rsz";
+                       reg = <0 0x14004000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_RSZ1>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+               };
 
-                       mdp_rsz2: rsz@14005000 {
-                               compatible = "mediatek,mt8173-mdp-rsz";
-                               reg = <0 0x14005000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_RSZ2>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                       };
+               mdp_rsz2: rsz@14005000 {
+                       compatible = "mediatek,mt8173-mdp-rsz";
+                       reg = <0 0x14005000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_RSZ2>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+               };
 
-                       mdp_wdma0: wdma@14006000 {
-                               compatible = "mediatek,mt8173-mdp-wdma";
-                               reg = <0 0x14006000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_WDMA>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                               iommus = <&iommu M4U_PORT_MDP_WDMA>;
-                               mediatek,larb = <&larb0>;
-                       };
+               mdp_wdma0: wdma@14006000 {
+                       compatible = "mediatek,mt8173-mdp-wdma";
+                       reg = <0 0x14006000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_WDMA>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+                       iommus = <&iommu M4U_PORT_MDP_WDMA>;
+                       mediatek,larb = <&larb0>;
+               };
 
-                       mdp_wrot0: wrot@14007000 {
-                               compatible = "mediatek,mt8173-mdp-wrot";
-                               reg = <0 0x14007000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_WROT0>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                               iommus = <&iommu M4U_PORT_MDP_WROT0>;
-                               mediatek,larb = <&larb0>;
-                       };
+               mdp_wrot0: wrot@14007000 {
+                       compatible = "mediatek,mt8173-mdp-wrot";
+                       reg = <0 0x14007000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_WROT0>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+                       iommus = <&iommu M4U_PORT_MDP_WROT0>;
+                       mediatek,larb = <&larb0>;
+               };
 
-                       mdp_wrot1: wrot@14008000 {
-                               compatible = "mediatek,mt8173-mdp-wrot";
-                               reg = <0 0x14008000 0 0x1000>;
-                               clocks = <&mmsys CLK_MM_MDP_WROT1>;
-                               power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
-                               iommus = <&iommu M4U_PORT_MDP_WROT1>;
-                               mediatek,larb = <&larb4>;
-                       };
+               mdp_wrot1: wrot@14008000 {
+                       compatible = "mediatek,mt8173-mdp-wrot";
+                       reg = <0 0x14008000 0 0x1000>;
+                       clocks = <&mmsys CLK_MM_MDP_WROT1>;
+                       power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+                       iommus = <&iommu M4U_PORT_MDP_WROT1>;
+                       mediatek,larb = <&larb4>;
                };
 
                ovl0: ovl@1400c000 {
index 2b17936ac5be4cda30af18031effcd28fc990ab0..c2f0f27435784a2dea76f2c4f17bc4359f7f9add 100644 (file)
@@ -12,7 +12,7 @@
        #address-cells = <2>;
        #size-cells = <2>;
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                compatible = "nvidia,tegra124-pcie";
                device_type = "pci";
                reg = <0x0 0x01003000 0x0 0x00000800   /* PADS registers */
@@ -55,6 +55,7 @@
                        device_type = "pci";
                        assigned-addresses = <0x82000800 0 0x01000000 0 0x1000>;
                        reg = <0x000800 0 0 0 0>;
+                       bus-range = <0x00 0xff>;
                        status = "disabled";
 
                        #address-cells = <3>;
@@ -68,6 +69,7 @@
                        device_type = "pci";
                        assigned-addresses = <0x82001000 0 0x01001000 0 0x1000>;
                        reg = <0x001000 0 0 0 0>;
+                       bus-range = <0x00 0xff>;
                        status = "disabled";
 
                        #address-cells = <3>;
index 5e62e68ac05385b525e2ff2ef9282b0e153fd2f6..0b0552c9f7dd4a7f3c2d38d4920f43ca9356803e 100644 (file)
                reg-names = "pmc", "wake", "aotag", "scratch";
        };
 
+       ccplex@e000000 {
+               compatible = "nvidia,tegra186-ccplex-cluster";
+               reg = <0x0 0x0e000000 0x0 0x3fffff>;
+
+               nvidia,bpmp = <&bpmp>;
+       };
+
        gpu@17000000 {
                compatible = "nvidia,gp10b";
                reg = <0x0 0x17000000 0x0 0x1000000>,
index 4c1ea7a08d43ecffb7db21d715a9e7cea454a47b..7cb95e0421171d0a4cfcb77bcd2c1b382f938fd9 100644 (file)
@@ -7,7 +7,7 @@
        model = "NVIDIA Jetson TX1 Developer Kit";
        compatible = "nvidia,p2371-2180", "nvidia,tegra210";
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                status = "okay";
 
                avdd-pll-uerefe-supply = <&avdd_1v05_pll>;
index 8f26c4d4409aad7d1a880cfbef78d1e5946f7763..29f471e0f22a948023ce25ea0050dc75217ee80d 100644 (file)
@@ -11,7 +11,7 @@
        #address-cells = <2>;
        #size-cells = <2>;
 
-       pcie-controller@01003000 {
+       pcie@1003000 {
                compatible = "nvidia,tegra210-pcie";
                device_type = "pci";
                reg = <0x0 0x01003000 0x0 0x00000800   /* PADS registers */
@@ -51,6 +51,7 @@
                        device_type = "pci";
                        assigned-addresses = <0x82000800 0 0x01000000 0 0x1000>;
                        reg = <0x000800 0 0 0 0>;
+                       bus-range = <0x00 0xff>;
                        status = "disabled";
 
                        #address-cells = <3>;
@@ -64,6 +65,7 @@
                        device_type = "pci";
                        assigned-addresses = <0x82001000 0 0x01001000 0 0x1000>;
                        reg = <0x001000 0 0 0 0>;
+                       bus-range = <0x00 0xff>;
                        status = "disabled";
 
                        #address-cells = <3>;
index a17f5b9a5de6116020ae030f67e904b21f6af941..bd310ac1967ab5a07f565bcbeead67a482d2e1b3 100644 (file)
                        led@5 {
                                label = "apq8016-sbc:yellow:wlan";
                                gpios = <&pm8916_mpps 2 GPIO_ACTIVE_HIGH>;
-                               linux,default-trigger = "wlan";
+                               linux,default-trigger = "phy0tx";
                                default-state = "off";
                        };
 
                usb@78d9000 {
                        extcon = <&usb_id>, <&usb_id>;
                        status = "okay";
-               };
-
-               ehci@78d9000 {
-                       status = "okay";
-               };
-
-               phy@78d9000 {
-                       v1p8-supply = <&pm8916_l7>;
-                       v3p3-supply = <&pm8916_l13>;
-                       vddcx-supply = <&pm8916_s1>;
-                       extcon = <&usb_id>, <&usb_id>;
-                       dr_mode = "otg";
-                       status = "okay";
-                       switch-gpio = <&pm8916_gpios 4 GPIO_ACTIVE_HIGH>;
-                       pinctrl-names = "default";
-                       pinctrl-0 = <&usb_sw_sel_pm>;
+                       adp-disable;
+                       hnp-disable;
+                       srp-disable;
+                       ulpi {
+                               phy {
+                                       v1p8-supply = <&pm8916_l7>;
+                                       v3p3-supply = <&pm8916_l13>;
+                                       extcon = <&usb_id>;
+                               };
+                       };
                };
 
                lpass@07708000 {
                pinctrl-0 = <&usb_id_default>;
        };
 
+       usb-switch {
+               compatible = "toshiba,tc7usb40mu";
+               switch-gpios = <&pm8916_gpios 4 GPIO_ACTIVE_HIGH>;
+               extcon = <&usb_id>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&usb_sw_sel_pm>;
+       };
+
        hdmi-out {
                compatible = "hdmi-connector";
                type = "a";
index ab3093995ded75d7784946376b3bda12fc90b649..c963ef2ec5f58cdce997c710f480eb9cbb85bf96 100644 (file)
                        status = "disabled";
                };
 
-               usb_dev: usb@78d9000 {
+               otg: usb@78d9000 {
                        compatible = "qcom,ci-hdrc";
-                       reg = <0x78d9000 0x400>;
-                       dr_mode = "peripheral";
-                       interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
-                       usb-phy = <&usb_otg>;
-                       status = "disabled";
-               };
-
-               usb_host: ehci@78d9000 {
-                       compatible = "qcom,ehci-host";
-                       reg = <0x78d9000 0x400>;
-                       interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
-                       usb-phy = <&usb_otg>;
-                       status = "disabled";
-               };
-
-               usb_otg: phy@78d9000 {
-                       compatible = "qcom,usb-otg-snps";
-                       reg = <0x78d9000 0x400>;
+                       reg = <0x78d9000 0x200>,
+                             <0x78d9200 0x200>;
                        interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
-
-                       qcom,vdd-levels = <500000 1000000 1320000>;
-                       qcom,phy-init-sequence = <0x44 0x6B 0x24 0x13>;
-                       dr_mode = "peripheral";
-                       qcom,otg-control = <2>; // PMIC
-                       qcom,manual-pullup;
-
                        clocks = <&gcc GCC_USB_HS_AHB_CLK>,
-                                <&gcc GCC_USB_HS_SYSTEM_CLK>,
-                                <&gcc GCC_USB2A_PHY_SLEEP_CLK>;
-                       clock-names = "iface", "core", "sleep";
-
-                       resets = <&gcc GCC_USB2A_PHY_BCR>,
-                                <&gcc GCC_USB_HS_BCR>;
-                       reset-names = "phy", "link";
+                                <&gcc GCC_USB_HS_SYSTEM_CLK>;
+                       clock-names = "iface", "core";
+                       assigned-clocks = <&gcc GCC_USB_HS_SYSTEM_CLK>;
+                       assigned-clock-rates = <80000000>;
+                       resets = <&gcc GCC_USB_HS_BCR>;
+                       reset-names = "core";
+                       phy_type = "ulpi";
+                       dr_mode = "otg";
+                       ahb-burst-config = <0>;
+                       phy-names = "usb-phy";
+                       phys = <&usb_hs_phy>;
                        status = "disabled";
+                       #reset-cells = <1>;
+
+                       ulpi {
+                               usb_hs_phy: phy {
+                                       compatible = "qcom,usb-hs-phy-msm8916",
+                                                    "qcom,usb-hs-phy";
+                                       #phy-cells = <0>;
+                                       clocks = <&xo_board>, <&gcc GCC_USB2A_PHY_SLEEP_CLK>;
+                                       clock-names = "ref", "sleep";
+                                       resets = <&gcc GCC_USB2A_PHY_BCR>, <&otg 0>;
+                                       reset-names = "phy", "por";
+                                       qcom,init-seq = /bits/ 8 <0x0 0x44
+                                               0x1 0x6b 0x2 0x24 0x3 0x13>;
+                               };
+                       };
                };
 
                intc: interrupt-controller@b000000 {
index 44b2d37d8c4b52fb3e7f2ad6718df924643f487c..171578747ed083873d19e5c2152bea18d319f1e7 100644 (file)
                clock-frequency = <32768>;
        };
 
+       vreg_vph_pwr: vreg-vph-pwr {
+               compatible = "regulator-fixed";
+               status = "okay";
+               regulator-name = "vph-pwr";
+
+               regulator-min-microvolt = <3600000>;
+               regulator-max-microvolt = <3600000>;
+
+               regulator-always-on;
+       };
+
+       sfpb_mutex: hwmutex {
+               compatible = "qcom,sfpb-mutex";
+               syscon = <&sfpb_mutex_regs 0x0 0x100>;
+               #hwlock-cells = <1>;
+       };
+
+       smem {
+               compatible = "qcom,smem";
+               memory-region = <&smem_region>;
+               qcom,rpm-msg-ram = <&rpm_msg_ram>;
+               hwlocks = <&sfpb_mutex 3>;
+       };
+
        soc {
                #address-cells = <1>;
                #size-cells = <1>;
                                <0xf9002000 0x1000>;
                };
 
+               apcs: syscon@f900d000 {
+                       compatible = "syscon";
+                       reg = <0xf900d000 0x2000>;
+               };
+
                timer@f9020000 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        #power-domain-cells = <1>;
                        reg = <0xfc400000 0x2000>;
                };
+
+               rpm_msg_ram: memory@fc428000 {
+                       compatible = "qcom,rpm-msg-ram";
+                       reg = <0xfc428000 0x4000>;
+               };
+
+               sfpb_mutex_regs: syscon@fd484000 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       compatible = "syscon";
+                       reg = <0xfd484000 0x400>;
+               };
        };
 
        memory {
                device_type = "memory";
                reg = <0 0 0 0>; // bootloader will update
        };
+
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               smem_region: smem@6a00000 {
+                       reg = <0x0 0x6a00000 0x0 0x200000>;
+                       no-map;
+               };
+       };
+
 };
 
 
index 9bc9c857a000190c0ad2d655874233470d3c1cb9..8f085716e25898a19a4efb8ad493aaf60963eef9 100644 (file)
                        reg = <0x300000 0x90000>;
                };
 
+               kryocc: clock-controller@6400000 {
+                       compatible = "qcom,apcc-msm8996";
+                       reg = <0x6400000 0x90000>;
+                       #clock-cells = <1>;
+               };
+
                blsp1_spi0: spi@07575000 {
                        compatible = "qcom,spi-qup-v2.2.1";
                        reg = <0x07575000 0x600>;
diff --git a/arch/arm64/boot/dts/realtek/Makefile b/arch/arm64/boot/dts/realtek/Makefile
new file mode 100644 (file)
index 0000000..8521e92
--- /dev/null
@@ -0,0 +1,5 @@
+dtb-$(CONFIG_ARCH_REALTEK) += rtd1295-zidoo-x9s.dtb
+
+always         := $(dtb-y)
+subdir-y       := $(dts-dirs)
+clean-files    := *.dtb
diff --git a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts
new file mode 100644 (file)
index 0000000..6efa809
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2016-2017 Andreas Färber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+
+/memreserve/   0x0000000000000000 0x0000000000030000;
+/memreserve/   0x000000000001f000 0x0000000000001000;
+/memreserve/   0x0000000000030000 0x00000000000d0000;
+/memreserve/   0x0000000001b00000 0x00000000004be000;
+/memreserve/   0x0000000001ffe000 0x0000000000004000;
+
+#include "rtd1295.dtsi"
+
+/ {
+       compatible = "zidoo,x9s", "realtek,rtd1295";
+       model = "Zidoo X9S";
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x80000000>;
+       };
+
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&uart1 {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/realtek/rtd1295.dtsi b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
new file mode 100644 (file)
index 0000000..d8f8466
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Realtek RTD1295 SoC
+ *
+ * Copyright (c) 2016-2017 Andreas Färber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       compatible = "realtek,rtd1295";
+       interrupt-parent = <&gic>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <2>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       reg = <0x0 0x0>;
+                       next-level-cache = <&l2>;
+               };
+
+               cpu1: cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       reg = <0x0 0x1>;
+                       next-level-cache = <&l2>;
+               };
+
+               cpu2: cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       reg = <0x0 0x2>;
+                       next-level-cache = <&l2>;
+               };
+
+               cpu3: cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53", "arm,armv8";
+                       reg = <0x0 0x3>;
+                       next-level-cache = <&l2>;
+               };
+
+               l2: l2-cache {
+                       compatible = "cache";
+               };
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               tee@10100000 {
+                       reg = <0x10100000 0xf00000>;
+                       no-map;
+               };
+       };
+
+       arm-pmu {
+               compatible = "arm,cortex-a53-pmu";
+               interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13
+                       (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14
+                       (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11
+                       (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10
+                       (GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               /* Exclude up to 2 GiB of RAM */
+               ranges = <0x80000000 0x80000000 0x80000000>;
+
+               uart0: serial@98007800 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x98007800 0x400>,
+                             <0x98007000 0x100>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clock-frequency = <27000000>;
+                       status = "disabled";
+               };
+
+               uart1: serial@9801b200 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x9801b200 0x100>,
+                             <0x9801b00c 0x100>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clock-frequency = <432000000>;
+                       status = "disabled";
+               };
+
+               uart2: serial@9801b400 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x9801b400 0x100>,
+                             <0x9801b00c 0x100>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clock-frequency = <432000000>;
+                       status = "disabled";
+               };
+
+               gic: interrupt-controller@ff011000 {
+                       compatible = "arm,gic-400";
+                       reg = <0xff011000 0x1000>,
+                             <0xff012000 0x2000>,
+                             <0xff014000 0x2000>,
+                             <0xff016000 0x2000>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+               };
+       };
+};
index 1618e0a3c81d48bd1eb475a5bf0ceaee2162d83d..acc4bb30d485b6bc55fa50926ae678d73bdcac92 100644 (file)
@@ -1,4 +1,6 @@
 dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-salvator-x.dtb r8a7795-h3ulcb.dtb
+dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-salvator-xs.dtb
+dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-es1-salvator-x.dtb r8a7795-es1-h3ulcb.dtb
 dtb-$(CONFIG_ARCH_R8A7796) += r8a7796-salvator-x.dtb r8a7796-m3ulcb.dtb
 
 always         := $(dtb-y)
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb.dts
new file mode 100644 (file)
index 0000000..95fe207
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Device Tree Source for the H3ULCB (R-Car Starter Kit Premier) board
+ *
+ * Copyright (C) 2016 Renesas Electronics Corp.
+ * Copyright (C) 2016 Cogent Embedded, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#define CPG_AUDIO_CLK_I                R8A7795_CLK_S0D4
+
+/dts-v1/;
+#include "r8a7795-es1.dtsi"
+#include "ulcb.dtsi"
+
+/ {
+       model = "Renesas H3ULCB board based on r8a7795 ES1.x";
+       compatible = "renesas,h3ulcb", "renesas,r8a7795";
+
+       memory@48000000 {
+               device_type = "memory";
+               /* first 128MB is reserved for secure area. */
+               reg = <0x0 0x48000000 0x0 0x38000000>;
+       };
+
+       memory@500000000 {
+               device_type = "memory";
+               reg = <0x5 0x00000000 0x0 0x40000000>;
+       };
+
+       memory@600000000 {
+               device_type = "memory";
+               reg = <0x6 0x00000000 0x0 0x40000000>;
+       };
+
+       memory@700000000 {
+               device_type = "memory";
+               reg = <0x7 0x00000000 0x0 0x40000000>;
+       };
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
new file mode 100644 (file)
index 0000000..b84c156
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Device Tree Source for the Salvator-X board
+ *
+ * Copyright (C) 2015 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#define CPG_AUDIO_CLK_I                R8A7795_CLK_S0D4
+
+/dts-v1/;
+#include "r8a7795-es1.dtsi"
+#include "salvator-x.dtsi"
+
+/ {
+       model = "Renesas Salvator-X board based on r8a7795 ES1.x";
+       compatible = "renesas,salvator-x", "renesas,r8a7795";
+
+       memory@48000000 {
+               device_type = "memory";
+               /* first 128MB is reserved for secure area. */
+               reg = <0x0 0x48000000 0x0 0x38000000>;
+       };
+
+       memory@500000000 {
+               device_type = "memory";
+               reg = <0x5 0x00000000 0x0 0x40000000>;
+       };
+
+       memory@600000000 {
+               device_type = "memory";
+               reg = <0x6 0x00000000 0x0 0x40000000>;
+       };
+
+       memory@700000000 {
+               device_type = "memory";
+               reg = <0x7 0x00000000 0x0 0x40000000>;
+       };
+};
+
+&du {
+       clocks = <&cpg CPG_MOD 724>,
+                <&cpg CPG_MOD 723>,
+                <&cpg CPG_MOD 722>,
+                <&cpg CPG_MOD 721>,
+                <&cpg CPG_MOD 727>,
+                <&versaclock5 1>,
+                <&x21_clk>,
+                <&x22_clk>,
+                <&versaclock5 2>;
+       clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+                     "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
+};
+
+&ehci2 {
+       status = "okay";
+};
+
+&hdmi0 {
+       status = "okay";
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi0_out: endpoint {
+                               remote-endpoint = <&hdmi0_con>;
+                       };
+               };
+       };
+};
+
+&hdmi0_con {
+       remote-endpoint = <&rcar_dw_hdmi0_out>;
+};
+
+&hdmi1 {
+       status = "okay";
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi1_out: endpoint {
+                               remote-endpoint = <&hdmi1_con>;
+                       };
+               };
+       };
+};
+
+&hdmi1_con {
+       remote-endpoint = <&rcar_dw_hdmi1_out>;
+};
+
+&ohci2 {
+       status = "okay";
+};
+
+&pfc {
+       usb2_pins: usb2 {
+               groups = "usb2";
+               function = "usb2";
+       };
+};
+
+&sata {
+       status = "okay";
+};
+
+&usb2_phy2 {
+       pinctrl-0 = <&usb2_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi
new file mode 100644 (file)
index 0000000..a0ba7bd
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Device Tree Source for the r8a7795 ES1.x SoC
+ *
+ * Copyright (C) 2015 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include "r8a7795.dtsi"
+
+&soc {
+       xhci1: usb@ee0400000 {
+               compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci";
+               reg = <0 0xee040000 0 0xc00>;
+               interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cpg CPG_MOD 327>;
+               power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+               resets = <&cpg 327>;
+               status = "disabled";
+       };
+
+       fcpf2: fcp@fe952000 {
+               compatible = "renesas,fcpf";
+               reg = <0 0xfe952000 0 0x200>;
+               clocks = <&cpg CPG_MOD 613>;
+               power-domains = <&sysc R8A7795_PD_A3VP>;
+               resets = <&cpg 613>;
+       };
+
+       vspi2: vsp@fe9c0000 {
+               compatible = "renesas,vsp2";
+               reg = <0 0xfe9c0000 0 0x8000>;
+               interrupts = <GIC_SPI 446 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cpg CPG_MOD 629>;
+               power-domains = <&sysc R8A7795_PD_A3VP>;
+               resets = <&cpg 629>;
+
+               renesas,fcp = <&fcpvi2>;
+       };
+
+       fcpvi2: fcp@fe9cf000 {
+               compatible = "renesas,fcpv";
+               reg = <0 0xfe9cf000 0 0x200>;
+               clocks = <&cpg CPG_MOD 609>;
+               power-domains = <&sysc R8A7795_PD_A3VP>;
+               resets = <&cpg 609>;
+       };
+
+       vspd3: vsp@fea38000 {
+               compatible = "renesas,vsp2";
+               reg = <0 0xfea38000 0 0x4000>;
+               interrupts = <GIC_SPI 469 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cpg CPG_MOD 620>;
+               power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+               resets = <&cpg 620>;
+
+               renesas,fcp = <&fcpvd3>;
+       };
+
+       fcpvd3: fcp@fea3f000 {
+               compatible = "renesas,fcpv";
+               reg = <0 0xfea3f000 0 0x200>;
+               clocks = <&cpg CPG_MOD 600>;
+               power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+               resets = <&cpg 600>;
+       };
+
+       fdp1@fe948000 {
+               compatible = "renesas,fdp1";
+               reg = <0 0xfe948000 0 0x2400>;
+               interrupts = <GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cpg CPG_MOD 117>;
+               power-domains = <&sysc R8A7795_PD_A3VP>;
+               resets = <&cpg 117>;
+               renesas,fcp = <&fcpf2>;
+       };
+};
+
+&du {
+       compatible = "renesas,du-r8a7795";
+       vsps = <&vspd0 &vspd1 &vspd2 &vspd3>;
+};
index ab352159de6572c99a32eb0b1ab9775b08202863..0426f41765f0bc68f426e5284d84a354c686dbd8 100644 (file)
@@ -9,24 +9,16 @@
  * kind, whether express or implied.
  */
 
+#define CPG_AUDIO_CLK_I                R8A7795_CLK_S0D4
+
 /dts-v1/;
 #include "r8a7795.dtsi"
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
+#include "ulcb.dtsi"
 
 / {
-       model = "Renesas H3ULCB board based on r8a7795";
+       model = "Renesas H3ULCB board based on r8a7795 ES2.0+";
        compatible = "renesas,h3ulcb", "renesas,r8a7795";
 
-       aliases {
-               serial0 = &scif2;
-               ethernet0 = &avb;
-       };
-
-       chosen {
-               stdout-path = "serial0:115200n8";
-       };
-
        memory@48000000 {
                device_type = "memory";
                /* first 128MB is reserved for secure area. */
                device_type = "memory";
                reg = <0x7 0x00000000 0x0 0x40000000>;
        };
-
-       leds {
-               compatible = "gpio-leds";
-
-               led5 {
-                       gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
-               };
-               led6 {
-                       gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       keyboard {
-               compatible = "gpio-keys";
-
-               key-1 {
-                       linux,code = <KEY_1>;
-                       label = "SW3";
-                       wakeup-source;
-                       debounce-interval = <20>;
-                       gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
-               };
-       };
-
-       x12_clk: x12 {
-               compatible = "fixed-clock";
-               #clock-cells = <0>;
-               clock-frequency = <24576000>;
-       };
-
-       reg_1p8v: regulator0 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-1.8V";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       reg_3p3v: regulator1 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-3.3V";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       vcc_sdhi0: regulator-vcc-sdhi0 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "SDHI0 Vcc";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vccq_sdhi0: regulator-vccq-sdhi0 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI0 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
-               gpios-states = <1>;
-               states = <3300000 1
-                         1800000 0>;
-       };
-
-       audio_clkout: audio-clkout {
-               /*
-                * This is same as <&rcar_sound 0>
-                * but needed to avoid cs2000/rcar_sound probe dead-lock
-                */
-               compatible = "fixed-clock";
-               #clock-cells = <0>;
-               clock-frequency = <11289600>;
-       };
-
-       rsnd_ak4613: sound {
-               compatible = "simple-audio-card";
-
-               simple-audio-card,format = "left_j";
-               simple-audio-card,bitclock-master = <&sndcpu>;
-               simple-audio-card,frame-master = <&sndcpu>;
-
-               sndcpu: simple-audio-card,cpu {
-                       sound-dai = <&rcar_sound>;
-               };
-
-               sndcodec: simple-audio-card,codec {
-                       sound-dai = <&ak4613>;
-               };
-       };
-};
-
-&extal_clk {
-       clock-frequency = <16666666>;
-};
-
-&extalr_clk {
-       clock-frequency = <32768>;
-};
-
-&pfc {
-       pinctrl-0 = <&scif_clk_pins>;
-       pinctrl-names = "default";
-
-       scif2_pins: scif2 {
-               groups = "scif2_data_a";
-               function = "scif2";
-       };
-
-       scif_clk_pins: scif_clk {
-               groups = "scif_clk_a";
-               function = "scif_clk";
-       };
-
-       i2c2_pins: i2c2 {
-               groups = "i2c2_a";
-               function = "i2c2";
-       };
-
-       avb_pins: avb {
-               groups = "avb_mdc";
-               function = "avb";
-       };
-
-       sdhi0_pins: sd0 {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <3300>;
-       };
-
-       sdhi0_pins_uhs: sd0_uhs {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <1800>;
-       };
-
-       sdhi2_pins: sd2 {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <3300>;
-       };
-
-       sdhi2_pins_uhs: sd2_uhs {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <1800>;
-       };
-
-       sound_pins: sound {
-               groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
-               function = "ssi";
-       };
-
-       sound_clk_pins: sound-clk {
-               groups = "audio_clk_a_a", "audio_clk_b_a", "audio_clk_c_a",
-                        "audio_clkout_a", "audio_clkout3_a";
-               function = "audio_clk";
-       };
-
-       usb1_pins: usb1 {
-               groups = "usb1";
-               function = "usb1";
-       };
-};
-
-&scif2 {
-       pinctrl-0 = <&scif2_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-};
-
-&scif_clk {
-       clock-frequency = <14745600>;
-};
-
-&i2c2 {
-       pinctrl-0 = <&i2c2_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-
-       clock-frequency = <100000>;
-
-       ak4613: codec@10 {
-               compatible = "asahi-kasei,ak4613";
-               #sound-dai-cells = <0>;
-               reg = <0x10>;
-               clocks = <&rcar_sound 3>;
-
-               asahi-kasei,in1-single-end;
-               asahi-kasei,in2-single-end;
-               asahi-kasei,out1-single-end;
-               asahi-kasei,out2-single-end;
-               asahi-kasei,out3-single-end;
-               asahi-kasei,out4-single-end;
-               asahi-kasei,out5-single-end;
-               asahi-kasei,out6-single-end;
-       };
-
-       cs2000: clk-multiplier@4f {
-               #clock-cells = <0>;
-               compatible = "cirrus,cs2000-cp";
-               reg = <0x4f>;
-               clocks = <&audio_clkout>, <&x12_clk>;
-               clock-names = "clk_in", "ref_clk";
-
-               assigned-clocks = <&cs2000>;
-               assigned-clock-rates = <24576000>; /* 1/1 divide */
-       };
-};
-
-&rcar_sound {
-       pinctrl-0 = <&sound_pins &sound_clk_pins>;
-       pinctrl-names = "default";
-
-       /* Single DAI */
-       #sound-dai-cells = <0>;
-
-       /* audio_clkout0/1/2/3 */
-       #clock-cells = <1>;
-       clock-frequency = <11289600>;
-
-       status = "okay";
-
-       /* update <audio_clk_b> to <cs2000> */
-       clocks = <&cpg CPG_MOD 1005>,
-                <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
-                <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
-                <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
-                <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
-                <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
-                <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
-                <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
-                <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
-                <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
-                <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
-                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
-                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
-                <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
-                <&audio_clk_a>, <&cs2000>,
-                <&audio_clk_c>,
-                <&cpg CPG_CORE R8A7795_CLK_S0D4>;
-
-       rcar_sound,dai {
-               dai0 {
-                       playback = <&ssi0 &src0 &dvc0>;
-                       capture  = <&ssi1 &src1 &dvc1>;
-               };
-       };
-};
-
-&sdhi0 {
-       pinctrl-0 = <&sdhi0_pins>;
-       pinctrl-1 = <&sdhi0_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&vcc_sdhi0>;
-       vqmmc-supply = <&vccq_sdhi0>;
-       cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
-       bus-width = <4>;
-       sd-uhs-sdr50;
-       status = "okay";
-};
-
-&sdhi2 {
-       /* used for on-board 8bit eMMC */
-       pinctrl-0 = <&sdhi2_pins>;
-       pinctrl-1 = <&sdhi2_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&reg_3p3v>;
-       vqmmc-supply = <&reg_1p8v>;
-       bus-width = <8>;
-       non-removable;
-       status = "okay";
-};
-
-&ssi1 {
-       shared-pin;
-};
-
-&wdt0 {
-       timeout-sec = <60>;
-       status = "okay";
-};
-
-&audio_clk_a {
-       clock-frequency = <22579200>;
-};
-
-&avb {
-       pinctrl-0 = <&avb_pins>;
-       pinctrl-names = "default";
-       renesas,no-ether-link;
-       phy-handle = <&phy0>;
-       status = "okay";
-
-       phy0: ethernet-phy@0 {
-               rxc-skew-ps = <1500>;
-               reg = <0>;
-               interrupt-parent = <&gpio2>;
-               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
-       };
-};
-
-&usb2_phy1 {
-       pinctrl-0 = <&usb1_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-};
-
-&ehci1 {
-       status = "okay";
-};
-
-&ohci1 {
-       status = "okay";
 };
index 639aa085d9966676b07b6eaf4c54ee3b9b5476cb..684fb3b9d154559eb31d85c401303f4bc52f9f4e 100644 (file)
  * kind, whether express or implied.
  */
 
-/*
- * SSI-AK4613
- *
- * This command is required when Playback/Capture
- *
- *     amixer set "DVC Out" 100%
- *     amixer set "DVC In" 100%
- *
- * You can use Mute
- *
- *     amixer set "DVC Out Mute" on
- *     amixer set "DVC In Mute" on
- *
- * You can use Volume Ramp
- *
- *     amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
- *     amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
- *     amixer set "DVC Out Ramp" on
- *     aplay xxx.wav &
- *     amixer set "DVC Out"  80%  // Volume Down
- *     amixer set "DVC Out" 100%  // Volume Up
- */
+#define CPG_AUDIO_CLK_I                R8A7795_CLK_S0D4
 
 /dts-v1/;
 #include "r8a7795.dtsi"
-#include <dt-bindings/gpio/gpio.h>
+#include "salvator-x.dtsi"
 
 / {
-       model = "Renesas Salvator-X board based on r8a7795";
+       model = "Renesas Salvator-X board based on r8a7795 ES2.0+";
        compatible = "renesas,salvator-x", "renesas,r8a7795";
 
-       aliases {
-               serial0 = &scif2;
-               serial1 = &scif1;
-               ethernet0 = &avb;
-       };
-
-       chosen {
-               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
-               stdout-path = "serial0:115200n8";
-       };
-
        memory@48000000 {
                device_type = "memory";
                /* first 128MB is reserved for secure area. */
                reg = <0x0 0x48000000 0x0 0x38000000>;
        };
 
-       x12_clk: x12 {
-               compatible = "fixed-clock";
-               #clock-cells = <0>;
-               clock-frequency = <24576000>;
-       };
-
-       reg_1p8v: regulator0 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-1.8V";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       reg_3p3v: regulator1 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-3.3V";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       vcc_sdhi0: regulator-vcc-sdhi0 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "SDHI0 Vcc";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vccq_sdhi0: regulator-vccq-sdhi0 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI0 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
-               gpios-states = <1>;
-               states = <3300000 1
-                         1800000 0>;
-       };
-
-       vcc_sdhi3: regulator-vcc-sdhi3 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "SDHI3 Vcc";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio3 15 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vccq_sdhi3: regulator-vccq-sdhi3 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI3 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
-               gpios-states = <1>;
-               states = <3300000 1
-                         1800000 0>;
+       memory@500000000 {
+               device_type = "memory";
+               reg = <0x5 0x00000000 0x0 0x40000000>;
        };
 
-       vbus0_usb2: regulator-vbus0-usb2 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "USB20_VBUS0";
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-
-               gpio = <&gpio6 16 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
+       memory@600000000 {
+               device_type = "memory";
+               reg = <0x6 0x00000000 0x0 0x40000000>;
        };
 
-       audio_clkout: audio_clkout {
-               /*
-                * This is same as <&rcar_sound 0>
-                * but needed to avoid cs2000/rcar_sound probe dead-lock
-                */
-               compatible = "fixed-clock";
-               #clock-cells = <0>;
-               clock-frequency = <11289600>;
+       memory@700000000 {
+               device_type = "memory";
+               reg = <0x7 0x00000000 0x0 0x40000000>;
        };
+};
 
-       rsnd_ak4613: sound {
-               compatible = "simple-audio-card";
-
-               simple-audio-card,format = "left_j";
-               simple-audio-card,bitclock-master = <&sndcpu>;
-               simple-audio-card,frame-master = <&sndcpu>;
-
-               sndcpu: simple-audio-card,cpu {
-                       sound-dai = <&rcar_sound>;
-               };
-
-               sndcodec: simple-audio-card,codec {
-                       sound-dai = <&ak4613>;
-               };
-       };
+&du {
+       clocks = <&cpg CPG_MOD 724>,
+                <&cpg CPG_MOD 723>,
+                <&cpg CPG_MOD 722>,
+                <&cpg CPG_MOD 721>,
+                <&cpg CPG_MOD 727>,
+                <&versaclock5 1>,
+                <&x21_clk>,
+                <&x22_clk>,
+                <&versaclock5 2>;
+       clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+                     "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
+};
 
-       vga-encoder {
-               compatible = "adi,adv7123";
+&ehci2 {
+       status = "okay";
+};
 
-               ports {
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+&hdmi0 {
+       status = "okay";
 
-                       port@0 {
-                               reg = <0>;
-                               adv7123_in: endpoint {
-                                       remote-endpoint = <&du_out_rgb>;
-                               };
-                       };
-                       port@1 {
-                               reg = <1>;
-                               adv7123_out: endpoint {
-                                       remote-endpoint = <&vga_in>;
-                               };
+       ports {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi0_out: endpoint {
+                               remote-endpoint = <&hdmi0_con>;
                        };
                };
        };
+};
 
-       vga {
-               compatible = "vga-connector";
-
-               port {
-                       vga_in: endpoint {
-                               remote-endpoint = <&adv7123_out>;
-                       };
-               };
-       };
+&hdmi0_con {
+       remote-endpoint = <&rcar_dw_hdmi0_out>;
 };
 
-&du {
-       pinctrl-0 = <&du_pins>;
-       pinctrl-names = "default";
+&hdmi1 {
        status = "okay";
 
        ports {
-               port@0 {
-                       endpoint {
-                               remote-endpoint = <&adv7123_in>;
-                       };
-               };
-               port@3 {
-                       lvds_connector: endpoint {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi1_out: endpoint {
+                               remote-endpoint = <&hdmi1_con>;
                        };
                };
        };
 };
 
-&extal_clk {
-       clock-frequency = <16666666>;
+&hdmi1_con {
+       remote-endpoint = <&rcar_dw_hdmi1_out>;
 };
 
-&extalr_clk {
-       clock-frequency = <32768>;
+&ohci2 {
+       status = "okay";
 };
 
 &pfc {
-       pinctrl-0 = <&scif_clk_pins>;
-       pinctrl-names = "default";
-
-       scif1_pins: scif1 {
-               groups = "scif1_data_a", "scif1_ctrl";
-               function = "scif1";
-       };
-       scif2_pins: scif2 {
-               groups = "scif2_data_a";
-               function = "scif2";
-       };
-       scif_clk_pins: scif_clk {
-               groups = "scif_clk_a";
-               function = "scif_clk";
-       };
-
-       i2c2_pins: i2c2 {
-               groups = "i2c2_a";
-               function = "i2c2";
-       };
-
-       avb_pins: avb {
-               mux {
-                       groups = "avb_link", "avb_phy_int", "avb_mdc",
-                                "avb_mii";
-                       function = "avb";
-               };
-
-               pins_mdc {
-                       groups = "avb_mdc";
-                       drive-strength = <24>;
-               };
-
-               pins_mii_tx {
-                       pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", "PIN_AVB_TD0",
-                              "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
-                       drive-strength = <12>;
-               };
-       };
-
-       du_pins: du {
-               groups = "du_rgb888", "du_sync", "du_oddf", "du_clk_out_0";
-               function = "du";
-       };
-
-       sdhi0_pins: sd0 {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <3300>;
-       };
-
-       sdhi0_pins_uhs: sd0_uhs {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <1800>;
-       };
-
-       sdhi2_pins: sd2 {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <3300>;
-       };
-
-       sdhi2_pins_uhs: sd2_uhs {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <1800>;
-       };
-
-       sdhi3_pins: sd3 {
-               groups = "sdhi3_data4", "sdhi3_ctrl";
-               function = "sdhi3";
-               power-source = <3300>;
-       };
-
-       sdhi3_pins_uhs: sd3_uhs {
-               groups = "sdhi3_data4", "sdhi3_ctrl";
-               function = "sdhi3";
-               power-source = <1800>;
-       };
-
-       sound_pins: sound {
-               groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
-               function = "ssi";
-       };
-
-       sound_clk_pins: sound_clk {
-               groups = "audio_clk_a_a", "audio_clk_b_a", "audio_clk_c_a",
-                        "audio_clkout_a", "audio_clkout3_a";
-               function = "audio_clk";
-       };
-
-       usb0_pins: usb0 {
-               groups = "usb0";
-               function = "usb0";
-       };
-
-       usb1_pins: usb1 {
-               mux {
-                       groups = "usb1";
-                       function = "usb1";
-               };
-
-               ovc {
-                       pins = "GP_6_27";
-                       bias-pull-up;
-               };
-
-               pwen {
-                       pins = "GP_6_26";
-                       bias-pull-down;
-               };
-       };
-
        usb2_pins: usb2 {
                groups = "usb2";
                function = "usb2";
        };
 };
 
-&scif1 {
-       pinctrl-0 = <&scif1_pins>;
-       pinctrl-names = "default";
-
-       uart-has-rtscts;
-       status = "okay";
-};
-
-&scif2 {
-       pinctrl-0 = <&scif2_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-};
-
-&scif_clk {
-       clock-frequency = <14745600>;
-};
-
-&i2c2 {
-       pinctrl-0 = <&i2c2_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-
-       clock-frequency = <100000>;
-
-       ak4613: codec@10 {
-               compatible = "asahi-kasei,ak4613";
-               #sound-dai-cells = <0>;
-               reg = <0x10>;
-               clocks = <&rcar_sound 3>;
-
-               asahi-kasei,in1-single-end;
-               asahi-kasei,in2-single-end;
-               asahi-kasei,out1-single-end;
-               asahi-kasei,out2-single-end;
-               asahi-kasei,out3-single-end;
-               asahi-kasei,out4-single-end;
-               asahi-kasei,out5-single-end;
-               asahi-kasei,out6-single-end;
-       };
-
-       cs2000: clk_multiplier@4f {
-               #clock-cells = <0>;
-               compatible = "cirrus,cs2000-cp";
-               reg = <0x4f>;
-               clocks = <&audio_clkout>, <&x12_clk>;
-               clock-names = "clk_in", "ref_clk";
-
-               assigned-clocks = <&cs2000>;
-               assigned-clock-rates = <24576000>; /* 1/1 divide */
-       };
-};
-
-&rcar_sound {
-       pinctrl-0 = <&sound_pins &sound_clk_pins>;
-       pinctrl-names = "default";
-
-       /* Single DAI */
-       #sound-dai-cells = <0>;
-
-       /* audio_clkout0/1/2/3 */
-       #clock-cells = <1>;
-       clock-frequency = <11289600>;
-
-       status = "okay";
-
-       /* update <audio_clk_b> to <cs2000> */
-       clocks = <&cpg CPG_MOD 1005>,
-                <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
-                <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
-                <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
-                <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
-                <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
-                <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
-                <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
-                <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
-                <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
-                <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
-                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
-                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
-                <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
-                <&audio_clk_a>, <&cs2000>,
-                <&audio_clk_c>,
-                <&cpg CPG_CORE R8A7795_CLK_S0D4>;
-
-       rcar_sound,dai {
-               dai0 {
-                       playback = <&ssi0 &src0 &dvc0>;
-                       capture  = <&ssi1 &src1 &dvc1>;
-               };
-       };
-};
-
 &sata {
        status = "okay";
 };
 
-&sdhi0 {
-       pinctrl-0 = <&sdhi0_pins>;
-       pinctrl-1 = <&sdhi0_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&vcc_sdhi0>;
-       vqmmc-supply = <&vccq_sdhi0>;
-       cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
-       wp-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>;
-       bus-width = <4>;
-       sd-uhs-sdr50;
-       status = "okay";
-};
-
-&sdhi2 {
-       /* used for on-board 8bit eMMC */
-       pinctrl-0 = <&sdhi2_pins>;
-       pinctrl-1 = <&sdhi2_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&reg_3p3v>;
-       vqmmc-supply = <&reg_1p8v>;
-       bus-width = <8>;
-       non-removable;
-       status = "okay";
-};
-
-&sdhi3 {
-       pinctrl-0 = <&sdhi3_pins>;
-       pinctrl-1 = <&sdhi3_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&vcc_sdhi3>;
-       vqmmc-supply = <&vccq_sdhi3>;
-       cd-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
-       wp-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
-       bus-width = <4>;
-       sd-uhs-sdr50;
-       status = "okay";
-};
-
-&ssi1 {
-       shared-pin;
-};
-
-&wdt0 {
-       timeout-sec = <60>;
-       status = "okay";
-};
-
-&audio_clk_a {
-       clock-frequency = <22579200>;
-};
-
-&i2c_dvfs {
-       status = "okay";
-};
-
-&avb {
-       pinctrl-0 = <&avb_pins>;
-       pinctrl-names = "default";
-       renesas,no-ether-link;
-       phy-handle = <&phy0>;
-       status = "okay";
-
-       phy0: ethernet-phy@0 {
-               rxc-skew-ps = <1500>;
-               reg = <0>;
-               interrupt-parent = <&gpio2>;
-               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
-       };
-};
-
-&xhci0 {
-       status = "okay";
-};
-
-&usb2_phy0 {
-       pinctrl-0 = <&usb0_pins>;
-       pinctrl-names = "default";
-
-       vbus-supply = <&vbus0_usb2>;
-       status = "okay";
-};
-
-&usb2_phy1 {
-       pinctrl-0 = <&usb1_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-};
-
 &usb2_phy2 {
        pinctrl-0 = <&usb2_pins>;
        pinctrl-names = "default";
 
        status = "okay";
 };
-
-&ehci0 {
-       status = "okay";
-};
-
-&ehci1 {
-       status = "okay";
-};
-
-&ehci2 {
-       status = "okay";
-};
-
-&ohci0 {
-       status = "okay";
-};
-
-&ohci1 {
-       status = "okay";
-};
-
-&ohci2 {
-       status = "okay";
-};
-
-&hsusb {
-       status = "okay";
-};
-
-&pcie_bus_clk {
-       clock-frequency = <100000000>;
-};
-
-&pciec0 {
-       status = "okay";
-};
-
-&pciec1 {
-       status = "okay";
-};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
new file mode 100644 (file)
index 0000000..de35495
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Device Tree Source for the Salvator-X 2nd version board
+ *
+ * Copyright (C) 2015-2017 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#define CPG_AUDIO_CLK_I                R8A7795_CLK_S0D4
+
+/dts-v1/;
+#include "r8a7795.dtsi"
+#include "salvator-xs.dtsi"
+
+/ {
+       model = "Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+";
+       compatible = "renesas,salvator-xs", "renesas,r8a7795";
+
+       memory@48000000 {
+               device_type = "memory";
+               /* first 128MB is reserved for secure area. */
+               reg = <0x0 0x48000000 0x0 0x38000000>;
+       };
+
+       memory@500000000 {
+               device_type = "memory";
+               reg = <0x5 0x00000000 0x0 0x40000000>;
+       };
+
+       memory@600000000 {
+               device_type = "memory";
+               reg = <0x6 0x00000000 0x0 0x40000000>;
+       };
+
+       memory@700000000 {
+               device_type = "memory";
+               reg = <0x7 0x00000000 0x0 0x40000000>;
+       };
+};
+
+&du {
+       clocks = <&cpg CPG_MOD 724>,
+                <&cpg CPG_MOD 723>,
+                <&cpg CPG_MOD 722>,
+                <&cpg CPG_MOD 721>,
+                <&cpg CPG_MOD 727>,
+                <&x21_clk>,
+                <&x22_clk>;
+       clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+                     "dclkin.1", "dclkin.2";
+};
+
+&ehci2 {
+       status = "okay";
+};
+
+&hdmi0 {
+       status = "okay";
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi0_out: endpoint {
+                               remote-endpoint = <&hdmi0_con>;
+                       };
+               };
+       };
+};
+
+&hdmi0_con {
+       remote-endpoint = <&rcar_dw_hdmi0_out>;
+};
+
+&hdmi1 {
+       status = "okay";
+
+       ports {
+               port@1 {
+                       reg = <1>;
+                       rcar_dw_hdmi1_out: endpoint {
+                               remote-endpoint = <&hdmi1_con>;
+                       };
+               };
+       };
+};
+
+&hdmi1_con {
+       remote-endpoint = <&rcar_dw_hdmi1_out>;
+};
+
+&ohci2 {
+       status = "okay";
+};
+
+&pfc {
+       usb2_pins: usb2 {
+               groups = "usb2";
+               function = "usb2";
+       };
+};
+
+&usb2_phy2 {
+       pinctrl-0 = <&usb2_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
index e99d6443b3e493a48da79c1f54060d6eddc3b963..e31c1b660b3fe78f370a01e1cc67e8c81d24ee97 100644 (file)
                clock-frequency = <0>;
        };
 
-       soc {
+       soc: soc {
                compatible = "simple-bus";
                interrupt-parent = <&gic>;
 
                        #power-domain-cells = <1>;
                };
 
-               pfc: pfc@e6060000 {
+               pfc: pin-controller@e6060000 {
                        compatible = "renesas,pfc-r8a7795";
                        reg = <0 0xe6060000 0 0x50c>;
                };
                        clocks = <&cpg CPG_MOD 926>;
                        power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
                        resets = <&cpg 926>;
+                       dmas = <&dmac0 0x11>, <&dmac0 0x10>;
+                       dma-names = "tx", "rx";
                        status = "disabled";
                };
 
                                      "dvc.0", "dvc.1",
                                      "clk_a", "clk_b", "clk_c", "clk_i";
                        power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 1005>,
+                                <&cpg 1006>, <&cpg 1007>,
+                                <&cpg 1008>, <&cpg 1009>,
+                                <&cpg 1010>, <&cpg 1011>,
+                                <&cpg 1012>, <&cpg 1013>,
+                                <&cpg 1014>, <&cpg 1015>;
+                       reset-names = "ssi-all",
+                                     "ssi.9", "ssi.8", "ssi.7", "ssi.6",
+                                     "ssi.5", "ssi.4", "ssi.3", "ssi.2",
+                                     "ssi.1", "ssi.0";
                        status = "disabled";
 
                        rcar_sound,dvc {
                        status = "disabled";
                };
 
-               xhci1: usb@ee0400000 {
-                       compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci";
-                       reg = <0 0xee040000 0 0xc00>;
-                       interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 327>;
-                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
-                       resets = <&cpg 327>;
-                       status = "disabled";
-               };
-
                usb_dmac0: dma-controller@e65a0000 {
                        compatible = "renesas,r8a7795-usb-dmac",
                                     "renesas,usb-dmac";
                        resets = <&cpg 614>;
                };
 
-               fcpf2: fcp@fe952000 {
-                       compatible = "renesas,fcpf";
-                       reg = <0 0xfe952000 0 0x200>;
-                       clocks = <&cpg CPG_MOD 613>;
-                       power-domains = <&sysc R8A7795_PD_A3VP>;
-                       resets = <&cpg 613>;
-               };
-
                vspbd: vsp@fe960000 {
                        compatible = "renesas,vsp2";
                        reg = <0 0xfe960000 0 0x8000>;
                        resets = <&cpg 610>;
                };
 
-               vspi2: vsp@fe9c0000 {
-                       compatible = "renesas,vsp2";
-                       reg = <0 0xfe9c0000 0 0x8000>;
-                       interrupts = <GIC_SPI 446 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 629>;
-                       power-domains = <&sysc R8A7795_PD_A3VP>;
-                       resets = <&cpg 629>;
-
-                       renesas,fcp = <&fcpvi2>;
-               };
-
-               fcpvi2: fcp@fe9cf000 {
-                       compatible = "renesas,fcpv";
-                       reg = <0 0xfe9cf000 0 0x200>;
-                       clocks = <&cpg CPG_MOD 609>;
-                       power-domains = <&sysc R8A7795_PD_A3VP>;
-                       resets = <&cpg 609>;
-               };
-
                vspd0: vsp@fea20000 {
                        compatible = "renesas,vsp2";
                        reg = <0 0xfea20000 0 0x4000>;
                        resets = <&cpg 601>;
                };
 
-               vspd3: vsp@fea38000 {
-                       compatible = "renesas,vsp2";
-                       reg = <0 0xfea38000 0 0x4000>;
-                       interrupts = <GIC_SPI 469 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 620>;
-                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
-                       resets = <&cpg 620>;
-
-                       renesas,fcp = <&fcpvd3>;
-               };
-
-               fcpvd3: fcp@fea3f000 {
-                       compatible = "renesas,fcpv";
-                       reg = <0 0xfea3f000 0 0x200>;
-                       clocks = <&cpg CPG_MOD 600>;
-                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
-                       resets = <&cpg 600>;
-               };
-
                fdp1@fe940000 {
                        compatible = "renesas,fdp1";
                        reg = <0 0xfe940000 0 0x2400>;
                        renesas,fcp = <&fcpf1>;
                };
 
-               fdp1@fe948000 {
-                       compatible = "renesas,fdp1";
-                       reg = <0 0xfe948000 0 0x2400>;
-                       interrupts = <GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 117>;
-                       power-domains = <&sysc R8A7795_PD_A3VP>;
-                       resets = <&cpg 117>;
-                       renesas,fcp = <&fcpf2>;
+               hdmi0: hdmi0@fead0000 {
+                       compatible = "renesas,r8a7795-hdmi", "renesas,rcar-gen3-hdmi";
+                       reg = <0 0xfead0000 0 0x10000>;
+                       interrupts = <GIC_SPI 389 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 729>, <&cpg CPG_CORE R8A7795_CLK_HDMI>;
+                       clock-names = "iahb", "isfr";
+                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 729>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               port@0 {
+                                       reg = <0>;
+                                       dw_hdmi0_in: endpoint {
+                                               remote-endpoint = <&du_out_hdmi0>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                               };
+                       };
+               };
+
+               hdmi1: hdmi1@feae0000 {
+                       compatible = "renesas,r8a7795-hdmi", "renesas,rcar-gen3-hdmi";
+                       reg = <0 0xfeae0000 0 0x10000>;
+                       interrupts = <GIC_SPI 436 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 728>, <&cpg CPG_CORE R8A7795_CLK_HDMI>;
+                       clock-names = "iahb", "isfr";
+                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 728>;
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               port@0 {
+                                       reg = <0>;
+                                       dw_hdmi1_in: endpoint {
+                                               remote-endpoint = <&du_out_hdmi1>;
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                               };
+                       };
                };
 
                du: display@feb00000 {
-                       compatible = "renesas,du-r8a7795";
                        reg = <0 0xfeb00000 0 0x80000>,
                              <0 0xfeb90000 0 0x14>;
                        reg-names = "du", "lvds.0";
                        clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0";
                        status = "disabled";
 
-                       vsps = <&vspd0 &vspd1 &vspd2 &vspd3>;
-
                        ports {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                port@1 {
                                        reg = <1>;
                                        du_out_hdmi0: endpoint {
+                                               remote-endpoint = <&dw_hdmi0_in>;
                                        };
                                };
                                port@2 {
                                        reg = <2>;
                                        du_out_hdmi1: endpoint {
+                                               remote-endpoint = <&dw_hdmi1_in>;
                                        };
                                };
                                port@3 {
index 372b2a9447163b24cd6bd08849c25be3ab6f27a6..38b58b7fca4bf0e9a309a1f9a27f91cb26d9e785 100644 (file)
  * kind, whether express or implied.
  */
 
+#define CPG_AUDIO_CLK_I                R8A7796_CLK_S0D4
+
 /dts-v1/;
 #include "r8a7796.dtsi"
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
+#include "ulcb.dtsi"
 
 / {
        model = "Renesas M3ULCB board based on r8a7796";
        compatible = "renesas,m3ulcb", "renesas,r8a7796";
 
-       aliases {
-               serial0 = &scif2;
-       };
-
-       chosen {
-               stdout-path = "serial0:115200n8";
-       };
-
        memory@48000000 {
                device_type = "memory";
                /* first 128MB is reserved for secure area. */
                reg = <0x0 0x48000000 0x0 0x38000000>;
        };
 
-       leds {
-               compatible = "gpio-leds";
-
-               led5 {
-                       gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
-               };
-               led6 {
-                       gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       keyboard {
-               compatible = "gpio-keys";
-
-               key-1 {
-                       linux,code = <KEY_1>;
-                       label = "SW3";
-                       wakeup-source;
-                       debounce-interval = <20>;
-                       gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
-               };
-       };
-
-       reg_1p8v: regulator0 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-1.8V";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       reg_3p3v: regulator1 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-3.3V";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       vcc_sdhi0: regulator-vcc-sdhi0 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "SDHI0 Vcc";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vccq_sdhi0: regulator-vccq-sdhi0 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI0 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
-               gpios-states = <1>;
-               states = <3300000 1
-                         1800000 0>;
-       };
-};
-
-&extal_clk {
-       clock-frequency = <16666666>;
-};
-
-&extalr_clk {
-       clock-frequency = <32768>;
-};
-
-&pfc {
-       pinctrl-0 = <&scif_clk_pins>;
-       pinctrl-names = "default";
-
-       scif2_pins: scif2 {
-               groups = "scif2_data_a";
-               function = "scif2";
-       };
-
-       scif_clk_pins: scif_clk {
-               groups = "scif_clk_a";
-               function = "scif_clk";
-       };
-
-       sdhi0_pins: sd0 {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <3300>;
-       };
-
-       sdhi0_pins_uhs: sd0_uhs {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <1800>;
-       };
-
-       sdhi2_pins: sd2 {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <3300>;
-       };
-
-       sdhi2_pins_uhs: sd2_uhs {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <1800>;
+       memory@600000000 {
+               device_type = "memory";
+               reg = <0x6 0x00000000 0x0 0x40000000>;
        };
 };
-
-&sdhi0 {
-       pinctrl-0 = <&sdhi0_pins>;
-       pinctrl-1 = <&sdhi0_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&vcc_sdhi0>;
-       vqmmc-supply = <&vccq_sdhi0>;
-       cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
-       bus-width = <4>;
-       sd-uhs-sdr50;
-       status = "okay";
-};
-
-&sdhi2 {
-       /* used for on-board 8bit eMMC */
-       pinctrl-0 = <&sdhi2_pins>;
-       pinctrl-1 = <&sdhi2_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&reg_3p3v>;
-       vqmmc-supply = <&reg_1p8v>;
-       bus-width = <8>;
-       non-removable;
-       status = "okay";
-};
-
-&scif2 {
-       pinctrl-0 = <&scif2_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-};
-
-&scif_clk {
-       clock-frequency = <14745600>;
-};
-
-&wdt0 {
-       timeout-sec = <60>;
-       status = "okay";
-};
index c9f59b6ce33f693fa62dae7ad7d0f82b7ee4c337..db4f162d6bdd2c42e13af8057b866498c0bf6c39 100644 (file)
@@ -8,25 +8,16 @@
  * kind, whether express or implied.
  */
 
+#define CPG_AUDIO_CLK_I                R8A7796_CLK_S0D4
+
 /dts-v1/;
 #include "r8a7796.dtsi"
-#include <dt-bindings/gpio/gpio.h>
+#include "salvator-x.dtsi"
 
 / {
        model = "Renesas Salvator-X board based on r8a7796";
        compatible = "renesas,salvator-x", "renesas,r8a7796";
 
-       aliases {
-               serial0 = &scif2;
-               serial1 = &scif1;
-               ethernet0 = &avb;
-       };
-
-       chosen {
-               bootargs = "ignore_loglevel";
-               stdout-path = "serial0:115200n8";
-       };
-
        memory@48000000 {
                device_type = "memory";
                /* first 128MB is reserved for secure area. */
                device_type = "memory";
                reg = <0x6 0x00000000 0x0 0x80000000>;
        };
-
-       reg_1p8v: regulator0 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-1.8V";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <1800000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       reg_3p3v: regulator1 {
-               compatible = "regulator-fixed";
-               regulator-name = "fixed-3.3V";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-               regulator-boot-on;
-               regulator-always-on;
-       };
-
-       vcc_sdhi0: regulator-vcc-sdhi0 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "SDHI0 Vcc";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vccq_sdhi0: regulator-vccq-sdhi0 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI0 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
-               gpios-states = <1>;
-               states = <3300000 1
-                         1800000 0>;
-       };
-
-       vcc_sdhi3: regulator-vcc-sdhi3 {
-               compatible = "regulator-fixed";
-
-               regulator-name = "SDHI3 Vcc";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpio = <&gpio3 15 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
-
-       vccq_sdhi3: regulator-vccq-sdhi3 {
-               compatible = "regulator-gpio";
-
-               regulator-name = "SDHI3 VccQ";
-               regulator-min-microvolt = <1800000>;
-               regulator-max-microvolt = <3300000>;
-
-               gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
-               gpios-states = <1>;
-               states = <3300000 1
-                         1800000 0>;
-       };
-};
-
-&pfc {
-       pinctrl-0 = <&scif_clk_pins>;
-       pinctrl-names = "default";
-
-       avb_pins: avb {
-               groups = "avb_mdc";
-               function = "avb";
-       };
-
-       scif1_pins: scif1 {
-               groups = "scif1_data_a", "scif1_ctrl";
-               function = "scif1";
-       };
-
-       scif2_pins: scif2 {
-               groups = "scif2_data_a";
-               function = "scif2";
-       };
-       scif_clk_pins: scif_clk {
-               groups = "scif_clk_a";
-               function = "scif_clk";
-       };
-
-       i2c2_pins: i2c2 {
-               groups = "i2c2_a";
-               function = "i2c2";
-       };
-
-       sdhi0_pins: sd0 {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <3300>;
-       };
-
-       sdhi0_pins_uhs: sd0_uhs {
-               groups = "sdhi0_data4", "sdhi0_ctrl";
-               function = "sdhi0";
-               power-source = <1800>;
-       };
-
-       sdhi2_pins: sd2 {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <3300>;
-       };
-
-       sdhi2_pins_uhs: sd2_uhs {
-               groups = "sdhi2_data8", "sdhi2_ctrl";
-               function = "sdhi2";
-               power-source = <1800>;
-       };
-
-       sdhi3_pins: sd3 {
-               groups = "sdhi3_data4", "sdhi3_ctrl";
-               function = "sdhi3";
-               power-source = <3300>;
-       };
-
-       sdhi3_pins_uhs: sd3_uhs {
-               groups = "sdhi3_data4", "sdhi3_ctrl";
-               function = "sdhi3";
-               power-source = <1800>;
-       };
-};
-
-&avb {
-       pinctrl-0 = <&avb_pins>;
-       pinctrl-names = "default";
-       renesas,no-ether-link;
-       phy-handle = <&phy0>;
-       status = "okay";
-
-       phy0: ethernet-phy@0 {
-               rxc-skew-ps = <1500>;
-               reg = <0>;
-               interrupt-parent = <&gpio2>;
-               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
-       };
-};
-
-&extal_clk {
-       clock-frequency = <16666666>;
-};
-
-&extalr_clk {
-       clock-frequency = <32768>;
-};
-
-&sdhi0 {
-       pinctrl-0 = <&sdhi0_pins>;
-       pinctrl-1 = <&sdhi0_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&vcc_sdhi0>;
-       vqmmc-supply = <&vccq_sdhi0>;
-       cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
-       wp-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>;
-       bus-width = <4>;
-       sd-uhs-sdr50;
-       status = "okay";
-};
-
-&sdhi2 {
-       /* used for on-board 8bit eMMC */
-       pinctrl-0 = <&sdhi2_pins>;
-       pinctrl-1 = <&sdhi2_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&reg_3p3v>;
-       vqmmc-supply = <&reg_1p8v>;
-       bus-width = <8>;
-       non-removable;
-       status = "okay";
-};
-
-&sdhi3 {
-       pinctrl-0 = <&sdhi3_pins>;
-       pinctrl-1 = <&sdhi3_pins_uhs>;
-       pinctrl-names = "default", "state_uhs";
-
-       vmmc-supply = <&vcc_sdhi3>;
-       vqmmc-supply = <&vccq_sdhi3>;
-       cd-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
-       wp-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
-       bus-width = <4>;
-       sd-uhs-sdr50;
-       status = "okay";
-};
-
-&scif1 {
-       pinctrl-0 = <&scif1_pins>;
-       pinctrl-names = "default";
-
-       uart-has-rtscts;
-       status = "okay";
-};
-
-&scif2 {
-       pinctrl-0 = <&scif2_pins>;
-       pinctrl-names = "default";
-       status = "okay";
-};
-
-&scif_clk {
-       clock-frequency = <14745600>;
-};
-
-&i2c2 {
-       pinctrl-0 = <&i2c2_pins>;
-       pinctrl-names = "default";
-
-       status = "okay";
-};
-
-&wdt0 {
-       timeout-sec = <60>;
-       status = "okay";
-};
-
-&i2c_dvfs {
-       status = "okay";
 };
index 2ec1ed5f499165ada8a7b2e41cbf4bf1339aa6af..1f671091204524e84600c66e697bc57a07d704d6 100644 (file)
                clock-frequency = <0>;
        };
 
+       /*
+        * The external audio clocks are configured as 0 Hz fixed frequency
+        * clocks by default.
+        * Boards that provide audio clocks should override them.
+        */
+       audio_clk_a: audio_clk_a {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <0>;
+       };
+
+       audio_clk_b: audio_clk_b {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <0>;
+       };
+
+       audio_clk_c: audio_clk_c {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <0>;
+       };
+
        /* External CAN clock - to be overridden by boards that provide it */
        can_clk: can {
                compatible = "fixed-clock";
                clock-frequency = <0>;
        };
 
+       /* External PCIe clock - can be overridden by the board */
+       pcie_bus_clk: pcie_bus {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <0>;
+       };
+
        soc {
                compatible = "simple-bus";
                interrupt-parent = <&gic>;
                        clocks = <&cpg CPG_MOD 926>;
                        power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
                        resets = <&cpg 926>;
+                       dmas = <&dmac0 0x11>, <&dmac0 0x10>;
+                       dma-names = "tx", "rx";
+                       status = "disabled";
+               };
+
+               pwm0: pwm@e6e30000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e30000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pwm1: pwm@e6e31000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e31000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pwm2: pwm@e6e32000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e32000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pwm3: pwm@e6e33000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e33000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pwm4: pwm@e6e34000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e34000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pwm5: pwm@e6e35000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e35000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       status = "disabled";
+               };
+
+               pwm6: pwm@e6e36000 {
+                       compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+                       reg = <0 0xe6e36000 0 8>;
+                       #pwm-cells = <2>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       resets = <&cpg 523>;
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
                        status = "disabled";
                };
 
                        dma-channels = <16>;
                };
 
+               audma0: dma-controller@ec700000 {
+                       compatible = "renesas,dmac-r8a7796",
+                                    "renesas,rcar-dmac";
+                       reg = <0 0xec700000 0 0x10000>;
+                       interrupts = <GIC_SPI 350 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 322 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 323 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 325 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 326 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 328 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 332 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 333 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "error",
+                                       "ch0", "ch1", "ch2", "ch3",
+                                       "ch4", "ch5", "ch6", "ch7",
+                                       "ch8", "ch9", "ch10", "ch11",
+                                       "ch12", "ch13", "ch14", "ch15";
+                       clocks = <&cpg CPG_MOD 502>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       resets = <&cpg 502>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+               };
+
+               audma1: dma-controller@ec720000 {
+                       compatible = "renesas,dmac-r8a7796",
+                                    "renesas,rcar-dmac";
+                       reg = <0 0xec720000 0 0x10000>;
+                       interrupts = <GIC_SPI 351 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 338 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 340 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 343 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 344 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 347 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 348 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 349 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 382 IRQ_TYPE_LEVEL_HIGH
+                                     GIC_SPI 383 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "error",
+                                       "ch0", "ch1", "ch2", "ch3",
+                                       "ch4", "ch5", "ch6", "ch7",
+                                       "ch8", "ch9", "ch10", "ch11",
+                                       "ch12", "ch13", "ch14", "ch15";
+                       clocks = <&cpg CPG_MOD 501>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       resets = <&cpg 501>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+               };
+
+               hsusb: usb@e6590000 {
+                       /* placeholder */
+               };
+
+               xhci0: usb@ee000000 {
+                       /* placeholder */
+               };
+
+               ohci0: usb@ee080000 {
+                       /* placeholder */
+               };
+
+               ehci0: usb@ee080100 {
+                       /* placeholder */
+               };
+
+               usb2_phy0: usb-phy@ee080200 {
+                       /* placeholder */
+               };
+
+               ohci1: usb@ee0a0000 {
+                       /* placeholder */
+               };
+
+               ehci1: usb@ee0a0100 {
+                       /* placeholder */
+               };
+
+               usb2_phy1: usb-phy@ee0a0200 {
+                       /* placeholder */
+               };
+
                sdhi0: sd@ee100000 {
                        compatible = "renesas,sdhi-r8a7796";
                        reg = <0 0xee100000 0 0x2000>;
                                };
                        };
                };
+
+               rcar_sound: sound@ec500000 {
+                       /*
+                        * #sound-dai-cells is required
+                        *
+                        * Single DAI : #sound-dai-cells = <0>; <&rcar_sound>;
+                        * Multi  DAI : #sound-dai-cells = <1>; <&rcar_sound N>;
+                        */
+                       /*
+                        * #clock-cells is required for audio_clkout0/1/2/3
+                        *
+                        * clkout       : #clock-cells = <0>;   <&rcar_sound>;
+                        * clkout0/1/2/3: #clock-cells = <1>;   <&rcar_sound N>;
+                        */
+                       compatible =  "renesas,rcar_sound-r8a7796", "renesas,rcar_sound-gen3";
+                       reg =   <0 0xec500000 0 0x1000>, /* SCU */
+                               <0 0xec5a0000 0 0x100>,  /* ADG */
+                               <0 0xec540000 0 0x1000>, /* SSIU */
+                               <0 0xec541000 0 0x280>,  /* SSI */
+                               <0 0xec740000 0 0x200>;  /* Audio DMAC peri peri*/
+                       reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
+
+                       clocks = <&cpg CPG_MOD 1005>,
+                                <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
+                                <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
+                                <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
+                                <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
+                                <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
+                                <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
+                                <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
+                                <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
+                                <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
+                                <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
+                                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+                                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+                                <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
+                                <&audio_clk_a>, <&audio_clk_b>,
+                                <&audio_clk_c>,
+                                <&cpg CPG_CORE R8A7796_CLK_S0D4>;
+                       clock-names = "ssi-all",
+                                     "ssi.9", "ssi.8", "ssi.7", "ssi.6",
+                                     "ssi.5", "ssi.4", "ssi.3", "ssi.2",
+                                     "ssi.1", "ssi.0",
+                                     "src.9", "src.8", "src.7", "src.6",
+                                     "src.5", "src.4", "src.3", "src.2",
+                                     "src.1", "src.0",
+                                     "mix.1", "mix.0",
+                                     "ctu.1", "ctu.0",
+                                     "dvc.0", "dvc.1",
+                                     "clk_a", "clk_b", "clk_c", "clk_i";
+                       power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+                       resets = <&cpg 1005>,
+                                <&cpg 1006>, <&cpg 1007>,
+                                <&cpg 1008>, <&cpg 1009>,
+                                <&cpg 1010>, <&cpg 1011>,
+                                <&cpg 1012>, <&cpg 1013>,
+                                <&cpg 1014>, <&cpg 1015>;
+                       reset-names = "ssi-all",
+                                     "ssi.9", "ssi.8", "ssi.7", "ssi.6",
+                                     "ssi.5", "ssi.4", "ssi.3", "ssi.2",
+                                     "ssi.1", "ssi.0";
+                       status = "disabled";
+
+                       rcar_sound,dvc {
+                               dvc0: dvc-0 {
+                                       dmas = <&audma1 0xbc>;
+                                       dma-names = "tx";
+                               };
+                               dvc1: dvc-1 {
+                                       dmas = <&audma1 0xbe>;
+                                       dma-names = "tx";
+                               };
+                       };
+
+                       rcar_sound,mix {
+                               mix0: mix-0 { };
+                               mix1: mix-1 { };
+                       };
+
+                       rcar_sound,ctu {
+                               ctu00: ctu-0 { };
+                               ctu01: ctu-1 { };
+                               ctu02: ctu-2 { };
+                               ctu03: ctu-3 { };
+                               ctu10: ctu-4 { };
+                               ctu11: ctu-5 { };
+                               ctu12: ctu-6 { };
+                               ctu13: ctu-7 { };
+                       };
+
+                       rcar_sound,src {
+                               src0: src-0 {
+                                       interrupts = <GIC_SPI 352 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x85>, <&audma1 0x9a>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src1: src-1 {
+                                       interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x87>, <&audma1 0x9c>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src2: src-2 {
+                                       interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x89>, <&audma1 0x9e>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src3: src-3 {
+                                       interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x8b>, <&audma1 0xa0>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src4: src-4 {
+                                       interrupts = <GIC_SPI 356 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x8d>, <&audma1 0xb0>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src5: src-5 {
+                                       interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x8f>, <&audma1 0xb2>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src6: src-6 {
+                                       interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x91>, <&audma1 0xb4>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src7: src-7 {
+                                       interrupts = <GIC_SPI 359 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x93>, <&audma1 0xb6>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src8: src-8 {
+                                       interrupts = <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x95>, <&audma1 0xb8>;
+                                       dma-names = "rx", "tx";
+                               };
+                               src9: src-9 {
+                                       interrupts = <GIC_SPI 361 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x97>, <&audma1 0xba>;
+                                       dma-names = "rx", "tx";
+                               };
+                       };
+
+                       rcar_sound,ssi {
+                               ssi0: ssi-0 {
+                                       interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x01>, <&audma1 0x02>, <&audma0 0x15>, <&audma1 0x16>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi1: ssi-1 {
+                                       interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x03>, <&audma1 0x04>, <&audma0 0x49>, <&audma1 0x4a>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi2: ssi-2 {
+                                       interrupts = <GIC_SPI 372 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x05>, <&audma1 0x06>, <&audma0 0x63>, <&audma1 0x64>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi3: ssi-3 {
+                                       interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x07>, <&audma1 0x08>, <&audma0 0x6f>, <&audma1 0x70>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi4: ssi-4 {
+                                       interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x09>, <&audma1 0x0a>, <&audma0 0x71>, <&audma1 0x72>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi5: ssi-5 {
+                                       interrupts = <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0b>, <&audma1 0x0c>, <&audma0 0x73>, <&audma1 0x74>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi6: ssi-6 {
+                                       interrupts = <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0d>, <&audma1 0x0e>, <&audma0 0x75>, <&audma1 0x76>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi7: ssi-7 {
+                                       interrupts = <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x0f>, <&audma1 0x10>, <&audma0 0x79>, <&audma1 0x7a>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi8: ssi-8 {
+                                       interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x11>, <&audma1 0x12>, <&audma0 0x7b>, <&audma1 0x7c>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                               ssi9: ssi-9 {
+                                       interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>;
+                                       dmas = <&audma0 0x13>, <&audma1 0x14>, <&audma0 0x7d>, <&audma1 0x7e>;
+                                       dma-names = "rx", "tx", "rxu", "txu";
+                               };
+                       };
+               };
+
+               pciec0: pcie@fe000000 {
+                       /* placeholder */
+               };
+
+               pciec1: pcie@ee800000 {
+                       /* placeholder */
+               };
+
+               du: display@feb00000 {
+                       /* placeholder */
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       du_out_rgb: endpoint {
+                                       };
+                               };
+                       };
+               };
        };
 };
diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
new file mode 100644 (file)
index 0000000..aef35e0
--- /dev/null
@@ -0,0 +1,629 @@
+/*
+ * Device Tree Source for common parts of Salvator-X board variants
+ *
+ * Copyright (C) 2015-2016 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/*
+ * SSI-AK4613
+ *
+ * This command is required when Playback/Capture
+ *
+ *     amixer set "DVC Out" 100%
+ *     amixer set "DVC In" 100%
+ *
+ * You can use Mute
+ *
+ *     amixer set "DVC Out Mute" on
+ *     amixer set "DVC In Mute" on
+ *
+ * You can use Volume Ramp
+ *
+ *     amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
+ *     amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
+ *     amixer set "DVC Out Ramp" on
+ *     aplay xxx.wav &
+ *     amixer set "DVC Out"  80%  // Volume Down
+ *     amixer set "DVC Out" 100%  // Volume Up
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       aliases {
+               serial0 = &scif2;
+               serial1 = &scif1;
+               ethernet0 = &avb;
+       };
+
+       chosen {
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
+               stdout-path = "serial0:115200n8";
+       };
+
+       audio_clkout: audio_clkout {
+               /*
+                * This is same as <&rcar_sound 0>
+                * but needed to avoid cs2000/rcar_sound probe dead-lock
+                */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <11289600>;
+       };
+
+       backlight: backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm1 0 50000>;
+
+               brightness-levels = <256 128 64 16 8 4 0>;
+               default-brightness-level = <6>;
+
+               enable-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
+       };
+
+       reg_1p8v: regulator0 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-1.8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator1 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       rsnd_ak4613: sound {
+               compatible = "simple-audio-card";
+
+               simple-audio-card,format = "left_j";
+               simple-audio-card,bitclock-master = <&sndcpu>;
+               simple-audio-card,frame-master = <&sndcpu>;
+
+               sndcpu: simple-audio-card,cpu {
+                       sound-dai = <&rcar_sound>;
+               };
+
+               sndcodec: simple-audio-card,codec {
+                       sound-dai = <&ak4613>;
+               };
+       };
+
+       vbus0_usb2: regulator-vbus0-usb2 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "USB20_VBUS0";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+
+               gpio = <&gpio6 16 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vcc_sdhi0: regulator-vcc-sdhi0 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "SDHI0 Vcc";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vccq_sdhi0: regulator-vccq-sdhi0 {
+               compatible = "regulator-gpio";
+
+               regulator-name = "SDHI0 VccQ";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
+               gpios-states = <1>;
+               states = <3300000 1
+                         1800000 0>;
+       };
+
+       vcc_sdhi3: regulator-vcc-sdhi3 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "SDHI3 Vcc";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpio = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vccq_sdhi3: regulator-vccq-sdhi3 {
+               compatible = "regulator-gpio";
+
+               regulator-name = "SDHI3 VccQ";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+               gpios-states = <1>;
+               states = <3300000 1
+                         1800000 0>;
+       };
+
+       hdmi0-out {
+               compatible = "hdmi-connector";
+               label = "HDMI0 OUT";
+               type = "a";
+
+               port {
+                       hdmi0_con: endpoint {
+                       };
+               };
+       };
+
+       hdmi1-out {
+               compatible = "hdmi-connector";
+               label = "HDMI1 OUT";
+               type = "a";
+
+               port {
+                       hdmi1_con: endpoint {
+                       };
+               };
+       };
+
+       vga {
+               compatible = "vga-connector";
+
+               port {
+                       vga_in: endpoint {
+                               remote-endpoint = <&adv7123_out>;
+                       };
+               };
+       };
+
+       vga-encoder {
+               compatible = "adi,adv7123";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@0 {
+                               reg = <0>;
+                               adv7123_in: endpoint {
+                                       remote-endpoint = <&du_out_rgb>;
+                               };
+                       };
+                       port@1 {
+                               reg = <1>;
+                               adv7123_out: endpoint {
+                                       remote-endpoint = <&vga_in>;
+                               };
+                       };
+               };
+       };
+
+       x12_clk: x12 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <24576000>;
+       };
+
+       /* External DU dot clocks */
+       x21_clk: x21-clock {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <33000000>;
+       };
+
+       x22_clk: x22-clock {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <33000000>;
+       };
+
+       x23_clk: x23-clock {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <25000000>;
+       };
+};
+
+&audio_clk_a {
+       clock-frequency = <22579200>;
+};
+
+&avb {
+       pinctrl-0 = <&avb_pins>;
+       pinctrl-names = "default";
+       renesas,no-ether-link;
+       phy-handle = <&phy0>;
+       status = "okay";
+
+       phy0: ethernet-phy@0 {
+               rxc-skew-ps = <1500>;
+               reg = <0>;
+               interrupt-parent = <&gpio2>;
+               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+       };
+};
+
+&du {
+       pinctrl-0 = <&du_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+
+       ports {
+               port@0 {
+                       endpoint {
+                               remote-endpoint = <&adv7123_in>;
+                       };
+               };
+               port@3 {
+                       lvds_connector: endpoint {
+                       };
+               };
+       };
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&extalr_clk {
+       clock-frequency = <32768>;
+};
+
+&hsusb {
+       status = "okay";
+};
+
+&i2c2 {
+       pinctrl-0 = <&i2c2_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+
+       clock-frequency = <100000>;
+
+       ak4613: codec@10 {
+               compatible = "asahi-kasei,ak4613";
+               #sound-dai-cells = <0>;
+               reg = <0x10>;
+               clocks = <&rcar_sound 3>;
+
+               asahi-kasei,in1-single-end;
+               asahi-kasei,in2-single-end;
+               asahi-kasei,out1-single-end;
+               asahi-kasei,out2-single-end;
+               asahi-kasei,out3-single-end;
+               asahi-kasei,out4-single-end;
+               asahi-kasei,out5-single-end;
+               asahi-kasei,out6-single-end;
+       };
+
+       cs2000: clk_multiplier@4f {
+               #clock-cells = <0>;
+               compatible = "cirrus,cs2000-cp";
+               reg = <0x4f>;
+               clocks = <&audio_clkout>, <&x12_clk>;
+               clock-names = "clk_in", "ref_clk";
+
+               assigned-clocks = <&cs2000>;
+               assigned-clock-rates = <24576000>; /* 1/1 divide */
+       };
+};
+
+&i2c4 {
+       status = "okay";
+
+       csa_vdd: adc@7c {
+               compatible = "maxim,max9611";
+               reg = <0x7c>;
+
+               shunt-resistor-micro-ohms = <5000>;
+       };
+
+       csa_dvfs: adc@7f {
+               compatible = "maxim,max9611";
+               reg = <0x7f>;
+
+               shunt-resistor-micro-ohms = <5000>;
+       };
+};
+
+&i2c_dvfs {
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&pcie_bus_clk {
+       clock-frequency = <100000000>;
+};
+
+&pciec0 {
+       status = "okay";
+};
+
+&pciec1 {
+       status = "okay";
+};
+
+&pfc {
+       pinctrl-0 = <&scif_clk_pins>;
+       pinctrl-names = "default";
+
+       avb_pins: avb {
+               mux {
+                       groups = "avb_link", "avb_phy_int", "avb_mdc",
+                                "avb_mii";
+                       function = "avb";
+               };
+
+               pins_mdc {
+                       groups = "avb_mdc";
+                       drive-strength = <24>;
+               };
+
+               pins_mii_tx {
+                       pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", "PIN_AVB_TD0",
+                              "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
+                       drive-strength = <12>;
+               };
+       };
+
+       du_pins: du {
+               groups = "du_rgb888", "du_sync", "du_oddf", "du_clk_out_0";
+               function = "du";
+       };
+
+       i2c2_pins: i2c2 {
+               groups = "i2c2_a";
+               function = "i2c2";
+       };
+
+       pwm1_pins: pwm1 {
+               groups = "pwm1_a";
+               function = "pwm1";
+       };
+
+       scif1_pins: scif1 {
+               groups = "scif1_data_a", "scif1_ctrl";
+               function = "scif1";
+       };
+
+       scif2_pins: scif2 {
+               groups = "scif2_data_a";
+               function = "scif2";
+       };
+
+       scif_clk_pins: scif_clk {
+               groups = "scif_clk_a";
+               function = "scif_clk";
+       };
+
+       sdhi0_pins: sd0 {
+               groups = "sdhi0_data4", "sdhi0_ctrl";
+               function = "sdhi0";
+               power-source = <3300>;
+       };
+
+       sdhi0_pins_uhs: sd0_uhs {
+               groups = "sdhi0_data4", "sdhi0_ctrl";
+               function = "sdhi0";
+               power-source = <1800>;
+       };
+
+       sdhi2_pins: sd2 {
+               groups = "sdhi2_data8", "sdhi2_ctrl";
+               function = "sdhi2";
+               power-source = <3300>;
+       };
+
+       sdhi2_pins_uhs: sd2_uhs {
+               groups = "sdhi2_data8", "sdhi2_ctrl";
+               function = "sdhi2";
+               power-source = <1800>;
+       };
+
+       sdhi3_pins: sd3 {
+               groups = "sdhi3_data4", "sdhi3_ctrl";
+               function = "sdhi3";
+               power-source = <3300>;
+       };
+
+       sdhi3_pins_uhs: sd3_uhs {
+               groups = "sdhi3_data4", "sdhi3_ctrl";
+               function = "sdhi3";
+               power-source = <1800>;
+       };
+
+       sound_pins: sound {
+               groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
+               function = "ssi";
+       };
+
+       sound_clk_pins: sound_clk {
+               groups = "audio_clk_a_a", "audio_clk_b_a", "audio_clk_c_a",
+                        "audio_clkout_a", "audio_clkout3_a";
+               function = "audio_clk";
+       };
+
+       usb0_pins: usb0 {
+               groups = "usb0";
+               function = "usb0";
+       };
+
+       usb1_pins: usb1 {
+               mux {
+                       groups = "usb1";
+                       function = "usb1";
+               };
+
+               ovc {
+                       pins = "GP_6_27";
+                       bias-pull-up;
+               };
+
+               pwen {
+                       pins = "GP_6_26";
+                       bias-pull-down;
+               };
+       };
+};
+
+&pwm1 {
+       pinctrl-0 = <&pwm1_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&rcar_sound {
+       pinctrl-0 = <&sound_pins &sound_clk_pins>;
+       pinctrl-names = "default";
+
+       /* Single DAI */
+       #sound-dai-cells = <0>;
+
+       /* audio_clkout0/1/2/3 */
+       #clock-cells = <1>;
+       clock-frequency = <11289600 12288000>;
+
+       status = "okay";
+
+       /* update <audio_clk_b> to <cs2000> */
+       clocks = <&cpg CPG_MOD 1005>,
+                <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
+                <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
+                <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
+                <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
+                <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
+                <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
+                <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
+                <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
+                <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
+                <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
+                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+                <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
+                <&audio_clk_a>, <&cs2000>,
+                <&audio_clk_c>,
+                <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
+
+       rcar_sound,dai {
+               dai0 {
+                       playback = <&ssi0 &src0 &dvc0>;
+                       capture  = <&ssi1 &src1 &dvc1>;
+               };
+       };
+};
+
+&scif1 {
+       pinctrl-0 = <&scif1_pins>;
+       pinctrl-names = "default";
+
+       uart-has-rtscts;
+       status = "okay";
+};
+
+&scif2 {
+       pinctrl-0 = <&scif2_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&scif_clk {
+       clock-frequency = <14745600>;
+};
+
+&sdhi0 {
+       pinctrl-0 = <&sdhi0_pins>;
+       pinctrl-1 = <&sdhi0_pins_uhs>;
+       pinctrl-names = "default", "state_uhs";
+
+       vmmc-supply = <&vcc_sdhi0>;
+       vqmmc-supply = <&vccq_sdhi0>;
+       cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>;
+       bus-width = <4>;
+       sd-uhs-sdr50;
+       status = "okay";
+};
+
+&sdhi2 {
+       /* used for on-board 8bit eMMC */
+       pinctrl-0 = <&sdhi2_pins>;
+       pinctrl-1 = <&sdhi2_pins_uhs>;
+       pinctrl-names = "default", "state_uhs";
+
+       vmmc-supply = <&reg_3p3v>;
+       vqmmc-supply = <&reg_1p8v>;
+       bus-width = <8>;
+       mmc-hs200-1_8v;
+       non-removable;
+       status = "okay";
+};
+
+&sdhi3 {
+       pinctrl-0 = <&sdhi3_pins>;
+       pinctrl-1 = <&sdhi3_pins_uhs>;
+       pinctrl-names = "default", "state_uhs";
+
+       vmmc-supply = <&vcc_sdhi3>;
+       vqmmc-supply = <&vccq_sdhi3>;
+       cd-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
+       bus-width = <4>;
+       sd-uhs-sdr50;
+       status = "okay";
+};
+
+&ssi1 {
+       shared-pin;
+};
+
+&usb2_phy0 {
+       pinctrl-0 = <&usb0_pins>;
+       pinctrl-names = "default";
+
+       vbus-supply = <&vbus0_usb2>;
+       status = "okay";
+};
+
+&usb2_phy1 {
+       pinctrl-0 = <&usb1_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&wdt0 {
+       timeout-sec = <60>;
+       status = "okay";
+};
+
+&xhci0 {
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/renesas/salvator-x.dtsi b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
new file mode 100644 (file)
index 0000000..468868c
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Device Tree Source for the Salvator-X board
+ *
+ * Copyright (C) 2015-2016 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include "salvator-common.dtsi"
+
+/ {
+       model = "Renesas Salvator-X board";
+       compatible = "renesas,salvator-x";
+};
+
+&extal_clk {
+       clock-frequency = <16666666>;
+};
+
+&i2c4 {
+       versaclock5: clock-generator@6a {
+               compatible = "idt,5p49v5923";
+               reg = <0x6a>;
+               #clock-cells = <1>;
+               clocks = <&x23_clk>;
+               clock-names = "xin";
+       };
+};
diff --git a/arch/arm64/boot/dts/renesas/salvator-xs.dtsi b/arch/arm64/boot/dts/renesas/salvator-xs.dtsi
new file mode 100644 (file)
index 0000000..81227e3
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Device Tree Source for the Salvator-X 2nd version board
+ *
+ * Copyright (C) 2015-2017 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include "salvator-common.dtsi"
+
+/ {
+       model = "Renesas Salvator-X 2nd version board";
+       compatible = "renesas,salvator-xs";
+};
+
+&extal_clk {
+       clock-frequency = <16640000>;
+};
diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi b/arch/arm64/boot/dts/renesas/ulcb.dtsi
new file mode 100644 (file)
index 0000000..b5c6ee0
--- /dev/null
@@ -0,0 +1,367 @@
+/*
+ * Device Tree Source for the R-Car Gen3 ULCB board
+ *
+ * Copyright (C) 2016 Renesas Electronics Corp.
+ * Copyright (C) 2016 Cogent Embedded, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Renesas R-Car Gen3 ULCB board";
+
+       aliases {
+               serial0 = &scif2;
+               ethernet0 = &avb;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       audio_clkout: audio-clkout {
+               /*
+                * This is same as <&rcar_sound 0>
+                * but needed to avoid cs2000/rcar_sound probe dead-lock
+                */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <11289600>;
+       };
+
+       keyboard {
+               compatible = "gpio-keys";
+
+               key-1 {
+                       linux,code = <KEY_1>;
+                       label = "SW3";
+                       wakeup-source;
+                       debounce-interval = <20>;
+                       gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led5 {
+                       gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
+               };
+               led6 {
+                       gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       reg_1p8v: regulator0 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-1.8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator1 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       rsnd_ak4613: sound {
+               compatible = "simple-audio-card";
+
+               simple-audio-card,format = "left_j";
+               simple-audio-card,bitclock-master = <&sndcpu>;
+               simple-audio-card,frame-master = <&sndcpu>;
+
+               sndcpu: simple-audio-card,cpu {
+                       sound-dai = <&rcar_sound>;
+               };
+
+               sndcodec: simple-audio-card,codec {
+                       sound-dai = <&ak4613>;
+               };
+       };
+
+       vcc_sdhi0: regulator-vcc-sdhi0 {
+               compatible = "regulator-fixed";
+
+               regulator-name = "SDHI0 Vcc";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       vccq_sdhi0: regulator-vccq-sdhi0 {
+               compatible = "regulator-gpio";
+
+               regulator-name = "SDHI0 VccQ";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <3300000>;
+
+               gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
+               gpios-states = <1>;
+               states = <3300000 1
+                         1800000 0>;
+       };
+
+       x12_clk: x12 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <24576000>;
+       };
+};
+
+&audio_clk_a {
+       clock-frequency = <22579200>;
+};
+
+&avb {
+       pinctrl-0 = <&avb_pins>;
+       pinctrl-names = "default";
+       renesas,no-ether-link;
+       phy-handle = <&phy0>;
+       status = "okay";
+
+       phy0: ethernet-phy@0 {
+               rxc-skew-ps = <1500>;
+               reg = <0>;
+               interrupt-parent = <&gpio2>;
+               interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+       };
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&extal_clk {
+       clock-frequency = <16666666>;
+};
+
+&extalr_clk {
+       clock-frequency = <32768>;
+};
+
+&i2c2 {
+       pinctrl-0 = <&i2c2_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+
+       clock-frequency = <100000>;
+
+       ak4613: codec@10 {
+               compatible = "asahi-kasei,ak4613";
+               #sound-dai-cells = <0>;
+               reg = <0x10>;
+               clocks = <&rcar_sound 3>;
+
+               asahi-kasei,in1-single-end;
+               asahi-kasei,in2-single-end;
+               asahi-kasei,out1-single-end;
+               asahi-kasei,out2-single-end;
+               asahi-kasei,out3-single-end;
+               asahi-kasei,out4-single-end;
+               asahi-kasei,out5-single-end;
+               asahi-kasei,out6-single-end;
+       };
+
+       cs2000: clk-multiplier@4f {
+               #clock-cells = <0>;
+               compatible = "cirrus,cs2000-cp";
+               reg = <0x4f>;
+               clocks = <&audio_clkout>, <&x12_clk>;
+               clock-names = "clk_in", "ref_clk";
+
+               assigned-clocks = <&cs2000>;
+               assigned-clock-rates = <24576000>; /* 1/1 divide */
+       };
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&pfc {
+       pinctrl-0 = <&scif_clk_pins>;
+       pinctrl-names = "default";
+
+       avb_pins: avb {
+               mux {
+                       groups = "avb_link", "avb_phy_int", "avb_mdc",
+                                "avb_mii";
+                       function = "avb";
+               };
+
+               pins_mdc {
+                       groups = "avb_mdc";
+                       drive-strength = <24>;
+               };
+
+               pins_mii_tx {
+                       pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", "PIN_AVB_TD0",
+                              "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
+                       drive-strength = <12>;
+               };
+       };
+
+       i2c2_pins: i2c2 {
+               groups = "i2c2_a";
+               function = "i2c2";
+       };
+
+       scif2_pins: scif2 {
+               groups = "scif2_data_a";
+               function = "scif2";
+       };
+
+       scif_clk_pins: scif_clk {
+               groups = "scif_clk_a";
+               function = "scif_clk";
+       };
+
+       sdhi0_pins: sd0 {
+               groups = "sdhi0_data4", "sdhi0_ctrl";
+               function = "sdhi0";
+               power-source = <3300>;
+       };
+
+       sdhi0_pins_uhs: sd0_uhs {
+               groups = "sdhi0_data4", "sdhi0_ctrl";
+               function = "sdhi0";
+               power-source = <1800>;
+       };
+
+       sdhi2_pins: sd2 {
+               groups = "sdhi2_data8", "sdhi2_ctrl";
+               function = "sdhi2";
+               power-source = <3300>;
+       };
+
+       sdhi2_pins_uhs: sd2_uhs {
+               groups = "sdhi2_data8", "sdhi2_ctrl";
+               function = "sdhi2";
+               power-source = <1800>;
+       };
+
+       sound_pins: sound {
+               groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
+               function = "ssi";
+       };
+
+       sound_clk_pins: sound-clk {
+               groups = "audio_clk_a_a", "audio_clk_b_a", "audio_clk_c_a",
+                        "audio_clkout_a", "audio_clkout3_a";
+               function = "audio_clk";
+       };
+
+       usb1_pins: usb1 {
+               groups = "usb1";
+               function = "usb1";
+       };
+};
+
+&rcar_sound {
+       pinctrl-0 = <&sound_pins &sound_clk_pins>;
+       pinctrl-names = "default";
+
+       /* Single DAI */
+       #sound-dai-cells = <0>;
+
+       /* audio_clkout0/1/2/3 */
+       #clock-cells = <1>;
+       clock-frequency = <11289600 12288000>;
+
+       status = "okay";
+
+       /* update <audio_clk_b> to <cs2000> */
+       clocks = <&cpg CPG_MOD 1005>,
+                <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
+                <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
+                <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
+                <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
+                <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
+                <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
+                <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
+                <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
+                <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
+                <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
+                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+                <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+                <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
+                <&audio_clk_a>, <&cs2000>,
+                <&audio_clk_c>,
+                <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
+
+       rcar_sound,dai {
+               dai0 {
+                       playback = <&ssi0 &src0 &dvc0>;
+                       capture  = <&ssi1 &src1 &dvc1>;
+               };
+       };
+};
+
+&scif2 {
+       pinctrl-0 = <&scif2_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&scif_clk {
+       clock-frequency = <14745600>;
+};
+
+&sdhi0 {
+       pinctrl-0 = <&sdhi0_pins>;
+       pinctrl-1 = <&sdhi0_pins_uhs>;
+       pinctrl-names = "default", "state_uhs";
+
+       vmmc-supply = <&vcc_sdhi0>;
+       vqmmc-supply = <&vccq_sdhi0>;
+       cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
+       bus-width = <4>;
+       sd-uhs-sdr50;
+       status = "okay";
+};
+
+&sdhi2 {
+       /* used for on-board 8bit eMMC */
+       pinctrl-0 = <&sdhi2_pins>;
+       pinctrl-1 = <&sdhi2_pins_uhs>;
+       pinctrl-names = "default", "state_uhs";
+
+       vmmc-supply = <&reg_3p3v>;
+       vqmmc-supply = <&reg_1p8v>;
+       bus-width = <8>;
+       mmc-hs200-1_8v;
+       non-removable;
+       status = "okay";
+};
+
+&ssi1 {
+       shared-pin;
+};
+
+&usb2_phy1 {
+       pinctrl-0 = <&usb1_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&wdt0 {
+       timeout-sec = <60>;
+       status = "okay";
+};
index b5636bba6b1c0ed9150d40bf32fae3209a040e5e..bcfa53b1e6b7ef7e310ba731c090c10fac657bfc 100644 (file)
@@ -5,6 +5,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-orion-r68-meta.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-px5-evb.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-r88.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-evb.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb
 
 always         := $(dtb-y)
index 7e69f1fe78d69cc03b82665b35e69f7a53626b73..0be96cee27bd107e5af9cecd8a72ffc6c1ca7b46 100644 (file)
                        <32768>;
        };
 
+       sdmmc: dwmmc@ff500000 {
+               compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
+               reg = <0x0 0xff500000 0x0 0x4000>;
+               interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
+                        <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
+               clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
+               fifo-depth = <0x100>;
+               status = "disabled";
+       };
+
+       sdio: dwmmc@ff510000 {
+               compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
+               reg = <0x0 0xff510000 0x0 0x4000>;
+               interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>,
+                        <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>;
+               clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
+               fifo-depth = <0x100>;
+               status = "disabled";
+       };
+
+       emmc: dwmmc@ff520000 {
+               compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
+               reg = <0x0 0xff520000 0x0 0x4000>;
+               interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>,
+                        <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>;
+               clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
+               fifo-depth = <0x100>;
+               status = "disabled";
+       };
+
        gmac2io: ethernet@ff540000 {
                compatible = "rockchip,rk3328-gmac";
                reg = <0x0 0xff540000 0x0 0x10000>;
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
new file mode 100644 (file)
index 0000000..ba1d981
--- /dev/null
@@ -0,0 +1,718 @@
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include <dt-bindings/pwm/pwm.h>
+#include "rk3399.dtsi"
+
+/ {
+       model = "Firefly-RK3399 Board";
+       compatible = "firefly,firefly-rk3399", "rockchip,rk3399";
+
+       backlight: backlight {
+               compatible = "pwm-backlight";
+               enable-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
+               pwms = <&pwm0 0 25000 0>;
+               brightness-levels = <
+                         0   1   2   3   4   5   6   7
+                         8   9  10  11  12  13  14  15
+                        16  17  18  19  20  21  22  23
+                        24  25  26  27  28  29  30  31
+                        32  33  34  35  36  37  38  39
+                        40  41  42  43  44  45  46  47
+                        48  49  50  51  52  53  54  55
+                        56  57  58  59  60  61  62  63
+                        64  65  66  67  68  69  70  71
+                        72  73  74  75  76  77  78  79
+                        80  81  82  83  84  85  86  87
+                        88  89  90  91  92  93  94  95
+                        96  97  98  99 100 101 102 103
+                       104 105 106 107 108 109 110 111
+                       112 113 114 115 116 117 118 119
+                       120 121 122 123 124 125 126 127
+                       128 129 130 131 132 133 134 135
+                       136 137 138 139 140 141 142 143
+                       144 145 146 147 148 149 150 151
+                       152 153 154 155 156 157 158 159
+                       160 161 162 163 164 165 166 167
+                       168 169 170 171 172 173 174 175
+                       176 177 178 179 180 181 182 183
+                       184 185 186 187 188 189 190 191
+                       192 193 194 195 196 197 198 199
+                       200 201 202 203 204 205 206 207
+                       208 209 210 211 212 213 214 215
+                       216 217 218 219 220 221 222 223
+                       224 225 226 227 228 229 230 231
+                       232 233 234 235 236 237 238 239
+                       240 241 242 243 244 245 246 247
+                       248 249 250 251 252 253 254 255>;
+               default-brightness-level = <200>;
+       };
+
+       clkin_gmac: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "clkin_gmac";
+               #clock-cells = <0>;
+       };
+
+       dc_12v: dc-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "dc_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       rt5640-sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "rockchip,rt5640-codec";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,mclk-fs = <256>;
+               simple-audio-card,widgets =
+                       "Microphone", "Mic Jack",
+                       "Headphone", "Headphone Jack";
+               simple-audio-card,routing =
+                       "Mic Jack", "MICBIAS1",
+                       "IN1P", "Mic Jack",
+                       "Headphone Jack", "HPOL",
+                       "Headphone Jack", "HPOR";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&i2s1>;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&rt5640>;
+               };
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_enable_h>;
+
+               /*
+                * On the module itself this is one of these (depending
+                * on the actual card populated):
+                * - SDIO_RESET_L_WL_REG_ON
+                * - PDN (power down when low)
+                */
+               reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+       };
+
+       /* switched by pmic_sleep */
+       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc1v8_s3";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_1v8>;
+       };
+
+       vcc3v3_pcie: vcc3v3-pcie-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pcie_pwr_en>;
+               regulator-name = "vcc3v3_pcie";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&dc_12v>;
+       };
+
+       vcc3v3_sys: vcc3v3-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_sys>;
+       };
+
+       /* Actually 3 regulators (host0, 1, 2) controlled by the same gpio */
+       vcc5v0_host: vcc5v0-host-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_host_en>;
+               regulator-name = "vcc5v0_host";
+               regulator-always-on;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc_sys: vcc-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_12v>;
+       };
+
+       vdd_log: vdd-log {
+               compatible = "pwm-regulator";
+               pwms = <&pwm2 0 25000 1>;
+               regulator-name = "vdd_log";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <800000>;
+               regulator-max-microvolt = <1400000>;
+               vin-supply = <&vcc_sys>;
+       };
+};
+
+&cpu_l0 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_b0 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_b1 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&emmc_phy {
+       status = "okay";
+};
+
+&gmac {
+       assigned-clocks = <&cru SCLK_RMII_SRC>;
+       assigned-clock-parents = <&clkin_gmac>;
+       clock_in_out = "input";
+       phy-supply = <&vcc_lan>;
+       phy-mode = "rgmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       tx_delay = <0x28>;
+       rx_delay = <0x11>;
+       status = "okay";
+};
+
+&i2c0 {
+       clock-frequency = <400000>;
+       i2c-scl-rising-time-ns = <168>;
+       i2c-scl-falling-time-ns = <4>;
+       status = "okay";
+
+       rk808: pmic@1b {
+               compatible = "rockchip,rk808";
+               reg = <0x1b>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "xin32k", "rk808-clkout2";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pmic_int_l>;
+               rockchip,system-power-controller;
+               wakeup-source;
+
+               vcc1-supply = <&vcc_sys>;
+               vcc2-supply = <&vcc_sys>;
+               vcc3-supply = <&vcc_sys>;
+               vcc4-supply = <&vcc_sys>;
+               vcc6-supply = <&vcc_sys>;
+               vcc7-supply = <&vcc_sys>;
+               vcc8-supply = <&vcc3v3_sys>;
+               vcc9-supply = <&vcc_sys>;
+               vcc10-supply = <&vcc_sys>;
+               vcc11-supply = <&vcc_sys>;
+               vcc12-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc1v8_pmu>;
+
+               regulators {
+                       vdd_center: DCDC_REG1 {
+                               regulator-name = "vdd_center";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <750000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vdd_cpu_l: DCDC_REG2 {
+                               regulator-name = "vdd_cpu_l";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <750000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_1v8: DCDC_REG4 {
+                               regulator-name = "vcc_1v8";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc1v8_dvp: LDO_REG1 {
+                               regulator-name = "vcc1v8_dvp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc2v8_dvp: LDO_REG2 {
+                               regulator-name = "vcc2v8_dvp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc1v8_pmu: LDO_REG3 {
+                               regulator-name = "vcc1v8_pmu";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc_sdio: LDO_REG4 {
+                               regulator-name = "vcc_sdio";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3300000>;
+                               };
+                       };
+
+                       vcca3v0_codec: LDO_REG5 {
+                               regulator-name = "vcca3v0_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_1v5: LDO_REG6 {
+                               regulator-name = "vcc_1v5";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1500000>;
+                               };
+                       };
+
+                       vcca1v8_codec: LDO_REG7 {
+                               regulator-name = "vcca1v8_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_3v0: LDO_REG8 {
+                               regulator-name = "vcc_3v0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcc3v3_s3: vcc_lan: SWITCH_REG1 {
+                               regulator-name = "vcc3v3_s3";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v3_s0: SWITCH_REG2 {
+                               regulator-name = "vcc3v3_s0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+               };
+       };
+
+       vdd_cpu_b: regulator@40 {
+               compatible = "silergy,syr827";
+               reg = <0x40>;
+               fcs,suspend-voltage-selector = <0>;
+               regulator-name = "vdd_cpu_b";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+
+       vdd_gpu: regulator@41 {
+               compatible = "silergy,syr828";
+               reg = <0x41>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_gpu";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+};
+
+&i2c1 {
+       i2c-scl-rising-time-ns = <300>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+
+       rt5640: rt5640@1c {
+               compatible = "realtek,rt5640";
+               reg = <0x1c>;
+               clocks = <&cru SCLK_I2S_8CH_OUT>;
+               clock-names = "mclk";
+               realtek,in1-differential;
+               #sound-dai-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&rt5640_hpcon>;
+       };
+};
+
+&i2c3 {
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c4 {
+       i2c-scl-rising-time-ns = <600>;
+       i2c-scl-falling-time-ns = <20>;
+       status = "okay";
+
+       accelerometer@68 {
+               compatible = "invensense,mpu6500";
+               reg = <0x68>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PC6 IRQ_TYPE_EDGE_RISING>;
+       };
+};
+
+&i2s0 {
+       rockchip,playback-channels = <8>;
+       rockchip,capture-channels = <8>;
+       #sound-dai-cells = <0>;
+       status = "okay";
+};
+
+&i2s1 {
+       rockchip,playback-channels = <2>;
+       rockchip,capture-channels = <2>;
+       #sound-dai-cells = <0>;
+       status = "okay";
+};
+
+&i2s2 {
+       #sound-dai-cells = <0>;
+       status = "okay";
+};
+
+&io_domains {
+       status = "okay";
+
+       bt656-supply = <&vcc1v8_dvp>;
+       audio-supply = <&vcca1v8_codec>;
+       sdmmc-supply = <&vcc_sdio>;
+       gpio1830-supply = <&vcc_3v0>;
+};
+
+&pcie_phy {
+       status = "okay";
+};
+
+&pcie0 {
+       ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
+       num-lanes = <4>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie_clkreqn>;
+       status = "okay";
+};
+
+&pmu_io_domains {
+       pmu1830-supply = <&vcc_3v0>;
+       status = "okay";
+};
+
+&pinctrl {
+       buttons {
+               pwrbtn: pwrbtn {
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       lcd-panel {
+               lcd_panel_reset: lcd-panel-reset {
+                       rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       pcie {
+               pcie_pwr_en: pcie-pwr-en {
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               pcie_3g_drv: pcie-3g-drv {
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       pmic {
+               vsel1_gpio: vsel1-gpio {
+                       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+
+               vsel2_gpio: vsel2-gpio {
+                       rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
+               };
+       };
+
+       sdio-pwrseq {
+               wifi_enable_h: wifi-enable-h {
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       rt5640 {
+               rt5640_hpcon: rt5640-hpcon {
+                       rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       pmic {
+               pmic_int_l: pmic-int-l {
+                       rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       usb2 {
+               vcc5v0_host_en: vcc5v0-host-en {
+                       rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+};
+
+&pwm0 {
+       status = "okay";
+};
+
+&pwm2 {
+       status = "okay";
+};
+
+&saradc {
+       vref-supply = <&vcca1v8_s3>;
+       status = "okay";
+};
+
+&sdhci {
+       bus-width = <8>;
+       keep-power-in-suspend;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;
+       non-removable;
+       status = "okay";
+};
+
+&tsadc {
+       /* tshut mode 0:CRU 1:GPIO */
+       rockchip,hw-tshut-mode = <1>;
+       /* tshut polarity 0:LOW 1:HIGH */
+       rockchip,hw-tshut-polarity = <1>;
+       status = "okay";
+};
+
+&u2phy0 {
+       status = "okay";
+
+       u2phy0_otg: otg-port {
+               status = "okay";
+       };
+
+       u2phy0_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&u2phy1 {
+       status = "okay";
+
+       u2phy1_otg: otg-port {
+               status = "okay";
+       };
+
+       u2phy1_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_xfer &uart0_cts>;
+       status = "okay";
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
+
+&usb_host1_ehci {
+       status = "okay";
+};
+
+&usb_host1_ohci {
+       status = "okay";
+};
+
+&usbdrd3_0 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+       status = "okay";
+       dr_mode = "otg";
+};
+
+&usbdrd3_1 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_1 {
+       status = "okay";
+       dr_mode = "host";
+};
index 0d960b7f7625e6e9fa1eeb805a0e27a530a006be..eb505934402311f8b6b4621bb1d79b8965b0648e 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <dt-bindings/input/input.h>
 #include "rk3399.dtsi"
-#include "rk3399-opp.dtsi"
+#include "rk3399-op1-opp.dtsi"
 
 / {
        chosen {
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-op1-opp.dtsi
new file mode 100644 (file)
index 0000000..be7fe63
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2016-2017 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/ {
+       cluster0_opp: opp-table0 {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp00 {
+                       opp-hz = /bits/ 64 <408000000>;
+                       opp-microvolt = <800000>;
+                       clock-latency-ns = <40000>;
+               };
+               opp01 {
+                       opp-hz = /bits/ 64 <600000000>;
+                       opp-microvolt = <825000>;
+               };
+               opp02 {
+                       opp-hz = /bits/ 64 <816000000>;
+                       opp-microvolt = <850000>;
+               };
+               opp03 {
+                       opp-hz = /bits/ 64 <1008000000>;
+                       opp-microvolt = <900000>;
+               };
+               opp04 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <975000>;
+               };
+               opp05 {
+                       opp-hz = /bits/ 64 <1416000000>;
+                       opp-microvolt = <1100000>;
+               };
+               opp06 {
+                       opp-hz = /bits/ 64 <1512000000>;
+                       opp-microvolt = <1150000>;
+               };
+       };
+
+       cluster1_opp: opp-table1 {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp00 {
+                       opp-hz = /bits/ 64 <408000000>;
+                       opp-microvolt = <800000>;
+                       clock-latency-ns = <40000>;
+               };
+               opp01 {
+                       opp-hz = /bits/ 64 <600000000>;
+                       opp-microvolt = <800000>;
+               };
+               opp02 {
+                       opp-hz = /bits/ 64 <816000000>;
+                       opp-microvolt = <825000>;
+               };
+               opp03 {
+                       opp-hz = /bits/ 64 <1008000000>;
+                       opp-microvolt = <850000>;
+               };
+               opp04 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <900000>;
+               };
+               opp05 {
+                       opp-hz = /bits/ 64 <1416000000>;
+                       opp-microvolt = <975000>;
+               };
+               opp06 {
+                       opp-hz = /bits/ 64 <1608000000>;
+                       opp-microvolt = <1050000>;
+               };
+               opp07 {
+                       opp-hz = /bits/ 64 <1800000000>;
+                       opp-microvolt = <1150000>;
+               };
+               opp08 {
+                       opp-hz = /bits/ 64 <2016000000>;
+                       opp-microvolt = <1250000>;
+               };
+       };
+};
+
+&cpu_l0 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_l1 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_l2 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_l3 {
+       operating-points-v2 = <&cluster0_opp>;
+};
+
+&cpu_b0 {
+       operating-points-v2 = <&cluster1_opp>;
+};
+
+&cpu_b1 {
+       operating-points-v2 = <&cluster1_opp>;
+};
index dd82e16236a8dd8d024a705d1c492fcd414a7d90..c83460db130ab35fcf4a37b9c9998de6be87f7d8 100644 (file)
                };
                opp02 {
                        opp-hz = /bits/ 64 <816000000>;
-                       opp-microvolt = <800000>;
+                       opp-microvolt = <850000>;
                };
                opp03 {
                        opp-hz = /bits/ 64 <1008000000>;
-                       opp-microvolt = <875000>;
+                       opp-microvolt = <925000>;
                };
                opp04 {
                        opp-hz = /bits/ 64 <1200000000>;
-                       opp-microvolt = <925000>;
+                       opp-microvolt = <1000000>;
                };
                opp05 {
                        opp-hz = /bits/ 64 <1416000000>;
-                       opp-microvolt = <1050000>;
-               };
-               opp06 {
-                       opp-hz = /bits/ 64 <1512000000>;
                        opp-microvolt = <1125000>;
                };
        };
                };
                opp06 {
                        opp-hz = /bits/ 64 <1608000000>;
-                       opp-microvolt = <1075000>;
+                       opp-microvolt = <1100000>;
                };
                opp07 {
                        opp-hz = /bits/ 64 <1800000000>;
-                       opp-microvolt = <1150000>;
-               };
-               opp08 {
-                       opp-hz = /bits/ 64 <2016000000>;
-                       opp-microvolt = <1250000>;
+                       opp-microvolt = <1200000>;
                };
        };
 };
index f4f3c96c798d0c0caf5def9b155c8b273f3ba6e4..69c56f7316c4577105f44d01762d5d1852df05df 100644 (file)
@@ -56,6 +56,7 @@
        #size-cells = <2>;
 
        aliases {
+               ethernet0 = &gmac;
                i2c0 = &i2c0;
                i2c1 = &i2c1;
                i2c2 = &i2c2;
                #size-cells = <2>;
                #interrupt-cells = <1>;
                aspm-no-l0s;
-               bus-range = <0x0 0x1>;
+               bus-range = <0x0 0x1f>;
                clocks = <&cru ACLK_PCIE>, <&cru ACLK_PERF_PCIE>,
                         <&cru PCLK_PCIE>, <&cru SCLK_PCIE_PM>;
                clock-names = "aclk", "aclk-perf",
                msi-map = <0x0 &its 0x0 0x1000>;
                phys = <&pcie_phy>;
                phy-names = "pcie-phy";
-               ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x600000
-                         0x81000000 0x0 0xfa600000 0x0 0xfa600000 0x0 0x100000>;
+               ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x1e00000
+                         0x81000000 0x0 0xfbe00000 0x0 0xfbe00000 0x0 0x100000>;
                resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>,
                         <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>,
                         <&cru SRST_PCIE_PM>, <&cru SRST_P_PCIE>,
                status = "disabled";
        };
 
-       qos_sd: qos@ffa74000 {
-               compatible = "syscon";
-               reg = <0x0 0xffa74000 0x0 0x20>;
-       };
-
        qos_emmc: qos@ffa58000 {
                compatible = "syscon";
                reg = <0x0 0xffa58000 0x0 0x20>;
                reg = <0x0 0xffa5c000 0x0 0x20>;
        };
 
+       qos_pcie: qos@ffa60080 {
+               compatible = "syscon";
+               reg = <0x0 0xffa60080 0x0 0x20>;
+       };
+
+       qos_usb_host0: qos@ffa60100 {
+               compatible = "syscon";
+               reg = <0x0 0xffa60100 0x0 0x20>;
+       };
+
+       qos_usb_host1: qos@ffa60180 {
+               compatible = "syscon";
+               reg = <0x0 0xffa60180 0x0 0x20>;
+       };
+
+       qos_usb_otg0: qos@ffa70000 {
+               compatible = "syscon";
+               reg = <0x0 0xffa70000 0x0 0x20>;
+       };
+
+       qos_usb_otg1: qos@ffa70080 {
+               compatible = "syscon";
+               reg = <0x0 0xffa70080 0x0 0x20>;
+       };
+
+       qos_sd: qos@ffa74000 {
+               compatible = "syscon";
+               reg = <0x0 0xffa74000 0x0 0x20>;
+       };
+
+       qos_sdioaudio: qos@ffa76000 {
+               compatible = "syscon";
+               reg = <0x0 0xffa76000 0x0 0x20>;
+       };
+
        qos_hdcp: qos@ffa90000 {
                compatible = "syscon";
                reg = <0x0 0xffa90000 0x0 0x20>;
                reg = <0x0 0xffad0000 0x0 0x20>;
        };
 
+       qos_perihp: qos@ffad8080 {
+               compatible = "syscon";
+               reg = <0x0 0xffad8080 0x0 0x20>;
+       };
+
        qos_gpu: qos@ffae0000 {
                compatible = "syscon";
                reg = <0x0 0xffae0000 0x0 0x20>;
                        };
                };
 
+               sdio0 {
+                       sdio0_bus1: sdio0-bus1 {
+                               rockchip,pins =
+                                       <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_bus4: sdio0-bus4 {
+                               rockchip,pins =
+                                       <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up>,
+                                       <2 RK_PC5 RK_FUNC_1 &pcfg_pull_up>,
+                                       <2 RK_PC6 RK_FUNC_1 &pcfg_pull_up>,
+                                       <2 RK_PC7 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_cmd: sdio0-cmd {
+                               rockchip,pins =
+                                       <2 RK_PD0 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_clk: sdio0-clk {
+                               rockchip,pins =
+                                       <2 RK_PD1 RK_FUNC_1 &pcfg_pull_none>;
+                       };
+
+                       sdio0_cd: sdio0-cd {
+                               rockchip,pins =
+                                       <2 RK_PD2 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_pwr: sdio0-pwr {
+                               rockchip,pins =
+                                       <2 RK_PD3 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_bkpwr: sdio0-bkpwr {
+                               rockchip,pins =
+                                       <2 RK_PD4 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_wp: sdio0-wp {
+                               rockchip,pins =
+                                       <0 RK_PA3 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdio0_int: sdio0-int {
+                               rockchip,pins =
+                                       <0 RK_PA4 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+               };
+
+               sdmmc {
+                       sdmmc_bus1: sdmmc-bus1 {
+                               rockchip,pins =
+                                       <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdmmc_bus4: sdmmc-bus4 {
+                               rockchip,pins =
+                                       <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up>,
+                                       <4 RK_PB1 RK_FUNC_1 &pcfg_pull_up>,
+                                       <4 RK_PB2 RK_FUNC_1 &pcfg_pull_up>,
+                                       <4 RK_PB3 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdmmc_clk: sdmmc-clk {
+                               rockchip,pins =
+                                       <4 RK_PB4 RK_FUNC_1 &pcfg_pull_none>;
+                       };
+
+                       sdmmc_cmd: sdmmc-cmd {
+                               rockchip,pins =
+                                       <4 RK_PB5 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdmmc_cd: sdmcc-cd {
+                               rockchip,pins =
+                                       <0 RK_PA7 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+
+                       sdmmc_wp: sdmmc-wp {
+                               rockchip,pins =
+                                       <0 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                       };
+               };
+
                sleep {
                        ap_pwroff: ap-pwroff {
                                rockchip,pins = <1 5 RK_FUNC_1 &pcfg_pull_none>;
                                rockchip,pins =
                                        <4 21 RK_FUNC_1 &pcfg_pull_none>;
                        };
+
+                       spdif_bus_1: spdif-bus-1 {
+                               rockchip,pins =
+                                       <3 RK_PC0 RK_FUNC_3 &pcfg_pull_none>;
+                       };
                };
 
                spi0 {
                        };
                };
 
+               hdmi {
+                       hdmi_i2c_xfer: hdmi-i2c-xfer {
+                               rockchip,pins =
+                                       <4 RK_PC1 RK_FUNC_3 &pcfg_pull_none>,
+                                       <4 RK_PC0 RK_FUNC_3 &pcfg_pull_none>;
+                       };
+
+                       hdmi_cec: hdmi-cec {
+                               rockchip,pins =
+                                       <4 RK_PC7 RK_FUNC_1 &pcfg_pull_none>;
+                       };
+               };
+
                pcie {
                        pcie_clkreqn: pci-clkreqn {
                                rockchip,pins =
                                rockchip,pins =
                                        <4 24 RK_FUNC_1 &pcfg_pull_none>;
                        };
+
+                       pcie_clkreqn_cpm: pci-clkreqn-cpm {
+                               rockchip,pins =
+                                       <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       };
+
+                       pcie_clkreqnb_cpm: pci-clkreqnb-cpm {
+                               rockchip,pins =
+                                       <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+                       };
                };
 
        };
index 5538598b302cf027b09862c81da0bf10a34d8958..4a13a3a971010e7c09f7919b6dacc796c1e3efa4 100644 (file)
@@ -1,5 +1,7 @@
 dtb-$(CONFIG_ARCH_UNIPHIER) += \
+       uniphier-ld11-global.dtb \
        uniphier-ld11-ref.dtb \
+       uniphier-ld20-global.dtb \
        uniphier-ld20-ref.dtb
 
 always         := $(dtb-y)
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts b/arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts
new file mode 100644 (file)
index 0000000..1153570
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Device Tree Source for UniPhier LD11 Global Board
+ *
+ * Copyright (C) 2016-2017 Socionext Inc.
+ *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ *           Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+/include/ "uniphier-ld11.dtsi"
+
+/ {
+       model = "UniPhier LD11 Global Board (REF_LD11_GP)";
+       compatible = "socionext,uniphier-ld11-global",
+                    "socionext,uniphier-ld11";
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       aliases {
+               serial0 = &serial0;
+               serial1 = &serial1;
+               serial2 = &serial2;
+               serial3 = &serial3;
+               i2c0 = &i2c0;
+               i2c1 = &i2c1;
+               i2c2 = &i2c2;
+               i2c3 = &i2c3;
+               i2c4 = &i2c4;
+               i2c5 = &i2c5;
+       };
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0 0x80000000 0 0x40000000>;
+       };
+};
+
+&serial0 {
+       status = "okay";
+};
+
+&serial1 {
+       status = "okay";
+};
+
+&i2c0 {
+       status = "okay";
+
+       eeprom@50 {
+               compatible = "st,24c64", "atmel,24c64";
+               reg = <0x50>;
+               pagesize = <32>;
+       };
+};
+
+&usb0 {
+       status = "okay";
+};
+
+&usb1 {
+       status = "okay";
+};
+
+&usb2 {
+       status = "okay";
+};
index 0173e93ab14169f51d7ba4b673e1b98cd6b0a689..cc8ebe34c27cd35e131e7a05f66a5c5a63dca7e4 100644 (file)
@@ -4,43 +4,7 @@
  * Copyright (C) 2016 Socionext Inc.
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  */
 
 /dts-v1/;
index 151c043b4835a14cd5db873b640b04f8731b2c19..bdce5b89baece0b53738deb8ff76c18f142f986b 100644 (file)
@@ -4,46 +4,10 @@
  * Copyright (C) 2016 Socionext Inc.
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  */
 
-/memreserve/ 0x80000000 0x00080000;
+/memreserve/ 0x80000000 0x02000000;
 
 / {
        compatible = "socionext,uniphier-ld11";
                compatible = "operating-points-v2";
                opp-shared;
 
-               opp@245000000 {
+               opp-245000000 {
                        opp-hz = /bits/ 64 <245000000>;
                        clock-latency-ns = <300>;
                };
-               opp@250000000 {
+               opp-250000000 {
                        opp-hz = /bits/ 64 <250000000>;
                        clock-latency-ns = <300>;
                };
-               opp@490000000 {
+               opp-490000000 {
                        opp-hz = /bits/ 64 <490000000>;
                        clock-latency-ns = <300>;
                };
-               opp@500000000 {
+               opp-500000000 {
                        opp-hz = /bits/ 64 <500000000>;
                        clock-latency-ns = <300>;
                };
-               opp@653334000 {
+               opp-653334000 {
                        opp-hz = /bits/ 64 <653334000>;
                        clock-latency-ns = <300>;
                };
-               opp@666667000 {
+               opp-666667000 {
                        opp-hz = /bits/ 64 <666667000>;
                        clock-latency-ns = <300>;
                };
-               opp@980000000 {
+               opp-980000000 {
                        opp-hz = /bits/ 64 <980000000>;
                        clock-latency-ns = <300>;
                };
                        pinctrl-0 = <&pinctrl_system_bus>;
                };
 
-               smpctrl@59800000 {
+               smpctrl@59801000 {
                        compatible = "socionext,uniphier-smpctrl";
                        reg = <0x59801000 0x400>;
                };
                        bus-width = <8>;
                        mmc-ddr-1_8v;
                        mmc-hs200-1_8v;
+                       cdns,phy-input-delay-legacy = <4>;
+                       cdns,phy-input-delay-mmc-highspeed = <2>;
+                       cdns,phy-input-delay-mmc-ddr = <3>;
+                       cdns,phy-dll-delay-sdclk = <21>;
+                       cdns,phy-dll-delay-sdclk-hsmmc = <21>;
                };
 
                usb0: usb@5a800100 {
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts b/arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts
new file mode 100644 (file)
index 0000000..9f620d4
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Device Tree Source for UniPhier LD20 Global Board
+ *
+ * Copyright (C) 2015-2017 Socionext Inc.
+ *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ *           Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+/include/ "uniphier-ld20.dtsi"
+
+/ {
+       model = "UniPhier LD20 Global Board (REF_LD20_GP)";
+       compatible = "socionext,uniphier-ld20-global",
+                    "socionext,uniphier-ld20";
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       aliases {
+               serial0 = &serial0;
+               serial1 = &serial1;
+               serial2 = &serial2;
+               serial3 = &serial3;
+               i2c0 = &i2c0;
+               i2c1 = &i2c1;
+               i2c2 = &i2c2;
+               i2c3 = &i2c3;
+               i2c4 = &i2c4;
+               i2c5 = &i2c5;
+       };
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0 0x80000000 0 0xc0000000>;
+       };
+};
+
+&serial0 {
+       status = "okay";
+};
+
+&serial1 {
+       status = "okay";
+};
+
+&i2c0 {
+       status = "okay";
+};
index fca4c479b469956fc9934c5104a8b48c9ac67443..494166aee24ce3c304045075c1a0938f6fdf43f2 100644 (file)
@@ -4,43 +4,7 @@
  * Copyright (C) 2015-2016 Socionext Inc.
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  */
 
 /dts-v1/;
index 6193f11acb78dba818f17e954db47a4e23593888..de1e7536281718f59617bc3b7be83c7e9ea53ace 100644 (file)
@@ -4,46 +4,10 @@
  * Copyright (C) 2015-2016 Socionext Inc.
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  */
 
-/memreserve/ 0x80000000 0x00080000;
+/memreserve/ 0x80000000 0x02000000;
 
 / {
        compatible = "socionext,uniphier-ld20";
                compatible = "operating-points-v2";
                opp-shared;
 
-               opp@250000000 {
+               opp-250000000 {
                        opp-hz = /bits/ 64 <250000000>;
                        clock-latency-ns = <300>;
                };
-               opp@275000000 {
+               opp-275000000 {
                        opp-hz = /bits/ 64 <275000000>;
                        clock-latency-ns = <300>;
                };
-               opp@500000000 {
+               opp-500000000 {
                        opp-hz = /bits/ 64 <500000000>;
                        clock-latency-ns = <300>;
                };
-               opp@550000000 {
+               opp-550000000 {
                        opp-hz = /bits/ 64 <550000000>;
                        clock-latency-ns = <300>;
                };
-               opp@666667000 {
+               opp-666667000 {
                        opp-hz = /bits/ 64 <666667000>;
                        clock-latency-ns = <300>;
                };
-               opp@733334000 {
+               opp-733334000 {
                        opp-hz = /bits/ 64 <733334000>;
                        clock-latency-ns = <300>;
                };
-               opp@1000000000 {
+               opp-1000000000 {
                        opp-hz = /bits/ 64 <1000000000>;
                        clock-latency-ns = <300>;
                };
-               opp@1100000000 {
+               opp-1100000000 {
                        opp-hz = /bits/ 64 <1100000000>;
                        clock-latency-ns = <300>;
                };
                compatible = "operating-points-v2";
                opp-shared;
 
-               opp@250000000 {
+               opp-250000000 {
                        opp-hz = /bits/ 64 <250000000>;
                        clock-latency-ns = <300>;
                };
-               opp@275000000 {
+               opp-275000000 {
                        opp-hz = /bits/ 64 <275000000>;
                        clock-latency-ns = <300>;
                };
-               opp@500000000 {
+               opp-500000000 {
                        opp-hz = /bits/ 64 <500000000>;
                        clock-latency-ns = <300>;
                };
-               opp@550000000 {
+               opp-550000000 {
                        opp-hz = /bits/ 64 <550000000>;
                        clock-latency-ns = <300>;
                };
-               opp@666667000 {
+               opp-666667000 {
                        opp-hz = /bits/ 64 <666667000>;
                        clock-latency-ns = <300>;
                };
-               opp@733334000 {
+               opp-733334000 {
                        opp-hz = /bits/ 64 <733334000>;
                        clock-latency-ns = <300>;
                };
-               opp@1000000000 {
+               opp-1000000000 {
                        opp-hz = /bits/ 64 <1000000000>;
                        clock-latency-ns = <300>;
                };
-               opp@1100000000 {
+               opp-1100000000 {
                        opp-hz = /bits/ 64 <1100000000>;
                        clock-latency-ns = <300>;
                };
                        pinctrl-0 = <&pinctrl_system_bus>;
                };
 
-               smpctrl@59800000 {
+               smpctrl@59801000 {
                        compatible = "socionext,uniphier-smpctrl";
                        reg = <0x59801000 0x400>;
                };
                        bus-width = <8>;
                        mmc-ddr-1_8v;
                        mmc-hs200-1_8v;
+                       cdns,phy-input-delay-legacy = <4>;
+                       cdns,phy-input-delay-mmc-highspeed = <2>;
+                       cdns,phy-input-delay-mmc-ddr = <3>;
+                       cdns,phy-dll-delay-sdclk = <21>;
+                       cdns,phy-dll-delay-sdclk-hsmmc = <21>;
                };
 
                soc-glue@5f800000 {
index 316dc713268c68f8dcd93afd8c0b8bde27e30ac5..d83bf789c8641b73f9c973e7aa0e1bdb41a62017 100644 (file)
                compatible = "operating-points-v2";
                opp-shared;
 
-               opp@500000000 {
+               opp-500000000 {
                        opp-hz = /bits/ 64 <500000000>;
                        clock-latency-ns = <500000>;
                };
 
-               opp@648000000 {
+               opp-648000000 {
                        opp-hz = /bits/ 64 <648000000>;
                        clock-latency-ns = <500000>;
                };
 
-               opp@800000000 {
+               opp-800000000 {
                        opp-hz = /bits/ 64 <800000000>;
                        clock-latency-ns = <500000>;
                };
 
-               opp@1000000000 {
+               opp-1000000000 {
                        opp-hz = /bits/ 64 <1000000000>;
                        clock-latency-ns = <500000>;
                };
 
-               opp@1188000000 {
+               opp-1188000000 {
                        opp-hz = /bits/ 64 <1188000000>;
                        clock-latency-ns = <500000>;
                };
index 3e7ce86d5c1330986289a72b0c38ea2686f6d6e6..4d877144f3773b3aa4dcefd9deeb12b13bcfe136 100644 (file)
@@ -46,6 +46,8 @@
 #define PPC_FEATURE2_HTM_NOSC          0x01000000
 #define PPC_FEATURE2_ARCH_3_00         0x00800000 /* ISA 3.00 */
 #define PPC_FEATURE2_HAS_IEEE128       0x00400000 /* VSX IEEE Binary Float 128-bit */
+#define PPC_FEATURE2_DARN              0x00200000 /* darn random number insn */
+#define PPC_FEATURE2_SCV               0x00100000 /* scv syscall */
 
 /*
  * IMPORTANT!
index 9b3e88b1a9c83b041d9bd84ce9d17fdc87aaeaf7..6f849832a66914f520d59c38a3c6c28f405de904 100644 (file)
@@ -124,7 +124,8 @@ extern void __restore_cpu_e6500(void);
 #define COMMON_USER_POWER9     COMMON_USER_POWER8
 #define COMMON_USER2_POWER9    (COMMON_USER2_POWER8 | \
                                 PPC_FEATURE2_ARCH_3_00 | \
-                                PPC_FEATURE2_HAS_IEEE128)
+                                PPC_FEATURE2_HAS_IEEE128 | \
+                                PPC_FEATURE2_DARN )
 
 #ifdef CONFIG_PPC_BOOK3E_64
 #define COMMON_USER_BOOKE      (COMMON_USER_PPC64 | PPC_FEATURE_BOOKE)
index 40c4887c27b613d73bc420b4aca34cee406325a8..f830562974417bfd0f338766b59a6ffd7a09a176 100644 (file)
@@ -161,7 +161,9 @@ static struct ibm_pa_feature {
        { .pabyte = 0,  .pabit = 3, .cpu_features  = CPU_FTR_CTRL },
        { .pabyte = 0,  .pabit = 6, .cpu_features  = CPU_FTR_NOEXECUTE },
        { .pabyte = 1,  .pabit = 2, .mmu_features  = MMU_FTR_CI_LARGE_PAGE },
+#ifdef CONFIG_PPC_RADIX_MMU
        { .pabyte = 40, .pabit = 0, .mmu_features  = MMU_FTR_TYPE_RADIX },
+#endif
        { .pabyte = 1,  .pabit = 1, .invert = 1, .cpu_features = CPU_FTR_NODSISRALIGN },
        { .pabyte = 5,  .pabit = 0, .cpu_features  = CPU_FTR_REAL_LE,
                                    .cpu_user_ftrs = PPC_FEATURE_TRUE_LE },
index 96c2b8a406303194737962905330c0a7a3900944..0c45cdbac4cfc80bcb79e287486d5a8a85fefdef 100644 (file)
@@ -197,7 +197,9 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
            (REGION_ID(ea) != USER_REGION_ID)) {
 
                spin_unlock(&spu->register_lock);
-               ret = hash_page(ea, _PAGE_PRESENT | _PAGE_READ, 0x300, dsisr);
+               ret = hash_page(ea,
+                               _PAGE_PRESENT | _PAGE_READ | _PAGE_PRIVILEGED,
+                               0x300, dsisr);
                spin_lock(&spu->register_lock);
 
                if (!ret) {
index 067defeea6911303e7fd59206e239fa7d6d770eb..78fa9395b8c55c3dab2c10e1a245f5a7a04be8a2 100644 (file)
@@ -714,7 +714,7 @@ static void pnv_npu2_release_context(struct kref *kref)
 void pnv_npu2_destroy_context(struct npu_context *npu_context,
                        struct pci_dev *gpdev)
 {
-       struct pnv_phb *nphb, *phb;
+       struct pnv_phb *nphb;
        struct npu *npu;
        struct pci_dev *npdev = pnv_pci_get_npu_dev(gpdev, 0);
        struct device_node *nvlink_dn;
@@ -728,13 +728,12 @@ void pnv_npu2_destroy_context(struct npu_context *npu_context,
 
        nphb = pci_bus_to_host(npdev->bus)->private_data;
        npu = &nphb->npu;
-       phb = pci_bus_to_host(gpdev->bus)->private_data;
        nvlink_dn = of_parse_phandle(npdev->dev.of_node, "ibm,nvlink", 0);
        if (WARN_ON(of_property_read_u32(nvlink_dn, "ibm,npu-link-index",
                                                        &nvlink_index)))
                return;
        npu_context->npdev[npu->index][nvlink_index] = NULL;
-       opal_npu_destroy_context(phb->opal_id, npu_context->mm->context.id,
+       opal_npu_destroy_context(nphb->opal_id, npu_context->mm->context.id,
                                PCI_DEVID(gpdev->bus->number, gpdev->devfn));
        kref_put(&npu_context->kref, pnv_npu2_release_context);
 }
index cd18994a9555ab7ec628da2bdc909dd445fef1a2..4ccfacc7232ab1ace21b8466ae73e4c7d18d3fba 100644 (file)
@@ -360,7 +360,7 @@ config SMP
          Management" code will be disabled if you say Y here.
 
          See also <file:Documentation/x86/i386/IO-APIC.txt>,
-         <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
+         <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO available at
          <http://www.tldp.org/docs.html#howto>.
 
          If you don't know what to do here, say N.
index 5851411e60fb9fd008f0035ac92932bd03eb519b..bf240b9204738598e78ece3f99e85d8f21385ea4 100644 (file)
@@ -159,7 +159,7 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER
        # If '-Os' is enabled, disable it and print a warning.
         ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
           undefine CONFIG_CC_OPTIMIZE_FOR_SIZE
-         $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE.  Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.)
+          $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE.  Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.)
         endif
 
     endif
index 44163e8c3868ec4dda58fed54f38411134224089..2c860ad4fe0686a9cf796cd9a5b4453b8199223f 100644 (file)
@@ -94,7 +94,7 @@ vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_thunk_$(BITS).o
 quiet_cmd_check_data_rel = DATAREL $@
 define cmd_check_data_rel
        for obj in $(filter %.o,$^); do \
-               readelf -S $$obj | grep -qF .rel.local && { \
+               ${CROSS_COMPILE}readelf -S $$obj | grep -qF .rel.local && { \
                        echo "error: $$obj has data relocations!" >&2; \
                        exit 1; \
                } || true; \
index 50bc26949e9edf75cc5978f8a08a4273bf489aec..48ef7bb32c4269331ceb2332b8e6bf5faffcb3de 100644 (file)
@@ -251,6 +251,23 @@ ENTRY(__switch_to_asm)
        jmp     __switch_to
 END(__switch_to_asm)
 
+/*
+ * The unwinder expects the last frame on the stack to always be at the same
+ * offset from the end of the page, which allows it to validate the stack.
+ * Calling schedule_tail() directly would break that convention because its an
+ * asmlinkage function so its argument has to be pushed on the stack.  This
+ * wrapper creates a proper "end of stack" frame header before the call.
+ */
+ENTRY(schedule_tail_wrapper)
+       FRAME_BEGIN
+
+       pushl   %eax
+       call    schedule_tail
+       popl    %eax
+
+       FRAME_END
+       ret
+ENDPROC(schedule_tail_wrapper)
 /*
  * A newly forked process directly context switches into this address.
  *
@@ -259,24 +276,15 @@ END(__switch_to_asm)
  * edi: kernel thread arg
  */
 ENTRY(ret_from_fork)
-       FRAME_BEGIN             /* help unwinder find end of stack */
-
-       /*
-        * schedule_tail() is asmlinkage so we have to put its 'prev' argument
-        * on the stack.
-        */
-       pushl   %eax
-       call    schedule_tail
-       popl    %eax
+       call    schedule_tail_wrapper
 
        testl   %ebx, %ebx
        jnz     1f              /* kernel threads are uncommon */
 
 2:
        /* When we fork, we trace the syscall return in the child, too. */
-       leal    FRAME_OFFSET(%esp), %eax
+       movl    %esp, %eax
        call    syscall_return_slowpath
-       FRAME_END
        jmp     restore_all
 
        /* kernel thread */
index 607d72c4a485cf25a3e582804cea0b7c031e1d32..4a4c0834f9659bd9b4855e23801d47103e644f09 100644 (file)
@@ -36,7 +36,6 @@
 #include <asm/smap.h>
 #include <asm/pgtable_types.h>
 #include <asm/export.h>
-#include <asm/frame.h>
 #include <linux/err.h>
 
 .code64
@@ -406,19 +405,17 @@ END(__switch_to_asm)
  * r12: kernel thread arg
  */
 ENTRY(ret_from_fork)
-       FRAME_BEGIN                     /* help unwinder find end of stack */
        movq    %rax, %rdi
-       call    schedule_tail           /* rdi: 'prev' task parameter */
+       call    schedule_tail                   /* rdi: 'prev' task parameter */
 
-       testq   %rbx, %rbx              /* from kernel_thread? */
-       jnz     1f                      /* kernel threads are uncommon */
+       testq   %rbx, %rbx                      /* from kernel_thread? */
+       jnz     1f                              /* kernel threads are uncommon */
 
 2:
-       leaq    FRAME_OFFSET(%rsp),%rdi /* pt_regs pointer */
+       movq    %rsp, %rdi
        call    syscall_return_slowpath /* returns with IRQs disabled */
        TRACE_IRQS_ON                   /* user mode is traced as IRQS on */
        SWAPGS
-       FRAME_END
        jmp     restore_regs_and_iret
 
 1:
index 4fd5195deed01836a092dccf680baf6b3e150713..3f9a3d2a52095af1f100e72bc3c24b4fc8d1b397 100644 (file)
@@ -266,6 +266,7 @@ static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *s
 #endif
 
 int mce_available(struct cpuinfo_x86 *c);
+bool mce_is_memory_error(struct mce *m);
 
 DECLARE_PER_CPU(unsigned, mce_exception_count);
 DECLARE_PER_CPU(unsigned, mce_poll_count);
index c5b8f760473c32f090c430693c5b2e8a61cc196f..32e14d13741670efa680c3c9e9facd1ffc0415a5 100644 (file)
@@ -409,8 +409,13 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
                memcpy(insnbuf, replacement, a->replacementlen);
                insnbuf_sz = a->replacementlen;
 
-               /* 0xe8 is a relative jump; fix the offset. */
-               if (*insnbuf == 0xe8 && a->replacementlen == 5) {
+               /*
+                * 0xe8 is a relative jump; fix the offset.
+                *
+                * Instruction length is checked before the opcode to avoid
+                * accessing uninitialized bytes for zero-length replacements.
+                */
+               if (a->replacementlen == 5 && *insnbuf == 0xe8) {
                        *(s32 *)(insnbuf + 1) += replacement - instr;
                        DPRINTK("Fix CALL offset: 0x%x, CALL 0x%lx",
                                *(s32 *)(insnbuf + 1),
index 5abd4bf73d6e6805d033c361e4671087bb7be076..5cfbaeb6529a04bcba6cb6ba7b09610d0f2fa88c 100644 (file)
@@ -499,16 +499,14 @@ static int mce_usable_address(struct mce *m)
        return 1;
 }
 
-static bool memory_error(struct mce *m)
+bool mce_is_memory_error(struct mce *m)
 {
-       struct cpuinfo_x86 *c = &boot_cpu_data;
-
-       if (c->x86_vendor == X86_VENDOR_AMD) {
+       if (m->cpuvendor == X86_VENDOR_AMD) {
                /* ErrCodeExt[20:16] */
                u8 xec = (m->status >> 16) & 0x1f;
 
                return (xec == 0x0 || xec == 0x8);
-       } else if (c->x86_vendor == X86_VENDOR_INTEL) {
+       } else if (m->cpuvendor == X86_VENDOR_INTEL) {
                /*
                 * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
                 *
@@ -529,6 +527,7 @@ static bool memory_error(struct mce *m)
 
        return false;
 }
+EXPORT_SYMBOL_GPL(mce_is_memory_error);
 
 static bool cec_add_mce(struct mce *m)
 {
@@ -536,7 +535,7 @@ static bool cec_add_mce(struct mce *m)
                return false;
 
        /* We eat only correctable DRAM errors with usable addresses. */
-       if (memory_error(m) &&
+       if (mce_is_memory_error(m) &&
            !(m->status & MCI_STATUS_UC) &&
            mce_usable_address(m))
                if (!cec_add_elem(m->addr >> PAGE_SHIFT))
@@ -713,7 +712,7 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
 
                severity = mce_severity(&m, mca_cfg.tolerant, NULL, false);
 
-               if (severity == MCE_DEFERRED_SEVERITY && memory_error(&m))
+               if (severity == MCE_DEFERRED_SEVERITY && mce_is_memory_error(&m))
                        if (m.status & MCI_STATUS_ADDRV)
                                m.severity = severity;
 
index 0651e974dcb3a88211db1711a5969434d3163e5a..9bef1bbeba63885e3ba584960b97e8c190b4c5a8 100644 (file)
@@ -689,8 +689,12 @@ static inline void *alloc_tramp(unsigned long size)
 {
        return module_alloc(size);
 }
-static inline void tramp_free(void *tramp)
+static inline void tramp_free(void *tramp, int size)
 {
+       int npages = PAGE_ALIGN(size) >> PAGE_SHIFT;
+
+       set_memory_nx((unsigned long)tramp, npages);
+       set_memory_rw((unsigned long)tramp, npages);
        module_memfree(tramp);
 }
 #else
@@ -699,7 +703,7 @@ static inline void *alloc_tramp(unsigned long size)
 {
        return NULL;
 }
-static inline void tramp_free(void *tramp) { }
+static inline void tramp_free(void *tramp, int size) { }
 #endif
 
 /* Defined as markers to the end of the ftrace default trampolines */
@@ -771,7 +775,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
        /* Copy ftrace_caller onto the trampoline memory */
        ret = probe_kernel_read(trampoline, (void *)start_offset, size);
        if (WARN_ON(ret < 0)) {
-               tramp_free(trampoline);
+               tramp_free(trampoline, *tramp_size);
                return 0;
        }
 
@@ -797,7 +801,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
 
        /* Are we pointing to the reference? */
        if (WARN_ON(memcmp(op_ptr.op, op_ref, 3) != 0)) {
-               tramp_free(trampoline);
+               tramp_free(trampoline, *tramp_size);
                return 0;
        }
 
@@ -839,7 +843,7 @@ void arch_ftrace_update_trampoline(struct ftrace_ops *ops)
        unsigned long offset;
        unsigned long ip;
        unsigned int size;
-       int ret;
+       int ret, npages;
 
        if (ops->trampoline) {
                /*
@@ -848,11 +852,14 @@ void arch_ftrace_update_trampoline(struct ftrace_ops *ops)
                 */
                if (!(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
                        return;
+               npages = PAGE_ALIGN(ops->trampoline_size) >> PAGE_SHIFT;
+               set_memory_rw(ops->trampoline, npages);
        } else {
                ops->trampoline = create_trampoline(ops, &size);
                if (!ops->trampoline)
                        return;
                ops->trampoline_size = size;
+               npages = PAGE_ALIGN(size) >> PAGE_SHIFT;
        }
 
        offset = calc_trampoline_call_offset(ops->flags & FTRACE_OPS_FL_SAVE_REGS);
@@ -863,6 +870,7 @@ void arch_ftrace_update_trampoline(struct ftrace_ops *ops)
        /* Do a safe modify in case the trampoline is executing */
        new = ftrace_call_replace(ip, (unsigned long)func);
        ret = update_ftrace_func(ip, new);
+       set_memory_ro(ops->trampoline, npages);
 
        /* The update should never fail */
        WARN_ON(ret);
@@ -939,7 +947,7 @@ void arch_ftrace_trampoline_free(struct ftrace_ops *ops)
        if (!ops || !(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP))
                return;
 
-       tramp_free((void *)ops->trampoline);
+       tramp_free((void *)ops->trampoline, ops->trampoline_size);
        ops->trampoline = 0;
 }
 
index 5b2bbfbb371284942b2ce95a3b2495eb9ecc8981..6b877807598b9028527a2357fef630431021c383 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/ftrace.h>
 #include <linux/frame.h>
 #include <linux/kasan.h>
+#include <linux/moduleloader.h>
 
 #include <asm/text-patching.h>
 #include <asm/cacheflush.h>
@@ -417,6 +418,14 @@ static void prepare_boost(struct kprobe *p, struct insn *insn)
        }
 }
 
+/* Recover page to RW mode before releasing it */
+void free_insn_page(void *page)
+{
+       set_memory_nx((unsigned long)page & PAGE_MASK, 1);
+       set_memory_rw((unsigned long)page & PAGE_MASK, 1);
+       module_memfree(page);
+}
+
 static int arch_copy_kprobe(struct kprobe *p)
 {
        struct insn insn;
index 0b4d3c686b1ef94463c8caabce01e38404d1b8c1..f818236950140fa0e3ccfc013e31857676db4f77 100644 (file)
@@ -980,8 +980,6 @@ void __init setup_arch(char **cmdline_p)
         */
        x86_configure_nx();
 
-       simple_udelay_calibration();
-
        parse_early_param();
 
 #ifdef CONFIG_MEMORY_HOTPLUG
@@ -1041,6 +1039,8 @@ void __init setup_arch(char **cmdline_p)
         */
        init_hypervisor_platform();
 
+       simple_udelay_calibration();
+
        x86_init.resources.probe_roms();
 
        /* after parse_early_param, so could debug it */
index 82c6d7f1fd73e64debd566d0846f3b9a62ab8959..b9389d72b2f784887e14acc89a6346a78c13c1b4 100644 (file)
@@ -104,6 +104,11 @@ static inline unsigned long *last_frame(struct unwind_state *state)
        return (unsigned long *)task_pt_regs(state->task) - 2;
 }
 
+static bool is_last_frame(struct unwind_state *state)
+{
+       return state->bp == last_frame(state);
+}
+
 #ifdef CONFIG_X86_32
 #define GCC_REALIGN_WORDS 3
 #else
@@ -115,16 +120,15 @@ static inline unsigned long *last_aligned_frame(struct unwind_state *state)
        return last_frame(state) - GCC_REALIGN_WORDS;
 }
 
-static bool is_last_task_frame(struct unwind_state *state)
+static bool is_last_aligned_frame(struct unwind_state *state)
 {
        unsigned long *last_bp = last_frame(state);
        unsigned long *aligned_bp = last_aligned_frame(state);
 
        /*
-        * We have to check for the last task frame at two different locations
-        * because gcc can occasionally decide to realign the stack pointer and
-        * change the offset of the stack frame in the prologue of a function
-        * called by head/entry code.  Examples:
+        * GCC can occasionally decide to realign the stack pointer and change
+        * the offset of the stack frame in the prologue of a function called
+        * by head/entry code.  Examples:
         *
         * <start_secondary>:
         *      push   %edi
@@ -141,11 +145,38 @@ static bool is_last_task_frame(struct unwind_state *state)
         *      push   %rbp
         *      mov    %rsp,%rbp
         *
-        * Note that after aligning the stack, it pushes a duplicate copy of
-        * the return address before pushing the frame pointer.
+        * After aligning the stack, it pushes a duplicate copy of the return
+        * address before pushing the frame pointer.
+        */
+       return (state->bp == aligned_bp && *(aligned_bp + 1) == *(last_bp + 1));
+}
+
+static bool is_last_ftrace_frame(struct unwind_state *state)
+{
+       unsigned long *last_bp = last_frame(state);
+       unsigned long *last_ftrace_bp = last_bp - 3;
+
+       /*
+        * When unwinding from an ftrace handler of a function called by entry
+        * code, the stack layout of the last frame is:
+        *
+        *   bp
+        *   parent ret addr
+        *   bp
+        *   function ret addr
+        *   parent ret addr
+        *   pt_regs
+        *   -----------------
         */
-       return (state->bp == last_bp ||
-               (state->bp == aligned_bp && *(aligned_bp+1) == *(last_bp+1)));
+       return (state->bp == last_ftrace_bp &&
+               *state->bp == *(state->bp + 2) &&
+               *(state->bp + 1) == *(state->bp + 4));
+}
+
+static bool is_last_task_frame(struct unwind_state *state)
+{
+       return is_last_frame(state) || is_last_aligned_frame(state) ||
+              is_last_ftrace_frame(state);
 }
 
 /*
index 1dcd2be4cce44aabd5659b531962f918da1b8dd3..c8520b2c62d252f774f7c6b9df83eefa6a5925c2 100644 (file)
@@ -186,7 +186,7 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
        unsigned int i, level;
        unsigned long addr;
 
-       BUG_ON(irqs_disabled());
+       BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
        WARN_ON(PAGE_ALIGN(start) != start);
 
        on_each_cpu(__cpa_flush_range, NULL, 1);
index 9b78685b66e663c80ec3a68986a39024fd372b3c..83a59a67757a77b46f7b7788074294a3a3c8a10c 100644 (file)
@@ -65,9 +65,11 @@ static int __init nopat(char *str)
 }
 early_param("nopat", nopat);
 
+static bool __read_mostly __pat_initialized = false;
+
 bool pat_enabled(void)
 {
-       return !!__pat_enabled;
+       return __pat_initialized;
 }
 EXPORT_SYMBOL_GPL(pat_enabled);
 
@@ -225,13 +227,14 @@ static void pat_bsp_init(u64 pat)
        }
 
        wrmsrl(MSR_IA32_CR_PAT, pat);
+       __pat_initialized = true;
 
        __init_cache_modes(pat);
 }
 
 static void pat_ap_init(u64 pat)
 {
-       if (!boot_cpu_has(X86_FEATURE_PAT)) {
+       if (!this_cpu_has(X86_FEATURE_PAT)) {
                /*
                 * If this happens we are on a secondary CPU, but switched to
                 * PAT on the boot CPU. We have no way to undo PAT.
@@ -306,7 +309,7 @@ void pat_init(void)
        u64 pat;
        struct cpuinfo_x86 *c = &boot_cpu_data;
 
-       if (!pat_enabled()) {
+       if (!__pat_enabled) {
                init_cache_modes();
                return;
        }
index a69ad122ed66c6b93385f1b3959a893b407b9d05..f2224ffd225da8acb9b4775a19125f015cc6ab0a 100644 (file)
@@ -628,25 +628,6 @@ void blk_mq_delay_kick_requeue_list(struct request_queue *q,
 }
 EXPORT_SYMBOL(blk_mq_delay_kick_requeue_list);
 
-void blk_mq_abort_requeue_list(struct request_queue *q)
-{
-       unsigned long flags;
-       LIST_HEAD(rq_list);
-
-       spin_lock_irqsave(&q->requeue_lock, flags);
-       list_splice_init(&q->requeue_list, &rq_list);
-       spin_unlock_irqrestore(&q->requeue_lock, flags);
-
-       while (!list_empty(&rq_list)) {
-               struct request *rq;
-
-               rq = list_first_entry(&rq_list, struct request, queuelist);
-               list_del_init(&rq->queuelist);
-               blk_mq_end_request(rq, -EIO);
-       }
-}
-EXPORT_SYMBOL(blk_mq_abort_requeue_list);
-
 struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
 {
        if (tag < tags->nr_tags) {
index 504fee9400523e206f987542d59abf8167e31c7e..712b018e9f5496de893440646e7942e2c752b3b8 100644 (file)
@@ -887,10 +887,10 @@ int blk_register_queue(struct gendisk *disk)
                goto unlock;
        }
 
-       if (q->mq_ops)
+       if (q->mq_ops) {
                __blk_mq_register_dev(dev, q);
-
-       blk_mq_debugfs_register(q);
+               blk_mq_debugfs_register(q);
+       }
 
        kobject_uevent(&q->kobj, KOBJ_ADD);
 
index b78db2e5fdff1e158ea52c179313ff3eba282015..fc13dd0c6e3956a84913d9e71132c0f321a67280 100644 (file)
@@ -22,11 +22,11 @@ static int throtl_quantum = 32;
 #define DFL_THROTL_SLICE_HD (HZ / 10)
 #define DFL_THROTL_SLICE_SSD (HZ / 50)
 #define MAX_THROTL_SLICE (HZ)
-#define DFL_IDLE_THRESHOLD_SSD (1000L) /* 1 ms */
-#define DFL_IDLE_THRESHOLD_HD (100L * 1000) /* 100 ms */
 #define MAX_IDLE_TIME (5L * 1000 * 1000) /* 5 s */
-/* default latency target is 0, eg, guarantee IO latency by default */
-#define DFL_LATENCY_TARGET (0)
+#define MIN_THROTL_BPS (320 * 1024)
+#define MIN_THROTL_IOPS (10)
+#define DFL_LATENCY_TARGET (-1L)
+#define DFL_IDLE_THRESHOLD (0)
 
 #define SKIP_LATENCY (((u64)1) << BLK_STAT_RES_SHIFT)
 
@@ -157,6 +157,7 @@ struct throtl_grp {
        unsigned long last_check_time;
 
        unsigned long latency_target; /* us */
+       unsigned long latency_target_conf; /* us */
        /* When did we start a new slice */
        unsigned long slice_start[2];
        unsigned long slice_end[2];
@@ -165,6 +166,7 @@ struct throtl_grp {
        unsigned long checked_last_finish_time; /* ns / 1024 */
        unsigned long avg_idletime; /* ns / 1024 */
        unsigned long idletime_threshold; /* us */
+       unsigned long idletime_threshold_conf; /* us */
 
        unsigned int bio_cnt; /* total bios */
        unsigned int bad_bio_cnt; /* bios exceeding latency threshold */
@@ -201,8 +203,6 @@ struct throtl_data
        unsigned int limit_index;
        bool limit_valid[LIMIT_CNT];
 
-       unsigned long dft_idletime_threshold; /* us */
-
        unsigned long low_upgrade_time;
        unsigned long low_downgrade_time;
 
@@ -294,8 +294,14 @@ static uint64_t tg_bps_limit(struct throtl_grp *tg, int rw)
 
        td = tg->td;
        ret = tg->bps[rw][td->limit_index];
-       if (ret == 0 && td->limit_index == LIMIT_LOW)
-               return tg->bps[rw][LIMIT_MAX];
+       if (ret == 0 && td->limit_index == LIMIT_LOW) {
+               /* intermediate node or iops isn't 0 */
+               if (!list_empty(&blkg->blkcg->css.children) ||
+                   tg->iops[rw][td->limit_index])
+                       return U64_MAX;
+               else
+                       return MIN_THROTL_BPS;
+       }
 
        if (td->limit_index == LIMIT_MAX && tg->bps[rw][LIMIT_LOW] &&
            tg->bps[rw][LIMIT_LOW] != tg->bps[rw][LIMIT_MAX]) {
@@ -315,10 +321,17 @@ static unsigned int tg_iops_limit(struct throtl_grp *tg, int rw)
 
        if (cgroup_subsys_on_dfl(io_cgrp_subsys) && !blkg->parent)
                return UINT_MAX;
+
        td = tg->td;
        ret = tg->iops[rw][td->limit_index];
-       if (ret == 0 && tg->td->limit_index == LIMIT_LOW)
-               return tg->iops[rw][LIMIT_MAX];
+       if (ret == 0 && tg->td->limit_index == LIMIT_LOW) {
+               /* intermediate node or bps isn't 0 */
+               if (!list_empty(&blkg->blkcg->css.children) ||
+                   tg->bps[rw][td->limit_index])
+                       return UINT_MAX;
+               else
+                       return MIN_THROTL_IOPS;
+       }
 
        if (td->limit_index == LIMIT_MAX && tg->iops[rw][LIMIT_LOW] &&
            tg->iops[rw][LIMIT_LOW] != tg->iops[rw][LIMIT_MAX]) {
@@ -482,6 +495,9 @@ static struct blkg_policy_data *throtl_pd_alloc(gfp_t gfp, int node)
        /* LIMIT_LOW will have default value 0 */
 
        tg->latency_target = DFL_LATENCY_TARGET;
+       tg->latency_target_conf = DFL_LATENCY_TARGET;
+       tg->idletime_threshold = DFL_IDLE_THRESHOLD;
+       tg->idletime_threshold_conf = DFL_IDLE_THRESHOLD;
 
        return &tg->pd;
 }
@@ -510,8 +526,6 @@ static void throtl_pd_init(struct blkg_policy_data *pd)
        if (cgroup_subsys_on_dfl(io_cgrp_subsys) && blkg->parent)
                sq->parent_sq = &blkg_to_tg(blkg->parent)->service_queue;
        tg->td = td;
-
-       tg->idletime_threshold = td->dft_idletime_threshold;
 }
 
 /*
@@ -1349,7 +1363,7 @@ static int tg_print_conf_uint(struct seq_file *sf, void *v)
        return 0;
 }
 
-static void tg_conf_updated(struct throtl_grp *tg)
+static void tg_conf_updated(struct throtl_grp *tg, bool global)
 {
        struct throtl_service_queue *sq = &tg->service_queue;
        struct cgroup_subsys_state *pos_css;
@@ -1367,8 +1381,26 @@ static void tg_conf_updated(struct throtl_grp *tg)
         * restrictions in the whole hierarchy and allows them to bypass
         * blk-throttle.
         */
-       blkg_for_each_descendant_pre(blkg, pos_css, tg_to_blkg(tg))
-               tg_update_has_rules(blkg_to_tg(blkg));
+       blkg_for_each_descendant_pre(blkg, pos_css,
+                       global ? tg->td->queue->root_blkg : tg_to_blkg(tg)) {
+               struct throtl_grp *this_tg = blkg_to_tg(blkg);
+               struct throtl_grp *parent_tg;
+
+               tg_update_has_rules(this_tg);
+               /* ignore root/second level */
+               if (!cgroup_subsys_on_dfl(io_cgrp_subsys) || !blkg->parent ||
+                   !blkg->parent->parent)
+                       continue;
+               parent_tg = blkg_to_tg(blkg->parent);
+               /*
+                * make sure all children has lower idle time threshold and
+                * higher latency target
+                */
+               this_tg->idletime_threshold = min(this_tg->idletime_threshold,
+                               parent_tg->idletime_threshold);
+               this_tg->latency_target = max(this_tg->latency_target,
+                               parent_tg->latency_target);
+       }
 
        /*
         * We're already holding queue_lock and know @tg is valid.  Let's
@@ -1413,7 +1445,7 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
        else
                *(unsigned int *)((void *)tg + of_cft(of)->private) = v;
 
-       tg_conf_updated(tg);
+       tg_conf_updated(tg, false);
        ret = 0;
 out_finish:
        blkg_conf_finish(&ctx);
@@ -1497,34 +1529,34 @@ static u64 tg_prfill_limit(struct seq_file *sf, struct blkg_policy_data *pd,
            tg->iops_conf[READ][off] == iops_dft &&
            tg->iops_conf[WRITE][off] == iops_dft &&
            (off != LIMIT_LOW ||
-            (tg->idletime_threshold == tg->td->dft_idletime_threshold &&
-             tg->latency_target == DFL_LATENCY_TARGET)))
+            (tg->idletime_threshold_conf == DFL_IDLE_THRESHOLD &&
+             tg->latency_target_conf == DFL_LATENCY_TARGET)))
                return 0;
 
-       if (tg->bps_conf[READ][off] != bps_dft)
+       if (tg->bps_conf[READ][off] != U64_MAX)
                snprintf(bufs[0], sizeof(bufs[0]), "%llu",
                        tg->bps_conf[READ][off]);
-       if (tg->bps_conf[WRITE][off] != bps_dft)
+       if (tg->bps_conf[WRITE][off] != U64_MAX)
                snprintf(bufs[1], sizeof(bufs[1]), "%llu",
                        tg->bps_conf[WRITE][off]);
-       if (tg->iops_conf[READ][off] != iops_dft)
+       if (tg->iops_conf[READ][off] != UINT_MAX)
                snprintf(bufs[2], sizeof(bufs[2]), "%u",
                        tg->iops_conf[READ][off]);
-       if (tg->iops_conf[WRITE][off] != iops_dft)
+       if (tg->iops_conf[WRITE][off] != UINT_MAX)
                snprintf(bufs[3], sizeof(bufs[3]), "%u",
                        tg->iops_conf[WRITE][off]);
        if (off == LIMIT_LOW) {
-               if (tg->idletime_threshold == ULONG_MAX)
+               if (tg->idletime_threshold_conf == ULONG_MAX)
                        strcpy(idle_time, " idle=max");
                else
                        snprintf(idle_time, sizeof(idle_time), " idle=%lu",
-                               tg->idletime_threshold);
+                               tg->idletime_threshold_conf);
 
-               if (tg->latency_target == ULONG_MAX)
+               if (tg->latency_target_conf == ULONG_MAX)
                        strcpy(latency_time, " latency=max");
                else
                        snprintf(latency_time, sizeof(latency_time),
-                               " latency=%lu", tg->latency_target);
+                               " latency=%lu", tg->latency_target_conf);
        }
 
        seq_printf(sf, "%s rbps=%s wbps=%s riops=%s wiops=%s%s%s\n",
@@ -1563,8 +1595,8 @@ static ssize_t tg_set_limit(struct kernfs_open_file *of,
        v[2] = tg->iops_conf[READ][index];
        v[3] = tg->iops_conf[WRITE][index];
 
-       idle_time = tg->idletime_threshold;
-       latency_time = tg->latency_target;
+       idle_time = tg->idletime_threshold_conf;
+       latency_time = tg->latency_target_conf;
        while (true) {
                char tok[27];   /* wiops=18446744073709551616 */
                char *p;
@@ -1623,17 +1655,33 @@ static ssize_t tg_set_limit(struct kernfs_open_file *of,
                tg->iops_conf[READ][LIMIT_MAX]);
        tg->iops[WRITE][LIMIT_LOW] = min(tg->iops_conf[WRITE][LIMIT_LOW],
                tg->iops_conf[WRITE][LIMIT_MAX]);
+       tg->idletime_threshold_conf = idle_time;
+       tg->latency_target_conf = latency_time;
+
+       /* force user to configure all settings for low limit  */
+       if (!(tg->bps[READ][LIMIT_LOW] || tg->iops[READ][LIMIT_LOW] ||
+             tg->bps[WRITE][LIMIT_LOW] || tg->iops[WRITE][LIMIT_LOW]) ||
+           tg->idletime_threshold_conf == DFL_IDLE_THRESHOLD ||
+           tg->latency_target_conf == DFL_LATENCY_TARGET) {
+               tg->bps[READ][LIMIT_LOW] = 0;
+               tg->bps[WRITE][LIMIT_LOW] = 0;
+               tg->iops[READ][LIMIT_LOW] = 0;
+               tg->iops[WRITE][LIMIT_LOW] = 0;
+               tg->idletime_threshold = DFL_IDLE_THRESHOLD;
+               tg->latency_target = DFL_LATENCY_TARGET;
+       } else if (index == LIMIT_LOW) {
+               tg->idletime_threshold = tg->idletime_threshold_conf;
+               tg->latency_target = tg->latency_target_conf;
+       }
 
-       if (index == LIMIT_LOW) {
-               blk_throtl_update_limit_valid(tg->td);
-               if (tg->td->limit_valid[LIMIT_LOW])
+       blk_throtl_update_limit_valid(tg->td);
+       if (tg->td->limit_valid[LIMIT_LOW]) {
+               if (index == LIMIT_LOW)
                        tg->td->limit_index = LIMIT_LOW;
-               tg->idletime_threshold = (idle_time == ULONG_MAX) ?
-                       ULONG_MAX : idle_time;
-               tg->latency_target = (latency_time == ULONG_MAX) ?
-                       ULONG_MAX : latency_time;
-       }
-       tg_conf_updated(tg);
+       } else
+               tg->td->limit_index = LIMIT_MAX;
+       tg_conf_updated(tg, index == LIMIT_LOW &&
+               tg->td->limit_valid[LIMIT_LOW]);
        ret = 0;
 out_finish:
        blkg_conf_finish(&ctx);
@@ -1722,17 +1770,25 @@ static bool throtl_tg_is_idle(struct throtl_grp *tg)
        /*
         * cgroup is idle if:
         * - single idle is too long, longer than a fixed value (in case user
-        *   configure a too big threshold) or 4 times of slice
+        *   configure a too big threshold) or 4 times of idletime threshold
         * - average think time is more than threshold
         * - IO latency is largely below threshold
         */
-       unsigned long time = jiffies_to_usecs(4 * tg->td->throtl_slice);
-
-       time = min_t(unsigned long, MAX_IDLE_TIME, time);
-       return (ktime_get_ns() >> 10) - tg->last_finish_time > time ||
-              tg->avg_idletime > tg->idletime_threshold ||
-              (tg->latency_target && tg->bio_cnt &&
+       unsigned long time;
+       bool ret;
+
+       time = min_t(unsigned long, MAX_IDLE_TIME, 4 * tg->idletime_threshold);
+       ret = tg->latency_target == DFL_LATENCY_TARGET ||
+             tg->idletime_threshold == DFL_IDLE_THRESHOLD ||
+             (ktime_get_ns() >> 10) - tg->last_finish_time > time ||
+             tg->avg_idletime > tg->idletime_threshold ||
+             (tg->latency_target && tg->bio_cnt &&
                tg->bad_bio_cnt * 5 < tg->bio_cnt);
+       throtl_log(&tg->service_queue,
+               "avg_idle=%ld, idle_threshold=%ld, bad_bio=%d, total_bio=%d, is_idle=%d, scale=%d",
+               tg->avg_idletime, tg->idletime_threshold, tg->bad_bio_cnt,
+               tg->bio_cnt, ret, tg->td->scale);
+       return ret;
 }
 
 static bool throtl_tg_can_upgrade(struct throtl_grp *tg)
@@ -1828,6 +1884,7 @@ static void throtl_upgrade_state(struct throtl_data *td)
        struct cgroup_subsys_state *pos_css;
        struct blkcg_gq *blkg;
 
+       throtl_log(&td->service_queue, "upgrade to max");
        td->limit_index = LIMIT_MAX;
        td->low_upgrade_time = jiffies;
        td->scale = 0;
@@ -1850,6 +1907,7 @@ static void throtl_downgrade_state(struct throtl_data *td, int new)
 {
        td->scale /= 2;
 
+       throtl_log(&td->service_queue, "downgrade, scale %d", td->scale);
        if (td->scale) {
                td->low_upgrade_time = jiffies - td->scale * td->throtl_slice;
                return;
@@ -2023,6 +2081,11 @@ static void throtl_update_latency_buckets(struct throtl_data *td)
                td->avg_buckets[i].valid = true;
                last_latency = td->avg_buckets[i].latency;
        }
+
+       for (i = 0; i < LATENCY_BUCKET_SIZE; i++)
+               throtl_log(&td->service_queue,
+                       "Latency bucket %d: latency=%ld, valid=%d", i,
+                       td->avg_buckets[i].latency, td->avg_buckets[i].valid);
 }
 #else
 static inline void throtl_update_latency_buckets(struct throtl_data *td)
@@ -2354,19 +2417,14 @@ void blk_throtl_exit(struct request_queue *q)
 void blk_throtl_register_queue(struct request_queue *q)
 {
        struct throtl_data *td;
-       struct cgroup_subsys_state *pos_css;
-       struct blkcg_gq *blkg;
 
        td = q->td;
        BUG_ON(!td);
 
-       if (blk_queue_nonrot(q)) {
+       if (blk_queue_nonrot(q))
                td->throtl_slice = DFL_THROTL_SLICE_SSD;
-               td->dft_idletime_threshold = DFL_IDLE_THRESHOLD_SSD;
-       } else {
+       else
                td->throtl_slice = DFL_THROTL_SLICE_HD;
-               td->dft_idletime_threshold = DFL_IDLE_THRESHOLD_HD;
-       }
 #ifndef CONFIG_BLK_DEV_THROTTLING_LOW
        /* if no low limit, use previous default */
        td->throtl_slice = DFL_THROTL_SLICE_HD;
@@ -2375,18 +2433,6 @@ void blk_throtl_register_queue(struct request_queue *q)
        td->track_bio_latency = !q->mq_ops && !q->request_fn;
        if (!td->track_bio_latency)
                blk_stat_enable_accounting(q);
-
-       /*
-        * some tg are created before queue is fully initialized, eg, nonrot
-        * isn't initialized yet
-        */
-       rcu_read_lock();
-       blkg_for_each_descendant_post(blkg, pos_css, q->root_blkg) {
-               struct throtl_grp *tg = blkg_to_tg(blkg);
-
-               tg->idletime_threshold = td->dft_idletime_threshold;
-       }
-       rcu_read_unlock();
 }
 
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
index ff07b9143ca456f8b2e8aaa3f41f9d6d8b5fe7a3..c5ec8246e25e1ed3eb6aef683c99e4aacd32ce2c 100644 (file)
@@ -320,8 +320,10 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
 
        if (info) {
                struct partition_meta_info *pinfo = alloc_part_info(disk);
-               if (!pinfo)
+               if (!pinfo) {
+                       err = -ENOMEM;
                        goto out_free_stats;
+               }
                memcpy(pinfo, info, sizeof(*info));
                p->info = pinfo;
        }
index 93e7c1b32eddd5aa27fc8c96f5f581f712541a53..5610cd537da78812e2633d76ca90e5c3fb66e7cc 100644 (file)
@@ -300,6 +300,8 @@ static void parse_bsd(struct parsed_partitions *state,
                        continue;
                bsd_start = le32_to_cpu(p->p_offset);
                bsd_size = le32_to_cpu(p->p_size);
+               if (memcmp(flavour, "bsd\0", 4) == 0)
+                       bsd_start += offset;
                if (offset == bsd_start && size == bsd_size)
                        /* full parent partition, we have it already */
                        continue;
index 014af741fc6a3d78c769baa725774be7d9815851..4faa0fd53b0c120d39022ad726dbbe2c74f787bd 100644 (file)
@@ -764,6 +764,44 @@ static int crypto_init_skcipher_ops_ablkcipher(struct crypto_tfm *tfm)
        return 0;
 }
 
+static int skcipher_setkey_unaligned(struct crypto_skcipher *tfm,
+                                    const u8 *key, unsigned int keylen)
+{
+       unsigned long alignmask = crypto_skcipher_alignmask(tfm);
+       struct skcipher_alg *cipher = crypto_skcipher_alg(tfm);
+       u8 *buffer, *alignbuffer;
+       unsigned long absize;
+       int ret;
+
+       absize = keylen + alignmask;
+       buffer = kmalloc(absize, GFP_ATOMIC);
+       if (!buffer)
+               return -ENOMEM;
+
+       alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
+       memcpy(alignbuffer, key, keylen);
+       ret = cipher->setkey(tfm, alignbuffer, keylen);
+       kzfree(buffer);
+       return ret;
+}
+
+static int skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
+                          unsigned int keylen)
+{
+       struct skcipher_alg *cipher = crypto_skcipher_alg(tfm);
+       unsigned long alignmask = crypto_skcipher_alignmask(tfm);
+
+       if (keylen < cipher->min_keysize || keylen > cipher->max_keysize) {
+               crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
+               return -EINVAL;
+       }
+
+       if ((unsigned long)key & alignmask)
+               return skcipher_setkey_unaligned(tfm, key, keylen);
+
+       return cipher->setkey(tfm, key, keylen);
+}
+
 static void crypto_skcipher_exit_tfm(struct crypto_tfm *tfm)
 {
        struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);
@@ -784,7 +822,7 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)
            tfm->__crt_alg->cra_type == &crypto_givcipher_type)
                return crypto_init_skcipher_ops_ablkcipher(tfm);
 
-       skcipher->setkey = alg->setkey;
+       skcipher->setkey = skcipher_setkey;
        skcipher->encrypt = alg->encrypt;
        skcipher->decrypt = alg->decrypt;
        skcipher->ivsize = alg->ivsize;
index b7c2a06963d6fb79cb5f5aaa2576936d17d5088f..25aba9b107dd51db522225b5171e7017a5a3ec9d 100644 (file)
@@ -57,6 +57,7 @@
 
 #define ACPI_BUTTON_LID_INIT_IGNORE    0x00
 #define ACPI_BUTTON_LID_INIT_OPEN      0x01
+#define ACPI_BUTTON_LID_INIT_METHOD    0x02
 
 #define _COMPONENT             ACPI_BUTTON_COMPONENT
 ACPI_MODULE_NAME("button");
@@ -376,6 +377,9 @@ static void acpi_lid_initialize_state(struct acpi_device *device)
        case ACPI_BUTTON_LID_INIT_OPEN:
                (void)acpi_lid_notify_state(device, 1);
                break;
+       case ACPI_BUTTON_LID_INIT_METHOD:
+               (void)acpi_lid_update_state(device);
+               break;
        case ACPI_BUTTON_LID_INIT_IGNORE:
        default:
                break;
@@ -560,6 +564,9 @@ static int param_set_lid_init_state(const char *val, struct kernel_param *kp)
        if (!strncmp(val, "open", sizeof("open") - 1)) {
                lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
                pr_info("Notify initial lid state as open\n");
+       } else if (!strncmp(val, "method", sizeof("method") - 1)) {
+               lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
+               pr_info("Notify initial lid state with _LID return value\n");
        } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {
                lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;
                pr_info("Do not notify initial lid state\n");
@@ -573,6 +580,8 @@ static int param_get_lid_init_state(char *buffer, struct kernel_param *kp)
        switch (lid_init_state) {
        case ACPI_BUTTON_LID_INIT_OPEN:
                return sprintf(buffer, "open");
+       case ACPI_BUTTON_LID_INIT_METHOD:
+               return sprintf(buffer, "method");
        case ACPI_BUTTON_LID_INIT_IGNORE:
                return sprintf(buffer, "ignore");
        default:
index 3ba1c3472cf9e293ae70fd7cdc649eeb96abf1a0..fd86bec98dea37f0fdc7afbfdcf94d79227e8a44 100644 (file)
@@ -26,7 +26,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
        struct nfit_spa *nfit_spa;
 
        /* We only care about memory errors */
-       if (!(mce->status & MCACOD))
+       if (!mce_is_memory_error(mce))
                return NOTIFY_DONE;
 
        /*
index f62082fdd6703e11c7576dc5db673dbc7dbba056..9c36b27996fc2b56a141bb388acf4947a45b104b 100644 (file)
@@ -512,13 +512,12 @@ static bool wakeup_source_not_registered(struct wakeup_source *ws)
 /**
  * wakup_source_activate - Mark given wakeup source as active.
  * @ws: Wakeup source to handle.
- * @hard: If set, abort suspends in progress and wake up from suspend-to-idle.
  *
  * Update the @ws' statistics and, if @ws has just been activated, notify the PM
  * core of the event by incrementing the counter of of wakeup events being
  * processed.
  */
-static void wakeup_source_activate(struct wakeup_source *ws, bool hard)
+static void wakeup_source_activate(struct wakeup_source *ws)
 {
        unsigned int cec;
 
@@ -526,9 +525,6 @@ static void wakeup_source_activate(struct wakeup_source *ws, bool hard)
                        "unregistered wakeup source\n"))
                return;
 
-       if (hard)
-               pm_system_wakeup();
-
        ws->active = true;
        ws->active_count++;
        ws->last_time = ktime_get();
@@ -554,7 +550,10 @@ static void wakeup_source_report_event(struct wakeup_source *ws, bool hard)
                ws->wakeup_count++;
 
        if (!ws->active)
-               wakeup_source_activate(ws, hard);
+               wakeup_source_activate(ws);
+
+       if (hard)
+               pm_system_wakeup();
 }
 
 /**
index 74ed7e9a7f27cd333a6bdf48144c0de4e6e7469e..2011fec2d6ad9d5b4ad1b089c38a1be23baeb509 100644 (file)
@@ -71,6 +71,15 @@ config ARM_HIGHBANK_CPUFREQ
 
          If in doubt, say N.
 
+config ARM_DB8500_CPUFREQ
+       tristate "ST-Ericsson DB8500 cpufreq" if COMPILE_TEST && !ARCH_U8500
+       default ARCH_U8500
+       depends on HAS_IOMEM
+       depends on !CPU_THERMAL || THERMAL
+       help
+         This adds the CPUFreq driver for ST-Ericsson Ux500 (DB8500) SoC
+         series.
+
 config ARM_IMX6Q_CPUFREQ
        tristate "Freescale i.MX6 cpufreq support"
        depends on ARCH_MXC
index b7e78f063c4f1d373bc892f84f68d6b8000a3051..ab3a42cd29ef210bcf0cad2ee48c74cb954b14f2 100644 (file)
@@ -53,7 +53,7 @@ obj-$(CONFIG_ARM_DT_BL_CPUFREQ)               += arm_big_little_dt.o
 
 obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ)  += brcmstb-avs-cpufreq.o
 obj-$(CONFIG_ARCH_DAVINCI)             += davinci-cpufreq.o
-obj-$(CONFIG_UX500_SOC_DB8500)         += dbx500-cpufreq.o
+obj-$(CONFIG_ARM_DB8500_CPUFREQ)       += dbx500-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ)   += exynos5440-cpufreq.o
 obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ)     += highbank-cpufreq.o
 obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)                += imx6q-cpufreq.o
index ab3a951a17e6c182dfa1c68b579ee003b3c1c44a..ef1fafdad4008ae7fa1824396592e0e53cf61002 100644 (file)
@@ -53,6 +53,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
        if (sscanf(name, "dump-type%u-%u-%d-%lu-%c",
                   &record->type, &part, &cnt, &time, &data_type) == 5) {
                record->id = generic_id(time, part, cnt);
+               record->part = part;
                record->count = cnt;
                record->time.tv_sec = time;
                record->time.tv_nsec = 0;
@@ -64,6 +65,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
        } else if (sscanf(name, "dump-type%u-%u-%d-%lu",
                   &record->type, &part, &cnt, &time) == 4) {
                record->id = generic_id(time, part, cnt);
+               record->part = part;
                record->count = cnt;
                record->time.tv_sec = time;
                record->time.tv_nsec = 0;
@@ -77,6 +79,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry,
                 * multiple logs, remains.
                 */
                record->id = generic_id(time, part, 0);
+               record->part = part;
                record->count = 0;
                record->time.tv_sec = time;
                record->time.tv_nsec = 0;
@@ -241,9 +244,15 @@ static int efi_pstore_write(struct pstore_record *record)
        efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
        int i, ret = 0;
 
+       record->time.tv_sec = get_seconds();
+       record->time.tv_nsec = 0;
+
+       record->id = generic_id(record->time.tv_sec, record->part,
+                               record->count);
+
        snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lu-%c",
                 record->type, record->part, record->count,
-                get_seconds(), record->compressed ? 'C' : 'D');
+                record->time.tv_sec, record->compressed ? 'C' : 'D');
 
        for (i = 0; i < DUMP_NAME_LEN; i++)
                efi_name[i] = name[i];
@@ -255,7 +264,6 @@ static int efi_pstore_write(struct pstore_record *record)
        if (record->reason == KMSG_DUMP_OOPS)
                efivar_run_worker();
 
-       record->id = record->part;
        return ret;
 };
 
@@ -287,7 +295,7 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data)
                 * holding multiple logs, remains.
                 */
                snprintf(name_old, sizeof(name_old), "dump-type%u-%u-%lu",
-                       ed->record->type, (unsigned int)ed->record->id,
+                       ed->record->type, ed->record->part,
                        ed->record->time.tv_sec);
 
                for (i = 0; i < DUMP_NAME_LEN; i++)
@@ -320,10 +328,7 @@ static int efi_pstore_erase(struct pstore_record *record)
        char name[DUMP_NAME_LEN];
        efi_char16_t efi_name[DUMP_NAME_LEN];
        int found, i;
-       unsigned int part;
 
-       do_div(record->id, 1000);
-       part = do_div(record->id, 100);
        snprintf(name, sizeof(name), "dump-type%u-%u-%d-%lu",
                 record->type, record->part, record->count,
                 record->time.tv_sec);
index 236d9950221b62665e8728941faa5793fc757980..c0d8c6ff6380e8a69de8faf58d28963dde29c8de 100644 (file)
@@ -425,10 +425,15 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
 
 void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev)
 {
-       struct amdgpu_fbdev *afbdev = adev->mode_info.rfbdev;
+       struct amdgpu_fbdev *afbdev;
        struct drm_fb_helper *fb_helper;
        int ret;
 
+       if (!adev)
+               return;
+
+       afbdev = adev->mode_info.rfbdev;
+
        if (!afbdev)
                return;
 
index 07ff3b1514f129edc23875c1f42053f7ef1aaa72..8ecf82c5fe74dc4d34e55d4dbaec5931bca1a2e8 100644 (file)
@@ -634,7 +634,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job)
                mutex_unlock(&id_mgr->lock);
        }
 
-       if (gds_switch_needed) {
+       if (ring->funcs->emit_gds_switch && gds_switch_needed) {
                id->gds_base = job->gds_base;
                id->gds_size = job->gds_size;
                id->gws_base = job->gws_base;
@@ -672,6 +672,7 @@ void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vmhub,
        struct amdgpu_vm_id_manager *id_mgr = &adev->vm_manager.id_mgr[vmhub];
        struct amdgpu_vm_id *id = &id_mgr->ids[vmid];
 
+       atomic64_set(&id->owner, 0);
        id->gds_base = 0;
        id->gds_size = 0;
        id->gws_base = 0;
@@ -680,6 +681,26 @@ void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vmhub,
        id->oa_size = 0;
 }
 
+/**
+ * amdgpu_vm_reset_all_id - reset VMID to zero
+ *
+ * @adev: amdgpu device structure
+ *
+ * Reset VMID to force flush on next use
+ */
+void amdgpu_vm_reset_all_ids(struct amdgpu_device *adev)
+{
+       unsigned i, j;
+
+       for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
+               struct amdgpu_vm_id_manager *id_mgr =
+                       &adev->vm_manager.id_mgr[i];
+
+               for (j = 1; j < id_mgr->num_ids; ++j)
+                       amdgpu_vm_reset_id(adev, i, j);
+       }
+}
+
 /**
  * amdgpu_vm_bo_find - find the bo_va for a specific vm & bo
  *
@@ -2270,7 +2291,6 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev)
        for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
                adev->vm_manager.seqno[i] = 0;
 
-
        atomic_set(&adev->vm_manager.vm_pte_next_ring, 0);
        atomic64_set(&adev->vm_manager.client_counter, 0);
        spin_lock_init(&adev->vm_manager.prt_lock);
index d97e28b4bdc41cbb52e70647685b58db4886514a..e1d951ece4333672512f96ae914ee740f0a5922b 100644 (file)
@@ -204,6 +204,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
 int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job);
 void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vmhub,
                        unsigned vmid);
+void amdgpu_vm_reset_all_ids(struct amdgpu_device *adev);
 int amdgpu_vm_update_directories(struct amdgpu_device *adev,
                                 struct amdgpu_vm *vm);
 int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
index 6dc1410b380f376982551dbebe06f4dd84edf3b2..ec93714e4524eeaf80dbd5181da396e48024827b 100644 (file)
@@ -906,6 +906,12 @@ static bool ci_dpm_vblank_too_short(struct amdgpu_device *adev)
        u32 vblank_time = amdgpu_dpm_get_vblank_time(adev);
        u32 switch_limit = adev->mc.vram_type == AMDGPU_VRAM_TYPE_GDDR5 ? 450 : 300;
 
+       /* disable mclk switching if the refresh is >120Hz, even if the
+        * blanking period would allow it
+        */
+       if (amdgpu_dpm_get_vrefresh(adev) > 120)
+               return true;
+
        if (vblank_time < switch_limit)
                return true;
        else
index a572979f186cdaeba52701fb8183850e16581143..d860939152df234517e7806135015a23aa316df9 100644 (file)
@@ -950,10 +950,6 @@ static int gmc_v6_0_suspend(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       if (adev->vm_manager.enabled) {
-               gmc_v6_0_vm_fini(adev);
-               adev->vm_manager.enabled = false;
-       }
        gmc_v6_0_hw_fini(adev);
 
        return 0;
@@ -968,16 +964,9 @@ static int gmc_v6_0_resume(void *handle)
        if (r)
                return r;
 
-       if (!adev->vm_manager.enabled) {
-               r = gmc_v6_0_vm_init(adev);
-               if (r) {
-                       dev_err(adev->dev, "vm manager initialization failed (%d).\n", r);
-                       return r;
-               }
-               adev->vm_manager.enabled = true;
-       }
+       amdgpu_vm_reset_all_ids(adev);
 
-       return r;
+       return 0;
 }
 
 static bool gmc_v6_0_is_idle(void *handle)
index a9083a16a250920c64605bc447ca19c8b3014f3a..2750e5c2381301ceebddb8f614f7e5868de23d2c 100644 (file)
@@ -1117,10 +1117,6 @@ static int gmc_v7_0_suspend(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       if (adev->vm_manager.enabled) {
-               gmc_v7_0_vm_fini(adev);
-               adev->vm_manager.enabled = false;
-       }
        gmc_v7_0_hw_fini(adev);
 
        return 0;
@@ -1135,16 +1131,9 @@ static int gmc_v7_0_resume(void *handle)
        if (r)
                return r;
 
-       if (!adev->vm_manager.enabled) {
-               r = gmc_v7_0_vm_init(adev);
-               if (r) {
-                       dev_err(adev->dev, "vm manager initialization failed (%d).\n", r);
-                       return r;
-               }
-               adev->vm_manager.enabled = true;
-       }
+       amdgpu_vm_reset_all_ids(adev);
 
-       return r;
+       return 0;
 }
 
 static bool gmc_v7_0_is_idle(void *handle)
index 4ac99784160a3ed9fbb59c5bf53a8d1b0a6ec1b4..f56b4089ee9f3fe7581cd6c541d434867c613cbb 100644 (file)
@@ -1209,10 +1209,6 @@ static int gmc_v8_0_suspend(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       if (adev->vm_manager.enabled) {
-               gmc_v8_0_vm_fini(adev);
-               adev->vm_manager.enabled = false;
-       }
        gmc_v8_0_hw_fini(adev);
 
        return 0;
@@ -1227,16 +1223,9 @@ static int gmc_v8_0_resume(void *handle)
        if (r)
                return r;
 
-       if (!adev->vm_manager.enabled) {
-               r = gmc_v8_0_vm_init(adev);
-               if (r) {
-                       dev_err(adev->dev, "vm manager initialization failed (%d).\n", r);
-                       return r;
-               }
-               adev->vm_manager.enabled = true;
-       }
+       amdgpu_vm_reset_all_ids(adev);
 
-       return r;
+       return 0;
 }
 
 static bool gmc_v8_0_is_idle(void *handle)
index dc1e1c1d6b2430cb9957047a454cde87bf439561..f936332a069d2d1c9329a3d52a17f9e44776f659 100644 (file)
@@ -791,10 +791,6 @@ static int gmc_v9_0_suspend(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       if (adev->vm_manager.enabled) {
-               gmc_v9_0_vm_fini(adev);
-               adev->vm_manager.enabled = false;
-       }
        gmc_v9_0_hw_fini(adev);
 
        return 0;
@@ -809,17 +805,9 @@ static int gmc_v9_0_resume(void *handle)
        if (r)
                return r;
 
-       if (!adev->vm_manager.enabled) {
-               r = gmc_v9_0_vm_init(adev);
-               if (r) {
-                       dev_err(adev->dev,
-                               "vm manager initialization failed (%d).\n", r);
-                       return r;
-               }
-               adev->vm_manager.enabled = true;
-       }
+       amdgpu_vm_reset_all_ids(adev);
 
-       return r;
+       return 0;
 }
 
 static bool gmc_v9_0_is_idle(void *handle)
index a74a3db3056c9c4a991e2b4525eb09de8a234a0a..102eb6d029faeb27887215ada8aeccf93d4039b0 100644 (file)
@@ -2655,6 +2655,28 @@ static int smu7_get_power_state_size(struct pp_hwmgr *hwmgr)
        return sizeof(struct smu7_power_state);
 }
 
+static int smu7_vblank_too_short(struct pp_hwmgr *hwmgr,
+                                uint32_t vblank_time_us)
+{
+       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+       uint32_t switch_limit_us;
+
+       switch (hwmgr->chip_id) {
+       case CHIP_POLARIS10:
+       case CHIP_POLARIS11:
+       case CHIP_POLARIS12:
+               switch_limit_us = data->is_memory_gddr5 ? 190 : 150;
+               break;
+       default:
+               switch_limit_us = data->is_memory_gddr5 ? 450 : 150;
+               break;
+       }
+
+       if (vblank_time_us < switch_limit_us)
+               return true;
+       else
+               return false;
+}
 
 static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
                                struct pp_power_state *request_ps,
@@ -2669,6 +2691,7 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
        bool disable_mclk_switching;
        bool disable_mclk_switching_for_frame_lock;
        struct cgs_display_info info = {0};
+       struct cgs_mode_info mode_info = {0};
        const struct phm_clock_and_voltage_limits *max_limits;
        uint32_t i;
        struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
@@ -2677,6 +2700,7 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
        int32_t count;
        int32_t stable_pstate_sclk = 0, stable_pstate_mclk = 0;
 
+       info.mode_info = &mode_info;
        data->battery_state = (PP_StateUILabel_Battery ==
                        request_ps->classification.ui_label);
 
@@ -2703,8 +2727,6 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 
        cgs_get_active_displays_info(hwmgr->device, &info);
 
-       /*TO DO result = PHM_CheckVBlankTime(hwmgr, &vblankTooShort);*/
-
        minimum_clocks.engineClock = hwmgr->display_config.min_core_set_clock;
        minimum_clocks.memoryClock = hwmgr->display_config.min_mem_set_clock;
 
@@ -2769,8 +2791,10 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
                                    PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
 
 
-       disable_mclk_switching = (1 < info.display_count) ||
-                                   disable_mclk_switching_for_frame_lock;
+       disable_mclk_switching = ((1 < info.display_count) ||
+                                 disable_mclk_switching_for_frame_lock ||
+                                 smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
+                                 (mode_info.refresh_rate > 120));
 
        sclk = smu7_ps->performance_levels[0].engine_clock;
        mclk = smu7_ps->performance_levels[0].memory_clock;
index ad30f5d3a10d5ea2a0118203ff66110a11b0583a..2614af2f553f3007ae25cb70e1f8f322c23a62d6 100644 (file)
@@ -4186,7 +4186,7 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,
                enum pp_clock_type type, uint32_t mask)
 {
        struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
-       uint32_t i;
+       int i;
 
        if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
                return -EINVAL;
index fedd4d60d9cd5b2bab64ed8aae1391ea2f402fc5..5dc8c4350602a561fe4cfd77fce77e26770696fb 100644 (file)
@@ -948,8 +948,6 @@ retry:
        }
 
 out:
-       if (ret && crtc->funcs->page_flip_target)
-               drm_crtc_vblank_put(crtc);
        if (fb)
                drm_framebuffer_put(fb);
        if (crtc->primary->old_fb)
@@ -964,5 +962,8 @@ out:
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
 
+       if (ret && crtc->funcs->page_flip_target)
+               drm_crtc_vblank_put(crtc);
+
        return ret;
 }
index 0066fe7e622ef75de181cc54770daeb2006a2d24..be3eefec5152aa0cdf9dd891bf4d4fe423ff87d4 100644 (file)
@@ -759,20 +759,23 @@ void psb_intel_lvds_init(struct drm_device *dev,
                if (scan->type & DRM_MODE_TYPE_PREFERRED) {
                        mode_dev->panel_fixed_mode =
                            drm_mode_duplicate(dev, scan);
+                       DRM_DEBUG_KMS("Using mode from DDC\n");
                        goto out;       /* FIXME: check for quirks */
                }
        }
 
        /* Failed to get EDID, what about VBT? do we need this? */
-       if (mode_dev->vbt_mode)
+       if (dev_priv->lfp_lvds_vbt_mode) {
                mode_dev->panel_fixed_mode =
-                   drm_mode_duplicate(dev, mode_dev->vbt_mode);
+                       drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
 
-       if (!mode_dev->panel_fixed_mode)
-               if (dev_priv->lfp_lvds_vbt_mode)
-                       mode_dev->panel_fixed_mode =
-                               drm_mode_duplicate(dev,
-                                       dev_priv->lfp_lvds_vbt_mode);
+               if (mode_dev->panel_fixed_mode) {
+                       mode_dev->panel_fixed_mode->type |=
+                               DRM_MODE_TYPE_PREFERRED;
+                       DRM_DEBUG_KMS("Using mode from VBT\n");
+                       goto out;
+               }
+       }
 
        /*
         * If we didn't get EDID, try checking if the panel is already turned
@@ -789,6 +792,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
                if (mode_dev->panel_fixed_mode) {
                        mode_dev->panel_fixed_mode->type |=
                            DRM_MODE_TYPE_PREFERRED;
+                       DRM_DEBUG_KMS("Using pre-programmed mode\n");
                        goto out;       /* FIXME: check for quirks */
                }
        }
index 058340a002c29daef072f21bf90e1e8a572b3fa9..4a340efd8ba67ac23aadc6611ea3ce7e7d460e1a 100644 (file)
@@ -575,8 +575,6 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane,
        if (ret)
                return;
 
-       cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release);
-
        if (fb != old_state->fb) {
                obj = to_qxl_framebuffer(fb)->obj;
                user_bo = gem_to_qxl_bo(obj);
@@ -614,6 +612,7 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane,
                qxl_bo_kunmap(cursor_bo);
                qxl_bo_kunmap(user_bo);
 
+               cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release);
                cmd->u.set.visible = 1;
                cmd->u.set.shape = qxl_bo_physical_address(qdev,
                                                           cursor_bo, 0);
@@ -624,6 +623,7 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane,
                if (ret)
                        goto out_free_release;
 
+               cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release);
                cmd->type = QXL_CURSOR_MOVE;
        }
 
index 7ba450832e6b7a59db9499a0919a8bb5f4a3fd1a..ea36dc4dd5d22ec7b30678ea811dcf5009f454f7 100644 (file)
@@ -776,6 +776,12 @@ bool ci_dpm_vblank_too_short(struct radeon_device *rdev)
        u32 vblank_time = r600_dpm_get_vblank_time(rdev);
        u32 switch_limit = pi->mem_gddr5 ? 450 : 300;
 
+       /* disable mclk switching if the refresh is >120Hz, even if the
+        * blanking period would allow it
+        */
+       if (r600_dpm_get_vrefresh(rdev) > 120)
+               return true;
+
        if (vblank_time < switch_limit)
                return true;
        else
index ccebe0f8d2e1e3b4ec15d6170b788e2e8fc8b980..008c145b7f29f60a298419931f1922555de5e35a 100644 (file)
@@ -7401,7 +7401,7 @@ static inline void cik_irq_ack(struct radeon_device *rdev)
                WREG32(DC_HPD5_INT_CONTROL, tmp);
        }
        if (rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_INTERRUPT) {
-               tmp = RREG32(DC_HPD5_INT_CONTROL);
+               tmp = RREG32(DC_HPD6_INT_CONTROL);
                tmp |= DC_HPDx_INT_ACK;
                WREG32(DC_HPD6_INT_CONTROL, tmp);
        }
@@ -7431,7 +7431,7 @@ static inline void cik_irq_ack(struct radeon_device *rdev)
                WREG32(DC_HPD5_INT_CONTROL, tmp);
        }
        if (rdev->irq.stat_regs.cik.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) {
-               tmp = RREG32(DC_HPD5_INT_CONTROL);
+               tmp = RREG32(DC_HPD6_INT_CONTROL);
                tmp |= DC_HPDx_RX_INT_ACK;
                WREG32(DC_HPD6_INT_CONTROL, tmp);
        }
index f130ec41ee4bbcad63516335dfaf17e24e782b60..0bf103536404e5dde2d480bf692a496a6865e817 100644 (file)
@@ -4927,7 +4927,7 @@ static void evergreen_irq_ack(struct radeon_device *rdev)
                WREG32(DC_HPD5_INT_CONTROL, tmp);
        }
        if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT) {
-               tmp = RREG32(DC_HPD5_INT_CONTROL);
+               tmp = RREG32(DC_HPD6_INT_CONTROL);
                tmp |= DC_HPDx_INT_ACK;
                WREG32(DC_HPD6_INT_CONTROL, tmp);
        }
@@ -4958,7 +4958,7 @@ static void evergreen_irq_ack(struct radeon_device *rdev)
                WREG32(DC_HPD5_INT_CONTROL, tmp);
        }
        if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) {
-               tmp = RREG32(DC_HPD5_INT_CONTROL);
+               tmp = RREG32(DC_HPD6_INT_CONTROL);
                tmp |= DC_HPDx_RX_INT_ACK;
                WREG32(DC_HPD6_INT_CONTROL, tmp);
        }
index 0a085176e79b35b2887c19f7b33091804b58e645..e06e2d8feab397822361ba18a3e4b420cc2f0c4d 100644 (file)
@@ -3988,7 +3988,7 @@ static void r600_irq_ack(struct radeon_device *rdev)
                        WREG32(DC_HPD5_INT_CONTROL, tmp);
                }
                if (rdev->irq.stat_regs.r600.disp_int_cont2 & DC_HPD6_INTERRUPT) {
-                       tmp = RREG32(DC_HPD5_INT_CONTROL);
+                       tmp = RREG32(DC_HPD6_INT_CONTROL);
                        tmp |= DC_HPDx_INT_ACK;
                        WREG32(DC_HPD6_INT_CONTROL, tmp);
                }
index e3e7cb1d10a2941d1790d36a9f5250f70aeb78cd..4761f27f2ca2a073a8ffb30806a9cac905003f23 100644 (file)
@@ -116,7 +116,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
        if ((radeon_runtime_pm != 0) &&
            radeon_has_atpx() &&
            ((flags & RADEON_IS_IGP) == 0) &&
-           !pci_is_thunderbolt_attached(rdev->pdev))
+           !pci_is_thunderbolt_attached(dev->pdev))
                flags |= RADEON_IS_PX;
 
        /* radeon_device_init should report only fatal error
index ceee87f029d9a3479d374c4fc305338377dee961..76d1888528e675c700b543fa6e10c77a466054d7 100644 (file)
@@ -6317,7 +6317,7 @@ static inline void si_irq_ack(struct radeon_device *rdev)
                WREG32(DC_HPD5_INT_CONTROL, tmp);
        }
        if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_INTERRUPT) {
-               tmp = RREG32(DC_HPD5_INT_CONTROL);
+               tmp = RREG32(DC_HPD6_INT_CONTROL);
                tmp |= DC_HPDx_INT_ACK;
                WREG32(DC_HPD6_INT_CONTROL, tmp);
        }
@@ -6348,7 +6348,7 @@ static inline void si_irq_ack(struct radeon_device *rdev)
                WREG32(DC_HPD5_INT_CONTROL, tmp);
        }
        if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & DC_HPD6_RX_INTERRUPT) {
-               tmp = RREG32(DC_HPD5_INT_CONTROL);
+               tmp = RREG32(DC_HPD6_INT_CONTROL);
                tmp |= DC_HPDx_RX_INT_ACK;
                WREG32(DC_HPD6_INT_CONTROL, tmp);
        }
index 6283b99d2b17f8ec3e22e4d4b0c08dad78d15d2b..d1263b82d646a1524697b38e2f63b31bd14f153d 100644 (file)
@@ -94,9 +94,9 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
 static int dw_i2c_acpi_configure(struct platform_device *pdev)
 {
        struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
+       u32 ss_ht = 0, fp_ht = 0, hs_ht = 0, fs_ht = 0;
        acpi_handle handle = ACPI_HANDLE(&pdev->dev);
        const struct acpi_device_id *id;
-       u32 ss_ht, fp_ht, hs_ht, fs_ht;
        struct acpi_device *adev;
        const char *uid;
 
index 0ed77eeff31e661fe5a4c6b8426c7d2cd6a10f89..a2e3dd715380c74397a5cf2c1a778786eb12826b 100644 (file)
@@ -178,22 +178,39 @@ static int usb_read(struct i2c_adapter *adapter, int cmd,
                    int value, int index, void *data, int len)
 {
        struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data;
+       void *dmadata = kmalloc(len, GFP_KERNEL);
+       int ret;
+
+       if (!dmadata)
+               return -ENOMEM;
 
        /* do control transfer */
-       return usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0),
+       ret = usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0),
                               cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
-                              USB_DIR_IN, value, index, data, len, 2000);
+                              USB_DIR_IN, value, index, dmadata, len, 2000);
+
+       memcpy(data, dmadata, len);
+       kfree(dmadata);
+       return ret;
 }
 
 static int usb_write(struct i2c_adapter *adapter, int cmd,
                     int value, int index, void *data, int len)
 {
        struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data;
+       void *dmadata = kmemdup(data, len, GFP_KERNEL);
+       int ret;
+
+       if (!dmadata)
+               return -ENOMEM;
 
        /* do control transfer */
-       return usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0),
+       ret = usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0),
                               cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
-                              value, index, data, len, 2000);
+                              value, index, dmadata, len, 2000);
+
+       kfree(dmadata);
+       return ret;
 }
 
 static void i2c_tiny_usb_free(struct i2c_tiny_usb *dev)
index a679e56c44cd49ddea4361aebdb97d4fe7f1e12e..f431da07f861e50fa86574954f7e4b0c2c1e57c3 100644 (file)
@@ -554,32 +554,34 @@ static int elan_i2c_finish_fw_update(struct i2c_client *client,
                                     struct completion *completion)
 {
        struct device *dev = &client->dev;
-       long ret;
        int error;
        int len;
-       u8 buffer[ETP_I2C_INF_LENGTH];
+       u8 buffer[ETP_I2C_REPORT_LEN];
+
+       len = i2c_master_recv(client, buffer, ETP_I2C_REPORT_LEN);
+       if (len != ETP_I2C_REPORT_LEN) {
+               error = len < 0 ? len : -EIO;
+               dev_warn(dev, "failed to read I2C data after FW WDT reset: %d (%d)\n",
+                       error, len);
+       }
 
        reinit_completion(completion);
        enable_irq(client->irq);
 
        error = elan_i2c_write_cmd(client, ETP_I2C_STAND_CMD, ETP_I2C_RESET);
-       if (!error)
-               ret = wait_for_completion_interruptible_timeout(completion,
-                                                       msecs_to_jiffies(300));
-       disable_irq(client->irq);
-
        if (error) {
                dev_err(dev, "device reset failed: %d\n", error);
-               return error;
-       } else if (ret == 0) {
+       } else if (!wait_for_completion_timeout(completion,
+                                               msecs_to_jiffies(300))) {
                dev_err(dev, "timeout waiting for device reset\n");
-               return -ETIMEDOUT;
-       } else if (ret < 0) {
-               error = ret;
-               dev_err(dev, "error waiting for device reset: %d\n", error);
-               return error;
+               error = -ETIMEDOUT;
        }
 
+       disable_irq(client->irq);
+
+       if (error)
+               return error;
+
        len = i2c_master_recv(client, buffer, ETP_I2C_INF_LENGTH);
        if (len != ETP_I2C_INF_LENGTH) {
                error = len < 0 ? len : -EIO;
index 2302aef2b2d403d47f8384c0127ad91104788ef5..dd042a9b0aaacc208056376b27a5fd7bf5755f6c 100644 (file)
@@ -350,6 +350,7 @@ static bool mxt_object_readable(unsigned int type)
        case MXT_TOUCH_KEYARRAY_T15:
        case MXT_TOUCH_PROXIMITY_T23:
        case MXT_TOUCH_PROXKEY_T52:
+       case MXT_TOUCH_MULTITOUCHSCREEN_T100:
        case MXT_PROCI_GRIPFACE_T20:
        case MXT_PROCG_NOISE_T22:
        case MXT_PROCI_ONETOUCH_T24:
index 8cf8d8d5d4ef4f82b45cc5ecbb959c92be95b699..f872817e81e46ba6d962a5edc207302e9bd25f3f 100644 (file)
@@ -471,7 +471,7 @@ static EDT_ATTR(gain, S_IWUSR | S_IRUGO, WORK_REGISTER_GAIN,
 static EDT_ATTR(offset, S_IWUSR | S_IRUGO, WORK_REGISTER_OFFSET,
                M09_REGISTER_OFFSET, 0, 31);
 static EDT_ATTR(threshold, S_IWUSR | S_IRUGO, WORK_REGISTER_THRESHOLD,
-               M09_REGISTER_THRESHOLD, 20, 80);
+               M09_REGISTER_THRESHOLD, 0, 80);
 static EDT_ATTR(report_rate, S_IWUSR | S_IRUGO, WORK_REGISTER_REPORT_RATE,
                NO_REGISTER, 3, 14);
 
index 78a7ce816a4792c7b1ddc101cece8c265084e630..9a873118ea5fcf4ff7adae18e03b3a351936df16 100644 (file)
@@ -285,7 +285,7 @@ static int pca955x_probe(struct i2c_client *client,
                        "slave address 0x%02x\n",
                        client->name, chip->bits, client->addr);
 
-       if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
+       if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return -EIO;
 
        if (pdata) {
index 1304160de16828f402dad6ff1f970af70764c3b2..13ef162cf066a63363106e40a513f3317205d10d 100644 (file)
@@ -27,6 +27,7 @@ struct mmc_pwrseq_simple {
        struct mmc_pwrseq pwrseq;
        bool clk_enabled;
        u32 post_power_on_delay_ms;
+       u32 power_off_delay_us;
        struct clk *ext_clk;
        struct gpio_descs *reset_gpios;
 };
@@ -78,6 +79,10 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host)
 
        mmc_pwrseq_simple_set_gpios_value(pwrseq, 1);
 
+       if (pwrseq->power_off_delay_us)
+               usleep_range(pwrseq->power_off_delay_us,
+                       2 * pwrseq->power_off_delay_us);
+
        if (!IS_ERR(pwrseq->ext_clk) && pwrseq->clk_enabled) {
                clk_disable_unprepare(pwrseq->ext_clk);
                pwrseq->clk_enabled = false;
@@ -119,6 +124,8 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
 
        device_property_read_u32(dev, "post-power-on-delay-ms",
                                 &pwrseq->post_power_on_delay_ms);
+       device_property_read_u32(dev, "power-off-delay-us",
+                                &pwrseq->power_off_delay_us);
 
        pwrseq->pwrseq.dev = dev;
        pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
index 772d0900026d0efbd6e59911f93ef9cc8930b38a..951d2cdd7888b0d68f9994298572759162277682 100644 (file)
@@ -108,7 +108,7 @@ static void octeon_mmc_release_bus(struct cvm_mmc_host *host)
 static void octeon_mmc_int_enable(struct cvm_mmc_host *host, u64 val)
 {
        writeq(val, host->base + MIO_EMM_INT(host));
-       if (!host->dma_active || (host->dma_active && !host->has_ciu3))
+       if (!host->has_ciu3)
                writeq(val, host->base + MIO_EMM_INT_EN(host));
 }
 
@@ -267,7 +267,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)
        }
 
        host->global_pwr_gpiod = devm_gpiod_get_optional(&pdev->dev,
-                                                        "power-gpios",
+                                                        "power",
                                                         GPIOD_OUT_HIGH);
        if (IS_ERR(host->global_pwr_gpiod)) {
                dev_err(&pdev->dev, "Invalid power GPIO\n");
@@ -288,11 +288,20 @@ static int octeon_mmc_probe(struct platform_device *pdev)
                if (ret) {
                        dev_err(&pdev->dev, "Error populating slots\n");
                        octeon_mmc_set_shared_power(host, 0);
-                       return ret;
+                       goto error;
                }
                i++;
        }
        return 0;
+
+error:
+       for (i = 0; i < CAVIUM_MAX_MMC; i++) {
+               if (host->slot[i])
+                       cvm_mmc_of_slot_remove(host->slot[i]);
+               if (host->slot_pdev[i])
+                       of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
+       }
+       return ret;
 }
 
 static int octeon_mmc_remove(struct platform_device *pdev)
index fe3d77267cd6b7803ae287d8b6fc5fc308f95a87..b9cc9599879978972b4c8c96f9dbddc26caebb2f 100644 (file)
@@ -146,6 +146,12 @@ static int thunder_mmc_probe(struct pci_dev *pdev,
        return 0;
 
 error:
+       for (i = 0; i < CAVIUM_MAX_MMC; i++) {
+               if (host->slot[i])
+                       cvm_mmc_of_slot_remove(host->slot[i]);
+               if (host->slot_pdev[i])
+                       of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL);
+       }
        clk_disable_unprepare(host->clk);
        return ret;
 }
index 58b51ba6aabd2de7773209d42aa758cb493c2500..b8aaf0fdb77cf52bf89cd3000a98b77536a6f5a4 100644 (file)
@@ -839,14 +839,14 @@ static void cvm_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                cvm_mmc_reset_bus(slot);
                if (host->global_pwr_gpiod)
                        host->set_shared_power(host, 0);
-               else
+               else if (!IS_ERR(mmc->supply.vmmc))
                        mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
                break;
 
        case MMC_POWER_UP:
                if (host->global_pwr_gpiod)
                        host->set_shared_power(host, 1);
-               else
+               else if (!IS_ERR(mmc->supply.vmmc))
                        mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
                break;
        }
@@ -968,20 +968,15 @@ static int cvm_mmc_of_parse(struct device *dev, struct cvm_mmc_slot *slot)
                return -EINVAL;
        }
 
-       mmc->supply.vmmc = devm_regulator_get_optional(dev, "vmmc");
-       if (IS_ERR(mmc->supply.vmmc)) {
-               if (PTR_ERR(mmc->supply.vmmc) == -EPROBE_DEFER)
-                       return -EPROBE_DEFER;
-               /*
-                * Legacy Octeon firmware has no regulator entry, fall-back to
-                * a hard-coded voltage to get a sane OCR.
-                */
+       ret = mmc_regulator_get_supply(mmc);
+       if (ret == -EPROBE_DEFER)
+               return ret;
+       /*
+        * Legacy Octeon firmware has no regulator entry, fall-back to
+        * a hard-coded voltage to get a sane OCR.
+        */
+       if (IS_ERR(mmc->supply.vmmc))
                mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-       } else {
-               ret = mmc_regulator_get_ocrmask(mmc->supply.vmmc);
-               if (ret > 0)
-                       mmc->ocr_avail = ret;
-       }
 
        /* Common MMC bindings */
        ret = mmc_of_parse(mmc);
index 3275d49958120857d899384237bc905ad5fd17a5..61666d2697713a7665191b848084846142644457 100644 (file)
@@ -187,7 +187,8 @@ static const struct sdhci_iproc_data iproc_cygnus_data = {
 };
 
 static const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = {
-       .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
+       .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
+                 SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
        .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN,
        .ops = &sdhci_iproc_ops,
 };
index 6356781f1cca78190bff46e5225606e0f2113cc7..f7e26b031e768d871ed465cde982005295066e82 100644 (file)
@@ -787,14 +787,6 @@ int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios)
        return ret;
 }
 
-void xenon_clean_phy(struct sdhci_host *host)
-{
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-       struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
-
-       kfree(priv->phy_params);
-}
-
 static int xenon_add_phy(struct device_node *np, struct sdhci_host *host,
                         const char *phy_name)
 {
@@ -819,11 +811,7 @@ static int xenon_add_phy(struct device_node *np, struct sdhci_host *host,
        if (ret)
                return ret;
 
-       ret = xenon_emmc_phy_parse_param_dt(host, np, priv->phy_params);
-       if (ret)
-               xenon_clean_phy(host);
-
-       return ret;
+       return xenon_emmc_phy_parse_param_dt(host, np, priv->phy_params);
 }
 
 int xenon_phy_parse_dt(struct device_node *np, struct sdhci_host *host)
index 67246655315b02b005b00153abfaa60c67fca7a5..bc1781bb070b7b8b83c0132abb114f6905ffddfb 100644 (file)
@@ -486,7 +486,7 @@ static int xenon_probe(struct platform_device *pdev)
 
        err = xenon_sdhc_prepare(host);
        if (err)
-               goto clean_phy_param;
+               goto err_clk;
 
        err = sdhci_add_host(host);
        if (err)
@@ -496,8 +496,6 @@ static int xenon_probe(struct platform_device *pdev)
 
 remove_sdhc:
        xenon_sdhc_unprepare(host);
-clean_phy_param:
-       xenon_clean_phy(host);
 err_clk:
        clk_disable_unprepare(pltfm_host->clk);
 free_pltfm:
@@ -510,8 +508,6 @@ static int xenon_remove(struct platform_device *pdev)
        struct sdhci_host *host = platform_get_drvdata(pdev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 
-       xenon_clean_phy(host);
-
        sdhci_remove_host(host, 0);
 
        xenon_sdhc_unprepare(host);
index 6e6523ea01ce50389f3b77f52b467efb11305831..73debb42dc2f9991356f59668d18ebd09296f927 100644 (file)
@@ -93,7 +93,6 @@ struct xenon_priv {
 };
 
 int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios);
-void xenon_clean_phy(struct sdhci_host *host);
 int xenon_phy_parse_dt(struct device_node *np,
                       struct sdhci_host *host);
 void xenon_soc_pad_ctrl(struct sdhci_host *host,
index c5fd4259da331b27503644938ab22787e2eea8ae..b44a6aeb346d0404144dde0304a502268de1da91 100644 (file)
@@ -2577,7 +2577,7 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond,
                return -1;
 
        ad_info->aggregator_id = aggregator->aggregator_identifier;
-       ad_info->ports = aggregator->num_of_ports;
+       ad_info->ports = __agg_active_ports(aggregator);
        ad_info->actor_key = aggregator->actor_oper_aggregator_key;
        ad_info->partner_key = aggregator->partner_oper_aggregator_key;
        ether_addr_copy(ad_info->partner_system,
index 2be78807fd6e1318487961708394caead76af268..2359478b977f0e008335e51dc8f63adc2dc35087 100644 (file)
@@ -2612,11 +2612,13 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
        bond_for_each_slave_rcu(bond, slave, iter) {
                unsigned long trans_start = dev_trans_start(slave->dev);
 
+               slave->new_link = BOND_LINK_NOCHANGE;
+
                if (slave->link != BOND_LINK_UP) {
                        if (bond_time_in_interval(bond, trans_start, 1) &&
                            bond_time_in_interval(bond, slave->last_rx, 1)) {
 
-                               slave->link  = BOND_LINK_UP;
+                               slave->new_link = BOND_LINK_UP;
                                slave_state_changed = 1;
 
                                /* primary_slave has no meaning in round-robin
@@ -2643,7 +2645,7 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
                        if (!bond_time_in_interval(bond, trans_start, 2) ||
                            !bond_time_in_interval(bond, slave->last_rx, 2)) {
 
-                               slave->link  = BOND_LINK_DOWN;
+                               slave->new_link = BOND_LINK_DOWN;
                                slave_state_changed = 1;
 
                                if (slave->link_failure_count < UINT_MAX)
@@ -2674,6 +2676,11 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
                if (!rtnl_trylock())
                        goto re_arm;
 
+               bond_for_each_slave(bond, slave, iter) {
+                       if (slave->new_link != BOND_LINK_NOCHANGE)
+                               slave->link = slave->new_link;
+               }
+
                if (slave_state_changed) {
                        bond_slave_state_change(bond);
                        if (BOND_MODE(bond) == BOND_MODE_XOR)
@@ -4271,10 +4278,10 @@ static int bond_check_params(struct bond_params *params)
        int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
        struct bond_opt_value newval;
        const struct bond_opt_value *valptr;
-       int arp_all_targets_value;
+       int arp_all_targets_value = 0;
        u16 ad_actor_sys_prio = 0;
        u16 ad_user_port_key = 0;
-       __be32 arp_target[BOND_MAX_ARP_TARGETS];
+       __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0 };
        int arp_ip_count;
        int bond_mode   = BOND_MODE_ROUNDROBIN;
        int xmit_hashtype = BOND_XMIT_POLICY_LAYER2;
@@ -4501,7 +4508,6 @@ static int bond_check_params(struct bond_params *params)
                arp_validate_value = 0;
        }
 
-       arp_all_targets_value = 0;
        if (arp_all_targets) {
                bond_opt_initstr(&newval, arp_all_targets);
                valptr = bond_opt_parse(bond_opt_get(BOND_OPT_ARP_ALL_TARGETS),
index b0a3b85fc6f8d346f3a7d421b094b491d022dd12..db02bc2fb4b2d634ed454cedfcf57692e9b941c0 100644 (file)
@@ -748,13 +748,13 @@ static int ax_init_dev(struct net_device *dev)
 
        ret = ax_mii_init(dev);
        if (ret)
-               goto out_irq;
+               goto err_out;
 
        ax_NS8390_init(dev, 0);
 
        ret = register_netdev(dev);
        if (ret)
-               goto out_irq;
+               goto err_out;
 
        netdev_info(dev, "%dbit, irq %d, %lx, MAC: %pM\n",
                    ei_local->word16 ? 16 : 8, dev->irq, dev->base_addr,
@@ -762,9 +762,6 @@ static int ax_init_dev(struct net_device *dev)
 
        return 0;
 
- out_irq:
-       /* cleanup irq */
-       free_irq(dev->irq, dev);
  err_out:
        return ret;
 }
index 63f2deec2a52994684fa7a58763f68502265542e..77a1c03255defa77f2c662650d41a1ffc68eb7bb 100644 (file)
@@ -1353,6 +1353,7 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) &&
                pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_ERR "atl2: No usable DMA configuration, aborting\n");
+               err = -EIO;
                goto err_dma;
        }
 
@@ -1366,10 +1367,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         * pcibios_set_master to do the needed arch specific settings */
        pci_set_master(pdev);
 
-       err = -ENOMEM;
        netdev = alloc_etherdev(sizeof(struct atl2_adapter));
-       if (!netdev)
+       if (!netdev) {
+               err = -ENOMEM;
                goto err_alloc_etherdev;
+       }
 
        SET_NETDEV_DEV(netdev, &pdev->dev);
 
@@ -1408,8 +1410,6 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (err)
                goto err_sw_init;
 
-       err = -EIO;
-
        netdev->hw_features = NETIF_F_HW_VLAN_CTAG_RX;
        netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);
 
index f3a09ab559004b80106e957674cb0d6acbf3ea65..4eee18ce9be46b5e1dc35167b51af634a2070e60 100644 (file)
@@ -5078,9 +5078,11 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
        struct be_adapter *adapter = netdev_priv(dev);
        u8 l4_hdr = 0;
 
-       /* The code below restricts offload features for some tunneled packets.
+       /* The code below restricts offload features for some tunneled and
+        * Q-in-Q packets.
         * Offload features for normal (non tunnel) packets are unchanged.
         */
+       features = vlan_features_check(skb, features);
        if (!skb->encapsulation ||
            !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS))
                return features;
index 56a563f90b0bf51d189dac8eb7da14791cc2b078..f7c8649fd28f695a1ff0519a85491bf85ec11f0b 100644 (file)
@@ -3192,7 +3192,7 @@ static int fec_reset_phy(struct platform_device *pdev)
 {
        int err, phy_reset;
        bool active_high = false;
-       int msec = 1;
+       int msec = 1, phy_post_delay = 0;
        struct device_node *np = pdev->dev.of_node;
 
        if (!np)
@@ -3209,6 +3209,11 @@ static int fec_reset_phy(struct platform_device *pdev)
        else if (!gpio_is_valid(phy_reset))
                return 0;
 
+       err = of_property_read_u32(np, "phy-reset-post-delay", &phy_post_delay);
+       /* valid reset duration should be less than 1s */
+       if (!err && phy_post_delay > 1000)
+               return -EINVAL;
+
        active_high = of_property_read_bool(np, "phy-reset-active-high");
 
        err = devm_gpio_request_one(&pdev->dev, phy_reset,
@@ -3226,6 +3231,15 @@ static int fec_reset_phy(struct platform_device *pdev)
 
        gpio_set_value_cansleep(phy_reset, !active_high);
 
+       if (!phy_post_delay)
+               return 0;
+
+       if (phy_post_delay > 20)
+               msleep(phy_post_delay);
+       else
+               usleep_range(phy_post_delay * 1000,
+                            phy_post_delay * 1000 + 1000);
+
        return 0;
 }
 #else /* CONFIG_OF */
index 5bdaf3d545b2fc656a318d5b562f940e14ecd9d9..10d282841f5be16c0957c72111c68baf6a452ca9 100644 (file)
@@ -774,7 +774,7 @@ static void cb_timeout_handler(struct work_struct *work)
        mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n",
                       mlx5_command_str(msg_to_opcode(ent->in)),
                       msg_to_opcode(ent->in));
-       mlx5_cmd_comp_handler(dev, 1UL << ent->idx);
+       mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
 }
 
 static void cmd_work_handler(struct work_struct *work)
@@ -804,6 +804,7 @@ static void cmd_work_handler(struct work_struct *work)
        }
 
        cmd->ent_arr[ent->idx] = ent;
+       set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
        lay = get_inst(cmd, ent->idx);
        ent->lay = lay;
        memset(lay, 0, sizeof(*lay));
@@ -825,6 +826,20 @@ static void cmd_work_handler(struct work_struct *work)
        if (ent->callback)
                schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);
 
+       /* Skip sending command to fw if internal error */
+       if (pci_channel_offline(dev->pdev) ||
+           dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
+               u8 status = 0;
+               u32 drv_synd;
+
+               ent->ret = mlx5_internal_err_ret_value(dev, msg_to_opcode(ent->in), &drv_synd, &status);
+               MLX5_SET(mbox_out, ent->out, status, status);
+               MLX5_SET(mbox_out, ent->out, syndrome, drv_synd);
+
+               mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
+               return;
+       }
+
        /* ring doorbell after the descriptor is valid */
        mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx);
        wmb();
@@ -835,7 +850,7 @@ static void cmd_work_handler(struct work_struct *work)
                poll_timeout(ent);
                /* make sure we read the descriptor after ownership is SW */
                rmb();
-               mlx5_cmd_comp_handler(dev, 1UL << ent->idx);
+               mlx5_cmd_comp_handler(dev, 1UL << ent->idx, (ent->ret == -ETIMEDOUT));
        }
 }
 
@@ -879,7 +894,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent)
                wait_for_completion(&ent->done);
        } else if (!wait_for_completion_timeout(&ent->done, timeout)) {
                ent->ret = -ETIMEDOUT;
-               mlx5_cmd_comp_handler(dev, 1UL << ent->idx);
+               mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
        }
 
        err = ent->ret;
@@ -1375,7 +1390,7 @@ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg)
        }
 }
 
-void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec)
+void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool forced)
 {
        struct mlx5_cmd *cmd = &dev->cmd;
        struct mlx5_cmd_work_ent *ent;
@@ -1395,6 +1410,19 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec)
                        struct semaphore *sem;
 
                        ent = cmd->ent_arr[i];
+
+                       /* if we already completed the command, ignore it */
+                       if (!test_and_clear_bit(MLX5_CMD_ENT_STATE_PENDING_COMP,
+                                               &ent->state)) {
+                               /* only real completion can free the cmd slot */
+                               if (!forced) {
+                                       mlx5_core_err(dev, "Command completion arrived after timeout (entry idx = %d).\n",
+                                                     ent->idx);
+                                       free_ent(cmd, ent->idx);
+                               }
+                               continue;
+                       }
+
                        if (ent->callback)
                                cancel_delayed_work(&ent->cb_timeout_work);
                        if (ent->page_queue)
@@ -1417,7 +1445,10 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec)
                                mlx5_core_dbg(dev, "command completed. ret 0x%x, delivery status %s(0x%x)\n",
                                              ent->ret, deliv_status_to_str(ent->status), ent->status);
                        }
-                       free_ent(cmd, ent->idx);
+
+                       /* only real completion will free the entry slot */
+                       if (!forced)
+                               free_ent(cmd, ent->idx);
 
                        if (ent->callback) {
                                ds = ent->ts2 - ent->ts1;
index 7b1566f0ae58c7c64e3313ed4f6f3fb83bafee5c..66b5fec1531349d14b5324f68a28746cecdf1918 100644 (file)
@@ -1041,6 +1041,8 @@ void mlx5e_free_xdpsq_descs(struct mlx5e_xdpsq *sq)
 #define MLX5_IB_GRH_BYTES       40
 #define MLX5_IPOIB_ENCAP_LEN    4
 #define MLX5_GID_SIZE           16
+#define MLX5_IPOIB_PSEUDO_LEN   20
+#define MLX5_IPOIB_HARD_LEN     (MLX5_IPOIB_PSEUDO_LEN + MLX5_IPOIB_ENCAP_LEN)
 
 static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
                                         struct mlx5_cqe64 *cqe,
@@ -1048,6 +1050,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
                                         struct sk_buff *skb)
 {
        struct net_device *netdev = rq->netdev;
+       char *pseudo_header;
        u8 *dgid;
        u8 g;
 
@@ -1076,8 +1079,11 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
        if (likely(netdev->features & NETIF_F_RXHASH))
                mlx5e_skb_set_hash(cqe, skb);
 
+       /* 20 bytes of ipoib header and 4 for encap existing */
+       pseudo_header = skb_push(skb, MLX5_IPOIB_PSEUDO_LEN);
+       memset(pseudo_header, 0, MLX5_IPOIB_PSEUDO_LEN);
        skb_reset_mac_header(skb);
-       skb_pull(skb, MLX5_IPOIB_ENCAP_LEN);
+       skb_pull(skb, MLX5_IPOIB_HARD_LEN);
 
        skb->dev = netdev;
 
index 11c27e4fadf6e09400a432c5498749df73265477..ec63158ab64330c939ffa4ca8c001f8134f8e4e2 100644 (file)
@@ -43,6 +43,7 @@
 #include <net/tc_act/tc_vlan.h>
 #include <net/tc_act/tc_tunnel_key.h>
 #include <net/tc_act/tc_pedit.h>
+#include <net/tc_act/tc_csum.h>
 #include <net/vxlan.h>
 #include <net/arp.h>
 #include "en.h"
@@ -384,7 +385,7 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
                if (e->flags & MLX5_ENCAP_ENTRY_VALID)
                        mlx5_encap_dealloc(priv->mdev, e->encap_id);
 
-               hlist_del_rcu(&e->encap_hlist);
+               hash_del_rcu(&e->encap_hlist);
                kfree(e->encap_header);
                kfree(e);
        }
@@ -925,11 +926,11 @@ static int offload_pedit_fields(struct pedit_headers *masks,
                                struct mlx5e_tc_flow_parse_attr *parse_attr)
 {
        struct pedit_headers *set_masks, *add_masks, *set_vals, *add_vals;
-       int i, action_size, nactions, max_actions, first, last;
+       int i, action_size, nactions, max_actions, first, last, first_z;
        void *s_masks_p, *a_masks_p, *vals_p;
-       u32 s_mask, a_mask, val;
        struct mlx5_fields *f;
        u8 cmd, field_bsize;
+       u32 s_mask, a_mask;
        unsigned long mask;
        void *action;
 
@@ -946,7 +947,8 @@ static int offload_pedit_fields(struct pedit_headers *masks,
        for (i = 0; i < ARRAY_SIZE(fields); i++) {
                f = &fields[i];
                /* avoid seeing bits set from previous iterations */
-               s_mask = a_mask = mask = val = 0;
+               s_mask = 0;
+               a_mask = 0;
 
                s_masks_p = (void *)set_masks + f->offset;
                a_masks_p = (void *)add_masks + f->offset;
@@ -981,12 +983,12 @@ static int offload_pedit_fields(struct pedit_headers *masks,
                        memset(a_masks_p, 0, f->size);
                }
 
-               memcpy(&val, vals_p, f->size);
-
                field_bsize = f->size * BITS_PER_BYTE;
+
+               first_z = find_first_zero_bit(&mask, field_bsize);
                first = find_first_bit(&mask, field_bsize);
                last  = find_last_bit(&mask, field_bsize);
-               if (first > 0 || last != (field_bsize - 1)) {
+               if (first > 0 || last != (field_bsize - 1) || first_z < last) {
                        printk(KERN_WARNING "mlx5: partial rewrite (mask %lx) is currently not offloaded\n",
                               mask);
                        return -EOPNOTSUPP;
@@ -1002,11 +1004,11 @@ static int offload_pedit_fields(struct pedit_headers *masks,
                }
 
                if (field_bsize == 32)
-                       MLX5_SET(set_action_in, action, data, ntohl(val));
+                       MLX5_SET(set_action_in, action, data, ntohl(*(__be32 *)vals_p));
                else if (field_bsize == 16)
-                       MLX5_SET(set_action_in, action, data, ntohs(val));
+                       MLX5_SET(set_action_in, action, data, ntohs(*(__be16 *)vals_p));
                else if (field_bsize == 8)
-                       MLX5_SET(set_action_in, action, data, val);
+                       MLX5_SET(set_action_in, action, data, *(u8 *)vals_p);
 
                action += action_size;
                nactions++;
@@ -1109,6 +1111,28 @@ out_err:
        return err;
 }
 
+static bool csum_offload_supported(struct mlx5e_priv *priv, u32 action, u32 update_flags)
+{
+       u32 prot_flags = TCA_CSUM_UPDATE_FLAG_IPV4HDR | TCA_CSUM_UPDATE_FLAG_TCP |
+                        TCA_CSUM_UPDATE_FLAG_UDP;
+
+       /*  The HW recalcs checksums only if re-writing headers */
+       if (!(action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)) {
+               netdev_warn(priv->netdev,
+                           "TC csum action is only offloaded with pedit\n");
+               return false;
+       }
+
+       if (update_flags & ~prot_flags) {
+               netdev_warn(priv->netdev,
+                           "can't offload TC csum action for some header/s - flags %#x\n",
+                           update_flags);
+               return false;
+       }
+
+       return true;
+}
+
 static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                                struct mlx5e_tc_flow_parse_attr *parse_attr,
                                struct mlx5e_tc_flow *flow)
@@ -1149,6 +1173,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                        continue;
                }
 
+               if (is_tcf_csum(a)) {
+                       if (csum_offload_supported(priv, attr->action,
+                                                  tcf_csum_update_flags(a)))
+                               continue;
+
+                       return -EOPNOTSUPP;
+               }
+
                if (is_tcf_skbedit_mark(a)) {
                        u32 mark = tcf_skbedit_mark(a);
 
@@ -1651,6 +1683,14 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
                        continue;
                }
 
+               if (is_tcf_csum(a)) {
+                       if (csum_offload_supported(priv, attr->action,
+                                                  tcf_csum_update_flags(a)))
+                               continue;
+
+                       return -EOPNOTSUPP;
+               }
+
                if (is_tcf_mirred_egress_redirect(a)) {
                        int ifindex = tcf_mirred_ifindex(a);
                        struct net_device *out_dev, *encap_dev = NULL;
index ea5d8d37a75c465cf022a4c29d89918802f97bbb..33eae5ad2fb09efe302e2b892c3c9e30d4b117f5 100644 (file)
@@ -422,7 +422,7 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
                        break;
 
                case MLX5_EVENT_TYPE_CMD:
-                       mlx5_cmd_comp_handler(dev, be32_to_cpu(eqe->data.cmd.vector));
+                       mlx5_cmd_comp_handler(dev, be32_to_cpu(eqe->data.cmd.vector), false);
                        break;
 
                case MLX5_EVENT_TYPE_PORT_CHANGE:
index d0515391d33bbc57961311f648ed5ef25f457c28..44f59b1d6f0f27f7bb4f818b11f341af28ba09dc 100644 (file)
@@ -90,7 +90,7 @@ static void trigger_cmd_completions(struct mlx5_core_dev *dev)
        spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags);
 
        mlx5_core_dbg(dev, "vector 0x%llx\n", vector);
-       mlx5_cmd_comp_handler(dev, vector);
+       mlx5_cmd_comp_handler(dev, vector, true);
        return;
 
 no_trig:
index 0c123d571b4cf52a0eb3b833208156766b5de6be..fe5546bb41537f0af0c4bcfe9054ccceaa42bbb2 100644 (file)
@@ -612,7 +612,6 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
        struct mlx5_priv *priv  = &mdev->priv;
        struct msix_entry *msix = priv->msix_arr;
        int irq                 = msix[i + MLX5_EQ_VEC_COMP_BASE].vector;
-       int err;
 
        if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) {
                mlx5_core_warn(mdev, "zalloc_cpumask_var failed");
@@ -622,18 +621,12 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
        cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
                        priv->irq_info[i].mask);
 
-       err = irq_set_affinity_hint(irq, priv->irq_info[i].mask);
-       if (err) {
-               mlx5_core_warn(mdev, "irq_set_affinity_hint failed,irq 0x%.4x",
-                              irq);
-               goto err_clear_mask;
-       }
+#ifdef CONFIG_SMP
+       if (irq_set_affinity_hint(irq, priv->irq_info[i].mask))
+               mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", irq);
+#endif
 
        return 0;
-
-err_clear_mask:
-       free_cpumask_var(priv->irq_info[i].mask);
-       return err;
 }
 
 static void mlx5_irq_clear_affinity_hint(struct mlx5_core_dev *mdev, int i)
index dec5d563ab19091cdadd422eed9af8268ce5805e..959fd12d2e670dfa52d7d9d11f835e990c82aa7c 100644 (file)
@@ -1293,7 +1293,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
        if (nla_put_u32(skb, IFLA_GENEVE_ID, vni))
                goto nla_put_failure;
 
-       if (ip_tunnel_info_af(info) == AF_INET) {
+       if (rtnl_dereference(geneve->sock4)) {
                if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE,
                                    info->key.u.ipv4.dst))
                        goto nla_put_failure;
@@ -1302,8 +1302,10 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
                               !!(info->key.tun_flags & TUNNEL_CSUM)))
                        goto nla_put_failure;
 
+       }
+
 #if IS_ENABLED(CONFIG_IPV6)
-       } else {
+       if (rtnl_dereference(geneve->sock6)) {
                if (nla_put_in6_addr(skb, IFLA_GENEVE_REMOTE6,
                                     &info->key.u.ipv6.dst))
                        goto nla_put_failure;
@@ -1315,8 +1317,8 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
                if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
                               !geneve->use_udp6_rx_checksums))
                        goto nla_put_failure;
-#endif
        }
+#endif
 
        if (nla_put_u8(skb, IFLA_GENEVE_TTL, info->key.ttl) ||
            nla_put_u8(skb, IFLA_GENEVE_TOS, info->key.tos) ||
index 4fea1b3dfbb4457247c4bc98dc9378591c36ecd3..7b652bb7ebe407b35c054009b521b173fd9fa361 100644 (file)
@@ -873,7 +873,7 @@ static struct gtp_dev *gtp_find_dev(struct net *src_net, struct nlattr *nla[])
 
        /* Check if there's an existing gtpX device to configure */
        dev = dev_get_by_index_rcu(net, nla_get_u32(nla[GTPA_LINK]));
-       if (dev->netdev_ops == &gtp_netdev_ops)
+       if (dev && dev->netdev_ops == &gtp_netdev_ops)
                gtp = netdev_priv(dev);
 
        put_net(net);
index 60ffc9da6a286272d84e8dc3f4326eb908e7961a..c360dd6ead2213b112282ff508b963354cf15d72 100644 (file)
@@ -108,7 +108,7 @@ config MDIO_MOXART
 config MDIO_OCTEON
        tristate "Octeon and some ThunderX SOCs MDIO buses"
        depends on 64BIT
-       depends on HAS_IOMEM
+       depends on HAS_IOMEM && OF_MDIO
        select MDIO_CAVIUM
        help
          This module provides a driver for the Octeon and ThunderX MDIO
index 272b051a019975110aa1d117da993cf18cb98816..9097e42bec2e42d8ee864edea4a6be5d8c0a92cc 100644 (file)
@@ -255,34 +255,6 @@ static int marvell_config_aneg(struct phy_device *phydev)
 {
        int err;
 
-       /* The Marvell PHY has an errata which requires
-        * that certain registers get written in order
-        * to restart autonegotiation */
-       err = phy_write(phydev, MII_BMCR, BMCR_RESET);
-
-       if (err < 0)
-               return err;
-
-       err = phy_write(phydev, 0x1d, 0x1f);
-       if (err < 0)
-               return err;
-
-       err = phy_write(phydev, 0x1e, 0x200c);
-       if (err < 0)
-               return err;
-
-       err = phy_write(phydev, 0x1d, 0x5);
-       if (err < 0)
-               return err;
-
-       err = phy_write(phydev, 0x1e, 0);
-       if (err < 0)
-               return err;
-
-       err = phy_write(phydev, 0x1e, 0x100);
-       if (err < 0)
-               return err;
-
        err = marvell_set_polarity(phydev, phydev->mdix_ctrl);
        if (err < 0)
                return err;
@@ -316,6 +288,42 @@ static int marvell_config_aneg(struct phy_device *phydev)
        return 0;
 }
 
+static int m88e1101_config_aneg(struct phy_device *phydev)
+{
+       int err;
+
+       /* This Marvell PHY has an errata which requires
+        * that certain registers get written in order
+        * to restart autonegotiation
+        */
+       err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+
+       if (err < 0)
+               return err;
+
+       err = phy_write(phydev, 0x1d, 0x1f);
+       if (err < 0)
+               return err;
+
+       err = phy_write(phydev, 0x1e, 0x200c);
+       if (err < 0)
+               return err;
+
+       err = phy_write(phydev, 0x1d, 0x5);
+       if (err < 0)
+               return err;
+
+       err = phy_write(phydev, 0x1e, 0);
+       if (err < 0)
+               return err;
+
+       err = phy_write(phydev, 0x1e, 0x100);
+       if (err < 0)
+               return err;
+
+       return marvell_config_aneg(phydev);
+}
+
 static int m88e1111_config_aneg(struct phy_device *phydev)
 {
        int err;
@@ -1892,7 +1900,7 @@ static struct phy_driver marvell_drivers[] = {
                .flags = PHY_HAS_INTERRUPT,
                .probe = marvell_probe,
                .config_init = &marvell_config_init,
-               .config_aneg = &marvell_config_aneg,
+               .config_aneg = &m88e1101_config_aneg,
                .read_status = &genphy_read_status,
                .ack_interrupt = &marvell_ack_interrupt,
                .config_intr = &marvell_config_intr,
index f3ae88fdf332e890ac8273e3df1ca7dd53092c07..8ab281b478f23bd98d71b896a0c00c4fdba7dacc 100644 (file)
@@ -310,6 +310,26 @@ skip:
                return -ENODEV;
        }
 
+       return 0;
+
+bad_desc:
+       dev_info(&dev->udev->dev, "bad CDC descriptors\n");
+       return -ENODEV;
+}
+EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);
+
+
+/* like usbnet_generic_cdc_bind() but handles filter initialization
+ * correctly
+ */
+int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
+{
+       int rv;
+
+       rv = usbnet_generic_cdc_bind(dev, intf);
+       if (rv < 0)
+               goto bail_out;
+
        /* Some devices don't initialise properly. In particular
         * the packet filter is not reset. There are devices that
         * don't do reset all the way. So the packet filter should
@@ -317,13 +337,10 @@ skip:
         */
        usbnet_cdc_update_filter(dev);
 
-       return 0;
-
-bad_desc:
-       dev_info(&dev->udev->dev, "bad CDC descriptors\n");
-       return -ENODEV;
+bail_out:
+       return rv;
 }
-EXPORT_SYMBOL_GPL(usbnet_generic_cdc_bind);
+EXPORT_SYMBOL_GPL(usbnet_ether_cdc_bind);
 
 void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
 {
@@ -417,7 +434,7 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
        BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data)
                        < sizeof(struct cdc_state)));
 
-       status = usbnet_generic_cdc_bind(dev, intf);
+       status = usbnet_ether_cdc_bind(dev, intf);
        if (status < 0)
                return status;
 
index 765400b62168436b278d8a09fa0dd1fd8566bcb7..2dfca96a63b60283b89efab676932a711024a499 100644 (file)
@@ -681,7 +681,7 @@ static int smsc95xx_set_features(struct net_device *netdev,
        if (ret < 0)
                return ret;
 
-       if (features & NETIF_F_HW_CSUM)
+       if (features & NETIF_F_IP_CSUM)
                read_buf |= Tx_COE_EN_;
        else
                read_buf &= ~Tx_COE_EN_;
@@ -1279,12 +1279,19 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
 
        spin_lock_init(&pdata->mac_cr_lock);
 
+       /* LAN95xx devices do not alter the computed checksum of 0 to 0xffff.
+        * RFC 2460, ipv6 UDP calculated checksum yields a result of zero must
+        * be changed to 0xffff. RFC 768, ipv4 UDP computed checksum is zero,
+        * it is transmitted as all ones. The zero transmitted checksum means
+        * transmitter generated no checksum. Hence, enable csum offload only
+        * for ipv4 packets.
+        */
        if (DEFAULT_TX_CSUM_ENABLE)
-               dev->net->features |= NETIF_F_HW_CSUM;
+               dev->net->features |= NETIF_F_IP_CSUM;
        if (DEFAULT_RX_CSUM_ENABLE)
                dev->net->features |= NETIF_F_RXCSUM;
 
-       dev->net->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
+       dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
 
        smsc95xx_init_mac_address(dev);
 
index 9320d96a1632bbebe8bd1d4a04059e0df631ac19..3e9246cc49c3784ebc045868a53318d35bf01075 100644 (file)
@@ -1989,6 +1989,7 @@ static const struct net_device_ops virtnet_netdev = {
        .ndo_poll_controller = virtnet_netpoll,
 #endif
        .ndo_xdp                = virtnet_xdp,
+       .ndo_features_check     = passthru_features_check,
 };
 
 static void virtnet_config_changed_work(struct work_struct *work)
index d5e0906262ead5dd9f202385d7ace81444c25a0f..a60926410438b98c2e414de081f7c8093bac5862 100644 (file)
@@ -925,6 +925,29 @@ static int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 }
 
 #ifdef CONFIG_BLK_DEV_INTEGRITY
+static void nvme_prep_integrity(struct gendisk *disk, struct nvme_id_ns *id,
+               u16 bs)
+{
+       struct nvme_ns *ns = disk->private_data;
+       u16 old_ms = ns->ms;
+       u8 pi_type = 0;
+
+       ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms);
+       ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
+
+       /* PI implementation requires metadata equal t10 pi tuple size */
+       if (ns->ms == sizeof(struct t10_pi_tuple))
+               pi_type = id->dps & NVME_NS_DPS_PI_MASK;
+
+       if (blk_get_integrity(disk) &&
+           (ns->pi_type != pi_type || ns->ms != old_ms ||
+            bs != queue_logical_block_size(disk->queue) ||
+            (ns->ms && ns->ext)))
+               blk_integrity_unregister(disk);
+
+       ns->pi_type = pi_type;
+}
+
 static void nvme_init_integrity(struct nvme_ns *ns)
 {
        struct blk_integrity integrity;
@@ -951,6 +974,10 @@ static void nvme_init_integrity(struct nvme_ns *ns)
        blk_queue_max_integrity_segments(ns->queue, 1);
 }
 #else
+static void nvme_prep_integrity(struct gendisk *disk, struct nvme_id_ns *id,
+               u16 bs)
+{
+}
 static void nvme_init_integrity(struct nvme_ns *ns)
 {
 }
@@ -997,37 +1024,22 @@ static int nvme_revalidate_ns(struct nvme_ns *ns, struct nvme_id_ns **id)
 static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
 {
        struct nvme_ns *ns = disk->private_data;
-       u8 lbaf, pi_type;
-       u16 old_ms;
-       unsigned short bs;
-
-       old_ms = ns->ms;
-       lbaf = id->flbas & NVME_NS_FLBAS_LBA_MASK;
-       ns->lba_shift = id->lbaf[lbaf].ds;
-       ns->ms = le16_to_cpu(id->lbaf[lbaf].ms);
-       ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
+       u16 bs;
 
        /*
         * If identify namespace failed, use default 512 byte block size so
         * block layer can use before failing read/write for 0 capacity.
         */
+       ns->lba_shift = id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ds;
        if (ns->lba_shift == 0)
                ns->lba_shift = 9;
        bs = 1 << ns->lba_shift;
-       /* XXX: PI implementation requires metadata equal t10 pi tuple size */
-       pi_type = ns->ms == sizeof(struct t10_pi_tuple) ?
-                                       id->dps & NVME_NS_DPS_PI_MASK : 0;
 
        blk_mq_freeze_queue(disk->queue);
-       if (blk_get_integrity(disk) && (ns->pi_type != pi_type ||
-                               ns->ms != old_ms ||
-                               bs != queue_logical_block_size(disk->queue) ||
-                               (ns->ms && ns->ext)))
-               blk_integrity_unregister(disk);
 
-       ns->pi_type = pi_type;
+       if (ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)
+               nvme_prep_integrity(disk, id, bs);
        blk_queue_logical_block_size(ns->queue, bs);
-
        if (ns->ms && !blk_get_integrity(disk) && !ns->ext)
                nvme_init_integrity(ns);
        if (ns->ms && !(ns->ms == 8 && ns->pi_type) && !blk_get_integrity(disk))
@@ -1605,7 +1617,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        }
        memcpy(ctrl->psd, id->psd, sizeof(ctrl->psd));
 
-       if (ctrl->ops->is_fabrics) {
+       if (ctrl->ops->flags & NVME_F_FABRICS) {
                ctrl->icdoff = le16_to_cpu(id->icdoff);
                ctrl->ioccsz = le32_to_cpu(id->ioccsz);
                ctrl->iorcsz = le32_to_cpu(id->iorcsz);
@@ -2098,7 +2110,6 @@ static void nvme_ns_remove(struct nvme_ns *ns)
                if (ns->ndev)
                        nvme_nvm_unregister_sysfs(ns);
                del_gendisk(ns->disk);
-               blk_mq_abort_requeue_list(ns->queue);
                blk_cleanup_queue(ns->queue);
        }
 
@@ -2436,8 +2447,16 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
                        continue;
                revalidate_disk(ns->disk);
                blk_set_queue_dying(ns->queue);
-               blk_mq_abort_requeue_list(ns->queue);
-               blk_mq_start_stopped_hw_queues(ns->queue, true);
+
+               /*
+                * Forcibly start all queues to avoid having stuck requests.
+                * Note that we must ensure the queues are not stopped
+                * when the final removal happens.
+                */
+               blk_mq_start_hw_queues(ns->queue);
+
+               /* draining requests in requeue list */
+               blk_mq_kick_requeue_list(ns->queue);
        }
        mutex_unlock(&ctrl->namespaces_mutex);
 }
index dca7165fabcf9ce5df19fee1007e8da8bd794e21..5b14cbefb7240d5e7d50bb1ade8fd958417282e8 100644 (file)
@@ -45,8 +45,6 @@ enum nvme_fc_queue_flags {
 
 #define NVMEFC_QUEUE_DELAY     3               /* ms units */
 
-#define NVME_FC_MAX_CONNECT_ATTEMPTS   1
-
 struct nvme_fc_queue {
        struct nvme_fc_ctrl     *ctrl;
        struct device           *dev;
@@ -165,8 +163,6 @@ struct nvme_fc_ctrl {
        struct work_struct      delete_work;
        struct work_struct      reset_work;
        struct delayed_work     connect_work;
-       int                     reconnect_delay;
-       int                     connect_attempts;
 
        struct kref             ref;
        u32                     flags;
@@ -1376,9 +1372,9 @@ done:
        complete_rq = __nvme_fc_fcpop_chk_teardowns(ctrl, op);
        if (!complete_rq) {
                if (unlikely(op->flags & FCOP_FLAGS_TERMIO)) {
-                       status = cpu_to_le16(NVME_SC_ABORT_REQ);
+                       status = cpu_to_le16(NVME_SC_ABORT_REQ << 1);
                        if (blk_queue_dying(rq->q))
-                               status |= cpu_to_le16(NVME_SC_DNR);
+                               status |= cpu_to_le16(NVME_SC_DNR << 1);
                }
                nvme_end_request(rq, status, result);
        } else
@@ -1751,7 +1747,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
        dev_warn(ctrl->ctrl.device,
                "NVME-FC{%d}: transport association error detected: %s\n",
                ctrl->cnum, errmsg);
-       dev_info(ctrl->ctrl.device,
+       dev_warn(ctrl->ctrl.device,
                "NVME-FC{%d}: resetting controller\n", ctrl->cnum);
 
        /* stop the queues on error, cleanup is in reset thread */
@@ -2195,9 +2191,6 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
        if (!opts->nr_io_queues)
                return 0;
 
-       dev_info(ctrl->ctrl.device, "creating %d I/O queues.\n",
-                       opts->nr_io_queues);
-
        nvme_fc_init_io_queues(ctrl);
 
        memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set));
@@ -2268,9 +2261,6 @@ nvme_fc_reinit_io_queues(struct nvme_fc_ctrl *ctrl)
        if (ctrl->queue_count == 1)
                return 0;
 
-       dev_info(ctrl->ctrl.device, "Recreating %d I/O queues.\n",
-                       opts->nr_io_queues);
-
        nvme_fc_init_io_queues(ctrl);
 
        ret = blk_mq_reinit_tagset(&ctrl->tag_set);
@@ -2306,7 +2296,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
        int ret;
        bool changed;
 
-       ctrl->connect_attempts++;
+       ++ctrl->ctrl.opts->nr_reconnects;
 
        /*
         * Create the admin queue
@@ -2403,9 +2393,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
        changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
        WARN_ON_ONCE(!changed);
 
-       ctrl->connect_attempts = 0;
-
-       kref_get(&ctrl->ctrl.kref);
+       ctrl->ctrl.opts->nr_reconnects = 0;
 
        if (ctrl->queue_count > 1) {
                nvme_start_queues(&ctrl->ctrl);
@@ -2536,26 +2524,32 @@ nvme_fc_delete_ctrl_work(struct work_struct *work)
 
        /*
         * tear down the controller
-        * This will result in the last reference on the nvme ctrl to
-        * expire, calling the transport nvme_fc_nvme_ctrl_freed() callback.
-        * From there, the transport will tear down it's logical queues and
-        * association.
+        * After the last reference on the nvme ctrl is removed,
+        * the transport nvme_fc_nvme_ctrl_freed() callback will be
+        * invoked. From there, the transport will tear down it's
+        * logical queues and association.
         */
        nvme_uninit_ctrl(&ctrl->ctrl);
 
        nvme_put_ctrl(&ctrl->ctrl);
 }
 
-static int
-__nvme_fc_del_ctrl(struct nvme_fc_ctrl *ctrl)
+static bool
+__nvme_fc_schedule_delete_work(struct nvme_fc_ctrl *ctrl)
 {
        if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING))
-               return -EBUSY;
+               return true;
 
        if (!queue_work(nvme_fc_wq, &ctrl->delete_work))
-               return -EBUSY;
+               return true;
 
-       return 0;
+       return false;
+}
+
+static int
+__nvme_fc_del_ctrl(struct nvme_fc_ctrl *ctrl)
+{
+       return __nvme_fc_schedule_delete_work(ctrl) ? -EBUSY : 0;
 }
 
 /*
@@ -2580,6 +2574,35 @@ nvme_fc_del_nvme_ctrl(struct nvme_ctrl *nctrl)
        return ret;
 }
 
+static void
+nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
+{
+       /* If we are resetting/deleting then do nothing */
+       if (ctrl->ctrl.state != NVME_CTRL_RECONNECTING) {
+               WARN_ON_ONCE(ctrl->ctrl.state == NVME_CTRL_NEW ||
+                       ctrl->ctrl.state == NVME_CTRL_LIVE);
+               return;
+       }
+
+       dev_info(ctrl->ctrl.device,
+               "NVME-FC{%d}: reset: Reconnect attempt failed (%d)\n",
+               ctrl->cnum, status);
+
+       if (nvmf_should_reconnect(&ctrl->ctrl)) {
+               dev_info(ctrl->ctrl.device,
+                       "NVME-FC{%d}: Reconnect attempt in %d seconds.\n",
+                       ctrl->cnum, ctrl->ctrl.opts->reconnect_delay);
+               queue_delayed_work(nvme_fc_wq, &ctrl->connect_work,
+                               ctrl->ctrl.opts->reconnect_delay * HZ);
+       } else {
+               dev_warn(ctrl->ctrl.device,
+                               "NVME-FC{%d}: Max reconnect attempts (%d) "
+                               "reached. Removing controller\n",
+                               ctrl->cnum, ctrl->ctrl.opts->nr_reconnects);
+               WARN_ON(__nvme_fc_schedule_delete_work(ctrl));
+       }
+}
+
 static void
 nvme_fc_reset_ctrl_work(struct work_struct *work)
 {
@@ -2591,34 +2614,9 @@ nvme_fc_reset_ctrl_work(struct work_struct *work)
        nvme_fc_delete_association(ctrl);
 
        ret = nvme_fc_create_association(ctrl);
-       if (ret) {
-               dev_warn(ctrl->ctrl.device,
-                       "NVME-FC{%d}: reset: Reconnect attempt failed (%d)\n",
-                       ctrl->cnum, ret);
-               if (ctrl->connect_attempts >= NVME_FC_MAX_CONNECT_ATTEMPTS) {
-                       dev_warn(ctrl->ctrl.device,
-                               "NVME-FC{%d}: Max reconnect attempts (%d) "
-                               "reached. Removing controller\n",
-                               ctrl->cnum, ctrl->connect_attempts);
-
-                       if (!nvme_change_ctrl_state(&ctrl->ctrl,
-                               NVME_CTRL_DELETING)) {
-                               dev_err(ctrl->ctrl.device,
-                                       "NVME-FC{%d}: failed to change state "
-                                       "to DELETING\n", ctrl->cnum);
-                               return;
-                       }
-
-                       WARN_ON(!queue_work(nvme_fc_wq, &ctrl->delete_work));
-                       return;
-               }
-
-               dev_warn(ctrl->ctrl.device,
-                       "NVME-FC{%d}: Reconnect attempt in %d seconds.\n",
-                       ctrl->cnum, ctrl->reconnect_delay);
-               queue_delayed_work(nvme_fc_wq, &ctrl->connect_work,
-                               ctrl->reconnect_delay * HZ);
-       } else
+       if (ret)
+               nvme_fc_reconnect_or_delete(ctrl, ret);
+       else
                dev_info(ctrl->ctrl.device,
                        "NVME-FC{%d}: controller reset complete\n", ctrl->cnum);
 }
@@ -2632,7 +2630,7 @@ nvme_fc_reset_nvme_ctrl(struct nvme_ctrl *nctrl)
 {
        struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
 
-       dev_warn(ctrl->ctrl.device,
+       dev_info(ctrl->ctrl.device,
                "NVME-FC{%d}: admin requested controller reset\n", ctrl->cnum);
 
        if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
@@ -2649,7 +2647,7 @@ nvme_fc_reset_nvme_ctrl(struct nvme_ctrl *nctrl)
 static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = {
        .name                   = "fc",
        .module                 = THIS_MODULE,
-       .is_fabrics             = true,
+       .flags                  = NVME_F_FABRICS,
        .reg_read32             = nvmf_reg_read32,
        .reg_read64             = nvmf_reg_read64,
        .reg_write32            = nvmf_reg_write32,
@@ -2671,34 +2669,9 @@ nvme_fc_connect_ctrl_work(struct work_struct *work)
                                struct nvme_fc_ctrl, connect_work);
 
        ret = nvme_fc_create_association(ctrl);
-       if (ret) {
-               dev_warn(ctrl->ctrl.device,
-                       "NVME-FC{%d}: Reconnect attempt failed (%d)\n",
-                       ctrl->cnum, ret);
-               if (ctrl->connect_attempts >= NVME_FC_MAX_CONNECT_ATTEMPTS) {
-                       dev_warn(ctrl->ctrl.device,
-                               "NVME-FC{%d}: Max reconnect attempts (%d) "
-                               "reached. Removing controller\n",
-                               ctrl->cnum, ctrl->connect_attempts);
-
-                       if (!nvme_change_ctrl_state(&ctrl->ctrl,
-                               NVME_CTRL_DELETING)) {
-                               dev_err(ctrl->ctrl.device,
-                                       "NVME-FC{%d}: failed to change state "
-                                       "to DELETING\n", ctrl->cnum);
-                               return;
-                       }
-
-                       WARN_ON(!queue_work(nvme_fc_wq, &ctrl->delete_work));
-                       return;
-               }
-
-               dev_warn(ctrl->ctrl.device,
-                       "NVME-FC{%d}: Reconnect attempt in %d seconds.\n",
-                       ctrl->cnum, ctrl->reconnect_delay);
-               queue_delayed_work(nvme_fc_wq, &ctrl->connect_work,
-                               ctrl->reconnect_delay * HZ);
-       } else
+       if (ret)
+               nvme_fc_reconnect_or_delete(ctrl, ret);
+       else
                dev_info(ctrl->ctrl.device,
                        "NVME-FC{%d}: controller reconnect complete\n",
                        ctrl->cnum);
@@ -2755,7 +2728,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
        INIT_WORK(&ctrl->delete_work, nvme_fc_delete_ctrl_work);
        INIT_WORK(&ctrl->reset_work, nvme_fc_reset_ctrl_work);
        INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work);
-       ctrl->reconnect_delay = opts->reconnect_delay;
        spin_lock_init(&ctrl->lock);
 
        /* io queue count */
@@ -2819,7 +2791,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
                ctrl->ctrl.opts = NULL;
                /* initiate nvme ctrl ref counting teardown */
                nvme_uninit_ctrl(&ctrl->ctrl);
-               nvme_put_ctrl(&ctrl->ctrl);
 
                /* as we're past the point where we transition to the ref
                 * counting teardown path, if we return a bad pointer here,
@@ -2835,6 +2806,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
                return ERR_PTR(ret);
        }
 
+       kref_get(&ctrl->ctrl.kref);
+
        dev_info(ctrl->ctrl.device,
                "NVME-FC{%d}: new ctrl: NQN \"%s\"\n",
                ctrl->cnum, ctrl->ctrl.opts->subsysnqn);
@@ -2971,7 +2944,7 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
 static struct nvmf_transport_ops nvme_fc_transport = {
        .name           = "fc",
        .required_opts  = NVMF_OPT_TRADDR | NVMF_OPT_HOST_TRADDR,
-       .allowed_opts   = NVMF_OPT_RECONNECT_DELAY,
+       .allowed_opts   = NVMF_OPT_RECONNECT_DELAY | NVMF_OPT_CTRL_LOSS_TMO,
        .create_ctrl    = nvme_fc_create_ctrl,
 };
 
index 29c708ca9621c4622ab3f32d153c02546e9d0ca6..9d6a070d43914dcc5388b2a7a03f477a00b8bd1f 100644 (file)
@@ -208,7 +208,9 @@ struct nvme_ns {
 struct nvme_ctrl_ops {
        const char *name;
        struct module *module;
-       bool is_fabrics;
+       unsigned int flags;
+#define NVME_F_FABRICS                 (1 << 0)
+#define NVME_F_METADATA_SUPPORTED      (1 << 1)
        int (*reg_read32)(struct nvme_ctrl *ctrl, u32 off, u32 *val);
        int (*reg_write32)(struct nvme_ctrl *ctrl, u32 off, u32 val);
        int (*reg_read64)(struct nvme_ctrl *ctrl, u32 off, u64 *val);
index 4c2ff2bb26bcd7c615e40ae777327a3ba401cf3d..d52701df72457d0fa2b85a168c500fd022b8b717 100644 (file)
@@ -263,7 +263,7 @@ static void nvme_dbbuf_set(struct nvme_dev *dev)
        c.dbbuf.prp2 = cpu_to_le64(dev->dbbuf_eis_dma_addr);
 
        if (nvme_submit_sync_cmd(dev->ctrl.admin_q, &c, NULL, 0)) {
-               dev_warn(dev->dev, "unable to set dbbuf\n");
+               dev_warn(dev->ctrl.device, "unable to set dbbuf\n");
                /* Free memory and continue on */
                nvme_dbbuf_dma_free(dev);
        }
@@ -1394,11 +1394,11 @@ static void nvme_warn_reset(struct nvme_dev *dev, u32 csts)
        result = pci_read_config_word(to_pci_dev(dev->dev), PCI_STATUS,
                                      &pci_status);
        if (result == PCIBIOS_SUCCESSFUL)
-               dev_warn(dev->dev,
+               dev_warn(dev->ctrl.device,
                         "controller is down; will reset: CSTS=0x%x, PCI_STATUS=0x%hx\n",
                         csts, pci_status);
        else
-               dev_warn(dev->dev,
+               dev_warn(dev->ctrl.device,
                         "controller is down; will reset: CSTS=0x%x, PCI_STATUS read failed (%d)\n",
                         csts, result);
 }
@@ -1740,8 +1740,8 @@ static int nvme_pci_enable(struct nvme_dev *dev)
         */
        if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001) {
                dev->q_depth = 2;
-               dev_warn(dev->dev, "detected Apple NVMe controller, set "
-                       "queue depth=%u to work around controller resets\n",
+               dev_warn(dev->ctrl.device, "detected Apple NVMe controller, "
+                       "set queue depth=%u to work around controller resets\n",
                        dev->q_depth);
        }
 
@@ -1759,7 +1759,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
                if (dev->cmbsz) {
                        if (sysfs_add_file_to_group(&dev->ctrl.device->kobj,
                                                    &dev_attr_cmb.attr, NULL))
-                               dev_warn(dev->dev,
+                               dev_warn(dev->ctrl.device,
                                         "failed to add sysfs attribute for CMB\n");
                }
        }
@@ -2047,6 +2047,7 @@ static int nvme_pci_reset_ctrl(struct nvme_ctrl *ctrl)
 static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
        .name                   = "pcie",
        .module                 = THIS_MODULE,
+       .flags                  = NVME_F_METADATA_SUPPORTED,
        .reg_read32             = nvme_pci_reg_read32,
        .reg_write32            = nvme_pci_reg_write32,
        .reg_read64             = nvme_pci_reg_read64,
@@ -2293,6 +2294,8 @@ static const struct pci_device_id nvme_id_table[] = {
        { PCI_VDEVICE(INTEL, 0x0a54),
                .driver_data = NVME_QUIRK_STRIPE_SIZE |
                                NVME_QUIRK_DEALLOCATE_ZEROES, },
+       { PCI_VDEVICE(INTEL, 0xf1a5),   /* Intel 600P/P3100 */
+               .driver_data = NVME_QUIRK_NO_DEEPEST_PS },
        { PCI_VDEVICE(INTEL, 0x5845),   /* Qemu emulated controller */
                .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
        { PCI_DEVICE(0x1c58, 0x0003),   /* HGST adapter */
index dd1c6deef82fcf509b5c04af20d9df1c17746d9b..28bd255c144dcca10aa60cede2c9a51cd101426a 100644 (file)
@@ -1038,6 +1038,19 @@ static void nvme_rdma_send_done(struct ib_cq *cq, struct ib_wc *wc)
                nvme_rdma_wr_error(cq, wc, "SEND");
 }
 
+static inline int nvme_rdma_queue_sig_limit(struct nvme_rdma_queue *queue)
+{
+       int sig_limit;
+
+       /*
+        * We signal completion every queue depth/2 and also handle the
+        * degenerated case of a  device with queue_depth=1, where we
+        * would need to signal every message.
+        */
+       sig_limit = max(queue->queue_size / 2, 1);
+       return (++queue->sig_count % sig_limit) == 0;
+}
+
 static int nvme_rdma_post_send(struct nvme_rdma_queue *queue,
                struct nvme_rdma_qe *qe, struct ib_sge *sge, u32 num_sge,
                struct ib_send_wr *first, bool flush)
@@ -1065,9 +1078,6 @@ static int nvme_rdma_post_send(struct nvme_rdma_queue *queue,
         * Would have been way to obvious to handle this in hardware or
         * at least the RDMA stack..
         *
-        * This messy and racy code sniplet is copy and pasted from the iSER
-        * initiator, and the magic '32' comes from there as well.
-        *
         * Always signal the flushes. The magic request used for the flush
         * sequencer is not allocated in our driver's tagset and it's
         * triggered to be freed by blk_cleanup_queue(). So we need to
@@ -1075,7 +1085,7 @@ static int nvme_rdma_post_send(struct nvme_rdma_queue *queue,
         * embedded in request's payload, is not freed when __ib_process_cq()
         * calls wr_cqe->done().
         */
-       if ((++queue->sig_count % 32) == 0 || flush)
+       if (nvme_rdma_queue_sig_limit(queue) || flush)
                wr.send_flags |= IB_SEND_SIGNALED;
 
        if (first)
@@ -1782,7 +1792,7 @@ static int nvme_rdma_reset_ctrl(struct nvme_ctrl *nctrl)
 static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = {
        .name                   = "rdma",
        .module                 = THIS_MODULE,
-       .is_fabrics             = true,
+       .flags                  = NVME_F_FABRICS,
        .reg_read32             = nvmf_reg_read32,
        .reg_read64             = nvmf_reg_read64,
        .reg_write32            = nvmf_reg_write32,
index feb497134aeea662092424804073be9ed104c464..e503cfff03372fb9cc7605c800743dd4c5891318 100644 (file)
@@ -558,7 +558,7 @@ static int nvme_loop_reset_ctrl(struct nvme_ctrl *nctrl)
 static const struct nvme_ctrl_ops nvme_loop_ctrl_ops = {
        .name                   = "loop",
        .module                 = THIS_MODULE,
-       .is_fabrics             = true,
+       .flags                  = NVME_F_FABRICS,
        .reg_read32             = nvmf_reg_read32,
        .reg_read64             = nvmf_reg_read64,
        .reg_write32            = nvmf_reg_write32,
index 71fecc2debfc940affba38afc6c912f3a4aa8b4b..703a42118ffc907571f2da5300639b725c2d529f 100644 (file)
@@ -523,7 +523,7 @@ static int __init of_platform_default_populate_init(void)
 arch_initcall_sync(of_platform_default_populate_init);
 #endif
 
-static int of_platform_device_destroy(struct device *dev, void *data)
+int of_platform_device_destroy(struct device *dev, void *data)
 {
        /* Do not touch devices not populated from the device tree */
        if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED))
@@ -544,6 +544,7 @@ static int of_platform_device_destroy(struct device *dev, void *data)
        of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);
        return 0;
 }
+EXPORT_SYMBOL_GPL(of_platform_device_destroy);
 
 /**
  * of_platform_depopulate() - Remove devices populated from device tree
index a98cba55c7f02e670436787c011a85a8772f5109..19a289b8cc944fefb6e2bb3b627b61a0a2eff3ed 100644 (file)
@@ -252,7 +252,34 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie)
 static int imx6q_pcie_abort_handler(unsigned long addr,
                unsigned int fsr, struct pt_regs *regs)
 {
-       return 0;
+       unsigned long pc = instruction_pointer(regs);
+       unsigned long instr = *(unsigned long *)pc;
+       int reg = (instr >> 12) & 15;
+
+       /*
+        * If the instruction being executed was a read,
+        * make it look like it read all-ones.
+        */
+       if ((instr & 0x0c100000) == 0x04100000) {
+               unsigned long val;
+
+               if (instr & 0x00400000)
+                       val = 255;
+               else
+                       val = -1;
+
+               regs->uregs[reg] = val;
+               regs->ARM_pc += 4;
+               return 0;
+       }
+
+       if ((instr & 0x0e100090) == 0x00100090) {
+               regs->uregs[reg] = -1;
+               regs->ARM_pc += 4;
+               return 0;
+       }
+
+       return 1;
 }
 
 static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
@@ -819,8 +846,8 @@ static int __init imx6_pcie_init(void)
         * we can install the handler here without risking it
         * accessing some uninitialized driver state.
         */
-       hook_fault_code(16 + 6, imx6q_pcie_abort_handler, SIGBUS, 0,
-                       "imprecise external abort");
+       hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0,
+                       "external abort on non-linefetch");
 
        return platform_driver_register(&imx6_pcie_driver);
 }
index c23f146fb5a668b3a5f5ae27b0bb4f00a8057d7f..c09623ca8c3b14b9b522c471fa9ac118c9522106 100644 (file)
@@ -6,6 +6,7 @@ menu "PCI Endpoint"
 
 config PCI_ENDPOINT
        bool "PCI Endpoint Support"
+       depends on HAS_DMA
        help
           Enable this configuration option to support configurable PCI
           endpoint. This should be enabled if the platform has a PCI
index b01bd5bba8e604709c3b51f14f9fbdb796a2c4fb..563901cd9c06b839f4eea9a74ed78f76309f7f62 100644 (file)
@@ -2144,7 +2144,8 @@ bool pci_dev_keep_suspended(struct pci_dev *pci_dev)
 
        if (!pm_runtime_suspended(dev)
            || pci_target_state(pci_dev) != pci_dev->current_state
-           || platform_pci_need_resume(pci_dev))
+           || platform_pci_need_resume(pci_dev)
+           || (pci_dev->dev_flags & PCI_DEV_FLAGS_NEEDS_RESUME))
                return false;
 
        /*
index cc6e085008fb9c6e72244d9e6a588864c3f2962b..f6a63406c76e0b170e348c882abcf2723f2d401d 100644 (file)
@@ -1291,7 +1291,6 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev)
        cdev = &stdev->cdev;
        cdev_init(cdev, &switchtec_fops);
        cdev->owner = THIS_MODULE;
-       cdev->kobj.parent = &dev->kobj;
 
        return stdev;
 
@@ -1442,12 +1441,15 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
        stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET;
        stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET;
        stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET;
-       stdev->partition = ioread8(&stdev->mmio_ntb->partition_id);
+       stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id);
        stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count);
        stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET;
        stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition];
        stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET;
 
+       if (stdev->partition_count < 1)
+               stdev->partition_count = 1;
+
        init_pff(stdev);
 
        pci_set_drvdata(pdev, stdev);
@@ -1479,11 +1481,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
                  SWITCHTEC_EVENT_EN_IRQ,
                  &stdev->mmio_part_cfg->mrpc_comp_hdr);
 
-       rc = cdev_add(&stdev->cdev, stdev->dev.devt, 1);
-       if (rc)
-               goto err_put;
-
-       rc = device_add(&stdev->dev);
+       rc = cdev_device_add(&stdev->cdev, &stdev->dev);
        if (rc)
                goto err_devadd;
 
@@ -1492,7 +1490,6 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
        return 0;
 
 err_devadd:
-       cdev_del(&stdev->cdev);
        stdev_kill(stdev);
 err_put:
        ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt));
@@ -1506,8 +1503,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev)
 
        pci_set_drvdata(pdev, NULL);
 
-       device_del(&stdev->dev);
-       cdev_del(&stdev->cdev);
+       cdev_device_del(&stdev->cdev, &stdev->dev);
        ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt));
        dev_info(&stdev->dev, "unregistered.\n");
 
index 14bde0db8c245680fd010bf2f0aa39093af5a4c2..5b10b50f8686f953a5fe476f3131b0d8a42307bb 100644 (file)
@@ -538,6 +538,7 @@ struct powercap_zone *powercap_register_zone(
 
        power_zone->id = result;
        idr_init(&power_zone->idr);
+       result = -ENOMEM;
        power_zone->name = kstrdup(name, GFP_KERNEL);
        if (!power_zone->name)
                goto err_name_alloc;
index b3de973a62607de6812615e81ac1d00bce5c1f1a..9dca53df35845cc64366a5428d9927bff7f28220 100644 (file)
@@ -1088,7 +1088,7 @@ static u32 rtc_handler(void *context)
        }
        spin_unlock_irqrestore(&rtc_lock, flags);
 
-       pm_wakeup_event(dev, 0);
+       pm_wakeup_hard_event(dev);
        acpi_clear_event(ACPI_EVENT_RTC);
        acpi_disable_event(ACPI_EVENT_RTC, 0);
        return ACPI_INTERRUPT_HANDLED;
index 622bdabc88941430f18ed65b0d70fd9fb0478b9b..dab195f04da78f46921f4eaf044c3f7e953c9a65 100644 (file)
@@ -1769,7 +1769,6 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param)
                goto bye;
        }
 
-       mempool_free(mbp, hw->mb_mempool);
        if (finicsum != cfcsum) {
                csio_warn(hw,
                      "Config File checksum mismatch: csum=%#x, computed=%#x\n",
@@ -1780,6 +1779,10 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param)
        rv = csio_hw_validate_caps(hw, mbp);
        if (rv != 0)
                goto bye;
+
+       mempool_free(mbp, hw->mb_mempool);
+       mbp = NULL;
+
        /*
         * Note that we're operating with parameters
         * not supplied by the driver, rather than from hard-wired
index b44c3136eb5181311f12f982fa1ab77b5e95a5f5..520325867e2b4c05528bd89a7eeaccea2f5c6f94 100644 (file)
@@ -1422,7 +1422,7 @@ static void fc_rport_recv_rtv_req(struct fc_rport_priv *rdata,
        fp = fc_frame_alloc(lport, sizeof(*rtv));
        if (!fp) {
                rjt_data.reason = ELS_RJT_UNAB;
-               rjt_data.reason = ELS_EXPL_INSUF_RES;
+               rjt_data.explan = ELS_EXPL_INSUF_RES;
                fc_seq_els_rsp_send(in_fp, ELS_LS_RJT, &rjt_data);
                goto drop;
        }
index 6d7840b096e6f0899823e99d98e12153683e4f07..f2c0ba6ced78bad65694cde021611d9e0e9f9f25 100644 (file)
@@ -141,6 +141,13 @@ struct lpfc_dmabuf {
        uint32_t   buffer_tag;  /* used for tagged queue ring */
 };
 
+struct lpfc_nvmet_ctxbuf {
+       struct list_head list;
+       struct lpfc_nvmet_rcv_ctx *context;
+       struct lpfc_iocbq *iocbq;
+       struct lpfc_sglq *sglq;
+};
+
 struct lpfc_dma_pool {
        struct lpfc_dmabuf   *elements;
        uint32_t    max_count;
@@ -163,9 +170,7 @@ struct rqb_dmabuf {
        struct lpfc_dmabuf dbuf;
        uint16_t total_size;
        uint16_t bytes_recv;
-       void *context;
-       struct lpfc_iocbq *iocbq;
-       struct lpfc_sglq *sglq;
+       uint16_t idx;
        struct lpfc_queue *hrq;   /* ptr to associated Header RQ */
        struct lpfc_queue *drq;   /* ptr to associated Data RQ */
 };
@@ -670,6 +675,8 @@ struct lpfc_hba {
                                        /* INIT_LINK mailbox command */
 #define LS_NPIV_FAB_SUPPORTED 0x2      /* Fabric supports NPIV */
 #define LS_IGNORE_ERATT       0x4      /* intr handler should ignore ERATT */
+#define LS_MDS_LINK_DOWN      0x8      /* MDS Diagnostics Link Down */
+#define LS_MDS_LOOPBACK      0x16      /* MDS Diagnostics Link Up (Loopback) */
 
        uint32_t hba_flag;      /* hba generic flags */
 #define HBA_ERATT_HANDLED      0x1 /* This flag is set when eratt handled */
@@ -777,7 +784,6 @@ struct lpfc_hba {
        uint32_t cfg_nvme_oas;
        uint32_t cfg_nvme_io_channel;
        uint32_t cfg_nvmet_mrq;
-       uint32_t cfg_nvmet_mrq_post;
        uint32_t cfg_enable_nvmet;
        uint32_t cfg_nvme_enable_fb;
        uint32_t cfg_nvmet_fb_size;
@@ -943,6 +949,7 @@ struct lpfc_hba {
        struct pci_pool *lpfc_mbuf_pool;
        struct pci_pool *lpfc_hrb_pool; /* header receive buffer pool */
        struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */
+       struct pci_pool *lpfc_nvmet_drb_pool; /* data receive buffer pool */
        struct pci_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */
        struct pci_pool *txrdy_payload_pool;
        struct lpfc_dma_pool lpfc_mbuf_safety_pool;
@@ -1228,7 +1235,11 @@ lpfc_sli_read_hs(struct lpfc_hba *phba)
 static inline struct lpfc_sli_ring *
 lpfc_phba_elsring(struct lpfc_hba *phba)
 {
-       if (phba->sli_rev == LPFC_SLI_REV4)
-               return phba->sli4_hba.els_wq->pring;
+       if (phba->sli_rev == LPFC_SLI_REV4) {
+               if (phba->sli4_hba.els_wq)
+                       return phba->sli4_hba.els_wq->pring;
+               else
+                       return NULL;
+       }
        return &phba->sli.sli3_ring[LPFC_ELS_RING];
 }
index 4830370bfab14247f567de976787aecc9d6b6d28..bb2d9e238225a43315fa846ddcab4052b4de1caa 100644 (file)
@@ -60,9 +60,9 @@
 #define LPFC_MIN_DEVLOSS_TMO   1
 #define LPFC_MAX_DEVLOSS_TMO   255
 
-#define LPFC_DEF_MRQ_POST      256
-#define LPFC_MIN_MRQ_POST      32
-#define LPFC_MAX_MRQ_POST      512
+#define LPFC_DEF_MRQ_POST      512
+#define LPFC_MIN_MRQ_POST      512
+#define LPFC_MAX_MRQ_POST      2048
 
 /*
  * Write key size should be multiple of 4. If write key is changed
@@ -205,8 +205,9 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                                atomic_read(&tgtp->xmt_ls_rsp_error));
 
                len += snprintf(buf+len, PAGE_SIZE-len,
-                               "FCP: Rcv %08x Drop %08x\n",
+                               "FCP: Rcv %08x Release %08x Drop %08x\n",
                                atomic_read(&tgtp->rcv_fcp_cmd_in),
+                               atomic_read(&tgtp->xmt_fcp_release),
                                atomic_read(&tgtp->rcv_fcp_cmd_drop));
 
                if (atomic_read(&tgtp->rcv_fcp_cmd_in) !=
@@ -218,15 +219,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                }
 
                len += snprintf(buf+len, PAGE_SIZE-len,
-                               "FCP Rsp: RD %08x rsp %08x WR %08x rsp %08x\n",
+                               "FCP Rsp: RD %08x rsp %08x WR %08x rsp %08x "
+                               "drop %08x\n",
                                atomic_read(&tgtp->xmt_fcp_read),
                                atomic_read(&tgtp->xmt_fcp_read_rsp),
                                atomic_read(&tgtp->xmt_fcp_write),
-                               atomic_read(&tgtp->xmt_fcp_rsp));
-
-               len += snprintf(buf+len, PAGE_SIZE-len,
-                               "FCP Rsp: abort %08x drop %08x\n",
-                               atomic_read(&tgtp->xmt_fcp_abort),
+                               atomic_read(&tgtp->xmt_fcp_rsp),
                                atomic_read(&tgtp->xmt_fcp_drop));
 
                len += snprintf(buf+len, PAGE_SIZE-len,
@@ -236,10 +234,22 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
                                atomic_read(&tgtp->xmt_fcp_rsp_drop));
 
                len += snprintf(buf+len, PAGE_SIZE-len,
-                               "ABORT: Xmt %08x Err %08x Cmpl %08x",
+                               "ABORT: Xmt %08x Cmpl %08x\n",
+                               atomic_read(&tgtp->xmt_fcp_abort),
+                               atomic_read(&tgtp->xmt_fcp_abort_cmpl));
+
+               len += snprintf(buf + len, PAGE_SIZE - len,
+                               "ABORT: Sol %08x  Usol %08x Err %08x Cmpl %08x",
+                               atomic_read(&tgtp->xmt_abort_sol),
+                               atomic_read(&tgtp->xmt_abort_unsol),
                                atomic_read(&tgtp->xmt_abort_rsp),
-                               atomic_read(&tgtp->xmt_abort_rsp_error),
-                               atomic_read(&tgtp->xmt_abort_cmpl));
+                               atomic_read(&tgtp->xmt_abort_rsp_error));
+
+               len += snprintf(buf + len, PAGE_SIZE - len,
+                               "IO_CTX: %08x outstanding %08x total %x",
+                               phba->sli4_hba.nvmet_ctx_cnt,
+                               phba->sli4_hba.nvmet_io_wait_cnt,
+                               phba->sli4_hba.nvmet_io_wait_total);
 
                len +=  snprintf(buf+len, PAGE_SIZE-len, "\n");
                return len;
@@ -3311,14 +3321,6 @@ LPFC_ATTR_R(nvmet_mrq,
            1, 1, 16,
            "Specify number of RQ pairs for processing NVMET cmds");
 
-/*
- * lpfc_nvmet_mrq_post: Specify number buffers to post on every MRQ
- *
- */
-LPFC_ATTR_R(nvmet_mrq_post, LPFC_DEF_MRQ_POST,
-           LPFC_MIN_MRQ_POST, LPFC_MAX_MRQ_POST,
-           "Specify number of buffers to post on every MRQ");
-
 /*
  * lpfc_enable_fc4_type: Defines what FC4 types are supported.
  * Supported Values:  1 - register just FCP
@@ -5154,7 +5156,6 @@ struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_lpfc_suppress_rsp,
        &dev_attr_lpfc_nvme_io_channel,
        &dev_attr_lpfc_nvmet_mrq,
-       &dev_attr_lpfc_nvmet_mrq_post,
        &dev_attr_lpfc_nvme_enable_fb,
        &dev_attr_lpfc_nvmet_fb_size,
        &dev_attr_lpfc_enable_bg,
@@ -6194,7 +6195,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
 
        lpfc_enable_fc4_type_init(phba, lpfc_enable_fc4_type);
        lpfc_nvmet_mrq_init(phba, lpfc_nvmet_mrq);
-       lpfc_nvmet_mrq_post_init(phba, lpfc_nvmet_mrq_post);
 
        /* Initialize first burst. Target vs Initiator are different. */
        lpfc_nvme_enable_fb_init(phba, lpfc_nvme_enable_fb);
@@ -6291,7 +6291,6 @@ lpfc_nvme_mod_param_dep(struct lpfc_hba *phba)
                /* Not NVME Target mode.  Turn off Target parameters. */
                phba->nvmet_support = 0;
                phba->cfg_nvmet_mrq = 0;
-               phba->cfg_nvmet_mrq_post = 0;
                phba->cfg_nvmet_fb_size = 0;
        }
 
index 1c55408ac718a94f9aa622210a0ebf96a9896137..8912767e7bc88cc407ea3fb372f242e2cbccd0de 100644 (file)
@@ -75,6 +75,10 @@ void lpfc_init_vpi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
 void lpfc_cancel_all_vport_retry_delay_timer(struct lpfc_hba *);
 void lpfc_retry_pport_discovery(struct lpfc_hba *);
 void lpfc_release_rpi(struct lpfc_hba *, struct lpfc_vport *, uint16_t);
+int lpfc_init_iocb_list(struct lpfc_hba *phba, int cnt);
+void lpfc_free_iocb_list(struct lpfc_hba *phba);
+int lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,
+                       struct lpfc_queue *drq, int count, int idx);
 
 void lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
 void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
@@ -246,16 +250,14 @@ struct hbq_dmabuf *lpfc_sli4_rb_alloc(struct lpfc_hba *);
 void lpfc_sli4_rb_free(struct lpfc_hba *, struct hbq_dmabuf *);
 struct rqb_dmabuf *lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba);
 void lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab);
-void lpfc_nvmet_rq_post(struct lpfc_hba *phba, struct lpfc_nvmet_rcv_ctx *ctxp,
-                       struct lpfc_dmabuf *mp);
+void lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba,
+                           struct lpfc_nvmet_ctxbuf *ctxp);
 int lpfc_nvmet_rcv_unsol_abort(struct lpfc_vport *vport,
                               struct fc_frame_header *fc_hdr);
 void lpfc_sli4_build_dflt_fcf_record(struct lpfc_hba *, struct fcf_record *,
                        uint16_t);
 int lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq,
                     struct lpfc_rqe *hrqe, struct lpfc_rqe *drqe);
-int lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hq,
-                       struct lpfc_queue *dq, int count);
 int lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hq);
 void lpfc_unregister_fcf(struct lpfc_hba *);
 void lpfc_unregister_fcf_rescan(struct lpfc_hba *);
@@ -271,6 +273,7 @@ int lpfc_sli4_fcf_rr_next_proc(struct lpfc_vport *, uint16_t);
 void lpfc_sli4_clear_fcf_rr_bmask(struct lpfc_hba *);
 
 int lpfc_mem_alloc(struct lpfc_hba *, int align);
+int lpfc_nvmet_mem_alloc(struct lpfc_hba *phba);
 int lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *);
 void lpfc_mem_free(struct lpfc_hba *);
 void lpfc_mem_free_all(struct lpfc_hba *);
index c7962dae4dab8c7130dcb46fa1b7d45dac0509eb..f2cd19c6c2df9fd77516d18fddf2de04cf531437 100644 (file)
@@ -2092,6 +2092,7 @@ lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport,
 
        ae->un.AttrTypes[3] = 0x02; /* Type 1 - ELS */
        ae->un.AttrTypes[2] = 0x01; /* Type 8 - FCP */
+       ae->un.AttrTypes[6] = 0x01; /* Type 40 - NVME */
        ae->un.AttrTypes[7] = 0x01; /* Type 32 - CT */
        size = FOURBYTES + 32;
        ad->AttrLen = cpu_to_be16(size);
index fce549a91911c197d8e616bce9e0c13cb17de535..4bcb92c844ca5f5061c8a4a5cdfb3d7835594162 100644 (file)
@@ -797,11 +797,6 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size)
                                atomic_read(&tgtp->xmt_fcp_write),
                                atomic_read(&tgtp->xmt_fcp_rsp));
 
-               len += snprintf(buf + len, size - len,
-                               "FCP Rsp: abort %08x drop %08x\n",
-                               atomic_read(&tgtp->xmt_fcp_abort),
-                               atomic_read(&tgtp->xmt_fcp_drop));
-
                len += snprintf(buf + len, size - len,
                                "FCP Rsp Cmpl: %08x err %08x drop %08x\n",
                                atomic_read(&tgtp->xmt_fcp_rsp_cmpl),
@@ -809,10 +804,16 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size)
                                atomic_read(&tgtp->xmt_fcp_rsp_drop));
 
                len += snprintf(buf + len, size - len,
-                               "ABORT: Xmt %08x Err %08x Cmpl %08x",
+                               "ABORT: Xmt %08x Cmpl %08x\n",
+                               atomic_read(&tgtp->xmt_fcp_abort),
+                               atomic_read(&tgtp->xmt_fcp_abort_cmpl));
+
+               len += snprintf(buf + len, size - len,
+                               "ABORT: Sol %08x  Usol %08x Err %08x Cmpl %08x",
+                               atomic_read(&tgtp->xmt_abort_sol),
+                               atomic_read(&tgtp->xmt_abort_unsol),
                                atomic_read(&tgtp->xmt_abort_rsp),
-                               atomic_read(&tgtp->xmt_abort_rsp_error),
-                               atomic_read(&tgtp->xmt_abort_cmpl));
+                               atomic_read(&tgtp->xmt_abort_rsp_error));
 
                len +=  snprintf(buf + len, size - len, "\n");
 
@@ -841,6 +842,12 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size)
                        }
                        spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock);
                }
+
+               len += snprintf(buf + len, size - len,
+                               "IO_CTX: %08x  outstanding %08x total %08x\n",
+                               phba->sli4_hba.nvmet_ctx_cnt,
+                               phba->sli4_hba.nvmet_io_wait_cnt,
+                               phba->sli4_hba.nvmet_io_wait_total);
        } else {
                if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME))
                        return len;
@@ -1959,6 +1966,7 @@ lpfc_debugfs_nvmestat_write(struct file *file, const char __user *buf,
                atomic_set(&tgtp->rcv_ls_req_out, 0);
                atomic_set(&tgtp->rcv_ls_req_drop, 0);
                atomic_set(&tgtp->xmt_ls_abort, 0);
+               atomic_set(&tgtp->xmt_ls_abort_cmpl, 0);
                atomic_set(&tgtp->xmt_ls_rsp, 0);
                atomic_set(&tgtp->xmt_ls_drop, 0);
                atomic_set(&tgtp->xmt_ls_rsp_error, 0);
@@ -1967,19 +1975,22 @@ lpfc_debugfs_nvmestat_write(struct file *file, const char __user *buf,
                atomic_set(&tgtp->rcv_fcp_cmd_in, 0);
                atomic_set(&tgtp->rcv_fcp_cmd_out, 0);
                atomic_set(&tgtp->rcv_fcp_cmd_drop, 0);
-               atomic_set(&tgtp->xmt_fcp_abort, 0);
                atomic_set(&tgtp->xmt_fcp_drop, 0);
                atomic_set(&tgtp->xmt_fcp_read_rsp, 0);
                atomic_set(&tgtp->xmt_fcp_read, 0);
                atomic_set(&tgtp->xmt_fcp_write, 0);
                atomic_set(&tgtp->xmt_fcp_rsp, 0);
+               atomic_set(&tgtp->xmt_fcp_release, 0);
                atomic_set(&tgtp->xmt_fcp_rsp_cmpl, 0);
                atomic_set(&tgtp->xmt_fcp_rsp_error, 0);
                atomic_set(&tgtp->xmt_fcp_rsp_drop, 0);
 
+               atomic_set(&tgtp->xmt_fcp_abort, 0);
+               atomic_set(&tgtp->xmt_fcp_abort_cmpl, 0);
+               atomic_set(&tgtp->xmt_abort_sol, 0);
+               atomic_set(&tgtp->xmt_abort_unsol, 0);
                atomic_set(&tgtp->xmt_abort_rsp, 0);
                atomic_set(&tgtp->xmt_abort_rsp_error, 0);
-               atomic_set(&tgtp->xmt_abort_cmpl, 0);
        }
        return nbytes;
 }
@@ -3070,11 +3081,11 @@ __lpfc_idiag_print_wq(struct lpfc_queue *qp, char *wqtype,
                        qp->assoc_qid, qp->q_cnt_1,
                        (unsigned long long)qp->q_cnt_4);
        len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
-                       "\t\tWQID[%02d], QE-CNT[%04d], QE-SIZE[%04d], "
-                       "HOST-IDX[%04d], PORT-IDX[%04d]",
+                       "\t\tWQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
+                       "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
                        qp->queue_id, qp->entry_count,
                        qp->entry_size, qp->host_index,
-                       qp->hba_index);
+                       qp->hba_index, qp->entry_repost);
        len +=  snprintf(pbuffer + len,
                        LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
        return len;
@@ -3121,11 +3132,11 @@ __lpfc_idiag_print_cq(struct lpfc_queue *qp, char *cqtype,
                        qp->assoc_qid, qp->q_cnt_1, qp->q_cnt_2,
                        qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
        len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
-                       "\tCQID[%02d], QE-CNT[%04d], QE-SIZE[%04d], "
-                       "HOST-IDX[%04d], PORT-IDX[%04d]",
+                       "\tCQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
+                       "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
                        qp->queue_id, qp->entry_count,
                        qp->entry_size, qp->host_index,
-                       qp->hba_index);
+                       qp->hba_index, qp->entry_repost);
 
        len +=  snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
 
@@ -3143,20 +3154,20 @@ __lpfc_idiag_print_rqpair(struct lpfc_queue *qp, struct lpfc_queue *datqp,
                        "\t\t%s RQ info: ", rqtype);
        len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
                        "AssocCQID[%02d]: RQ-STAT[nopost:x%x nobuf:x%x "
-                       "trunc:x%x rcv:x%llx]\n",
+                       "posted:x%x rcv:x%llx]\n",
                        qp->assoc_qid, qp->q_cnt_1, qp->q_cnt_2,
                        qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
        len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
-                       "\t\tHQID[%02d], QE-CNT[%04d], QE-SIZE[%04d], "
-                       "HOST-IDX[%04d], PORT-IDX[%04d]\n",
+                       "\t\tHQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
+                       "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
                        qp->queue_id, qp->entry_count, qp->entry_size,
-                       qp->host_index, qp->hba_index);
+                       qp->host_index, qp->hba_index, qp->entry_repost);
        len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
-                       "\t\tDQID[%02d], QE-CNT[%04d], QE-SIZE[%04d], "
-                       "HOST-IDX[%04d], PORT-IDX[%04d]\n",
+                       "\t\tDQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
+                       "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
                        datqp->queue_id, datqp->entry_count,
                        datqp->entry_size, datqp->host_index,
-                       datqp->hba_index);
+                       datqp->hba_index, datqp->entry_repost);
        return len;
 }
 
@@ -3242,10 +3253,10 @@ __lpfc_idiag_print_eq(struct lpfc_queue *qp, char *eqtype,
                        eqtype, qp->q_cnt_1, qp->q_cnt_2, qp->q_cnt_3,
                        (unsigned long long)qp->q_cnt_4);
        len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
-                       "EQID[%02d], QE-CNT[%04d], QE-SIZE[%04d], "
-                       "HOST-IDX[%04d], PORT-IDX[%04d]",
+                       "EQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
+                       "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
                        qp->queue_id, qp->entry_count, qp->entry_size,
-                       qp->host_index, qp->hba_index);
+                       qp->host_index, qp->hba_index, qp->entry_repost);
        len +=  snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
 
        return len;
@@ -5855,8 +5866,10 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
                        atomic_dec(&lpfc_debugfs_hba_count);
                }
 
-               debugfs_remove(lpfc_debugfs_root); /* lpfc */
-               lpfc_debugfs_root = NULL;
+               if (atomic_read(&lpfc_debugfs_hba_count) == 0) {
+                       debugfs_remove(lpfc_debugfs_root); /* lpfc */
+                       lpfc_debugfs_root = NULL;
+               }
        }
 #endif
        return;
index 9d5a379f4b15734a484c643fc9cc81b0ba8b33e9..094c97b9e5f741faba5e0ef904f97faa3cc7a734 100644 (file)
@@ -90,6 +90,7 @@ struct lpfc_nodelist {
 #define NLP_FCP_INITIATOR  0x10                        /* entry is an FCP Initiator */
 #define NLP_NVME_TARGET    0x20                        /* entry is a NVME Target */
 #define NLP_NVME_INITIATOR 0x40                        /* entry is a NVME Initiator */
+#define NLP_NVME_DISCOVERY 0x80                 /* entry has NVME disc srvc */
 
        uint16_t        nlp_fc4_type;           /* FC types node supports. */
                                                /* Assigned from GID_FF, only
index 67827e397431abe8b55955d9cc6497cbf680c054..8e532b39ae93af5c35a1199084f606b627e37ff0 100644 (file)
@@ -1047,6 +1047,13 @@ stop_rr_fcf_flogi:
                                 irsp->ulpStatus, irsp->un.ulpWord[4],
                                 irsp->ulpTimeout);
 
+
+               /* If this is not a loop open failure, bail out */
+               if (!(irsp->ulpStatus == IOSTAT_LOCAL_REJECT &&
+                     ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                                       IOERR_LOOP_OPEN_FAILURE)))
+                       goto flogifail;
+
                /* FLOGI failed, so there is no fabric */
                spin_lock_irq(shost->host_lock);
                vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
@@ -2077,16 +2084,19 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 
        if (irsp->ulpStatus) {
                /* Check for retry */
+               ndlp->fc4_prli_sent--;
                if (lpfc_els_retry(phba, cmdiocb, rspiocb)) {
                        /* ELS command is being retried */
-                       ndlp->fc4_prli_sent--;
                        goto out;
                }
+
                /* PRLI failed */
                lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
-                                "2754 PRLI failure DID:%06X Status:x%x/x%x\n",
+                                "2754 PRLI failure DID:%06X Status:x%x/x%x, "
+                                "data: x%x\n",
                                 ndlp->nlp_DID, irsp->ulpStatus,
-                                irsp->un.ulpWord[4]);
+                                irsp->un.ulpWord[4], ndlp->fc4_prli_sent);
+
                /* Do not call DSM for lpfc_els_abort'ed ELS cmds */
                if (lpfc_error_lost_link(irsp))
                        goto out;
@@ -7441,6 +7451,13 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)
         */
        spin_lock_irq(&phba->hbalock);
        pring = lpfc_phba_elsring(phba);
+
+       /* Bail out if we've no ELS wq, like in PCI error recovery case. */
+       if (unlikely(!pring)) {
+               spin_unlock_irq(&phba->hbalock);
+               return;
+       }
+
        if (phba->sli_rev == LPFC_SLI_REV4)
                spin_lock(&pring->ring_lock);
 
@@ -8667,7 +8684,8 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                lpfc_do_scr_ns_plogi(phba, vport);
        goto out;
 fdisc_failed:
-       if (vport->fc_vport->vport_state != FC_VPORT_NO_FABRIC_RSCS)
+       if (vport->fc_vport &&
+           (vport->fc_vport->vport_state != FC_VPORT_NO_FABRIC_RSCS))
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
        /* Cancel discovery timer */
        lpfc_can_disctmo(vport);
index 0482c558033104d3a44f75290750e1acdc3ee0d9..3ffcd9215ca892eb7ef3e5972df50a427ef17369 100644 (file)
@@ -693,15 +693,16 @@ lpfc_work_done(struct lpfc_hba *phba)
        pring = lpfc_phba_elsring(phba);
        status = (ha_copy & (HA_RXMASK  << (4*LPFC_ELS_RING)));
        status >>= (4*LPFC_ELS_RING);
-       if ((status & HA_RXMASK) ||
-           (pring->flag & LPFC_DEFERRED_RING_EVENT) ||
-           (phba->hba_flag & HBA_SP_QUEUE_EVT)) {
+       if (pring && (status & HA_RXMASK ||
+                     pring->flag & LPFC_DEFERRED_RING_EVENT ||
+                     phba->hba_flag & HBA_SP_QUEUE_EVT)) {
                if (pring->flag & LPFC_STOP_IOCB_EVENT) {
                        pring->flag |= LPFC_DEFERRED_RING_EVENT;
                        /* Set the lpfc data pending flag */
                        set_bit(LPFC_DATA_READY, &phba->data_flags);
                } else {
-                       if (phba->link_state >= LPFC_LINK_UP) {
+                       if (phba->link_state >= LPFC_LINK_UP ||
+                           phba->link_flag & LS_MDS_LOOPBACK) {
                                pring->flag &= ~LPFC_DEFERRED_RING_EVENT;
                                lpfc_sli_handle_slow_ring_event(phba, pring,
                                                                (status &
index 1d12f2be36bcccd336f8892aa0a20d3109d7150c..e0a5fce416aeea7604ab9a46464d8514e82fb0cb 100644 (file)
@@ -1356,6 +1356,7 @@ struct lpfc_mbx_wq_destroy {
 
 #define LPFC_HDR_BUF_SIZE 128
 #define LPFC_DATA_BUF_SIZE 2048
+#define LPFC_NVMET_DATA_BUF_SIZE 128
 struct rq_context {
        uint32_t word0;
 #define lpfc_rq_context_rqe_count_SHIFT        16      /* Version 0 Only */
@@ -4420,6 +4421,19 @@ struct fcp_treceive64_wqe {
 };
 #define TXRDY_PAYLOAD_LEN      12
 
+#define CMD_SEND_FRAME 0xE1
+
+struct send_frame_wqe {
+       struct ulp_bde64 bde;          /* words 0-2 */
+       uint32_t frame_len;            /* word 3 */
+       uint32_t fc_hdr_wd0;           /* word 4 */
+       uint32_t fc_hdr_wd1;           /* word 5 */
+       struct wqe_common wqe_com;     /* words 6-11 */
+       uint32_t fc_hdr_wd2;           /* word 12 */
+       uint32_t fc_hdr_wd3;           /* word 13 */
+       uint32_t fc_hdr_wd4;           /* word 14 */
+       uint32_t fc_hdr_wd5;           /* word 15 */
+};
 
 union lpfc_wqe {
        uint32_t words[16];
@@ -4438,7 +4452,7 @@ union lpfc_wqe {
        struct fcp_trsp64_wqe fcp_trsp;
        struct fcp_tsend64_wqe fcp_tsend;
        struct fcp_treceive64_wqe fcp_treceive;
-
+       struct send_frame_wqe send_frame;
 };
 
 union lpfc_wqe128 {
index 4b1eb98c228df823a986f5568f8b948a7b2ef9bf..9add9473cae52a1f2bf5d1b78a8854a57c9f6192 100644 (file)
@@ -1099,7 +1099,7 @@ lpfc_hba_down_post_s4(struct lpfc_hba *phba)
 
                list_for_each_entry_safe(ctxp, ctxp_next, &nvmet_aborts, list) {
                        ctxp->flag &= ~(LPFC_NVMET_XBUSY | LPFC_NVMET_ABORT_OP);
-                       lpfc_nvmet_rq_post(phba, ctxp, &ctxp->rqb_buffer->hbuf);
+                       lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
                }
        }
 
@@ -3381,7 +3381,7 @@ lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba)
 {
        struct lpfc_sglq *sglq_entry = NULL, *sglq_entry_next = NULL;
        uint16_t i, lxri, xri_cnt, els_xri_cnt;
-       uint16_t nvmet_xri_cnt, tot_cnt;
+       uint16_t nvmet_xri_cnt;
        LIST_HEAD(nvmet_sgl_list);
        int rc;
 
@@ -3389,15 +3389,9 @@ lpfc_sli4_nvmet_sgl_update(struct lpfc_hba *phba)
         * update on pci function's nvmet xri-sgl list
         */
        els_xri_cnt = lpfc_sli4_get_els_iocb_cnt(phba);
-       nvmet_xri_cnt = phba->cfg_nvmet_mrq * phba->cfg_nvmet_mrq_post;
-       tot_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt;
-       if (nvmet_xri_cnt > tot_cnt) {
-               phba->cfg_nvmet_mrq_post = tot_cnt / phba->cfg_nvmet_mrq;
-               nvmet_xri_cnt = phba->cfg_nvmet_mrq * phba->cfg_nvmet_mrq_post;
-               lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                               "6301 NVMET post-sgl count changed to %d\n",
-                               phba->cfg_nvmet_mrq_post);
-       }
+
+       /* For NVMET, ALL remaining XRIs are dedicated for IO processing */
+       nvmet_xri_cnt = phba->sli4_hba.max_cfg_param.max_xri - els_xri_cnt;
 
        if (nvmet_xri_cnt > phba->sli4_hba.nvmet_xri_cnt) {
                /* els xri-sgl expanded */
@@ -4546,6 +4540,19 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc)
        pmb->vport = phba->pport;
 
        if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) {
+               phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK);
+
+               switch (phba->sli4_hba.link_state.status) {
+               case LPFC_FC_LA_TYPE_MDS_LINK_DOWN:
+                       phba->link_flag |= LS_MDS_LINK_DOWN;
+                       break;
+               case LPFC_FC_LA_TYPE_MDS_LOOPBACK:
+                       phba->link_flag |= LS_MDS_LOOPBACK;
+                       break;
+               default:
+                       break;
+               }
+
                /* Parse and translate status field */
                mb = &pmb->u.mb;
                mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba,
@@ -5830,6 +5837,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
                spin_lock_init(&phba->sli4_hba.abts_nvme_buf_list_lock);
                INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvme_buf_list);
                INIT_LIST_HEAD(&phba->sli4_hba.lpfc_abts_nvmet_ctx_list);
+               INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_ctx_list);
+               INIT_LIST_HEAD(&phba->sli4_hba.lpfc_nvmet_io_wait_list);
+
                /* Fast-path XRI aborted CQ Event work queue list */
                INIT_LIST_HEAD(&phba->sli4_hba.sp_nvme_xri_aborted_work_queue);
        }
@@ -5837,6 +5847,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
        /* This abort list used by worker thread */
        spin_lock_init(&phba->sli4_hba.sgl_list_lock);
        spin_lock_init(&phba->sli4_hba.nvmet_io_lock);
+       spin_lock_init(&phba->sli4_hba.nvmet_io_wait_lock);
 
        /*
         * Initialize driver internal slow-path work queues
@@ -5951,16 +5962,21 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
                for (i = 0; i < lpfc_enable_nvmet_cnt; i++) {
                        if (wwn == lpfc_enable_nvmet[i]) {
 #if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
+                               if (lpfc_nvmet_mem_alloc(phba))
+                                       break;
+
+                               phba->nvmet_support = 1; /* a match */
+
                                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                                "6017 NVME Target %016llx\n",
                                                wwn);
-                               phba->nvmet_support = 1; /* a match */
 #else
                                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                                "6021 Can't enable NVME Target."
                                                " NVME_TARGET_FC infrastructure"
                                                " is not in kernel\n");
 #endif
+                               break;
                        }
                }
        }
@@ -6269,7 +6285,7 @@ lpfc_unset_driver_resource_phase2(struct lpfc_hba *phba)
  *
  * This routine is invoked to free the driver's IOCB list and memory.
  **/
-static void
+void
 lpfc_free_iocb_list(struct lpfc_hba *phba)
 {
        struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL;
@@ -6297,7 +6313,7 @@ lpfc_free_iocb_list(struct lpfc_hba *phba)
  *     0 - successful
  *     other values - error
  **/
-static int
+int
 lpfc_init_iocb_list(struct lpfc_hba *phba, int iocb_count)
 {
        struct lpfc_iocbq *iocbq_entry = NULL;
@@ -6525,7 +6541,6 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)
        uint16_t rpi_limit, curr_rpi_range;
        struct lpfc_dmabuf *dmabuf;
        struct lpfc_rpi_hdr *rpi_hdr;
-       uint32_t rpi_count;
 
        /*
         * If the SLI4 port supports extents, posting the rpi header isn't
@@ -6538,8 +6553,7 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)
                return NULL;
 
        /* The limit on the logical index is just the max_rpi count. */
-       rpi_limit = phba->sli4_hba.max_cfg_param.rpi_base +
-       phba->sli4_hba.max_cfg_param.max_rpi - 1;
+       rpi_limit = phba->sli4_hba.max_cfg_param.max_rpi;
 
        spin_lock_irq(&phba->hbalock);
        /*
@@ -6550,18 +6564,10 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)
        curr_rpi_range = phba->sli4_hba.next_rpi;
        spin_unlock_irq(&phba->hbalock);
 
-       /*
-        * The port has a limited number of rpis. The increment here
-        * is LPFC_RPI_HDR_COUNT - 1 to account for the starting value
-        * and to allow the full max_rpi range per port.
-        */
-       if ((curr_rpi_range + (LPFC_RPI_HDR_COUNT - 1)) > rpi_limit)
-               rpi_count = rpi_limit - curr_rpi_range;
-       else
-               rpi_count = LPFC_RPI_HDR_COUNT;
-
-       if (!rpi_count)
+       /* Reached full RPI range */
+       if (curr_rpi_range == rpi_limit)
                return NULL;
+
        /*
         * First allocate the protocol header region for the port.  The
         * port expects a 4KB DMA-mapped memory region that is 4K aligned.
@@ -6595,13 +6601,9 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)
 
        /* The rpi_hdr stores the logical index only. */
        rpi_hdr->start_rpi = curr_rpi_range;
+       rpi_hdr->next_rpi = phba->sli4_hba.next_rpi + LPFC_RPI_HDR_COUNT;
        list_add_tail(&rpi_hdr->list, &phba->sli4_hba.lpfc_rpi_hdr_list);
 
-       /*
-        * The next_rpi stores the next logical module-64 rpi value used
-        * to post physical rpis in subsequent rpi postings.
-        */
-       phba->sli4_hba.next_rpi += rpi_count;
        spin_unlock_irq(&phba->hbalock);
        return rpi_hdr;
 
@@ -8172,7 +8174,7 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba)
                        /* Create NVMET Receive Queue for header */
                        qdesc = lpfc_sli4_queue_alloc(phba,
                                                      phba->sli4_hba.rq_esize,
-                                                     phba->sli4_hba.rq_ecount);
+                                                     LPFC_NVMET_RQE_DEF_COUNT);
                        if (!qdesc) {
                                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                                "3146 Failed allocate "
@@ -8194,7 +8196,7 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba)
                        /* Create NVMET Receive Queue for data */
                        qdesc = lpfc_sli4_queue_alloc(phba,
                                                      phba->sli4_hba.rq_esize,
-                                                     phba->sli4_hba.rq_ecount);
+                                                     LPFC_NVMET_RQE_DEF_COUNT);
                        if (!qdesc) {
                                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                                "3156 Failed allocate "
@@ -8325,46 +8327,6 @@ lpfc_sli4_queue_destroy(struct lpfc_hba *phba)
        INIT_LIST_HEAD(&phba->sli4_hba.lpfc_wq_list);
 }
 
-int
-lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,
-                   struct lpfc_queue *drq, int count)
-{
-       int rc, i;
-       struct lpfc_rqe hrqe;
-       struct lpfc_rqe drqe;
-       struct lpfc_rqb *rqbp;
-       struct rqb_dmabuf *rqb_buffer;
-       LIST_HEAD(rqb_buf_list);
-
-       rqbp = hrq->rqbp;
-       for (i = 0; i < count; i++) {
-               rqb_buffer = (rqbp->rqb_alloc_buffer)(phba);
-               if (!rqb_buffer)
-                       break;
-               rqb_buffer->hrq = hrq;
-               rqb_buffer->drq = drq;
-               list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list);
-       }
-       while (!list_empty(&rqb_buf_list)) {
-               list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf,
-                                hbuf.list);
-
-               hrqe.address_lo = putPaddrLow(rqb_buffer->hbuf.phys);
-               hrqe.address_hi = putPaddrHigh(rqb_buffer->hbuf.phys);
-               drqe.address_lo = putPaddrLow(rqb_buffer->dbuf.phys);
-               drqe.address_hi = putPaddrHigh(rqb_buffer->dbuf.phys);
-               rc = lpfc_sli4_rq_put(hrq, drq, &hrqe, &drqe);
-               if (rc < 0) {
-                       (rqbp->rqb_free_buffer)(phba, rqb_buffer);
-               } else {
-                       list_add_tail(&rqb_buffer->hbuf.list,
-                                     &rqbp->rqb_buffer_list);
-                       rqbp->buffer_count++;
-               }
-       }
-       return 1;
-}
-
 int
 lpfc_free_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *rq)
 {
@@ -8784,9 +8746,6 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)
                goto out_destroy;
        }
 
-       lpfc_rq_adjust_repost(phba, phba->sli4_hba.hdr_rq, LPFC_ELS_HBQ);
-       lpfc_rq_adjust_repost(phba, phba->sli4_hba.dat_rq, LPFC_ELS_HBQ);
-
        rc = lpfc_rq_create(phba, phba->sli4_hba.hdr_rq, phba->sli4_hba.dat_rq,
                            phba->sli4_hba.els_cq, LPFC_USOL);
        if (rc) {
@@ -11110,7 +11069,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
        struct lpfc_hba   *phba;
        struct lpfc_vport *vport = NULL;
        struct Scsi_Host  *shost = NULL;
-       int error, cnt;
+       int error;
        uint32_t cfg_mode, intr_mode;
 
        /* Allocate memory for HBA structure */
@@ -11144,22 +11103,6 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
                goto out_unset_pci_mem_s4;
        }
 
-       cnt = phba->cfg_iocb_cnt * 1024;
-       if (phba->nvmet_support)
-               cnt += phba->cfg_nvmet_mrq_post * phba->cfg_nvmet_mrq;
-
-       /* Initialize and populate the iocb list per host */
-       lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                       "2821 initialize iocb list %d total %d\n",
-                       phba->cfg_iocb_cnt, cnt);
-       error = lpfc_init_iocb_list(phba, cnt);
-
-       if (error) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "1413 Failed to initialize iocb list.\n");
-               goto out_unset_driver_resource_s4;
-       }
-
        INIT_LIST_HEAD(&phba->active_rrq_list);
        INIT_LIST_HEAD(&phba->fcf.fcf_pri_list);
 
@@ -11168,7 +11111,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
        if (error) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                "1414 Failed to set up driver resource.\n");
-               goto out_free_iocb_list;
+               goto out_unset_driver_resource_s4;
        }
 
        /* Get the default values for Model Name and Description */
@@ -11268,8 +11211,6 @@ out_destroy_shost:
        lpfc_destroy_shost(phba);
 out_unset_driver_resource:
        lpfc_unset_driver_resource_phase2(phba);
-out_free_iocb_list:
-       lpfc_free_iocb_list(phba);
 out_unset_driver_resource_s4:
        lpfc_sli4_driver_resource_unset(phba);
 out_unset_pci_mem_s4:
index 5986c7957199df6ef97343a3c0402931cbdeb7ad..fcc05a1517c21d5134282e6cc9337ade5ee1a5c9 100644 (file)
@@ -214,6 +214,21 @@ fail_free_drb_pool:
        return -ENOMEM;
 }
 
+int
+lpfc_nvmet_mem_alloc(struct lpfc_hba *phba)
+{
+       phba->lpfc_nvmet_drb_pool =
+               pci_pool_create("lpfc_nvmet_drb_pool",
+                               phba->pcidev, LPFC_NVMET_DATA_BUF_SIZE,
+                               SGL_ALIGN_SZ, 0);
+       if (!phba->lpfc_nvmet_drb_pool) {
+               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+                               "6024 Can't enable NVME Target - no memory\n");
+               return -ENOMEM;
+       }
+       return 0;
+}
+
 /**
  * lpfc_mem_free - Frees memory allocated by lpfc_mem_alloc
  * @phba: HBA to free memory for
@@ -232,6 +247,9 @@ lpfc_mem_free(struct lpfc_hba *phba)
 
        /* Free HBQ pools */
        lpfc_sli_hbqbuf_free_all(phba);
+       if (phba->lpfc_nvmet_drb_pool)
+               pci_pool_destroy(phba->lpfc_nvmet_drb_pool);
+       phba->lpfc_nvmet_drb_pool = NULL;
        if (phba->lpfc_drb_pool)
                pci_pool_destroy(phba->lpfc_drb_pool);
        phba->lpfc_drb_pool = NULL;
@@ -611,8 +629,6 @@ struct rqb_dmabuf *
 lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
 {
        struct rqb_dmabuf *dma_buf;
-       struct lpfc_iocbq *nvmewqe;
-       union lpfc_wqe128 *wqe;
 
        dma_buf = kzalloc(sizeof(struct rqb_dmabuf), GFP_KERNEL);
        if (!dma_buf)
@@ -624,69 +640,15 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
                kfree(dma_buf);
                return NULL;
        }
-       dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
-                                           &dma_buf->dbuf.phys);
+       dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_nvmet_drb_pool,
+                                           GFP_KERNEL, &dma_buf->dbuf.phys);
        if (!dma_buf->dbuf.virt) {
                pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
                              dma_buf->hbuf.phys);
                kfree(dma_buf);
                return NULL;
        }
-       dma_buf->total_size = LPFC_DATA_BUF_SIZE;
-
-       dma_buf->context = kzalloc(sizeof(struct lpfc_nvmet_rcv_ctx),
-                                  GFP_KERNEL);
-       if (!dma_buf->context) {
-               pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
-                             dma_buf->dbuf.phys);
-               pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
-                             dma_buf->hbuf.phys);
-               kfree(dma_buf);
-               return NULL;
-       }
-
-       dma_buf->iocbq = lpfc_sli_get_iocbq(phba);
-       if (!dma_buf->iocbq) {
-               kfree(dma_buf->context);
-               pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
-                             dma_buf->dbuf.phys);
-               pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
-                             dma_buf->hbuf.phys);
-               kfree(dma_buf);
-               lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
-                               "2621 Ran out of nvmet iocb/WQEs\n");
-               return NULL;
-       }
-       dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
-       nvmewqe = dma_buf->iocbq;
-       wqe = (union lpfc_wqe128 *)&nvmewqe->wqe;
-       /* Initialize WQE */
-       memset(wqe, 0, sizeof(union lpfc_wqe));
-       /* Word 7 */
-       bf_set(wqe_ct, &wqe->generic.wqe_com, SLI4_CT_RPI);
-       bf_set(wqe_class, &wqe->generic.wqe_com, CLASS3);
-       bf_set(wqe_pu, &wqe->generic.wqe_com, 1);
-       /* Word 10 */
-       bf_set(wqe_nvme, &wqe->fcp_tsend.wqe_com, 1);
-       bf_set(wqe_ebde_cnt, &wqe->generic.wqe_com, 0);
-       bf_set(wqe_qosd, &wqe->generic.wqe_com, 0);
-
-       dma_buf->iocbq->context1 = NULL;
-       spin_lock(&phba->sli4_hba.sgl_list_lock);
-       dma_buf->sglq = __lpfc_sli_get_nvmet_sglq(phba, dma_buf->iocbq);
-       spin_unlock(&phba->sli4_hba.sgl_list_lock);
-       if (!dma_buf->sglq) {
-               lpfc_sli_release_iocbq(phba, dma_buf->iocbq);
-               kfree(dma_buf->context);
-               pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
-                             dma_buf->dbuf.phys);
-               pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
-                             dma_buf->hbuf.phys);
-               kfree(dma_buf);
-               lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
-                               "6132 Ran out of nvmet XRIs\n");
-               return NULL;
-       }
+       dma_buf->total_size = LPFC_NVMET_DATA_BUF_SIZE;
        return dma_buf;
 }
 
@@ -705,20 +667,9 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
 void
 lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab)
 {
-       unsigned long flags;
-
-       __lpfc_clear_active_sglq(phba, dmab->sglq->sli4_lxritag);
-       dmab->sglq->state = SGL_FREED;
-       dmab->sglq->ndlp = NULL;
-
-       spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, flags);
-       list_add_tail(&dmab->sglq->list, &phba->sli4_hba.lpfc_nvmet_sgl_list);
-       spin_unlock_irqrestore(&phba->sli4_hba.sgl_list_lock, flags);
-
-       lpfc_sli_release_iocbq(phba, dmab->iocbq);
-       kfree(dmab->context);
        pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
-       pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
+       pci_pool_free(phba->lpfc_nvmet_drb_pool,
+                     dmab->dbuf.virt, dmab->dbuf.phys);
        kfree(dmab);
 }
 
@@ -803,6 +754,11 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
        rc = lpfc_sli4_rq_put(rqb_entry->hrq, rqb_entry->drq, &hrqe, &drqe);
        if (rc < 0) {
                (rqbp->rqb_free_buffer)(phba, rqb_entry);
+               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+                               "6409 Cannot post to RQ %d: %x %x\n",
+                               rqb_entry->hrq->queue_id,
+                               rqb_entry->hrq->host_index,
+                               rqb_entry->hrq->hba_index);
        } else {
                list_add_tail(&rqb_entry->hbuf.list, &rqbp->rqb_buffer_list);
                rqbp->buffer_count++;
index 8777c2d5f50d35ecae18223da67245157811b4be..bff3de053df475365193ea47b153c13795f9c816 100644 (file)
@@ -1944,7 +1944,13 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 
                /* Target driver cannot solicit NVME FB. */
                if (bf_get_be32(prli_tgt, nvpr)) {
+                       /* Complete the nvme target roles.  The transport
+                        * needs to know if the rport is capable of
+                        * discovery in addition to its role.
+                        */
                        ndlp->nlp_type |= NLP_NVME_TARGET;
+                       if (bf_get_be32(prli_disc, nvpr))
+                               ndlp->nlp_type |= NLP_NVME_DISCOVERY;
                        if ((bf_get_be32(prli_fba, nvpr) == 1) &&
                            (bf_get_be32(prli_fb_sz, nvpr) > 0) &&
                            (phba->cfg_nvme_enable_fb) &&
index 0488580eea12eecd0c2767bc6ad5c11a014ac46d..074a6b5e7763510555d9b7f9f7e34e095af1b0f4 100644 (file)
@@ -142,7 +142,7 @@ out:
 }
 
 /**
- * lpfc_nvmet_rq_post - Repost a NVMET RQ DMA buffer and clean up context
+ * lpfc_nvmet_ctxbuf_post - Repost a NVMET RQ DMA buffer and clean up context
  * @phba: HBA buffer is associated with
  * @ctxp: context to clean up
  * @mp: Buffer to free
@@ -155,24 +155,113 @@ out:
  * Returns: None
  **/
 void
-lpfc_nvmet_rq_post(struct lpfc_hba *phba, struct lpfc_nvmet_rcv_ctx *ctxp,
-                  struct lpfc_dmabuf *mp)
+lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf)
 {
-       if (ctxp) {
-               if (ctxp->flag)
-                       lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS,
-                               "6314 rq_post ctx xri x%x flag x%x\n",
-                               ctxp->oxid, ctxp->flag);
-
-               if (ctxp->txrdy) {
-                       pci_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
-                                     ctxp->txrdy_phys);
-                       ctxp->txrdy = NULL;
-                       ctxp->txrdy_phys = 0;
+#if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
+       struct lpfc_nvmet_rcv_ctx *ctxp = ctx_buf->context;
+       struct lpfc_nvmet_tgtport *tgtp;
+       struct fc_frame_header *fc_hdr;
+       struct rqb_dmabuf *nvmebuf;
+       struct lpfc_dmabuf *hbufp;
+       uint32_t *payload;
+       uint32_t size, oxid, sid, rc;
+       unsigned long iflag;
+
+       if (ctxp->txrdy) {
+               pci_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
+                             ctxp->txrdy_phys);
+               ctxp->txrdy = NULL;
+               ctxp->txrdy_phys = 0;
+       }
+       ctxp->state = LPFC_NVMET_STE_FREE;
+
+       spin_lock_irqsave(&phba->sli4_hba.nvmet_io_wait_lock, iflag);
+       if (phba->sli4_hba.nvmet_io_wait_cnt) {
+               hbufp = &nvmebuf->hbuf;
+               list_remove_head(&phba->sli4_hba.lpfc_nvmet_io_wait_list,
+                                nvmebuf, struct rqb_dmabuf,
+                                hbuf.list);
+               phba->sli4_hba.nvmet_io_wait_cnt--;
+               spin_unlock_irqrestore(&phba->sli4_hba.nvmet_io_wait_lock,
+                                      iflag);
+
+               fc_hdr = (struct fc_frame_header *)(nvmebuf->hbuf.virt);
+               oxid = be16_to_cpu(fc_hdr->fh_ox_id);
+               tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
+               payload = (uint32_t *)(nvmebuf->dbuf.virt);
+               size = nvmebuf->bytes_recv;
+               sid = sli4_sid_from_fc_hdr(fc_hdr);
+
+               ctxp = (struct lpfc_nvmet_rcv_ctx *)ctx_buf->context;
+               memset(ctxp, 0, sizeof(ctxp->ctx));
+               ctxp->wqeq = NULL;
+               ctxp->txrdy = NULL;
+               ctxp->offset = 0;
+               ctxp->phba = phba;
+               ctxp->size = size;
+               ctxp->oxid = oxid;
+               ctxp->sid = sid;
+               ctxp->state = LPFC_NVMET_STE_RCV;
+               ctxp->entry_cnt = 1;
+               ctxp->flag = 0;
+               ctxp->ctxbuf = ctx_buf;
+               spin_lock_init(&ctxp->ctxlock);
+
+#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
+               if (phba->ktime_on) {
+                       ctxp->ts_cmd_nvme = ktime_get_ns();
+                       ctxp->ts_isr_cmd = ctxp->ts_cmd_nvme;
+                       ctxp->ts_nvme_data = 0;
+                       ctxp->ts_data_wqput = 0;
+                       ctxp->ts_isr_data = 0;
+                       ctxp->ts_data_nvme = 0;
+                       ctxp->ts_nvme_status = 0;
+                       ctxp->ts_status_wqput = 0;
+                       ctxp->ts_isr_status = 0;
+                       ctxp->ts_status_nvme = 0;
                }
-               ctxp->state = LPFC_NVMET_STE_FREE;
+#endif
+               atomic_inc(&tgtp->rcv_fcp_cmd_in);
+               /*
+                * The calling sequence should be:
+                * nvmet_fc_rcv_fcp_req->lpfc_nvmet_xmt_fcp_op/cmp- req->done
+                * lpfc_nvmet_xmt_fcp_op_cmp should free the allocated ctxp.
+                * When we return from nvmet_fc_rcv_fcp_req, all relevant info
+                * the NVME command / FC header is stored.
+                * A buffer has already been reposted for this IO, so just free
+                * the nvmebuf.
+                */
+               rc = nvmet_fc_rcv_fcp_req(phba->targetport, &ctxp->ctx.fcp_req,
+                                         payload, size);
+
+               /* Process FCP command */
+               if (rc == 0) {
+                       atomic_inc(&tgtp->rcv_fcp_cmd_out);
+                       nvmebuf->hrq->rqbp->rqb_free_buffer(phba, nvmebuf);
+                       return;
+               }
+
+               atomic_inc(&tgtp->rcv_fcp_cmd_drop);
+               lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
+                               "2582 FCP Drop IO x%x: err x%x: x%x x%x x%x\n",
+                               ctxp->oxid, rc,
+                               atomic_read(&tgtp->rcv_fcp_cmd_in),
+                               atomic_read(&tgtp->rcv_fcp_cmd_out),
+                               atomic_read(&tgtp->xmt_fcp_release));
+
+               lpfc_nvmet_defer_release(phba, ctxp);
+               lpfc_nvmet_unsol_fcp_issue_abort(phba, ctxp, sid, oxid);
+               nvmebuf->hrq->rqbp->rqb_free_buffer(phba, nvmebuf);
+               return;
        }
-       lpfc_rq_buf_free(phba, mp);
+       spin_unlock_irqrestore(&phba->sli4_hba.nvmet_io_wait_lock, iflag);
+
+       spin_lock_irqsave(&phba->sli4_hba.nvmet_io_lock, iflag);
+       list_add_tail(&ctx_buf->list,
+                     &phba->sli4_hba.lpfc_nvmet_ctx_list);
+       phba->sli4_hba.nvmet_ctx_cnt++;
+       spin_unlock_irqrestore(&phba->sli4_hba.nvmet_io_lock, iflag);
+#endif
 }
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
@@ -502,6 +591,7 @@ lpfc_nvmet_xmt_ls_rsp(struct nvmet_fc_target_port *tgtport,
                                "6150 LS Drop IO x%x: Prep\n",
                                ctxp->oxid);
                lpfc_in_buf_free(phba, &nvmebuf->dbuf);
+               atomic_inc(&nvmep->xmt_ls_abort);
                lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp,
                                                ctxp->sid, ctxp->oxid);
                return -ENOMEM;
@@ -545,6 +635,7 @@ lpfc_nvmet_xmt_ls_rsp(struct nvmet_fc_target_port *tgtport,
        lpfc_nlp_put(nvmewqeq->context1);
 
        lpfc_in_buf_free(phba, &nvmebuf->dbuf);
+       atomic_inc(&nvmep->xmt_ls_abort);
        lpfc_nvmet_unsol_ls_issue_abort(phba, ctxp, ctxp->sid, ctxp->oxid);
        return -ENXIO;
 }
@@ -612,9 +703,9 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport,
        lpfc_nvmeio_data(phba, "NVMET FCP CMND: xri x%x op x%x len x%x\n",
                         ctxp->oxid, rsp->op, rsp->rsplen);
 
+       ctxp->flag |= LPFC_NVMET_IO_INP;
        rc = lpfc_sli4_issue_wqe(phba, LPFC_FCP_RING, nvmewqeq);
        if (rc == WQE_SUCCESS) {
-               ctxp->flag |= LPFC_NVMET_IO_INP;
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
                if (!phba->ktime_on)
                        return 0;
@@ -692,6 +783,7 @@ static void
 lpfc_nvmet_xmt_fcp_release(struct nvmet_fc_target_port *tgtport,
                           struct nvmefc_tgt_fcp_req *rsp)
 {
+       struct lpfc_nvmet_tgtport *lpfc_nvmep = tgtport->private;
        struct lpfc_nvmet_rcv_ctx *ctxp =
                container_of(rsp, struct lpfc_nvmet_rcv_ctx, ctx.fcp_req);
        struct lpfc_hba *phba = ctxp->phba;
@@ -710,10 +802,12 @@ lpfc_nvmet_xmt_fcp_release(struct nvmet_fc_target_port *tgtport,
        lpfc_nvmeio_data(phba, "NVMET FCP FREE: xri x%x ste %d\n", ctxp->oxid,
                         ctxp->state, 0);
 
+       atomic_inc(&lpfc_nvmep->xmt_fcp_release);
+
        if (aborting)
                return;
 
-       lpfc_nvmet_rq_post(phba, ctxp, &ctxp->rqb_buffer->hbuf);
+       lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
 }
 
 static struct nvmet_fc_target_template lpfc_tgttemplate = {
@@ -734,17 +828,128 @@ static struct nvmet_fc_target_template lpfc_tgttemplate = {
        .target_priv_sz = sizeof(struct lpfc_nvmet_tgtport),
 };
 
+void
+lpfc_nvmet_cleanup_io_context(struct lpfc_hba *phba)
+{
+       struct lpfc_nvmet_ctxbuf *ctx_buf, *next_ctx_buf;
+       unsigned long flags;
+
+       list_for_each_entry_safe(
+               ctx_buf, next_ctx_buf,
+               &phba->sli4_hba.lpfc_nvmet_ctx_list, list) {
+               spin_lock_irqsave(
+                       &phba->sli4_hba.abts_nvme_buf_list_lock, flags);
+               list_del_init(&ctx_buf->list);
+               spin_unlock_irqrestore(
+                       &phba->sli4_hba.abts_nvme_buf_list_lock, flags);
+               __lpfc_clear_active_sglq(phba,
+                                        ctx_buf->sglq->sli4_lxritag);
+               ctx_buf->sglq->state = SGL_FREED;
+               ctx_buf->sglq->ndlp = NULL;
+
+               spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, flags);
+               list_add_tail(&ctx_buf->sglq->list,
+                             &phba->sli4_hba.lpfc_nvmet_sgl_list);
+               spin_unlock_irqrestore(&phba->sli4_hba.sgl_list_lock,
+                                      flags);
+
+               lpfc_sli_release_iocbq(phba, ctx_buf->iocbq);
+               kfree(ctx_buf->context);
+       }
+}
+
+int
+lpfc_nvmet_setup_io_context(struct lpfc_hba *phba)
+{
+       struct lpfc_nvmet_ctxbuf *ctx_buf;
+       struct lpfc_iocbq *nvmewqe;
+       union lpfc_wqe128 *wqe;
+       int i;
+
+       lpfc_printf_log(phba, KERN_INFO, LOG_NVME,
+                       "6403 Allocate NVMET resources for %d XRIs\n",
+                       phba->sli4_hba.nvmet_xri_cnt);
+
+       /* For all nvmet xris, allocate resources needed to process a
+        * received command on a per xri basis.
+        */
+       for (i = 0; i < phba->sli4_hba.nvmet_xri_cnt; i++) {
+               ctx_buf = kzalloc(sizeof(*ctx_buf), GFP_KERNEL);
+               if (!ctx_buf) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
+                                       "6404 Ran out of memory for NVMET\n");
+                       return -ENOMEM;
+               }
+
+               ctx_buf->context = kzalloc(sizeof(*ctx_buf->context),
+                                          GFP_KERNEL);
+               if (!ctx_buf->context) {
+                       kfree(ctx_buf);
+                       lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
+                                       "6405 Ran out of NVMET "
+                                       "context memory\n");
+                       return -ENOMEM;
+               }
+               ctx_buf->context->ctxbuf = ctx_buf;
+
+               ctx_buf->iocbq = lpfc_sli_get_iocbq(phba);
+               if (!ctx_buf->iocbq) {
+                       kfree(ctx_buf->context);
+                       kfree(ctx_buf);
+                       lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
+                                       "6406 Ran out of NVMET iocb/WQEs\n");
+                       return -ENOMEM;
+               }
+               ctx_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
+               nvmewqe = ctx_buf->iocbq;
+               wqe = (union lpfc_wqe128 *)&nvmewqe->wqe;
+               /* Initialize WQE */
+               memset(wqe, 0, sizeof(union lpfc_wqe));
+               /* Word 7 */
+               bf_set(wqe_ct, &wqe->generic.wqe_com, SLI4_CT_RPI);
+               bf_set(wqe_class, &wqe->generic.wqe_com, CLASS3);
+               bf_set(wqe_pu, &wqe->generic.wqe_com, 1);
+               /* Word 10 */
+               bf_set(wqe_nvme, &wqe->fcp_tsend.wqe_com, 1);
+               bf_set(wqe_ebde_cnt, &wqe->generic.wqe_com, 0);
+               bf_set(wqe_qosd, &wqe->generic.wqe_com, 0);
+
+               ctx_buf->iocbq->context1 = NULL;
+               spin_lock(&phba->sli4_hba.sgl_list_lock);
+               ctx_buf->sglq = __lpfc_sli_get_nvmet_sglq(phba, ctx_buf->iocbq);
+               spin_unlock(&phba->sli4_hba.sgl_list_lock);
+               if (!ctx_buf->sglq) {
+                       lpfc_sli_release_iocbq(phba, ctx_buf->iocbq);
+                       kfree(ctx_buf->context);
+                       kfree(ctx_buf);
+                       lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
+                                       "6407 Ran out of NVMET XRIs\n");
+                       return -ENOMEM;
+               }
+               spin_lock(&phba->sli4_hba.nvmet_io_lock);
+               list_add_tail(&ctx_buf->list,
+                             &phba->sli4_hba.lpfc_nvmet_ctx_list);
+               spin_unlock(&phba->sli4_hba.nvmet_io_lock);
+       }
+       phba->sli4_hba.nvmet_ctx_cnt = phba->sli4_hba.nvmet_xri_cnt;
+       return 0;
+}
+
 int
 lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
 {
        struct lpfc_vport  *vport = phba->pport;
        struct lpfc_nvmet_tgtport *tgtp;
        struct nvmet_fc_port_info pinfo;
-       int error = 0;
+       int error;
 
        if (phba->targetport)
                return 0;
 
+       error = lpfc_nvmet_setup_io_context(phba);
+       if (error)
+               return error;
+
        memset(&pinfo, 0, sizeof(struct nvmet_fc_port_info));
        pinfo.node_name = wwn_to_u64(vport->fc_nodename.u.wwn);
        pinfo.port_name = wwn_to_u64(vport->fc_portname.u.wwn);
@@ -772,13 +977,16 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
                                             &phba->pcidev->dev,
                                             &phba->targetport);
 #else
-       error = -ENOMEM;
+       error = -ENOENT;
 #endif
        if (error) {
                lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC,
                                "6025 Cannot register NVME targetport "
                                "x%x\n", error);
                phba->targetport = NULL;
+
+               lpfc_nvmet_cleanup_io_context(phba);
+
        } else {
                tgtp = (struct lpfc_nvmet_tgtport *)
                        phba->targetport->private;
@@ -795,6 +1003,7 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
                atomic_set(&tgtp->rcv_ls_req_out, 0);
                atomic_set(&tgtp->rcv_ls_req_drop, 0);
                atomic_set(&tgtp->xmt_ls_abort, 0);
+               atomic_set(&tgtp->xmt_ls_abort_cmpl, 0);
                atomic_set(&tgtp->xmt_ls_rsp, 0);
                atomic_set(&tgtp->xmt_ls_drop, 0);
                atomic_set(&tgtp->xmt_ls_rsp_error, 0);
@@ -802,18 +1011,21 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
                atomic_set(&tgtp->rcv_fcp_cmd_in, 0);
                atomic_set(&tgtp->rcv_fcp_cmd_out, 0);
                atomic_set(&tgtp->rcv_fcp_cmd_drop, 0);
-               atomic_set(&tgtp->xmt_fcp_abort, 0);
                atomic_set(&tgtp->xmt_fcp_drop, 0);
                atomic_set(&tgtp->xmt_fcp_read_rsp, 0);
                atomic_set(&tgtp->xmt_fcp_read, 0);
                atomic_set(&tgtp->xmt_fcp_write, 0);
                atomic_set(&tgtp->xmt_fcp_rsp, 0);
+               atomic_set(&tgtp->xmt_fcp_release, 0);
                atomic_set(&tgtp->xmt_fcp_rsp_cmpl, 0);
                atomic_set(&tgtp->xmt_fcp_rsp_error, 0);
                atomic_set(&tgtp->xmt_fcp_rsp_drop, 0);
+               atomic_set(&tgtp->xmt_fcp_abort, 0);
+               atomic_set(&tgtp->xmt_fcp_abort_cmpl, 0);
+               atomic_set(&tgtp->xmt_abort_unsol, 0);
+               atomic_set(&tgtp->xmt_abort_sol, 0);
                atomic_set(&tgtp->xmt_abort_rsp, 0);
                atomic_set(&tgtp->xmt_abort_rsp_error, 0);
-               atomic_set(&tgtp->xmt_abort_cmpl, 0);
        }
        return error;
 }
@@ -864,7 +1076,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,
        list_for_each_entry_safe(ctxp, next_ctxp,
                                 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list,
                                 list) {
-               if (ctxp->rqb_buffer->sglq->sli4_xritag != xri)
+               if (ctxp->ctxbuf->sglq->sli4_xritag != xri)
                        continue;
 
                /* Check if we already received a free context call
@@ -885,7 +1097,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,
                    (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE ||
                     ndlp->nlp_state == NLP_STE_MAPPED_NODE)) {
                        lpfc_set_rrq_active(phba, ndlp,
-                               ctxp->rqb_buffer->sglq->sli4_lxritag,
+                               ctxp->ctxbuf->sglq->sli4_lxritag,
                                rxid, 1);
                        lpfc_sli4_abts_err_handler(phba, ndlp, axri);
                }
@@ -894,8 +1106,8 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,
                                "6318 XB aborted %x flg x%x (%x)\n",
                                ctxp->oxid, ctxp->flag, released);
                if (released)
-                       lpfc_nvmet_rq_post(phba, ctxp,
-                                          &ctxp->rqb_buffer->hbuf);
+                       lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
+
                if (rrq_empty)
                        lpfc_worker_wake_up(phba);
                return;
@@ -923,7 +1135,7 @@ lpfc_nvmet_rcv_unsol_abort(struct lpfc_vport *vport,
        list_for_each_entry_safe(ctxp, next_ctxp,
                                 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list,
                                 list) {
-               if (ctxp->rqb_buffer->sglq->sli4_xritag != xri)
+               if (ctxp->ctxbuf->sglq->sli4_xritag != xri)
                        continue;
 
                spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock);
@@ -975,6 +1187,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
                init_completion(&tgtp->tport_unreg_done);
                nvmet_fc_unregister_targetport(phba->targetport);
                wait_for_completion_timeout(&tgtp->tport_unreg_done, 5);
+               lpfc_nvmet_cleanup_io_context(phba);
        }
        phba->targetport = NULL;
 #endif
@@ -1010,6 +1223,7 @@ lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                oxid = 0;
                size = 0;
                sid = 0;
+               ctxp = NULL;
                goto dropit;
        }
 
@@ -1104,39 +1318,71 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
        struct lpfc_nvmet_rcv_ctx *ctxp;
        struct lpfc_nvmet_tgtport *tgtp;
        struct fc_frame_header *fc_hdr;
+       struct lpfc_nvmet_ctxbuf *ctx_buf;
        uint32_t *payload;
-       uint32_t size, oxid, sid, rc;
+       uint32_t size, oxid, sid, rc, qno;
+       unsigned long iflag;
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
        uint32_t id;
 #endif
 
+       ctx_buf = NULL;
        if (!nvmebuf || !phba->targetport) {
                lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
-                               "6157 FCP Drop IO\n");
+                               "6157 NVMET FCP Drop IO\n");
                oxid = 0;
                size = 0;
                sid = 0;
+               ctxp = NULL;
                goto dropit;
        }
 
+       spin_lock_irqsave(&phba->sli4_hba.nvmet_io_lock, iflag);
+       if (phba->sli4_hba.nvmet_ctx_cnt) {
+               list_remove_head(&phba->sli4_hba.lpfc_nvmet_ctx_list,
+                                ctx_buf, struct lpfc_nvmet_ctxbuf, list);
+               phba->sli4_hba.nvmet_ctx_cnt--;
+       }
+       spin_unlock_irqrestore(&phba->sli4_hba.nvmet_io_lock, iflag);
 
-       tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
-       payload = (uint32_t *)(nvmebuf->dbuf.virt);
        fc_hdr = (struct fc_frame_header *)(nvmebuf->hbuf.virt);
-       size = nvmebuf->bytes_recv;
        oxid = be16_to_cpu(fc_hdr->fh_ox_id);
-       sid = sli4_sid_from_fc_hdr(fc_hdr);
+       size = nvmebuf->bytes_recv;
 
-       ctxp = (struct lpfc_nvmet_rcv_ctx *)nvmebuf->context;
-       if (ctxp == NULL) {
-               atomic_inc(&tgtp->rcv_fcp_cmd_drop);
-               lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
-                               "6158 FCP Drop IO x%x: Alloc\n",
-                               oxid);
-               lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf);
-               /* Cannot send ABTS without context */
+#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
+       if (phba->cpucheck_on & LPFC_CHECK_NVMET_RCV) {
+               id = smp_processor_id();
+               if (id < LPFC_CHECK_CPU_CNT)
+                       phba->cpucheck_rcv_io[id]++;
+       }
+#endif
+
+       lpfc_nvmeio_data(phba, "NVMET FCP  RCV: xri x%x sz %d CPU %02x\n",
+                        oxid, size, smp_processor_id());
+
+       if (!ctx_buf) {
+               /* Queue this NVME IO to process later */
+               spin_lock_irqsave(&phba->sli4_hba.nvmet_io_wait_lock, iflag);
+               list_add_tail(&nvmebuf->hbuf.list,
+                             &phba->sli4_hba.lpfc_nvmet_io_wait_list);
+               phba->sli4_hba.nvmet_io_wait_cnt++;
+               phba->sli4_hba.nvmet_io_wait_total++;
+               spin_unlock_irqrestore(&phba->sli4_hba.nvmet_io_wait_lock,
+                                      iflag);
+
+               /* Post a brand new DMA buffer to RQ */
+               qno = nvmebuf->idx;
+               lpfc_post_rq_buffer(
+                       phba, phba->sli4_hba.nvmet_mrq_hdr[qno],
+                       phba->sli4_hba.nvmet_mrq_data[qno], 1, qno);
                return;
        }
+
+       tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
+       payload = (uint32_t *)(nvmebuf->dbuf.virt);
+       sid = sli4_sid_from_fc_hdr(fc_hdr);
+
+       ctxp = (struct lpfc_nvmet_rcv_ctx *)ctx_buf->context;
        memset(ctxp, 0, sizeof(ctxp->ctx));
        ctxp->wqeq = NULL;
        ctxp->txrdy = NULL;
@@ -1146,9 +1392,9 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
        ctxp->oxid = oxid;
        ctxp->sid = sid;
        ctxp->state = LPFC_NVMET_STE_RCV;
-       ctxp->rqb_buffer = nvmebuf;
        ctxp->entry_cnt = 1;
        ctxp->flag = 0;
+       ctxp->ctxbuf = ctx_buf;
        spin_lock_init(&ctxp->ctxlock);
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
@@ -1164,22 +1410,16 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
                ctxp->ts_isr_status = 0;
                ctxp->ts_status_nvme = 0;
        }
-
-       if (phba->cpucheck_on & LPFC_CHECK_NVMET_RCV) {
-               id = smp_processor_id();
-               if (id < LPFC_CHECK_CPU_CNT)
-                       phba->cpucheck_rcv_io[id]++;
-       }
 #endif
 
-       lpfc_nvmeio_data(phba, "NVMET FCP  RCV: xri x%x sz %d CPU %02x\n",
-                        oxid, size, smp_processor_id());
-
        atomic_inc(&tgtp->rcv_fcp_cmd_in);
        /*
         * The calling sequence should be:
         * nvmet_fc_rcv_fcp_req -> lpfc_nvmet_xmt_fcp_op/cmp -> req->done
         * lpfc_nvmet_xmt_fcp_op_cmp should free the allocated ctxp.
+        * When we return from nvmet_fc_rcv_fcp_req, all relevant info in
+        * the NVME command / FC header is stored, so we are free to repost
+        * the buffer.
         */
        rc = nvmet_fc_rcv_fcp_req(phba->targetport, &ctxp->ctx.fcp_req,
                                  payload, size);
@@ -1187,26 +1427,32 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
        /* Process FCP command */
        if (rc == 0) {
                atomic_inc(&tgtp->rcv_fcp_cmd_out);
+               lpfc_rq_buf_free(phba, &nvmebuf->hbuf); /* repost */
                return;
        }
 
        atomic_inc(&tgtp->rcv_fcp_cmd_drop);
        lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
-                       "6159 FCP Drop IO x%x: err x%x\n",
-                       ctxp->oxid, rc);
+                       "6159 FCP Drop IO x%x: err x%x: x%x x%x x%x\n",
+                       ctxp->oxid, rc,
+                       atomic_read(&tgtp->rcv_fcp_cmd_in),
+                       atomic_read(&tgtp->rcv_fcp_cmd_out),
+                       atomic_read(&tgtp->xmt_fcp_release));
 dropit:
        lpfc_nvmeio_data(phba, "NVMET FCP DROP: xri x%x sz %d from %06x\n",
                         oxid, size, sid);
        if (oxid) {
+               lpfc_nvmet_defer_release(phba, ctxp);
                lpfc_nvmet_unsol_fcp_issue_abort(phba, ctxp, sid, oxid);
+               lpfc_rq_buf_free(phba, &nvmebuf->hbuf); /* repost */
                return;
        }
 
-       if (nvmebuf) {
-               nvmebuf->iocbq->hba_wqidx = 0;
-               /* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */
-               lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf);
-       }
+       if (ctx_buf)
+               lpfc_nvmet_ctxbuf_post(phba, ctx_buf);
+
+       if (nvmebuf)
+               lpfc_rq_buf_free(phba, &nvmebuf->hbuf); /* repost */
 #endif
 }
 
@@ -1258,7 +1504,7 @@ lpfc_nvmet_unsol_fcp_event(struct lpfc_hba *phba,
                           uint64_t isr_timestamp)
 {
        if (phba->nvmet_support == 0) {
-               lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf);
+               lpfc_rq_buf_free(phba, &nvmebuf->hbuf);
                return;
        }
        lpfc_nvmet_unsol_fcp_buffer(phba, pring, nvmebuf,
@@ -1459,7 +1705,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
        nvmewqe = ctxp->wqeq;
        if (nvmewqe == NULL) {
                /* Allocate buffer for  command wqe */
-               nvmewqe = ctxp->rqb_buffer->iocbq;
+               nvmewqe = ctxp->ctxbuf->iocbq;
                if (nvmewqe == NULL) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
                                        "6110 lpfc_nvmet_prep_fcp_wqe: No "
@@ -1486,7 +1732,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
                return NULL;
        }
 
-       sgl  = (struct sli4_sge *)ctxp->rqb_buffer->sglq->sgl;
+       sgl  = (struct sli4_sge *)ctxp->ctxbuf->sglq->sgl;
        switch (rsp->op) {
        case NVMET_FCOP_READDATA:
        case NVMET_FCOP_READDATA_RSP:
@@ -1811,7 +2057,8 @@ lpfc_nvmet_sol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
        result = wcqe->parameter;
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
-       atomic_inc(&tgtp->xmt_abort_cmpl);
+       if (ctxp->flag & LPFC_NVMET_ABORT_OP)
+               atomic_inc(&tgtp->xmt_fcp_abort_cmpl);
 
        ctxp->state = LPFC_NVMET_STE_DONE;
 
@@ -1826,6 +2073,7 @@ lpfc_nvmet_sol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
        }
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
        spin_unlock_irqrestore(&ctxp->ctxlock, flags);
+       atomic_inc(&tgtp->xmt_abort_rsp);
 
        lpfc_printf_log(phba, KERN_ERR, LOG_NVME_ABTS,
                        "6165 ABORT cmpl: xri x%x flg x%x (%d) "
@@ -1834,15 +2082,16 @@ lpfc_nvmet_sol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
                        wcqe->word0, wcqe->total_data_placed,
                        result, wcqe->word3);
 
+       cmdwqe->context2 = NULL;
+       cmdwqe->context3 = NULL;
        /*
         * if transport has released ctx, then can reuse it. Otherwise,
         * will be recycled by transport release call.
         */
        if (released)
-               lpfc_nvmet_rq_post(phba, ctxp, &ctxp->rqb_buffer->hbuf);
+               lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
 
-       cmdwqe->context2 = NULL;
-       cmdwqe->context3 = NULL;
+       /* This is the iocbq for the abort, not the command */
        lpfc_sli_release_iocbq(phba, cmdwqe);
 
        /* Since iaab/iaar are NOT set, there is no work left.
@@ -1876,7 +2125,8 @@ lpfc_nvmet_unsol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
        result = wcqe->parameter;
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
-       atomic_inc(&tgtp->xmt_abort_cmpl);
+       if (ctxp->flag & LPFC_NVMET_ABORT_OP)
+               atomic_inc(&tgtp->xmt_fcp_abort_cmpl);
 
        if (!ctxp) {
                /* if context is clear, related io alrady complete */
@@ -1906,6 +2156,7 @@ lpfc_nvmet_unsol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
        }
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
        spin_unlock_irqrestore(&ctxp->ctxlock, flags);
+       atomic_inc(&tgtp->xmt_abort_rsp);
 
        lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS,
                        "6316 ABTS cmpl xri x%x flg x%x (%x) "
@@ -1913,15 +2164,15 @@ lpfc_nvmet_unsol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
                        ctxp->oxid, ctxp->flag, released,
                        wcqe->word0, wcqe->total_data_placed,
                        result, wcqe->word3);
+
+       cmdwqe->context2 = NULL;
+       cmdwqe->context3 = NULL;
        /*
         * if transport has released ctx, then can reuse it. Otherwise,
         * will be recycled by transport release call.
         */
        if (released)
-               lpfc_nvmet_rq_post(phba, ctxp, &ctxp->rqb_buffer->hbuf);
-
-       cmdwqe->context2 = NULL;
-       cmdwqe->context3 = NULL;
+               lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
 
        /* Since iaab/iaar are NOT set, there is no work left.
         * For LPFC_NVMET_XBUSY, lpfc_sli4_nvmet_xri_aborted
@@ -1952,7 +2203,7 @@ lpfc_nvmet_xmt_ls_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe,
        result = wcqe->parameter;
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
-       atomic_inc(&tgtp->xmt_abort_cmpl);
+       atomic_inc(&tgtp->xmt_ls_abort_cmpl);
 
        lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS,
                        "6083 Abort cmpl: ctx %p WCQE: %08x %08x %08x %08x\n",
@@ -1983,10 +2234,6 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba,
                        sid, xri, ctxp->wqeq->sli4_xritag);
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
-       if (!ctxp->wqeq) {
-               ctxp->wqeq = ctxp->rqb_buffer->iocbq;
-               ctxp->wqeq->hba_wqidx = 0;
-       }
 
        ndlp = lpfc_findnode_did(phba->pport, sid);
        if (!ndlp || !NLP_CHK_NODE_ACT(ndlp) ||
@@ -2082,7 +2329,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
        if (!ctxp->wqeq) {
-               ctxp->wqeq = ctxp->rqb_buffer->iocbq;
+               ctxp->wqeq = ctxp->ctxbuf->iocbq;
                ctxp->wqeq->hba_wqidx = 0;
        }
 
@@ -2103,6 +2350,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
        /* Issue ABTS for this WQE based on iotag */
        ctxp->abort_wqeq = lpfc_sli_get_iocbq(phba);
        if (!ctxp->abort_wqeq) {
+               atomic_inc(&tgtp->xmt_abort_rsp_error);
                lpfc_printf_log(phba, KERN_WARNING, LOG_NVME_ABTS,
                                "6161 ABORT failed: No wqeqs: "
                                "xri: x%x\n", ctxp->oxid);
@@ -2127,6 +2375,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
        /* driver queued commands are in process of being flushed */
        if (phba->hba_flag & HBA_NVME_IOQ_FLUSH) {
                spin_unlock_irqrestore(&phba->hbalock, flags);
+               atomic_inc(&tgtp->xmt_abort_rsp_error);
                lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
                                "6163 Driver in reset cleanup - flushing "
                                "NVME Req now. hba_flag x%x oxid x%x\n",
@@ -2139,6 +2388,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
        /* Outstanding abort is in progress */
        if (abts_wqeq->iocb_flag & LPFC_DRIVER_ABORTED) {
                spin_unlock_irqrestore(&phba->hbalock, flags);
+               atomic_inc(&tgtp->xmt_abort_rsp_error);
                lpfc_printf_log(phba, KERN_ERR, LOG_NVME,
                                "6164 Outstanding NVME I/O Abort Request "
                                "still pending on oxid x%x\n",
@@ -2189,9 +2439,12 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,
        abts_wqeq->context2 = ctxp;
        rc = lpfc_sli4_issue_wqe(phba, LPFC_FCP_RING, abts_wqeq);
        spin_unlock_irqrestore(&phba->hbalock, flags);
-       if (rc == WQE_SUCCESS)
+       if (rc == WQE_SUCCESS) {
+               atomic_inc(&tgtp->xmt_abort_sol);
                return 0;
+       }
 
+       atomic_inc(&tgtp->xmt_abort_rsp_error);
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
        lpfc_sli_release_iocbq(phba, abts_wqeq);
        lpfc_printf_log(phba, KERN_ERR, LOG_NVME_ABTS,
@@ -2214,7 +2467,7 @@ lpfc_nvmet_unsol_fcp_issue_abort(struct lpfc_hba *phba,
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
        if (!ctxp->wqeq) {
-               ctxp->wqeq = ctxp->rqb_buffer->iocbq;
+               ctxp->wqeq = ctxp->ctxbuf->iocbq;
                ctxp->wqeq->hba_wqidx = 0;
        }
 
@@ -2230,11 +2483,11 @@ lpfc_nvmet_unsol_fcp_issue_abort(struct lpfc_hba *phba,
        rc = lpfc_sli4_issue_wqe(phba, LPFC_FCP_RING, abts_wqeq);
        spin_unlock_irqrestore(&phba->hbalock, flags);
        if (rc == WQE_SUCCESS) {
-               atomic_inc(&tgtp->xmt_abort_rsp);
                return 0;
        }
 
 aerr:
+       atomic_inc(&tgtp->xmt_abort_rsp_error);
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
        atomic_inc(&tgtp->xmt_abort_rsp_error);
        lpfc_printf_log(phba, KERN_WARNING, LOG_NVME_ABTS,
@@ -2269,6 +2522,7 @@ lpfc_nvmet_unsol_ls_issue_abort(struct lpfc_hba *phba,
        }
        abts_wqeq = ctxp->wqeq;
        wqe_abts = &abts_wqeq->wqe;
+
        lpfc_nvmet_unsol_issue_abort(phba, ctxp, sid, xri);
 
        spin_lock_irqsave(&phba->hbalock, flags);
@@ -2278,7 +2532,7 @@ lpfc_nvmet_unsol_ls_issue_abort(struct lpfc_hba *phba,
        rc = lpfc_sli4_issue_wqe(phba, LPFC_ELS_RING, abts_wqeq);
        spin_unlock_irqrestore(&phba->hbalock, flags);
        if (rc == WQE_SUCCESS) {
-               atomic_inc(&tgtp->xmt_abort_rsp);
+               atomic_inc(&tgtp->xmt_abort_unsol);
                return 0;
        }
 
index 128759fe665058dba133febdaa7140f29469f733..6eb2f5d8d4eda40f931097752c72f175354f14da 100644 (file)
@@ -22,6 +22,7 @@
  ********************************************************************/
 
 #define LPFC_NVMET_DEFAULT_SEGS                (64 + 1)        /* 256K IOs */
+#define LPFC_NVMET_RQE_DEF_COUNT       512
 #define LPFC_NVMET_SUCCESS_LEN 12
 
 /* Used for NVME Target */
@@ -34,6 +35,7 @@ struct lpfc_nvmet_tgtport {
        atomic_t rcv_ls_req_out;
        atomic_t rcv_ls_req_drop;
        atomic_t xmt_ls_abort;
+       atomic_t xmt_ls_abort_cmpl;
 
        /* Stats counters - lpfc_nvmet_xmt_ls_rsp */
        atomic_t xmt_ls_rsp;
@@ -47,9 +49,9 @@ struct lpfc_nvmet_tgtport {
        atomic_t rcv_fcp_cmd_in;
        atomic_t rcv_fcp_cmd_out;
        atomic_t rcv_fcp_cmd_drop;
+       atomic_t xmt_fcp_release;
 
        /* Stats counters - lpfc_nvmet_xmt_fcp_op */
-       atomic_t xmt_fcp_abort;
        atomic_t xmt_fcp_drop;
        atomic_t xmt_fcp_read_rsp;
        atomic_t xmt_fcp_read;
@@ -62,12 +64,13 @@ struct lpfc_nvmet_tgtport {
        atomic_t xmt_fcp_rsp_drop;
 
 
-       /* Stats counters - lpfc_nvmet_unsol_issue_abort */
+       /* Stats counters - lpfc_nvmet_xmt_fcp_abort */
+       atomic_t xmt_fcp_abort;
+       atomic_t xmt_fcp_abort_cmpl;
+       atomic_t xmt_abort_sol;
+       atomic_t xmt_abort_unsol;
        atomic_t xmt_abort_rsp;
        atomic_t xmt_abort_rsp_error;
-
-       /* Stats counters - lpfc_nvmet_xmt_abort_cmp */
-       atomic_t xmt_abort_cmpl;
 };
 
 struct lpfc_nvmet_rcv_ctx {
@@ -103,6 +106,7 @@ struct lpfc_nvmet_rcv_ctx {
 #define LPFC_NVMET_CTX_RLS             0x8  /* ctx free requested */
 #define LPFC_NVMET_ABTS_RCV            0x10  /* ABTS received on exchange */
        struct rqb_dmabuf *rqb_buffer;
+       struct lpfc_nvmet_ctxbuf *ctxbuf;
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
        uint64_t ts_isr_cmd;
index 2a4fc00dfa9bdc7dbe42d5bed00935abd0a9e398..d6b184839bc2ff951233ee8fbcf477d6b133206f 100644 (file)
@@ -74,6 +74,8 @@ static struct lpfc_iocbq *lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *,
                                                         struct lpfc_iocbq *);
 static void lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *,
                                      struct hbq_dmabuf *);
+static void lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport,
+                                         struct hbq_dmabuf *dmabuf);
 static int lpfc_sli4_fp_handle_cqe(struct lpfc_hba *, struct lpfc_queue *,
                                    struct lpfc_cqe *);
 static int lpfc_sli4_post_sgl_list(struct lpfc_hba *, struct list_head *,
@@ -479,22 +481,23 @@ lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq,
        if (unlikely(!hq) || unlikely(!dq))
                return -ENOMEM;
        put_index = hq->host_index;
-       temp_hrqe = hq->qe[hq->host_index].rqe;
+       temp_hrqe = hq->qe[put_index].rqe;
        temp_drqe = dq->qe[dq->host_index].rqe;
 
        if (hq->type != LPFC_HRQ || dq->type != LPFC_DRQ)
                return -EINVAL;
-       if (hq->host_index != dq->host_index)
+       if (put_index != dq->host_index)
                return -EINVAL;
        /* If the host has not yet processed the next entry then we are done */
-       if (((hq->host_index + 1) % hq->entry_count) == hq->hba_index)
+       if (((put_index + 1) % hq->entry_count) == hq->hba_index)
                return -EBUSY;
        lpfc_sli_pcimem_bcopy(hrqe, temp_hrqe, hq->entry_size);
        lpfc_sli_pcimem_bcopy(drqe, temp_drqe, dq->entry_size);
 
        /* Update the host index to point to the next slot */
-       hq->host_index = ((hq->host_index + 1) % hq->entry_count);
+       hq->host_index = ((put_index + 1) % hq->entry_count);
        dq->host_index = ((dq->host_index + 1) % dq->entry_count);
+       hq->RQ_buf_posted++;
 
        /* Ring The Header Receive Queue Doorbell */
        if (!(hq->host_index % hq->entry_repost)) {
@@ -5906,7 +5909,7 @@ lpfc_set_features(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox,
                bf_set(lpfc_mbx_set_feature_mds,
                       &mbox->u.mqe.un.set_feature, 1);
                bf_set(lpfc_mbx_set_feature_mds_deep_loopbk,
-                      &mbox->u.mqe.un.set_feature, 0);
+                      &mbox->u.mqe.un.set_feature, 1);
                mbox->u.mqe.un.set_feature.feature = LPFC_SET_MDS_DIAGS;
                mbox->u.mqe.un.set_feature.param_len = 8;
                break;
@@ -6512,6 +6515,50 @@ lpfc_set_host_data(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
                 (phba->hba_flag & HBA_FCOE_MODE) ? "FCoE" : "FC");
 }
 
+int
+lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,
+                   struct lpfc_queue *drq, int count, int idx)
+{
+       int rc, i;
+       struct lpfc_rqe hrqe;
+       struct lpfc_rqe drqe;
+       struct lpfc_rqb *rqbp;
+       struct rqb_dmabuf *rqb_buffer;
+       LIST_HEAD(rqb_buf_list);
+
+       rqbp = hrq->rqbp;
+       for (i = 0; i < count; i++) {
+               /* IF RQ is already full, don't bother */
+               if (rqbp->buffer_count + i >= rqbp->entry_count - 1)
+                       break;
+               rqb_buffer = rqbp->rqb_alloc_buffer(phba);
+               if (!rqb_buffer)
+                       break;
+               rqb_buffer->hrq = hrq;
+               rqb_buffer->drq = drq;
+               rqb_buffer->idx = idx;
+               list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list);
+       }
+       while (!list_empty(&rqb_buf_list)) {
+               list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf,
+                                hbuf.list);
+
+               hrqe.address_lo = putPaddrLow(rqb_buffer->hbuf.phys);
+               hrqe.address_hi = putPaddrHigh(rqb_buffer->hbuf.phys);
+               drqe.address_lo = putPaddrLow(rqb_buffer->dbuf.phys);
+               drqe.address_hi = putPaddrHigh(rqb_buffer->dbuf.phys);
+               rc = lpfc_sli4_rq_put(hrq, drq, &hrqe, &drqe);
+               if (rc < 0) {
+                       rqbp->rqb_free_buffer(phba, rqb_buffer);
+               } else {
+                       list_add_tail(&rqb_buffer->hbuf.list,
+                                     &rqbp->rqb_buffer_list);
+                       rqbp->buffer_count++;
+               }
+       }
+       return 1;
+}
+
 /**
  * lpfc_sli4_hba_setup - SLI4 device initialization PCI function
  * @phba: Pointer to HBA context object.
@@ -6524,7 +6571,7 @@ lpfc_set_host_data(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
 int
 lpfc_sli4_hba_setup(struct lpfc_hba *phba)
 {
-       int rc, i;
+       int rc, i, cnt;
        LPFC_MBOXQ_t *mboxq;
        struct lpfc_mqe *mqe;
        uint8_t *vpd;
@@ -6875,6 +6922,21 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
                        goto out_destroy_queue;
                }
                phba->sli4_hba.nvmet_xri_cnt = rc;
+
+               cnt = phba->cfg_iocb_cnt * 1024;
+               /* We need 1 iocbq for every SGL, for IO processing */
+               cnt += phba->sli4_hba.nvmet_xri_cnt;
+               /* Initialize and populate the iocb list per host */
+               lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+                               "2821 initialize iocb list %d total %d\n",
+                               phba->cfg_iocb_cnt, cnt);
+               rc = lpfc_init_iocb_list(phba, cnt);
+               if (rc) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+                                       "1413 Failed to init iocb list.\n");
+                       goto out_destroy_queue;
+               }
+
                lpfc_nvmet_create_targetport(phba);
        } else {
                /* update host scsi xri-sgl sizes and mappings */
@@ -6894,28 +6956,34 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
                                        "and mapping: %d\n", rc);
                        goto out_destroy_queue;
                }
+
+               cnt = phba->cfg_iocb_cnt * 1024;
+               /* Initialize and populate the iocb list per host */
+               lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+                               "2820 initialize iocb list %d total %d\n",
+                               phba->cfg_iocb_cnt, cnt);
+               rc = lpfc_init_iocb_list(phba, cnt);
+               if (rc) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+                                       "6301 Failed to init iocb list.\n");
+                       goto out_destroy_queue;
+               }
        }
 
        if (phba->nvmet_support && phba->cfg_nvmet_mrq) {
-
                /* Post initial buffers to all RQs created */
                for (i = 0; i < phba->cfg_nvmet_mrq; i++) {
                        rqbp = phba->sli4_hba.nvmet_mrq_hdr[i]->rqbp;
                        INIT_LIST_HEAD(&rqbp->rqb_buffer_list);
                        rqbp->rqb_alloc_buffer = lpfc_sli4_nvmet_alloc;
                        rqbp->rqb_free_buffer = lpfc_sli4_nvmet_free;
-                       rqbp->entry_count = 256;
+                       rqbp->entry_count = LPFC_NVMET_RQE_DEF_COUNT;
                        rqbp->buffer_count = 0;
 
-                       /* Divide by 4 and round down to multiple of 16 */
-                       rc = (phba->cfg_nvmet_mrq_post >> 2) & 0xfff8;
-                       phba->sli4_hba.nvmet_mrq_hdr[i]->entry_repost = rc;
-                       phba->sli4_hba.nvmet_mrq_data[i]->entry_repost = rc;
-
                        lpfc_post_rq_buffer(
                                phba, phba->sli4_hba.nvmet_mrq_hdr[i],
                                phba->sli4_hba.nvmet_mrq_data[i],
-                               phba->cfg_nvmet_mrq_post);
+                               LPFC_NVMET_RQE_DEF_COUNT, i);
                }
        }
 
@@ -7082,6 +7150,7 @@ out_unset_queue:
        /* Unset all the queues set up in this routine when error out */
        lpfc_sli4_queue_unset(phba);
 out_destroy_queue:
+       lpfc_free_iocb_list(phba);
        lpfc_sli4_queue_destroy(phba);
 out_stop_timers:
        lpfc_stop_hba_timers(phba);
@@ -8621,8 +8690,11 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                memset(wqe, 0, sizeof(union lpfc_wqe128));
        /* Some of the fields are in the right position already */
        memcpy(wqe, &iocbq->iocb, sizeof(union lpfc_wqe));
-       wqe->generic.wqe_com.word7 = 0; /* The ct field has moved so reset */
-       wqe->generic.wqe_com.word10 = 0;
+       if (iocbq->iocb.ulpCommand != CMD_SEND_FRAME) {
+               /* The ct field has moved so reset */
+               wqe->generic.wqe_com.word7 = 0;
+               wqe->generic.wqe_com.word10 = 0;
+       }
 
        abort_tag = (uint32_t) iocbq->iotag;
        xritag = iocbq->sli4_xritag;
@@ -9116,6 +9188,10 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                }
 
                break;
+       case CMD_SEND_FRAME:
+               bf_set(wqe_xri_tag, &wqe->generic.wqe_com, xritag);
+               bf_set(wqe_reqtag, &wqe->generic.wqe_com, iocbq->iotag);
+               return 0;
        case CMD_XRI_ABORTED_CX:
        case CMD_CREATE_XRI_CR: /* Do we expect to use this? */
        case CMD_IOCB_FCP_IBIDIR64_CR: /* bidirectional xfer */
@@ -12788,6 +12864,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
        struct fc_frame_header *fc_hdr;
        struct lpfc_queue *hrq = phba->sli4_hba.hdr_rq;
        struct lpfc_queue *drq = phba->sli4_hba.dat_rq;
+       struct lpfc_nvmet_tgtport *tgtp;
        struct hbq_dmabuf *dma_buf;
        uint32_t status, rq_id;
        unsigned long iflags;
@@ -12808,7 +12885,6 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
        case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "2537 Receive Frame Truncated!!\n");
-               hrq->RQ_buf_trunc++;
        case FC_STATUS_RQ_SUCCESS:
                lpfc_sli4_rq_release(hrq, drq);
                spin_lock_irqsave(&phba->hbalock, iflags);
@@ -12819,6 +12895,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
                        goto out;
                }
                hrq->RQ_rcv_buf++;
+               hrq->RQ_buf_posted--;
                memcpy(&dma_buf->cq_event.cqe.rcqe_cmpl, rcqe, sizeof(*rcqe));
 
                /* If a NVME LS event (type 0x28), treat it as Fast path */
@@ -12832,8 +12909,21 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
                spin_unlock_irqrestore(&phba->hbalock, iflags);
                workposted = true;
                break;
-       case FC_STATUS_INSUFF_BUF_NEED_BUF:
        case FC_STATUS_INSUFF_BUF_FRM_DISC:
+               if (phba->nvmet_support) {
+                       tgtp = phba->targetport->private;
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_NVME,
+                                       "6402 RQE Error x%x, posted %d err_cnt "
+                                       "%d: %x %x %x\n",
+                                       status, hrq->RQ_buf_posted,
+                                       hrq->RQ_no_posted_buf,
+                                       atomic_read(&tgtp->rcv_fcp_cmd_in),
+                                       atomic_read(&tgtp->rcv_fcp_cmd_out),
+                                       atomic_read(&tgtp->xmt_fcp_release));
+               }
+               /* fallthrough */
+
+       case FC_STATUS_INSUFF_BUF_NEED_BUF:
                hrq->RQ_no_posted_buf++;
                /* Post more buffers if possible */
                spin_lock_irqsave(&phba->hbalock, iflags);
@@ -12951,7 +13041,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
                while ((cqe = lpfc_sli4_cq_get(cq))) {
                        workposted |= lpfc_sli4_sp_handle_mcqe(phba, cqe);
                        if (!(++ecount % cq->entry_repost))
-                               lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);
+                               break;
                        cq->CQ_mbox++;
                }
                break;
@@ -12965,7 +13055,7 @@ lpfc_sli4_sp_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe,
                                workposted |= lpfc_sli4_sp_handle_cqe(phba, cq,
                                                                      cqe);
                        if (!(++ecount % cq->entry_repost))
-                               lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);
+                               break;
                }
 
                /* Track the max number of CQEs processed in 1 EQ */
@@ -13135,6 +13225,7 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
        struct lpfc_queue *drq;
        struct rqb_dmabuf *dma_buf;
        struct fc_frame_header *fc_hdr;
+       struct lpfc_nvmet_tgtport *tgtp;
        uint32_t status, rq_id;
        unsigned long iflags;
        uint32_t fctl, idx;
@@ -13165,8 +13256,6 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
        case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "6126 Receive Frame Truncated!!\n");
-               hrq->RQ_buf_trunc++;
-               break;
        case FC_STATUS_RQ_SUCCESS:
                lpfc_sli4_rq_release(hrq, drq);
                spin_lock_irqsave(&phba->hbalock, iflags);
@@ -13178,6 +13267,7 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
                }
                spin_unlock_irqrestore(&phba->hbalock, iflags);
                hrq->RQ_rcv_buf++;
+               hrq->RQ_buf_posted--;
                fc_hdr = (struct fc_frame_header *)dma_buf->hbuf.virt;
 
                /* Just some basic sanity checks on FCP Command frame */
@@ -13200,14 +13290,23 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
 drop:
                lpfc_in_buf_free(phba, &dma_buf->dbuf);
                break;
-       case FC_STATUS_INSUFF_BUF_NEED_BUF:
        case FC_STATUS_INSUFF_BUF_FRM_DISC:
+               if (phba->nvmet_support) {
+                       tgtp = phba->targetport->private;
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_NVME,
+                                       "6401 RQE Error x%x, posted %d err_cnt "
+                                       "%d: %x %x %x\n",
+                                       status, hrq->RQ_buf_posted,
+                                       hrq->RQ_no_posted_buf,
+                                       atomic_read(&tgtp->rcv_fcp_cmd_in),
+                                       atomic_read(&tgtp->rcv_fcp_cmd_out),
+                                       atomic_read(&tgtp->xmt_fcp_release));
+               }
+               /* fallthrough */
+
+       case FC_STATUS_INSUFF_BUF_NEED_BUF:
                hrq->RQ_no_posted_buf++;
                /* Post more buffers if possible */
-               spin_lock_irqsave(&phba->hbalock, iflags);
-               phba->hba_flag |= HBA_POST_RECEIVE_BUFFER;
-               spin_unlock_irqrestore(&phba->hbalock, iflags);
-               workposted = true;
                break;
        }
 out:
@@ -13361,7 +13460,7 @@ process_cq:
        while ((cqe = lpfc_sli4_cq_get(cq))) {
                workposted |= lpfc_sli4_fp_handle_cqe(phba, cq, cqe);
                if (!(++ecount % cq->entry_repost))
-                       lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);
+                       break;
        }
 
        /* Track the max number of CQEs processed in 1 EQ */
@@ -13452,7 +13551,7 @@ lpfc_sli4_fof_handle_eqe(struct lpfc_hba *phba, struct lpfc_eqe *eqe)
        while ((cqe = lpfc_sli4_cq_get(cq))) {
                workposted |= lpfc_sli4_fp_handle_cqe(phba, cq, cqe);
                if (!(++ecount % cq->entry_repost))
-                       lpfc_sli4_cq_release(cq, LPFC_QUEUE_NOARM);
+                       break;
        }
 
        /* Track the max number of CQEs processed in 1 EQ */
@@ -13534,7 +13633,7 @@ lpfc_sli4_fof_intr_handler(int irq, void *dev_id)
        while ((eqe = lpfc_sli4_eq_get(eq))) {
                lpfc_sli4_fof_handle_eqe(phba, eqe);
                if (!(++ecount % eq->entry_repost))
-                       lpfc_sli4_eq_release(eq, LPFC_QUEUE_NOARM);
+                       break;
                eq->EQ_processed++;
        }
 
@@ -13651,7 +13750,7 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id)
 
                lpfc_sli4_hba_handle_eqe(phba, eqe, hba_eqidx);
                if (!(++ecount % fpeq->entry_repost))
-                       lpfc_sli4_eq_release(fpeq, LPFC_QUEUE_NOARM);
+                       break;
                fpeq->EQ_processed++;
        }
 
@@ -13832,17 +13931,10 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t entry_size,
        }
        queue->entry_size = entry_size;
        queue->entry_count = entry_count;
-
-       /*
-        * entry_repost is calculated based on the number of entries in the
-        * queue. This works out except for RQs. If buffers are NOT initially
-        * posted for every RQE, entry_repost should be adjusted accordingly.
-        */
-       queue->entry_repost = (entry_count >> 3);
-       if (queue->entry_repost < LPFC_QUEUE_MIN_REPOST)
-               queue->entry_repost = LPFC_QUEUE_MIN_REPOST;
        queue->phba = phba;
 
+       /* entry_repost will be set during q creation */
+
        return queue;
 out_fail:
        lpfc_sli4_queue_free(queue);
@@ -14073,6 +14165,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
                status = -ENXIO;
        eq->host_index = 0;
        eq->hba_index = 0;
+       eq->entry_repost = LPFC_EQ_REPOST;
 
        mempool_free(mbox, phba->mbox_mem_pool);
        return status;
@@ -14146,9 +14239,9 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
        default:
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "0361 Unsupported CQ count: "
-                               "entry cnt %d sz %d pg cnt %d repost %d\n",
+                               "entry cnt %d sz %d pg cnt %d\n",
                                cq->entry_count, cq->entry_size,
-                               cq->page_count, cq->entry_repost);
+                               cq->page_count);
                if (cq->entry_count < 256) {
                        status = -EINVAL;
                        goto out;
@@ -14201,6 +14294,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
        cq->assoc_qid = eq->queue_id;
        cq->host_index = 0;
        cq->hba_index = 0;
+       cq->entry_repost = LPFC_CQ_REPOST;
 
 out:
        mempool_free(mbox, phba->mbox_mem_pool);
@@ -14392,6 +14486,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
                cq->assoc_qid = eq->queue_id;
                cq->host_index = 0;
                cq->hba_index = 0;
+               cq->entry_repost = LPFC_CQ_REPOST;
 
                rc = 0;
                list_for_each_entry(dmabuf, &cq->page_list, list) {
@@ -14640,6 +14735,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
        mq->subtype = subtype;
        mq->host_index = 0;
        mq->hba_index = 0;
+       mq->entry_repost = LPFC_MQ_REPOST;
 
        /* link the mq onto the parent cq child list */
        list_add_tail(&mq->list, &cq->child_list);
@@ -14864,34 +14960,6 @@ out:
        return status;
 }
 
-/**
- * lpfc_rq_adjust_repost - Adjust entry_repost for an RQ
- * @phba: HBA structure that indicates port to create a queue on.
- * @rq:   The queue structure to use for the receive queue.
- * @qno:  The associated HBQ number
- *
- *
- * For SLI4 we need to adjust the RQ repost value based on
- * the number of buffers that are initially posted to the RQ.
- */
-void
-lpfc_rq_adjust_repost(struct lpfc_hba *phba, struct lpfc_queue *rq, int qno)
-{
-       uint32_t cnt;
-
-       /* sanity check on queue memory */
-       if (!rq)
-               return;
-       cnt = lpfc_hbq_defs[qno]->entry_count;
-
-       /* Recalc repost for RQs based on buffers initially posted */
-       cnt = (cnt >> 3);
-       if (cnt < LPFC_QUEUE_MIN_REPOST)
-               cnt = LPFC_QUEUE_MIN_REPOST;
-
-       rq->entry_repost = cnt;
-}
-
 /**
  * lpfc_rq_create - Create a Receive Queue on the HBA
  * @phba: HBA structure that indicates port to create a queue on.
@@ -15077,6 +15145,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
        hrq->subtype = subtype;
        hrq->host_index = 0;
        hrq->hba_index = 0;
+       hrq->entry_repost = LPFC_RQ_REPOST;
 
        /* now create the data queue */
        lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,
@@ -15087,7 +15156,12 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
        if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) {
                bf_set(lpfc_rq_context_rqe_count_1,
                       &rq_create->u.request.context, hrq->entry_count);
-               rq_create->u.request.context.buffer_size = LPFC_DATA_BUF_SIZE;
+               if (subtype == LPFC_NVMET)
+                       rq_create->u.request.context.buffer_size =
+                               LPFC_NVMET_DATA_BUF_SIZE;
+               else
+                       rq_create->u.request.context.buffer_size =
+                               LPFC_DATA_BUF_SIZE;
                bf_set(lpfc_rq_context_rqe_size, &rq_create->u.request.context,
                       LPFC_RQE_SIZE_8);
                bf_set(lpfc_rq_context_page_size, &rq_create->u.request.context,
@@ -15124,8 +15198,14 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
                               LPFC_RQ_RING_SIZE_4096);
                        break;
                }
-               bf_set(lpfc_rq_context_buf_size, &rq_create->u.request.context,
-                      LPFC_DATA_BUF_SIZE);
+               if (subtype == LPFC_NVMET)
+                       bf_set(lpfc_rq_context_buf_size,
+                              &rq_create->u.request.context,
+                              LPFC_NVMET_DATA_BUF_SIZE);
+               else
+                       bf_set(lpfc_rq_context_buf_size,
+                              &rq_create->u.request.context,
+                              LPFC_DATA_BUF_SIZE);
        }
        bf_set(lpfc_rq_context_cq_id, &rq_create->u.request.context,
               cq->queue_id);
@@ -15158,6 +15238,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
        drq->subtype = subtype;
        drq->host_index = 0;
        drq->hba_index = 0;
+       drq->entry_repost = LPFC_RQ_REPOST;
 
        /* link the header and data RQs onto the parent cq child list */
        list_add_tail(&hrq->list, &cq->child_list);
@@ -15270,7 +15351,7 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
                               cq->queue_id);
                        bf_set(lpfc_rq_context_data_size,
                               &rq_create->u.request.context,
-                              LPFC_DATA_BUF_SIZE);
+                              LPFC_NVMET_DATA_BUF_SIZE);
                        bf_set(lpfc_rq_context_hdr_size,
                               &rq_create->u.request.context,
                               LPFC_HDR_BUF_SIZE);
@@ -15315,6 +15396,7 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
                hrq->subtype = subtype;
                hrq->host_index = 0;
                hrq->hba_index = 0;
+               hrq->entry_repost = LPFC_RQ_REPOST;
 
                drq->db_format = LPFC_DB_RING_FORMAT;
                drq->db_regaddr = phba->sli4_hba.RQDBregaddr;
@@ -15323,6 +15405,7 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
                drq->subtype = subtype;
                drq->host_index = 0;
                drq->hba_index = 0;
+               drq->entry_repost = LPFC_RQ_REPOST;
 
                list_add_tail(&hrq->list, &cq->child_list);
                list_add_tail(&drq->list, &cq->child_list);
@@ -16063,6 +16146,8 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr)
        struct fc_vft_header *fc_vft_hdr;
        uint32_t *header = (uint32_t *) fc_hdr;
 
+#define FC_RCTL_MDS_DIAGS      0xF4
+
        switch (fc_hdr->fh_r_ctl) {
        case FC_RCTL_DD_UNCAT:          /* uncategorized information */
        case FC_RCTL_DD_SOL_DATA:       /* solicited data */
@@ -16090,6 +16175,7 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr)
        case FC_RCTL_F_BSY:     /* fabric busy to data frame */
        case FC_RCTL_F_BSYL:    /* fabric busy to link control frame */
        case FC_RCTL_LCR:       /* link credit reset */
+       case FC_RCTL_MDS_DIAGS: /* MDS Diagnostics */
        case FC_RCTL_END:       /* end */
                break;
        case FC_RCTL_VFTH:      /* Virtual Fabric tagging Header */
@@ -16099,12 +16185,16 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr)
        default:
                goto drop;
        }
+
+#define FC_TYPE_VENDOR_UNIQUE  0xFF
+
        switch (fc_hdr->fh_type) {
        case FC_TYPE_BLS:
        case FC_TYPE_ELS:
        case FC_TYPE_FCP:
        case FC_TYPE_CT:
        case FC_TYPE_NVME:
+       case FC_TYPE_VENDOR_UNIQUE:
                break;
        case FC_TYPE_IP:
        case FC_TYPE_ILS:
@@ -16115,12 +16205,14 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr)
        lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
                        "2538 Received frame rctl:%s (x%x), type:%s (x%x), "
                        "frame Data:%08x %08x %08x %08x %08x %08x %08x\n",
+                       (fc_hdr->fh_r_ctl == FC_RCTL_MDS_DIAGS) ? "MDS Diags" :
                        lpfc_rctl_names[fc_hdr->fh_r_ctl], fc_hdr->fh_r_ctl,
-                       lpfc_type_names[fc_hdr->fh_type], fc_hdr->fh_type,
-                       be32_to_cpu(header[0]), be32_to_cpu(header[1]),
-                       be32_to_cpu(header[2]), be32_to_cpu(header[3]),
-                       be32_to_cpu(header[4]), be32_to_cpu(header[5]),
-                       be32_to_cpu(header[6]));
+                       (fc_hdr->fh_type == FC_TYPE_VENDOR_UNIQUE) ?
+                       "Vendor Unique" : lpfc_type_names[fc_hdr->fh_type],
+                       fc_hdr->fh_type, be32_to_cpu(header[0]),
+                       be32_to_cpu(header[1]), be32_to_cpu(header[2]),
+                       be32_to_cpu(header[3]), be32_to_cpu(header[4]),
+                       be32_to_cpu(header[5]), be32_to_cpu(header[6]));
        return 0;
 drop:
        lpfc_printf_log(phba, KERN_WARNING, LOG_ELS,
@@ -16926,6 +17018,96 @@ lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *vport,
        lpfc_sli_release_iocbq(phba, iocbq);
 }
 
+static void
+lpfc_sli4_mds_loopback_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
+                           struct lpfc_iocbq *rspiocb)
+{
+       struct lpfc_dmabuf *pcmd = cmdiocb->context2;
+
+       if (pcmd && pcmd->virt)
+               pci_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);
+       kfree(pcmd);
+       lpfc_sli_release_iocbq(phba, cmdiocb);
+}
+
+static void
+lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport,
+                             struct hbq_dmabuf *dmabuf)
+{
+       struct fc_frame_header *fc_hdr;
+       struct lpfc_hba *phba = vport->phba;
+       struct lpfc_iocbq *iocbq = NULL;
+       union  lpfc_wqe *wqe;
+       struct lpfc_dmabuf *pcmd = NULL;
+       uint32_t frame_len;
+       int rc;
+
+       fc_hdr = (struct fc_frame_header *)dmabuf->hbuf.virt;
+       frame_len = bf_get(lpfc_rcqe_length, &dmabuf->cq_event.cqe.rcqe_cmpl);
+
+       /* Send the received frame back */
+       iocbq = lpfc_sli_get_iocbq(phba);
+       if (!iocbq)
+               goto exit;
+
+       /* Allocate buffer for command payload */
+       pcmd = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
+       if (pcmd)
+               pcmd->virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
+                                           &pcmd->phys);
+       if (!pcmd || !pcmd->virt)
+               goto exit;
+
+       INIT_LIST_HEAD(&pcmd->list);
+
+       /* copyin the payload */
+       memcpy(pcmd->virt, dmabuf->dbuf.virt, frame_len);
+
+       /* fill in BDE's for command */
+       iocbq->iocb.un.xseq64.bdl.addrHigh = putPaddrHigh(pcmd->phys);
+       iocbq->iocb.un.xseq64.bdl.addrLow = putPaddrLow(pcmd->phys);
+       iocbq->iocb.un.xseq64.bdl.bdeFlags = BUFF_TYPE_BDE_64;
+       iocbq->iocb.un.xseq64.bdl.bdeSize = frame_len;
+
+       iocbq->context2 = pcmd;
+       iocbq->vport = vport;
+       iocbq->iocb_flag &= ~LPFC_FIP_ELS_ID_MASK;
+       iocbq->iocb_flag |= LPFC_USE_FCPWQIDX;
+
+       /*
+        * Setup rest of the iocb as though it were a WQE
+        * Build the SEND_FRAME WQE
+        */
+       wqe = (union lpfc_wqe *)&iocbq->iocb;
+
+       wqe->send_frame.frame_len = frame_len;
+       wqe->send_frame.fc_hdr_wd0 = be32_to_cpu(*((uint32_t *)fc_hdr));
+       wqe->send_frame.fc_hdr_wd1 = be32_to_cpu(*((uint32_t *)fc_hdr + 1));
+       wqe->send_frame.fc_hdr_wd2 = be32_to_cpu(*((uint32_t *)fc_hdr + 2));
+       wqe->send_frame.fc_hdr_wd3 = be32_to_cpu(*((uint32_t *)fc_hdr + 3));
+       wqe->send_frame.fc_hdr_wd4 = be32_to_cpu(*((uint32_t *)fc_hdr + 4));
+       wqe->send_frame.fc_hdr_wd5 = be32_to_cpu(*((uint32_t *)fc_hdr + 5));
+
+       iocbq->iocb.ulpCommand = CMD_SEND_FRAME;
+       iocbq->iocb.ulpLe = 1;
+       iocbq->iocb_cmpl = lpfc_sli4_mds_loopback_cmpl;
+       rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, iocbq, 0);
+       if (rc == IOCB_ERROR)
+               goto exit;
+
+       lpfc_in_buf_free(phba, &dmabuf->dbuf);
+       return;
+
+exit:
+       lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
+                       "2023 Unable to process MDS loopback frame\n");
+       if (pcmd && pcmd->virt)
+               pci_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);
+       kfree(pcmd);
+       lpfc_sli_release_iocbq(phba, iocbq);
+       lpfc_in_buf_free(phba, &dmabuf->dbuf);
+}
+
 /**
  * lpfc_sli4_handle_received_buffer - Handle received buffers from firmware
  * @phba: Pointer to HBA context object.
@@ -16964,6 +17146,13 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba,
                fcfi = bf_get(lpfc_rcqe_fcf_id,
                              &dmabuf->cq_event.cqe.rcqe_cmpl);
 
+       if (fc_hdr->fh_r_ctl == 0xF4 && fc_hdr->fh_type == 0xFF) {
+               vport = phba->pport;
+               /* Handle MDS Loopback frames */
+               lpfc_sli4_handle_mds_loopback(vport, dmabuf);
+               return;
+       }
+
        /* d_id this frame is directed to */
        did = sli4_did_from_fc_hdr(fc_hdr);
 
@@ -17137,6 +17326,14 @@ lpfc_sli4_post_rpi_hdr(struct lpfc_hba *phba, struct lpfc_rpi_hdr *rpi_page)
                                "status x%x add_status x%x, mbx status x%x\n",
                                shdr_status, shdr_add_status, rc);
                rc = -ENXIO;
+       } else {
+               /*
+                * The next_rpi stores the next logical module-64 rpi value used
+                * to post physical rpis in subsequent rpi postings.
+                */
+               spin_lock_irq(&phba->hbalock);
+               phba->sli4_hba.next_rpi = rpi_page->next_rpi;
+               spin_unlock_irq(&phba->hbalock);
        }
        return rc;
 }
@@ -18717,7 +18914,7 @@ lpfc_sli4_issue_wqe(struct lpfc_hba *phba, uint32_t ring_number,
 
                spin_lock_irqsave(&pring->ring_lock, iflags);
                ctxp = pwqe->context2;
-               sglq = ctxp->rqb_buffer->sglq;
+               sglq = ctxp->ctxbuf->sglq;
                if (pwqe->sli4_xritag ==  NO_XRI) {
                        pwqe->sli4_lxritag = sglq->sli4_lxritag;
                        pwqe->sli4_xritag = sglq->sli4_xritag;
index da46471337c8a7e3b6c38164bc4afe1a4f0087c2..cf863db27700a2400463bcc65777ec15f9806da4 100644 (file)
@@ -24,7 +24,6 @@
 #define LPFC_XRI_EXCH_BUSY_WAIT_TMO            10000
 #define LPFC_XRI_EXCH_BUSY_WAIT_T1             10
 #define LPFC_XRI_EXCH_BUSY_WAIT_T2              30000
-#define LPFC_RELEASE_NOTIFICATION_INTERVAL     32
 #define LPFC_RPI_LOW_WATER_MARK                        10
 
 #define LPFC_UNREG_FCF                          1
@@ -155,7 +154,11 @@ struct lpfc_queue {
        uint32_t entry_count;   /* Number of entries to support on the queue */
        uint32_t entry_size;    /* Size of each queue entry. */
        uint32_t entry_repost;  /* Count of entries before doorbell is rung */
-#define LPFC_QUEUE_MIN_REPOST  8
+#define LPFC_EQ_REPOST         8
+#define LPFC_MQ_REPOST         8
+#define LPFC_CQ_REPOST         64
+#define LPFC_RQ_REPOST         64
+#define LPFC_RELEASE_NOTIFICATION_INTERVAL     32  /* For WQs */
        uint32_t queue_id;      /* Queue ID assigned by the hardware */
        uint32_t assoc_qid;     /* Queue ID associated with, for CQ/WQ/MQ */
        uint32_t page_count;    /* Number of pages allocated for this queue */
@@ -195,7 +198,7 @@ struct lpfc_queue {
 /* defines for RQ stats */
 #define        RQ_no_posted_buf        q_cnt_1
 #define        RQ_no_buf_found         q_cnt_2
-#define        RQ_buf_trunc            q_cnt_3
+#define        RQ_buf_posted           q_cnt_3
 #define        RQ_rcv_buf              q_cnt_4
 
        uint64_t isr_timestamp;
@@ -617,12 +620,17 @@ struct lpfc_sli4_hba {
        uint16_t scsi_xri_start;
        uint16_t els_xri_cnt;
        uint16_t nvmet_xri_cnt;
+       uint16_t nvmet_ctx_cnt;
+       uint16_t nvmet_io_wait_cnt;
+       uint16_t nvmet_io_wait_total;
        struct list_head lpfc_els_sgl_list;
        struct list_head lpfc_abts_els_sgl_list;
        struct list_head lpfc_nvmet_sgl_list;
        struct list_head lpfc_abts_nvmet_ctx_list;
        struct list_head lpfc_abts_scsi_buf_list;
        struct list_head lpfc_abts_nvme_buf_list;
+       struct list_head lpfc_nvmet_ctx_list;
+       struct list_head lpfc_nvmet_io_wait_list;
        struct lpfc_sglq **lpfc_sglq_active_list;
        struct list_head lpfc_rpi_hdr_list;
        unsigned long *rpi_bmask;
@@ -654,6 +662,7 @@ struct lpfc_sli4_hba {
        spinlock_t abts_scsi_buf_list_lock; /* list of aborted SCSI IOs */
        spinlock_t sgl_list_lock; /* list of aborted els IOs */
        spinlock_t nvmet_io_lock;
+       spinlock_t nvmet_io_wait_lock; /* IOs waiting for ctx resources */
        uint32_t physical_port;
 
        /* CPU to vector mapping information */
@@ -661,8 +670,6 @@ struct lpfc_sli4_hba {
        uint16_t num_online_cpu;
        uint16_t num_present_cpu;
        uint16_t curr_disp_cpu;
-
-       uint16_t nvmet_mrq_post_idx;
 };
 
 enum lpfc_sge_type {
@@ -698,6 +705,7 @@ struct lpfc_rpi_hdr {
        struct lpfc_dmabuf *dmabuf;
        uint32_t page_count;
        uint32_t start_rpi;
+       uint16_t next_rpi;
 };
 
 struct lpfc_rsrc_blks {
@@ -762,7 +770,6 @@ int lpfc_rq_create(struct lpfc_hba *, struct lpfc_queue *,
 int lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
                        struct lpfc_queue **drqp, struct lpfc_queue **cqp,
                        uint32_t subtype);
-void lpfc_rq_adjust_repost(struct lpfc_hba *, struct lpfc_queue *, int);
 int lpfc_eq_destroy(struct lpfc_hba *, struct lpfc_queue *);
 int lpfc_cq_destroy(struct lpfc_hba *, struct lpfc_queue *);
 int lpfc_mq_destroy(struct lpfc_hba *, struct lpfc_queue *);
index 1c26dc67151b65e050b729e63a0871cb6846564f..c2653244221cb1b2cb987d962686daeed43094c3 100644 (file)
@@ -20,7 +20,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "11.2.0.12"
+#define LPFC_DRIVER_VERSION "11.2.0.14"
 #define LPFC_DRIVER_NAME               "lpfc"
 
 /* Used for SLI 2/3 */
index e31f1cc90b815b28a332d1a6915c82e19519a62f..99e16ac479e365d343840f44c9f7b0c50b4042cc 100644 (file)
@@ -1851,7 +1851,7 @@ static int scsi_mq_prep_fn(struct request *req)
 
        /* zero out the cmd, except for the embedded scsi_request */
        memset((char *)cmd + sizeof(cmd->req), 0,
-               sizeof(*cmd) - sizeof(cmd->req));
+               sizeof(*cmd) - sizeof(cmd->req) + shost->hostt->cmd_size);
 
        req->special = cmd;
 
index f9d1432d7cc589360354c9d3fdbe4c0967e23ee6..b6bb4e0ce0e3288f321ef1319621063f02d6c868 100644 (file)
@@ -827,21 +827,32 @@ static int sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd)
        struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
        u64 sector = blk_rq_pos(rq) >> (ilog2(sdp->sector_size) - 9);
        u32 nr_sectors = blk_rq_sectors(rq) >> (ilog2(sdp->sector_size) - 9);
+       int ret;
 
        if (!(rq->cmd_flags & REQ_NOUNMAP)) {
                switch (sdkp->zeroing_mode) {
                case SD_ZERO_WS16_UNMAP:
-                       return sd_setup_write_same16_cmnd(cmd, true);
+                       ret = sd_setup_write_same16_cmnd(cmd, true);
+                       goto out;
                case SD_ZERO_WS10_UNMAP:
-                       return sd_setup_write_same10_cmnd(cmd, true);
+                       ret = sd_setup_write_same10_cmnd(cmd, true);
+                       goto out;
                }
        }
 
        if (sdp->no_write_same)
                return BLKPREP_INVALID;
+
        if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff)
-               return sd_setup_write_same16_cmnd(cmd, false);
-       return sd_setup_write_same10_cmnd(cmd, false);
+               ret = sd_setup_write_same16_cmnd(cmd, false);
+       else
+               ret = sd_setup_write_same10_cmnd(cmd, false);
+
+out:
+       if (sd_is_zoned(sdkp) && ret == BLKPREP_OK)
+               return sd_zbc_write_lock_zone(cmd);
+
+       return ret;
 }
 
 static void sd_config_write_same(struct scsi_disk *sdkp)
@@ -948,6 +959,10 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
        rq->__data_len = sdp->sector_size;
        ret = scsi_init_io(cmd);
        rq->__data_len = nr_bytes;
+
+       if (sd_is_zoned(sdkp) && ret != BLKPREP_OK)
+               sd_zbc_write_unlock_zone(cmd);
+
        return ret;
 }
 
@@ -1567,17 +1582,21 @@ out:
        return retval;
 }
 
-static int sd_sync_cache(struct scsi_disk *sdkp)
+static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
 {
        int retries, res;
        struct scsi_device *sdp = sdkp->device;
        const int timeout = sdp->request_queue->rq_timeout
                * SD_FLUSH_TIMEOUT_MULTIPLIER;
-       struct scsi_sense_hdr sshdr;
+       struct scsi_sense_hdr my_sshdr;
 
        if (!scsi_device_online(sdp))
                return -ENODEV;
 
+       /* caller might not be interested in sense, but we need it */
+       if (!sshdr)
+               sshdr = &my_sshdr;
+
        for (retries = 3; retries > 0; --retries) {
                unsigned char cmd[10] = { 0 };
 
@@ -1586,7 +1605,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
                 * Leave the rest of the command zero to indicate
                 * flush everything.
                 */
-               res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
+               res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr,
                                timeout, SD_MAX_RETRIES, 0, RQF_PM, NULL);
                if (res == 0)
                        break;
@@ -1596,11 +1615,12 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
                sd_print_result(sdkp, "Synchronize Cache(10) failed", res);
 
                if (driver_byte(res) & DRIVER_SENSE)
-                       sd_print_sense_hdr(sdkp, &sshdr);
+                       sd_print_sense_hdr(sdkp, sshdr);
+
                /* we need to evaluate the error return  */
-               if (scsi_sense_valid(&sshdr) &&
-                       (sshdr.asc == 0x3a ||   /* medium not present */
-                        sshdr.asc == 0x20))    /* invalid command */
+               if (scsi_sense_valid(sshdr) &&
+                       (sshdr->asc == 0x3a ||  /* medium not present */
+                        sshdr->asc == 0x20))   /* invalid command */
                                /* this is no error here */
                                return 0;
 
@@ -3444,7 +3464,7 @@ static void sd_shutdown(struct device *dev)
 
        if (sdkp->WCE && sdkp->media_present) {
                sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
-               sd_sync_cache(sdkp);
+               sd_sync_cache(sdkp, NULL);
        }
 
        if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
@@ -3456,6 +3476,7 @@ static void sd_shutdown(struct device *dev)
 static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
 {
        struct scsi_disk *sdkp = dev_get_drvdata(dev);
+       struct scsi_sense_hdr sshdr;
        int ret = 0;
 
        if (!sdkp)      /* E.g.: runtime suspend following sd_remove() */
@@ -3463,12 +3484,23 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
 
        if (sdkp->WCE && sdkp->media_present) {
                sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
-               ret = sd_sync_cache(sdkp);
+               ret = sd_sync_cache(sdkp, &sshdr);
+
                if (ret) {
                        /* ignore OFFLINE device */
                        if (ret == -ENODEV)
-                               ret = 0;
-                       goto done;
+                               return 0;
+
+                       if (!scsi_sense_valid(&sshdr) ||
+                           sshdr.sense_key != ILLEGAL_REQUEST)
+                               return ret;
+
+                       /*
+                        * sshdr.sense_key == ILLEGAL_REQUEST means this drive
+                        * doesn't support sync. There's not much to do and
+                        * suspend shouldn't fail.
+                        */
+                        ret = 0;
                }
        }
 
@@ -3480,7 +3512,6 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
                        ret = 0;
        }
 
-done:
        return ret;
 }
 
index 0a38ba01b7b4aac2151faf88421c8f2645dbd86a..82c33a6edbeaa7a00e6f7840ef4b5d8cdb8a084f 100644 (file)
@@ -2074,11 +2074,12 @@ sg_get_rq_mark(Sg_fd * sfp, int pack_id)
                if ((1 == resp->done) && (!resp->sg_io_owned) &&
                    ((-1 == pack_id) || (resp->header.pack_id == pack_id))) {
                        resp->done = 2; /* guard against other readers */
-                       break;
+                       write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
+                       return resp;
                }
        }
        write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
-       return resp;
+       return NULL;
 }
 
 /* always adds to end of list */
index abc7e87937cc3087617ca404dc73b01b39ff7822..ffe8d86088181c7da9c30ad58986418842f7016d 100644 (file)
@@ -7698,6 +7698,12 @@ static inline void ufshcd_add_sysfs_nodes(struct ufs_hba *hba)
        ufshcd_add_spm_lvl_sysfs_nodes(hba);
 }
 
+static inline void ufshcd_remove_sysfs_nodes(struct ufs_hba *hba)
+{
+       device_remove_file(hba->dev, &hba->rpm_lvl_attr);
+       device_remove_file(hba->dev, &hba->spm_lvl_attr);
+}
+
 /**
  * ufshcd_shutdown - shutdown routine
  * @hba: per adapter instance
@@ -7735,6 +7741,7 @@ EXPORT_SYMBOL(ufshcd_shutdown);
  */
 void ufshcd_remove(struct ufs_hba *hba)
 {
+       ufshcd_remove_sysfs_nodes(hba);
        scsi_remove_host(hba->host);
        /* disable interrupts */
        ufshcd_disable_intr(hba, hba->intr_mask);
index ab08af4654ef18c05d1ab9725dd96fb44f9264bf..42c098e86f849393eeb580e85fef1f93a14bdac7 100644 (file)
@@ -9,8 +9,9 @@ config BCM2835_THERMAL
 config BCM_NS_THERMAL
        tristate "Northstar thermal driver"
        depends on ARCH_BCM_IPROC || COMPILE_TEST
+       default y if ARCH_BCM_IPROC
        help
-         Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
-         BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
-         with a thermal sensor that allows checking CPU temperature. This
-         driver provides support for it.
+         Support for the Northstar and Northstar Plus family of SoCs (e.g.
+         BCM4708, BCM4709, BCM5301x, BCM95852X, etc). It contains DMU (Device
+         Management Unit) block with a thermal sensor that allows checking CPU
+         temperature.
index 644ba526d9ea09d2b1d0525cbf298cf10893cad0..4362a69ac88dcff8573e88e16fd6f3653432dd68 100644 (file)
@@ -195,7 +195,6 @@ static struct thermal_zone_of_device_ops tmu_tz_ops = {
 static int qoriq_tmu_probe(struct platform_device *pdev)
 {
        int ret;
-       const struct thermal_trip *trip;
        struct qoriq_tmu_data *data;
        struct device_node *np = pdev->dev.of_node;
        u32 site = 0;
@@ -243,8 +242,6 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
                goto err_tmu;
        }
 
-       trip = of_thermal_get_trip_points(data->tz);
-
        /* Enable monitoring */
        site |= 0x1 << (15 - data->sensor_id);
        tmu_write(data, site | TMR_ME | TMR_ALPF, &data->regs->tmr);
index b21b9cc2c8d6412897193a4ce53e295966737e9c..5a51c740e37238b31b9883d689aa67ffaea15704 100644 (file)
@@ -359,7 +359,7 @@ static DECLARE_DELAYED_WORK(thermal_emergency_poweroff_work,
  * This may be called from any critical situation to trigger a system shutdown
  * after a known period of time. By default this is not scheduled.
  */
-void thermal_emergency_poweroff(void)
+static void thermal_emergency_poweroff(void)
 {
        int poweroff_delay_ms = CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS;
        /*
index ba9c302454fb398490046be46831c0a0f821788c..696ab3046b87d98cff65182f60499c98578175bd 100644 (file)
@@ -1010,7 +1010,7 @@ ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
 }
 
 /**
- * ti_bandgap_set_continous_mode() - One time enabling of continuous mode
+ * ti_bandgap_set_continuous_mode() - One time enabling of continuous mode
  * @bgp: pointer to struct ti_bandgap
  *
  * Call this function only if HAS(MODE_CONFIG) is set. As this driver may
@@ -1214,22 +1214,18 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
        }
 
        bgp = devm_kzalloc(&pdev->dev, sizeof(*bgp), GFP_KERNEL);
-       if (!bgp) {
-               dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
+       if (!bgp)
                return ERR_PTR(-ENOMEM);
-       }
 
        of_id = of_match_device(of_ti_bandgap_match, &pdev->dev);
        if (of_id)
                bgp->conf = of_id->data;
 
        /* register shadow for context save and restore */
-       bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
-                                  bgp->conf->sensor_count, GFP_KERNEL);
-       if (!bgp->regval) {
-               dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
+       bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,
+                                  sizeof(*bgp->regval), GFP_KERNEL);
+       if (!bgp->regval)
                return ERR_PTR(-ENOMEM);
-       }
 
        i = 0;
        do {
index 7ac9bcdf1e61a551bb8286a48c0afc492e4a95ee..61fe8d6fd24e1bb0cf2cdfd2a4de67ceb05123bf 100644 (file)
@@ -764,7 +764,7 @@ static int __init ehv_bc_init(void)
        ehv_bc_driver = alloc_tty_driver(count);
        if (!ehv_bc_driver) {
                ret = -ENOMEM;
-               goto error;
+               goto err_free_bcs;
        }
 
        ehv_bc_driver->driver_name = "ehv-bc";
@@ -778,24 +778,23 @@ static int __init ehv_bc_init(void)
        ret = tty_register_driver(ehv_bc_driver);
        if (ret) {
                pr_err("ehv-bc: could not register tty driver (ret=%i)\n", ret);
-               goto error;
+               goto err_put_tty_driver;
        }
 
        ret = platform_driver_register(&ehv_bc_tty_driver);
        if (ret) {
                pr_err("ehv-bc: could not register platform driver (ret=%i)\n",
                       ret);
-               goto error;
+               goto err_deregister_tty_driver;
        }
 
        return 0;
 
-error:
-       if (ehv_bc_driver) {
-               tty_unregister_driver(ehv_bc_driver);
-               put_tty_driver(ehv_bc_driver);
-       }
-
+err_deregister_tty_driver:
+       tty_unregister_driver(ehv_bc_driver);
+err_put_tty_driver:
+       put_tty_driver(ehv_bc_driver);
+err_free_bcs:
        kfree(bcs);
 
        return ret;
index 433de5ea9b02f53386b9367e64ad880ac6795e07..f71b47334149ace03ff276e41d8ecfd2a7038c6e 100644 (file)
@@ -122,6 +122,18 @@ void serdev_device_write_wakeup(struct serdev_device *serdev)
 }
 EXPORT_SYMBOL_GPL(serdev_device_write_wakeup);
 
+int serdev_device_write_buf(struct serdev_device *serdev,
+                           const unsigned char *buf, size_t count)
+{
+       struct serdev_controller *ctrl = serdev->ctrl;
+
+       if (!ctrl || !ctrl->ops->write_buf)
+               return -EINVAL;
+
+       return ctrl->ops->write_buf(ctrl, buf, count);
+}
+EXPORT_SYMBOL_GPL(serdev_device_write_buf);
+
 int serdev_device_write(struct serdev_device *serdev,
                        const unsigned char *buf, size_t count,
                        unsigned long timeout)
index 487c88f6aa0e36b5f986f5c02477e65f0f55143c..d0a021c93986252ceae888d7c26bde3eba295e9e 100644 (file)
@@ -102,9 +102,6 @@ static int ttyport_open(struct serdev_controller *ctrl)
                return PTR_ERR(tty);
        serport->tty = tty;
 
-       serport->port->client_ops = &client_ops;
-       serport->port->client_data = ctrl;
-
        if (tty->ops->open)
                tty->ops->open(serport->tty, NULL);
        else
@@ -215,6 +212,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
                                        struct device *parent,
                                        struct tty_driver *drv, int idx)
 {
+       const struct tty_port_client_operations *old_ops;
        struct serdev_controller *ctrl;
        struct serport *serport;
        int ret;
@@ -233,28 +231,37 @@ struct device *serdev_tty_port_register(struct tty_port *port,
 
        ctrl->ops = &ctrl_ops;
 
+       old_ops = port->client_ops;
+       port->client_ops = &client_ops;
+       port->client_data = ctrl;
+
        ret = serdev_controller_add(ctrl);
        if (ret)
-               goto err_controller_put;
+               goto err_reset_data;
 
        dev_info(&ctrl->dev, "tty port %s%d registered\n", drv->name, idx);
        return &ctrl->dev;
 
-err_controller_put:
+err_reset_data:
+       port->client_data = NULL;
+       port->client_ops = old_ops;
        serdev_controller_put(ctrl);
+
        return ERR_PTR(ret);
 }
 
-void serdev_tty_port_unregister(struct tty_port *port)
+int serdev_tty_port_unregister(struct tty_port *port)
 {
        struct serdev_controller *ctrl = port->client_data;
        struct serport *serport = serdev_controller_get_drvdata(ctrl);
 
        if (!serport)
-               return;
+               return -ENODEV;
 
        serdev_controller_remove(ctrl);
        port->client_ops = NULL;
        port->client_data = NULL;
        serdev_controller_put(ctrl);
+
+       return 0;
 }
index 09a65a3ec7f7df0bb3f7355fd7758d797169f960..68fd045a7025047726860547ecd661b95d61ac80 100644 (file)
@@ -47,6 +47,7 @@
 /*
  * These are definitions for the Exar XR17V35X and XR17(C|D)15X
  */
+#define UART_EXAR_INT0         0x80
 #define UART_EXAR_SLEEP                0x8b    /* Sleep mode */
 #define UART_EXAR_DVID         0x8d    /* Device identification */
 
@@ -1337,7 +1338,7 @@ out_lock:
        /*
         * Check if the device is a Fintek F81216A
         */
-       if (port->type == PORT_16550A)
+       if (port->type == PORT_16550A && port->iotype == UPIO_PORT)
                fintek_8250_probe(up);
 
        if (up->capabilities != old_capabilities) {
@@ -1869,17 +1870,13 @@ static int serial8250_default_handle_irq(struct uart_port *port)
 static int exar_handle_irq(struct uart_port *port)
 {
        unsigned int iir = serial_port_in(port, UART_IIR);
-       int ret;
+       int ret = 0;
 
-       ret = serial8250_handle_irq(port, iir);
+       if (((port->type == PORT_XR17V35X) || (port->type == PORT_XR17D15X)) &&
+           serial_port_in(port, UART_EXAR_INT0) != 0)
+               ret = 1;
 
-       if ((port->type == PORT_XR17V35X) ||
-          (port->type == PORT_XR17D15X)) {
-               serial_port_in(port, 0x80);
-               serial_port_in(port, 0x81);
-               serial_port_in(port, 0x82);
-               serial_port_in(port, 0x83);
-       }
+       ret |= serial8250_handle_irq(port, iir);
 
        return ret;
 }
@@ -2177,6 +2174,8 @@ int serial8250_do_startup(struct uart_port *port)
        serial_port_in(port, UART_RX);
        serial_port_in(port, UART_IIR);
        serial_port_in(port, UART_MSR);
+       if ((port->type == PORT_XR17V35X) || (port->type == PORT_XR17D15X))
+               serial_port_in(port, UART_EXAR_INT0);
 
        /*
         * At this point, there's no way the LSR could still be 0xff;
@@ -2335,6 +2334,8 @@ dont_test_tx_en:
        serial_port_in(port, UART_RX);
        serial_port_in(port, UART_IIR);
        serial_port_in(port, UART_MSR);
+       if ((port->type == PORT_XR17V35X) || (port->type == PORT_XR17D15X))
+               serial_port_in(port, UART_EXAR_INT0);
        up->lsr_saved_flags = 0;
        up->msr_saved_flags = 0;
 
index 18e3f8342b8554ae4e7d414dd39653fb3a33b26f..0475f5d261cef6ee60f7bcd2e9cde6572a520c46 100644 (file)
@@ -478,6 +478,7 @@ static int altera_jtaguart_remove(struct platform_device *pdev)
 
        port = &altera_jtaguart_ports[i].port;
        uart_remove_one_port(&altera_jtaguart_driver, port);
+       iounmap(port->membase);
 
        return 0;
 }
index 46d3438a0d27014ce97115e7a17b0eb024f12035..3e4b717670d7432e32d4b66568900773f6e239ce 100644 (file)
@@ -615,6 +615,7 @@ static int altera_uart_remove(struct platform_device *pdev)
        if (port) {
                uart_remove_one_port(&altera_uart_driver, port);
                port->mapbase = 0;
+               iounmap(port->membase);
        }
 
        return 0;
index ebd8569f9ad5da126b2ff15985943e630135925a..9fff25be87f9db91273aa96e5b015705e7fd9118 100644 (file)
@@ -27,6 +27,7 @@
 #define UARTn_FRAME            0x04
 #define UARTn_FRAME_DATABITS__MASK     0x000f
 #define UARTn_FRAME_DATABITS(n)                ((n) - 3)
+#define UARTn_FRAME_PARITY__MASK       0x0300
 #define UARTn_FRAME_PARITY_NONE                0x0000
 #define UARTn_FRAME_PARITY_EVEN                0x0200
 #define UARTn_FRAME_PARITY_ODD         0x0300
@@ -572,12 +573,16 @@ static void efm32_uart_console_get_options(struct efm32_uart_port *efm_port,
                        16 * (4 + (clkdiv >> 6)));
 
        frame = efm32_uart_read32(efm_port, UARTn_FRAME);
-       if (frame & UARTn_FRAME_PARITY_ODD)
+       switch (frame & UARTn_FRAME_PARITY__MASK) {
+       case UARTn_FRAME_PARITY_ODD:
                *parity = 'o';
-       else if (frame & UARTn_FRAME_PARITY_EVEN)
+               break;
+       case UARTn_FRAME_PARITY_EVEN:
                *parity = 'e';
-       else
+               break;
+       default:
                *parity = 'n';
+       }
 
        *bits = (frame & UARTn_FRAME_DATABITS__MASK) -
                        UARTn_FRAME_DATABITS(4) + 4;
index 157883653256da9ebeae89d7dabead3285656c82..f190a84a02465668d64f3b6a57d6462588d781ad 100644 (file)
@@ -1382,9 +1382,9 @@ static struct spi_driver ifx_spi_driver = {
 static void __exit ifx_spi_exit(void)
 {
        /* unregister */
+       spi_unregister_driver(&ifx_spi_driver);
        tty_unregister_driver(tty_drv);
        put_tty_driver(tty_drv);
-       spi_unregister_driver(&ifx_spi_driver);
        unregister_reboot_notifier(&ifx_modem_reboot_notifier_block);
 }
 
index 33509b4beaec237715de1e8febd63e861fbb9c15..bbefddd92bfeae77b637033af8028ac481642931 100644 (file)
@@ -2184,7 +2184,9 @@ static int serial_imx_probe(struct platform_device *pdev)
                 * and DCD (when they are outputs) or enables the respective
                 * irqs. So set this bit early, i.e. before requesting irqs.
                 */
-               writel(UFCR_DCEDTE, sport->port.membase + UFCR);
+               reg = readl(sport->port.membase + UFCR);
+               if (!(reg & UFCR_DCEDTE))
+                       writel(reg | UFCR_DCEDTE, sport->port.membase + UFCR);
 
                /*
                 * Disable UCR3_RI and UCR3_DCD irqs. They are also not
@@ -2195,7 +2197,15 @@ static int serial_imx_probe(struct platform_device *pdev)
                       sport->port.membase + UCR3);
 
        } else {
-               writel(0, sport->port.membase + UFCR);
+               unsigned long ucr3 = UCR3_DSR;
+
+               reg = readl(sport->port.membase + UFCR);
+               if (reg & UFCR_DCEDTE)
+                       writel(reg & ~UFCR_DCEDTE, sport->port.membase + UFCR);
+
+               if (!is_imx1_uart(sport))
+                       ucr3 |= IMX21_UCR3_RXDMUXSEL | UCR3_ADNIMP;
+               writel(ucr3, sport->port.membase + UCR3);
        }
 
        clk_disable_unprepare(sport->clk_ipg);
index 0f45b7884a2c58a299668591e87bead1f6628f98..13bfd5dcffce5c0bfaee47879277e32aedf308a9 100644 (file)
@@ -2083,7 +2083,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
        mutex_lock(&port->mutex);
 
        tty_dev = device_find_child(uport->dev, &match, serial_match_port);
-       if (device_may_wakeup(tty_dev)) {
+       if (tty_dev && device_may_wakeup(tty_dev)) {
                if (!enable_irq_wake(uport->irq))
                        uport->irq_wake = 1;
                put_device(tty_dev);
@@ -2782,7 +2782,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
         * Register the port whether it's detected or not.  This allows
         * setserial to be used to alter this port's parameters.
         */
-       tty_dev = tty_port_register_device_attr(port, drv->tty_driver,
+       tty_dev = tty_port_register_device_attr_serdev(port, drv->tty_driver,
                        uport->line, uport->dev, port, uport->tty_groups);
        if (likely(!IS_ERR(tty_dev))) {
                device_set_wakeup_capable(tty_dev, 1);
@@ -2845,7 +2845,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
        /*
         * Remove the devices from the tty layer
         */
-       tty_unregister_device(drv->tty_driver, uport->line);
+       tty_port_unregister_device(port, drv->tty_driver, uport->line);
 
        tty = tty_port_tty_get(port);
        if (tty) {
index 1d21a9c1d33e6e3c5ef007a25e4b4550fb62a51c..4fb3165384c4495bb83a785dc564f76be68e340a 100644 (file)
@@ -34,7 +34,9 @@ static int tty_port_default_receive_buf(struct tty_port *port,
        if (!disc)
                return 0;
 
+       mutex_lock(&tty->atomic_write_lock);
        ret = tty_ldisc_receive_buf(disc, p, (char *)f, count);
+       mutex_unlock(&tty->atomic_write_lock);
 
        tty_ldisc_deref(disc);
 
@@ -128,20 +130,86 @@ struct device *tty_port_register_device_attr(struct tty_port *port,
                struct tty_driver *driver, unsigned index,
                struct device *device, void *drvdata,
                const struct attribute_group **attr_grp)
+{
+       tty_port_link_device(port, driver, index);
+       return tty_register_device_attr(driver, index, device, drvdata,
+                       attr_grp);
+}
+EXPORT_SYMBOL_GPL(tty_port_register_device_attr);
+
+/**
+ * tty_port_register_device_attr_serdev - register tty or serdev device
+ * @port: tty_port of the device
+ * @driver: tty_driver for this device
+ * @index: index of the tty
+ * @device: parent if exists, otherwise NULL
+ * @drvdata: driver data for the device
+ * @attr_grp: attribute group for the device
+ *
+ * Register a serdev or tty device depending on if the parent device has any
+ * defined serdev clients or not.
+ */
+struct device *tty_port_register_device_attr_serdev(struct tty_port *port,
+               struct tty_driver *driver, unsigned index,
+               struct device *device, void *drvdata,
+               const struct attribute_group **attr_grp)
 {
        struct device *dev;
 
        tty_port_link_device(port, driver, index);
 
        dev = serdev_tty_port_register(port, device, driver, index);
-       if (PTR_ERR(dev) != -ENODEV)
+       if (PTR_ERR(dev) != -ENODEV) {
                /* Skip creating cdev if we registered a serdev device */
                return dev;
+       }
 
        return tty_register_device_attr(driver, index, device, drvdata,
                        attr_grp);
 }
-EXPORT_SYMBOL_GPL(tty_port_register_device_attr);
+EXPORT_SYMBOL_GPL(tty_port_register_device_attr_serdev);
+
+/**
+ * tty_port_register_device_serdev - register tty or serdev device
+ * @port: tty_port of the device
+ * @driver: tty_driver for this device
+ * @index: index of the tty
+ * @device: parent if exists, otherwise NULL
+ *
+ * Register a serdev or tty device depending on if the parent device has any
+ * defined serdev clients or not.
+ */
+struct device *tty_port_register_device_serdev(struct tty_port *port,
+               struct tty_driver *driver, unsigned index,
+               struct device *device)
+{
+       return tty_port_register_device_attr_serdev(port, driver, index,
+                       device, NULL, NULL);
+}
+EXPORT_SYMBOL_GPL(tty_port_register_device_serdev);
+
+/**
+ * tty_port_unregister_device - deregister a tty or serdev device
+ * @port: tty_port of the device
+ * @driver: tty_driver for this device
+ * @index: index of the tty
+ *
+ * If a tty or serdev device is registered with a call to
+ * tty_port_register_device_serdev() then this function must be called when
+ * the device is gone.
+ */
+void tty_port_unregister_device(struct tty_port *port,
+               struct tty_driver *driver, unsigned index)
+{
+       int ret;
+
+       ret = serdev_tty_port_unregister(port);
+       if (ret == 0)
+               return;
+
+       tty_unregister_device(driver, index);
+}
+EXPORT_SYMBOL_GPL(tty_port_unregister_device);
 
 int tty_port_alloc_xmit_buf(struct tty_port *port)
 {
@@ -189,9 +257,6 @@ static void tty_port_destructor(struct kref *kref)
        /* check if last port ref was dropped before tty release */
        if (WARN_ON(port->itty))
                return;
-
-       serdev_tty_port_unregister(port);
-
        if (port->xmit_buf)
                free_page((unsigned long)port->xmit_buf);
        tty_port_destroy(port);
index 3fdde0b283c9b86f7fa6aaa9585593699be29fca..29308a80d66ffa118b9aec996874d65a952c29aa 100644 (file)
@@ -1671,8 +1671,12 @@ static long ceph_fallocate(struct file *file, int mode,
        }
 
        size = i_size_read(inode);
-       if (!(mode & FALLOC_FL_KEEP_SIZE))
+       if (!(mode & FALLOC_FL_KEEP_SIZE)) {
                endoff = offset + length;
+               ret = inode_newsize_ok(inode, endoff);
+               if (ret)
+                       goto unlock;
+       }
 
        if (fi->fmode & CEPH_FILE_MODE_LAZY)
                want = CEPH_CAP_FILE_BUFFER | CEPH_CAP_FILE_LAZYIO;
index f02eb767339219e8e59418429c666b3934d795f4..a7048eafa8e6d8c92a0c6888017389d8562c75ba 100644 (file)
@@ -1280,7 +1280,6 @@ xfs_bmap_read_extents(
                xfs_bmbt_rec_t  *frp;
                xfs_fsblock_t   nextbno;
                xfs_extnum_t    num_recs;
-               xfs_extnum_t    start;
 
                num_recs = xfs_btree_get_numrecs(block);
                if (unlikely(i + num_recs > room)) {
@@ -1303,7 +1302,6 @@ xfs_bmap_read_extents(
                 * Copy records into the extent records.
                 */
                frp = XFS_BMBT_REC_ADDR(mp, block, 1);
-               start = i;
                for (j = 0; j < num_recs; j++, i++, frp++) {
                        xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i);
                        trp->l0 = be64_to_cpu(frp->l0);
@@ -2065,8 +2063,10 @@ xfs_bmap_add_extent_delay_real(
                }
                temp = xfs_bmap_worst_indlen(bma->ip, temp);
                temp2 = xfs_bmap_worst_indlen(bma->ip, temp2);
-               diff = (int)(temp + temp2 - startblockval(PREV.br_startblock) -
-                       (bma->cur ? bma->cur->bc_private.b.allocated : 0));
+               diff = (int)(temp + temp2 -
+                            (startblockval(PREV.br_startblock) -
+                             (bma->cur ?
+                              bma->cur->bc_private.b.allocated : 0)));
                if (diff > 0) {
                        error = xfs_mod_fdblocks(bma->ip->i_mount,
                                                 -((int64_t)diff), false);
@@ -2123,7 +2123,6 @@ xfs_bmap_add_extent_delay_real(
                temp = da_new;
                if (bma->cur)
                        temp += bma->cur->bc_private.b.allocated;
-               ASSERT(temp <= da_old);
                if (temp < da_old)
                        xfs_mod_fdblocks(bma->ip->i_mount,
                                        (int64_t)(da_old - temp), false);
index 5392674bf8930550d949f6c01d0f47ec03228ba8..3a673ba201aae9f39c8190bfa2b8904120284ce5 100644 (file)
@@ -4395,7 +4395,7 @@ xfs_btree_visit_blocks(
                        xfs_btree_readahead_ptr(cur, ptr, 1);
 
                        /* save for the next iteration of the loop */
-                       lptr = *ptr;
+                       xfs_btree_copy_ptrs(cur, &lptr, ptr, 1);
                }
 
                /* for each buffer in the level */
index b177ef33cd4c3215de5f3bc228a467bcf73031e1..82a38d86ebad83346c441e802340a172402ef532 100644 (file)
@@ -1629,13 +1629,28 @@ xfs_refcount_recover_cow_leftovers(
        if (mp->m_sb.sb_agblocks >= XFS_REFC_COW_START)
                return -EOPNOTSUPP;
 
-       error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
+       INIT_LIST_HEAD(&debris);
+
+       /*
+        * In this first part, we use an empty transaction to gather up
+        * all the leftover CoW extents so that we can subsequently
+        * delete them.  The empty transaction is used to avoid
+        * a buffer lock deadlock if there happens to be a loop in the
+        * refcountbt because we're allowed to re-grab a buffer that is
+        * already attached to our transaction.  When we're done
+        * recording the CoW debris we cancel the (empty) transaction
+        * and everything goes away cleanly.
+        */
+       error = xfs_trans_alloc_empty(mp, &tp);
        if (error)
                return error;
-       cur = xfs_refcountbt_init_cursor(mp, NULL, agbp, agno, NULL);
+
+       error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
+       if (error)
+               goto out_trans;
+       cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL);
 
        /* Find all the leftover CoW staging extents. */
-       INIT_LIST_HEAD(&debris);
        memset(&low, 0, sizeof(low));
        memset(&high, 0, sizeof(high));
        low.rc.rc_startblock = XFS_REFC_COW_START;
@@ -1645,10 +1660,11 @@ xfs_refcount_recover_cow_leftovers(
        if (error)
                goto out_cursor;
        xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
-       xfs_buf_relse(agbp);
+       xfs_trans_brelse(tp, agbp);
+       xfs_trans_cancel(tp);
 
        /* Now iterate the list to free the leftovers */
-       list_for_each_entry(rr, &debris, rr_list) {
+       list_for_each_entry_safe(rr, n, &debris, rr_list) {
                /* Set up transaction. */
                error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, 0, 0, 0, &tp);
                if (error)
@@ -1676,8 +1692,16 @@ xfs_refcount_recover_cow_leftovers(
                error = xfs_trans_commit(tp);
                if (error)
                        goto out_free;
+
+               list_del(&rr->rr_list);
+               kmem_free(rr);
        }
 
+       return error;
+out_defer:
+       xfs_defer_cancel(&dfops);
+out_trans:
+       xfs_trans_cancel(tp);
 out_free:
        /* Free the leftover list */
        list_for_each_entry_safe(rr, n, &debris, rr_list) {
@@ -1688,11 +1712,6 @@ out_free:
 
 out_cursor:
        xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
-       xfs_buf_relse(agbp);
-       goto out_free;
-
-out_defer:
-       xfs_defer_cancel(&dfops);
-       xfs_trans_cancel(tp);
-       goto out_free;
+       xfs_trans_brelse(tp, agbp);
+       goto out_trans;
 }
index 2b954308a1d671e9f09d06a5353713297f11be76..9e3cc2146d5b03cdc84a4a0d92ce3c186314525d 100644 (file)
@@ -582,9 +582,13 @@ xfs_getbmap(
                }
                break;
        default:
+               /* Local format data forks report no extents. */
+               if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
+                       bmv->bmv_entries = 0;
+                       return 0;
+               }
                if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&
-                   ip->i_d.di_format != XFS_DINODE_FMT_BTREE &&
-                   ip->i_d.di_format != XFS_DINODE_FMT_LOCAL)
+                   ip->i_d.di_format != XFS_DINODE_FMT_BTREE)
                        return -EINVAL;
 
                if (xfs_get_extsz_hint(ip) ||
@@ -712,7 +716,7 @@ xfs_getbmap(
                         * extents.
                         */
                        if (map[i].br_startblock == DELAYSTARTBLOCK &&
-                           map[i].br_startoff <= XFS_B_TO_FSB(mp, XFS_ISIZE(ip)))
+                           map[i].br_startoff < XFS_B_TO_FSB(mp, XFS_ISIZE(ip)))
                                ASSERT((iflags & BMV_IF_DELALLOC) != 0);
 
                         if (map[i].br_startblock == HOLESTARTBLOCK &&
index 35703a80137208b81cb38ab91ce50e28d80a19f2..5fb5a0958a1485db46a2f753446c11828ff1913e 100644 (file)
@@ -1043,49 +1043,17 @@ xfs_find_get_desired_pgoff(
 
        index = startoff >> PAGE_SHIFT;
        endoff = XFS_FSB_TO_B(mp, map->br_startoff + map->br_blockcount);
-       end = endoff >> PAGE_SHIFT;
+       end = (endoff - 1) >> PAGE_SHIFT;
        do {
                int             want;
                unsigned        nr_pages;
                unsigned int    i;
 
-               want = min_t(pgoff_t, end - index, PAGEVEC_SIZE);
+               want = min_t(pgoff_t, end - index, PAGEVEC_SIZE - 1) + 1;
                nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
                                          want);
-               /*
-                * No page mapped into given range.  If we are searching holes
-                * and if this is the first time we got into the loop, it means
-                * that the given offset is landed in a hole, return it.
-                *
-                * If we have already stepped through some block buffers to find
-                * holes but they all contains data.  In this case, the last
-                * offset is already updated and pointed to the end of the last
-                * mapped page, if it does not reach the endpoint to search,
-                * that means there should be a hole between them.
-                */
-               if (nr_pages == 0) {
-                       /* Data search found nothing */
-                       if (type == DATA_OFF)
-                               break;
-
-                       ASSERT(type == HOLE_OFF);
-                       if (lastoff == startoff || lastoff < endoff) {
-                               found = true;
-                               *offset = lastoff;
-                       }
-                       break;
-               }
-
-               /*
-                * At lease we found one page.  If this is the first time we
-                * step into the loop, and if the first page index offset is
-                * greater than the given search offset, a hole was found.
-                */
-               if (type == HOLE_OFF && lastoff == startoff &&
-                   lastoff < page_offset(pvec.pages[0])) {
-                       found = true;
+               if (nr_pages == 0)
                        break;
-               }
 
                for (i = 0; i < nr_pages; i++) {
                        struct page     *page = pvec.pages[i];
@@ -1098,18 +1066,18 @@ xfs_find_get_desired_pgoff(
                         * file mapping. However, page->index will not change
                         * because we have a reference on the page.
                         *
-                        * Searching done if the page index is out of range.
-                        * If the current offset is not reaches the end of
-                        * the specified search range, there should be a hole
-                        * between them.
+                        * If current page offset is beyond where we've ended,
+                        * we've found a hole.
                         */
-                       if (page->index > end) {
-                               if (type == HOLE_OFF && lastoff < endoff) {
-                                       *offset = lastoff;
-                                       found = true;
-                               }
+                       if (type == HOLE_OFF && lastoff < endoff &&
+                           lastoff < page_offset(pvec.pages[i])) {
+                               found = true;
+                               *offset = lastoff;
                                goto out;
                        }
+                       /* Searching done if the page index is out of range. */
+                       if (page->index > end)
+                               goto out;
 
                        lock_page(page);
                        /*
@@ -1151,21 +1119,20 @@ xfs_find_get_desired_pgoff(
 
                /*
                 * The number of returned pages less than our desired, search
-                * done.  In this case, nothing was found for searching data,
-                * but we found a hole behind the last offset.
+                * done.
                 */
-               if (nr_pages < want) {
-                       if (type == HOLE_OFF) {
-                               *offset = lastoff;
-                               found = true;
-                       }
+               if (nr_pages < want)
                        break;
-               }
 
                index = pvec.pages[i - 1]->index + 1;
                pagevec_release(&pvec);
        } while (index <= end);
 
+       /* No page at lastoff and we are not done - we found a hole. */
+       if (type == HOLE_OFF && lastoff < endoff) {
+               *offset = lastoff;
+               found = true;
+       }
 out:
        pagevec_release(&pvec);
        return found;
index 3683819887a5658eff23d6e3258d21567bbdc0b4..814ed729881d9a4305c3dd5646d75ef0f112b87b 100644 (file)
@@ -828,6 +828,7 @@ xfs_getfsmap(
        struct xfs_fsmap                dkeys[2];       /* per-dev keys */
        struct xfs_getfsmap_dev         handlers[XFS_GETFSMAP_DEVS];
        struct xfs_getfsmap_info        info = { NULL };
+       bool                            use_rmap;
        int                             i;
        int                             error = 0;
 
@@ -837,12 +838,14 @@ xfs_getfsmap(
            !xfs_getfsmap_is_valid_device(mp, &head->fmh_keys[1]))
                return -EINVAL;
 
+       use_rmap = capable(CAP_SYS_ADMIN) &&
+                  xfs_sb_version_hasrmapbt(&mp->m_sb);
        head->fmh_entries = 0;
 
        /* Set up our device handlers. */
        memset(handlers, 0, sizeof(handlers));
        handlers[0].dev = new_encode_dev(mp->m_ddev_targp->bt_dev);
-       if (xfs_sb_version_hasrmapbt(&mp->m_sb))
+       if (use_rmap)
                handlers[0].fn = xfs_getfsmap_datadev_rmapbt;
        else
                handlers[0].fn = xfs_getfsmap_datadev_bnobt;
diff --git a/include/dt-bindings/clock/bcm-sr.h b/include/dt-bindings/clock/bcm-sr.h
new file mode 100644 (file)
index 0000000..cff6c6f
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Broadcom. All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom Corporation nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _CLOCK_BCM_SR_H
+#define _CLOCK_BCM_SR_H
+
+/* GENPLL 0 clock channel ID SCR HSLS FS PCIE */
+#define BCM_SR_GENPLL0                 0
+#define BCM_SR_GENPLL0_SATA_CLK                1
+#define BCM_SR_GENPLL0_SCR_CLK         2
+#define BCM_SR_GENPLL0_250M_CLK                3
+#define BCM_SR_GENPLL0_PCIE_AXI_CLK    4
+#define BCM_SR_GENPLL0_PAXC_AXI_X2_CLK 5
+#define BCM_SR_GENPLL0_PAXC_AXI_CLK    6
+
+/* GENPLL 1 clock channel ID MHB PCIE NITRO */
+#define BCM_SR_GENPLL1                 0
+#define BCM_SR_GENPLL1_PCIE_TL_CLK     1
+#define BCM_SR_GENPLL1_MHB_APB_CLK     2
+
+/* GENPLL 2 clock channel ID NITRO MHB*/
+#define BCM_SR_GENPLL2                 0
+#define BCM_SR_GENPLL2_NIC_CLK         1
+#define BCM_SR_GENPLL2_250_NITRO_CLK   2
+#define BCM_SR_GENPLL2_125_NITRO_CLK   3
+#define BCM_SR_GENPLL2_CHIMP_CLK       4
+
+/* GENPLL 3 HSLS clock channel ID */
+#define BCM_SR_GENPLL3                 0
+#define BCM_SR_GENPLL3_HSLS_CLK                1
+#define BCM_SR_GENPLL3_SDIO_CLK                2
+
+/* GENPLL 4 SCR clock channel ID */
+#define BCM_SR_GENPLL4                 0
+#define BCM_SR_GENPLL4_CCN_CLK         1
+
+/* GENPLL 5 FS4 clock channel ID */
+#define BCM_SR_GENPLL5                 0
+#define BCM_SR_GENPLL5_FS_CLK          1
+#define BCM_SR_GENPLL5_SPU_CLK         2
+
+/* GENPLL 6 NITRO clock channel ID */
+#define BCM_SR_GENPLL6                 0
+#define BCM_SR_GENPLL6_48_USB_CLK      1
+
+/* LCPLL0  clock channel ID */
+#define BCM_SR_LCPLL0                  0
+#define BCM_SR_LCPLL0_SATA_REF_CLK     1
+#define BCM_SR_LCPLL0_USB_REF_CLK      2
+#define BCM_SR_LCPLL0_SATA_REFPN_CLK   3
+
+/* LCPLL1  clock channel ID */
+#define BCM_SR_LCPLL1                  0
+#define BCM_SR_LCPLL1_WAN_CLK          1
+
+/* LCPLL PCIE  clock channel ID */
+#define BCM_SR_LCPLL_PCIE              0
+#define BCM_SR_LCPLL_PCIE_PHY_REF_CLK  1
+
+/* GENPLL EMEM0 clock channel ID */
+#define BCM_SR_EMEMPLL0                        0
+#define BCM_SR_EMEMPLL0_EMEM_CLK       1
+
+/* GENPLL EMEM0 clock channel ID */
+#define BCM_SR_EMEMPLL1                        0
+#define BCM_SR_EMEMPLL1_EMEM_CLK       1
+
+/* GENPLL EMEM0 clock channel ID */
+#define BCM_SR_EMEMPLL2                        0
+#define BCM_SR_EMEMPLL2_EMEM_CLK       1
+
+#endif /* _CLOCK_BCM_SR_H */
diff --git a/include/dt-bindings/pinctrl/brcm,pinctrl-stingray.h b/include/dt-bindings/pinctrl/brcm,pinctrl-stingray.h
new file mode 100644 (file)
index 0000000..caa6c66
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2017 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in
+ *      the documentation and/or other materials provided with the
+ *      distribution.
+ *    * Neither the name of Broadcom Corporation nor the names of its
+ *      contributors may be used to endorse or promote products derived
+ *      from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DT_BINDINGS_PINCTRL_BRCM_STINGRAY_H__
+#define __DT_BINDINGS_PINCTRL_BRCM_STINGRAY_H__
+
+/* Alternate functions available in MUX controller */
+#define MODE_NITRO                             0
+#define MODE_NAND                              1
+#define MODE_PNOR                              2
+#define MODE_GPIO                              3
+
+/* Pad configuration attribute */
+#define PAD_SLEW_RATE_ENA                      (1 << 0)
+#define PAD_SLEW_RATE_ENA_MASK                 (1 << 0)
+
+#define PAD_DRIVE_STRENGTH_2_MA                        (0 << 1)
+#define PAD_DRIVE_STRENGTH_4_MA                        (1 << 1)
+#define PAD_DRIVE_STRENGTH_6_MA                        (2 << 1)
+#define PAD_DRIVE_STRENGTH_8_MA                        (3 << 1)
+#define PAD_DRIVE_STRENGTH_10_MA               (4 << 1)
+#define PAD_DRIVE_STRENGTH_12_MA               (5 << 1)
+#define PAD_DRIVE_STRENGTH_14_MA               (6 << 1)
+#define PAD_DRIVE_STRENGTH_16_MA               (7 << 1)
+#define PAD_DRIVE_STRENGTH_MASK                        (7 << 1)
+
+#define PAD_PULL_UP_ENA                                (1 << 4)
+#define PAD_PULL_UP_ENA_MASK                   (1 << 4)
+
+#define PAD_PULL_DOWN_ENA                      (1 << 5)
+#define PAD_PULL_DOWN_ENA_MASK                 (1 << 5)
+
+#define PAD_INPUT_PATH_DIS                     (1 << 6)
+#define PAD_INPUT_PATH_DIS_MASK                        (1 << 6)
+
+#define PAD_HYSTERESIS_ENA                     (1 << 7)
+#define PAD_HYSTERESIS_ENA_MASK                        (1 << 7)
+
+#endif
index c47aa248c640bc5ea806d5112ce7f7b5fb6b7a46..fcd641032f8d3a87162b0e9f1a63e08ae16d10df 100644 (file)
@@ -238,7 +238,6 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
                                bool kick_requeue_list);
 void blk_mq_kick_requeue_list(struct request_queue *q);
 void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
-void blk_mq_abort_requeue_list(struct request_queue *q);
 void blk_mq_complete_request(struct request *rq);
 
 bool blk_mq_queue_stopped(struct request_queue *q);
index aa2e19182d990eedda70de69bf638db5856811d1..51c5bd64bd0022c8a3f197d846c23448e7bb6a6e 100644 (file)
@@ -3,6 +3,8 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/string.h>
+
 #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
 
 /*
  */
 
 # if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
-extern const char *ceph_file_part(const char *s, int len);
 #  define dout(fmt, ...)                                               \
        pr_debug("%.*s %12.12s:%-4d : " fmt,                            \
                 8 - (int)sizeof(KBUILD_MODNAME), "    ",               \
-                ceph_file_part(__FILE__, sizeof(__FILE__)),            \
-                __LINE__, ##__VA_ARGS__)
+                kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
 # else
 /* faux printk call just to see any compiler warnings. */
 #  define dout(fmt, ...)       do {                            \
index 56197f82af45fb0f7cf492961fe1eb1956105735..62d948f80730fdd94c587b4f0235c72cf5d3399a 100644 (file)
@@ -272,6 +272,16 @@ struct bpf_prog_aux;
                .off   = OFF,                                   \
                .imm   = IMM })
 
+/* Unconditional jumps, goto pc + off16 */
+
+#define BPF_JMP_A(OFF)                                         \
+       ((struct bpf_insn) {                                    \
+               .code  = BPF_JMP | BPF_JA,                      \
+               .dst_reg = 0,                                   \
+               .src_reg = 0,                                   \
+               .off   = OFF,                                   \
+               .imm   = 0 })
+
 /* Function call */
 
 #define BPF_EMIT_CALL(FUNC)                                    \
index 8d5fcd6284ce0f4702d9eb28703bf2ae80d7e399..283dc2f5364d77c13df5a16ed0474154ee6724ff 100644 (file)
@@ -614,14 +614,16 @@ static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
 static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
                                                    netdev_features_t features)
 {
-       if (skb_vlan_tagged_multi(skb))
-               features = netdev_intersect_features(features,
-                                                    NETIF_F_SG |
-                                                    NETIF_F_HIGHDMA |
-                                                    NETIF_F_FRAGLIST |
-                                                    NETIF_F_HW_CSUM |
-                                                    NETIF_F_HW_VLAN_CTAG_TX |
-                                                    NETIF_F_HW_VLAN_STAG_TX);
+       if (skb_vlan_tagged_multi(skb)) {
+               /* In the case of multi-tagged packets, use a direct mask
+                * instead of using netdev_interesect_features(), to make
+                * sure that only devices supporting NETIF_F_HW_CSUM will
+                * have checksum offloading support.
+                */
+               features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
+                           NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX |
+                           NETIF_F_HW_VLAN_STAG_TX;
+       }
 
        return features;
 }
index dd9a263ed368d5476b06a3464bbfada0436cf6e2..a940ec6a046cfd0dc8c3016226c71ea9e2c343e5 100644 (file)
@@ -787,8 +787,14 @@ enum {
 };
 
 enum {
-       CQE_RSS_HTYPE_IP        = 0x3 << 6,
-       CQE_RSS_HTYPE_L4        = 0x3 << 2,
+       CQE_RSS_HTYPE_IP        = 0x3 << 2,
+       /* cqe->rss_hash_type[3:2] - IP destination selected for hash
+        * (00 = none,  01 = IPv4, 10 = IPv6, 11 = Reserved)
+        */
+       CQE_RSS_HTYPE_L4        = 0x3 << 6,
+       /* cqe->rss_hash_type[7:6] - L4 destination selected for hash
+        * (00 = none, 01 = TCP. 10 = UDP, 11 = IPSEC.SPI
+        */
 };
 
 enum {
index bcdf739ee41a2cf38fe537e48172e9ca9053e3b9..93273d9ea4d145f125846f0c9a56a5a6e74915e4 100644 (file)
@@ -787,7 +787,12 @@ enum {
 
 typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
 
+enum {
+       MLX5_CMD_ENT_STATE_PENDING_COMP,
+};
+
 struct mlx5_cmd_work_ent {
+       unsigned long           state;
        struct mlx5_cmd_msg    *in;
        struct mlx5_cmd_msg    *out;
        void                   *uout;
@@ -976,7 +981,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
 void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
 struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
-void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec);
+void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool forced);
 void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
 int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
                       int nent, u64 mask, const char *name,
index be378cf47fcc93fa2c89c6cd870f0a9fecd65211..b3044c2c62cbe8e856605129aa17f111e2a21493 100644 (file)
@@ -294,7 +294,7 @@ int xt_match_to_user(const struct xt_entry_match *m,
 int xt_target_to_user(const struct xt_entry_target *t,
                      struct xt_entry_target __user *u);
 int xt_data_to_user(void __user *dst, const void *src,
-                   int usersize, int size);
+                   int usersize, int size, int aligned_size);
 
 void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
                                 struct xt_counters_info *info, bool compat);
index a30efb437e6d1cfa42a75ec72997bf12b9cdf59d..e0cbf17af780e1d3e4c2be6bba351c9a27cebf88 100644 (file)
@@ -125,4 +125,9 @@ extern unsigned int ebt_do_table(struct sk_buff *skb,
 /* True if the target is not a standard target */
 #define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)
 
+static inline bool ebt_invalid_target(int target)
+{
+       return (target < -NUM_STANDARD_TARGETS || target >= 0);
+}
+
 #endif
index dc8224ae28d5d9e6106dc0d06a8a9bc2eb85fd0a..e0d1946270f38e5238ddf0a3bb25cf03c3f3ebe4 100644 (file)
@@ -64,6 +64,7 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
                                                   const char *bus_id,
                                                   struct device *parent);
 
+extern int of_platform_device_destroy(struct device *dev, void *data);
 extern int of_platform_bus_probe(struct device_node *root,
                                 const struct of_device_id *matches,
                                 struct device *parent);
index 33c2b0b77429d09aaa31cb9735458db5762e08a7..8039f9f0ca054ba20fd9992b13b7926859d029b5 100644 (file)
@@ -183,6 +183,11 @@ enum pci_dev_flags {
        PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9),
        /* Do not use FLR even if device advertises PCI_AF_CAP */
        PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10),
+       /*
+        * Resume before calling the driver's system suspend hooks, disabling
+        * the direct_complete optimization.
+        */
+       PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11),
 };
 
 enum pci_irq_reroute_variant {
@@ -1342,9 +1347,9 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
                               unsigned int max_vecs, unsigned int flags,
                               const struct irq_affinity *aff_desc)
 {
-       if (min_vecs > 1)
-               return -EINVAL;
-       return 1;
+       if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
+               return 1;
+       return -ENOSPC;
 }
 
 static inline void pci_free_irq_vectors(struct pci_dev *dev)
index 422bc2e4cb6a6fc47571d28cb0602d59477d7caf..ef3eb8bbfee482e04aa06c83b21fbc2ce02d50b3 100644 (file)
@@ -54,7 +54,8 @@ extern int ptrace_request(struct task_struct *child, long request,
                          unsigned long addr, unsigned long data);
 extern void ptrace_notify(int exit_code);
 extern void __ptrace_link(struct task_struct *child,
-                         struct task_struct *new_parent);
+                         struct task_struct *new_parent,
+                         const struct cred *ptracer_cred);
 extern void __ptrace_unlink(struct task_struct *child);
 extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
 #define PTRACE_MODE_READ       0x01
@@ -206,7 +207,7 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
 
        if (unlikely(ptrace) && current->ptrace) {
                child->ptrace = current->ptrace;
-               __ptrace_link(child, current->parent);
+               __ptrace_link(child, current->parent, current->ptracer_cred);
 
                if (child->ptrace & PT_SEIZED)
                        task_set_jobctl_pending(child, JOBCTL_TRAP_STOP);
@@ -215,6 +216,8 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
 
                set_tsk_thread_flag(child, TIF_SIGPENDING);
        }
+       else
+               child->ptracer_cred = NULL;
 }
 
 /**
index cda76c6506ca411c42c5e1cdf6d287263d97dde6..e69402d4a8aecbdc6fe4a40e8ad7e01957badbd6 100644 (file)
@@ -195,6 +195,7 @@ int serdev_device_open(struct serdev_device *);
 void serdev_device_close(struct serdev_device *);
 unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
 void serdev_device_set_flow_control(struct serdev_device *, bool);
+int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);
 void serdev_device_wait_until_sent(struct serdev_device *, long);
 int serdev_device_get_tiocm(struct serdev_device *);
 int serdev_device_set_tiocm(struct serdev_device *, int, int);
@@ -236,6 +237,12 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdev
        return 0;
 }
 static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {}
+static inline int serdev_device_write_buf(struct serdev_device *serdev,
+                                         const unsigned char *buf,
+                                         size_t count)
+{
+       return -ENODEV;
+}
 static inline void serdev_device_wait_until_sent(struct serdev_device *sdev, long timeout) {}
 static inline int serdev_device_get_tiocm(struct serdev_device *serdev)
 {
@@ -301,7 +308,7 @@ struct tty_driver;
 struct device *serdev_tty_port_register(struct tty_port *port,
                                        struct device *parent,
                                        struct tty_driver *drv, int idx);
-void serdev_tty_port_unregister(struct tty_port *port);
+int serdev_tty_port_unregister(struct tty_port *port);
 #else
 static inline struct device *serdev_tty_port_register(struct tty_port *port,
                                           struct device *parent,
@@ -309,14 +316,10 @@ static inline struct device *serdev_tty_port_register(struct tty_port *port,
 {
        return ERR_PTR(-ENODEV);
 }
-static inline void serdev_tty_port_unregister(struct tty_port *port) {}
-#endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
-
-static inline int serdev_device_write_buf(struct serdev_device *serdev,
-                                         const unsigned char *data,
-                                         size_t count)
+static inline int serdev_tty_port_unregister(struct tty_port *port)
 {
-       return serdev_device_write(serdev, data, count, 0);
+       return -ENODEV;
 }
+#endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
 
 #endif /*_LINUX_SERDEV_H */
index d07cd2105a6c6a3bdcac20c918622c7ad4ea0840..eccb4ec30a8a7b94064ff1ede0645234b94ae49c 100644 (file)
@@ -558,6 +558,15 @@ extern struct device *tty_port_register_device_attr(struct tty_port *port,
                struct tty_driver *driver, unsigned index,
                struct device *device, void *drvdata,
                const struct attribute_group **attr_grp);
+extern struct device *tty_port_register_device_serdev(struct tty_port *port,
+               struct tty_driver *driver, unsigned index,
+               struct device *device);
+extern struct device *tty_port_register_device_attr_serdev(struct tty_port *port,
+               struct tty_driver *driver, unsigned index,
+               struct device *device, void *drvdata,
+               const struct attribute_group **attr_grp);
+extern void tty_port_unregister_device(struct tty_port *port,
+               struct tty_driver *driver, unsigned index);
 extern int tty_port_alloc_xmit_buf(struct tty_port *port);
 extern void tty_port_free_xmit_buf(struct tty_port *port);
 extern void tty_port_destroy(struct tty_port *port);
index 7dffa5624ea62bee992e547c44ed4a86a577b0a7..97116379db5ff6a850e078c35047fe995f45b265 100644 (file)
@@ -206,6 +206,7 @@ struct cdc_state {
 };
 
 extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
+extern int usbnet_ether_cdc_bind(struct usbnet *dev, struct usb_interface *intf);
 extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
 extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
 extern void usbnet_cdc_status(struct usbnet *, struct urb *);
index 049af33da3b6c95897d544670cea65c542317673..cfc0437841665d7ed46a714915c50d723c24901c 100644 (file)
@@ -107,10 +107,16 @@ struct dst_entry {
        };
 };
 
+struct dst_metrics {
+       u32             metrics[RTAX_MAX];
+       atomic_t        refcnt;
+};
+extern const struct dst_metrics dst_default_metrics;
+
 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
-extern const u32 dst_default_metrics[];
 
 #define DST_METRICS_READ_ONLY          0x1UL
+#define DST_METRICS_REFCOUNTED         0x2UL
 #define DST_METRICS_FLAGS              0x3UL
 #define __DST_METRICS_PTR(Y)   \
        ((u32 *)((Y) & ~DST_METRICS_FLAGS))
index 6692c5758b332d468f1e0611ecc4f3e03ae03b2b..f7f6aa789c6174c41ca9739206d586c559c1f3a1 100644 (file)
@@ -114,11 +114,11 @@ struct fib_info {
        __be32                  fib_prefsrc;
        u32                     fib_tb_id;
        u32                     fib_priority;
-       u32                     *fib_metrics;
-#define fib_mtu fib_metrics[RTAX_MTU-1]
-#define fib_window fib_metrics[RTAX_WINDOW-1]
-#define fib_rtt fib_metrics[RTAX_RTT-1]
-#define fib_advmss fib_metrics[RTAX_ADVMSS-1]
+       struct dst_metrics      *fib_metrics;
+#define fib_mtu fib_metrics->metrics[RTAX_MTU-1]
+#define fib_window fib_metrics->metrics[RTAX_WINDOW-1]
+#define fib_rtt fib_metrics->metrics[RTAX_RTT-1]
+#define fib_advmss fib_metrics->metrics[RTAX_ADVMSS-1]
        int                     fib_nhs;
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
        int                     fib_weight;
index e04fa7691e5d6873cd04e94816227d4a41275fa2..c519bb5b5bb8806089886caacaca4846fe3eeb98 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef _NF_CONNTRACK_HELPER_H
 #define _NF_CONNTRACK_HELPER_H
+#include <linux/refcount.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_extend.h>
 #include <net/netfilter/nf_conntrack_expect.h>
@@ -26,6 +27,7 @@ struct nf_conntrack_helper {
        struct hlist_node hnode;        /* Internal use. */
 
        char name[NF_CT_HELPER_NAME_LEN]; /* name of the module */
+       refcount_t refcnt;
        struct module *me;              /* pointer to self */
        const struct nf_conntrack_expect_policy *expect_policy;
 
@@ -79,6 +81,8 @@ struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
 struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
                                                               u16 l3num,
                                                               u8 protonum);
+void nf_conntrack_helper_put(struct nf_conntrack_helper *helper);
+
 void nf_ct_helper_init(struct nf_conntrack_helper *helper,
                       u16 l3num, u16 protonum, const char *name,
                       u16 default_port, u16 spec_port, u32 id,
index 028faec8fc2799b0c176ac88b54fc6700e89f896..8a8bab8d7b15a8e9c746a899dcf474740e9f6f25 100644 (file)
@@ -176,7 +176,7 @@ struct nft_data_desc {
 int nft_data_init(const struct nft_ctx *ctx,
                  struct nft_data *data, unsigned int size,
                  struct nft_data_desc *desc, const struct nlattr *nla);
-void nft_data_uninit(const struct nft_data *data, enum nft_data_types type);
+void nft_data_release(const struct nft_data *data, enum nft_data_types type);
 int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
                  enum nft_data_types type, unsigned int len);
 
index f31fb6331a532eed7258177d5cfbb48fde9a594a..3248beaf16b0513283cd3c863695a77d09793cdc 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <net/act_api.h>
+#include <linux/tc_act/tc_csum.h>
 
 struct tcf_csum {
        struct tc_action common;
@@ -11,4 +12,18 @@ struct tcf_csum {
 };
 #define to_tcf_csum(a) ((struct tcf_csum *)a)
 
+static inline bool is_tcf_csum(const struct tc_action *a)
+{
+#ifdef CONFIG_NET_CLS_ACT
+       if (a->ops && a->ops->type == TCA_ACT_CSUM)
+               return true;
+#endif
+       return false;
+}
+
+static inline u32 tcf_csum_update_flags(const struct tc_action *a)
+{
+       return to_tcf_csum(a)->update_flags;
+}
+
 #endif /* __NET_TC_CSUM_H */
index 6793a30c66b1f054516a27229c29037fcdfa2f6f..7e7e2b0d29157047fa0d3596b3f97cf501d754f9 100644 (file)
@@ -979,10 +979,6 @@ struct xfrm_dst {
        struct flow_cache_object flo;
        struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
        int num_pols, num_xfrms;
-#ifdef CONFIG_XFRM_SUB_POLICY
-       struct flowi *origin;
-       struct xfrm_selector *partner;
-#endif
        u32 xfrm_genid;
        u32 policy_genid;
        u32 route_mtu_cached;
@@ -998,12 +994,6 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
        dst_release(xdst->route);
        if (likely(xdst->u.dst.xfrm))
                xfrm_state_put(xdst->u.dst.xfrm);
-#ifdef CONFIG_XFRM_SUB_POLICY
-       kfree(xdst->origin);
-       xdst->origin = NULL;
-       kfree(xdst->partner);
-       xdst->partner = NULL;
-#endif
 }
 #endif
 
index 5e00b2333c26e3256a6f4dc51a2a58011a2c9db6..172dc8ee0e3bda95c39f7e037e7a33baf8012214 100644 (file)
@@ -86,6 +86,7 @@ static struct bpf_map *array_map_alloc(union bpf_attr *attr)
        array->map.key_size = attr->key_size;
        array->map.value_size = attr->value_size;
        array->map.max_entries = attr->max_entries;
+       array->map.map_flags = attr->map_flags;
        array->elem_size = elem_size;
 
        if (!percpu)
index 39cfafd895b80d2f0fb5054626af001949a8ad98..b09185f0f17d3428ac445de2ed52756004ca5368 100644 (file)
@@ -432,6 +432,7 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr)
        trie->map.key_size = attr->key_size;
        trie->map.value_size = attr->value_size;
        trie->map.max_entries = attr->max_entries;
+       trie->map.map_flags = attr->map_flags;
        trie->data_size = attr->key_size -
                          offsetof(struct bpf_lpm_trie_key, data);
        trie->max_prefixlen = trie->data_size * 8;
index 4dfd6f2ec2f9725681f490971e60acc8033c64b6..31147d730abf532cc8f10efc9a871b5dd498928d 100644 (file)
@@ -88,6 +88,7 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
        smap->map.key_size = attr->key_size;
        smap->map.value_size = value_size;
        smap->map.max_entries = attr->max_entries;
+       smap->map.map_flags = attr->map_flags;
        smap->n_buckets = n_buckets;
        smap->map.pages = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT;
 
index 1eddb713b815c3820dd996b4d34770e4c784ab71..339c8a1371de0201df0f7ac799280168ea4d22e3 100644 (file)
@@ -463,19 +463,22 @@ static const int caller_saved[CALLER_SAVED_REGS] = {
        BPF_REG_0, BPF_REG_1, BPF_REG_2, BPF_REG_3, BPF_REG_4, BPF_REG_5
 };
 
+static void mark_reg_not_init(struct bpf_reg_state *regs, u32 regno)
+{
+       BUG_ON(regno >= MAX_BPF_REG);
+
+       memset(&regs[regno], 0, sizeof(regs[regno]));
+       regs[regno].type = NOT_INIT;
+       regs[regno].min_value = BPF_REGISTER_MIN_RANGE;
+       regs[regno].max_value = BPF_REGISTER_MAX_RANGE;
+}
+
 static void init_reg_state(struct bpf_reg_state *regs)
 {
        int i;
 
-       for (i = 0; i < MAX_BPF_REG; i++) {
-               regs[i].type = NOT_INIT;
-               regs[i].imm = 0;
-               regs[i].min_value = BPF_REGISTER_MIN_RANGE;
-               regs[i].max_value = BPF_REGISTER_MAX_RANGE;
-               regs[i].min_align = 0;
-               regs[i].aux_off = 0;
-               regs[i].aux_off_align = 0;
-       }
+       for (i = 0; i < MAX_BPF_REG; i++)
+               mark_reg_not_init(regs, i);
 
        /* frame pointer */
        regs[BPF_REG_FP].type = FRAME_PTR;
@@ -808,11 +811,15 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
                reg_off += reg->aux_off;
        }
 
-       /* skb->data is NET_IP_ALIGN-ed, but for strict alignment checking
-        * we force this to 2 which is universally what architectures use
-        * when they don't set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
+       /* For platforms that do not have a Kconfig enabling
+        * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS the value of
+        * NET_IP_ALIGN is universally set to '2'.  And on platforms
+        * that do set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, we get
+        * to this code only in strict mode where we want to emulate
+        * the NET_IP_ALIGN==2 checking.  Therefore use an
+        * unconditional IP align value of '2'.
         */
-       ip_align = strict ? 2 : NET_IP_ALIGN;
+       ip_align = 2;
        if ((ip_align + reg_off + off) % size != 0) {
                verbose("misaligned packet access off %d+%d+%d size %d\n",
                        ip_align, reg_off, off, size);
@@ -839,9 +846,6 @@ static int check_ptr_alignment(struct bpf_verifier_env *env,
 {
        bool strict = env->strict_alignment;
 
-       if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
-               strict = true;
-
        switch (reg->type) {
        case PTR_TO_PACKET:
                return check_pkt_ptr_alignment(reg, off, size, strict);
@@ -1345,7 +1349,6 @@ static int check_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
        struct bpf_verifier_state *state = &env->cur_state;
        const struct bpf_func_proto *fn = NULL;
        struct bpf_reg_state *regs = state->regs;
-       struct bpf_reg_state *reg;
        struct bpf_call_arg_meta meta;
        bool changes_data;
        int i, err;
@@ -1412,11 +1415,8 @@ static int check_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
        }
 
        /* reset caller saved regs */
-       for (i = 0; i < CALLER_SAVED_REGS; i++) {
-               reg = regs + caller_saved[i];
-               reg->type = NOT_INIT;
-               reg->imm = 0;
-       }
+       for (i = 0; i < CALLER_SAVED_REGS; i++)
+               mark_reg_not_init(regs, caller_saved[i]);
 
        /* update return register */
        if (fn->ret_type == RET_INTEGER) {
@@ -2444,7 +2444,6 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn)
 {
        struct bpf_reg_state *regs = env->cur_state.regs;
        u8 mode = BPF_MODE(insn->code);
-       struct bpf_reg_state *reg;
        int i, err;
 
        if (!may_access_skb(env->prog->type)) {
@@ -2477,11 +2476,8 @@ static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn)
        }
 
        /* reset caller saved regs to unreadable */
-       for (i = 0; i < CALLER_SAVED_REGS; i++) {
-               reg = regs + caller_saved[i];
-               reg->type = NOT_INIT;
-               reg->imm = 0;
-       }
+       for (i = 0; i < CALLER_SAVED_REGS; i++)
+               mark_reg_not_init(regs, caller_saved[i]);
 
        /* mark destination R0 register as readable, since it contains
         * the value fetched from the packet
@@ -2692,7 +2688,8 @@ err_free:
 /* the following conditions reduce the number of explored insns
  * from ~140k to ~80k for ultra large programs that use a lot of ptr_to_packet
  */
-static bool compare_ptrs_to_packet(struct bpf_reg_state *old,
+static bool compare_ptrs_to_packet(struct bpf_verifier_env *env,
+                                  struct bpf_reg_state *old,
                                   struct bpf_reg_state *cur)
 {
        if (old->id != cur->id)
@@ -2735,7 +2732,7 @@ static bool compare_ptrs_to_packet(struct bpf_reg_state *old,
         * 'if (R4 > data_end)' and all further insn were already good with r=20,
         * so they will be good with r=30 and we can prune the search.
         */
-       if (old->off <= cur->off &&
+       if (!env->strict_alignment && old->off <= cur->off &&
            old->off >= old->range && cur->off >= cur->range)
                return true;
 
@@ -2806,7 +2803,7 @@ static bool states_equal(struct bpf_verifier_env *env,
                        continue;
 
                if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET &&
-                   compare_ptrs_to_packet(rold, rcur))
+                   compare_ptrs_to_packet(env, rold, rcur))
                        continue;
 
                return false;
@@ -3584,10 +3581,10 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr)
        } else {
                log_level = 0;
        }
-       if (attr->prog_flags & BPF_F_STRICT_ALIGNMENT)
+
+       env->strict_alignment = !!(attr->prog_flags & BPF_F_STRICT_ALIGNMENT);
+       if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
                env->strict_alignment = true;
-       else
-               env->strict_alignment = false;
 
        ret = replace_map_fd_with_map_ptr(env);
        if (ret < 0)
@@ -3693,7 +3690,10 @@ int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops *ops,
        mutex_lock(&bpf_verifier_lock);
 
        log_level = 0;
+
        env->strict_alignment = false;
+       if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
+               env->strict_alignment = true;
 
        env->explored_states = kcalloc(env->prog->len,
                                       sizeof(struct bpf_verifier_state_list *),
index aa1076c5e4a9f3a5d9e6f58fef1c6f34e332de8c..e53770d2bf956bf5bf6ec1a42c75121552713da6 100644 (file)
@@ -1577,6 +1577,18 @@ static __latent_entropy struct task_struct *copy_process(
        if (!p)
                goto fork_out;
 
+       /*
+        * This _must_ happen before we call free_task(), i.e. before we jump
+        * to any of the bad_fork_* labels. This is to avoid freeing
+        * p->set_child_tid which is (ab)used as a kthread's data pointer for
+        * kernel threads (PF_KTHREAD).
+        */
+       p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
+       /*
+        * Clear TID on mm_release()?
+        */
+       p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
+
        ftrace_graph_init_task(p);
 
        rt_mutex_init_task(p);
@@ -1743,11 +1755,6 @@ static __latent_entropy struct task_struct *copy_process(
                }
        }
 
-       p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
-       /*
-        * Clear TID on mm_release()?
-        */
-       p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
 #ifdef CONFIG_BLOCK
        p->plug = NULL;
 #endif
index 2d2d3a568e4e8b3aeedb16711c90e660f698d6cf..adfe3b4cfe05a101bcee0da8e72db6fe6a10cf72 100644 (file)
@@ -122,7 +122,7 @@ static void *alloc_insn_page(void)
        return module_alloc(PAGE_SIZE);
 }
 
-static void free_insn_page(void *page)
+void __weak free_insn_page(void *page)
 {
        module_memfree(page);
 }
index b9550941690915bc23323cd772e060cda7d3a704..28cd09e635ed669fe6c93b28eb1d59e46bbf4615 100644 (file)
@@ -1785,12 +1785,14 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock,
        int ret;
 
        raw_spin_lock_irq(&lock->wait_lock);
-
-       set_current_state(TASK_INTERRUPTIBLE);
-
        /* sleep on the mutex */
+       set_current_state(TASK_INTERRUPTIBLE);
        ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter);
-
+       /*
+        * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might
+        * have to fix that up.
+        */
+       fixup_rt_mutex_waiters(lock);
        raw_spin_unlock_irq(&lock->wait_lock);
 
        return ret;
@@ -1821,16 +1823,26 @@ bool rt_mutex_cleanup_proxy_lock(struct rt_mutex *lock,
        bool cleanup = false;
 
        raw_spin_lock_irq(&lock->wait_lock);
+       /*
+        * Do an unconditional try-lock, this deals with the lock stealing
+        * state where __rt_mutex_futex_unlock() -> mark_wakeup_next_waiter()
+        * sets a NULL owner.
+        *
+        * We're not interested in the return value, because the subsequent
+        * test on rt_mutex_owner() will infer that. If the trylock succeeded,
+        * we will own the lock and it will have removed the waiter. If we
+        * failed the trylock, we're still not owner and we need to remove
+        * ourselves.
+        */
+       try_to_take_rt_mutex(lock, current, waiter);
        /*
         * Unless we're the owner; we're still enqueued on the wait_list.
         * So check if we became owner, if not, take us off the wait_list.
         */
        if (rt_mutex_owner(lock) != current) {
                remove_waiter(lock, waiter);
-               fixup_rt_mutex_waiters(lock);
                cleanup = true;
        }
-
        /*
         * try_to_take_rt_mutex() sets the waiter bit unconditionally. We might
         * have to fix that up.
index 3b1e0f3ad07fa69d9524bcb72d1c6d0bab1a9ad8..fa46606f33565613d2ef13a1e948f2bae0dfaa8b 100644 (file)
@@ -1425,7 +1425,7 @@ static unsigned int nr_meta_pages;
  * Numbers of normal and highmem page frames allocated for hibernation image
  * before suspending devices.
  */
-unsigned int alloc_normal, alloc_highmem;
+static unsigned int alloc_normal, alloc_highmem;
 /*
  * Memory bitmap used for marking saveable pages (during hibernation) or
  * hibernation image pages (during restore)
index 266ddcc1d8bbbc6af7bceda3657618beef2a9c59..60f356d91060c8974268cc5bc02d57c75d359afc 100644 (file)
@@ -60,19 +60,25 @@ int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,
 }
 
 
+void __ptrace_link(struct task_struct *child, struct task_struct *new_parent,
+                  const struct cred *ptracer_cred)
+{
+       BUG_ON(!list_empty(&child->ptrace_entry));
+       list_add(&child->ptrace_entry, &new_parent->ptraced);
+       child->parent = new_parent;
+       child->ptracer_cred = get_cred(ptracer_cred);
+}
+
 /*
  * ptrace a task: make the debugger its new parent and
  * move it to the ptrace list.
  *
  * Must be called with the tasklist lock write-held.
  */
-void __ptrace_link(struct task_struct *child, struct task_struct *new_parent)
+static void ptrace_link(struct task_struct *child, struct task_struct *new_parent)
 {
-       BUG_ON(!list_empty(&child->ptrace_entry));
-       list_add(&child->ptrace_entry, &new_parent->ptraced);
-       child->parent = new_parent;
        rcu_read_lock();
-       child->ptracer_cred = get_cred(__task_cred(new_parent));
+       __ptrace_link(child, new_parent, __task_cred(new_parent));
        rcu_read_unlock();
 }
 
@@ -386,7 +392,7 @@ static int ptrace_attach(struct task_struct *task, long request,
                flags |= PT_SEIZED;
        task->ptrace = flags;
 
-       __ptrace_link(task, current);
+       ptrace_link(task, current);
 
        /* SEIZE doesn't trap tracee on attach */
        if (!seize)
@@ -459,7 +465,7 @@ static int ptrace_traceme(void)
                 */
                if (!ret && !(current->real_parent->flags & PF_EXITING)) {
                        current->ptrace = PT_PTRACED;
-                       __ptrace_link(current, current->real_parent);
+                       ptrace_link(current, current->real_parent);
                }
        }
        write_unlock_irq(&tasklist_lock);
index 76877a62b5fa374f0daa93f1180ce853ba32fc0c..622eed1b7658301a94a645c4426598b0096a8ab9 100644 (file)
@@ -245,11 +245,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
        sugov_update_commit(sg_policy, time, next_f);
 }
 
-static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu)
+static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time)
 {
        struct sugov_policy *sg_policy = sg_cpu->sg_policy;
        struct cpufreq_policy *policy = sg_policy->policy;
-       u64 last_freq_update_time = sg_policy->last_freq_update_time;
        unsigned long util = 0, max = 1;
        unsigned int j;
 
@@ -265,7 +264,7 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu)
                 * enough, don't take the CPU into account as it probably is
                 * idle now (and clear iowait_boost for it).
                 */
-               delta_ns = last_freq_update_time - j_sg_cpu->last_update;
+               delta_ns = time - j_sg_cpu->last_update;
                if (delta_ns > TICK_NSEC) {
                        j_sg_cpu->iowait_boost = 0;
                        continue;
@@ -309,7 +308,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,
                if (flags & SCHED_CPUFREQ_RT_DL)
                        next_f = sg_policy->policy->cpuinfo.max_freq;
                else
-                       next_f = sugov_next_freq_shared(sg_cpu);
+                       next_f = sugov_next_freq_shared(sg_cpu, time);
 
                sugov_update_commit(sg_policy, time, next_f);
        }
index 1370f067fb51511f26d578cb3954032952a62027..d2a1e6dd02913f4beb58b1d79be12d72761deec3 100644 (file)
@@ -825,8 +825,10 @@ static void check_thread_timers(struct task_struct *tsk,
                         * At the hard limit, we just die.
                         * No need to calculate anything else now.
                         */
-                       pr_info("CPU Watchdog Timeout (hard): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("CPU Watchdog Timeout (hard): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
                        return;
                }
@@ -838,8 +840,10 @@ static void check_thread_timers(struct task_struct *tsk,
                                soft += USEC_PER_SEC;
                                sig->rlim[RLIMIT_RTTIME].rlim_cur = soft;
                        }
-                       pr_info("RT Watchdog Timeout (soft): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("RT Watchdog Timeout (soft): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);
                }
        }
@@ -936,8 +940,10 @@ static void check_process_timers(struct task_struct *tsk,
                         * At the hard limit, we just die.
                         * No need to calculate anything else now.
                         */
-                       pr_info("RT Watchdog Timeout (hard): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("RT Watchdog Timeout (hard): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
                        return;
                }
@@ -945,8 +951,10 @@ static void check_process_timers(struct task_struct *tsk,
                        /*
                         * At the soft limit, send a SIGXCPU every second.
                         */
-                       pr_info("CPU Watchdog Timeout (soft): %s[%d]\n",
-                               tsk->comm, task_pid_nr(tsk));
+                       if (print_fatal_signals) {
+                               pr_info("CPU Watchdog Timeout (soft): %s[%d]\n",
+                                       tsk->comm, task_pid_nr(tsk));
+                       }
                        __group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);
                        if (soft < hard) {
                                soft++;
index 74fdfe9ed3dba7fa659cb11feafac25919984bbb..9e5841dc14b5fa62e0c1470df704c3dc9b99f8ad 100644 (file)
@@ -5063,7 +5063,7 @@ ftrace_graph_release(struct inode *inode, struct file *file)
        }
 
  out:
-       kfree(fgd->new_hash);
+       free_ftrace_hash(fgd->new_hash);
        kfree(fgd);
 
        return ret;
index 889bc31785bee57901ae969f16a55390db8265c4..be88cbaadde3aeed809b2997e2ef683fba62dba4 100644 (file)
@@ -4504,6 +4504,44 @@ static struct bpf_test tests[] = {
                { },
                { { 0, 1 } },
        },
+       {
+               "JMP_JSGE_K: Signed jump: value walk 1",
+               .u.insns_int = {
+                       BPF_ALU32_IMM(BPF_MOV, R0, 0),
+                       BPF_LD_IMM64(R1, -3),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 6),
+                       BPF_ALU64_IMM(BPF_ADD, R1, 1),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 4),
+                       BPF_ALU64_IMM(BPF_ADD, R1, 1),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 2),
+                       BPF_ALU64_IMM(BPF_ADD, R1, 1),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 1),
+                       BPF_EXIT_INSN(),                /* bad exit */
+                       BPF_ALU32_IMM(BPF_MOV, R0, 1),  /* good exit */
+                       BPF_EXIT_INSN(),
+               },
+               INTERNAL,
+               { },
+               { { 0, 1 } },
+       },
+       {
+               "JMP_JSGE_K: Signed jump: value walk 2",
+               .u.insns_int = {
+                       BPF_ALU32_IMM(BPF_MOV, R0, 0),
+                       BPF_LD_IMM64(R1, -3),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 4),
+                       BPF_ALU64_IMM(BPF_ADD, R1, 2),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 2),
+                       BPF_ALU64_IMM(BPF_ADD, R1, 2),
+                       BPF_JMP_IMM(BPF_JSGE, R1, 0, 1),
+                       BPF_EXIT_INSN(),                /* bad exit */
+                       BPF_ALU32_IMM(BPF_MOV, R0, 1),  /* good exit */
+                       BPF_EXIT_INSN(),
+               },
+               INTERNAL,
+               { },
+               { { 0, 1 } },
+       },
        /* BPF_JMP | BPF_JGT | BPF_K */
        {
                "JMP_JGT_K: if (3 > 2) return 1",
index 08341d2aa9c946d7bdd6e0d599e31ba96557a290..0db8102995a506d64ece0de48b7266ccf3839ba8 100644 (file)
@@ -179,6 +179,7 @@ static void br_stp_start(struct net_bridge *br)
                br_debug(br, "using kernel STP\n");
 
                /* To start timers on any ports left in blocking */
+               mod_timer(&br->hello_timer, jiffies + br->hello_time);
                br_port_state_selection(br);
        }
 
index c98b3e5c140a5f30a28fd748408cf5e949a032b6..60b6fe277a8b0c90faad0dfcda87f149ceaa5552 100644 (file)
@@ -40,7 +40,7 @@ static void br_hello_timer_expired(unsigned long arg)
        if (br->dev->flags & IFF_UP) {
                br_config_bpdu_generation(br);
 
-               if (br->stp_enabled != BR_USER_STP)
+               if (br->stp_enabled == BR_KERNEL_STP)
                        mod_timer(&br->hello_timer,
                                  round_jiffies(jiffies + br->hello_time));
        }
index 5929309beaa1d5d310a19029364693c0b0355772..db85230e49c3b7e97093d54a1d7625d9145dfeb4 100644 (file)
@@ -68,6 +68,9 @@ static int ebt_arpreply_tg_check(const struct xt_tgchk_param *par)
        if (e->ethproto != htons(ETH_P_ARP) ||
            e->invflags & EBT_IPROTO)
                return -EINVAL;
+       if (ebt_invalid_target(info->target))
+               return -EINVAL;
+
        return 0;
 }
 
index 9ec0c9f908fa712b18bfa25c87aa7bce12cee786..9c6e619f452bc96770a8e340d3879adce6dadd2a 100644 (file)
@@ -1373,7 +1373,8 @@ static inline int ebt_obj_to_user(char __user *um, const char *_name,
        strlcpy(name, _name, sizeof(name));
        if (copy_to_user(um, name, EBT_FUNCTION_MAXNAMELEN) ||
            put_user(datasize, (int __user *)(um + EBT_FUNCTION_MAXNAMELEN)) ||
-           xt_data_to_user(um + entrysize, data, usersize, datasize))
+           xt_data_to_user(um + entrysize, data, usersize, datasize,
+                           XT_ALIGN(datasize)))
                return -EFAULT;
 
        return 0;
@@ -1658,7 +1659,8 @@ static int compat_match_to_user(struct ebt_entry_match *m, void __user **dstptr,
                if (match->compat_to_user(cm->data, m->data))
                        return -EFAULT;
        } else {
-               if (xt_data_to_user(cm->data, m->data, match->usersize, msize))
+               if (xt_data_to_user(cm->data, m->data, match->usersize, msize,
+                                   COMPAT_XT_ALIGN(msize)))
                        return -EFAULT;
        }
 
@@ -1687,7 +1689,8 @@ static int compat_target_to_user(struct ebt_entry_target *t,
                if (target->compat_to_user(cm->data, t->data))
                        return -EFAULT;
        } else {
-               if (xt_data_to_user(cm->data, t->data, target->usersize, tsize))
+               if (xt_data_to_user(cm->data, t->data, target->usersize, tsize,
+                                   COMPAT_XT_ALIGN(tsize)))
                        return -EFAULT;
        }
 
index 2034fb9266700e6b456b141db9b5d264aed77d62..8757fb87dab871faaaeccaed0ac11d76521ad594 100644 (file)
@@ -151,7 +151,7 @@ static int process_one_ticket(struct ceph_auth_client *ac,
        struct timespec validity;
        void *tp, *tpend;
        void **ptp;
-       struct ceph_crypto_key new_session_key;
+       struct ceph_crypto_key new_session_key = { 0 };
        struct ceph_buffer *new_ticket_blob;
        unsigned long new_expires, new_renew_after;
        u64 new_secret_id;
@@ -215,6 +215,9 @@ static int process_one_ticket(struct ceph_auth_client *ac,
        dout(" ticket blob is %d bytes\n", dlen);
        ceph_decode_need(ptp, tpend, 1 + sizeof(u64), bad);
        blob_struct_v = ceph_decode_8(ptp);
+       if (blob_struct_v != 1)
+               goto bad;
+
        new_secret_id = ceph_decode_64(ptp);
        ret = ceph_decode_buffer(&new_ticket_blob, ptp, tpend);
        if (ret)
@@ -234,13 +237,13 @@ static int process_one_ticket(struct ceph_auth_client *ac,
             type, ceph_entity_type_name(type), th->secret_id,
             (int)th->ticket_blob->vec.iov_len);
        xi->have_keys |= th->service;
-
-out:
-       return ret;
+       return 0;
 
 bad:
        ret = -EINVAL;
-       goto out;
+out:
+       ceph_crypto_key_destroy(&new_session_key);
+       return ret;
 }
 
 static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
index 4fd02831beed20fb3d98475c7da2a0b4f2818513..47e94b560ba0d37daf2fb801fa11b9aa39720013 100644 (file)
@@ -56,19 +56,6 @@ static const struct kernel_param_ops param_ops_supported_features = {
 module_param_cb(supported_features, &param_ops_supported_features, NULL,
                S_IRUGO);
 
-/*
- * find filename portion of a path (/foo/bar/baz -> baz)
- */
-const char *ceph_file_part(const char *s, int len)
-{
-       const char *e = s + len;
-
-       while (e != s && *(e-1) != '/')
-               e--;
-       return e;
-}
-EXPORT_SYMBOL(ceph_file_part);
-
 const char *ceph_msg_type_name(int type)
 {
        switch (type) {
index 5766a6c896c4fa7290fffdbee239701ca4e2eeef..588a919300514ad2cd4b843c528bb41e601fa7d8 100644 (file)
@@ -1174,8 +1174,8 @@ static struct page *ceph_msg_data_next(struct ceph_msg_data_cursor *cursor,
  * Returns true if the result moves the cursor on to the next piece
  * of the data item.
  */
-static bool ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor,
-                               size_t bytes)
+static void ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor,
+                                 size_t bytes)
 {
        bool new_piece;
 
@@ -1207,8 +1207,6 @@ static bool ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor,
                new_piece = true;
        }
        cursor->need_crc = new_piece;
-
-       return new_piece;
 }
 
 static size_t sizeof_footer(struct ceph_connection *con)
@@ -1577,7 +1575,6 @@ static int write_partial_message_data(struct ceph_connection *con)
                size_t page_offset;
                size_t length;
                bool last_piece;
-               bool need_crc;
                int ret;
 
                page = ceph_msg_data_next(cursor, &page_offset, &length,
@@ -1592,7 +1589,7 @@ static int write_partial_message_data(struct ceph_connection *con)
                }
                if (do_datacrc && cursor->need_crc)
                        crc = ceph_crc32c_page(crc, page, page_offset, length);
-               need_crc = ceph_msg_data_advance(cursor, (size_t)ret);
+               ceph_msg_data_advance(cursor, (size_t)ret);
        }
 
        dout("%s %p msg %p done\n", __func__, con, msg);
@@ -2231,10 +2228,18 @@ static void process_ack(struct ceph_connection *con)
        struct ceph_msg *m;
        u64 ack = le64_to_cpu(con->in_temp_ack);
        u64 seq;
+       bool reconnect = (con->in_tag == CEPH_MSGR_TAG_SEQ);
+       struct list_head *list = reconnect ? &con->out_queue : &con->out_sent;
 
-       while (!list_empty(&con->out_sent)) {
-               m = list_first_entry(&con->out_sent, struct ceph_msg,
-                                    list_head);
+       /*
+        * In the reconnect case, con_fault() has requeued messages
+        * in out_sent. We should cleanup old messages according to
+        * the reconnect seq.
+        */
+       while (!list_empty(list)) {
+               m = list_first_entry(list, struct ceph_msg, list_head);
+               if (reconnect && m->needs_out_seq)
+                       break;
                seq = le64_to_cpu(m->hdr.seq);
                if (seq > ack)
                        break;
@@ -2243,6 +2248,7 @@ static void process_ack(struct ceph_connection *con)
                m->ack_stamp = jiffies;
                ceph_msg_remove(m);
        }
+
        prepare_read_tag(con);
 }
 
@@ -2299,7 +2305,7 @@ static int read_partial_msg_data(struct ceph_connection *con)
 
                if (do_datacrc)
                        crc = ceph_crc32c_page(crc, page, page_offset, ret);
-               (void) ceph_msg_data_advance(cursor, (size_t)ret);
+               ceph_msg_data_advance(cursor, (size_t)ret);
        }
        if (do_datacrc)
                con->in_data_crc = crc;
index 29a0ef351c5e068838fc1ed8f634439853ff0a3a..250f11f786092d902b52da5af9a228d9786acf62 100644 (file)
@@ -43,15 +43,13 @@ struct ceph_monmap *ceph_monmap_decode(void *p, void *end)
        int i, err = -EINVAL;
        struct ceph_fsid fsid;
        u32 epoch, num_mon;
-       u16 version;
        u32 len;
 
        ceph_decode_32_safe(&p, end, len, bad);
        ceph_decode_need(&p, end, len, bad);
 
        dout("monmap_decode %p %p len %d\n", p, end, (int)(end-p));
-
-       ceph_decode_16_safe(&p, end, version, bad);
+       p += sizeof(u16);  /* skip version */
 
        ceph_decode_need(&p, end, sizeof(fsid) + 2*sizeof(u32), bad);
        ceph_decode_copy(&p, &fsid, sizeof(fsid));
index ffe9e904d4d1d130b0353edbe45d50d236b4f74e..55e3a477f92d4cba92e342d13686b6e3b94204c0 100644 (file)
@@ -317,6 +317,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
                u32 yes;
                struct crush_rule *r;
 
+               err = -EINVAL;
                ceph_decode_32_safe(p, end, yes, bad);
                if (!yes) {
                        dout("crush_decode NO rule %d off %x %p to %p\n",
index 960e503b5a529a2c4f1866f49c150493ee98d7da..6192f11beec9077de964e2aeff4f78547f08b8da 100644 (file)
@@ -151,13 +151,13 @@ int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb)
 }
 EXPORT_SYMBOL(dst_discard_out);
 
-const u32 dst_default_metrics[RTAX_MAX + 1] = {
+const struct dst_metrics dst_default_metrics = {
        /* This initializer is needed to force linker to place this variable
         * into const section. Otherwise it might end into bss section.
         * We really want to avoid false sharing on this variable, and catch
         * any writes on it.
         */
-       [RTAX_MAX] = 0xdeadbeef,
+       .refcnt = ATOMIC_INIT(1),
 };
 
 void dst_init(struct dst_entry *dst, struct dst_ops *ops,
@@ -169,7 +169,7 @@ void dst_init(struct dst_entry *dst, struct dst_ops *ops,
        if (dev)
                dev_hold(dev);
        dst->ops = ops;
-       dst_init_metrics(dst, dst_default_metrics, true);
+       dst_init_metrics(dst, dst_default_metrics.metrics, true);
        dst->expires = 0UL;
        dst->path = dst;
        dst->from = NULL;
@@ -314,25 +314,30 @@ EXPORT_SYMBOL(dst_release);
 
 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old)
 {
-       u32 *p = kmalloc(sizeof(u32) * RTAX_MAX, GFP_ATOMIC);
+       struct dst_metrics *p = kmalloc(sizeof(*p), GFP_ATOMIC);
 
        if (p) {
-               u32 *old_p = __DST_METRICS_PTR(old);
+               struct dst_metrics *old_p = (struct dst_metrics *)__DST_METRICS_PTR(old);
                unsigned long prev, new;
 
-               memcpy(p, old_p, sizeof(u32) * RTAX_MAX);
+               atomic_set(&p->refcnt, 1);
+               memcpy(p->metrics, old_p->metrics, sizeof(p->metrics));
 
                new = (unsigned long) p;
                prev = cmpxchg(&dst->_metrics, old, new);
 
                if (prev != old) {
                        kfree(p);
-                       p = __DST_METRICS_PTR(prev);
+                       p = (struct dst_metrics *)__DST_METRICS_PTR(prev);
                        if (prev & DST_METRICS_READ_ONLY)
                                p = NULL;
+               } else if (prev & DST_METRICS_REFCOUNTED) {
+                       if (atomic_dec_and_test(&old_p->refcnt))
+                               kfree(old_p);
                }
        }
-       return p;
+       BUILD_BUG_ON(offsetof(struct dst_metrics, metrics) != 0);
+       return (u32 *)p;
 }
 EXPORT_SYMBOL(dst_cow_metrics_generic);
 
@@ -341,7 +346,7 @@ void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old)
 {
        unsigned long prev, new;
 
-       new = ((unsigned long) dst_default_metrics) | DST_METRICS_READ_ONLY;
+       new = ((unsigned long) &dst_default_metrics) | DST_METRICS_READ_ONLY;
        prev = cmpxchg(&dst->_metrics, old, new);
        if (prev == old)
                kfree(__DST_METRICS_PTR(old));
index a253a6197e6b37a7ae2fe451c646b01c861a3e22..a6bb95fa87b26a6627ba38cd9a94269c7e59f73d 100644 (file)
@@ -2281,6 +2281,7 @@ bool bpf_helper_changes_pkt_data(void *func)
            func == bpf_skb_change_head ||
            func == bpf_skb_change_tail ||
            func == bpf_skb_pull_data ||
+           func == bpf_clone_redirect ||
            func == bpf_l3_csum_replace ||
            func == bpf_l4_csum_replace ||
            func == bpf_xdp_adjust_head)
index 1934efd4a9d4986f3497abc40968fd08c91896b3..26bbfababff27cecc589bca69e3eb14739187f5b 100644 (file)
@@ -315,6 +315,25 @@ out_undo:
        goto out;
 }
 
+static int __net_init net_defaults_init_net(struct net *net)
+{
+       net->core.sysctl_somaxconn = SOMAXCONN;
+       return 0;
+}
+
+static struct pernet_operations net_defaults_ops = {
+       .init = net_defaults_init_net,
+};
+
+static __init int net_defaults_init(void)
+{
+       if (register_pernet_subsys(&net_defaults_ops))
+               panic("Cannot initialize net default settings");
+
+       return 0;
+}
+
+core_initcall(net_defaults_init);
 
 #ifdef CONFIG_NET_NS
 static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
index 49a279a7cc15b0d2409236f53a0629ccc927e07c..9e2c0a7cb3256e8cb2af1d65aaf293db96b9a418 100644 (file)
@@ -3231,8 +3231,11 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
        int err = 0;
        int fidx = 0;
 
-       if (nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,
-                       IFLA_MAX, ifla_policy, NULL) == 0) {
+       err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,
+                         IFLA_MAX, ifla_policy, NULL);
+       if (err < 0) {
+               return -EINVAL;
+       } else if (err == 0) {
                if (tb[IFLA_MASTER])
                        br_idx = nla_get_u32(tb[IFLA_MASTER]);
        }
index ea23254b2457cf15eeae495130dab437090f8e2e..b7cd9aafe99e9b9216b13cce617133cdf832eeeb 100644 (file)
@@ -479,8 +479,6 @@ static __net_init int sysctl_core_net_init(struct net *net)
 {
        struct ctl_table *tbl;
 
-       net->core.sysctl_somaxconn = SOMAXCONN;
-
        tbl = netns_core_table;
        if (!net_eq(net, &init_net)) {
                tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
index d54345a06f720fb1cd7632a364aa7e7e19ff6216..e9f3386a528b4a792839d5e50894a68d3097eb42 100644 (file)
@@ -641,6 +641,32 @@ void arp_xmit(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(arp_xmit);
 
+static bool arp_is_garp(struct net *net, struct net_device *dev,
+                       int *addr_type, __be16 ar_op,
+                       __be32 sip, __be32 tip,
+                       unsigned char *sha, unsigned char *tha)
+{
+       bool is_garp = tip == sip;
+
+       /* Gratuitous ARP _replies_ also require target hwaddr to be
+        * the same as source.
+        */
+       if (is_garp && ar_op == htons(ARPOP_REPLY))
+               is_garp =
+                       /* IPv4 over IEEE 1394 doesn't provide target
+                        * hardware address field in its ARP payload.
+                        */
+                       tha &&
+                       !memcmp(tha, sha, dev->addr_len);
+
+       if (is_garp) {
+               *addr_type = inet_addr_type_dev_table(net, dev, sip);
+               if (*addr_type != RTN_UNICAST)
+                       is_garp = false;
+       }
+       return is_garp;
+}
+
 /*
  *     Process an arp request.
  */
@@ -837,29 +863,25 @@ static int arp_process(struct net *net, struct sock *sk, struct sk_buff *skb)
 
        n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
 
-       if (IN_DEV_ARP_ACCEPT(in_dev)) {
-               unsigned int addr_type = inet_addr_type_dev_table(net, dev, sip);
+       addr_type = -1;
+       if (n || IN_DEV_ARP_ACCEPT(in_dev)) {
+               is_garp = arp_is_garp(net, dev, &addr_type, arp->ar_op,
+                                     sip, tip, sha, tha);
+       }
 
+       if (IN_DEV_ARP_ACCEPT(in_dev)) {
                /* Unsolicited ARP is not accepted by default.
                   It is possible, that this option should be enabled for some
                   devices (strip is candidate)
                 */
-               is_garp = tip == sip && addr_type == RTN_UNICAST;
-
-               /* Unsolicited ARP _replies_ also require target hwaddr to be
-                * the same as source.
-                */
-               if (is_garp && arp->ar_op == htons(ARPOP_REPLY))
-                       is_garp =
-                               /* IPv4 over IEEE 1394 doesn't provide target
-                                * hardware address field in its ARP payload.
-                                */
-                               tha &&
-                               !memcmp(tha, sha, dev->addr_len);
-
                if (!n &&
-                   ((arp->ar_op == htons(ARPOP_REPLY)  &&
-                               addr_type == RTN_UNICAST) || is_garp))
+                   (is_garp ||
+                    (arp->ar_op == htons(ARPOP_REPLY) &&
+                     (addr_type == RTN_UNICAST ||
+                      (addr_type < 0 &&
+                       /* postpone calculation to as late as possible */
+                       inet_addr_type_dev_table(net, dev, sip) ==
+                               RTN_UNICAST)))))
                        n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
        }
 
index 65cc02bd82bc87991a29135a58c059c7916a5a35..93322f895eab6136adbe22aa37a4eedc9687a0e4 100644 (file)
@@ -248,6 +248,7 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
        u8 *tail;
        u8 *vaddr;
        int nfrags;
+       int esph_offset;
        struct page *page;
        struct sk_buff *trailer;
        int tailen = esp->tailen;
@@ -313,11 +314,13 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
        }
 
 cow:
+       esph_offset = (unsigned char *)esp->esph - skb_transport_header(skb);
+
        nfrags = skb_cow_data(skb, tailen, &trailer);
        if (nfrags < 0)
                goto out;
        tail = skb_tail_pointer(trailer);
-       esp->esph = ip_esp_hdr(skb);
+       esp->esph = (struct ip_esp_hdr *)(skb_transport_header(skb) + esph_offset);
 
 skip_cow:
        esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto);
index da449ddb8cc172bd9091c00057a69a095f98b56d..ad9ad4aab5da7c7d11c3b80edbdfcbdd3d7153fe 100644 (file)
@@ -203,6 +203,7 @@ static void rt_fibinfo_free_cpus(struct rtable __rcu * __percpu *rtp)
 static void free_fib_info_rcu(struct rcu_head *head)
 {
        struct fib_info *fi = container_of(head, struct fib_info, rcu);
+       struct dst_metrics *m;
 
        change_nexthops(fi) {
                if (nexthop_nh->nh_dev)
@@ -213,8 +214,9 @@ static void free_fib_info_rcu(struct rcu_head *head)
                rt_fibinfo_free(&nexthop_nh->nh_rth_input);
        } endfor_nexthops(fi);
 
-       if (fi->fib_metrics != (u32 *) dst_default_metrics)
-               kfree(fi->fib_metrics);
+       m = fi->fib_metrics;
+       if (m != &dst_default_metrics && atomic_dec_and_test(&m->refcnt))
+               kfree(m);
        kfree(fi);
 }
 
@@ -971,11 +973,11 @@ fib_convert_metrics(struct fib_info *fi, const struct fib_config *cfg)
                        val = 255;
                if (type == RTAX_FEATURES && (val & ~RTAX_FEATURE_MASK))
                        return -EINVAL;
-               fi->fib_metrics[type - 1] = val;
+               fi->fib_metrics->metrics[type - 1] = val;
        }
 
        if (ecn_ca)
-               fi->fib_metrics[RTAX_FEATURES - 1] |= DST_FEATURE_ECN_CA;
+               fi->fib_metrics->metrics[RTAX_FEATURES - 1] |= DST_FEATURE_ECN_CA;
 
        return 0;
 }
@@ -1033,11 +1035,12 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
                goto failure;
        fib_info_cnt++;
        if (cfg->fc_mx) {
-               fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL);
+               fi->fib_metrics = kzalloc(sizeof(*fi->fib_metrics), GFP_KERNEL);
                if (!fi->fib_metrics)
                        goto failure;
+               atomic_set(&fi->fib_metrics->refcnt, 1);
        } else
-               fi->fib_metrics = (u32 *) dst_default_metrics;
+               fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics;
 
        fi->fib_net = net;
        fi->fib_protocol = cfg->fc_protocol;
@@ -1238,7 +1241,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
        if (fi->fib_priority &&
            nla_put_u32(skb, RTA_PRIORITY, fi->fib_priority))
                goto nla_put_failure;
-       if (rtnetlink_put_metrics(skb, fi->fib_metrics) < 0)
+       if (rtnetlink_put_metrics(skb, fi->fib_metrics->metrics) < 0)
                goto nla_put_failure;
 
        if (fi->fib_prefsrc &&
index 655d9eebe43e16a59102edcd3ea4bc177c6b341d..6883b3d4ba8f69de2cb924612d60f5671a219a84 100644 (file)
@@ -1385,8 +1385,12 @@ static void rt_add_uncached_list(struct rtable *rt)
 
 static void ipv4_dst_destroy(struct dst_entry *dst)
 {
+       struct dst_metrics *p = (struct dst_metrics *)DST_METRICS_PTR(dst);
        struct rtable *rt = (struct rtable *) dst;
 
+       if (p != &dst_default_metrics && atomic_dec_and_test(&p->refcnt))
+               kfree(p);
+
        if (!list_empty(&rt->rt_uncached)) {
                struct uncached_list *ul = rt->rt_uncached_list;
 
@@ -1438,7 +1442,11 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
                        rt->rt_gateway = nh->nh_gw;
                        rt->rt_uses_gateway = 1;
                }
-               dst_init_metrics(&rt->dst, fi->fib_metrics, true);
+               dst_init_metrics(&rt->dst, fi->fib_metrics->metrics, true);
+               if (fi->fib_metrics != &dst_default_metrics) {
+                       rt->dst._metrics |= DST_METRICS_REFCOUNTED;
+                       atomic_inc(&fi->fib_metrics->refcnt);
+               }
 #ifdef CONFIG_IP_ROUTE_CLASSID
                rt->dst.tclassid = nh->nh_tclassid;
 #endif
index 1e4c76d2b8278ba71d6cc2cf7ebfe483e241f76e..59792d283ff8c19048904cb790dbeebef14da73d 100644 (file)
@@ -1084,9 +1084,12 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
 {
        struct tcp_sock *tp = tcp_sk(sk);
        struct inet_sock *inet = inet_sk(sk);
+       struct sockaddr *uaddr = msg->msg_name;
        int err, flags;
 
-       if (!(sysctl_tcp_fastopen & TFO_CLIENT_ENABLE))
+       if (!(sysctl_tcp_fastopen & TFO_CLIENT_ENABLE) ||
+           (uaddr && msg->msg_namelen >= sizeof(uaddr->sa_family) &&
+            uaddr->sa_family == AF_UNSPEC))
                return -EOPNOTSUPP;
        if (tp->fastopen_req)
                return -EALREADY; /* Another Fast Open is in progress */
@@ -1108,7 +1111,7 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
                }
        }
        flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0;
-       err = __inet_stream_connect(sk->sk_socket, msg->msg_name,
+       err = __inet_stream_connect(sk->sk_socket, uaddr,
                                    msg->msg_namelen, flags, 1);
        /* fastopen_req could already be freed in __inet_stream_connect
         * if the connection times out or gets rst
@@ -2320,6 +2323,10 @@ int tcp_disconnect(struct sock *sk, int flags)
        tcp_set_ca_state(sk, TCP_CA_Open);
        tcp_clear_retrans(tp);
        inet_csk_delack_init(sk);
+       /* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 0
+        * issue in __tcp_select_window()
+        */
+       icsk->icsk_ack.rcv_mss = TCP_MIN_MSS;
        tcp_init_send_head(sk);
        memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));
        __sk_dst_reset(sk);
index 8d128ba79b66de52d4d60628fe8df6cc9bccbc3b..0c5b4caa19491eb04bc755032611c76f03008acb 100644 (file)
@@ -537,11 +537,10 @@ static inline int ip6gre_xmit_ipv4(struct sk_buff *skb, struct net_device *dev)
 
        memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
 
-       dsfield = ipv4_get_dsfield(iph);
-
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
-               fl6.flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT)
-                                         & IPV6_TCLASS_MASK;
+               dsfield = ipv4_get_dsfield(iph);
+       else
+               dsfield = ip6_tclass(t->parms.flowinfo);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
                fl6.flowi6_mark = skb->mark;
        else
@@ -598,9 +597,11 @@ static inline int ip6gre_xmit_ipv6(struct sk_buff *skb, struct net_device *dev)
 
        memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
 
-       dsfield = ipv6_get_dsfield(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
-               fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
+               dsfield = ipv6_get_dsfield(ipv6h);
+       else
+               dsfield = ip6_tclass(t->parms.flowinfo);
+
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
                fl6.flowlabel |= ip6_flowlabel(ipv6h);
        if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
index d4a31becbd25dda895d7391e1e65c2de237bf2a3..bf8a58a1c32d83a9605844075da5815be23a6bf1 100644 (file)
@@ -1466,6 +1466,11 @@ alloc_new_skb:
                         */
                        alloclen += sizeof(struct frag_hdr);
 
+                       copy = datalen - transhdrlen - fraggap;
+                       if (copy < 0) {
+                               err = -EINVAL;
+                               goto error;
+                       }
                        if (transhdrlen) {
                                skb = sock_alloc_send_skb(sk,
                                                alloclen + hh_len,
@@ -1515,13 +1520,9 @@ alloc_new_skb:
                                data += fraggap;
                                pskb_trim_unique(skb_prev, maxfraglen);
                        }
-                       copy = datalen - transhdrlen - fraggap;
-
-                       if (copy < 0) {
-                               err = -EINVAL;
-                               kfree_skb(skb);
-                               goto error;
-                       } else if (copy > 0 && getfrag(from, data + transhdrlen, offset, copy, fraggap, skb) < 0) {
+                       if (copy > 0 &&
+                           getfrag(from, data + transhdrlen, offset,
+                                   copy, fraggap, skb) < 0) {
                                err = -EFAULT;
                                kfree_skb(skb);
                                goto error;
index 6eb2ae507500b30959134aa3ed35c53c7b79aad9..7ae6c503f1ca2b089388598bfceb43e4aa2d2fea 100644 (file)
@@ -1196,7 +1196,7 @@ route_lookup:
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
        ipv6h = ipv6_hdr(skb);
-       ip6_flow_hdr(ipv6h, INET_ECN_encapsulate(0, dsfield),
+       ip6_flow_hdr(ipv6h, dsfield,
                     ip6_make_flowlabel(net, skb, fl6->flowlabel, true, fl6));
        ipv6h->hop_limit = hop_limit;
        ipv6h->nexthdr = proto;
@@ -1231,8 +1231,6 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
        if (tproto != IPPROTO_IPIP && tproto != 0)
                return -1;
 
-       dsfield = ipv4_get_dsfield(iph);
-
        if (t->parms.collect_md) {
                struct ip_tunnel_info *tun_info;
                const struct ip_tunnel_key *key;
@@ -1246,6 +1244,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
                fl6.flowi6_proto = IPPROTO_IPIP;
                fl6.daddr = key->u.ipv6.dst;
                fl6.flowlabel = key->label;
+               dsfield = ip6_tclass(key->label);
        } else {
                if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
                        encap_limit = t->parms.encap_limit;
@@ -1254,8 +1253,9 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
                fl6.flowi6_proto = IPPROTO_IPIP;
 
                if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
-                       fl6.flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT)
-                                        & IPV6_TCLASS_MASK;
+                       dsfield = ipv4_get_dsfield(iph);
+               else
+                       dsfield = ip6_tclass(t->parms.flowinfo);
                if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
                        fl6.flowi6_mark = skb->mark;
                else
@@ -1267,6 +1267,8 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
        if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
                return -1;
 
+       dsfield = INET_ECN_encapsulate(dsfield, ipv4_get_dsfield(iph));
+
        skb_set_inner_ipproto(skb, IPPROTO_IPIP);
 
        err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
@@ -1300,8 +1302,6 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
            ip6_tnl_addr_conflict(t, ipv6h))
                return -1;
 
-       dsfield = ipv6_get_dsfield(ipv6h);
-
        if (t->parms.collect_md) {
                struct ip_tunnel_info *tun_info;
                const struct ip_tunnel_key *key;
@@ -1315,6 +1315,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
                fl6.flowi6_proto = IPPROTO_IPV6;
                fl6.daddr = key->u.ipv6.dst;
                fl6.flowlabel = key->label;
+               dsfield = ip6_tclass(key->label);
        } else {
                offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb));
                /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */
@@ -1337,7 +1338,9 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
                fl6.flowi6_proto = IPPROTO_IPV6;
 
                if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
-                       fl6.flowlabel |= (*(__be32 *)ipv6h & IPV6_TCLASS_MASK);
+                       dsfield = ipv6_get_dsfield(ipv6h);
+               else
+                       dsfield = ip6_tclass(t->parms.flowinfo);
                if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
                        fl6.flowlabel |= ip6_flowlabel(ipv6h);
                if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
@@ -1351,6 +1354,8 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
        if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6))
                return -1;
 
+       dsfield = INET_ECN_encapsulate(dsfield, ipv6_get_dsfield(ipv6h));
+
        skb_set_inner_ipproto(skb, IPPROTO_IPV6);
 
        err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu,
index c1950bb14735bc914b53c0476342f2679ad50b87..512dc43d0ce6814f0a6d0507805025d75234eece 100644 (file)
@@ -3285,7 +3285,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
                p += pol->sadb_x_policy_len*8;
                sec_ctx = (struct sadb_x_sec_ctx *)p;
                if (len < pol->sadb_x_policy_len*8 +
-                   sec_ctx->sadb_x_sec_len) {
+                   sec_ctx->sadb_x_sec_len*8) {
                        *dir = -EINVAL;
                        goto out;
                }
index 8364fe5b59e4ca01ef8d05b1038dbe96fedf657b..c38d16f22d2a7ff265b8729d43b164312598fd9f 100644 (file)
@@ -311,6 +311,8 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
        int rc = -EINVAL;
 
        dprintk("%s: binding %02X\n", __func__, addr->sllc_sap);
+
+       lock_sock(sk);
        if (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr)))
                goto out;
        rc = -EAFNOSUPPORT;
@@ -382,6 +384,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
 out_put:
        llc_sap_put(sap);
 out:
+       release_sock(sk);
        return rc;
 }
 
index 35f4c7d7a50089e3998ff9860e86f6d26e1da600..1f75280ba26c78b3ad9864d0b63305cbba43f8fe 100644 (file)
@@ -2492,7 +2492,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
                if (is_multicast_ether_addr(hdr->addr1)) {
                        mpp_addr = hdr->addr3;
                        proxied_addr = mesh_hdr->eaddr1;
-               } else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) {
+               } else if ((mesh_hdr->flags & MESH_FLAGS_AE) ==
+                           MESH_FLAGS_AE_A5_A6) {
                        /* has_a4 already checked in ieee80211_rx_mesh_check */
                        mpp_addr = hdr->addr4;
                        proxied_addr = mesh_hdr->eaddr2;
index d2d7bdf1d5104b6e68284bbbb533c30f159844e2..ad99c1ceea6f42bf3e52500a4452f7f74e730be5 100644 (file)
@@ -849,10 +849,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
 {
        unsigned int verdict = NF_DROP;
 
-       if (IP_VS_FWD_METHOD(cp) != 0) {
-               pr_err("shouldn't reach here, because the box is on the "
-                      "half connection in the tun/dr module.\n");
-       }
+       if (IP_VS_FWD_METHOD(cp) != IP_VS_CONN_F_MASQ)
+               goto ignore_cp;
 
        /* Ensure the checksum is correct */
        if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) {
@@ -886,6 +884,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
                ip_vs_notrack(skb);
        else
                ip_vs_update_conntrack(skb, cp, 0);
+
+ignore_cp:
        verdict = NF_ACCEPT;
 
 out:
@@ -1385,8 +1385,11 @@ ip_vs_out(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, in
         */
        cp = pp->conn_out_get(ipvs, af, skb, &iph);
 
-       if (likely(cp))
+       if (likely(cp)) {
+               if (IP_VS_FWD_METHOD(cp) != IP_VS_CONN_F_MASQ)
+                       goto ignore_cp;
                return handle_response(af, skb, pd, cp, &iph, hooknum);
+       }
 
        /* Check for real-server-started requests */
        if (atomic_read(&ipvs->conn_out_counter)) {
@@ -1444,9 +1447,15 @@ ip_vs_out(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, in
                        }
                }
        }
+
+out:
        IP_VS_DBG_PKT(12, af, pp, skb, iph.off,
                      "ip_vs_out: packet continues traversal as normal");
        return NF_ACCEPT;
+
+ignore_cp:
+       __ip_vs_conn_put(cp);
+       goto out;
 }
 
 /*
index 3a60efa7799b2e4569af35ce943c67fc354dc68a..7f6100ca63be6dd4f37c24852fd16b9a71b8a823 100644 (file)
@@ -174,6 +174,10 @@ nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum)
 #endif
        if (h != NULL && !try_module_get(h->me))
                h = NULL;
+       if (h != NULL && !refcount_inc_not_zero(&h->refcnt)) {
+               module_put(h->me);
+               h = NULL;
+       }
 
        rcu_read_unlock();
 
@@ -181,6 +185,13 @@ nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum)
 }
 EXPORT_SYMBOL_GPL(nf_conntrack_helper_try_module_get);
 
+void nf_conntrack_helper_put(struct nf_conntrack_helper *helper)
+{
+       refcount_dec(&helper->refcnt);
+       module_put(helper->me);
+}
+EXPORT_SYMBOL_GPL(nf_conntrack_helper_put);
+
 struct nf_conn_help *
 nf_ct_helper_ext_add(struct nf_conn *ct,
                     struct nf_conntrack_helper *helper, gfp_t gfp)
@@ -417,6 +428,7 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
                        }
                }
        }
+       refcount_set(&me->refcnt, 1);
        hlist_add_head_rcu(&me->hnode, &nf_ct_helper_hash[h]);
        nf_ct_helper_count++;
 out:
index dcf561b5c97a47e627ee00649d756635db0e6fb3..9799a50bc604cc630494514cc80aa49edc2def0e 100644 (file)
@@ -45,6 +45,8 @@
 #include <net/netfilter/nf_conntrack_zones.h>
 #include <net/netfilter/nf_conntrack_timestamp.h>
 #include <net/netfilter/nf_conntrack_labels.h>
+#include <net/netfilter/nf_conntrack_seqadj.h>
+#include <net/netfilter/nf_conntrack_synproxy.h>
 #ifdef CONFIG_NF_NAT_NEEDED
 #include <net/netfilter/nf_nat_core.h>
 #include <net/netfilter/nf_nat_l4proto.h>
@@ -1007,9 +1009,8 @@ static const struct nla_policy tuple_nla_policy[CTA_TUPLE_MAX+1] = {
 
 static int
 ctnetlink_parse_tuple(const struct nlattr * const cda[],
-                     struct nf_conntrack_tuple *tuple,
-                     enum ctattr_type type, u_int8_t l3num,
-                     struct nf_conntrack_zone *zone)
+                     struct nf_conntrack_tuple *tuple, u32 type,
+                     u_int8_t l3num, struct nf_conntrack_zone *zone)
 {
        struct nlattr *tb[CTA_TUPLE_MAX+1];
        int err;
@@ -1828,6 +1829,8 @@ ctnetlink_create_conntrack(struct net *net,
        nf_ct_tstamp_ext_add(ct, GFP_ATOMIC);
        nf_ct_ecache_ext_add(ct, 0, 0, GFP_ATOMIC);
        nf_ct_labels_ext_add(ct);
+       nfct_seqadj_ext_add(ct);
+       nfct_synproxy_ext_add(ct);
 
        /* we must add conntrack extensions before confirmation. */
        ct->status |= IPS_CONFIRMED;
@@ -2447,7 +2450,7 @@ static struct nfnl_ct_hook ctnetlink_glue_hook = {
 
 static int ctnetlink_exp_dump_tuple(struct sk_buff *skb,
                                    const struct nf_conntrack_tuple *tuple,
-                                   enum ctattr_expect type)
+                                   u32 type)
 {
        struct nlattr *nest_parms;
 
index b48d6b5aae8a87d4ea69cae0e025739ebe3f1658..ef0be325a0c6368bfe29ecda39db37dcb178a6d2 100644 (file)
@@ -409,6 +409,10 @@ nf_nat_setup_info(struct nf_conn *ct,
 {
        struct nf_conntrack_tuple curr_tuple, new_tuple;
 
+       /* Can't setup nat info for confirmed ct. */
+       if (nf_ct_is_confirmed(ct))
+               return NF_ACCEPT;
+
        NF_CT_ASSERT(maniptype == NF_NAT_MANIP_SRC ||
                     maniptype == NF_NAT_MANIP_DST);
        BUG_ON(nf_nat_initialized(ct, maniptype));
index 5592250297402fe6e272f3213efa7e02ab230485..da314be0c048720172bbd153cd2f730b486603ce 100644 (file)
@@ -3367,35 +3367,50 @@ static int nf_tables_dump_setelem(const struct nft_ctx *ctx,
        return nf_tables_fill_setelem(args->skb, set, elem);
 }
 
+struct nft_set_dump_ctx {
+       const struct nft_set    *set;
+       struct nft_ctx          ctx;
+};
+
 static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
 {
+       struct nft_set_dump_ctx *dump_ctx = cb->data;
        struct net *net = sock_net(skb->sk);
-       u8 genmask = nft_genmask_cur(net);
+       struct nft_af_info *afi;
+       struct nft_table *table;
        struct nft_set *set;
        struct nft_set_dump_args args;
-       struct nft_ctx ctx;
-       struct nlattr *nla[NFTA_SET_ELEM_LIST_MAX + 1];
+       bool set_found = false;
        struct nfgenmsg *nfmsg;
        struct nlmsghdr *nlh;
        struct nlattr *nest;
        u32 portid, seq;
-       int event, err;
+       int event;
 
-       err = nlmsg_parse(cb->nlh, sizeof(struct nfgenmsg), nla,
-                         NFTA_SET_ELEM_LIST_MAX, nft_set_elem_list_policy,
-                         NULL);
-       if (err < 0)
-               return err;
+       rcu_read_lock();
+       list_for_each_entry_rcu(afi, &net->nft.af_info, list) {
+               if (afi != dump_ctx->ctx.afi)
+                       continue;
 
-       err = nft_ctx_init_from_elemattr(&ctx, net, cb->skb, cb->nlh,
-                                        (void *)nla, genmask);
-       if (err < 0)
-               return err;
+               list_for_each_entry_rcu(table, &afi->tables, list) {
+                       if (table != dump_ctx->ctx.table)
+                               continue;
 
-       set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_ELEM_LIST_SET],
-                                  genmask);
-       if (IS_ERR(set))
-               return PTR_ERR(set);
+                       list_for_each_entry_rcu(set, &table->sets, list) {
+                               if (set == dump_ctx->set) {
+                                       set_found = true;
+                                       break;
+                               }
+                       }
+                       break;
+               }
+               break;
+       }
+
+       if (!set_found) {
+               rcu_read_unlock();
+               return -ENOENT;
+       }
 
        event  = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWSETELEM);
        portid = NETLINK_CB(cb->skb).portid;
@@ -3407,11 +3422,11 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
                goto nla_put_failure;
 
        nfmsg = nlmsg_data(nlh);
-       nfmsg->nfgen_family = ctx.afi->family;
+       nfmsg->nfgen_family = afi->family;
        nfmsg->version      = NFNETLINK_V0;
-       nfmsg->res_id       = htons(ctx.net->nft.base_seq & 0xffff);
+       nfmsg->res_id       = htons(net->nft.base_seq & 0xffff);
 
-       if (nla_put_string(skb, NFTA_SET_ELEM_LIST_TABLE, ctx.table->name))
+       if (nla_put_string(skb, NFTA_SET_ELEM_LIST_TABLE, table->name))
                goto nla_put_failure;
        if (nla_put_string(skb, NFTA_SET_ELEM_LIST_SET, set->name))
                goto nla_put_failure;
@@ -3422,12 +3437,13 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
 
        args.cb                 = cb;
        args.skb                = skb;
-       args.iter.genmask       = nft_genmask_cur(ctx.net);
+       args.iter.genmask       = nft_genmask_cur(net);
        args.iter.skip          = cb->args[0];
        args.iter.count         = 0;
        args.iter.err           = 0;
        args.iter.fn            = nf_tables_dump_setelem;
-       set->ops->walk(&ctx, set, &args.iter);
+       set->ops->walk(&dump_ctx->ctx, set, &args.iter);
+       rcu_read_unlock();
 
        nla_nest_end(skb, nest);
        nlmsg_end(skb, nlh);
@@ -3441,9 +3457,16 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
        return skb->len;
 
 nla_put_failure:
+       rcu_read_unlock();
        return -ENOSPC;
 }
 
+static int nf_tables_dump_set_done(struct netlink_callback *cb)
+{
+       kfree(cb->data);
+       return 0;
+}
+
 static int nf_tables_getsetelem(struct net *net, struct sock *nlsk,
                                struct sk_buff *skb, const struct nlmsghdr *nlh,
                                const struct nlattr * const nla[])
@@ -3465,7 +3488,18 @@ static int nf_tables_getsetelem(struct net *net, struct sock *nlsk,
        if (nlh->nlmsg_flags & NLM_F_DUMP) {
                struct netlink_dump_control c = {
                        .dump = nf_tables_dump_set,
+                       .done = nf_tables_dump_set_done,
                };
+               struct nft_set_dump_ctx *dump_ctx;
+
+               dump_ctx = kmalloc(sizeof(*dump_ctx), GFP_KERNEL);
+               if (!dump_ctx)
+                       return -ENOMEM;
+
+               dump_ctx->set = set;
+               dump_ctx->ctx = ctx;
+
+               c.data = dump_ctx;
                return netlink_dump_start(nlsk, skb, nlh, &c);
        }
        return -EOPNOTSUPP;
@@ -3593,9 +3627,9 @@ void nft_set_elem_destroy(const struct nft_set *set, void *elem,
 {
        struct nft_set_ext *ext = nft_set_elem_ext(set, elem);
 
-       nft_data_uninit(nft_set_ext_key(ext), NFT_DATA_VALUE);
+       nft_data_release(nft_set_ext_key(ext), NFT_DATA_VALUE);
        if (nft_set_ext_exists(ext, NFT_SET_EXT_DATA))
-               nft_data_uninit(nft_set_ext_data(ext), set->dtype);
+               nft_data_release(nft_set_ext_data(ext), set->dtype);
        if (destroy_expr && nft_set_ext_exists(ext, NFT_SET_EXT_EXPR))
                nf_tables_expr_destroy(NULL, nft_set_ext_expr(ext));
        if (nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF))
@@ -3604,6 +3638,18 @@ void nft_set_elem_destroy(const struct nft_set *set, void *elem,
 }
 EXPORT_SYMBOL_GPL(nft_set_elem_destroy);
 
+/* Only called from commit path, nft_set_elem_deactivate() already deals with
+ * the refcounting from the preparation phase.
+ */
+static void nf_tables_set_elem_destroy(const struct nft_set *set, void *elem)
+{
+       struct nft_set_ext *ext = nft_set_elem_ext(set, elem);
+
+       if (nft_set_ext_exists(ext, NFT_SET_EXT_EXPR))
+               nf_tables_expr_destroy(NULL, nft_set_ext_expr(ext));
+       kfree(elem);
+}
+
 static int nft_setelem_parse_flags(const struct nft_set *set,
                                   const struct nlattr *attr, u32 *flags)
 {
@@ -3815,9 +3861,9 @@ err4:
        kfree(elem.priv);
 err3:
        if (nla[NFTA_SET_ELEM_DATA] != NULL)
-               nft_data_uninit(&data, d2.type);
+               nft_data_release(&data, d2.type);
 err2:
-       nft_data_uninit(&elem.key.val, d1.type);
+       nft_data_release(&elem.key.val, d1.type);
 err1:
        return err;
 }
@@ -3862,6 +3908,53 @@ static int nf_tables_newsetelem(struct net *net, struct sock *nlsk,
        return err;
 }
 
+/**
+ *     nft_data_hold - hold a nft_data item
+ *
+ *     @data: struct nft_data to release
+ *     @type: type of data
+ *
+ *     Hold a nft_data item. NFT_DATA_VALUE types can be silently discarded,
+ *     NFT_DATA_VERDICT bumps the reference to chains in case of NFT_JUMP and
+ *     NFT_GOTO verdicts. This function must be called on active data objects
+ *     from the second phase of the commit protocol.
+ */
+static void nft_data_hold(const struct nft_data *data, enum nft_data_types type)
+{
+       if (type == NFT_DATA_VERDICT) {
+               switch (data->verdict.code) {
+               case NFT_JUMP:
+               case NFT_GOTO:
+                       data->verdict.chain->use++;
+                       break;
+               }
+       }
+}
+
+static void nft_set_elem_activate(const struct net *net,
+                                 const struct nft_set *set,
+                                 struct nft_set_elem *elem)
+{
+       const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
+
+       if (nft_set_ext_exists(ext, NFT_SET_EXT_DATA))
+               nft_data_hold(nft_set_ext_data(ext), set->dtype);
+       if (nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF))
+               (*nft_set_ext_obj(ext))->use++;
+}
+
+static void nft_set_elem_deactivate(const struct net *net,
+                                   const struct nft_set *set,
+                                   struct nft_set_elem *elem)
+{
+       const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
+
+       if (nft_set_ext_exists(ext, NFT_SET_EXT_DATA))
+               nft_data_release(nft_set_ext_data(ext), set->dtype);
+       if (nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF))
+               (*nft_set_ext_obj(ext))->use--;
+}
+
 static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set,
                           const struct nlattr *attr)
 {
@@ -3927,6 +4020,8 @@ static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set,
        kfree(elem.priv);
        elem.priv = priv;
 
+       nft_set_elem_deactivate(ctx->net, set, &elem);
+
        nft_trans_elem(trans) = elem;
        list_add_tail(&trans->list, &ctx->net->nft.commit_list);
        return 0;
@@ -3936,7 +4031,7 @@ err4:
 err3:
        kfree(elem.priv);
 err2:
-       nft_data_uninit(&elem.key.val, desc.type);
+       nft_data_release(&elem.key.val, desc.type);
 err1:
        return err;
 }
@@ -4743,8 +4838,8 @@ static void nf_tables_commit_release(struct nft_trans *trans)
                nft_set_destroy(nft_trans_set(trans));
                break;
        case NFT_MSG_DELSETELEM:
-               nft_set_elem_destroy(nft_trans_elem_set(trans),
-                                    nft_trans_elem(trans).priv, true);
+               nf_tables_set_elem_destroy(nft_trans_elem_set(trans),
+                                          nft_trans_elem(trans).priv);
                break;
        case NFT_MSG_DELOBJ:
                nft_obj_destroy(nft_trans_obj(trans));
@@ -4979,6 +5074,7 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb)
                case NFT_MSG_DELSETELEM:
                        te = (struct nft_trans_elem *)trans->data;
 
+                       nft_set_elem_activate(net, te->set, &te->elem);
                        te->set->ops->activate(net, te->set, &te->elem);
                        te->set->ndeact--;
 
@@ -5464,7 +5560,7 @@ int nft_data_init(const struct nft_ctx *ctx,
 EXPORT_SYMBOL_GPL(nft_data_init);
 
 /**
- *     nft_data_uninit - release a nft_data item
+ *     nft_data_release - release a nft_data item
  *
  *     @data: struct nft_data to release
  *     @type: type of data
@@ -5472,7 +5568,7 @@ EXPORT_SYMBOL_GPL(nft_data_init);
  *     Release a nft_data item. NFT_DATA_VALUE types can be silently discarded,
  *     all others need to be released by calling this function.
  */
-void nft_data_uninit(const struct nft_data *data, enum nft_data_types type)
+void nft_data_release(const struct nft_data *data, enum nft_data_types type)
 {
        if (type < NFT_DATA_VERDICT)
                return;
@@ -5483,7 +5579,7 @@ void nft_data_uninit(const struct nft_data *data, enum nft_data_types type)
                WARN_ON(1);
        }
 }
-EXPORT_SYMBOL_GPL(nft_data_uninit);
+EXPORT_SYMBOL_GPL(nft_data_release);
 
 int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
                  enum nft_data_types type, unsigned int len)
index 950bf6eadc6578516ac92b50427fe682cba3976d..be678a323598c3237a2cae09e4e3ed4bdea46614 100644 (file)
@@ -686,6 +686,7 @@ static int nfnl_cthelper_del(struct net *net, struct sock *nfnl,
                tuple_set = true;
        }
 
+       ret = -ENOENT;
        list_for_each_entry_safe(nlcth, n, &nfnl_cthelper_list, list) {
                cur = &nlcth->helper;
                j++;
@@ -699,16 +700,20 @@ static int nfnl_cthelper_del(struct net *net, struct sock *nfnl,
                     tuple.dst.protonum != cur->tuple.dst.protonum))
                        continue;
 
-               found = true;
-               nf_conntrack_helper_unregister(cur);
-               kfree(cur->expect_policy);
+               if (refcount_dec_if_one(&cur->refcnt)) {
+                       found = true;
+                       nf_conntrack_helper_unregister(cur);
+                       kfree(cur->expect_policy);
 
-               list_del(&nlcth->list);
-               kfree(nlcth);
+                       list_del(&nlcth->list);
+                       kfree(nlcth);
+               } else {
+                       ret = -EBUSY;
+               }
        }
 
        /* Make sure we return success if we flush and there is no helpers */
-       return (found || j == 0) ? 0 : -ENOENT;
+       return (found || j == 0) ? 0 : ret;
 }
 
 static const struct nla_policy nfnl_cthelper_policy[NFCTH_MAX+1] = {
index 877d9acd91ef5c616c43d00f265facbfe4c2d334..fff8073e2a5692c14037a77c5d8151cf0c1bbcb0 100644 (file)
@@ -83,17 +83,26 @@ static int nft_bitwise_init(const struct nft_ctx *ctx,
                            tb[NFTA_BITWISE_MASK]);
        if (err < 0)
                return err;
-       if (d1.len != priv->len)
-               return -EINVAL;
+       if (d1.len != priv->len) {
+               err = -EINVAL;
+               goto err1;
+       }
 
        err = nft_data_init(NULL, &priv->xor, sizeof(priv->xor), &d2,
                            tb[NFTA_BITWISE_XOR]);
        if (err < 0)
-               return err;
-       if (d2.len != priv->len)
-               return -EINVAL;
+               goto err1;
+       if (d2.len != priv->len) {
+               err = -EINVAL;
+               goto err2;
+       }
 
        return 0;
+err2:
+       nft_data_release(&priv->xor, d2.type);
+err1:
+       nft_data_release(&priv->mask, d1.type);
+       return err;
 }
 
 static int nft_bitwise_dump(struct sk_buff *skb, const struct nft_expr *expr)
index 2b96effeadc1bc708a1f16e89342c8d39c4c4da7..c2945eb3397c8991ae05ea84abb2ba15591cbefb 100644 (file)
@@ -201,10 +201,18 @@ nft_cmp_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[])
        if (err < 0)
                return ERR_PTR(err);
 
+       if (desc.type != NFT_DATA_VALUE) {
+               err = -EINVAL;
+               goto err1;
+       }
+
        if (desc.len <= sizeof(u32) && op == NFT_CMP_EQ)
                return &nft_cmp_fast_ops;
-       else
-               return &nft_cmp_ops;
+
+       return &nft_cmp_ops;
+err1:
+       nft_data_release(&data, desc.type);
+       return ERR_PTR(-EINVAL);
 }
 
 struct nft_expr_type nft_cmp_type __read_mostly = {
index a34ceb38fc55681962daad2c323f0011a5fe683d..1678e9e75e8ee7d22301d6083ddeb04dd39ab385 100644 (file)
@@ -826,9 +826,9 @@ static void nft_ct_helper_obj_destroy(struct nft_object *obj)
        struct nft_ct_helper_obj *priv = nft_obj_data(obj);
 
        if (priv->helper4)
-               module_put(priv->helper4->me);
+               nf_conntrack_helper_put(priv->helper4);
        if (priv->helper6)
-               module_put(priv->helper6->me);
+               nf_conntrack_helper_put(priv->helper6);
 }
 
 static void nft_ct_helper_obj_eval(struct nft_object *obj,
index 728baf88295aab3d4f0e1272d551672ae5a2fb13..4717d77969271c324087ed7677df636b414e54ad 100644 (file)
@@ -65,7 +65,7 @@ static int nft_immediate_init(const struct nft_ctx *ctx,
        return 0;
 
 err1:
-       nft_data_uninit(&priv->data, desc.type);
+       nft_data_release(&priv->data, desc.type);
        return err;
 }
 
@@ -73,7 +73,8 @@ static void nft_immediate_destroy(const struct nft_ctx *ctx,
                                  const struct nft_expr *expr)
 {
        const struct nft_immediate_expr *priv = nft_expr_priv(expr);
-       return nft_data_uninit(&priv->data, nft_dreg_to_type(priv->dreg));
+
+       return nft_data_release(&priv->data, nft_dreg_to_type(priv->dreg));
 }
 
 static int nft_immediate_dump(struct sk_buff *skb, const struct nft_expr *expr)
index 9edc74eedc1021e836bc767defc02fac1a63333f..cedb96c3619fa991395602dff1363314d3de13ea 100644 (file)
@@ -102,9 +102,9 @@ static int nft_range_init(const struct nft_ctx *ctx, const struct nft_expr *expr
        priv->len = desc_from.len;
        return 0;
 err2:
-       nft_data_uninit(&priv->data_to, desc_to.type);
+       nft_data_release(&priv->data_to, desc_to.type);
 err1:
-       nft_data_uninit(&priv->data_from, desc_from.type);
+       nft_data_release(&priv->data_from, desc_from.type);
        return err;
 }
 
index 8ec086b6b56b742485e34511b38a77af848d9f99..3d3a6df4ce70ea0950a4f07cab75b3c54680e09a 100644 (file)
@@ -222,7 +222,7 @@ static void nft_hash_walk(const struct nft_ctx *ctx, struct nft_set *set,
        struct nft_set_elem elem;
        int err;
 
-       err = rhashtable_walk_init(&priv->ht, &hti, GFP_KERNEL);
+       err = rhashtable_walk_init(&priv->ht, &hti, GFP_ATOMIC);
        iter->err = err;
        if (err)
                return;
index 8876b7da6884c210393d1988032cbb5bd7018507..1770c1d9b37fc14be9d9d8cf4721d21c745826ad 100644 (file)
@@ -283,28 +283,30 @@ static int xt_obj_to_user(u16 __user *psize, u16 size,
                       &U->u.user.revision, K->u.kernel.TYPE->revision)
 
 int xt_data_to_user(void __user *dst, const void *src,
-                   int usersize, int size)
+                   int usersize, int size, int aligned_size)
 {
        usersize = usersize ? : size;
        if (copy_to_user(dst, src, usersize))
                return -EFAULT;
-       if (usersize != size && clear_user(dst + usersize, size - usersize))
+       if (usersize != aligned_size &&
+           clear_user(dst + usersize, aligned_size - usersize))
                return -EFAULT;
 
        return 0;
 }
 EXPORT_SYMBOL_GPL(xt_data_to_user);
 
-#define XT_DATA_TO_USER(U, K, TYPE, C_SIZE)                            \
+#define XT_DATA_TO_USER(U, K, TYPE)                                    \
        xt_data_to_user(U->data, K->data,                               \
                        K->u.kernel.TYPE->usersize,                     \
-                       C_SIZE ? : K->u.kernel.TYPE->TYPE##size)
+                       K->u.kernel.TYPE->TYPE##size,                   \
+                       XT_ALIGN(K->u.kernel.TYPE->TYPE##size))
 
 int xt_match_to_user(const struct xt_entry_match *m,
                     struct xt_entry_match __user *u)
 {
        return XT_OBJ_TO_USER(u, m, match, 0) ||
-              XT_DATA_TO_USER(u, m, match, 0);
+              XT_DATA_TO_USER(u, m, match);
 }
 EXPORT_SYMBOL_GPL(xt_match_to_user);
 
@@ -312,7 +314,7 @@ int xt_target_to_user(const struct xt_entry_target *t,
                      struct xt_entry_target __user *u)
 {
        return XT_OBJ_TO_USER(u, t, target, 0) ||
-              XT_DATA_TO_USER(u, t, target, 0);
+              XT_DATA_TO_USER(u, t, target);
 }
 EXPORT_SYMBOL_GPL(xt_target_to_user);
 
@@ -611,6 +613,12 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
 }
 EXPORT_SYMBOL_GPL(xt_compat_match_from_user);
 
+#define COMPAT_XT_DATA_TO_USER(U, K, TYPE, C_SIZE)                     \
+       xt_data_to_user(U->data, K->data,                               \
+                       K->u.kernel.TYPE->usersize,                     \
+                       C_SIZE,                                         \
+                       COMPAT_XT_ALIGN(C_SIZE))
+
 int xt_compat_match_to_user(const struct xt_entry_match *m,
                            void __user **dstptr, unsigned int *size)
 {
@@ -626,7 +634,7 @@ int xt_compat_match_to_user(const struct xt_entry_match *m,
                if (match->compat_to_user((void __user *)cm->data, m->data))
                        return -EFAULT;
        } else {
-               if (XT_DATA_TO_USER(cm, m, match, msize - sizeof(*cm)))
+               if (COMPAT_XT_DATA_TO_USER(cm, m, match, msize - sizeof(*cm)))
                        return -EFAULT;
        }
 
@@ -972,7 +980,7 @@ int xt_compat_target_to_user(const struct xt_entry_target *t,
                if (target->compat_to_user((void __user *)ct->data, t->data))
                        return -EFAULT;
        } else {
-               if (XT_DATA_TO_USER(ct, t, target, tsize - sizeof(*ct)))
+               if (COMPAT_XT_DATA_TO_USER(ct, t, target, tsize - sizeof(*ct)))
                        return -EFAULT;
        }
 
index bb7ad82dcd5603e810db8fba35f81d3f2c03a2b7..623ef37de886fa22fd508a1261f0c1934f767e5f 100644 (file)
@@ -96,7 +96,7 @@ xt_ct_set_helper(struct nf_conn *ct, const char *helper_name,
 
        help = nf_ct_helper_ext_add(ct, helper, GFP_KERNEL);
        if (help == NULL) {
-               module_put(helper->me);
+               nf_conntrack_helper_put(helper);
                return -ENOMEM;
        }
 
@@ -263,7 +263,7 @@ out:
 err4:
        help = nfct_help(ct);
        if (help)
-               module_put(help->helper->me);
+               nf_conntrack_helper_put(help->helper);
 err3:
        nf_ct_tmpl_free(ct);
 err2:
@@ -346,7 +346,7 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par,
        if (ct) {
                help = nfct_help(ct);
                if (help)
-                       module_put(help->helper->me);
+                       nf_conntrack_helper_put(help->helper);
 
                nf_ct_netns_put(par->net, par->family);
 
index bf602e33c40af4896240c9cc0566fa10126cf662..08679ebb3068298a58a081926c6a7dd5a2a73d17 100644 (file)
@@ -1123,7 +1123,7 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
 
        help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL);
        if (!help) {
-               module_put(helper->me);
+               nf_conntrack_helper_put(helper);
                return -ENOMEM;
        }
 
@@ -1584,7 +1584,7 @@ void ovs_ct_free_action(const struct nlattr *a)
 static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info)
 {
        if (ct_info->helper)
-               module_put(ct_info->helper->me);
+               nf_conntrack_helper_put(ct_info->helper);
        if (ct_info->ct)
                nf_ct_tmpl_free(ct_info->ct);
 }
index dee469fed9671d518dbeddd6bd48d96cc9158675..51859b8edd7eff3845ca3d5b5b0d900583736d4a 100644 (file)
@@ -203,7 +203,6 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,
 
        *arg = (unsigned long) head;
        rcu_assign_pointer(tp->root, new);
-       call_rcu(&head->rcu, mall_destroy_rcu);
        return 0;
 
 err_replace_hw_filter:
index a9708da28eb53ff2987264c6c7d7ca6ec2ff09e9..95238284c422e23fbd834a3aedc54c9243743d0f 100644 (file)
@@ -1176,7 +1176,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
 
                asoc->ctsn_ack_point = asoc->next_tsn - 1;
                asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
-               if (!asoc->stream) {
+
+               if (sctp_state(asoc, COOKIE_WAIT)) {
+                       sctp_stream_free(asoc->stream);
                        asoc->stream = new->stream;
                        new->stream = NULL;
                }
index 0e06a278d2a911e2360e75e983b623e453284b7b..ba9ad32fc44740b9ec45d95e265d3d895148d7a7 100644 (file)
@@ -473,15 +473,14 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
                             struct sctp_association **app,
                             struct sctp_transport **tpp)
 {
+       struct sctp_init_chunk *chunkhdr, _chunkhdr;
        union sctp_addr saddr;
        union sctp_addr daddr;
        struct sctp_af *af;
        struct sock *sk = NULL;
        struct sctp_association *asoc;
        struct sctp_transport *transport = NULL;
-       struct sctp_init_chunk *chunkhdr;
        __u32 vtag = ntohl(sctphdr->vtag);
-       int len = skb->len - ((void *)sctphdr - (void *)skb->data);
 
        *app = NULL; *tpp = NULL;
 
@@ -516,13 +515,16 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
         * discard the packet.
         */
        if (vtag == 0) {
-               chunkhdr = (void *)sctphdr + sizeof(struct sctphdr);
-               if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t)
-                         + sizeof(__be32) ||
+               /* chunk header + first 4 octects of init header */
+               chunkhdr = skb_header_pointer(skb, skb_transport_offset(skb) +
+                                             sizeof(struct sctphdr),
+                                             sizeof(struct sctp_chunkhdr) +
+                                             sizeof(__be32), &_chunkhdr);
+               if (!chunkhdr ||
                    chunkhdr->chunk_hdr.type != SCTP_CID_INIT ||
-                   ntohl(chunkhdr->init_hdr.init_tag) != asoc->c.my_vtag) {
+                   ntohl(chunkhdr->init_hdr.init_tag) != asoc->c.my_vtag)
                        goto out;
-               }
+
        } else if (vtag != asoc->c.peer_vtag) {
                goto out;
        }
index 8a08f13469c4cc26aeec55de6793b2c2e3c562a6..92e332e173914f16c10ba54038dbb78dee0d0c49 100644 (file)
@@ -2454,16 +2454,11 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
         * stream sequence number shall be set to 0.
         */
 
-       /* Allocate storage for the negotiated streams if it is not a temporary
-        * association.
-        */
-       if (!asoc->temp) {
-               if (sctp_stream_init(asoc, gfp))
-                       goto clean_up;
+       if (sctp_stream_init(asoc, gfp))
+               goto clean_up;
 
-               if (sctp_assoc_set_id(asoc, gfp))
-                       goto clean_up;
-       }
+       if (!asoc->temp && sctp_assoc_set_id(asoc, gfp))
+               goto clean_up;
 
        /* ADDIP Section 4.1 ASCONF Chunk Procedures
         *
index 4f5e6cfc7f601b4de8db8802668d553f1af8491d..f863b5573e42d6f1c4908bf045af0079edc4b2d9 100644 (file)
@@ -2088,6 +2088,9 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net,
                }
        }
 
+       /* Set temp so that it won't be added into hashtable */
+       new_asoc->temp = 1;
+
        /* Compare the tie_tag in cookie with the verification tag of
         * current association.
         */
index 6f7f6757ceefb500551fafbf40c462835c4baf88..dfc8c51e4d74ec378a338ab9bb2560b3811f393b 100644 (file)
@@ -1540,8 +1540,7 @@ static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
        long timeout;
        int err;
        struct vsock_transport_send_notify_data send_data;
-
-       DEFINE_WAIT(wait);
+       DEFINE_WAIT_FUNC(wait, woken_wake_function);
 
        sk = sock->sk;
        vsk = vsock_sk(sk);
@@ -1584,11 +1583,10 @@ static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
        if (err < 0)
                goto out;
 
-
        while (total_written < len) {
                ssize_t written;
 
-               prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
+               add_wait_queue(sk_sleep(sk), &wait);
                while (vsock_stream_has_space(vsk) == 0 &&
                       sk->sk_err == 0 &&
                       !(sk->sk_shutdown & SEND_SHUTDOWN) &&
@@ -1597,33 +1595,30 @@ static int vsock_stream_sendmsg(struct socket *sock, struct msghdr *msg,
                        /* Don't wait for non-blocking sockets. */
                        if (timeout == 0) {
                                err = -EAGAIN;
-                               finish_wait(sk_sleep(sk), &wait);
+                               remove_wait_queue(sk_sleep(sk), &wait);
                                goto out_err;
                        }
 
                        err = transport->notify_send_pre_block(vsk, &send_data);
                        if (err < 0) {
-                               finish_wait(sk_sleep(sk), &wait);
+                               remove_wait_queue(sk_sleep(sk), &wait);
                                goto out_err;
                        }
 
                        release_sock(sk);
-                       timeout = schedule_timeout(timeout);
+                       timeout = wait_woken(&wait, TASK_INTERRUPTIBLE, timeout);
                        lock_sock(sk);
                        if (signal_pending(current)) {
                                err = sock_intr_errno(timeout);
-                               finish_wait(sk_sleep(sk), &wait);
+                               remove_wait_queue(sk_sleep(sk), &wait);
                                goto out_err;
                        } else if (timeout == 0) {
                                err = -EAGAIN;
-                               finish_wait(sk_sleep(sk), &wait);
+                               remove_wait_queue(sk_sleep(sk), &wait);
                                goto out_err;
                        }
-
-                       prepare_to_wait(sk_sleep(sk), &wait,
-                                       TASK_INTERRUPTIBLE);
                }
-               finish_wait(sk_sleep(sk), &wait);
+               remove_wait_queue(sk_sleep(sk), &wait);
 
                /* These checks occur both as part of and after the loop
                 * conditional since we need to check before and after
index 14d5f0c8c45ff07224f2dc8e6310c2edc440874e..9f0901f3e42b60db2c6aee7927b2b0ddc0ab7759 100644 (file)
@@ -322,9 +322,9 @@ cfg80211_find_sched_scan_req(struct cfg80211_registered_device *rdev, u64 reqid)
 {
        struct cfg80211_sched_scan_request *pos;
 
-       ASSERT_RTNL();
+       WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_rtnl_is_held());
 
-       list_for_each_entry(pos, &rdev->sched_scan_req_list, list) {
+       list_for_each_entry_rcu(pos, &rdev->sched_scan_req_list, list) {
                if (pos->reqid == reqid)
                        return pos;
        }
@@ -398,13 +398,13 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid)
        trace_cfg80211_sched_scan_results(wiphy, reqid);
        /* ignore if we're not scanning */
 
-       rtnl_lock();
+       rcu_read_lock();
        request = cfg80211_find_sched_scan_req(rdev, reqid);
        if (request) {
                request->report_results = true;
                queue_work(cfg80211_wq, &rdev->sched_scan_res_wk);
        }
-       rtnl_unlock();
+       rcu_read_unlock();
 }
 EXPORT_SYMBOL(cfg80211_sched_scan_results);
 
index 7198373e29206a0f19f006578596fea78e82f66e..4992f1025c9d3749bddd5f22948d2dad791aa9a9 100644 (file)
@@ -454,6 +454,8 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
        if (iftype == NL80211_IFTYPE_MESH_POINT)
                skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
 
+       mesh_flags &= MESH_FLAGS_AE;
+
        switch (hdr->frame_control &
                cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
        case cpu_to_le16(IEEE80211_FCTL_TODS):
@@ -469,9 +471,9 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
                             iftype != NL80211_IFTYPE_STATION))
                        return -1;
                if (iftype == NL80211_IFTYPE_MESH_POINT) {
-                       if (mesh_flags & MESH_FLAGS_AE_A4)
+                       if (mesh_flags == MESH_FLAGS_AE_A4)
                                return -1;
-                       if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
+                       if (mesh_flags == MESH_FLAGS_AE_A5_A6) {
                                skb_copy_bits(skb, hdrlen +
                                        offsetof(struct ieee80211s_hdr, eaddr1),
                                        tmp.h_dest, 2 * ETH_ALEN);
@@ -487,9 +489,9 @@ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
                     ether_addr_equal(tmp.h_source, addr)))
                        return -1;
                if (iftype == NL80211_IFTYPE_MESH_POINT) {
-                       if (mesh_flags & MESH_FLAGS_AE_A5_A6)
+                       if (mesh_flags == MESH_FLAGS_AE_A5_A6)
                                return -1;
-                       if (mesh_flags & MESH_FLAGS_AE_A4)
+                       if (mesh_flags == MESH_FLAGS_AE_A4)
                                skb_copy_bits(skb, hdrlen +
                                        offsetof(struct ieee80211s_hdr, eaddr1),
                                        tmp.h_source, ETH_ALEN);
index 8ec8a3fcf8d4740670b16c2c1af099ef0beaa5c5..574e6f32f94f29a496ef20f1a673a0e718a1a31b 100644 (file)
@@ -170,7 +170,7 @@ static int xfrm_dev_feat_change(struct net_device *dev)
 
 static int xfrm_dev_down(struct net_device *dev)
 {
-       if (dev->hw_features & NETIF_F_HW_ESP)
+       if (dev->features & NETIF_F_HW_ESP)
                xfrm_dev_state_flush(dev_net(dev), dev, true);
 
        xfrm_garbage_collect(dev_net(dev));
index b00a1d5a7f52e54f2ac454da3eeb14447f84d8b2..ed4e52d95172e2d8dcca603cdf62cfb55517f3c9 100644 (file)
@@ -1797,43 +1797,6 @@ free_dst:
        goto out;
 }
 
-#ifdef CONFIG_XFRM_SUB_POLICY
-static int xfrm_dst_alloc_copy(void **target, const void *src, int size)
-{
-       if (!*target) {
-               *target = kmalloc(size, GFP_ATOMIC);
-               if (!*target)
-                       return -ENOMEM;
-       }
-
-       memcpy(*target, src, size);
-       return 0;
-}
-#endif
-
-static int xfrm_dst_update_parent(struct dst_entry *dst,
-                                 const struct xfrm_selector *sel)
-{
-#ifdef CONFIG_XFRM_SUB_POLICY
-       struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
-       return xfrm_dst_alloc_copy((void **)&(xdst->partner),
-                                  sel, sizeof(*sel));
-#else
-       return 0;
-#endif
-}
-
-static int xfrm_dst_update_origin(struct dst_entry *dst,
-                                 const struct flowi *fl)
-{
-#ifdef CONFIG_XFRM_SUB_POLICY
-       struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
-       return xfrm_dst_alloc_copy((void **)&(xdst->origin), fl, sizeof(*fl));
-#else
-       return 0;
-#endif
-}
-
 static int xfrm_expand_policies(const struct flowi *fl, u16 family,
                                struct xfrm_policy **pols,
                                int *num_pols, int *num_xfrms)
@@ -1905,16 +1868,6 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
 
        xdst = (struct xfrm_dst *)dst;
        xdst->num_xfrms = err;
-       if (num_pols > 1)
-               err = xfrm_dst_update_parent(dst, &pols[1]->selector);
-       else
-               err = xfrm_dst_update_origin(dst, fl);
-       if (unlikely(err)) {
-               dst_free(dst);
-               XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTBUNDLECHECKERROR);
-               return ERR_PTR(err);
-       }
-
        xdst->num_pols = num_pols;
        memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols);
        xdst->policy_genid = atomic_read(&pols[0]->genid);
index fc3c5aa387543a63bf18955e60309207bf06e961..2e291bc5f1fc1003ca62e40f67da8a6a46875c02 100644 (file)
@@ -1383,6 +1383,8 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig)
        x->curlft.add_time = orig->curlft.add_time;
        x->km.state = orig->km.state;
        x->km.seq = orig->km.seq;
+       x->replay = orig->replay;
+       x->preplay = orig->preplay;
 
        return x;
 
index 58df440013c54c00da464166f1905bfd4edfbd36..918e45268915de1c64e5b8b783ba423488e8f319 100644 (file)
@@ -2328,6 +2328,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
        SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
+       SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
        SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
        SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
        SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
@@ -2342,6 +2343,7 @@ static const struct hda_model_fixup alc882_fixup_models[] = {
        {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
        {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
        {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
+       {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
        {}
 };
 
@@ -6014,6 +6016,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
        {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
        {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
        {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
+       {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
        {}
 };
 #define ALC225_STANDARD_PINS \
@@ -6465,8 +6468,11 @@ static int patch_alc269(struct hda_codec *codec)
                break;
        case 0x10ec0225:
        case 0x10ec0295:
+               spec->codec_variant = ALC269_TYPE_ALC225;
+               break;
        case 0x10ec0299:
                spec->codec_variant = ALC269_TYPE_ALC225;
+               spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
                break;
        case 0x10ec0234:
        case 0x10ec0274:
@@ -7338,6 +7344,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = {
        {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
        {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
        {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
+       {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
        {}
 };
 
index faa3d38bac0b7e51ab206440e8d17f4f6d751530..6cefdf6c0b758770e2615126285d7cd83d736d64 100644 (file)
@@ -1559,6 +1559,8 @@ static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
                      "Dell Inspiron 1501", STAC_9200_DELL_M26),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
                      "unknown Dell", STAC_9200_DELL_M26),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0201,
+                     "Dell Latitude D430", STAC_9200_DELL_M22),
        /* Panasonic */
        SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
        /* Gateway machines needs EAPD to be set on resume */
index 01eff6ce6401a3f8c6c8b51da93524f635bba86a..d7b0b0a3a2db55617a908e2fe4a8a2af90082e02 100644 (file)
@@ -1364,7 +1364,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
        /* Amanero Combo384 USB interface with native DSD support */
        case USB_ID(0x16d0, 0x071a):
                if (fp->altsetting == 2) {
-                       switch (chip->dev->descriptor.bcdDevice) {
+                       switch (le16_to_cpu(chip->dev->descriptor.bcdDevice)) {
                        case 0x199:
                                return SNDRV_PCM_FMTBIT_DSD_U32_LE;
                        case 0x19b:
index 6ebd3e6a1fd12d3202067020b48446fd9bdcff98..5e3c673fa3f4435b027fbc634815be10c26cf39f 100644 (file)
@@ -27,6 +27,8 @@
 #define __KVM_HAVE_IRQ_LINE
 #define __KVM_HAVE_READONLY_MEM
 
+#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
+
 #define KVM_REG_SIZE(id)                                               \
        (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
 
@@ -114,6 +116,8 @@ struct kvm_debug_exit_arch {
 };
 
 struct kvm_sync_regs {
+       /* Used with KVM_CAP_ARM_USER_IRQ */
+       __u64 device_irq_level;
 };
 
 struct kvm_arch_memory_slot {
@@ -192,13 +196,17 @@ struct kvm_arch_memory_slot {
 #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
 #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
 #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO  7
+#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS  8
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \
                        (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff
 #define VGIC_LEVEL_INFO_LINE_LEVEL     0
 
-#define   KVM_DEV_ARM_VGIC_CTRL_INIT    0
+#define   KVM_DEV_ARM_VGIC_CTRL_INIT           0
+#define   KVM_DEV_ARM_ITS_SAVE_TABLES          1
+#define   KVM_DEV_ARM_ITS_RESTORE_TABLES       2
+#define   KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3
 
 /* KVM_IRQ_LINE irq field index values */
 #define KVM_ARM_IRQ_TYPE_SHIFT         24
index c2860358ae3e0c3271d9ca4b944351986276e397..70eea2ecc6631cab3d718c3958cd0513a7f7e6a3 100644 (file)
@@ -39,6 +39,8 @@
 #define __KVM_HAVE_IRQ_LINE
 #define __KVM_HAVE_READONLY_MEM
 
+#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
+
 #define KVM_REG_SIZE(id)                                               \
        (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
 
@@ -143,6 +145,8 @@ struct kvm_debug_exit_arch {
 #define KVM_GUESTDBG_USE_HW            (1 << 17)
 
 struct kvm_sync_regs {
+       /* Used with KVM_CAP_ARM_USER_IRQ */
+       __u64 device_irq_level;
 };
 
 struct kvm_arch_memory_slot {
@@ -212,13 +216,17 @@ struct kvm_arch_memory_slot {
 #define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
 #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
 #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO  7
+#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \
                        (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff
 #define VGIC_LEVEL_INFO_LINE_LEVEL     0
 
-#define   KVM_DEV_ARM_VGIC_CTRL_INIT   0
+#define   KVM_DEV_ARM_VGIC_CTRL_INIT           0
+#define   KVM_DEV_ARM_ITS_SAVE_TABLES           1
+#define   KVM_DEV_ARM_ITS_RESTORE_TABLES        2
+#define   KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3
 
 /* Device Control API on vcpu fd */
 #define KVM_ARM_VCPU_PMU_V3_CTRL       0
index 4edbe4bb0e8b0cdd2553c74df9988823990833d9..07fbeb927834f3a96278414aedaa59ea580ae8de 100644 (file)
@@ -29,6 +29,9 @@
 #define __KVM_HAVE_IRQ_LINE
 #define __KVM_HAVE_GUEST_DEBUG
 
+/* Not always available, but if it is, this is the correct offset.  */
+#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
+
 struct kvm_regs {
        __u64 pc;
        __u64 cr;
index 7f4fd65e9208514b99112c51f0e018f3f441712f..3dd2a1d308dd0b92c36c3c5ca5276fd19838f252 100644 (file)
@@ -26,6 +26,8 @@
 #define KVM_DEV_FLIC_ADAPTER_REGISTER  6
 #define KVM_DEV_FLIC_ADAPTER_MODIFY    7
 #define KVM_DEV_FLIC_CLEAR_IO_IRQ      8
+#define KVM_DEV_FLIC_AISM              9
+#define KVM_DEV_FLIC_AIRQ_INJECT       10
 /*
  * We can have up to 4*64k pending subchannels + 8 adapter interrupts,
  * as well as up  to ASYNC_PF_PER_VCPU*KVM_MAX_VCPUS pfault done interrupts.
@@ -41,7 +43,14 @@ struct kvm_s390_io_adapter {
        __u8 isc;
        __u8 maskable;
        __u8 swap;
-       __u8 pad;
+       __u8 flags;
+};
+
+#define KVM_S390_ADAPTER_SUPPRESSIBLE 0x01
+
+struct kvm_s390_ais_req {
+       __u8 isc;
+       __u16 mode;
 };
 
 #define KVM_S390_IO_ADAPTER_MASK 1
@@ -110,6 +119,7 @@ struct kvm_s390_vm_cpu_machine {
 #define KVM_S390_VM_CPU_FEAT_CMMA      10
 #define KVM_S390_VM_CPU_FEAT_PFMFI     11
 #define KVM_S390_VM_CPU_FEAT_SIGPIF    12
+#define KVM_S390_VM_CPU_FEAT_KSS       13
 struct kvm_s390_vm_cpu_feat {
        __u64 feat[16];
 };
@@ -198,6 +208,10 @@ struct kvm_guest_debug_arch {
 #define KVM_SYNC_VRS    (1UL << 6)
 #define KVM_SYNC_RICCB  (1UL << 7)
 #define KVM_SYNC_FPRS   (1UL << 8)
+#define KVM_SYNC_GSCB   (1UL << 9)
+/* length and alignment of the sdnx as a power of two */
+#define SDNXC 8
+#define SDNXL (1UL << SDNXC)
 /* definition of registers in kvm_run */
 struct kvm_sync_regs {
        __u64 prefix;   /* prefix register */
@@ -218,8 +232,16 @@ struct kvm_sync_regs {
        };
        __u8  reserved[512];    /* for future vector expansion */
        __u32 fpc;              /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */
-       __u8 padding[52];       /* riccb needs to be 64byte aligned */
+       __u8 padding1[52];      /* riccb needs to be 64byte aligned */
        __u8 riccb[64];         /* runtime instrumentation controls block */
+       __u8 padding2[192];     /* sdnx needs to be 256byte aligned */
+       union {
+               __u8 sdnx[SDNXL];  /* state description annex */
+               struct {
+                       __u64 reserved1[2];
+                       __u64 gscb[4];
+               };
+       };
 };
 
 #define KVM_REG_S390_TODPR     (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
index 0fe00446f9cac8c16e1ae3fcabc4a469b772597b..2701e5f8145bd250c3a35dc12cab5839e16ff30d 100644 (file)
 #define X86_FEATURE_AVX512_4VNNIW (7*32+16) /* AVX-512 Neural Network Instructions */
 #define X86_FEATURE_AVX512_4FMAPS (7*32+17) /* AVX-512 Multiply Accumulation Single precision */
 
+#define X86_FEATURE_MBA         ( 7*32+18) /* Memory Bandwidth Allocation */
+
 /* Virtualization flags: Linux defined, word 8 */
 #define X86_FEATURE_TPR_SHADOW  ( 8*32+ 0) /* Intel TPR Shadow */
 #define X86_FEATURE_VNMI        ( 8*32+ 1) /* Intel Virtual NMI */
index 85599ad4d0247863cef655d02b9a4b3f83c77fb7..5dff775af7cd6456f7177d9ce5888ae78dc6bc10 100644 (file)
 # define DISABLE_OSPKE         (1<<(X86_FEATURE_OSPKE & 31))
 #endif /* CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS */
 
+#ifdef CONFIG_X86_5LEVEL
+# define DISABLE_LA57  0
+#else
+# define DISABLE_LA57  (1<<(X86_FEATURE_LA57 & 31))
+#endif
+
 /*
  * Make sure to add features to the correct mask
  */
@@ -55,7 +61,7 @@
 #define DISABLED_MASK13        0
 #define DISABLED_MASK14        0
 #define DISABLED_MASK15        0
-#define DISABLED_MASK16        (DISABLE_PKU|DISABLE_OSPKE)
+#define DISABLED_MASK16        (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57)
 #define DISABLED_MASK17        0
 #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18)
 
index fac9a5c0abe94b233b72b35bca8c7a665847b694..d91ba04dd00709b7e549ced791759c12cf70d5d0 100644 (file)
 # define NEED_MOVBE    0
 #endif
 
+#ifdef CONFIG_X86_5LEVEL
+# define NEED_LA57     (1<<(X86_FEATURE_LA57 & 31))
+#else
+# define NEED_LA57     0
+#endif
+
 #ifdef CONFIG_X86_64
 #ifdef CONFIG_PARAVIRT
 /* Paravirtualized systems may not have PSE or PGE available */
 #define REQUIRED_MASK13        0
 #define REQUIRED_MASK14        0
 #define REQUIRED_MASK15        0
-#define REQUIRED_MASK16        0
+#define REQUIRED_MASK16        (NEED_LA57)
 #define REQUIRED_MASK17        0
 #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 18)
 
index 739c0c5940226d7af38d2ab4bc068f7772f1a8c7..c2824d02ba3762553b62a07709058102050e34da 100644 (file)
@@ -9,6 +9,9 @@
 #include <linux/types.h>
 #include <linux/ioctl.h>
 
+#define KVM_PIO_PAGE_OFFSET 1
+#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
+
 #define DE_VECTOR 0
 #define DB_VECTOR 1
 #define BP_VECTOR 3
index 14458658e988bb6c9333e73701ea55e7b6525a92..690a2dcf407860cf54793f03e69d8761b06f068d 100644 (file)
 #define EXIT_REASON_WBINVD              54
 #define EXIT_REASON_XSETBV              55
 #define EXIT_REASON_APIC_WRITE          56
+#define EXIT_REASON_RDRAND              57
 #define EXIT_REASON_INVPCID             58
+#define EXIT_REASON_VMFUNC              59
+#define EXIT_REASON_ENCLS               60
+#define EXIT_REASON_RDSEED              61
 #define EXIT_REASON_PML_FULL            62
 #define EXIT_REASON_XSAVES              63
 #define EXIT_REASON_XRSTORS             64
@@ -90,6 +94,7 @@
        { EXIT_REASON_TASK_SWITCH,           "TASK_SWITCH" }, \
        { EXIT_REASON_CPUID,                 "CPUID" }, \
        { EXIT_REASON_HLT,                   "HLT" }, \
+       { EXIT_REASON_INVD,                  "INVD" }, \
        { EXIT_REASON_INVLPG,                "INVLPG" }, \
        { EXIT_REASON_RDPMC,                 "RDPMC" }, \
        { EXIT_REASON_RDTSC,                 "RDTSC" }, \
        { EXIT_REASON_IO_INSTRUCTION,        "IO_INSTRUCTION" }, \
        { EXIT_REASON_MSR_READ,              "MSR_READ" }, \
        { EXIT_REASON_MSR_WRITE,             "MSR_WRITE" }, \
+       { EXIT_REASON_INVALID_STATE,         "INVALID_STATE" }, \
+       { EXIT_REASON_MSR_LOAD_FAIL,         "MSR_LOAD_FAIL" }, \
        { EXIT_REASON_MWAIT_INSTRUCTION,     "MWAIT_INSTRUCTION" }, \
        { EXIT_REASON_MONITOR_TRAP_FLAG,     "MONITOR_TRAP_FLAG" }, \
        { EXIT_REASON_MONITOR_INSTRUCTION,   "MONITOR_INSTRUCTION" }, \
        { EXIT_REASON_MCE_DURING_VMENTRY,    "MCE_DURING_VMENTRY" }, \
        { EXIT_REASON_TPR_BELOW_THRESHOLD,   "TPR_BELOW_THRESHOLD" }, \
        { EXIT_REASON_APIC_ACCESS,           "APIC_ACCESS" }, \
-       { EXIT_REASON_GDTR_IDTR,             "GDTR_IDTR" }, \
-       { EXIT_REASON_LDTR_TR,               "LDTR_TR" }, \
+       { EXIT_REASON_EOI_INDUCED,           "EOI_INDUCED" }, \
+       { EXIT_REASON_GDTR_IDTR,             "GDTR_IDTR" }, \
+       { EXIT_REASON_LDTR_TR,               "LDTR_TR" }, \
        { EXIT_REASON_EPT_VIOLATION,         "EPT_VIOLATION" }, \
        { EXIT_REASON_EPT_MISCONFIG,         "EPT_MISCONFIG" }, \
        { EXIT_REASON_INVEPT,                "INVEPT" }, \
+       { EXIT_REASON_RDTSCP,                "RDTSCP" }, \
        { EXIT_REASON_PREEMPTION_TIMER,      "PREEMPTION_TIMER" }, \
+       { EXIT_REASON_INVVPID,               "INVVPID" }, \
        { EXIT_REASON_WBINVD,                "WBINVD" }, \
+       { EXIT_REASON_XSETBV,                "XSETBV" }, \
        { EXIT_REASON_APIC_WRITE,            "APIC_WRITE" }, \
-       { EXIT_REASON_EOI_INDUCED,           "EOI_INDUCED" }, \
-       { EXIT_REASON_INVALID_STATE,         "INVALID_STATE" }, \
-       { EXIT_REASON_MSR_LOAD_FAIL,         "MSR_LOAD_FAIL" }, \
-       { EXIT_REASON_INVD,                  "INVD" }, \
-       { EXIT_REASON_INVVPID,               "INVVPID" }, \
+       { EXIT_REASON_RDRAND,                "RDRAND" }, \
        { EXIT_REASON_INVPCID,               "INVPCID" }, \
+       { EXIT_REASON_VMFUNC,                "VMFUNC" }, \
+       { EXIT_REASON_ENCLS,                 "ENCLS" }, \
+       { EXIT_REASON_RDSEED,                "RDSEED" }, \
+       { EXIT_REASON_PML_FULL,              "PML_FULL" }, \
        { EXIT_REASON_XSAVES,                "XSAVES" }, \
        { EXIT_REASON_XRSTORS,               "XRSTORS" }
 
index 390d7c9685fd6107c83be2296ead9cb198b571a3..4ce25d43e8e305df8afcfc6fb1747a58fad20c1b 100644 (file)
                .off   = OFF,                                   \
                .imm   = IMM })
 
+/* Unconditional jumps, goto pc + off16 */
+
+#define BPF_JMP_A(OFF)                                         \
+       ((struct bpf_insn) {                                    \
+               .code  = BPF_JMP | BPF_JA,                      \
+               .dst_reg = 0,                                   \
+               .src_reg = 0,                                   \
+               .off   = OFF,                                   \
+               .imm   = 0 })
+
 /* Function call */
 
 #define BPF_EMIT_CALL(FUNC)                                    \
index d538897b8e08bb4358c56148c189fc7b8128a9da..17b10304c393355da9ed2da743107a5c59748290 100644 (file)
  * tv_sec holds the number of seconds before (negative) or after (positive)
  * 00:00:00 1st January 1970 UTC.
  *
- * tv_nsec holds a number of nanoseconds before (0..-999,999,999 if tv_sec is
- * negative) or after (0..999,999,999 if tv_sec is positive) the tv_sec time.
- *
- * Note that if both tv_sec and tv_nsec are non-zero, then the two values must
- * either be both positive or both negative.
+ * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time.
  *
  * __reserved is held in case we need a yet finer resolution.
  */
 struct statx_timestamp {
        __s64   tv_sec;
-       __s32   tv_nsec;
+       __u32   tv_nsec;
        __s32   __reserved;
 };
 
index cb0eda3925e6d8562da9d3091147c5fca602ebbf..3517e204a2b30754e430213c41b1d48e51d9b52c 100644 (file)
@@ -311,6 +311,10 @@ include::itrace.txt[]
        Set the maximum number of program blocks to print with brstackasm for
        each sample.
 
+--inline::
+       If a callgraph address belongs to an inlined function, the inline stack
+       will be printed. Each entry has function name and file/line.
+
 SEE ALSO
 --------
 linkperf:perf-record[1], linkperf:perf-script-perl[1],
index d05aec491cff22189d7fe763120884a639cd2cfb..4761b0d7fcb5b2586e7fd86c1ed8b219d0cec987 100644 (file)
@@ -2494,6 +2494,8 @@ int cmd_script(int argc, const char **argv)
                        "Enable kernel symbol demangling"),
        OPT_STRING(0, "time", &script.time_str, "str",
                   "Time span of interest (start,stop)"),
+       OPT_BOOLEAN(0, "inline", &symbol_conf.inline_name,
+                   "Show inline function"),
        OPT_END()
        };
        const char * const script_subcommands[] = { "record", "report", NULL };
index 59addd52d9cd51ab2d8789989a9d377d2ce23eb5..ddb2c6fbdf919e8124ffb40eee47c801b43bd6c6 100644 (file)
@@ -210,6 +210,8 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b,
                        return 0;
 
                ret = b->callchain->max_depth - a->callchain->max_depth;
+               if (callchain_param.order == ORDER_CALLER)
+                       ret = -ret;
        }
        return ret;
 }
index 81fc29ac798facf789712d81147eacda0c01552d..b4204b43ed58a83c9530ae3b75df4c01004b442e 100644 (file)
@@ -621,14 +621,19 @@ enum match_result {
 static enum match_result match_chain_srcline(struct callchain_cursor_node *node,
                                             struct callchain_list *cnode)
 {
-       char *left = get_srcline(cnode->ms.map->dso,
+       char *left = NULL;
+       char *right = NULL;
+       enum match_result ret = MATCH_EQ;
+       int cmp;
+
+       if (cnode->ms.map)
+               left = get_srcline(cnode->ms.map->dso,
                                 map__rip_2objdump(cnode->ms.map, cnode->ip),
                                 cnode->ms.sym, true, false);
-       char *right = get_srcline(node->map->dso,
+       if (node->map)
+               right = get_srcline(node->map->dso,
                                  map__rip_2objdump(node->map, node->ip),
                                  node->sym, true, false);
-       enum match_result ret = MATCH_EQ;
-       int cmp;
 
        if (left && right)
                cmp = strcmp(left, right);
index e415aee6a24520f3c88e9ce70d621b39109896b6..583f3a602506f29f198d7153b8ad8ee8073a6fd9 100644 (file)
@@ -7,6 +7,7 @@
 #include "map.h"
 #include "strlist.h"
 #include "symbol.h"
+#include "srcline.h"
 
 static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...)
 {
@@ -168,6 +169,38 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
                        if (!print_oneline)
                                printed += fprintf(fp, "\n");
 
+                       if (symbol_conf.inline_name && node->map) {
+                               struct inline_node *inode;
+
+                               addr = map__rip_2objdump(node->map, node->ip),
+                               inode = dso__parse_addr_inlines(node->map->dso, addr);
+
+                               if (inode) {
+                                       struct inline_list *ilist;
+
+                                       list_for_each_entry(ilist, &inode->val, list) {
+                                               if (print_arrow)
+                                                       printed += fprintf(fp, " <-");
+
+                                               /* IP is same, just skip it */
+                                               if (print_ip)
+                                                       printed += fprintf(fp, "%c%16s",
+                                                                          s, "");
+                                               if (print_sym)
+                                                       printed += fprintf(fp, " %s",
+                                                                          ilist->funcname);
+                                               if (print_srcline)
+                                                       printed += fprintf(fp, "\n  %s:%d",
+                                                                          ilist->filename,
+                                                                          ilist->line_nr);
+                                               if (!print_oneline)
+                                                       printed += fprintf(fp, "\n");
+                                       }
+
+                                       inline_node__delete(inode);
+                               }
+                       }
+
                        if (symbol_conf.bt_stop_list &&
                            node->sym &&
                            strlist__has_entry(symbol_conf.bt_stop_list,
index df051a52393c1de8e85f46d43f567755888133e7..ebc88a74e67b7129cbbd6790c34f50dcefec0de1 100644 (file)
@@ -56,7 +56,10 @@ static int inline_list__append(char *filename, char *funcname, int line_nr,
                }
        }
 
-       list_add_tail(&ilist->list, &node->val);
+       if (callchain_param.order == ORDER_CALLEE)
+               list_add_tail(&ilist->list, &node->val);
+       else
+               list_add(&ilist->list, &node->val);
 
        return 0;
 }
@@ -200,12 +203,14 @@ static void addr2line_cleanup(struct a2l_data *a2l)
 
 #define MAX_INLINE_NEST 1024
 
-static void inline_list__reverse(struct inline_node *node)
+static int inline_list__append_dso_a2l(struct dso *dso,
+                                      struct inline_node *node)
 {
-       struct inline_list *ilist, *n;
+       struct a2l_data *a2l = dso->a2l;
+       char *funcname = a2l->funcname ? strdup(a2l->funcname) : NULL;
+       char *filename = a2l->filename ? strdup(a2l->filename) : NULL;
 
-       list_for_each_entry_safe_reverse(ilist, n, &node->val, list)
-               list_move_tail(&ilist->list, &node->val);
+       return inline_list__append(filename, funcname, a2l->line, node, dso);
 }
 
 static int addr2line(const char *dso_name, u64 addr,
@@ -230,36 +235,36 @@ static int addr2line(const char *dso_name, u64 addr,
 
        bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l);
 
-       if (a2l->found && unwind_inlines) {
+       if (!a2l->found)
+               return 0;
+
+       if (unwind_inlines) {
                int cnt = 0;
 
+               if (node && inline_list__append_dso_a2l(dso, node))
+                       return 0;
+
                while (bfd_find_inliner_info(a2l->abfd, &a2l->filename,
                                             &a2l->funcname, &a2l->line) &&
                       cnt++ < MAX_INLINE_NEST) {
 
                        if (node != NULL) {
-                               if (inline_list__append(strdup(a2l->filename),
-                                                       strdup(a2l->funcname),
-                                                       a2l->line, node,
-                                                       dso) != 0)
+                               if (inline_list__append_dso_a2l(dso, node))
                                        return 0;
+                               // found at least one inline frame
+                               ret = 1;
                        }
                }
+       }
 
-               if ((node != NULL) &&
-                   (callchain_param.order != ORDER_CALLEE)) {
-                       inline_list__reverse(node);
-               }
+       if (file) {
+               *file = a2l->filename ? strdup(a2l->filename) : NULL;
+               ret = *file ? 1 : 0;
        }
 
-       if (a2l->found && a2l->filename) {
-               *file = strdup(a2l->filename);
+       if (line)
                *line = a2l->line;
 
-               if (*file)
-                       ret = 1;
-       }
-
        return ret;
 }
 
@@ -278,8 +283,6 @@ void dso__free_a2l(struct dso *dso)
 static struct inline_node *addr2inlines(const char *dso_name, u64 addr,
        struct dso *dso)
 {
-       char *file = NULL;
-       unsigned int line = 0;
        struct inline_node *node;
 
        node = zalloc(sizeof(*node));
@@ -291,7 +294,7 @@ static struct inline_node *addr2inlines(const char *dso_name, u64 addr,
        INIT_LIST_HEAD(&node->val);
        node->addr = addr;
 
-       if (!addr2line(dso_name, addr, &file, &line, dso, TRUE, node))
+       if (!addr2line(dso_name, addr, NULL, NULL, dso, TRUE, node))
                goto out_free_inline_node;
 
        if (list_empty(&node->val))
index f90e11a555b208302f9dd2a4163d73051e0d2f47..943a06291587b064c3649569dd85b356805a7fab 100644 (file)
@@ -168,12 +168,16 @@ frame_callback(Dwfl_Frame *state, void *arg)
 {
        struct unwind_info *ui = arg;
        Dwarf_Addr pc;
+       bool isactivation;
 
-       if (!dwfl_frame_pc(state, &pc, NULL)) {
+       if (!dwfl_frame_pc(state, &pc, &isactivation)) {
                pr_err("%s", dwfl_errmsg(-1));
                return DWARF_CB_ABORT;
        }
 
+       if (!isactivation)
+               --pc;
+
        return entry(pc, ui) || !(--ui->max_stack) ?
               DWARF_CB_ABORT : DWARF_CB_OK;
 }
index f8455bed6e653705183b878c40d294991edf4e92..672c2ada9357a25054b4b1ba7eeec643505984e2 100644 (file)
@@ -692,6 +692,17 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
 
                while (!ret && (unw_step(&c) > 0) && i < max_stack) {
                        unw_get_reg(&c, UNW_REG_IP, &ips[i]);
+
+                       /*
+                        * Decrement the IP for any non-activation frames.
+                        * this is required to properly find the srcline
+                        * for caller frames.
+                        * See also the documentation for dwfl_frame_pc(),
+                        * which this code tries to replicate.
+                        */
+                       if (unw_is_signal_frame(&c) <= 0)
+                               --ips[i];
+
                        ++i;
                }
 
diff --git a/tools/power/acpi/.gitignore b/tools/power/acpi/.gitignore
new file mode 100644 (file)
index 0000000..cba3d99
--- /dev/null
@@ -0,0 +1,4 @@
+acpidbg
+acpidump
+ec
+include
index 3773562056da267aee91878ed8088b3c577a997e..cabb19b1e3718b289910fcc921c698f44f162768 100644 (file)
@@ -49,6 +49,7 @@
 #define MAX_NR_MAPS    4
 
 #define F_NEEDS_EFFICIENT_UNALIGNED_ACCESS     (1 << 0)
+#define F_LOAD_WITH_STRICT_ALIGNMENT           (1 << 1)
 
 struct bpf_test {
        const char *descr;
@@ -2614,6 +2615,30 @@ static struct bpf_test tests[] = {
                .result = REJECT,
                .prog_type = BPF_PROG_TYPE_SCHED_CLS,
        },
+       {
+               "direct packet access: test17 (pruning, alignment)",
+               .insns = {
+                       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
+                                   offsetof(struct __sk_buff, data)),
+                       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
+                                   offsetof(struct __sk_buff, data_end)),
+                       BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_1,
+                                   offsetof(struct __sk_buff, mark)),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 14),
+                       BPF_JMP_IMM(BPF_JGT, BPF_REG_7, 1, 4),
+                       BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
+                       BPF_STX_MEM(BPF_W, BPF_REG_0, BPF_REG_0, -4),
+                       BPF_MOV64_IMM(BPF_REG_0, 0),
+                       BPF_EXIT_INSN(),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
+                       BPF_JMP_A(-6),
+               },
+               .errstr = "misaligned packet access off 2+15+-4 size 4",
+               .result = REJECT,
+               .prog_type = BPF_PROG_TYPE_SCHED_CLS,
+               .flags = F_LOAD_WITH_STRICT_ALIGNMENT,
+       },
        {
                "helper access to packet: test1, valid packet_ptr range",
                .insns = {
@@ -3340,6 +3365,70 @@ static struct bpf_test tests[] = {
                .result = ACCEPT,
                .prog_type = BPF_PROG_TYPE_SCHED_CLS
        },
+       {
+               "alu ops on ptr_to_map_value_or_null, 1",
+               .insns = {
+                       BPF_MOV64_IMM(BPF_REG_1, 10),
+                       BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_1, -8),
+                       BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
+                       BPF_LD_MAP_FD(BPF_REG_1, 0),
+                       BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+                                    BPF_FUNC_map_lookup_elem),
+                       BPF_MOV64_REG(BPF_REG_4, BPF_REG_0),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, -2),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 2),
+                       BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
+                       BPF_ST_MEM(BPF_DW, BPF_REG_4, 0, 0),
+                       BPF_EXIT_INSN(),
+               },
+               .fixup_map1 = { 4 },
+               .errstr = "R4 invalid mem access",
+               .result = REJECT,
+               .prog_type = BPF_PROG_TYPE_SCHED_CLS
+       },
+       {
+               "alu ops on ptr_to_map_value_or_null, 2",
+               .insns = {
+                       BPF_MOV64_IMM(BPF_REG_1, 10),
+                       BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_1, -8),
+                       BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
+                       BPF_LD_MAP_FD(BPF_REG_1, 0),
+                       BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+                                    BPF_FUNC_map_lookup_elem),
+                       BPF_MOV64_REG(BPF_REG_4, BPF_REG_0),
+                       BPF_ALU64_IMM(BPF_AND, BPF_REG_4, -1),
+                       BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
+                       BPF_ST_MEM(BPF_DW, BPF_REG_4, 0, 0),
+                       BPF_EXIT_INSN(),
+               },
+               .fixup_map1 = { 4 },
+               .errstr = "R4 invalid mem access",
+               .result = REJECT,
+               .prog_type = BPF_PROG_TYPE_SCHED_CLS
+       },
+       {
+               "alu ops on ptr_to_map_value_or_null, 3",
+               .insns = {
+                       BPF_MOV64_IMM(BPF_REG_1, 10),
+                       BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_1, -8),
+                       BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
+                       BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
+                       BPF_LD_MAP_FD(BPF_REG_1, 0),
+                       BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
+                                    BPF_FUNC_map_lookup_elem),
+                       BPF_MOV64_REG(BPF_REG_4, BPF_REG_0),
+                       BPF_ALU64_IMM(BPF_LSH, BPF_REG_4, 1),
+                       BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
+                       BPF_ST_MEM(BPF_DW, BPF_REG_4, 0, 0),
+                       BPF_EXIT_INSN(),
+               },
+               .fixup_map1 = { 4 },
+               .errstr = "R4 invalid mem access",
+               .result = REJECT,
+               .prog_type = BPF_PROG_TYPE_SCHED_CLS
+       },
        {
                "invalid memory access with multiple map_lookup_elem calls",
                .insns = {
@@ -4937,7 +5026,149 @@ static struct bpf_test tests[] = {
                .fixup_map_in_map = { 3 },
                .errstr = "R1 type=map_value_or_null expected=map_ptr",
                .result = REJECT,
-       }
+       },
+       {
+               "ld_abs: check calling conv, r1",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_1, 0),
+                       BPF_LD_ABS(BPF_W, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_1),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R1 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_abs: check calling conv, r2",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_2, 0),
+                       BPF_LD_ABS(BPF_W, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R2 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_abs: check calling conv, r3",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_3, 0),
+                       BPF_LD_ABS(BPF_W, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_3),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R3 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_abs: check calling conv, r4",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_4, 0),
+                       BPF_LD_ABS(BPF_W, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_4),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R4 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_abs: check calling conv, r5",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_5, 0),
+                       BPF_LD_ABS(BPF_W, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_5),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R5 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_abs: check calling conv, r7",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_7, 0),
+                       BPF_LD_ABS(BPF_W, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_7),
+                       BPF_EXIT_INSN(),
+               },
+               .result = ACCEPT,
+       },
+       {
+               "ld_ind: check calling conv, r1",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_1, 1),
+                       BPF_LD_IND(BPF_W, BPF_REG_1, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_1),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R1 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_ind: check calling conv, r2",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_2, 1),
+                       BPF_LD_IND(BPF_W, BPF_REG_2, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R2 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_ind: check calling conv, r3",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_3, 1),
+                       BPF_LD_IND(BPF_W, BPF_REG_3, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_3),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R3 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_ind: check calling conv, r4",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_4, 1),
+                       BPF_LD_IND(BPF_W, BPF_REG_4, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_4),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R4 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_ind: check calling conv, r5",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_5, 1),
+                       BPF_LD_IND(BPF_W, BPF_REG_5, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_5),
+                       BPF_EXIT_INSN(),
+               },
+               .errstr = "R5 !read_ok",
+               .result = REJECT,
+       },
+       {
+               "ld_ind: check calling conv, r7",
+               .insns = {
+                       BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
+                       BPF_MOV64_IMM(BPF_REG_7, 1),
+                       BPF_LD_IND(BPF_W, BPF_REG_7, -0x200000),
+                       BPF_MOV64_REG(BPF_REG_0, BPF_REG_7),
+                       BPF_EXIT_INSN(),
+               },
+               .result = ACCEPT,
+       },
 };
 
 static int probe_filter_length(const struct bpf_insn *fp)
@@ -5059,9 +5290,9 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
 
        do_test_fixup(test, prog, map_fds);
 
-       fd_prog = bpf_load_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER,
-                                  prog, prog_len, "GPL", 0, bpf_vlog,
-                                  sizeof(bpf_vlog));
+       fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER,
+                                    prog, prog_len, test->flags & F_LOAD_WITH_STRICT_ALIGNMENT,
+                                    "GPL", 0, bpf_vlog, sizeof(bpf_vlog));
 
        expected_ret = unpriv && test->result_unpriv != UNDEF ?
                       test->result_unpriv : test->result;
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
new file mode 100644 (file)
index 0000000..f4d1ff7
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# description: Register/unregister many kprobe events
+
+# ftrace fentry skip size depends on the machine architecture.
+# Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc
+case `uname -m` in
+  x86_64|i[3456]86) OFFS=5;;
+  ppc*) OFFS=4;;
+  *) OFFS=0;;
+esac
+
+echo "Setup up to 256 kprobes"
+grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
+head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
+
+echo 1 > events/kprobes/enable
+echo 0 > events/kprobes/enable
+echo > kprobe_events
+echo "Waiting for unoptimizing & freeing"
+sleep 5
+echo "Done"
index d9c49f41515e704994ed1669dbe0a859a6dadd79..e79ccd6aada1a9acf10bb2860e76ddb444415d52 100644 (file)
@@ -42,12 +42,12 @@ int test_body(void)
        printf("Check DSCR TM context switch: ");
        fflush(stdout);
        for (;;) {
-               rv = 1;
                asm __volatile__ (
                        /* set a known value into the DSCR */
                        "ld      3, %[dscr1];"
                        "mtspr   %[sprn_dscr], 3;"
 
+                       "li      %[rv], 1;"
                        /* start and suspend a transaction */
                        "tbegin.;"
                        "beq     1f;"